UNPKG

leaf-framework

Version:
1 lines 28.6 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/http"),require("@ngx-translate/core"),require("@ngx-translate/http-loader"),require("@angular/common"),require("@angular/forms"),require("@angular/router"),require("ngx-bootstrap"),require("@angular/animations"),require("rxjs/Subject"),require("base-api-service"),require("rxjs/Rx"),require("rxjs/add/operator/map")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/http","@ngx-translate/core","@ngx-translate/http-loader","@angular/common","@angular/forms","@angular/router","ngx-bootstrap","@angular/animations","rxjs/Subject","base-api-service","rxjs/Rx","rxjs/add/operator/map"],e):e((t.ng=t.ng||{},t.ng.leafFramework=t.ng.leafFramework||{}),t.ng.core,t._angular_http,t._ngxTranslate_core,t._ngxTranslate_httpLoader,t._angular_common,t._angular_forms,t._angular_router,t.ngxBootstrap,t._angular_animations,t.rxjs_Subject,t.baseApiService,t.rxjs_Rx)}(this,function(t,e,n,r,o,i,a,s,c,u,l,p,g){"use strict";function d(t){return new o.TranslateHttpLoader(t,"/assets/i18n/",".json")}function h(t,e){if(t)throw new Error(e+" has already been loaded. Import Core modules in the AppModule only.")}var f=function(){function t(){}return t.getErrorMessage=function(t,e){var n=new Map;return n.set("required","This field is mandatory"),n.set("invalidCreditCard","Is invalid credit card number"),n.set("invalidEmailAddress","Invalid email address"),n.set("invalidPassword","Password must be at least 6 characters long, and contain a number."),n.set("minlength","Minimum length "+(e?e.requiredLength:0)),n.set("invalidPositiveNumber","The value is invalid"),n.get(t)},t.positiveNumberValidator=function(t){return parseInt(t.value,10)>=0?null:{invalidPositiveNumber:!0}},t.creditCardValidator=function(t){return t.value.match(/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/)?null:{invalidCreditCard:!0}},t.emailValidator=function(t){return t.value.match(/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/)?null:{invalidEmailAddress:!0}},t.passwordValidator=function(t){return t.value.match(/^(?=.*[0-9])[a-zA-Z0-9!@#$%^&*]{6,100}$/)?null:{invalidPassword:!0}},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}(),m=function(){function t(){}return t.prototype.ngOnInit=function(){},t.prototype.isInvalid=function(){return this.control&&this.control.touched&&!this.control.valid},t.prototype.hasError=function(t){return this.control&&this.control.hasError(t)&&this.control.touched},Object.defineProperty(t.prototype,"errorMessage",{get:function(){if(this.validator)this._errorMessage=this.hasError(this.validator)?this.message||f.getErrorMessage(this.validator):null;else if(this.control.errors)for(var t in this.control.errors)if(this.hasError(t)){this._errorMessage=this.message||f.getErrorMessage(t);break}return this._errorMessage},enumerable:!0,configurable:!0}),t.decorators=[{type:e.Component,args:[{selector:"app-control-messages",template:'\n<div *ngIf="isInvalid()" class="help-block">{{ errorMessage }}</div>\n '}]}],t.ctorParameters=function(){return[]},t.propDecorators={control:[{type:e.Input}],message:[{type:e.Input}],validator:[{type:e.Input}]},t}(),y=function(){function t(){}return t}(),A=function(){function t(t){this.loggerService=t,this.title="Page not found",this.message="Sorry, This page is not available"}return t.prototype.ngOnInit=function(){this.loggerService.log("... initializing page not found component from shared module.")},t.decorators=[{type:e.Component,args:[{selector:"leaf-layout-page-not-found",template:'\n <div class="container text-center">\n <h2>{{title}}</h2>\n <img class="img-responsive" src="assets/images/404-Page-Not-Found.png" class="text-center">\n <h4>{{message}}</h4>\n </div>\n '}]}],t.ctorParameters=function(){return[{type:y,decorators:[{type:e.Inject,args:["LoggerService"]}]}]},t}(),v=function(){function t(){}return t}(),C=function(){function t(t,e,n,r){this.formBuilder=t,this.route=e,this.router=n,this.authService=r,this.loading=!1}return t.prototype.ngOnInit=function(){this.authService.logout(),this.f=this.formBuilder.group({username:["",a.Validators.required],password:["",a.Validators.required]})},t.prototype.isInvalid=function(t){return t&&t.touched&&!t.valid},t.prototype.errorClass=function(t){var e=this.isInvalid(t);return{"has-error":e,"has-feedback":e}},t.prototype.login=function(){var t=this;if(this.f.dirty&&this.f.valid){this.loading=!0;var e=this.f.value.username,n=this.f.value.password;this.authService.login(e,n).subscribe(function(e){t.loading=!1,e.access_token?t.router.navigate([t.route.snapshot.queryParams.returnUrl||"/"]):t.showAuthError("Token not sent from service during authentication.")},function(e){t.showAuthError("The user is not authorized"),t.loading=!1})}},t.prototype.showAuthError=function(t){var e=this;this.authError=t,setTimeout(function(){e.authError=null},1e3)},t.decorators=[{type:e.Component,args:[{selector:"app-login",template:'\n <div class="col-md-6 col-md-offset-3">\n <h2>Login</h2>\n <form [formGroup]="f" (ngSubmit)="login()" novalidate>\n <div *ngIf="authError" id="message" role="alert" class="alert alert-danger"><i class="fa fa-remove"></i> {{authError}}</div>\n <div class="form-group" [ngClass]="errorClass(f.controls.username)">\n <label for="username">User name:</label>\n <input type="text" class="form-control" id="username" formControlName="username" placeholder="Enter user name ...">\n <span *ngIf="isInvalid(f.controls.username)" class="glyphicon glyphicon-remove form-control-feedback"></span>\n <leaf-layout-control-messages [formControl]="f.controls.username" [message]="\'Username is required!\'"></leaf-layout-control-messages>\n </div>\n <div class="form-group" [ngClass]="errorClass(f.controls.password)">\n <label for="pwd">Password:</label>\n <input type="password" class="form-control" id="pwd" formControlName="password" placeholder="Enter password ...">\n <span *ngIf="isInvalid(f.controls.password)" class="glyphicon glyphicon-remove form-control-feedback"></span>\n <leaf-layout-control-messages [formControl]="f.controls.password" [message]="\'Password is required!\'"></leaf-layout-control-messages>\n </div>\n <div class="form-group">\n <button type="submit" class="btn btn-primary" [disabled]="(f.dirty && !f.valid) || loading">Login</button>\n <img *ngIf="loading" src="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" />\n </div>\n </form>\n </div>\n '}]}],t.ctorParameters=function(){return[{type:a.FormBuilder},{type:s.ActivatedRoute},{type:s.Router},{type:v,decorators:[{type:e.Inject,args:["AuthService"]}]}]},t}(),I=u.trigger("titleTemplateAnimation",[u.transition(":enter",[u.style({opacity:0,position:"relative",top:"-100px","transition-timing-function":"ease-out"}),u.animate("0.4s",u.style({opacity:1,top:"0px"}))])]),b=function(){function t(){}return t.decorators=[{type:e.Component,args:[{selector:"[leaf-page-template]",template:'\n <div class="row wrapper border-bottom white-bg page-heading ng-scope" *ngIf="title" [@titleTemplateAnimation]>\n <div [ngClass]="{\'col-sm-4\': (titleRightWrapper.children.length > 0), \'col-sm-12\' : (titleRightWrapper.children.length === 0)}">\n <h2 class="m-b-xxs">{{ title }}</h2>\n </div>\n <div class="col-sm-8" [ngClass]="{\'hidden\': titleRightWrapper.children.length === 0}">\n <div class="pull-right m-t-md" #titleRightWrapper>\n <ng-content select="[title-right]"></ng-content>\n </div>\n </div>\n </div>\n <div class="row" >\n <div class="col-lg-12">\n <div class="wrapper wrapper-content">\n <ng-content select="[content]"></ng-content>\n </div>\n </div>\n </div>\n ',animations:[I]}]}],t.ctorParameters=function(){return[]},t.propDecorators={title:[{type:e.Input}]},t}(),S=function(){function t(){this.spinnerSubject=new l.Subject,this.spinnerState=this.spinnerSubject.asObservable()}return t.prototype.show=function(){this.spinnerSubject.next({show:!0})},t.prototype.hide=function(){this.spinnerSubject.next({show:!1})},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}();!function(t){t.USER_ID="userId",t.TOKEN_ID="token"}(t.CookieIdentifiers||(t.CookieIdentifiers={}));var E=function(){function n(t){this.apiConfig=t}return n.prototype.isUserLogged=function(){if("SkypAuthService"===this.apiConfig.authService.name)return!0;var t=this.getUserLogged(),e=this.getToken();return!p.CommonUtil.isEmpty(t)&&!p.CommonUtil.isEmpty(e)},n.prototype.getUserLogged=function(){return"SkypAuthService"===this.apiConfig.authService.name?null:p.CommonUtil.getCookie(t.CookieIdentifiers.USER_ID)},n.prototype.getToken=function(){return"SkypAuthService"===this.apiConfig.authService.name?null:p.CommonUtil.getCookie(t.CookieIdentifiers.TOKEN_ID)},n.prototype.addUserInfo=function(e,n){var r=p.CommonUtil.changeExpiredTime(60*n*1e3);document.cookie=t.CookieIdentifiers.USER_ID+"="+e+"; expires="+r+"; path=/"},n.prototype.addTokenInfo=function(e,n){var r=p.CommonUtil.changeExpiredTime(60*n*1e3);document.cookie=t.CookieIdentifiers.TOKEN_ID+"="+e+"; expires="+r+"; path=/"},n.prototype.removeUserInfo=function(){var e=p.CommonUtil.changeExpiredTime(0);document.cookie=t.CookieIdentifiers.USER_ID+"=; expires="+e+"; path=/"},n.prototype.removeTokenInfo=function(){var e=p.CommonUtil.changeExpiredTime(0);document.cookie=t.CookieIdentifiers.TOKEN_ID+"=; expires="+e+"; path=/"},n.ctorParameters=function(){return[{type:p.ApiConfig,decorators:[{type:e.Inject,args:["api.config"]}]}]},n}(),w=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),M=function(r){function o(t,e,n,o){var i=r.call(this,t,e)||this;return i.spinnerService=n,i.authHelper=o,i.NOT_REQUIRE_AUTH=["/oauth/token","logout"],i.AUTH_TYPE="Bearer",i}return w(o,r),o.prototype.get=function(t,e){var n=this;return this.isHttpService(t)?this.canCallHttp(t)?(this.requestInterceptor(t),r.prototype.get.call(this,t,this.getRequestOptionArgs(e)).finally(function(){return n.onFinally()})):this.getAuthError():r.prototype.get.call(this,t,this.getRequestOptionArgs(e))},o.prototype.post=function(t,e,n){var o=this;return this.isHttpService(t)?this.canCallHttp(t)?(this.requestInterceptor(t),r.prototype.post.call(this,t,e,this.getRequestOptionArgs(n)).finally(function(){return o.onFinally()})):this.getAuthError():r.prototype.post.call(this,t,e,this.getRequestOptionArgs(n))},o.prototype.put=function(t,e,n){var o=this;return this.isHttpService(t)?this.canCallHttp(t)?(this.requestInterceptor(t),r.prototype.put.call(this,t,e,this.getRequestOptionArgs(n)).finally(function(){return o.onFinally()})):this.getAuthError():r.prototype.put.call(this,t,e,this.getRequestOptionArgs(n))},o.prototype.delete=function(t,e){var n=this;return this.isHttpService(t)?this.canCallHttp(t)?(this.requestInterceptor(t),r.prototype.delete.call(this,t,this.getRequestOptionArgs(e)).finally(function(){return n.onFinally()})):this.getAuthError():r.prototype.delete.call(this,t,this.getRequestOptionArgs(e))},o.prototype.isHttpService=function(t){return t&&t.startsWith("http")},o.prototype.canCallHttp=function(t){return this.authHelper.isUserLogged||!this.needAuthBefore(t)},o.prototype.needAuthBefore=function(t){return null==t?null:null==this.NOT_REQUIRE_AUTH.find(function(e){return t.indexOf(e)>=0})},o.prototype.getAuthError=function(){return g.Observable.throw({status:401,statusText:"UNAUTHORIZED"})},o.prototype.getRequestOptionArgs=function(e){e=e||new n.RequestOptions,e.headers=e.headers||new n.Headers,e.headers.get("content-type")||e.headers.append("content-type","application/json; charset=utf-8");var r=p.CommonUtil.getCookie(t.CookieIdentifiers.TOKEN_ID);return p.CommonUtil.isEmpty(r)||e.headers.set("Authorization",this.AUTH_TYPE+" "+r),e},o.prototype.requestInterceptor=function(t){this.needAuthBefore(t)&&this.spinnerService.show()},o.prototype.responseInterceptor=function(){this.spinnerService.hide()},o.prototype.onFinally=function(){this.responseInterceptor()},o.decorators=[{type:e.Injectable}],o.ctorParameters=function(){return[{type:n.ConnectionBackend},{type:n.RequestOptions},{type:S},{type:E}]},o}(n.Http),O=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[i.CommonModule,n.HttpModule,a.FormsModule,a.ReactiveFormsModule,s.RouterModule,c.ModalModule.forRoot(),r.TranslateModule],declarations:[C,A,m,b],exports:[i.CommonModule,n.HttpModule,a.FormsModule,a.ReactiveFormsModule,s.RouterModule,r.TranslateModule,c.ModalModule,C,A,m,b],providers:[{provide:n.Http,useClass:M,deps:[n.XHRBackend,n.RequestOptions,S,E]}],schemas:[e.CUSTOM_ELEMENTS_SCHEMA]}]}],t.ctorParameters=function(){return[]},t}(),k=function(){function t(t){this.applicationRef=t}return t.prototype.minimaliza=function(){this.applicationRef.components[0].instance.minimalize()},t.decorators=[{type:e.Component,args:[{selector:"[leaf-layout-minimalize]",template:'\n <a class="navbar-minimalize minimalize-styl-2 btn btn-primary" (click)="minimaliza()"><i class="fa fa-bars"></i> </a>\n '}]}],t.ctorParameters=function(){return[{type:e.ApplicationRef}]},t}(),R=function(){function t(t){this.http=t}return t.prototype.getData=function(){return this.http.get(this.getFilePath()).map(this.extractData)},t.prototype.extractData=function(t){var e=t.json()||{};return e.data||e},t}(),j=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_=function(t){function r(e){var n=t.call(this,e)||this;return n.http=e,n}return j(r,t),r.prototype.getFilePath=function(){return"assets/data/menu.json"},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:n.Http}]},r}(R),x=function(){function t(t){this.menuService=t}return t.prototype.ngOnInit=function(){var t=this;this.items&&0!==this.items.length||this.menuService.getData().subscribe(function(e){t.items=e})},t.decorators=[{type:e.Component,args:[{selector:"[leaf-layout-navbar]",template:'\n <li *ngFor="let menu of items" [routerLinkActive]="[\'active\']" [routerLinkActiveOptions]="{exact:true}">\n <a routerLink="{{menu.action}}">\n <i class="fa {{menu.icon}}"></i>\n <span class="nav-label ng-binding">{{menu.title}}</span>\n <span class="fa arrow" *ngIf="menu.items"></span>\n </a>\n </li>\n '}]}],t.ctorParameters=function(){return[{type:_}]},t.propDecorators={items:[{type:e.Input}]},t}(),T=function(){function t(t){this.loggerService=t,this.year=(new Date).getFullYear()}return t.prototype.ngOnInit=function(){this.loggerService.log("... initializing footer component from core module.")},t.decorators=[{type:e.Component,args:[{selector:"[leaf-layout-footer]",template:'\n <div class="pull-right">\n Welcome to the jungle!\n </div>\n <div>\n <strong>Copyright</strong> Demo full application &copy; {{year}}\n </div>\n '}]}],t.ctorParameters=function(){return[{type:y,decorators:[{type:e.Inject,args:["LoggerService"]}]}]},t}(),U=function(){function t(t,e){this.authHelper=t,this.loggerService=e}return t.prototype.ngOnInit=function(){this.loggerService.log("... initializing header component from core module.")},t.prototype.isActive=function(){return this.authHelper.isUserLogged()},t.prototype.getUser=function(){return this.authHelper.getUserLogged()},t.decorators=[{type:e.Component,args:[{selector:"[leaf-layout-header]",template:'\n <div class="navbar-header">\n <span><a leaf-layout-minimalize></a></span>\n <ng-content select="[header-left]"></ng-content>\n <span leaf-spinner></span>\n </div>\n <ng-content select="[header-right]"></ng-content>\n '}]}],t.ctorParameters=function(){return[{type:E},{type:y,decorators:[{type:e.Inject,args:["LoggerService"]}]}]},t}();!function(t){t.BLOCKING="BLOCKING",t.CONFIRM="CONFIRM"}(t.MessageType||(t.MessageType={})),function(t){t.SUCCESS="SUCCESS",t.INFO="INFO",t.WARNING="WARNING",t.DANGER="DANGER"}(t.MessageStatus||(t.MessageStatus={}));var H=function(){function n(){this.onOk=new e.EventEmitter,this.onClose=new e.EventEmitter}return n.prototype.ngOnInit=function(){},n.prototype.getIcon=function(){switch(this.status){case t.MessageStatus.DANGER:return"fa-times";case t.MessageStatus.INFO:return"fa-info-circle";case t.MessageStatus.SUCCESS:return"fa-check ";case t.MessageStatus.WARNING:return"fa-exclamation-triangle";default:return"fa-times"}},n.prototype.getTitle=function(){switch(this.status){case t.MessageStatus.DANGER:return"Error";case t.MessageStatus.INFO:return"Info";case t.MessageStatus.SUCCESS:return"Success ";case t.MessageStatus.WARNING:return"Warning";default:return"Error"}},n.prototype.getOkTitle=function(){return"OK"},n.prototype.getCancelTitle=function(){return this.type===t.MessageType.BLOCKING?"Close":"Cancel"},n.prototype.show=function(){this.modal.show()},n.prototype.hide=function(){this.modal&&this.modal.isShown&&(this.type===t.MessageType.CONFIRM&&this.onOk.emit(!1),this.modal.hide(),this.onClose.emit(null))},n.prototype.onOKEvent=function(){this.onOk.emit(!0),this.modal.hide(),this.onClose.emit(null)},n.prototype.onCancelEvent=function(){this.hide()},n.decorators=[{type:e.Component,args:[{selector:"app-modal-message",template:'\n <div class="modal fade" bsModal #modalMsg="bs-modal" [config]="{backdrop: \'static\'}" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">\n <div class="modal-dialog modal-sm">\n <div class="modal-content">\n <div class="modal-header">\n <h4 class="modal-title pull-left"><i class="fa {{getIcon()}}" aria-hidden="true"></i> {{getTitle()}}</h4>\n <button type="button" class="close pull-right" aria-label="Close" (click)="modalMsg.hide()">\n <span aria-hidden="true">&times;</span>\n </button>\n </div>\n <div class="modal-body">{{message}}</div>\n <div class="modal-footer">\n <button type="button" class="btn btn-primary" (click)="onOKEvent()" *ngIf="type == \'CONFIRM\'">{{getOkTitle()}}</button>\n <button type="button" class="btn btn-primary" (click)="onCancelEvent()">{{getCancelTitle()}}</button>\n </div>\n </div>\n </div>\n </div>\n ',styles:["\n\n .fa-times {\n color: red;\n }\n .fa-info-circle {\n color: blue;\n }\n .fa-exclamation-triangle {\n color: orange;\n }\n\n .fa-exclamation-triangle {\n color: orange;\n }\n\n .fa-check {\n color: green;\n }\n "]}]}],n.ctorParameters=function(){return[]},n.propDecorators={message:[{type:e.Input}],status:[{type:e.Input}],type:[{type:e.Input}],onOk:[{type:e.Output}],onClose:[{type:e.Output}],modal:[{type:e.ViewChild,args:["modalMsg"]}]},n}(),P=function(){function t(){this.subjectMsg=new l.Subject,this.subjectConfirmed=new l.Subject}return t.prototype.showMessage=function(t){this.subjectMsg.next(t)},t.prototype.confirmMessage=function(t){this.subjectConfirmed.next(t)},t.prototype.getMessage=function(){return this.subjectMsg.asObservable()},t.prototype.getConfirmed=function(){return this.subjectConfirmed.asObservable()},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}(),N=u.trigger("fadeInAnimation",[u.transition(":enter",[u.style({opacity:0}),u.animate("0.3s",u.style({opacity:1}))])]),D=function(){function t(t,e){this.loggerService=t,this.spinnerService=e,this.visible=!1}return t.prototype.ngOnInit=function(){var t=this;this.loggerService.log("... initializing spinner component from core module."),this.spinnerStateChanged=this.spinnerService.spinnerState.subscribe(function(e){t.visible=e.show})},t.prototype.ngOnDestroy=function(){this.spinnerStateChanged.unsubscribe()},t.decorators=[{type:e.Component,args:[{selector:"[leaf-spinner]",template:'\n <a class="btn btn-primary minimalize-styl-item" *ngIf="visible" [@fadeInAnimation]><i class="fa fa-circle-o-notch fa-spin"></i></a>\n ',animations:[N]}]}],t.ctorParameters=function(){return[{type:y,decorators:[{type:e.Inject,args:["LoggerService"]}]},{type:S}]},t}(),L=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),F=function(t){function r(e){var n=t.call(this,e)||this;return n.http=e,n}return L(r,t),r.prototype.getFilePath=function(){return"assets/data/languages.json"},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:n.Http}]},r}(R),q=function(){function t(t,e){this.languageService=t,this.translate=e,this.languageSelected=localStorage.language||"en"}return t.prototype.ngOnInit=function(){var t=this;this.languages&&0!==this.languages.length||this.languageService.getData().subscribe(function(e){t.languages=e})},t.prototype.onLanguageChange=function(t){console.log("... language changed to: "+t),this.translate.use(t),localStorage&&(localStorage.language=t),this.languageSelected=t},t.decorators=[{type:e.Component,args:[{selector:"leaf-language-selector",template:'\n <select class="form-control" id="languages" [(ngModel)]="languageSelected" (change)="onLanguageChange($event.target.value)">\n <option *ngFor="let lang of languages" [value]="lang.id">{{lang.title}}</option>\n </select>\n '}]}],t.ctorParameters=function(){return[{type:F},{type:r.TranslateService}]},t.propDecorators={languages:[{type:e.Input}]},t}(),G=function(){function t(t,e){this.router=t,this.authHelper=e}return t.prototype.canActivate=function(t,e){return console.log("... check if can active menu"),this.authHelper.isUserLogged()?(console.log("... the user is logged so you can activate the menu"),!0):(console.log("... the user is NOT logged so you will be redirected to the login page"),this.router.navigate(["/login"],{queryParams:{returnUrl:e.url}}),!1)},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:s.Router},{type:E}]},t}(),B=function(){function t(t,e){this.router=t,this.authHelper=e}return t.prototype.canActivate=function(t,e){return this.authHelper.isUserLogged()&&this.router.navigate(["/"],{queryParams:{returnUrl:e.url}}),!0},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:s.Router},{type:E}]},t}(),z=function(){function t(t){h(t,"LeafFrameworkCore")}return t.decorators=[{type:e.NgModule,args:[{imports:[O,r.TranslateModule.forRoot({loader:{provide:r.TranslateLoader,useFactory:d,deps:[n.Http]}})],declarations:[U,T,x,k,D,q,H],exports:[O,U,T,x,k,D,q,H],providers:[S,_,F,G,B,E,P]}]}],t.ctorParameters=function(){return[{type:t,decorators:[{type:e.Optional},{type:e.SkipSelf}]}]},t}(),Q=function(){function t(){this.cssClass="fixed-sidebar fixed-nav md-skin pace-done"}return t.prototype.minimalize=function(){var t=this.cssClass.indexOf(" mini-navbar");this.cssClass=t<0?this.cssClass+" mini-navbar":this.cssClass.substring(0,t)+this.cssClass.substring(t+" mini-navbar".length)},t.propDecorators={cssClass:[{type:e.HostBinding,args:["class"]}]},t}(),K=function(){function t(t,e,n){this.title=t,this.action=e,this.icon=n}return t}(),W=function(){function e(e,n,r){if(void 0===n&&(n=t.MessageStatus.DANGER),void 0===r&&(r=t.MessageType.BLOCKING),this.text=e,this.status=n,this.type=r,(n=n.toUpperCase())!==t.MessageStatus.INFO&&n!==t.MessageStatus.SUCCESS&&n!==t.MessageStatus.WARNING&&n!==t.MessageStatus.DANGER)throw new Error("Invalid message status. Should be Info, Success, Warning or Danger.");if((r=r.toUpperCase())!==t.MessageType.BLOCKING&&r!==t.MessageType.CONFIRM)throw new Error("Invalid message type. Should be Blocking or Confirm.");this.text=e,this.status=n,this.type=r}return e}(),Y=function(){function t(){}return t.prototype.unwrap=function(t){var e=t.rejection?t.rejection:t;return e=e.originalError?e.originalError:e.originalStack?e.originalStack:e},t.prototype.handleError=function(t){if(t=this.unwrap(t),401===t.status||403===t.status||"UNAUTHORIZED"===t)return console.log("... the authentication session has expires or the user is not authorised!"),void(location.href=location.pathname+"login");if(t.status>=400&&t.status<500)return void console.log("... the request is incorrect!");if(t.status>=500)return void console.log("... the server is not responding. Contact the administrator!");var e="";if(t instanceof n.Response){var r=t.json()||"";r.error||JSON.stringify(r);t.status>0&&(e+=t.status+" - "),e+=""+(t.statusText||"Error in the application")}else e=t.message?t.message:t.toString();alert(e)},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}(),V=function(){function t(){}return t.prototype.login=function(t,e){},t.prototype.logout=function(){},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}(),J=function(){function t(t,e,n){this.http=t,this.apiConfig=e,this.authHelper=n}return t.prototype.getServiceUrl=function(){return p.CommonUtil.getApiUrl("OAUTH_SERVICE_URL",this.apiConfig)||""},t.prototype.login=function(t,e){var r=this,o="grant_type=password&username="+t+"&password="+e,i=new n.Headers;i.append("Authorization","Basic "+btoa(this.apiConfig.credentials.clientId+":"+this.apiConfig.credentials.clientSecret)),i.append("Content-Type","application/x-www-form-urlencoded");var a=new n.RequestOptions({headers:i}),s=this.getServiceUrl();return null==s?null:this.http.post(s,o,a).map(function(e){var n=e.json()||{},o=n.expires_in||r.apiConfig.timeExpired;return"mock"===r.apiConfig.apiEnv&&(n.access_token="12345-67890-5555"),n.access_token&&(r.authHelper.addUserInfo(t,o),r.authHelper.addTokenInfo(n.access_token,o)),n})},t.prototype.logout=function(){this.authHelper.removeUserInfo(),this.authHelper.removeTokenInfo()},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:n.Http},{type:p.ApiConfig,decorators:[{type:e.Inject,args:["api.config"]}]},{type:E}]},t}(),Z=function(){function t(){}return t.prototype.log=function(t){console.log(t)},t.prototype.error=function(t){console.error(t)},t.prototype.warn=function(t){console.warn(t)},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}(),$=function(){function t(t,e,n){this.id=t,this.title=e,this.icon=n}return t}();t.LeafFrameworkCore=z,t.LeafFrameworkShared=O,t.fadeInAnimation=N,t.BaseAppComponent=Q,t.MinimalizeComponent=k,t.Menu=K,t.MenuService=_,t.NavComponent=x,t.HeaderComponent=U,t.FooterComponent=T,t.ControlMessagesComponent=m,t.PageNotFoundComponent=A,t.LoginComponent=C,t.Message=W,t.MessageService=P,t.ModalMessageComponent=H,t.LeafPageTemplate=b,t.createTranslateLoader=d,t.AuthGuard=G,t.LoginGuard=B,t.throwIfAlreadyLoaded=h,t.InterceptedHttp=M,t.AuthHelper=E,t.SimpleErrorHandler=Y,t.AuthService=v,t.SkypAuthService=V,t.OAuthService=J,t.ConsoleLoggerService=Z,t.JsonFileService=R,t.LoggerService=y,t.ValidationService=f,t.SpinnerComponent=D,t.SpinnerService=S,t.LanguageSelectorComponent=q,t.LanguageService=F,t.Language=$,Object.defineProperty(t,"__esModule",{value:!0})});