import{isEmpty}from"../../base/helpers.mjs";import{Controller}from"../base.mjs";import{DetailingFormView}from"../../forms/enfugue/detailing.mjs";class DetailingController extends Controller{getState(e=!0){return{detailing:this.detailingForm.values}}getDefaultState(){return{detailing:{faceRestore:!1,faceInpaint:!1,handInpaint:!1,inpaintStrength:.25,detailStrength:0,detailInferenceSteps:null,detailGuidanceScale:null,detailControlnet:null,detailControlnetScale:null}}}setState(e){isEmpty(e.detailing)||this.detailingForm.setValues(e.detailing).then((()=>this.detailingForm.submit()))}async initialize(){this.detailingForm=new DetailingFormView(this.config),this.detailingForm.onSubmit((async e=>{this.engine.detailerFaceRestore=e.faceRestore,this.engine.detailerFaceInpaint=e.faceInpaint,this.engine.detailerHandInpaint=e.handInpaint,this.engine.detailerInpaintStrength=e.inpaintStrength,this.engine.detailerStrength=e.detailStrength,this.engine.detailerGuidanceScale=e.detailGuidanceScale,this.engine.detailerInferenceSteps=e.detailInferenceSteps,this.engine.detailerControlnet=e.detailControlnet,this.engine.detailerControlnetScale=e.detailControlnetScale})),this.application.sidebar.addChild(this.detailingForm)}}export{DetailingController as SidebarController};
