{ "version": 3, "sources": ["src/app/guards/canDeactivate.guard.ts"], "sourcesContent": ["import { Observable, take } from 'rxjs';\nimport { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\n\nexport interface BlockNavigationIfHasChanges {\n hasChanges: boolean;\n openConfirmationModal(): Observable;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class CanDeactivateNavigationIfHasChanges<\n T extends BlockNavigationIfHasChanges\n> \n{\n canDeactivate(\n component: T,\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable | boolean {\n return new Observable((observer) => {\n if (component.hasChanges) {\n return component\n .openConfirmationModal()\n .subscribe((confirmation: boolean) => {\n if (confirmation) {\n observer.next(confirmation);\n observer.complete();\n }\n });\n } else {\n observer.next(true);\n observer.complete();\n }\n });\n }\n}\n"], "mappings": "gDAUA,IAAaA,GAAmC,IAAA,CAA1C,IAAOA,EAAP,MAAOA,CAAmC,CAI9CC,cACEC,EACAC,EACAC,EAA0B,CAE1B,OAAO,IAAIC,EAAqBC,GAAY,CAC1C,GAAIJ,EAAUK,WACZ,OAAOL,EACJM,sBAAqB,EACrBC,UAAWC,GAAyB,CAC/BA,IACFJ,EAASK,KAAKD,CAAY,EAC1BJ,EAASM,SAAQ,EAErB,CAAC,EAEHN,EAASK,KAAK,EAAI,EAClBL,EAASM,SAAQ,CAErB,CAAC,CACH,yCAxBWZ,EAAmC,wBAAnCA,EAAmCa,QAAnCb,EAAmCc,UAAAC,WADtB,MAAM,CAAA,EAC1B,IAAOf,EAAPgB,SAAOhB,CAAmC,GAAA", "names": ["CanDeactivateNavigationIfHasChanges", "canDeactivate", "component", "route", "state", "Observable", "observer", "hasChanges", "openConfirmationModal", "subscribe", "confirmation", "next", "complete", "factory", "\u0275fac", "providedIn", "_CanDeactivateNavigationIfHasChanges"] }