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-4a12e52c.js";import{u as L}from"./useCurrentProject-9bb1c6a4.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-8a9d1c2a.js";import{M as B,a as O,A as z,P as J}from"./useResourceConfiguration-e5577e2f.js";import{N as Q,M as _}from"./ModelFrameworkField-bbcaa0d2.js";import{s,g as q}from"./utils-108fce97.js";import"./useProject-04893095.js";import"./index-55c7d560.js";import"./useProjectId-b391bbaa.js";import"./FileUploaderButton-546aa096.js";import"./useDownload-e87fcc63.js";import"./PrimaryIconButton-0a56fae1.js";import"./index-1b686e0d.js";import"./file-utils-37d8d953.js";import"./index-68c92134.js";import"./groupBy-74540ff9.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};
