import{fD as m,b5 as l}from"./index-ea7817a2.js";const p=(e,r,t)=>`${t?e.hopsworksInferencePath:e.modelServerInferencePath}:${r}`,h=m`
  from { -moz-transform: rotate(0deg); }
  to { -moz-transform: rotate(360deg); }
`,v={editForm:{width:"100%"},editFormWrapper:{width:"100%",alignItems:"center",paddingBottom:"10vh",justifyContent:"center"},fieldsWrapper:{gap:"20px",width:"100%"},defaultGap:{gap:"20px"},filtersContainer:{gap:"8px",label:{div:{backgroundColor:"white",width:"100%"},"div:hover":{div:{backgroundColor:"grayShade3",borderColor:"transparent"}}}},searchLabel:{lexGrow:1,mr:"8px"},noWrap:{whiteSpace:"nowrap"},table:{borderSpacing:"0 8px",borderCollapse:"separate",tr:{border:"none","&:not(:first-of-type)":{backgroundColor:"white"},"&:first-of-type":{border:"none",td:{border:"none !important",whiteSpace:"nowrap"}}},td:{px:"10px",borderTop:"1px solid grayShade2",borderBottom:"1px solid grayShade2","&:first-of-type":{borderLeft:"1px solid grayShade2"},"&:last-child":{borderRight:"1px solid grayShade2"},"&:nth-of-type(7)":{div:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"}}}},card:{overflow:"auto",padding:0},errorText:{color:"red",label:{color:"red !important","> div":{color:"red !important"}},span:{color:"red"}},divider:{marginLeft:"0 !important",width:"100% !important"," > div":{color:"grayShade2"}},overflowX:{overflowX:"auto"},codeInput:{"> div":{height:"auto !important",display:"flex",marginBottom:"0",maxHeight:"300px","> label":{height:"auto !important",marginBottom:"10px",maxHeight:"300px",minHeight:"80px"}}},loading:{svg:{animation:`${h} 1.5s ease infinite`}},quickDeploymentFlex:{"> div":{flex:1,"> span, > label":{width:"100%"}},gap:"20px"}};var u=(e=>(e.NODE="NODE",e.KUBE_CLUSTER="KUBE_CLUSTER",e.LOAD_BALANCER="LOAD_BALANCER",e))(u||{}),g=(e=>(e.HTTP="HTTP",e.HTTPS="HTTPS",e.STATUS="STATUS",e.TLS="TLS",e))(g||{});const f={name:({name:e},{name:r})=>e.localeCompare(r),"last created":({created:e},{created:r})=>{const t=new Date(e).getTime(),s=new Date(r).getTime();return t===s?0:t<s?1:-1}},w=(e,r)=>{const t=f[r];return t?e.sort(t):e},x=(e,r)=>r?e.filter(t=>t.name.toLowerCase().includes(r.toLowerCase())):e,k=(e,{selectedModel:r,selectedStatuses:t,selectedUsername:s})=>{let o=e;return r&&(o=o.filter(i=>i.modelName===r)),t!=null&&t.length&&(o=o.filter(i=>t.includes(i.status.toLowerCase()))),s?o.filter(i=>i.creator.toLowerCase()===s):o},L=e=>l.uniqBy(e,"modelName").map(r=>r.modelName),T=e=>e.batchingEnabled?e:{},b=(e,r)=>{if(e&&r)return"ALL";if(e)return"MODEL_INPUTS";if(r)return"PREDICTIONS"},d=(e,r,t,s)=>{let o=e.substring(e.lastIndexOf("/")+1);return e.endsWith(`Models/${s}/${t}/Artifacts/${r}/${o}`)?(o.startsWith("predictor-")?o=o.slice(10):o.startsWith("transformer-")&&(o=o.slice(12)),o):e},R=({formValues:e,apiValues:r={},project:t})=>({...r,modelServer:e.modelServer,name:e.name,description:e.description,modelName:e.modelName,modelPath:`/Projects/${t.projectName}/Models/${e.modelName}`,modelVersion:e.modelVersion,modelFramework:e.modelFramework,artifactVersion:e.artifactVersion,servingTool:e.kserve?"KSERVE":"DEFAULT",predictor:e.predictor?d(e.predictor,e.artifactVersion,e.modelVersion,e.modelName):void 0,transformer:e.transformer?d(e.transformer,e.artifactVersion,e.modelVersion,e.modelName):void 0,inferenceLogging:b(e.modelInput,e.predictions),kafkaTopicDTO:e.kafkaTopicDTO,batchingConfiguration:T(e.batchingConfiguration),requestedInstances:e.requestedInstances,requestedTransformerInstances:e.transformer?e.requestedTransformerInstances:void 0,predictorResources:{requests:{cores:e.predictorResources.cores[0],memory:e.predictorResources.memory[0],gpus:e.predictorResources.gpus[0]},limits:{cores:e.predictorResources.cores[1],memory:e.predictorResources.memory[1],gpus:e.predictorResources.gpus[1]}},transformerResources:e.transformer&&e.transformerResources?{requests:{cores:e.transformerResources.cores[0],memory:e.transformerResources.memory[0],gpus:e.transformerResources.gpus[0]},limits:{cores:e.transformerResources.cores[1],memory:e.transformerResources.memory[1],gpus:e.transformerResources.gpus[1]}}:void 0}),C=e=>{if(!e)return e;const{kafkaTopicDTO:r,inferenceLogging:t}=e,{predictorResources:s,transformerResources:o}=e,i=s.requests,n=s.limits,a=o==null?void 0:o.requests,c=o==null?void 0:o.limits;return{...e,kafkaTopicDTO:r??{name:"NONE"},inferenceLogging:t??"NONE",predictorResources:{cores:[i.cores,n.cores],memory:[i.memory,n.memory],gpus:[i.gpus,n.gpus]},transformerResources:a&&c?{cores:[a.cores,c.cores],memory:[a.memory,c.memory],gpus:[a.gpus,c.gpus]}:void 0}},S=[{label:"Predict",key:"predict"},{label:"Regress",key:"regress"},{label:"Classify",key:"classify"}],D=(e,r)=>`/hopsworks-api/api${p(e,r,!0)}`,E=(e,r,t)=>{var i;const s=(i=t.ports.find(n=>n.name===g.HTTP))==null?void 0:i.number,o=p(e,r,!1);return`http://${t.hosts[0]}:${s}${o}`},N=(e,r,t)=>`${r}.${e.replaceAll("_","-")}.${t}`;export{S as D,u as I,C as a,p as b,D as c,E as d,N as e,L as f,R as g,f as h,x as i,w as j,k,v as s};
