Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

single-spa

Package Overview
Dependencies
Maintainers
0
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

single-spa - npm Package Compare versions

Comparing version 7.0.0-beta.0 to 7.0.0-beta.1

lib/esm/single-spa.d.ts

56

lib/esm/single-spa.dev.js

@@ -1,2 +0,2 @@

/* single-spa@7.0.0-beta.0 - ESM - dev */
/* single-spa@7.0.0-beta.1 - ESM - dev */
var singleSpa = /*#__PURE__*/Object.freeze({

@@ -158,3 +158,2 @@ __proto__: null,

singleSpaErr.appOrParcelName = toName(appOrParcel);
// We set the status after transforming the error so that the error message

@@ -167,3 +166,4 @@ // references the state the application was in before the status change.

// App statuses
let AppOrParcelStatus = /*#__PURE__*/function (AppOrParcelStatus) {
var AppOrParcelStatus;
(function (AppOrParcelStatus) {
AppOrParcelStatus["NOT_LOADED"] = "NOT_LOADED";

@@ -181,4 +181,3 @@ AppOrParcelStatus["LOADING_SOURCE_CODE"] = "LOADING_SOURCE_CODE";

AppOrParcelStatus["SKIP_BECAUSE_BROKEN"] = "SKIP_BECAUSE_BROKEN";
return AppOrParcelStatus;
}({});
})(AppOrParcelStatus || (AppOrParcelStatus = {}));
const NOT_LOADED = AppOrParcelStatus.NOT_LOADED;

@@ -217,4 +216,2 @@ const LOADING_SOURCE_CODE = AppOrParcelStatus.LOADING_SOURCE_CODE;

// https://github.com/single-spa/single-spa-inspector/blob/ac3e1ded68e94239dd02d04f8a094ed8e6dfefc2/src/inspected-window-helpers/overlay-helpers.js#L53
function validLifecycleFn(fn) {

@@ -246,4 +243,2 @@ return fn && (typeof fn === "function" || isArrayOfFns(fn));

// Intended for internal use only
let profileEntries = [];

@@ -427,3 +422,2 @@ function getProfilerData() {

};
// This is a public api, exported to users of single-spa

@@ -435,3 +429,2 @@ function mountRootParcel(config, customProps) {

const owningAppOrParcel = this;
// Validate inputs

@@ -454,3 +447,2 @@ if (!config || typeof config !== "object" && typeof config !== "function") {

const configLoadingFunction = passedConfigLoadingFunction ? config : () => Promise.resolve(config);
// Internal representation

@@ -520,3 +512,2 @@ const parcel = {

const fullParcel = parcel;
// Add to owning app or parcel

@@ -526,3 +517,2 @@ owningAppOrParcel.parcels[id] = fullParcel;

});
// Start bootstrapping and mounting

@@ -543,3 +533,2 @@ // The .then() causes the work to be put on the event loop instead of happening immediately

}
// Add to owning app or parcel

@@ -705,5 +694,6 @@ owningAppOrParcel.parcels[id] = parcel;

function ensureValidAppTimeouts(timeouts) {
var _a;
const result = {};
for (let key in globalTimeoutConfig) {
result[key] = Object.assign({}, globalTimeoutConfig[key], timeouts?.[key] ?? {});
result[key] = Object.assign({}, globalTimeoutConfig[key], (_a = timeouts === null || timeouts === void 0 ? void 0 : timeouts[key]) !== null && _a !== void 0 ? _a : {});
}

@@ -769,3 +759,3 @@ return result;

appOptsStr = JSON.stringify(lifecycles);
} catch {}
} catch (_a) {}
console.error(formatErrorMessage(validationErrCode, `The loading function for single-spa application '${toName(appBeingLoaded)}' resolved with the following, which does not have bootstrap, mount, and unmount functions`, "application", toName(appBeingLoaded), appOptsStr), lifecycles);

@@ -897,3 +887,2 @@ handleAppError(validationErrMessage, appBeingLoaded, SKIP_BECAUSE_BROKEN);

let historyApiIsPatched = false;
// We patch the history API so single-spa is notified of all calls to pushState/replaceState.

@@ -906,13 +895,10 @@ // We patch addEventListener/removeEventListener so we can capture all popstate/hashchange event listeners,

}
// True by default, as a performance optimization that reduces
// the number of extraneous popstate events
urlRerouteOnly = opts?.hasOwnProperty("urlRerouteOnly") ? opts.urlRerouteOnly : true;
urlRerouteOnly = (opts === null || opts === void 0 ? void 0 : opts.hasOwnProperty("urlRerouteOnly")) ? opts.urlRerouteOnly : true;
historyApiIsPatched = true;
originalReplaceState = window.history.replaceState;
// We will trigger an app change for any routing events.
window.addEventListener("hashchange", urlReroute);
window.addEventListener("popstate", urlReroute);
// Patch addEventListener so that we can ensure correct timing

@@ -941,3 +927,2 @@ const originalAddEventListener = window.addEventListener;

}
// Detect if single-spa has already been loaded on the page.

@@ -960,3 +945,4 @@ // If so, warn because this can result in lots of problems, including

function ensureJQuerySupport(jQuery = window.jQuery) {
if (!jQuery && window?.$?.fn?.jquery) {
var _a, _b;
if (!jQuery && ((_b = (_a = window === null || window === void 0 ? void 0 : window.$) === null || _a === void 0 ? void 0 : _a.fn) === null || _b === void 0 ? void 0 : _b.jquery)) {
jQuery = window.$;

@@ -1044,3 +1030,2 @@ }

delete appsToUnload[toName(app)];
// Unloaded apps don't have lifecycles

@@ -1052,3 +1037,2 @@ delete app.bootstrap;

app.status = NOT_LOADED;
/* resolve the promise of whoever called unloadApplication.

@@ -1061,3 +1045,2 @@ * This should be done after all other cleanup/bookkeeping

delete appsToUnload[toName(app)];
// Unloaded apps don't have lifecycles

@@ -1091,3 +1074,2 @@ delete app.bootstrap;

appsToMount = [];
// We re-attempt to download applications in LOAD_ERROR after a timeout of 200 milliseconds

@@ -1138,3 +1120,2 @@ const currentTime = new Date().getTime();

}
// used in devtools, not (currently) exposed as a single-spa API

@@ -1204,5 +1185,4 @@ function getRawAppData() {

const appUnloadInfo = getAppUnloadInfo(toName(app));
if (opts?.waitForUnmount) {
if (opts === null || opts === void 0 ? void 0 : opts.waitForUnmount) {
// We need to wait for unmount before unloading the app
if (appUnloadInfo) {

@@ -1221,3 +1201,2 @@ // Someone else is already waiting for this, too

*/
let resultPromise;

@@ -1417,7 +1396,6 @@ if (appUnloadInfo) {

function cancelNavigation(val = true) {
const promise = typeof val?.then === "function" ? val : Promise.resolve(val);
const promise = typeof (val === null || val === void 0 ? void 0 : val.then) === "function" ? val : Promise.resolve(val);
cancelPromises.push(promise.catch(err => {
console.warn(Error(formatErrorMessage(42, `single-spa: A cancelNavigation promise rejected with the following value: ${err}`)));
console.warn(err);
// Interpret a Promise rejection to mean that the navigation should not be canceled

@@ -1463,6 +1441,4 @@ return false;

originalReplaceState.call(window.history, history.state, "", oldUrl.substring(location.origin.length));
// Single-spa's internal tracking of current url needs to be updated after the url change above
currentUrl = location.href;
// necessary for the reroute function to know that the current reroute is finished

@@ -1473,3 +1449,2 @@ appChangeUnderway = false;

}
// Tell single-spa to reroute again, this time with the url set to the old URL

@@ -1495,3 +1470,2 @@ return reroute(pendingPromises, eventArguments, true);

});
/* We load and bootstrap apps while other apps are unmounting, but we

@@ -1503,3 +1477,2 @@ * wait to mount the app until all apps are finishing unmounting

});
/* These are the apps that are already bootstrapped and just need

@@ -1554,3 +1527,2 @@ * to be mounted. They each wait for all unmounting apps to finish up

}
/* Setting this allows for subsequent calls to reroute() to actually perform

@@ -1572,3 +1544,2 @@ * a reroute instead of just getting queued behind the current reroute call.

}
/* We need to call all event listeners that have been delayed because they were

@@ -1622,3 +1593,3 @@ * waiting on single-spa. This includes haschange and popstate events for both

totalAppChanges: appsThatChanged.length,
originalEvent: eventArguments?.[0],
originalEvent: eventArguments === null || eventArguments === void 0 ? void 0 : eventArguments[0],
oldUrl,

@@ -1648,3 +1619,2 @@ newUrl

}
/**

@@ -1651,0 +1621,0 @@ * Let's imagine that some kind of delay occurred during application loading.

@@ -1,3 +0,3 @@

/* single-spa@7.0.0-beta.0 - ESM - prod */
var t,e,n=Object.freeze({__proto__:null,get BOOTSTRAPPING(){return w},get LOADING_SOURCE_CODE(){return m},get LOAD_ERROR(){return P},get MOUNTED(){return O},get MOUNTING(){return E},get NOT_BOOTSTRAPPED(){return d},get NOT_LOADED(){return h},get NOT_MOUNTED(){return g},get SKIP_BECAUSE_BROKEN(){return N},get UNLOADING(){return v},get UNMOUNTING(){return T},get UPDATING(){return y},get addErrorHandler(){return a},get checkActivityFunctions(){return bt},get ensureJQuerySupport(){return pt},get getAppNames(){return Tt},get getAppStatus(){return vt},get getMountedApps(){return yt},get mountRootParcel(){return W},get navigateToUrl(){return rt},get patchHistoryApi(){return lt},get pathToActiveWhen(){return Rt},get registerApplication(){return Nt},get removeErrorHandler(){return c},get setBootstrapMaxTime(){return Q},get setMountMaxTime(){return V},get setUnloadMaxTime(){return z},get setUnmountMaxTime(){return q},get start(){return xt},get triggerAppChange(){return Gt},get unloadApplication(){return _t},get unregisterApplication(){return At}}),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=o(function(){if(e)return t;e=1;var n=r.CustomEvent;return t=function(){try{var t=new n("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?n:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var n=document.createEvent("CustomEvent");return e?n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):n.initCustomEvent(t,!1,!1,void 0),n}:function(t,e){var n=document.createEventObject();return n.type=t,e?(n.bubbles=Boolean(e.bubbles),n.cancelable=Boolean(e.cancelable),n.detail=e.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}}());let s=[];function u(t,e,n){const r=f(t,e,n);s.length?s.forEach((t=>t(r))):setTimeout((()=>{throw r}))}function a(t){if("function"!=typeof t)throw Error(l(28));s.push(t)}function c(t){if("function"!=typeof t)throw Error(l(29));let e=!1;return s=s.filter((n=>{const r=n===t;return e=e||r,!r})),e}function l(t,e,...n){return`single-spa minified message #${t}: See https://single-spa.js.org/error/?code=${t}${n.length?`&arg=${n.join("&arg=")}`:""}`}function f(t,e,n){const r=`${U(e)} '${_(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=r+t.message}catch(t){}o=t}else{console.warn(l(30,0,e.status,_(e)));try{o=Error(r+JSON.stringify(t))}catch(e){o=t}}const i=o;return i.appOrParcelName=_(e),e.status=n,i}let p=function(t){return t.NOT_LOADED="NOT_LOADED",t.LOADING_SOURCE_CODE="LOADING_SOURCE_CODE",t.NOT_BOOTSTRAPPED="NOT_BOOTSTRAPPED",t.BOOTSTRAPPING="BOOTSTRAPPING",t.NOT_MOUNTED="NOT_MOUNTED",t.MOUNTING="MOUNTING",t.MOUNTED="MOUNTED",t.UPDATING="UPDATING",t.UNMOUNTING="UNMOUNTING",t.UNLOADING="UNLOADING",t.LOAD_ERROR="LOAD_ERROR",t.SKIP_BECAUSE_BROKEN="SKIP_BECAUSE_BROKEN",t}({});const h=p.NOT_LOADED,m=p.LOADING_SOURCE_CODE,d=p.NOT_BOOTSTRAPPED,w=p.BOOTSTRAPPING,g=p.NOT_MOUNTED,E=p.MOUNTING,O=p.MOUNTED,y=p.UPDATING,T=p.UNMOUNTING,v=p.UNLOADING,P=p.LOAD_ERROR,N=p.SKIP_BECAUSE_BROKEN;function b(t){return t.status===O}function A(t){try{return t.activeWhen(window.location)}catch(e){return u(e,t,N),!1}}function _(t){return t.name}function D(t){return Boolean(t.unmountThisParcel)}function U(t){return D(t)?"parcel":"application"}function S(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!e.find((t=>"function"!=typeof t))));var e}function M(t,e,n){let r=Array.isArray(t[e])?t[e]:[t[e]].filter(Boolean);0===r.length&&(r=[()=>Promise.resolve()]);const o=n?"parcel":"application",i=_(t);return function(t){return r.reduce(((n,r,s)=>n.then((()=>{const n=r(t);return R(n)?n:Promise.reject(l(15,0,o,i,e,s))}))),Promise.resolve())}}function R(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}let L=[];function j(t,e){return Promise.resolve().then((()=>t.status!==d?t:(t.status=w,t.bootstrap?X(t,"bootstrap").then(n).catch((n=>{if(e)throw f(n,t,N);return u(n,t,N),t})):Promise.resolve().then(n))));function n(){return t.status=g,t}}function I(t,e){return Promise.resolve().then((()=>{if(t.status!==O)return t;t.status=T;const n=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(n).then(r,(n=>r().then((()=>{const r=Error(n.message);if(e)throw f(r,t,N);u(r,t,N)})))).then((()=>t));function r(){return X(t,"unmount").then((()=>{t.status=g}),(n=>{if(e)throw f(n,t,N);u(n,t,N)}))}}))}let G=!1,B=!1;function $(t,e){return Promise.resolve().then((()=>t.status!==g?t:(G||(window.dispatchEvent(new i("single-spa:before-first-mount")),G=!0),t.status=E,X(t,"mount").then((()=>(t.status=O,B||(window.dispatchEvent(new i("single-spa:first-mount")),B=!0),t))).catch((n=>{return t.status=O,I(t,!0).then(r,r);function r(){if(e)throw f(n,t,N);return u(n,t,N),t}})))))}let C=0;const x={name:"rootParcels",parcels:{}};function W(t,e){return K.call(x,t,e)}function K(t,e){const n=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(l(2));if(t.name&&"string"!=typeof t.name)throw Error(l(3,0,typeof t.name));const r=C++;let o=t.name||`parcel-${r}`;if("object"!=typeof e)throw Error(l(4,0,o,typeof e));if(!e.domElement)throw Error(l(5,0,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),u={id:r,parcels:{},status:i?m:d,customProps:e,parentName:_(n),unmountThisParcel:()=>p.then((()=>{if(u.status!==O)throw Error(l(6,0,o,u.status));return I(u,!0)})).then((t=>(u.parentName&&delete n.parcels[u.id],t))).then((t=>(h(t),t))).catch((t=>{throw u.status=N,w(t),t}))};let a=s();if(!a||"function"!=typeof a.then)throw Error(l(7));a=a.then((t=>{if(!t)throw Error(l(8));if(o=t.name||`parcel-${r}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!S(t.bootstrap))throw Error(l(9,0,o));if(!S(t.mount))throw Error(l(10,0,o));if(!S(t.unmount))throw Error(l(11,0,o));if(t.update&&!S(t.update))throw Error(l(12,0,o));const e=M(t,"bootstrap",!0),i=M(t,"mount",!0),s=M(t,"unmount",!0);u.status=d,u.name=o,u.bootstrap=e,u.mount=i,u.unmount=s,u.timeouts=Y(t.timeouts),t.update&&(u.update=M(t,"update",!0));const a=u;return n.parcels[r]=a,t}));const c=a.then((()=>j(u,!0))),p=c.then((()=>$(u,!0)));let h,w;const E=new Promise(((t,e)=>{h=t,w=e}));let T={mount:()=>k(Promise.resolve().then((()=>{if(u.status!==g)throw Error(l(13,0,o,u.status));return n.parcels[r]=u,$(u)}))),unmount:()=>k(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:k(a),bootstrapPromise:k(c),mountPromise:k(p),unmountPromise:k(E),_parcel:u};return a.then((t=>{t.update&&(T.update=function(t){return u.customProps=t,k((e=u,Promise.resolve().then((()=>{if(e.status!==O)throw Error(l(32,0,_(e)));return e.status=y,X(e,"update").then((()=>(e.status=O,e))).catch((t=>{throw f(t,e,N)}))}))));var e})}),(()=>{})),T}function k(t){return t.then((()=>null))}function F(t){const e=_(t);let r="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(l(40),e,r));const o=Object.assign({},r,{name:e,mountParcel:K.bind(t),singleSpa:n});return D(t)&&(o.unmountSelf=t.unmountThisParcel),o}const H=1e3,J={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:H},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:H},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:H},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:H},update:{millis:3e3,dieOnTimeout:!1,warningMillis:H}};function Q(t,e,n){if("number"!=typeof t||t<=0)throw Error(l(16));J.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||H}}function V(t,e,n){if("number"!=typeof t||t<=0)throw Error(l(17));J.mount={millis:t,dieOnTimeout:e,warningMillis:n||H}}function q(t,e,n){if("number"!=typeof t||t<=0)throw Error(l(18));J.unmount={millis:t,dieOnTimeout:e,warningMillis:n||H}}function z(t,e,n){if("number"!=typeof t||t<=0)throw Error(l(19));J.unload={millis:t,dieOnTimeout:e,warningMillis:n||H}}function X(t,e){const n=t.timeouts[e],r=n.warningMillis,o=U(t);return new Promise(((i,s)=>{let u=!1,a=!1;t[e](F(t)).then((t=>{u=!0,i(t)})).catch((t=>{u=!0,s(t)})),setTimeout((()=>f(1)),r),setTimeout((()=>f(!0)),n.millis);const c=l(31,0,e,o,_(t),n.millis);function f(t){if(!u)if(!0===t)a=!0,n.dieOnTimeout?s(Error(c)):console.error(c);else if(!a){const e=t,o=e*r;console.warn(c),o+r<n.millis&&setTimeout((()=>f(e+1)),r)}}}))}function Y(t){const e={};for(let n in J)e[n]=Object.assign({},J[n],t?.[n]??{});return e}function Z(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==h&&t.status!==P)return t;const e=t;let n,r;return e.status=m,e.loadPromise=Promise.resolve().then((()=>{const o=e.loadApp(F(t));if(!R(o))throw r=!0,Error(l(33,0,_(e)));return o.then((r=>{let o;if(e.loadErrorTime=null,n=r,"object"!=typeof n&&(o=34),Object.prototype.hasOwnProperty.call(n,"bootstrap")&&!S(n.bootstrap)&&(o=35),S(n.mount)||(o=36),S(n.unmount)||(o=37),o){let t;try{t=JSON.stringify(n)}catch{}return console.error(l(o,0,"application",_(e),t),n),u(void 0,e,N),e}return n.devtools&&n.devtools.overlays&&(e.devtools.overlays=Object.assign({},t.devtools.overlays,n.devtools.overlays)),e.status=d,e.bootstrap=M(n,"bootstrap",!1),e.mount=M(n,"mount",!1),e.unmount=M(n,"unmount",!1),e.unload=M(n,"unload",!1),e.timeouts=Y(n.timeouts),delete e.loadPromise,e}))})).catch((t=>{let n;return delete e.loadPromise,r?n=N:(n=P,e.loadErrorTime=(new Date).getTime()),u(t,e,n),e}))}))}const tt="undefined"!=typeof window,et={hashchange:[],popstate:[]},nt=["hashchange","popstate"];function rt(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&"currentTarget"in t&&"href"in t.currentTarget&&"preventDefault"in t))throw Error(l(14));e=t.currentTarget.href,t.preventDefault()}const n=new URL(window.location.href),r=new URL(e,window.location.href);0===e.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=e:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,e)}function ot(t){if(t){const e=t[0].type;nt.indexOf(e)>=0&&et[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let it;function st(t){Bt([],[t])}function ut(t,e){return function(){const n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return it&&n===o||window.dispatchEvent(function(t,e){let n=new PopStateEvent("popstate",{state:t});return n.singleSpa=!0,n.singleSpaTrigger=e,n}(window.history.state,e)),r}}let at=null,ct=!1;function lt(t){if(ct)throw Error(l(43));it=!t?.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,ct=!0,at=window.history.replaceState,window.addEventListener("hashchange",st),window.addEventListener("popstate",st);const e=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&nt.indexOf(t)>=0)||et[t].find((t=>t===n)))return e.apply(this,arguments);et[t].push(n)},window.removeEventListener=function(t,e){return"function"==typeof e&&nt.includes(t)&&(et[t]=et[t].filter((t=>t!==e))),n.apply(this,arguments)},window.history.pushState=ut(window.history.pushState,"pushState"),window.history.replaceState=ut(at,"replaceState")}tt&&(window.singleSpaNavigate?console.warn(l(41)):window.singleSpaNavigate=rt);let ft=!1;function pt(t=window.jQuery){if(!t&&window?.$?.fn?.jquery&&(t=window.$),t&&!ft){const e=t.fn.on,n=t.fn.off;t.fn.on=function(t,n){return ht.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return ht.call(this,n,window.removeEventListener,t,e,arguments)},ft=!0}}function ht(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((t=>{nt.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}const mt={};function dt(t){return Promise.resolve().then((()=>{const e=mt[_(t)];if(!e)return t;if(t.status===h)return wt(t,e),t;if(t.status===v)return e.promise.then((()=>t));if(t.status!==g&&t.status!==P&&t.status!==N)return t;const n=t.unload?X(t,"unload"):Promise.resolve();return t.status=v,n.then((()=>(wt(t,e),t))).catch((n=>(function(t,e,n){delete mt[_(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,u(n,t,N),e.reject(n)}(t,e,n),t)))}))}function wt(t,e){delete mt[_(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=h,e.resolve()}function gt(t,e,n,r){mt[_(t)]={app:t,resolve:n,reject:r},Object.defineProperty(mt[_(t)],"promise",{get:e})}function Et(t){return mt[t]}const Ot=[];function yt(){return Ot.filter(b).map(_)}function Tt(){return Ot.map(_)}function vt(t){const e=Ot.find((e=>_(e)===t));return e?e.status:null}let Pt=!1;function Nt(t,e,n,r){const o=function(t,e,n,r){let o;return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(l(39));const e=["name","app","activeWhen","customProps"],n=Object.keys(t).reduce(((t,n)=>e.indexOf(n)>=0?t:t.concat(n)),[]);if(0!==n.length)throw Error(l(38,0,e.join(", "),n.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(l(20));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(l(20));const r=t=>"string"==typeof t||"function"==typeof t;if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))throw Error(l(24));if(!Ut(t.customProps))throw Error(l(22))}(t),o={name:t.name,app:t.app,activeWhen:t.activeWhen,customProps:t.customProps}):(function(t,e,n,r){if("string"!=typeof t||0===t.length)throw Error(l(20));if(!e)throw Error(l(23));if("function"!=typeof n)throw Error(l(24));if(!Ut(r))throw Error(l(22))}(t,e,n,r),o={name:t,app:e,activeWhen:n,customProps:r}),{name:o.name,loadApp:(i=o.app,"function"!=typeof i?()=>Promise.resolve(i):i),customProps:St(o.customProps),activeWhen:Mt(o.activeWhen)};var i}(t,e,n,r);if(Wt()||Pt||(Pt=!0,setTimeout((()=>{Wt()||console.warn(l(1))}),5e3)),-1!==Tt().indexOf(o.name))throw Error(l(21,0,o.name));Ot.push(Object.assign({loadErrorTime:null,status:h,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),tt&&(pt(),Bt())}function bt(t=window.location){return Ot.filter((e=>e.activeWhen(t))).map(_)}function At(t){if(0===Ot.filter((e=>_(e)===t)).length)throw Error(l(25,0,t));return(tt?_t(t,{waitForUnmount:!1}):Promise.resolve()).then((()=>{const e=Ot.map(_).indexOf(t);Ot.splice(e,1)}))}function _t(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(l(26));const n=Ot.find((e=>_(e)===t));if(!n)throw Error(l(27,0,t));const r=Et(_(n));if(e?.waitForUnmount){if(r)return r.promise;{const t=new Promise(((e,r)=>{gt(n,(()=>t),e,r)}));return t}}{let t;return r?(t=r.promise,Dt(n,r.resolve,r.reject)):t=new Promise(((e,r)=>{gt(n,(()=>t),e,r),Dt(n,e,r)})),t}}function Dt(t,e,n){Promise.resolve().then((()=>{if(bt().find((e=>e===_(t))))return Gt()})).then((()=>I(t).then(dt).then((()=>{e(),setTimeout((()=>{Bt()}))})))).catch(n)}function Ut(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function St(t){return t||{}}function Mt(t){const e=(Array.isArray(t)?t:[t]).map((t=>"function"==typeof t?t:Rt(t,!1)));return t=>e.some((e=>e(t)))}function Rt(t,e){const n=function(t,e){let n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const n=t[e];(!r&&":"===n||r&&"/"===n)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===t.length)if(r)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}r=!r,n=i}}(t,e);return t=>{const e=t.href.replace(t.origin,"").replace(t.search,"").split("?")[0];return n.test(e)}}let Lt=!1,jt=[],It=tt&&window.location.href;function Gt(){return Bt()}function Bt(t=[],e=void 0,n=!1){if(Lt)return new Promise(((t,n)=>{jt.push({resolve:t,reject:n,eventArguments:e})}));const{appsToUnload:r,appsToUnmount:o,appsToLoad:s,appsToMount:u}=function(){const t=[],e=[],n=[],r=[],o=(new Date).getTime();return Ot.forEach((i=>{const s=i.status!==N&&A(i);switch(i.status){case P:s&&o-i.loadErrorTime>=200&&n.push(i);break;case h:case m:s&&n.push(i);break;case d:case g:!s&&Et(_(i))?t.push(i):s&&r.push(i);break;case O:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}();let a,c=[],f=It,p=It=window.location.href;return Wt()?(Lt=!0,a=r.concat(s,o,u),Promise.resolve().then((()=>(v(0===a.length?"before-no-app-change":"before-app-change",T(!0)),v("before-routing-event",T(!0,{cancelNavigation:w})),Promise.all(c).then((n=>{if(n.some((t=>t)))return at.call(window.history,history.state,"",f.substring(location.origin.length)),It=location.href,Lt=!1,Bt(t,e,!0);const i=r.map(dt),a=[...o.map((t=>I(t))).map((t=>t.then(dt))),...i],c=Promise.all(a);c.then((()=>{v("before-mount-routing-event",T(!0))}),(t=>{throw t}));const l=s.map((t=>Z(t).then((t=>$t(t,c))))),p=u.filter((t=>!s.includes(t))).map((t=>$t(t,c)));return c.catch((t=>{throw y(),t})).then((()=>(y(),Promise.all(l.concat(p)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then((()=>{}),(t=>{throw t})).then(E))))})))))):(a=s,Promise.resolve().then((()=>{const t=s.map(Z);return Promise.all(t).then(y).then((()=>[])).catch((t=>{throw y(),t})).finally((()=>{}))})));function w(t=!0){const e="function"==typeof t?.then?t:Promise.resolve(t);c.push(e.catch((t=>(console.warn(Error(l(42))),console.warn(t),!1))))}function E(){const e=yt();t.forEach((t=>t.resolve(e)));try{v(0===a.length?"no-app-change":"app-change",T()),v("routing-event",T())}catch(t){setTimeout((()=>{throw t}))}if(Lt=!1,jt.length>0){const t=jt;jt=[],Bt(t)}return e}function y(){n||(t.forEach((t=>{ot(t.eventArguments)})),ot(e))}function T(t=!1,n){const i={},c={[O]:[],[g]:[],[h]:[],[N]:[]};t?(s.concat(u).forEach(((t,e)=>{m(t,O)})),r.forEach((t=>{m(t,h)})),o.forEach((t=>{m(t,g)}))):a.forEach((t=>{m(t)}));const l={detail:{newAppStatuses:i,appsByNewStatus:c,totalAppChanges:a.length,originalEvent:e?.[0],oldUrl:f,newUrl:p}};return n&&Object.assign(l.detail,n),l;function m(t,e){const n=_(t);e=e||vt(n),i[n]=e,(c[e]=c[e]||[]).push(n)}}function v(t,e){n||window.dispatchEvent(new i(`single-spa:${t}`,e))}}function $t(t,e){return A(t)?j(t).then((t=>e.then((()=>A(t)?$(t):t)))):e.then((()=>t))}let Ct=!1;function xt(t){Ct=!0,tt&&(lt(t),Bt())}function Wt(){return Ct}var Kt={getRawAppData:function(){return[...Ot]},reroute:Bt,NOT_LOADED:h,toLoadPromise:Z,toBootstrapPromise:j,unregisterApplication:At,getProfilerData:function(){return L}};tt&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Kt);export{w as BOOTSTRAPPING,m as LOADING_SOURCE_CODE,P as LOAD_ERROR,O as MOUNTED,E as MOUNTING,d as NOT_BOOTSTRAPPED,h as NOT_LOADED,g as NOT_MOUNTED,N as SKIP_BECAUSE_BROKEN,v as UNLOADING,T as UNMOUNTING,y as UPDATING,a as addErrorHandler,bt as checkActivityFunctions,pt as ensureJQuerySupport,Tt as getAppNames,vt as getAppStatus,yt as getMountedApps,W as mountRootParcel,rt as navigateToUrl,lt as patchHistoryApi,Rt as pathToActiveWhen,Nt as registerApplication,c as removeErrorHandler,Q as setBootstrapMaxTime,V as setMountMaxTime,z as setUnloadMaxTime,q as setUnmountMaxTime,xt as start,Gt as triggerAppChange,_t as unloadApplication,At as unregisterApplication};
/* single-spa@7.0.0-beta.1 - ESM - prod */
var t,e,n=Object.freeze({__proto__:null,get BOOTSTRAPPING(){return w},get LOADING_SOURCE_CODE(){return m},get LOAD_ERROR(){return P},get MOUNTED(){return O},get MOUNTING(){return E},get NOT_BOOTSTRAPPED(){return d},get NOT_LOADED(){return h},get NOT_MOUNTED(){return g},get SKIP_BECAUSE_BROKEN(){return N},get UNLOADING(){return T},get UNMOUNTING(){return y},get UPDATING(){return v},get addErrorHandler(){return a},get checkActivityFunctions(){return bt},get ensureJQuerySupport(){return pt},get getAppNames(){return yt},get getAppStatus(){return Tt},get getMountedApps(){return vt},get mountRootParcel(){return W},get navigateToUrl(){return rt},get patchHistoryApi(){return lt},get pathToActiveWhen(){return Rt},get registerApplication(){return Nt},get removeErrorHandler(){return c},get setBootstrapMaxTime(){return Q},get setMountMaxTime(){return V},get setUnloadMaxTime(){return z},get setUnmountMaxTime(){return q},get start(){return xt},get triggerAppChange(){return Gt},get unloadApplication(){return _t},get unregisterApplication(){return At}}),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=o(function(){if(e)return t;e=1;var n=r.CustomEvent;return t=function(){try{var t=new n("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?n:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var n=document.createEvent("CustomEvent");return e?n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):n.initCustomEvent(t,!1,!1,void 0),n}:function(t,e){var n=document.createEventObject();return n.type=t,e?(n.bubbles=Boolean(e.bubbles),n.cancelable=Boolean(e.cancelable),n.detail=e.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}}());let s=[];function u(t,e,n){const r=f(t,e,n);s.length?s.forEach((t=>t(r))):setTimeout((()=>{throw r}))}function a(t){if("function"!=typeof t)throw Error(l(28));s.push(t)}function c(t){if("function"!=typeof t)throw Error(l(29));let e=!1;return s=s.filter((n=>{const r=n===t;return e=e||r,!r})),e}function l(t,e,...n){return`single-spa minified message #${t}: See https://single-spa.js.org/error/?code=${t}${n.length?`&arg=${n.join("&arg=")}`:""}`}function f(t,e,n){const r=`${U(e)} '${_(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=r+t.message}catch(t){}o=t}else{console.warn(l(30,0,e.status,_(e)));try{o=Error(r+JSON.stringify(t))}catch(e){o=t}}const i=o;return i.appOrParcelName=_(e),e.status=n,i}var p;!function(t){t.NOT_LOADED="NOT_LOADED",t.LOADING_SOURCE_CODE="LOADING_SOURCE_CODE",t.NOT_BOOTSTRAPPED="NOT_BOOTSTRAPPED",t.BOOTSTRAPPING="BOOTSTRAPPING",t.NOT_MOUNTED="NOT_MOUNTED",t.MOUNTING="MOUNTING",t.MOUNTED="MOUNTED",t.UPDATING="UPDATING",t.UNMOUNTING="UNMOUNTING",t.UNLOADING="UNLOADING",t.LOAD_ERROR="LOAD_ERROR",t.SKIP_BECAUSE_BROKEN="SKIP_BECAUSE_BROKEN"}(p||(p={}));const h=p.NOT_LOADED,m=p.LOADING_SOURCE_CODE,d=p.NOT_BOOTSTRAPPED,w=p.BOOTSTRAPPING,g=p.NOT_MOUNTED,E=p.MOUNTING,O=p.MOUNTED,v=p.UPDATING,y=p.UNMOUNTING,T=p.UNLOADING,P=p.LOAD_ERROR,N=p.SKIP_BECAUSE_BROKEN;function b(t){return t.status===O}function A(t){try{return t.activeWhen(window.location)}catch(e){return u(e,t,N),!1}}function _(t){return t.name}function D(t){return Boolean(t.unmountThisParcel)}function U(t){return D(t)?"parcel":"application"}function S(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!e.find((t=>"function"!=typeof t))));var e}function M(t,e,n){let r=Array.isArray(t[e])?t[e]:[t[e]].filter(Boolean);0===r.length&&(r=[()=>Promise.resolve()]);const o=n?"parcel":"application",i=_(t);return function(t){return r.reduce(((n,r,s)=>n.then((()=>{const n=r(t);return R(n)?n:Promise.reject(l(15,0,o,i,e,s))}))),Promise.resolve())}}function R(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}let L=[];function j(t,e){return Promise.resolve().then((()=>t.status!==d?t:(t.status=w,t.bootstrap?X(t,"bootstrap").then(n).catch((n=>{if(e)throw f(n,t,N);return u(n,t,N),t})):Promise.resolve().then(n))));function n(){return t.status=g,t}}function I(t,e){return Promise.resolve().then((()=>{if(t.status!==O)return t;t.status=y;const n=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(n).then(r,(n=>r().then((()=>{const r=Error(n.message);if(e)throw f(r,t,N);u(r,t,N)})))).then((()=>t));function r(){return X(t,"unmount").then((()=>{t.status=g}),(n=>{if(e)throw f(n,t,N);u(n,t,N)}))}}))}let G=!1,B=!1;function $(t,e){return Promise.resolve().then((()=>t.status!==g?t:(G||(window.dispatchEvent(new i("single-spa:before-first-mount")),G=!0),t.status=E,X(t,"mount").then((()=>(t.status=O,B||(window.dispatchEvent(new i("single-spa:first-mount")),B=!0),t))).catch((n=>{return t.status=O,I(t,!0).then(r,r);function r(){if(e)throw f(n,t,N);return u(n,t,N),t}})))))}let C=0;const x={name:"rootParcels",parcels:{}};function W(t,e){return K.call(x,t,e)}function K(t,e){const n=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(l(2));if(t.name&&"string"!=typeof t.name)throw Error(l(3,0,typeof t.name));const r=C++;let o=t.name||`parcel-${r}`;if("object"!=typeof e)throw Error(l(4,0,o,typeof e));if(!e.domElement)throw Error(l(5,0,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),u={id:r,parcels:{},status:i?m:d,customProps:e,parentName:_(n),unmountThisParcel:()=>p.then((()=>{if(u.status!==O)throw Error(l(6,0,o,u.status));return I(u,!0)})).then((t=>(u.parentName&&delete n.parcels[u.id],t))).then((t=>(h(t),t))).catch((t=>{throw u.status=N,w(t),t}))};let a=s();if(!a||"function"!=typeof a.then)throw Error(l(7));a=a.then((t=>{if(!t)throw Error(l(8));if(o=t.name||`parcel-${r}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!S(t.bootstrap))throw Error(l(9,0,o));if(!S(t.mount))throw Error(l(10,0,o));if(!S(t.unmount))throw Error(l(11,0,o));if(t.update&&!S(t.update))throw Error(l(12,0,o));const e=M(t,"bootstrap",!0),i=M(t,"mount",!0),s=M(t,"unmount",!0);u.status=d,u.name=o,u.bootstrap=e,u.mount=i,u.unmount=s,u.timeouts=Y(t.timeouts),t.update&&(u.update=M(t,"update",!0));const a=u;return n.parcels[r]=a,t}));const c=a.then((()=>j(u,!0))),p=c.then((()=>$(u,!0)));let h,w;const E=new Promise(((t,e)=>{h=t,w=e}));let y={mount:()=>k(Promise.resolve().then((()=>{if(u.status!==g)throw Error(l(13,0,o,u.status));return n.parcels[r]=u,$(u)}))),unmount:()=>k(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:k(a),bootstrapPromise:k(c),mountPromise:k(p),unmountPromise:k(E),_parcel:u};return a.then((t=>{t.update&&(y.update=function(t){return u.customProps=t,k((e=u,Promise.resolve().then((()=>{if(e.status!==O)throw Error(l(32,0,_(e)));return e.status=v,X(e,"update").then((()=>(e.status=O,e))).catch((t=>{throw f(t,e,N)}))}))));var e})}),(()=>{})),y}function k(t){return t.then((()=>null))}function F(t){const e=_(t);let r="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(l(40),e,r));const o=Object.assign({},r,{name:e,mountParcel:K.bind(t),singleSpa:n});return D(t)&&(o.unmountSelf=t.unmountThisParcel),o}const H=1e3,J={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:H},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:H},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:H},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:H},update:{millis:3e3,dieOnTimeout:!1,warningMillis:H}};function Q(t,e,n){if("number"!=typeof t||t<=0)throw Error(l(16));J.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||H}}function V(t,e,n){if("number"!=typeof t||t<=0)throw Error(l(17));J.mount={millis:t,dieOnTimeout:e,warningMillis:n||H}}function q(t,e,n){if("number"!=typeof t||t<=0)throw Error(l(18));J.unmount={millis:t,dieOnTimeout:e,warningMillis:n||H}}function z(t,e,n){if("number"!=typeof t||t<=0)throw Error(l(19));J.unload={millis:t,dieOnTimeout:e,warningMillis:n||H}}function X(t,e){const n=t.timeouts[e],r=n.warningMillis,o=U(t);return new Promise(((i,s)=>{let u=!1,a=!1;t[e](F(t)).then((t=>{u=!0,i(t)})).catch((t=>{u=!0,s(t)})),setTimeout((()=>f(1)),r),setTimeout((()=>f(!0)),n.millis);const c=l(31,0,e,o,_(t),n.millis);function f(t){if(!u)if(!0===t)a=!0,n.dieOnTimeout?s(Error(c)):console.error(c);else if(!a){const e=t,o=e*r;console.warn(c),o+r<n.millis&&setTimeout((()=>f(e+1)),r)}}}))}function Y(t){var e;const n={};for(let r in J)n[r]=Object.assign({},J[r],null!==(e=null==t?void 0:t[r])&&void 0!==e?e:{});return n}function Z(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==h&&t.status!==P)return t;const e=t;let n,r;return e.status=m,e.loadPromise=Promise.resolve().then((()=>{const o=e.loadApp(F(t));if(!R(o))throw r=!0,Error(l(33,0,_(e)));return o.then((r=>{let o;if(e.loadErrorTime=null,n=r,"object"!=typeof n&&(o=34),Object.prototype.hasOwnProperty.call(n,"bootstrap")&&!S(n.bootstrap)&&(o=35),S(n.mount)||(o=36),S(n.unmount)||(o=37),o){let t;try{t=JSON.stringify(n)}catch(t){}return console.error(l(o,0,"application",_(e),t),n),u(void 0,e,N),e}return n.devtools&&n.devtools.overlays&&(e.devtools.overlays=Object.assign({},t.devtools.overlays,n.devtools.overlays)),e.status=d,e.bootstrap=M(n,"bootstrap",!1),e.mount=M(n,"mount",!1),e.unmount=M(n,"unmount",!1),e.unload=M(n,"unload",!1),e.timeouts=Y(n.timeouts),delete e.loadPromise,e}))})).catch((t=>{let n;return delete e.loadPromise,r?n=N:(n=P,e.loadErrorTime=(new Date).getTime()),u(t,e,n),e}))}))}const tt="undefined"!=typeof window,et={hashchange:[],popstate:[]},nt=["hashchange","popstate"];function rt(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&"currentTarget"in t&&"href"in t.currentTarget&&"preventDefault"in t))throw Error(l(14));e=t.currentTarget.href,t.preventDefault()}const n=new URL(window.location.href),r=new URL(e,window.location.href);0===e.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=e:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,e)}function ot(t){if(t){const e=t[0].type;nt.indexOf(e)>=0&&et[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let it;function st(t){Bt([],[t])}function ut(t,e){return function(){const n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return it&&n===o||window.dispatchEvent(function(t,e){let n=new PopStateEvent("popstate",{state:t});return n.singleSpa=!0,n.singleSpaTrigger=e,n}(window.history.state,e)),r}}let at=null,ct=!1;function lt(t){if(ct)throw Error(l(43));it=!(null==t?void 0:t.hasOwnProperty("urlRerouteOnly"))||t.urlRerouteOnly,ct=!0,at=window.history.replaceState,window.addEventListener("hashchange",st),window.addEventListener("popstate",st);const e=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&nt.indexOf(t)>=0)||et[t].find((t=>t===n)))return e.apply(this,arguments);et[t].push(n)},window.removeEventListener=function(t,e){return"function"==typeof e&&nt.includes(t)&&(et[t]=et[t].filter((t=>t!==e))),n.apply(this,arguments)},window.history.pushState=ut(window.history.pushState,"pushState"),window.history.replaceState=ut(at,"replaceState")}tt&&(window.singleSpaNavigate?console.warn(l(41)):window.singleSpaNavigate=rt);let ft=!1;function pt(t=window.jQuery){var e,n;if(!t&&(null===(n=null===(e=null===window||void 0===window?void 0:window.$)||void 0===e?void 0:e.fn)||void 0===n?void 0:n.jquery)&&(t=window.$),t&&!ft){const e=t.fn.on,n=t.fn.off;t.fn.on=function(t,n){return ht.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return ht.call(this,n,window.removeEventListener,t,e,arguments)},ft=!0}}function ht(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((t=>{nt.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}const mt={};function dt(t){return Promise.resolve().then((()=>{const e=mt[_(t)];if(!e)return t;if(t.status===h)return wt(t,e),t;if(t.status===T)return e.promise.then((()=>t));if(t.status!==g&&t.status!==P&&t.status!==N)return t;const n=t.unload?X(t,"unload"):Promise.resolve();return t.status=T,n.then((()=>(wt(t,e),t))).catch((n=>(function(t,e,n){delete mt[_(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,u(n,t,N),e.reject(n)}(t,e,n),t)))}))}function wt(t,e){delete mt[_(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=h,e.resolve()}function gt(t,e,n,r){mt[_(t)]={app:t,resolve:n,reject:r},Object.defineProperty(mt[_(t)],"promise",{get:e})}function Et(t){return mt[t]}const Ot=[];function vt(){return Ot.filter(b).map(_)}function yt(){return Ot.map(_)}function Tt(t){const e=Ot.find((e=>_(e)===t));return e?e.status:null}let Pt=!1;function Nt(t,e,n,r){const o=function(t,e,n,r){let o;return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(l(39));const e=["name","app","activeWhen","customProps"],n=Object.keys(t).reduce(((t,n)=>e.indexOf(n)>=0?t:t.concat(n)),[]);if(0!==n.length)throw Error(l(38,0,e.join(", "),n.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(l(20));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(l(20));const r=t=>"string"==typeof t||"function"==typeof t;if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))throw Error(l(24));if(!Ut(t.customProps))throw Error(l(22))}(t),o={name:t.name,app:t.app,activeWhen:t.activeWhen,customProps:t.customProps}):(function(t,e,n,r){if("string"!=typeof t||0===t.length)throw Error(l(20));if(!e)throw Error(l(23));if("function"!=typeof n)throw Error(l(24));if(!Ut(r))throw Error(l(22))}(t,e,n,r),o={name:t,app:e,activeWhen:n,customProps:r}),{name:o.name,loadApp:(i=o.app,"function"!=typeof i?()=>Promise.resolve(i):i),customProps:St(o.customProps),activeWhen:Mt(o.activeWhen)};var i}(t,e,n,r);if(Wt()||Pt||(Pt=!0,setTimeout((()=>{Wt()||console.warn(l(1))}),5e3)),-1!==yt().indexOf(o.name))throw Error(l(21,0,o.name));Ot.push(Object.assign({loadErrorTime:null,status:h,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),tt&&(pt(),Bt())}function bt(t=window.location){return Ot.filter((e=>e.activeWhen(t))).map(_)}function At(t){if(0===Ot.filter((e=>_(e)===t)).length)throw Error(l(25,0,t));return(tt?_t(t,{waitForUnmount:!1}):Promise.resolve()).then((()=>{const e=Ot.map(_).indexOf(t);Ot.splice(e,1)}))}function _t(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(l(26));const n=Ot.find((e=>_(e)===t));if(!n)throw Error(l(27,0,t));const r=Et(_(n));if(null==e?void 0:e.waitForUnmount){if(r)return r.promise;{const t=new Promise(((e,r)=>{gt(n,(()=>t),e,r)}));return t}}{let t;return r?(t=r.promise,Dt(n,r.resolve,r.reject)):t=new Promise(((e,r)=>{gt(n,(()=>t),e,r),Dt(n,e,r)})),t}}function Dt(t,e,n){Promise.resolve().then((()=>{if(bt().find((e=>e===_(t))))return Gt()})).then((()=>I(t).then(dt).then((()=>{e(),setTimeout((()=>{Bt()}))})))).catch(n)}function Ut(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function St(t){return t||{}}function Mt(t){const e=(Array.isArray(t)?t:[t]).map((t=>"function"==typeof t?t:Rt(t,!1)));return t=>e.some((e=>e(t)))}function Rt(t,e){const n=function(t,e){let n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const n=t[e];(!r&&":"===n||r&&"/"===n)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===t.length)if(r)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}r=!r,n=i}}(t,e);return t=>{const e=t.href.replace(t.origin,"").replace(t.search,"").split("?")[0];return n.test(e)}}let Lt=!1,jt=[],It=tt&&window.location.href;function Gt(){return Bt()}function Bt(t=[],e=void 0,n=!1){if(Lt)return new Promise(((t,n)=>{jt.push({resolve:t,reject:n,eventArguments:e})}));const{appsToUnload:r,appsToUnmount:o,appsToLoad:s,appsToMount:u}=function(){const t=[],e=[],n=[],r=[],o=(new Date).getTime();return Ot.forEach((i=>{const s=i.status!==N&&A(i);switch(i.status){case P:s&&o-i.loadErrorTime>=200&&n.push(i);break;case h:case m:s&&n.push(i);break;case d:case g:!s&&Et(_(i))?t.push(i):s&&r.push(i);break;case O:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}();let a,c=[],f=It,p=It=window.location.href;return Wt()?(Lt=!0,a=r.concat(s,o,u),Promise.resolve().then((()=>(T(0===a.length?"before-no-app-change":"before-app-change",y(!0)),T("before-routing-event",y(!0,{cancelNavigation:w})),Promise.all(c).then((n=>{if(n.some((t=>t)))return at.call(window.history,history.state,"",f.substring(location.origin.length)),It=location.href,Lt=!1,Bt(t,e,!0);const i=r.map(dt),a=[...o.map((t=>I(t))).map((t=>t.then(dt))),...i],c=Promise.all(a);c.then((()=>{T("before-mount-routing-event",y(!0))}),(t=>{throw t}));const l=s.map((t=>Z(t).then((t=>$t(t,c))))),p=u.filter((t=>!s.includes(t))).map((t=>$t(t,c)));return c.catch((t=>{throw v(),t})).then((()=>(v(),Promise.all(l.concat(p)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then((()=>{}),(t=>{throw t})).then(E))))})))))):(a=s,Promise.resolve().then((()=>{const t=s.map(Z);return Promise.all(t).then(v).then((()=>[])).catch((t=>{throw v(),t})).finally((()=>{}))})));function w(t=!0){const e="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);c.push(e.catch((t=>(console.warn(Error(l(42))),console.warn(t),!1))))}function E(){const e=vt();t.forEach((t=>t.resolve(e)));try{T(0===a.length?"no-app-change":"app-change",y()),T("routing-event",y())}catch(t){setTimeout((()=>{throw t}))}if(Lt=!1,jt.length>0){const t=jt;jt=[],Bt(t)}return e}function v(){n||(t.forEach((t=>{ot(t.eventArguments)})),ot(e))}function y(t=!1,n){const i={},c={[O]:[],[g]:[],[h]:[],[N]:[]};t?(s.concat(u).forEach(((t,e)=>{m(t,O)})),r.forEach((t=>{m(t,h)})),o.forEach((t=>{m(t,g)}))):a.forEach((t=>{m(t)}));const l={detail:{newAppStatuses:i,appsByNewStatus:c,totalAppChanges:a.length,originalEvent:null==e?void 0:e[0],oldUrl:f,newUrl:p}};return n&&Object.assign(l.detail,n),l;function m(t,e){const n=_(t);e=e||Tt(n),i[n]=e,(c[e]=c[e]||[]).push(n)}}function T(t,e){n||window.dispatchEvent(new i(`single-spa:${t}`,e))}}function $t(t,e){return A(t)?j(t).then((t=>e.then((()=>A(t)?$(t):t)))):e.then((()=>t))}let Ct=!1;function xt(t){Ct=!0,tt&&(lt(t),Bt())}function Wt(){return Ct}var Kt={getRawAppData:function(){return[...Ot]},reroute:Bt,NOT_LOADED:h,toLoadPromise:Z,toBootstrapPromise:j,unregisterApplication:At,getProfilerData:function(){return L}};tt&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Kt);export{w as BOOTSTRAPPING,m as LOADING_SOURCE_CODE,P as LOAD_ERROR,O as MOUNTED,E as MOUNTING,d as NOT_BOOTSTRAPPED,h as NOT_LOADED,g as NOT_MOUNTED,N as SKIP_BECAUSE_BROKEN,T as UNLOADING,y as UNMOUNTING,v as UPDATING,a as addErrorHandler,bt as checkActivityFunctions,pt as ensureJQuerySupport,yt as getAppNames,Tt as getAppStatus,vt as getMountedApps,W as mountRootParcel,rt as navigateToUrl,lt as patchHistoryApi,Rt as pathToActiveWhen,Nt as registerApplication,c as removeErrorHandler,Q as setBootstrapMaxTime,V as setMountMaxTime,z as setUnloadMaxTime,q as setUnmountMaxTime,xt as start,Gt as triggerAppChange,_t as unloadApplication,At as unregisterApplication};
//# sourceMappingURL=single-spa.min.js.map
{
"name": "single-spa",
"version": "7.0.0-beta.0",
"version": "7.0.0-beta.1",
"description": "The router for easy microfrontends",
"type": "module",
"main": "lib/umd/single-spa.min.cjs",
"main": "./lib/esm/single-spa.min.js",
"types": "./lib/esm/single-spa.d.ts",
"publishConfig": {

@@ -13,15 +14,30 @@ "access": "public"

"development": {
"import": "./lib/esm/single-spa.dev.js",
"require": "./lib/umd/single-spa.dev.cjs",
"types": "./typings/single-spa.d.ts"
"import": {
"types": "./lib/esm/single-spa.d.ts",
"default": "./lib/esm/single-spa.min.js"
},
"require": {
"types": "./lib/umd/single-spa.d.cts",
"default": "./lib/umd/single-spa.min.cjs"
}
},
"production": {
"import": "./lib/esm/single-spa.min.js",
"require": "./lib/umd/single-spa.min.cjs",
"types": "./typings/single-spa.d.ts"
"import": {
"types": "./lib/esm/single-spa.d.ts",
"default": "./lib/esm/single-spa.min.js"
},
"require": {
"types": "./lib/umd/single-spa.d.cts",
"default": "./lib/umd/single-spa.min.cjs"
}
},
"default": {
"import": "./lib/esm/single-spa.min.js",
"require": "./lib/umd/single-spa.min.cjs",
"types": "./typings/single-spa.d.ts"
"import": {
"types": "./lib/esm/single-spa.d.ts",
"default": "./lib/esm/single-spa.min.js"
},
"require": {
"types": "./lib/umd/single-spa.d.cts",
"default": "./lib/umd/single-spa.min.cjs"
}
}

@@ -69,2 +85,3 @@ },

"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@types/jest": "^29.5.13",

@@ -90,2 +107,3 @@ "@typescript-eslint/parser": "^8.7.0",

"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-dts": "^6.1.1",
"typescript": "^5.3.3"

@@ -98,9 +116,8 @@ },

"scripts": {
"build": "pnpm run clean && concurrently pnpm:build:dev pnpm:build:prod pnpm:build:types",
"build": "pnpm run clean && concurrently pnpm:build:dev pnpm:build:prod && rimraf ./lib/umd/types-unbundled ./lib/esm/types-unbundled",
"build:prod": "rollup -c --environment ROLLUP_ENV:'production'",
"build:dev": "rollup -c",
"build:analyze": "rollup -c --environment ANALYZER:'analyzer'",
"build:types": "tsc",
"watch": "rollup -c -w",
"clean": "rimraf lib typings",
"clean": "rimraf lib",
"test": "concurrently -n w: 'pnpm:test:*'",

@@ -107,0 +124,0 @@ "test:browser": "cross-env BABEL_ENV=test jest --config jest-browser.config.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc