System.register(["@angular/core","single-spa-angular/internals","@angular/common"],(function(t){"use strict";var e,n,o,r,a,i;return{setters:[function(t){e=t,t.Injectable,n=t.Inject},function(t){o=t.getContainerElementAndSetTemplate},function(t){r=t.BrowserPlatformLocation,a=t.DOCUMENT,i=t.PlatformLocation}],execute:function(){t({enableProdMode:function(){try{e.enableProdMode()}catch{}},getSingleSpaExtraProviders:function(){return[{provide:s,deps:[[new n(a)]]},{provide:i,useExisting:s}]},singleSpaAngular:function(t){if(p&&"object"!=typeof t)throw Error("single-spa-angular requires a configuration object");const e={...u,...t};if(p&&"function"!=typeof e.bootstrapFunction)throw Error("single-spa-angular must be passed an options.bootstrapFunction");if(p&&"string"!=typeof e.template)throw Error("single-spa-angular must be passed options.template string");if(p&&!e.NgZone)throw Error("single-spa-angular must be passed the NgZone option");p&&e.Router&&!e.NavigationStart&&console.warn("single-spa-angular must be passed the NavigationStart option");return{bootstrap:l.bind(null,e),mount:c.bind(null,e),unmount:g.bind(null,e),update:e.updateFunction}}});class s extends r{constructor(){super(...arguments),this.skipNextPopState=!1,this.source="Window.addEventListener:popstate"}pushState(t,e,n){this.skipNextPopState=!0,super.pushState(t,e,n)}replaceState(t,e,n){this.skipNextPopState=!0,super.replaceState(t,e,n)}onPopState(t){const e=Zone.current;t=e.wrap(t,this.source);return super.onPopState((e=>{const n=!!e.singleSpa;this.skipNextPopState&&n?this.skipNextPopState=!1:t(e)}))}static{this.\u0275fac=function(){let t;return function(n){return(t||(t=e.\u0275\u0275getInheritedFactory(s)))(n||s)}}()}static{this.\u0275prov=e.\u0275\u0275defineInjectable({token:s,factory:s.\u0275fac})}}const u={NgZone:null,bootstrapFunction:null,template:null,Router:void 0,domElementGetter:void 0,updateFunction:()=>Promise.resolve(),bootstrappedNgModuleRefOrAppRef:null},p=!1;async function l(t){"noop"!==t.NgZone&&(t.NgZone.assertInAngularZone=()=>{},t.NgZone.assertNotInAngularZone=()=>{},t.routingEventListener=()=>{t.bootstrappedNgZone.run((()=>{}))})}async function c(t,e){o(t,e);const n=t.bootstrapFunction(e);if(p&&!(n instanceof Promise))throw Error(`single-spa-angular: the options.bootstrapFunction must return a promise, but instead returned a '${typeof n}' that is not a Promise`);const r=await n;if(p&&(!r||"function"!=typeof r.destroy))throw Error("single-spa-angular: the options.bootstrapFunction returned a promise that did not resolve with a valid Angular module or ApplicationRef. Did you call platformBrowserDynamic().bootstrapModule() correctly?");const a=r.injector.get(s,null),i="noop"!==t.NgZone;if(p&&i&&t.Router&&null===a)throw new Error("\n      single-spa-angular: could not retrieve extra providers from the platform injector. Did you call platformBrowserDynamic(getSingleSpaExtraProviders()).bootstrapModule()?\n    ");const u=t;if(i){const e=r.injector.get(t.NgZone);null!==a&&function(t,e){if(!e.NavigationStart)return;const n=t.injector.get(e.Router),o=n.events.subscribe((t=>{if(t instanceof e.NavigationStart){const t=n.getCurrentNavigation();"imperative"!==t.trigger&&(t.extras.skipLocationChange=!0,t.extras.replaceUrl=!1)}}));t.onDestroy((()=>o.unsubscribe()))}(r,t),u.bootstrappedNgZone=e,window.addEventListener("single-spa:routing-event",u.routingEventListener)}return u.bootstrappedNgModuleRefOrAppRef=r,r}function g(t){return Promise.resolve().then((()=>{t.routingEventListener&&window.removeEventListener("single-spa:routing-event",t.routingEventListener),t.bootstrappedNgModuleRefOrAppRef.destroy(),t.bootstrappedNgModuleRefOrAppRef=null}))}}}}));
