import{j as e,$ as s,aw as P,bo as T,b9 as I,bg as O,y as n,fk as S,aC as A,aD as G,Z as N,bw as k,D as M,b as V,dT as r,bq as w,br as L,b1 as R,bs as _,h as U,q as W}from"./index-ljTaFLaB.js";import{u as q}from"./useScreenWithScroll-zcr7TMGO.js";import{D as B,v as K,K as $,a as H,I as X,A as Z,R as z,b as J}from"./validations-DJxQI9O9.js";import{M as l,a as d,b as Q,c as Y,d as ee,A as oe,P as se,T as re,e as ie,C as te,f as ae}from"./PythonEnvField-Btr7vPn-.js";import{N as ne}from"./NameField-BTd3lq1J.js";import{s as o}from"./styles-DB_mwe0S.js";import{e as le}from"./utils-BHUDm_qF.js";import"./SingleSelect-6Q2B8ZHD.js";import"./index-BtWEpmLJ.js";import"./useProjectId-BtNL8kct.js";import"./index-WyeuJRlK.js";import"./KubernetesProjectEdit-DCx9MFvC.js";import"./getDefaultFormValues-DLaNjXjC.js";import"./index-Df7phmI_.js";const de=()=>e.jsxs(s,{sx:o.defaultGap,children:[e.jsx(ne,{}),e.jsx(B,{})]}),c={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,d.cores],memory:[l.memory,d.memory],gpus:l.gpus},batchingConfiguration:{batchingEnabled:!1},requestedInstances:void 0,requestedTransformerInstances:0},Ce=()=>{const{id:p,project:m}=P(),x=q(),u=T(),f=I(),{state:g={}}=O(),[j,F]=n(),[h,v]=n(),[b,y]=n(),[E,{isLoading:i}]=S(),t=A({reValidateMode:"onChange",shouldUnregister:!1,mode:"onChange",resetOptions:{keepDefaultValues:!0},defaultValues:c,values:N(c,g),resolver:G(K)}),C=async D=>{if(U(t.formState.errors))try{const a=le({formValues:D,project:m});await E({projectId:p,formValues:a}).unwrap(),f(W.project.deployments.list)}catch(a){console.error(a)}};return e.jsxs(k,{...t,children:[i&&e.jsx(M,{}),e.jsxs("form",{onSubmit:t.handleSubmit(C,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(V,{title:"Create new deployment",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(Q,{}),e.jsxs(s,{sx:o.defaultGap,children:[e.jsx(Y,{}),e.jsx(ee,{}),e.jsx(oe,{})]}),e.jsx(de,{})]})}),e.jsx(r,{title:"Environment configuration",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx($,{}),e.jsx(se,{isFileExplorerOpen:j,toggleFileExplorerPopup:F}),e.jsx(re,{isFileExplorerOpen:h,toggleFileExplorerPopup:v}),e.jsx(ie,{}),e.jsx(te,{isFileExplorerOpen:b,toggleFileExplorerPopup:y})]})}),e.jsx(r,{title:"Inference logging",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(H,{}),e.jsx(X,{})]})}),e.jsx(r,{title:"Advanced configuration",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(ae,{}),e.jsx(Z,{})]})}),e.jsx(r,{title:"Resource allocation",children:e.jsx(z,{})}),e.jsx(J,{prefix:[],init:!0})]})}),e.jsx(w,{sx:{maxWidth:`var(${L})`},hasScrollOnScreen:x,mainButton:e.jsx(_,{type:"submit",intent:"primary",disabled:i,isLoading:i,children:"Create new deployment"}),secondaryButton:e.jsx(R,{type:"button",intent:"secondary",onClick:()=>u(-1),children:"Back"})})]})]})};export{Ce as Create,Ce as default};
