import{a as D}from"./chunk-5DV4GAJI.js";import{a as M}from"./chunk-3VELF5RN.js";import{I as N,g as E,p as l}from"./chunk-OXOZU62Y.js";import{h as A,y as k}from"./chunk-WEQN5LYX.js";import{E as U,F as j,d as y,f as q,s as I,t as L}from"./chunk-V67SIXYX.js";import{a as F,b as H}from"./chunk-LI2NM675.js";import{$b as a,Cd as _,F as u,Hc as C,Jc as v,Kb as g,Qb as s,Td as R,Yc as b,Zc as x,a as d,ad as S,b as f,ic as r,jc as m,k as c,kc as w,la as T,od as P,tc as p,xb as n,yb as h}from"./chunk-HEIW4SFT.js";k();T();H();L();P();j();R();q();function B(t,G){if(t&1&&(r(0,"div",5),C(1),b(2,"translate"),m()),t&2){let e=p(2);n(),v(" ",x(2,1,e.modalError)," ")}}function O(t,G){if(t&1&&(r(0,"div",2),w(1,"paw-input-field",3)(2,"paw-input-field",3)(3,"paw-input-field",3),s(4,B,3,3,"div",4),m()),t&2){let e=p();n(),a("field",e.inputFields.username)("model",e.dataModel)("form",e.formGroup),n(),a("field",e.inputFields.password)("model",e.dataModel)("form",e.formGroup),n(),a("field",e.inputFields.domainName)("model",e.dataModel)("form",e.formGroup),n(),a("ngIf",e.modalError)}}var oe=(()=>{class t{constructor(e){this.authService=e,this.allowDomainChange=!0,this.isEditable=!1,this.modalError="",this.dataModel={username:"",password:"",domainName:""},this.formGroup=new A([]),this.inputFields={username:{id:"username",label:"UserName",component:l,required:!0},password:{id:"password",label:"Password",component:N,required:!0,revealPassword:!1},domainName:{id:"domainName",label:"DomainName",component:l,required:!0}},this.formSettings={onSubmit:(i,o)=>{this.onSubmit(i)}},this.formActions=[{id:"cancel",label:"Cancel",type:"paw-chip-btn",onSelected:()=>{this.dialogRef.close()}}],this.submitAction={label:"Login"}}ngOnInit(){return c(this,null,function*(){let e=yield u(this.authService.authUser$);this.dataModel={username:"",password:"",domainName:e?.domain||""},this.inputFields.domainName.disabled=!this.allowDomainChange})}onSubmit(e){try{let i=F.backofficeUrl+I.auth.reLogin(f(d({},e),{returnUrl:window.location.href}));window.location.href=i}catch(i){this.modalError=D.errorHandler(i)}}static{this.\u0275fac=function(i){return new(i||t)(h(U))}}static{this.\u0275cmp=g({type:t,selectors:[["paw-change-user"]],inputs:{dialogRef:"dialogRef",dialogApi:"dialogApi",allowDomainChange:"allowDomainChange"},standalone:!1,decls:3,vars:5,consts:[["contentTpl",""],[1,"relative",3,"form","settings","model","actions","submitAction"],[1,"paw-padding-left-m","paw-padding-right-m","paw-padding-bottom-m","paw-padding-top-s","paw-area-v","paw-gap-xs"],[1,"paw-label-width-l",3,"field","model","form"],["class","paw-text-status-danger",4,"ngIf"],[1,"paw-text-status-danger"]],template:function(i,o){i&1&&(r(0,"paw-form",1),s(1,O,5,10,"ng-template",null,0,S),m()),i&2&&a("form",o.formGroup)("settings",o.formSettings)("model",o.dataModel)("actions",o.formActions)("submitAction",o.submitAction)},dependencies:[_,E,M,y],encapsulation:2})}}return t})();export{oe as a};
