import{ap as i,aF as u,r as c,j as l,a as f,aG as x,c9 as k,fP as t,fN as h,fM as d}from"./index-d6499a22.js";import{s as p}from"./utils-b5e8f9a5.js";const w=()=>{const{register:m,formState:{errors:n},setValue:e}=i(),[r,o]=u({name:["name","modelName"]});return c.useEffect(()=>{!r&&o&&e("name",o==null?void 0:o.replace(/[^a-zA-Z0-9]/g,"")),!o&&r&&e("name","")},[o,e]),l.jsx(f,{sx:n.name?p.errorText:{},children:l.jsx(x,{...m("name"),label:"Name",placeholder:"name"})})},b=()=>{const{control:m,formState:{errors:n},setValue:e}=i(),{state:r={}}=k(),o=u({name:"modelServer"}),F=a=>{const s=a.replace("_","-");return s[0]+s.slice(1).toLowerCase()},N=c.useMemo(()=>Object.keys(t).filter(a=>a!==t.PYTHON).map(a=>({key:a,label:F(a)})).concat({key:t.PYTHON,label:"Custom (python)"}),[]);c.useEffect(()=>{o&&!(r!=null&&r.modelName)&&e("modelName","",{shouldValidate:!0})},[o,e,r==null?void 0:r.modelName]);const S=a=>{const s=a===t.TENSORFLOW?d.TENSORFLOW_SERVING:d.PYTHON;e("modelServer",s),e("modelName","",{shouldValidate:!0}),e("modelVersion",""),e("artifactVersion","")};return l.jsx(f,{sx:n.modelServer?p.errorText:{},children:l.jsx(h,{required:!0,name:"modelFramework",label:"Framework",placeholder:"pick a framework",control:m,options:N,onSelectionChange:S})})};export{b as M,w as N};
