{"ast":null,"code":"import { Observable } from 'rxjs';\nimport { LoginComponent } from '../login/login.component';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"@angular/material/dialog\";\nimport * as i2 from \"../services/authentication.service\";\nimport * as i3 from \"@angular/router\";\nexport let AuthGuard = /*#__PURE__*/(() => {\n class AuthGuard {\n constructor(dialog, authService, router) {\n this.dialog = dialog;\n this.authService = authService;\n this.router = router;\n }\n canActivate(next, state) {\n return new Observable(observer => {\n this.authService.isAuthenticated().subscribe({\n next: res => {\n if (!res) this.openLogin();\n observer.next(res);\n },\n error: error => {\n observer.next(false);\n },\n complete: () => observer.complete()\n });\n });\n }\n openLogin() {\n const dialogRef = this.dialog.open(LoginComponent, {\n width: \"35vw\",\n data: {\n afterLogin: () => {\n dialogRef.close();\n }\n }\n });\n return dialogRef;\n }\n static #_ = this.ɵfac = function AuthGuard_Factory(t) {\n return new (t || AuthGuard)(i0.ɵɵinject(i1.MatDialog), i0.ɵɵinject(i2.AuthenticationService), i0.ɵɵinject(i3.Router));\n };\n static #_2 = this.ɵprov = /*@__PURE__*/i0.ɵɵdefineInjectable({\n token: AuthGuard,\n factory: AuthGuard.ɵfac,\n providedIn: 'root'\n });\n }\n return AuthGuard;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}