text: (window.webpackJsonp=window.webpackJsonp||[]).push([[5],{Yj9t:function(n,t,e){"use strict";e.r(t),e.d(t,"AuthModule",(function(){return f}));var i=e("fXoL");let o=(()=>{class n{constructor(){this.close=new i.n}onClose(){this.close.emit()}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=i.Bb({type:n,selectors:[["app-alert"]],inputs:{message:"message"},outputs:{close:"close"},decls:7,vars:1,consts:[[1,"backdrop",3,"click"],[1,"alert-box"],[1,"alert-box-actions"],[1,"btn","btn-primary",3,"click"]],template:function(n,t){1&n&&(i.Kb(0,"div",0),i.Rb("click",(function(){return t.onClose()})),i.Kb(1,"div",1),i.Kb(2,"p"),i.ec(3),i.Jb(),i.Kb(4,"div",2),i.Kb(5,"button",3),i.Rb("click",(function(){return t.onClose()})),i.ec(6," Close "),i.Jb(),i.Jb(),i.Jb(),i.Jb()),2&n&&(i.xb(3),i.fc(t.message))},styles:[".backdrop[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100vw;height:100vh;background:rgba(0,0,0,.75);z-index:50}.alert-box[_ngcontent-%COMP%]{position:fixed;top:30vh;left:20vw;width:60vw;padding:16px;z-index:100;background-color:#fff;box-shadow:0 2px 8px rbga(0,0,0,.26)}.alert-box-actions[_ngcontent-%COMP%]{text-align:right}"]}),n})(),s=(()=>{class n{constructor(n){this.viewContainerRef=n}}return n.\u0275fac=function(t){return new(t||n)(i.Hb(i.O))},n.\u0275dir=i.Cb({type:n,selectors:[["","appPlaceholder",""]]}),n})();var r=e("qXBG"),a=e("tyNb"),c=e("ofXK");let d=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=i.Bb({type:n,selectors:[["app-loading-spinner"]],decls:13,vars:0,consts:[[1,"lds-spinner"]],template:function(n,t){1&n&&(i.Kb(0,"div",0),i.Ib(1,"div"),i.Ib(2,"div"),i.Ib(3,"div"),i.Ib(4,"div"),i.Ib(5,"div"),i.Ib(6,"div"),i.Ib(7,"div"),i.Ib(8,"div"),i.Ib(9,"div"),i.Ib(10,"div"),i.Ib(11,"div"),i.Ib(12,"div"),i.Jb())},styles:['.lds-spinner[_ngcontent-%COMP%]{color:official;display:inline-block;position:relative;width:80px;height:80px}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{transform-origin:40px 40px;animation:lds-spinner 1.2s linear infinite}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:after{content:" ";display:block;position:absolute;top:3px;left:37px;width:6px;height:18px;border-radius:20%;background:#4c6ca0}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:first-child{transform:rotate(0deg);animation-delay:-1.1s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(2){transform:rotate(30deg);animation-delay:-1s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(3){transform:rotate(60deg);animation-delay:-.9s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(4){transform:rotate(90deg);animation-delay:-.8s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(5){transform:rotate(120deg);animation-delay:-.7s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(6){transform:rotate(150deg);animation-delay:-.6s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(7){transform:rotate(180deg);animation-delay:-.5s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(8){transform:rotate(210deg);animation-delay:-.4s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(9){transform:rotate(240deg);animation-delay:-.3s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(10){transform:rotate(270deg);animation-delay:-.2s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(11){transform:rotate(300deg);animation-delay:-.1s}.lds-spinner[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(12){transform:rotate(330deg);animation-delay:0s}@keyframes lds-spinner{0%{opacity:1}to{opacity:0}}']}),n})();var l=e("3Pt+");function b(n,t){}function g(n,t){1&n&&(i.Kb(0,"div",5),i.Ib(1,"app-loading-spinner"),i.Jb())}function p(n,t){if(1&n){const n=i.Lb();i.Kb(0,"form",6,7),i.Rb("ngSubmit",(function(){i.ac(n);const t=i.Zb(1);return i.Tb().onSubmit(t)})),i.Kb(2,"div",8),i.Kb(3,"label",9),i.ec(4,"E-Mail:"),i.Jb(),i.Ib(5,"input",10),i.Jb(),i.Kb(6,"div",8),i.Kb(7,"label",11),i.ec(8,"Password:"),i.Jb(),i.Ib(9,"input",12),i.Jb(),i.Kb(10,"div"),i.Kb(11,"button",13),i.ec(12),i.Jb(),i.ec(13," | "),i.Kb(14,"button",14),i.Rb("click",(function(){return i.ac(n),i.Tb().onToggleAuthMode()})),i.ec(15),i.Jb(),i.Jb(),i.Jb()}if(2&n){const n=i.Zb(1),t=i.Tb();i.xb(11),i.Ub("disabled",!n.valid),i.xb(1),i.gc(" ",t.isLoggedIn?"Login":"Sign Up"," "),i.xb(3),i.gc(" ",t.isLoggedIn?"Switch to Sign Up":"Switch to Login"," ")}}let u=(()=>{class n{constructor(n,t,e){this.authService=n,this.router=t,this.componentFactoryResolver=e,this.isLoggedIn=!0,this.isLoading=!1,this.error=null}onToggleAuthMode(){this.isLoggedIn=!this.isLoggedIn}onSubmit(n){if(!n.valid)return;const t=n.value.email,e=n.value.password;let i;this.isLoading=!0,i=this.isLoggedIn?this.authService.login(t,e):this.authService.signup(t,e),i.subscribe(n=>{this.isLoading=!1,this.router.navigate(["/recipes"])},n=>{this.error=n,this.showErrorAlert(n),this.isLoading=!1}),n.reset()}onHandleError(){this.error=null}showErrorAlert(n){const t=this.componentFactoryResolver.resolveComponentFactory(o),e=this.alertHost.viewContainerRef;e.clear();const i=e.createComponent(t);i.instance.message=n,this.closeSub=i.instance.close.subscribe(()=>{this.closeSub.unsubscribe(),e.clear()})}ngOnDestroy(){this.closeSub&&this.closeSub.unsubscribe()}}return n.\u0275fac=function(t){return new(t||n)(i.Hb(r.a),i.Hb(a.c),i.Hb(i.j))},n.\u0275cmp=i.Bb({type:n,selectors:[["app-auth"]],viewQuery:function(n,t){var e;1&n&&i.ic(s,!0),2&n&&i.Yb(e=i.Sb())&&(t.alertHost=e.first)},decls:5,vars:2,consts:[[1,"row"],[1,"col-xs-12","col-md-6","col-md-offset-3"],["appPlaceholder",""],["style","text-align: center;",4,"ngIf"],[3,"ngSubmit",4,"ngIf"],[2,"text-align","center"],[3,"ngSubmit"],["f","ngForm"],[1,"form-group"],["for","email"],["type","email","id","email","ngModel","","name","email","email","","required","",1,"form-control"],["for","password"],["type","password","id","password","ngModel","","name","password","required","","minlength","7",1,"form-control"],["type","submit",1,"btn","btn-primary",3,"disabled"],["type","button",1,"btn","btn-primary",3,"click"]],template:function(n,t){1&n&&(i.Kb(0,"div",0),i.Kb(1,"div",1),i.dc(2,b,0,0,"ng-template",2),i.dc(3,g,2,0,"div",3),i.dc(4,p,16,3,"form",4),i.Jb(),i.Jb()),2&n&&(i.xb(3),i.Ub("ngIf",t.isLoading),i.xb(1),i.Ub("ngIf",!t.isLoading))},directives:[s,c.i,d,l.u,l.m,l.n,l.a,l.l,l.o,l.b,l.s,l.k],encapsulation:2}),n})();var h=e("PCNd");let f=(()=>{class n{}return n.\u0275mod=i.Fb({type:n}),n.\u0275inj=i.Eb({factory:function(t){return new(t||n)},imports:[[c.b,l.j,a.f.forChild([{path:"",component:u}]),h.a]]}),n})()}}]);