{ "version": 3, "sources": ["libs/angular/ng-auth/src/lib/deprecated/client-auth.guard.ts"], "sourcesContent": ["import { Injectable } from '@angular/core';\nimport { Router, UrlTree } from '@angular/router';\nimport { map, Observable, tap } from 'rxjs';\nimport { ItkTokenManagementServiceDeprecated } from './token-management.service';\n\n/**\n * @deprecated\n */\n@Injectable()\nexport class ClientAuthGuardDeprecated {\n constructor(\n public readonly tokenManagement: ItkTokenManagementServiceDeprecated,\n readonly router: Router,\n ) {}\n\n canActivate():\n | boolean\n | UrlTree\n | Observable\n | Promise {\n return this.isTokenValid().pipe(\n tap((isValid) => {\n if (!isValid) this.router.navigate(['/']);\n }),\n );\n }\n\n isTokenValid(): Observable {\n return this.tokenManagement\n .refreshTokenIfNeeded()\n .pipe(map((x) => !('error' in x)));\n }\n}\n"], "mappings": "8GASA,IAAaA,GAAyB,IAAA,CAAhC,IAAOA,EAAP,MAAOA,CAAyB,CACpCC,YACkBC,EACPC,EAAc,CADP,KAAAD,gBAAAA,EACP,KAAAC,OAAAA,CACR,CAEHC,aAAW,CAKT,OAAO,KAAKC,aAAY,EAAGC,KACzBC,EAAKC,GAAW,CACTA,GAAS,KAAKL,OAAOM,SAAS,CAAC,GAAG,CAAC,CAC1C,CAAC,CAAC,CAEN,CAEAJ,cAAY,CACV,OAAO,KAAKH,gBACTQ,qBAAoB,EACpBJ,KAAKK,EAAKC,GAAM,EAAE,UAAWA,EAAE,CAAC,CACrC,yCAtBWZ,GAAyBa,EAAAC,CAAA,EAAAD,EAAAE,CAAA,CAAA,CAAA,wBAAzBf,EAAyBgB,QAAzBhB,EAAyBiB,SAAA,CAAA,EAAhC,IAAOjB,EAAPkB,SAAOlB,CAAyB,GAAA", "names": ["ClientAuthGuardDeprecated", "constructor", "tokenManagement", "router", "canActivate", "isTokenValid", "pipe", "tap", "isValid", "navigate", "refreshTokenIfNeeded", "map", "x", "\u0275\u0275inject", "ItkTokenManagementServiceDeprecated", "Router", "factory", "\u0275fac", "_ClientAuthGuardDeprecated"] }