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