import{o as F}from"./chunk-C6uGsfWa.js";import{Fa as eo,Gr as Va,Hr as V,Mt as Hx,Pr as Ub,Uo as m$,Wa as g,i as $i,lt as Fb,n as $c,nt as Et,s as $x,vr as She}from"./chunk-B_pj7Jpm.js";var C=[`root`];var S=class s{metaService=g($c);route=g(eo);router=g(Et);pluginService=g($i);root=She(`root`);urlSub;ngAfterViewInit(){this.urlSub=this.route.url.subscribe(()=>{this.loadRoute()})}ngOnDestroy(){this.urlSub&&this.urlSub.unsubscribe()}onRootClick(t){let e=t.target;if(!e)return;let i=e.closest(`a`);if(!i)return;let n=i.getAttribute(`href`)||``;!i.target&&n.startsWith(`/`)&&(t.preventDefault(),t.stopPropagation(),this.router.navigateByUrl(n))}loadRoute(){return F(this,null,function*(){if(yield this.pluginService.ensurePluginsAreLoaded(this.route.snapshot.data.pluginScope||`common`),!this.route.snapshot.data.parentRoute){V.error(`Missing "parentRoute" URL data to load plugin route `+this.route.snapshot.url);return}let t=`/`+this.route.snapshot.url.map(i=>i.path).join(`/`),e=this.pluginService.getRegisteredClientRoute(t,this.route.snapshot.data.parentRoute);if(!e)return V.info(`Could not find registered route ${t}`,{routes:this.pluginService.getAllRegisteredClientRoutes()}),this.router.navigate([`/404`],{skipLocationChange:!0});e.title&&this.metaService.setTitle(e.title),e.onMount({rootEl:this.root().nativeElement})})}static ɵfac=function(e){return new(e||s)};static ɵcmp=Va({type:s,selectors:[[`ng-component`]],viewQuery:function(e,i){e&1&&$x(i.root,C,5),e&2&&m$()},decls:2,vars:0,consts:[[`root`,``],[3,`click`]],template:function(e,i){e&1&&(Fb(0,`div`,1,0),Hx(`click`,function(b){return i.onRootClick(b)}),Ub())},encapsulation:2,changeDetection:1})};export{S as t};
//# debugId=290c98fb-c172-5689-9e69-06327593d78a
//# sourceMappingURL=chunk-DwDgF_Cy2.js.map