import{j as e,a as s,aw as I,bo as T,b9 as O,bg as S,y as n,fq as G,aC as N,aD as A,$ as c,bw as V,D as k,W as M,dV as r,bq as w,br as L,aJ as W,bs as R,l as U,t as _}from"./index-_eM6l4Nf.js";import{u as q}from"./useScreenWithScroll-zcr7TMGO.js";import{D as B,v as K,K as $,a as H,I as J,A as X,R as Z,b as z}from"./validations-DQKjlEYw.js";import{N as Q}from"./NameField-kD89_XoB.js";import{s as o}from"./styles-BK4Eh60z.js";import{M as l,a as p,b as Y,c as ee,d as oe,P as se,T as re,e as ie,C as te,A as ae}from"./PythonEnvField-kgV_dzlR.js";import{e as ne}from"./utils-CSOjPL09.js";import"./SingleSelect-DCo75wUx.js";import"./index-CmVntchS.js";import"./useProjectId-BzgWWAl7.js";import"./form-CMT9TYED.js";import"./KubernetesProjectEdit-CZi-T2Qi.js";import"./index-B-5JhFyZ.js";import"./getDefaultFormValues-CCXN4e2h.js";import"./index-BXwHI1zk.js";const le=()=>e.jsxs(s,{sx:o.defaultGap,children:[e.jsx(Q,{}),e.jsx(B,{})]}),m={name:void 0,modelName:void 0,modelFramework:void 0,modelServer:void 0,artifactVersion:void 0,predictor:void 0,transformer:void 0,configFile:void 0,kserve:void 0,kafkaTopicDTO:void 0,inferenceLogging:void 0,modelInput:void 0,predictions:void 0,predictorResources:{cores:[l.cores,p.cores],memory:[l.memory,p.memory],gpus:l.gpus},batchingConfiguration:{batchingEnabled:!1},requestedInstances:void 0,requestedTransformerInstances:0},Ce=()=>{const{id:u,project:x}=I(),f=q(),g=T(),j=O(),{state:d={}}=S(),[F,h]=n(),[v,y]=n(),[b,E]=n(),[C,{isLoading:i}]=G(),t=N({reValidateMode:"onChange",shouldUnregister:!1,mode:"onChange",resetOptions:{keepDefaultValues:!0},defaultValues:c(m,d??{}),values:c(m,d??{}),resolver:A(K)}),D=async P=>{if(U(t.formState.errors))try{const a=ne({formValues:P,project:x});await C({projectId:u,formValues:a}).unwrap(),j(_.project.deployments.list)}catch(a){console.error(a)}};return e.jsxs(V,{...t,children:[i&&e.jsx(k,{}),e.jsxs("form",{onSubmit:t.handleSubmit(D,console.error),style:o.editForm,children:[e.jsx(s,{justifyContent:"center",sx:o.editFormWrapper,children:e.jsxs(s,{flexDirection:"column",sx:o.fieldsWrapper,children:[e.jsx(M,{title:"Create new deployment",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(Y,{}),e.jsxs(s,{sx:o.defaultGap,children:[e.jsx(ee,{}),e.jsx(oe,{})]}),e.jsx(le,{})]})}),e.jsx(r,{title:"Environment configuration",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx($,{}),e.jsx(se,{isFileExplorerOpen:F,toggleFileExplorerPopup:h}),e.jsx(re,{isFileExplorerOpen:v,toggleFileExplorerPopup:y}),e.jsx(ie,{}),e.jsx(te,{isFileExplorerOpen:b,toggleFileExplorerPopup:E})]})}),e.jsx(r,{title:"Inference logging",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(H,{}),e.jsx(J,{})]})}),e.jsx(r,{title:"Advanced configuration",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(ae,{}),e.jsx(X,{})]})}),e.jsx(r,{title:"Resource allocation",children:e.jsx(Z,{})}),e.jsx(z,{prefix:[],init:!0})]})}),e.jsx(w,{sx:{maxWidth:`var(${L})`},hasScrollOnScreen:f,mainButton:e.jsx(R,{type:"submit",intent:"primary",disabled:i,isLoading:i,children:"Create new deployment"}),secondaryButton:e.jsx(W,{type:"button",intent:"secondary",onClick:()=>g(-1),children:"Back"})})]})]})};export{Ce as Create,Ce as default};
