text: function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,a){return t&&_defineProperties(e.prototype,t),a&&_defineProperties(e,a),e}(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{Yj9t:function(e,t,a){"use strict";a.r(t),a.d(t,"AuthModule",(function(){return O}));var n=a("ofXK"),r=a("tyNb"),o=a("3Pt+"),i=a("bTqV"),c=a("Wp6s"),s=a("kmnG"),u=a("qFsG"),l=a("YUcS"),f=a("eAqi"),b=a("vY5A"),m=a("fXoL"),p=a("z1O9"),d=a("XiUz");function h(e,t){if(1&e){var a=m.Vb();m.Ub(0,"form",3),m.cc("ngSubmit",(function(){return m.qc(a),m.ec().signInUp()})),m.Ub(1,"mat-form-field",4),m.Pb(2,"input",5),m.Tb(),m.Ub(3,"mat-form-field",4),m.Pb(4,"input",6),m.Tb(),m.Ub(5,"button",7),m.zc(6," Auth "),m.Tb(),m.Tb()}if(2&e){var n=m.ec();m.jc("formGroup",n.form)}}function g(e,t){1&e&&(m.Ub(0,"p"),m.zc(1,"You are logged in."),m.Tb())}function v(e,t){if(1&e){var a=m.Vb();m.Ub(0,"form",3),m.cc("ngSubmit",(function(){return m.qc(a),m.ec().signup()})),m.Ub(1,"mat-form-field",4),m.Pb(2,"input",5),m.Tb(),m.Ub(3,"mat-form-field",4),m.Pb(4,"input",6),m.Tb(),m.Ub(5,"button",7),m.zc(6,"Register "),m.Tb(),m.Tb()}if(2&e){var n=m.ec();m.jc("formGroup",n.form)}}function y(e,t){1&e&&(m.Ub(0,"p"),m.zc(1,"You are logged in."),m.Tb())}function w(e,t){if(1&e){var a=m.Vb();m.Ub(0,"form",3),m.cc("ngSubmit",(function(){return m.qc(a),m.ec().login()})),m.Ub(1,"mat-form-field",4),m.Pb(2,"input",5),m.Tb(),m.Ub(3,"mat-form-field",4),m.Pb(4,"input",6),m.Tb(),m.Ub(5,"button",7),m.zc(6,"Sign in "),m.Tb(),m.Tb()}if(2&e){var n=m.ec();m.jc("formGroup",n.form)}}function S(e,t){1&e&&(m.Ub(0,"p"),m.zc(1,"You are logged in."),m.Tb())}var I,k,U,T,C,x=[{path:"",component:(T=function(){function e(t,a,n,r){_classCallCheck(this,e),this.router=t,this.fb=a,this.authService=n,this.alertsService=r,this.auth=new o.c}return _createClass(e,[{key:"ngOnInit",value:function(){this.form=this.fb.group({email:["",[o.p.required,o.p.email]],password:["",o.p.required]})}},{key:"ngAfterViewInit",value:function(){var e;f.a.loggedIn()&&this.router.navigateByUrl((e=Object(b.b)(location.href),null==e?"/secret-dashboard":e)).then((function(){}))}},{key:"signInUp",value:function(){var e=this;this.authService.signinup(this.form.value).subscribe((function(t){var a;t.hasOwnProperty("access_token")?(e.authService._login(t),e.router.navigateByUrl((a=Object(b.b)(location.href),null==a?"/secret-dashboard":a)).then((function(){})).catch(console.error)):e.alertsService.add("Unexpected: ".concat(JSON.stringify(t),";"))}))}}]),e}(),T.\u0275fac=function(e){return new(e||T)(m.Ob(r.b),m.Ob(o.b),m.Ob(f.a),m.Ob(p.a))},T.\u0275cmp=m.Ib({type:T,selectors:[["app-signinup"]],decls:7,vars:2,consts:[[1,"mat-h1"],["novalidate","","fxLayout","row","fxLayout.lt-md","column","fxLayoutGap","25px",3,"formGroup","ngSubmit",4,"ngIf"],[4,"ngIf"],["novalidate","","fxLayout","row","fxLayout.lt-md","column","fxLayoutGap","25px",3,"formGroup","ngSubmit"],["fxFlex",""],["formControlName","email","id","email","matInput","","name","email","placeholder","Email","type","email"],["formControlName","password","id","password","matInput","","name","password","placeholder","Password","type","password"],["color","accent","mat-raised-button","","type","submit","fxFlex","20",2,"height","40px"]],template:function(e,t){1&e&&(m.Ub(0,"mat-card"),m.Ub(1,"mat-card-header"),m.Ub(2,"h1",0),m.zc(3,"Sign in/up"),m.Tb(),m.Tb(),m.Ub(4,"mat-card-content"),m.xc(5,h,7,1,"form",1),m.xc(6,g,2,0,"p",2),m.Tb(),m.Tb()),2&e&&(m.Cb(5),m.jc("ngIf",!t.authService.loggedIn()),m.Cb(1),m.jc("ngIf",t.authService.loggedIn()))},directives:[c.a,c.d,c.c,n.k,o.q,o.k,d.b,d.c,o.f,s.b,d.a,o.a,u.a,o.j,o.d,i.b],styles:[""]}),T)},{path:"signup",component:(U=function(){function e(t,a,n,r){_classCallCheck(this,e),this.router=t,this.fb=a,this.authService=n,this.alertsService=r,this.auth=new o.c}return _createClass(e,[{key:"ngOnInit",value:function(){this.form=this.fb.group({email:["",[o.p.required,o.p.email]],password:["",o.p.required]})}},{key:"signup",value:function(){var e=this;this.authService.register(this.form.value).subscribe((function(t){var a;t.headers.has("x-access-token")?(e.authService.accessToken=t.headers.get("x-access-token"),localStorage.setItem("access-token",e.authService.accessToken),e.router.navigateByUrl((a=Object(b.b)(location.href),null==a?"/secret-dashboard":a)).then((function(){}))):e.alertsService.add("No access token in response")}))}}]),e}(),U.\u0275fac=function(e){return new(e||U)(m.Ob(r.b),m.Ob(o.b),m.Ob(f.a),m.Ob(p.a))},U.\u0275cmp=m.Ib({type:U,selectors:[["app-signup"]],decls:7,vars:2,consts:[[1,"mat-h1"],["fxLayout","column","novalidate","",3,"formGroup","ngSubmit",4,"ngIf"],[4,"ngIf"],["fxLayout","column","novalidate","",3,"formGroup","ngSubmit"],[1,"example-full-width","form-group"],["formControlName","email","id","email","matInput","","name","email","placeholder","Email","type","email"],["formControlName","password","id","password","matInput","","name","password","placeholder","Password","type","password"],["color","accent","mat-raised-button","","type","submit"]],template:function(e,t){1&e&&(m.Ub(0,"mat-card"),m.Ub(1,"mat-card-header"),m.Ub(2,"h1",0),m.zc(3,"Signup"),m.Tb(),m.Tb(),m.Ub(4,"mat-card-content"),m.xc(5,v,7,1,"form",1),m.xc(6,y,2,0,"p",2),m.Tb(),m.Tb()),2&e&&(m.Cb(5),m.jc("ngIf",!t.authService.loggedIn()),m.Cb(1),m.jc("ngIf",t.authService.loggedIn()))},directives:[c.a,c.d,c.c,n.k,o.q,o.k,d.b,o.f,s.b,o.a,u.a,o.j,o.d,i.b],styles:[""]}),U)},{path:"login",component:(k=function(){function e(t,a,n,r){_classCallCheck(this,e),this.router=t,this.fb=a,this.authService=n,this.alertsService=r,this.auth=new o.c}return _createClass(e,[{key:"ngOnInit",value:function(){this.form=this.fb.group({email:["",[o.p.required,o.p.email]],password:["",o.p.required]})}},{key:"login",value:function(){var e=this;this.authService.login(this.form.value).subscribe((function(t){var a;null!=t.access_token?(e.authService.accessToken=t.access_token,localStorage.setItem("access-token",e.authService.accessToken),e.router.navigateByUrl((a=Object(b.b)(location.href),null==a?"/secret-dashboard":a)).then((function(){}))):e.alertsService.add("No access token; try logging in again")}))}}]),e}(),k.\u0275fac=function(e){return new(e||k)(m.Ob(r.b),m.Ob(o.b),m.Ob(f.a),m.Ob(p.a))},k.\u0275cmp=m.Ib({type:k,selectors:[["app-login"]],decls:7,vars:2,consts:[[1,"mat-h1"],["novalidate","",3,"formGroup","ngSubmit",4,"ngIf"],[4,"ngIf"],["novalidate","",3,"formGroup","ngSubmit"],[1,"example-full-width","form-group"],["formControlName","email","id","email","matInput","","name","email","placeholder","Email","type","email"],["formControlName","password","id","password","matInput","","name","password","placeholder","Password","type","password"],["color","accent","mat-raised-button","","type","submit"]],template:function(e,t){1&e&&(m.Ub(0,"mat-card"),m.Ub(1,"mat-card-header"),m.Ub(2,"h1",0),m.zc(3,"Login"),m.Tb(),m.Tb(),m.Ub(4,"mat-card-content"),m.xc(5,w,7,1,"form",1),m.xc(6,S,2,0,"p",2),m.Tb(),m.Tb()),2&e&&(m.Cb(5),m.jc("ngIf",!t.authService.loggedIn()),m.Cb(1),m.jc("ngIf",t.authService.loggedIn()))},directives:[c.a,c.d,c.c,n.k,o.q,o.k,o.f,s.b,o.a,u.a,o.j,o.d,i.b],styles:[""]}),k)},{path:"logout",component:(I=function(){function e(t){_classCallCheck(this,e),this.authService=t}return _createClass(e,[{key:"ngOnInit",value:function(){this.authService.logout()}}]),e}(),I.\u0275fac=function(e){return new(e||I)(m.Ob(f.a))},I.\u0275cmp=m.Ib({type:I,selectors:[["app-logout"]],decls:0,vars:0,template:function(e,t){},encapsulation:2}),I)}],O=((C=function e(){_classCallCheck(this,e)}).\u0275mod=m.Mb({type:C}),C.\u0275inj=m.Lb({factory:function(e){return new(e||C)},providers:[f.a],imports:[[n.c,r.f,r.f.forChild(x),o.g,o.n,l.a,u.b,c.e,s.d,i.c]]}),C)}}]);