import{j as e,Q as r,aR as g,aS as y,b2 as P,ca as S,P as v,fP as C,an as D,ao as b,aX as V,a$ as E,E as M,fO as t,aT as G,aU as i,al as k,b as w}from"./index-ea7817a2.js";import{u as A}from"./useCurrentProject-0132f110.js";import{D as L,K as N,T as R,a as I,I as K,A as O,R as T,v as U}from"./validations-7e0b3ce6.js";import{M as B,a as W,A as Q,P as X}from"./useResourceConfiguration-30b5e7f2.js";import{N as $,M as q}from"./ModelFrameworkField-6b7d2ab0.js";import{s,g as z}from"./utils-8f90da1d.js";import"./useProject-77619fff.js";import"./index-b96fda11.js";import"./useProjectId-fe5627bf.js";import"./FileUploaderButton-495e1c87.js";import"./useDownload-09eaf3eb.js";import"./PrimaryIconButton-fe990c52.js";import"./index-8f672200.js";import"./file-utils-a5f053e8.js";const H=()=>e.jsxs(r,{sx:s.defaultGap,children:[e.jsx($,{}),e.jsx(L,{})]}),ce=()=>{const{id:n,project:l}=A(),d=g(),c=y(),m=P(),{state:p={}}=S(),[x,u]=v(),[j,{isLoading:o}]=C(),a=D({reValidateMode:"onChange",shouldUnregister:!1,mode:"onChange",defaultValues:{artifactVersion:null,...p},resolver:b(U)}),f=async h=>{if(k(a.formState.errors))try{await j({projectId:n,formValues:z({formValues:h,project:l})}).unwrap(),m(w.deployments.list)}catch(F){console.error(F)}};return e.jsxs(V,{...a,children:[o&&e.jsx(E,{}),e.jsxs("form",{onSubmit:a.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(M,{title:"Create new deployment",children:e.jsxs(r,{flexDirection:"column",sx:s.defaultGap,children:[e.jsx(q,{}),e.jsx(H,{}),e.jsxs(r,{sx:s.defaultGap,children:[e.jsx(B,{}),e.jsx(W,{}),e.jsx(Q,{})]}),e.jsx(N,{}),e.jsx(X,{isFileExplorerOpen:x,toggleFileExplorerPopup:u}),e.jsx(R,{})]})}),e.jsx(t,{title:"Kafka topic",children:e.jsxs(r,{flexDirection:"column",sx:s.defaultGap,children:[e.jsx(I,{}),e.jsx(K,{})]})}),e.jsx(t,{title:"Configuration",children:e.jsx(r,{flexDirection:"column",sx:s.defaultGap,children:e.jsx(O,{})})}),e.jsx(t,{title:"Resource allocation",children:e.jsx(T,{})})]})}),e.jsx(G,{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{ce as Create,ce as default};
