import {J,c as tS,n4 as l,U as RN,aV as ut,du as w$1,by as it,n5 as a,w as wo,c1 as Tc,dF as L,f as QT,X as _z,e5 as Gu,a0 as ks,a3 as Py,a2 as Uu,e6 as zu,A as Iw,a4 as Sy,cF as rD}from'./main-WUGO6e7n.js';var W,w=J(()=>{tS();l();RN();tS();ut();w$1();W=(()=>{class e{constructor(t,i){this.isNew=!0,this.disabled=!1,this.type="button",this.onSubmit=new it,this.onClick=new it,this.isSubmitDisabled=!0,this.submitButtonDisabled=!1,t&&(this.parent=t),this.loadingService=i,this.isLoading=!1;}ngAfterViewInit(){this.loadingSubscription=this.loadingService.isWorking().subscribe(t=>{t.mode===a.Local&&(this.isLoading=t.isLoading,this.toggleSubmitButton());}),this.parent.form.valueChanges.subscribe(()=>{this.toggleSubmitButton();});}ngAfterContentChecked(){this.isSubmitDisabled=this.submitButtonDisabled;}ngOnChanges(t){this.toggleSubmitButton();}submit(){this.type==="button"&&(this.onSubmit.emit(),this.onClick.emit());}ngOnDestroy(){this.loadingSubscription&&this.loadingSubscription.unsubscribe();}toggleSubmitButton(){this.submitButtonDisabled=this.isLoading||!this.isNew&&this.parent.pristine||this.disabled||this.parent.form.invalid;}static{this.\u0275fac=function(i){return new(i||e)(wo(Tc,9),wo(L))};}static{this.\u0275cmp=QT({type:e,selectors:[["sd-submit-button"]],inputs:{isNew:"isNew",disabled:"disabled",parent:"parent",type:"type",label:"label"},outputs:{onSubmit:"onSubmit",onClick:"onClick"},features:[rD],decls:2,vars:2,consts:[["type","button","variant","primary",3,"onClick","label","disabled"]],template:function(i,n){i&1&&(Gu(0),ks(1,"dvl-button",0),Py("onClick",function(){return n.submit()}),Uu(),zu()),i&2&&(Iw(),Sy("label",n.label)("disabled",n.isSubmitDisabled));},dependencies:[_z],encapsulation:2,changeDetection:1});}}return e})();});export{W,w};