%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/www2]/app/
Upload File :
Create Path :
Current File : /home/vacivi36/www2]/app/730.59d61ff2dbdecf87.js

"use strict";(self.webpackChunkmaterial=self.webpackChunkmaterial||[]).push([[730],{6030:(k,_,l)=>{l.d(_,{x:()=>c});var g=l(8966),r=l(5e3),w=l(7423),C=l(3737);let p=(()=>{class d{constructor(h,m){this.dialogRef=h,this.data=m,this.loading=!1}ngOnInit(){}}return d.\u0275fac=function(h){return new(h||d)(r.Y36(g.so),r.Y36(g.WI))},d.\u0275cmp=r.Xpm({type:d,selectors:[["app-confirm-dialog"]],decls:13,vars:6,consts:[["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane",1,"p-4",2,"cursor","grab"],[1,"title-dialog"],[1,"mdi","mdi-alert","icon-alert"],[1,"message-dialog"],["align","end",1,"padding-buttons"],["mat-flat-button","",2,"margin-right","10px",3,"mat-dialog-close"],["mat-flat-button","","color","warn",1,"mr-2","custom-button","white",3,"mat-dialog-close"]],template:function(h,m){1&h&&(r.TgZ(0,"div",0)(1,"div",1),r._UZ(2,"i",2),r.TgZ(3,"span"),r._uU(4),r.qZA()(),r.TgZ(5,"div")(6,"span",3),r._uU(7),r.qZA()(),r.TgZ(8,"div",4)(9,"button",5),r._uU(10),r.qZA(),r.TgZ(11,"button",6),r._uU(12),r.qZA()()()),2&h&&(r.xp6(4),r.hij(" ",m.data.title," "),r.xp6(3),r.hij(" ",m.data.message," "),r.xp6(2),r.Q6J("mat-dialog-close",!1),r.xp6(1),r.hij(" ",m.data.button1,""),r.xp6(1),r.Q6J("mat-dialog-close",!0),r.xp6(1),r.hij(" ",m.data.button2," "))},dependencies:[w.lW,g.ZT,C.Zt],styles:['.title-dialog[_ngcontent-%COMP%]{font-weight:700;font-size:18px;margin-bottom:15px}.message-dialog[_ngcontent-%COMP%]{font-size:15px}.padding-buttons[_ngcontent-%COMP%]{margin-top:18px}.mdi-alert[_ngcontent-%COMP%]:before{content:"\\f0026";font-size:revert;color:#f39720}.custom-button[_ngcontent-%COMP%]{font-size:13px;font-weight:500;background-color:#dc3545;color:#fff}']}),d})(),c=(()=>{class d{constructor(h){this.dialog=h}openConfirmDialog(h,m,U,y){return this.dialog.open(p,{width:"360px",data:{title:h,message:m,button1:U,button2:y}})}}return d.\u0275fac=function(h){return new(h||d)(r.LFG(g.uw))},d.\u0275prov=r.Yz7({token:d,factory:d.\u0275fac,providedIn:"root"}),d})()},1730:(k,_,l)=>{l.r(_),l.d(_,{UsersModule:()=>Ce});var g=l(9808),r=l(6696),w=l(6087),C=l(4847),p=l(8279),c=l(3075),d=l(8966),e=l(5e3),h=l(7261),m=l(1538),U=l(6966),y=l(7423),b=l(4834),M=l(5899),N=l(2368),E=l(7238),A=l(3737),x=l(4376);function D(o,i){1&o&&e._UZ(0,"mat-progress-bar",27)}function I(o,i){if(1&o&&(e.TgZ(0,"div",31)(1,"span",32),e._uU(2),e.qZA(),e.TgZ(3,"span",33),e._uU(4),e.qZA()()),2&o){const t=i.item;e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Oqu(t.cnpj)}}function R(o,i){if(1&o&&(e.TgZ(0,"div",28)(1,"label",7),e._uU(2,"Empresa"),e.qZA(),e.TgZ(3,"ng-select",29),e.YNc(4,I,5,2,"ng-template",30),e.qZA()()),2&o){const t=e.oxw();e.xp6(3),e.Q6J("items",t.companies)("clearable",!0)}}function O(o,i){1&o&&(e.TgZ(0,"span",8),e._uU(1,"*"),e.qZA())}const P=function(o,i){return{"mdi-eye":o,"mdi-eye-off":i}};let Z=(()=>{class o{constructor(t,n,s,a,u,f){this.formBuilder=t,this._snackBar=n,this.userService=s,this.companyService=a,this.dialog=u,this.data=f,this.companies=[],this.loading=!1,this.savedChange=!1,this.showPassword=!1,this.user=this.data.user}ngOnInit(){this.initForm(),this.populateForm(this.user),this.downloadCompanies()}initForm(){var t,n,s;this.form=this.formBuilder.group({company_id:[null,[]],name:[null,[c.kI.required]],email:[null,[c.kI.required]],password:[null,[]],administrator:[null,[c.kI.required]],status:[!0]}),(null===(null===(t=this.user)||void 0===t?void 0:t.id)||void 0===(null===(n=this.user)||void 0===n?void 0:n.id))&&(null===(s=this.form.get("password"))||void 0===s||s.setValidators([c.kI.required])),this.checkIsUserAdmin()}save(t){if(this.form.valid){this.loading=!0;let n=this.form.value;this.user?this.userService.update(this.user.id,n).then(s=>{s&&(this.user=s,this.savedChange=!0,this.openSnackBar("Salvo com sucesso!","Fechar","success"),t&&this.closeDialog())}).catch(s=>{this.openSnackBar(s.error.message,"Fechar","danger")}).finally(()=>{this.loading=!1}):this.userService.create(n).then(s=>{s&&(this.user=s,this.savedChange=!0,this.openSnackBar("Salvo com sucesso!","Fechar","success"),t&&this.closeDialog())}).catch(s=>{this.openSnackBar(s.error.message,"Fechar","danger")}).finally(()=>{this.loading=!1})}}populateForm(t){this.form.patchValue(t)}canSave(){return this.form.valid&&!this.loading}closeDialog(){this.savedChange?this.dialog.close(this.user):this.dialog.close()}openSnackBar(t,n,s){this._snackBar.open(t,n,{horizontalPosition:"right",verticalPosition:"bottom",duration:4e3,panelClass:"snackBar-"+s})}downloadCompanies(){this.loading=!0,this.companyService.listActive().then(t=>{this.companies=t}).catch(t=>{this.openSnackBar("Erro ao listar empresas","Fechar","danger")}).finally(()=>{this.loading=!1})}checkIsUserAdmin(){var t;null===(t=this.form.get("administrator"))||void 0===t||t.valueChanges.subscribe(n=>{const s=this.form.get("company_id");n?null==s||s.clearValidators():null==s||s.setValidators([c.kI.required]),null==s||s.updateValueAndValidity()})}}return o.\u0275fac=function(t){return new(t||o)(e.Y36(c.qu),e.Y36(h.ux),e.Y36(m.K),e.Y36(U.J),e.Y36(d.so),e.Y36(d.WI))},o.\u0275cmp=e.Xpm({type:o,selectors:[["app-user-form-dialog"]],decls:50,vars:15,consts:[[3,"formGroup"],["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","",1,"d-flex","align-items-center","justify-content-between","cursor-pointer","p-2","mt-2","mx-2"],[1,"mdi","mdi-close","mb-2",3,"click"],["style","height: 3px;","color","accent","mode","indeterminate",4,"ngIf"],[1,"mat-typography","p-4","background-color-form"],[1,"row"],[1,"col-md-4"],[1,"form-label"],[1,"required"],["formControlName","administrator",1,"form-select"],[3,"value"],[1,"col-md-8"],["type","text","formControlName","name",1,"form-control"],["class","col-md-12 mt-3",4,"ngIf"],[1,"row","mt-3"],[1,"col-md-6"],["type","email","formControlName","email",1,"form-control"],["class","required",4,"ngIf"],[1,"password-input-container"],["formControlName","password",1,"form-control",3,"type","placeholder"],["type","button","matTooltip","Mostrar/Ocultar Senha",1,"btn","btn-show-password","shadow-none","active-none",3,"click"],[1,"mdi",3,"ngClass"],[1,"d-flex","align-items-center"],[1,"mt-3","d-flex","flex-column"],["color","accent","formControlName","status",1,"small-toggle"],["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","","align","end",1,"cursor-pointer","p-2","mt-1","mx-2","mb-1"],["mat-button","","color","accent",3,"disabled","click"],["color","accent","mode","indeterminate",2,"height","3px"],[1,"col-md-12","mt-3"],["bindLabel","name","bindValue","id","type","select","formControlName","company_id",1,"style-ng-select","form-select",3,"items","clearable"],["ng-option-tmp",""],[1,"d-flex","flex-column"],[1,"font-weight-bold"],[1,"small","text-muted"]],template:function(t,n){if(1&t&&(e.TgZ(0,"form",0)(1,"div",1)(2,"h6"),e._uU(3),e.qZA(),e.TgZ(4,"i",2),e.NdJ("click",function(){return n.closeDialog()}),e.qZA()(),e._UZ(5,"mat-divider"),e.YNc(6,D,1,0,"mat-progress-bar",3),e.TgZ(7,"div",4)(8,"div",5)(9,"div",6)(10,"label",7),e._uU(11,"Usu\xe1rio"),e.qZA(),e.TgZ(12,"span",8),e._uU(13,"*"),e.qZA(),e.TgZ(14,"ng-select",9)(15,"ng-option",10),e._uU(16,"Funcion\xe1rio"),e.qZA(),e.TgZ(17,"ng-option",10),e._uU(18,"Cliente"),e.qZA()()(),e.TgZ(19,"div",11)(20,"label",7),e._uU(21,"Nome"),e.qZA(),e.TgZ(22,"span",8),e._uU(23,"*"),e.qZA(),e._UZ(24,"input",12),e.qZA(),e.YNc(25,R,5,2,"div",13),e.qZA(),e.TgZ(26,"div",14)(27,"div",15)(28,"label",7),e._uU(29,"E-mail"),e.qZA(),e.TgZ(30,"span",8),e._uU(31,"*"),e.qZA(),e._UZ(32,"input",16),e.qZA(),e.TgZ(33,"div",15)(34,"label",7),e._uU(35),e.qZA(),e.YNc(36,O,2,0,"span",17),e.TgZ(37,"div",18),e._UZ(38,"input",19),e.TgZ(39,"button",20),e.NdJ("click",function(){return n.showPassword=!n.showPassword}),e._UZ(40,"i",21),e.qZA()()()(),e.TgZ(41,"div",22)(42,"div",23)(43,"label",7),e._uU(44,"Status"),e.qZA(),e._UZ(45,"mat-slide-toggle",24),e.qZA()()(),e._UZ(46,"mat-divider"),e.TgZ(47,"div",25)(48,"button",26),e.NdJ("click",function(){return n.save(!0)}),e._uU(49,"Salvar e Fechar"),e.qZA()()()),2&t){let s;e.Q6J("formGroup",n.form),e.xp6(3),e.Oqu(n.user?"Editar Usu\xe1rio #"+n.user.id:"Novo Usu\xe1rio"),e.xp6(3),e.Q6J("ngIf",n.loading),e.xp6(9),e.Q6J("value",!0),e.xp6(2),e.Q6J("value",!1),e.xp6(8),e.Q6J("ngIf",!1===(null==(s=n.form.get("administrator"))?null:s.value)),e.xp6(10),e.Oqu(n.user&&n.user.id?"Nova Senha":"Senha"),e.xp6(1),e.Q6J("ngIf",null==n.user),e.xp6(2),e.Q6J("type",n.showPassword?"text":"password")("placeholder",n.user&&n.user.id?"Digite uma nova senha":"Digite a senha"),e.xp6(2),e.Q6J("ngClass",e.WLB(12,P,!n.showPassword,n.showPassword)),e.xp6(8),e.Q6J("disabled",!n.canSave())}},dependencies:[g.mk,g.O5,y.lW,b.d,M.pW,N.Rr,E.gM,A.Zt,A.Bh,c._Y,c.Fj,c.JJ,c.JL,c.sg,c.u,x.w9,x.jq,x.ir],styles:['.style-ng-select[_ngcontent-%COMP%]{border-radius:4px;font-size:14px}.password-input-container[_ngcontent-%COMP%]{position:relative}.btn-show-password[_ngcontent-%COMP%]{position:absolute;top:55%;right:0;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:#b6b6b6}.mdi-information[_ngcontent-%COMP%]:before{content:"\\f02fc";font-size:13px;color:#dc3545}.small-toggle[_ngcontent-%COMP%]{transform:scale(.75);margin:0}.small-toggle[_ngcontent-%COMP%]   .mat-slide-toggle-thumb[_ngcontent-%COMP%]{width:12px;height:12px}.small-toggle[_ngcontent-%COMP%]   .mat-slide-toggle-bar[_ngcontent-%COMP%]{height:14px}.required[_ngcontent-%COMP%]{color:#ea0505;margin-left:5px}  ng-select .ng-select-container{font-size:14px!important}  ng-select .ng-option{font-size:14px!important}  ng-select .ng-value{font-size:14px!important}']}),o})();var F=l(4854),B=l(5664),H=l(6030),Y=l(5245),L=l(7531);function J(o,i){1&o&&e._UZ(0,"mat-progress-bar",22)}function q(o,i){1&o&&(e.TgZ(0,"th",23),e._uU(1," Nome"),e.qZA())}function Q(o,i){1&o&&e._UZ(0,"i",27)}function z(o,i){if(1&o&&(e.TgZ(0,"td",24),e.YNc(1,Q,1,0,"i",25),e.TgZ(2,"span",26),e._uU(3),e.qZA()()),2&o){const t=i.$implicit;e.xp6(1),e.Q6J("ngIf",t.master),e.xp6(2),e.Oqu(t.name)}}function K(o,i){1&o&&(e.TgZ(0,"th",23),e._uU(1," E-mail"),e.qZA())}function W(o,i){if(1&o&&(e.TgZ(0,"td",24),e._uU(1),e.qZA()),2&o){const t=i.$implicit;e.xp6(1),e.hij(" ",t.email,"")}}function j(o,i){1&o&&(e.TgZ(0,"th",23),e._uU(1," Empresa"),e.qZA())}function G(o,i){if(1&o&&(e.TgZ(0,"td",24),e._uU(1),e.qZA()),2&o){const t=i.$implicit;e.xp6(1),e.hij(" ",t.company&&t.company.name,"")}}function $(o,i){1&o&&(e.TgZ(0,"th",23),e._uU(1," Ativo"),e.qZA())}function X(o,i){1&o&&(e.TgZ(0,"mat-icon",30),e._uU(1,"check_circle"),e.qZA())}function ee(o,i){1&o&&(e.TgZ(0,"mat-icon",31),e._uU(1,"cancel"),e.qZA())}function te(o,i){if(1&o&&(e.TgZ(0,"td",24),e.YNc(1,X,2,0,"mat-icon",28),e.YNc(2,ee,2,0,"mat-icon",29),e.qZA()),2&o){const t=i.$implicit,n=e.oxw();e.xp6(1),e.Q6J("ngIf",t.status==n.STATUS.ACTIVE),e.xp6(1),e.Q6J("ngIf",t.status==n.STATUS.INACTIVE)}}function ie(o,i){1&o&&e._UZ(0,"th",32)}function ne(o,i){if(1&o){const t=e.EpF();e.TgZ(0,"td",24)(1,"div",33)(2,"button",34),e.NdJ("click",function(){const a=e.CHM(t).$implicit,u=e.oxw();return e.KtG(u.openDialog(a))}),e._UZ(3,"i",35),e.qZA(),e.TgZ(4,"button",36),e.NdJ("click",function(){const a=e.CHM(t).$implicit,u=e.oxw();return e.KtG(u.delete(a.id,a.name))}),e._UZ(5,"i",37),e.qZA()()()}}function oe(o,i){1&o&&e._UZ(0,"tr",38)}function se(o,i){1&o&&e._UZ(0,"tr",39)}function ae(o,i){if(1&o&&(e.TgZ(0,"tr",40)(1,"td",41)(2,"p",42),e._uU(3,"Nenhum registro encontrado."),e.qZA()()()),2&o){const t=e.oxw();e.xp6(1),e.uIk("colspan",t.displayedColumns.length)}}const re=function(){return[10,50,100]},le=[{path:"",component:(()=>{class o{constructor(t,n,s,a,u,f){this.elementRef=t,this._liveAnnouncer=n,this._snackBar=s,this.dialog=a,this.confirmService=u,this.userService=f,this.STATUS=F.Q,this.loading=!1,this.displayedColumns=["name","email","company","status","options"],this.dataSource=new p.by}ngOnInit(){this.downloadUsers()}ngAfterViewInit(){this.dataSource.sort=this.sort,this.dataSource.paginator=this.paginator}applyFilter(t){this.dataSource.filter=t.target.value.trim().toLowerCase()}sortChange(t){this._liveAnnouncer.announce(t.direction?`Sorted ${t.direction}ending`:"Sorting cleared")}openDialog(t){this.dialog.open(Z,{width:"700px",panelClass:"dialog",autoFocus:!1,data:{user:t}}).afterClosed().subscribe(s=>{s&&this.downloadUsers()})}downloadUsers(){this.loading=!0,this.userService.list().then(t=>{this.dataSource.data=t}).catch(t=>{this.openSnackBar("Erro ao listar usu\xe1rios","Fechar","danger")}).finally(()=>{this.loading=!1})}delete(t,n){this.confirmService.openConfirmDialog("Excluir","Tem certeza que deseja excluir o usu\xe1rio "+n+" ?","Cancelar","Excluir").afterClosed().subscribe(s=>{s&&(this.loading=!0,this.userService.delete(t).then(()=>{this.downloadUsers(),this.openSnackBar("Exclu\xeddo com sucesso!","Fechar","success")}).catch(a=>{this.openSnackBar("Erro ao excluir usu\xe1rio:  "+a,"Fechar","danger")}).finally(()=>{this.loading=!1}))})}openSnackBar(t,n,s){this._snackBar.open(t,n,{horizontalPosition:"right",verticalPosition:"bottom",duration:4e3,panelClass:"snackBar-"+s})}}return o.\u0275fac=function(t){return new(t||o)(e.Y36(e.SBq),e.Y36(B.Kd),e.Y36(h.ux),e.Y36(d.uw),e.Y36(H.x),e.Y36(m.K))},o.\u0275cmp=e.Xpm({type:o,selectors:[["app-user-list"]],viewQuery:function(t,n){if(1&t&&(e.Gf(w.NW,5),e.Gf(C.YE,5)),2&t){let s;e.iGM(s=e.CRH())&&(n.paginator=s.first),e.iGM(s=e.CRH())&&(n.sort=s.first)}},decls:33,vars:7,consts:[[1,"d-flex","align-items-center","justify-content-between","p-2"],["mat-raised-button","","color","accent",1,"style-button-add",3,"click"],[1,"mt-3"],["style","height: 3px;","color","accent","mode","indeterminate",4,"ngIf"],[1,"header-table"],[1,"search_input_group","search-table","w-25","mt-4","mb-4"],[1,"mdi","mdi-magnify"],["matInput","","placeholder","Pesquisar",1,"search_input",3,"input"],["input",""],["mat-table","","matSortActive","created_at","matSortDisableClear","","matSortDirection","desc","matSort","",3,"dataSource","matSortChange"],["matColumnDef","name"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","email"],["matColumnDef","company"],["matColumnDef","status"],["matColumnDef","options"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-header-row","",4,"matHeaderRowDef","matHeaderRowDefSticky"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],["showFirstLastButtons","",1,"mat-paginator",3,"pageSizeOptions"],["color","accent","mode","indeterminate",2,"height","3px"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["class","mdi mdi-shield-account","matTooltip","Usu\xe1rio Master",4,"ngIf"],[1,"mx-1"],["matTooltip","Usu\xe1rio Master",1,"mdi","mdi-shield-account"],["class","status-icon",4,"ngIf"],["class","status-icon-error",4,"ngIf"],[1,"status-icon"],[1,"status-icon-error"],["mat-header-cell",""],[1,"mat-icon-no-color"],["matTooltip","Editar",1,"icon-options",3,"click"],[1,"mdi","mdi-pencil-outline"],["matTooltip","Excluir",1,"icon-options-delete",3,"click"],[1,"mdi","mdi-trash-can-outline"],["mat-header-row",""],["mat-row",""],[1,"mat-row"],[1,"mat-cell"],[1,"d-flex","align-items-center","justify-content-center","mt-3"]],template:function(t,n){1&t&&(e.TgZ(0,"div",0)(1,"h3"),e._uU(2,"Usu\xe1rios"),e.qZA(),e.TgZ(3,"button",1),e.NdJ("click",function(){return n.openDialog()}),e._uU(4,"Adicionar Usu\xe1rio"),e.qZA()(),e._UZ(5,"mat-divider",2),e.YNc(6,J,1,0,"mat-progress-bar",3),e.TgZ(7,"div",4)(8,"div",5),e._UZ(9,"i",6),e._uU(10,"\xa0\xa0 "),e.TgZ(11,"input",7,8),e.NdJ("input",function(a){return n.applyFilter(a)}),e.qZA()(),e.TgZ(13,"table",9),e.NdJ("matSortChange",function(a){return n.sortChange(a)}),e.ynx(14,10),e.YNc(15,q,2,0,"th",11),e.YNc(16,z,4,2,"td",12),e.BQk(),e.ynx(17,13),e.YNc(18,K,2,0,"th",11),e.YNc(19,W,2,1,"td",12),e.BQk(),e.ynx(20,14),e.YNc(21,j,2,0,"th",11),e.YNc(22,G,2,1,"td",12),e.BQk(),e.ynx(23,15),e.YNc(24,$,2,0,"th",11),e.YNc(25,te,3,2,"td",12),e.BQk(),e.ynx(26,16),e.YNc(27,ie,1,0,"th",17),e.YNc(28,ne,6,0,"td",12),e.BQk(),e.YNc(29,oe,1,0,"tr",18),e.YNc(30,se,1,0,"tr",19),e.YNc(31,ae,4,1,"tr",20),e.qZA(),e._UZ(32,"mat-paginator",21),e.qZA()),2&t&&(e.xp6(6),e.Q6J("ngIf",n.loading),e.xp6(7),e.Q6J("dataSource",n.dataSource),e.xp6(16),e.Q6J("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),e.xp6(1),e.Q6J("matRowDefColumns",n.displayedColumns),e.xp6(2),e.Q6J("pageSizeOptions",e.DdM(6,re)))},dependencies:[g.O5,y.lW,p.BZ,p.fO,p.as,p.w1,p.Dz,p.nj,p.ge,p.ev,p.XQ,p.Gk,p.Ee,Y.Hw,L.Nt,b.d,w.NW,M.pW,C.YE,C.nU,E.gM],styles:['table[_ngcontent-%COMP%]{width:100%}h3[_ngcontent-%COMP%]{font-size:23px}.status-icon[_ngcontent-%COMP%]{font-size:16px;display:flex;align-items:center;color:#0d8a0d}.status-icon-error[_ngcontent-%COMP%]{font-size:16px;display:flex;align-items:center;color:#d00808}.scroll-table[_ngcontent-%COMP%]{max-height:718px;overflow:scroll}.mdi-shield-account[_ngcontent-%COMP%]:before{content:"\\f088f";font-size:14px}  .mat-table .mat-row:nth-child(odd){background-color:#f8f8f8}  .mat-table .mat-row:nth-child(even){background-color:#fff}']}),o})()},{path:"new",component:Z},{path:":id/edit",component:Z}];let ue=(()=>{class o{}return o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=e.oAB({type:o}),o.\u0275inj=e.cJS({imports:[r.Bz.forChild(le),r.Bz]}),o})();var ce=l(4540);let de=new e.OlP("currency.mask.config");class he{constructor(i){this.htmlInputElement=i}setCursorAt(i){if(this.htmlInputElement.setSelectionRange)this.htmlInputElement.focus(),this.htmlInputElement.setSelectionRange(i,i);else if(this.htmlInputElement.createTextRange){let t=this.htmlInputElement.createTextRange();t.collapse(!0),t.moveEnd("character",i),t.moveStart("character",i),t.select()}}updateValueAndCursor(i,t,n){this.rawValue=i,this.setCursorAt(n-=t-i.length)}get canInputMoreNumbers(){let i=!(this.rawValue.length>=this.htmlInputElement.maxLength&&this.htmlInputElement.maxLength>=0),t=this.inputSelection.selectionStart,n=this.inputSelection.selectionEnd,s=!(t==n||!this.htmlInputElement.value.substring(t,n).match(/\d/)),a="0"==this.htmlInputElement.value.substring(0,1);return i||s||a}get inputSelection(){let i=0,t=0;if("number"==typeof this.htmlInputElement.selectionStart&&"number"==typeof this.htmlInputElement.selectionEnd)i=this.htmlInputElement.selectionStart,t=this.htmlInputElement.selectionEnd;else{let n=document.getSelection().anchorNode;if(n&&n.firstChild==this.htmlInputElement){let s=this.htmlInputElement.value.length,a=this.htmlInputElement.value.replace(/\r\n/g,"\n"),u=this.htmlInputElement.createTextRange(),f=this.htmlInputElement.createTextRange();f.collapse(!1),u.compareEndPoints("StartToEnd",f)>-1?i=t=s:(i=-u.moveStart("character",-s),i+=a.slice(0,i).split("\n").length-1,u.compareEndPoints("EndToEnd",f)>-1?t=s:(t=-u.moveEnd("character",-s),t+=a.slice(0,t).split("\n").length-1))}}return{selectionStart:i,selectionEnd:t}}get rawValue(){return this.htmlInputElement&&this.htmlInputElement.value}set rawValue(i){this._storedRawValue=i,this.htmlInputElement&&(this.htmlInputElement.value=i)}get storedRawValue(){return this._storedRawValue}}class pe{constructor(i,t){this.htmlInputElement=i,this.options=t,this.inputManager=new he(i)}addNumber(i){this.rawValue||(this.rawValue=this.applyMask(!1,"0"));let t=String.fromCharCode(i),n=this.inputSelection.selectionStart,s=this.inputSelection.selectionEnd;this.rawValue=this.rawValue.substring(0,n)+t+this.rawValue.substring(s,this.rawValue.length),this.updateFieldValue(n+1)}applyMask(i,t){let{allowNegative:n,decimal:s,precision:a,prefix:u,suffix:f,thousands:Se}=this.options,S=(t=i?new Number(t).toFixed(a):t).replace(/[^0-9]/g,"");if(!S)return"";let T=S.slice(0,S.length-a).replace(/^0*/g,"").replace(/\B(?=(\d{3})+(?!\d))/g,Se);""==T&&(T="0");let V=T,v=S.slice(S.length-a);a>0&&(v="0".repeat(a-v.length)+v,V+=s+v);let _e=0==parseInt(T)&&(0==parseInt(v)||""==v);return(t.indexOf("-")>-1&&n&&!_e?"-":"")+u+V+f}clearMask(i){if(null==i||""==i)return null;let t=i.replace(this.options.prefix,"").replace(this.options.suffix,"");return this.options.thousands&&(t=t.replace(new RegExp("\\"+this.options.thousands,"g"),"")),this.options.decimal&&(t=t.replace(this.options.decimal,".")),parseFloat(t)}changeToNegative(){if(this.options.allowNegative&&""!=this.rawValue&&"-"!=this.rawValue.charAt(0)&&0!=this.value){let i=this.inputSelection.selectionStart;this.rawValue="-"+this.rawValue,this.updateFieldValue(i+1)}}changeToPositive(){let i=this.inputSelection.selectionStart;this.rawValue=this.rawValue.replace("-",""),this.updateFieldValue(i-1)}fixCursorPosition(i){let t=this.inputSelection.selectionStart;t>this.getRawValueWithoutSuffixEndPosition()||i?this.inputManager.setCursorAt(this.getRawValueWithoutSuffixEndPosition()):t<this.getRawValueWithoutPrefixStartPosition()&&this.inputManager.setCursorAt(this.getRawValueWithoutPrefixStartPosition())}getRawValueWithoutSuffixEndPosition(){return this.rawValue.length-this.options.suffix.length}getRawValueWithoutPrefixStartPosition(){return null!=this.value&&this.value<0?this.options.prefix.length+1:this.options.prefix.length}removeNumber(i){let{decimal:t,thousands:n}=this.options,s=this.inputSelection.selectionEnd,a=this.inputSelection.selectionStart;a>this.rawValue.length-this.options.suffix.length&&(s=this.rawValue.length-this.options.suffix.length,a=this.rawValue.length-this.options.suffix.length),s==a&&((46==i||63272==i)&&/^\d+$/.test(this.rawValue.substring(a,s+1))&&(s+=1),(46==i||63272==i)&&(this.rawValue.substring(a,s+1)==t||this.rawValue.substring(a,s+1)==n)&&(s+=2,a+=1),8==i&&/^\d+$/.test(this.rawValue.substring(a-1,s))&&(a-=1),8==i&&(this.rawValue.substring(a-1,s)==t||this.rawValue.substring(a-1,s)==n)&&(a-=2,s-=1)),this.rawValue=this.rawValue.substring(0,a)+this.rawValue.substring(s,this.rawValue.length),this.updateFieldValue(a)}updateFieldValue(i){let t=this.applyMask(!1,this.rawValue||"");this.inputManager.updateValueAndCursor(t,this.rawValue.length,i=null==i?this.rawValue.length:i)}updateOptions(i){let t=this.value;this.options=i,this.value=t}get canInputMoreNumbers(){return this.inputManager.canInputMoreNumbers}get inputSelection(){return this.inputManager.inputSelection}get rawValue(){return this.inputManager.rawValue}set rawValue(i){this.inputManager.rawValue=i}get storedRawValue(){return this.inputManager.storedRawValue}get value(){return this.clearMask(this.rawValue)}set value(i){this.rawValue=this.applyMask(!0,""+i)}}class me{constructor(i,t){this.inputService=new pe(i,t),this.htmlInputElement=i}handleClick(i,t){0==Math.abs(this.inputService.inputSelection.selectionEnd-this.inputService.inputSelection.selectionStart)&&!isNaN(this.inputService.value)&&this.inputService.fixCursorPosition(t)}handleCut(i){this.isReadOnly()||setTimeout(()=>{this.inputService.updateFieldValue(),this.setValue(this.inputService.value),this.onModelChange(this.inputService.value)},0)}handleInput(i){if(this.isReadOnly())return;let t=this.getNewKeyCode(this.inputService.storedRawValue,this.inputService.rawValue),n=this.inputService.rawValue.length,s=this.inputService.inputSelection.selectionEnd,a=this.inputService.getRawValueWithoutSuffixEndPosition(),u=this.inputService.storedRawValue.length;if(this.inputService.rawValue=this.inputService.storedRawValue,s==a&&1==Math.abs(n-u)||0==u){if(n<u&&(0!=this.inputService.value?this.inputService.removeNumber(8):this.setValue(null)),n>u)switch(t){case 43:this.inputService.changeToPositive();break;case 45:this.inputService.changeToNegative();break;default:if(!this.inputService.canInputMoreNumbers||isNaN(this.inputService.value)&&null==String.fromCharCode(t).match(/\d/))return;this.inputService.addNumber(t)}this.setCursorPosition(i),this.onModelChange(this.inputService.value)}else this.setCursorPosition(i)}handleKeydown(i){if(this.isReadOnly())return;let t=i.which||i.charCode||i.keyCode;if(8==t||46==t||63272==t){i.preventDefault();let n=Math.abs(this.inputService.inputSelection.selectionEnd-this.inputService.inputSelection.selectionStart);(n==this.inputService.rawValue.length||0==this.inputService.value)&&(this.setValue(null),this.onModelChange(this.inputService.value)),0==n&&!isNaN(this.inputService.value)&&(this.inputService.removeNumber(t),this.onModelChange(this.inputService.value)),(8===t||46===t)&&0!=n&&!isNaN(this.inputService.value)&&(this.inputService.removeNumber(t),this.onModelChange(this.inputService.value))}}handleKeypress(i){if(this.isReadOnly())return;let t=i.which||i.charCode||i.keyCode;if(null!=t&&-1==[9,13].indexOf(t)&&!this.isArrowEndHomeKeyInFirefox(i)){switch(t){case 43:this.inputService.changeToPositive();break;case 45:this.inputService.changeToNegative();break;default:this.inputService.canInputMoreNumbers&&(!isNaN(this.inputService.value)||null!=String.fromCharCode(t).match(/\d/))&&this.inputService.addNumber(t)}i.preventDefault(),this.onModelChange(this.inputService.value)}}handleKeyup(i){this.inputService.fixCursorPosition()}handlePaste(i){this.isReadOnly()||setTimeout(()=>{this.inputService.updateFieldValue(),this.setValue(this.inputService.value),this.onModelChange(this.inputService.value)},1)}updateOptions(i){this.inputService.updateOptions(i)}getOnModelChange(){return this.onModelChange}setOnModelChange(i){this.onModelChange=i}getOnModelTouched(){return this.onModelTouched}setOnModelTouched(i){this.onModelTouched=i}setValue(i){this.inputService.value=i}getNewKeyCode(i,t){if(i.length>t.length)return null;for(let n=0;n<t.length;n++)if(i.length==n||i[n]!=t[n])return t.charCodeAt(n);return null}isArrowEndHomeKeyInFirefox(i){return-1!=[35,36,37,38,39,40].indexOf(i.keyCode)&&(null==i.charCode||0==i.charCode)}isReadOnly(){return this.htmlInputElement&&this.htmlInputElement.readOnly}setCursorPosition(i){let t=this.inputService.getRawValueWithoutSuffixEndPosition();const n=i.target;setTimeout(function(){n.setSelectionRange(t,t)},0)}}const ge={provide:c.JU,useExisting:(0,e.Gpc)(()=>fe),multi:!0};let fe=(()=>{class o{constructor(t,n,s){this.currencyMaskConfig=t,this.elementRef=n,this.keyValueDiffers=s,this.options={},this.optionsTemplate={align:"right",allowNegative:!0,decimal:".",precision:2,prefix:"$ ",suffix:"",thousands:","},t&&(this.optionsTemplate=t),this.keyValueDiffer=s.find({}).create()}ngAfterViewInit(){this.elementRef.nativeElement.style.textAlign=this.options.align?this.options.align:this.optionsTemplate.align}ngDoCheck(){this.keyValueDiffer.diff(this.options)&&(this.elementRef.nativeElement.style.textAlign=this.options.align?this.options.align:this.optionsTemplate.align,this.inputHandler.updateOptions(Object.assign({},this.optionsTemplate,this.options)))}ngOnInit(){this.inputHandler=new me(this.elementRef.nativeElement,Object.assign({},this.optionsTemplate,this.options))}handleBlur(t){this.inputHandler.getOnModelTouched().apply(t)}handleClick(t){this.inputHandler.handleClick(t,this.isChromeAndroid())}handleCut(t){this.isChromeAndroid()||this.inputHandler.handleCut(t)}handleInput(t){this.isChromeAndroid()&&this.inputHandler.handleInput(t)}handleKeydown(t){this.isChromeAndroid()||this.inputHandler.handleKeydown(t)}handleKeypress(t){this.isChromeAndroid()||this.inputHandler.handleKeypress(t)}handleKeyup(t){this.isChromeAndroid()||this.inputHandler.handleKeyup(t)}handlePaste(t){this.isChromeAndroid()||this.inputHandler.handlePaste(t)}isChromeAndroid(){return/chrome/i.test(navigator.userAgent)&&/android/i.test(navigator.userAgent)}registerOnChange(t){this.inputHandler.setOnModelChange(t)}registerOnTouched(t){this.inputHandler.setOnModelTouched(t)}setDisabledState(t){this.elementRef.nativeElement.disabled=t}validate(t){let n={};return t.value>this.max&&(n.max=!0),t.value<this.min&&(n.min=!0),n!={}?n:null}writeValue(t){this.inputHandler.setValue(t)}}return o.\u0275fac=function(t){return new(t||o)(e.Y36(de,8),e.Y36(e.SBq),e.Y36(e.aQg))},o.\u0275dir=e.lG2({type:o,selectors:[["","currencyMask",""]],hostBindings:function(t,n){1&t&&e.NdJ("blur",function(a){return n.handleBlur(a)})("click",function(a){return n.handleClick(a)})("cut",function(a){return n.handleCut(a)})("input",function(a){return n.handleInput(a)})("keydown",function(a){return n.handleKeydown(a)})("keypress",function(a){return n.handleKeypress(a)})("keyup",function(a){return n.handleKeyup(a)})("paste",function(a){return n.handlePaste(a)})},inputs:{max:"max",min:"min",options:"options"},features:[e._Bn([ge,{provide:c.Cf,useExisting:o,multi:!0}])]}),o})(),ve=(()=>{class o{}return o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=e.oAB({type:o}),o.\u0275inj=e.cJS({imports:[[g.ez,c.u5]]}),o})(),Ce=(()=>{class o{}return o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=e.oAB({type:o}),o.\u0275inj=e.cJS({imports:[g.ez,ue,ce.m,c.UX,x.A0,ve]}),o})()}}]);

Zerion Mini Shell 1.0