import{j as e,a as r,aQ as g,aR as y,b1 as S,c9 as C,l as v,fJ as P,am as D,an as b,aW as M,a_ as V,K as k,fI as a,aS as E,aT as i,ak as G,e as K}from"./index-d6499a22.js";import{u as L}from"./useCurrentProject-b23444be.js";import{D as w,K as A,T as I,a as N,I as R,A as T,R as U,v as W}from"./validations-c473490c.js";import{M as B,a as O,A as z,P as J}from"./useResourceConfiguration-40036805.js";import{N as Q,M as _}from"./ModelFrameworkField-b2971863.js";import{s,g as q}from"./utils-b5e8f9a5.js";import"./useProject-0d0fdeb3.js";import"./index-0e1d5e0b.js";import"./useProjectId-6028b5ae.js";import"./FileUploaderButton-c4f1b533.js";import"./useDownload-7167ff3b.js";import"./PrimaryIconButton-fd23494f.js";import"./index-da50fbe6.js";import"./file-utils-b5704e1c.js";import"./index-d13f0052.js";import"./groupBy-d48cd610.js";const H=()=>e.jsxs(r,{sx:s.defaultGap,children:[e.jsx(Q,{}),e.jsx(w,{})]}),pe=()=>{const{id:n,project:l}=L(),d=g(),c=y(),m=S(),{state:p={}}=C(),[x,u]=v(),[j,{isLoading:o}]=P(),t=D({reValidateMode:"onChange",shouldUnregister:!1,mode:"onChange",defaultValues:{artifactVersion:null,...p},resolver:b(W)}),f=async h=>{if(G(t.formState.errors))try{await j({projectId:n,formValues:q({formValues:h,project:l})}).unwrap(),m(K.deployments.list)}catch(F){console.error(F)}};return e.jsxs(M,{...t,children:[o&&e.jsx(V,{}),e.jsxs("form",{onSubmit:t.handleSubmit(f,console.error),style:s.editForm,children:[e.jsx(r,{justifyContent:"center",sx:s.editFormWrapper,children:e.jsxs(r,{flexDirection:"column",sx:s.fieldsWrapper,children:[e.jsx(k,{title:"Create new deployment",children:e.jsxs(r,{flexDirection:"column",sx:s.defaultGap,children:[e.jsx(_,{}),e.jsx(H,{}),e.jsxs(r,{sx:s.defaultGap,children:[e.jsx(B,{}),e.jsx(O,{}),e.jsx(z,{})]}),e.jsx(A,{}),e.jsx(J,{isFileExplorerOpen:x,toggleFileExplorerPopup:u}),e.jsx(I,{})]})}),e.jsx(a,{title:"Kafka topic",children:e.jsxs(r,{flexDirection:"column",sx:s.defaultGap,children:[e.jsx(N,{}),e.jsx(R,{})]})}),e.jsx(a,{title:"Configuration",children:e.jsx(r,{flexDirection:"column",sx:s.defaultGap,children:e.jsx(T,{})})}),e.jsx(a,{title:"Resource allocation",children:e.jsx(U,{})})]})}),e.jsx(E,{hasScrollOnScreen:d,mainButton:e.jsx(i,{type:"submit",intent:"primary",disabled:o,isLoading:o,children:"Create new deployment"}),secondaryButton:e.jsx(i,{type:"button",intent:"secondary",onClick:()=>c(-1),children:"Back"})})]})]})};export{pe as Create,pe as default};
