import{isEmpty}from"../../base/helpers.mjs";import{Controller}from"../base.mjs";import{GenerationFormView}from"../../forms/enfugue/generation.mjs";class GenerationController extends Controller{getState(e=!0){return{generation:this.generationForm.values}}getDefaultState(){return{generation:{samples:1,iterations:1,seed:null}}}setState(e){isEmpty(e.generation)||this.generationForm.setValues(e.generation).then((()=>this.generationForm.submit()))}async initialize(){this.generationForm=new GenerationFormView(this.config),this.generationForm.onSubmit((async e=>{this.engine.samples=e.samples,this.engine.iterations=e.iterations,this.engine.seed=e.seed})),this.application.sidebar.addChild(this.generationForm)}}export{GenerationController as SidebarController};
