import{j as e,$ as r,aw as D,bo as P,b9 as S,bg as I,y as a,fi as O,aC as A,aD as G,bv as T,D as k,b as M,dS as s,bq as N,b1 as V,br as L,h as w,q as R}from"./index-46ma1THH.js";import{u as U}from"./useScreenWithScroll-zcr7TMGO.js";import{D as q,v as _,K as B,a as K,I as W,A as $,R as X,b as z}from"./validations-1LUbtRgK.js";import{M as n,a as l,b as H,c as J,d as Q,A as Y,P as Z,T as ee,e as oe,C as re,f as se}from"./PythonEnvField-D-anKKWV.js";import{N as ie}from"./NameField-BItiqscO.js";import{s as o}from"./styles-CqvG5Ri0.js";import{e as te}from"./utils-CSjO8SQp.js";import"./SingleSelect-DyMHGSBW.js";import"./index-DIN48ET6.js";import"./useProjectId-0fA9rNnF.js";import"./index-CcWUz40c.js";import"./KubernetesProjectEdit-DOgOIrBH.js";import"./getDefaultFormValues-3rRlpL1j.js";import"./index-D241LvV7.js";const ae=()=>e.jsxs(r,{sx:o.defaultGap,children:[e.jsx(ie,{}),e.jsx(q,{})]}),be=()=>{const{id:d,project:c}=D(),p=U(),m=P(),u=S(),{state:x={}}=I(),[f,g]=a(),[j,F]=a(),[h,v]=a(),[b,{isLoading:i}]=O(),t=A({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:[n.cores,l.cores],memory:[n.memory,l.memory],gpus:n.gpus},batchingConfiguration:{batchingEnabled:!1},requestedInstances:void 0,requestedTransformerInstances:0},values:x,resolver:G(_)}),y=async C=>{if(w(t.formState.errors))try{await b({projectId:d,formValues:te({formValues:C,project:c})}).unwrap(),u(R.project.deployments.list)}catch(E){console.error(E)}};return e.jsxs(T,{...t,children:[i&&e.jsx(k,{}),e.jsxs("form",{onSubmit:t.handleSubmit(y,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(M,{title:"Create new deployment",children:e.jsxs(r,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(H,{}),e.jsxs(r,{sx:o.defaultGap,children:[e.jsx(J,{}),e.jsx(Q,{}),e.jsx(Y,{})]}),e.jsx(ae,{})]})}),e.jsx(s,{title:"Environment configuration",children:e.jsxs(r,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(B,{}),e.jsx(Z,{isFileExplorerOpen:f,toggleFileExplorerPopup:g}),e.jsx(ee,{isFileExplorerOpen:j,toggleFileExplorerPopup:F}),e.jsx(oe,{}),e.jsx(re,{isFileExplorerOpen:h,toggleFileExplorerPopup:v})]})}),e.jsx(s,{title:"Inference logging",children:e.jsxs(r,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(K,{}),e.jsx(W,{})]})}),e.jsx(s,{title:"Advanced configuration",children:e.jsxs(r,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(se,{}),e.jsx($,{})]})}),e.jsx(s,{title:"Resource allocation",children:e.jsx(X,{})}),e.jsx(z,{prefix:[],init:!0})]})}),e.jsx(N,{hasScrollOnScreen:p,mainButton:e.jsx(L,{type:"submit",intent:"primary",disabled:i,isLoading:i,children:"Create new deployment"}),secondaryButton:e.jsx(V,{type:"button",intent:"secondary",onClick:()=>m(-1),children:"Back"})})]})]})};export{be as Create,be as default};
