import{j as e,B as r,bw as E,bL as D,bq as P,c as a,fl as S,az as V,aA as k,bB as O,L as A,m as B,ds as s,bx as G,aG as I,g as L,s as T}from"./index-dP1W1_bd.js";import{u as w}from"./useScreenWithScroll-zcr7TMGO.js";import{u as M}from"./useDownload-C3yCvYJa.js";import{B as R}from"./ButtonWithRole-CF64B_Or.js";import{D as N,K,a as U,I as W,A as q,R as z,b as Q,v as H}from"./validations-D4l99VpE.js";import{u as J,M as X,a as Y,b as Z,A as _,P as $,T as ee,c as oe,C as re,d as ie}from"./PythonEnvField-BA5Z1n7e.js";import{N as se}from"./NameField-BjALSfRj.js";import{s as o,g as te}from"./utils-CSV5kSUs.js";import"./useProject-CXVt1xnE.js";import"./length-BzpOfCdE.js";import"./SingleSelect-B8f6hurf.js";import"./index-D4-3j93o.js";import"./useProjectId-DopcTZap.js";import"./KubernetesProjectEdit-CcUpiV79.js";import"./index-MHdXqM53.js";import"./FileUploaderButton-frSujVRY.js";import"./uniq-98MdbBvs.js";import"./uniqBy-6mvKp2Ip.js";import"./dumbPluralize-CcxDsNiu.js";import"./getDefaultFormValues-BDGdN25U.js";import"./index-DEBSKkGo.js";import"./min-DNV8UA03.js";import"./__-BIxbRvwe.js";const ne=()=>e.jsxs(r,{sx:o.defaultGap,children:[e.jsx(se,{}),e.jsx(N,{})]}),Oe=()=>{const{id:l,project:d}=M(),{data:i}=J(),c=w(),p=E(),m=D(),{state:u={}}=P(),[x,f]=a(),[g,j]=a(),[F,v]=a(),[h,{isLoading:t}]=S(),n=V({reValidateMode:"onChange",shouldUnregister:!1,mode:"onChange",resetOptions:{keepDefaultValues:!0},defaultValues:{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:[i.minDefaultConfig.cores,i.maxDefaultConfig.cores],memory:[i.minDefaultConfig.memory,i.maxDefaultConfig.memory],gpus:i.minDefaultConfig.gpus},batchingConfiguration:{batchingEnabled:!1},requestedInstances:void 0,requestedTransformerInstances:0},values:u,resolver:k(H)}),C=async y=>{if(L(n.formState.errors))try{await h({projectId:l,formValues:te({formValues:y,project:d})}).unwrap(),m(T.deployments.list)}catch(b){console.error(b)}};return e.jsxs(O,{...n,children:[t&&e.jsx(A,{}),e.jsxs("form",{onSubmit:n.handleSubmit(C,console.error),style:o.editForm,children:[e.jsx(r,{justifyContent:"center",sx:o.editFormWrapper,children:e.jsxs(r,{flexDirection:"column",sx:o.fieldsWrapper,children:[e.jsx(B,{title:"Create new deployment",children:e.jsxs(r,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(X,{}),e.jsxs(r,{sx:o.defaultGap,children:[e.jsx(Y,{}),e.jsx(Z,{}),e.jsx(_,{})]}),e.jsx(ne,{})]})}),e.jsx(s,{title:"Environment configuration",children:e.jsxs(r,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(K,{}),e.jsx($,{isFileExplorerOpen:x,toggleFileExplorerPopup:f}),e.jsx(ee,{isFileExplorerOpen:g,toggleFileExplorerPopup:j}),e.jsx(oe,{}),e.jsx(re,{isFileExplorerOpen:F,toggleFileExplorerPopup:v})]})}),e.jsx(s,{title:"Inference logging",children:e.jsxs(r,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(U,{}),e.jsx(W,{})]})}),e.jsx(s,{title:"Advanced configuration",children:e.jsxs(r,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(ie,{}),e.jsx(q,{})]})}),e.jsx(s,{title:"Resource allocation",children:e.jsx(z,{})}),e.jsx(Q,{prefix:[],init:!0})]})}),e.jsx(G,{hasScrollOnScreen:c,mainButton:e.jsx(R,{type:"submit",intent:"primary",disabled:t,isLoading:t,children:"Create new deployment"}),secondaryButton:e.jsx(I,{type:"button",intent:"secondary",onClick:()=>p(-1),children:"Back"})})]})]})};export{Oe as Create,Oe as default};
