import{j as e,B as u,bX as d,bK as E,bi as _,aK as v,ao as f,r as y,e as C}from"./index-dP1W1_bd.js";import{H as x,P as c,M as j,R as $,a as k,C as F}from"./index-TtxdA7bE.js";const h=350,S=({data:o})=>{const n=o.label==="input";return e.jsxs(e.Fragment,{children:[e.jsx(u,{children:e.jsx(d,{legend:[],hoverable:!1,bordered:!0,standalone:!0,sx:{width:`${h}px`},children:e.jsxs(d.Row,{sx:{bg:o.value.activeFeature?"primaryShade2":"white"},children:[o.value.name&&e.jsx(d.Cell,{children:e.jsx(E,{children:o.value.name})}),e.jsx(d.Cell,{sx:{display:"flex",justifyContent:"end",pt:"16px"},children:e.jsx(_,{children:o.value.type})})]})})}),e.jsx(x,{type:n?"source":"target",position:n?c.Right:c.Left,draggable:!1})]})},w=1e3,T=({data:o})=>e.jsxs(e.Fragment,{children:[e.jsx(u,{flexDirection:"column",height:"100%",flexGrow:1,children:e.jsx(u,{flexGrow:1,width:`${w}px`,children:e.jsx(v,{title:o.title,readOnly:!0,copyButton:!0,downloadButton:!0,width:"100%",height:"100%",label:"Transformation snippet (Python)",language:"python",content:o.content})})}),e.jsx(x,{type:"target",position:c.Left,isConnectableEnd:!0}),e.jsx(x,{type:"source",position:c.Right,isConnectableEnd:!0})]}),R={FeatureAndType:S,SourceCode:T},g=200,M=({hopsworksUdf:{name:o,sourceCode:n},inputs:i,outputs:a,featureName:s})=>{const{colorMode:p}=f(),b=y.useMemo(()=>[...i.map(({name:t="",type:r=""},l)=>({id:`input-${t||r}`,position:{x:0,y:l*49},data:{label:"input",value:{name:t,type:r,activeFeature:s===t,featureLess:!s}},type:"FeatureAndType"})),{id:"source_code",position:{x:g+h,y:0},data:{label:"source_code",content:n,title:`${o}.py`},type:"SourceCode"},...a.map(({name:t="",type:r=""},l)=>({id:`output-${t||r}`,position:{x:g*2+w+h,y:l*49},data:{label:"output",value:{name:t,type:r,activeFeature:s===t,featureLess:!s}},type:"FeatureAndType"}))],[i,a,s,n,o]),m=y.useMemo(()=>[...i.map(({name:t="",type:r=""},l)=>({id:`to-source${t||r}`,source:`input-${t||r}`,target:"source_code",markerEnd:{type:j.ArrowClosed},...t===s?{style:{strokeWidth:5,stroke:`var(--quartz-colors-primaryShade2-_${p})`}}:{}})),...a.map(({name:t="",type:r=""})=>({id:`from-source-${t||r}`,source:"source_code",target:`output-${t||r}`,markerEnd:{type:j.ArrowClosed},...t===s?{style:{strokeWidth:5,stroke:`var(--quartz-colors-primaryShade2-_${p})`}}:{}}))],[i,a,s,p]);return e.jsx(C,{width:"100%",height:"100%",mt:"20px",sx:{".react-flow__attribution":{bg:"white",bottom:"20px"}},children:e.jsx($,{children:e.jsx(k,{nodes:b,edges:m,nodeTypes:R,fitView:!0,defaultEdgeOptions:D,children:e.jsx(F,{})})})})},D={style:{strokeWidth:2.5,stroke:"var(--quartz-colors-grayShade2)",zIndex:10}};export{M as V};
