"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[969],{4969:(e,t,a)=>{a.r(t),a.d(t,{default:()=>B});var n=a(5e3),l=a(9920),o=a(9048),i=a(8199),d=a(5988),s=a(7382),r=a(7976),c=a.n(r),u=a(4945);function p(e){const t=e.split("/");return t[0]+"//"+t[2]}var m=a(3139),g=a(9577),f=a(2949),y=a(9541),h=a.n(y),_=a(7249),v=a.n(_),N=a(2358),k=a.n(N),w=a(3585),Z=a.n(w),E=a(7850),C=a.n(E),x=a(8756),S=a.n(x),P=a(1802),T={};T.styleTagTransform=S(),T.setAttributes=Z(),T.insert=k().bind(null,"head"),T.domAPI=v(),T.insertStyleElement=C(),h()(P.Z,T),P.Z&&P.Z.locals&&P.Z.locals,a(3827);const b=u.z.array(u.z.any()),I="SPECIALNULLVALUEDONOTSETEVER";function j({arg:e,callUpdate:t,argValue:a,setArg:n,setNode:l,idx:o}){const i=(0,r.useRef)(null),[d,s]=(0,r.useState)("node");return(0,r.useEffect)((()=>{"input"===d&&i.current&&i.current.offsetTop&&i.current.clientHeight&&(l((e=>{const t={...e.input_handles?e.input_handles:{},[o]:(i.current?.offsetTop??0)+(i.current?.clientHeight??0)/2};return{...e,input_handles:t,num_inputs:Object.keys(t).length}})),t())}),[d,i]),(0,r.useEffect)((()=>{"node"===d&&(l((e=>{const t={...e.input_handles?e.input_handles:{}};return t[o]&&delete t[o],{...e,num_inputs:Object.keys(t).length,input_handles:t}})),t())}),[d]),c().createElement("div",{className:"flex flex-row space-x-2 items-center w-full",ref:i},c().createElement(A,{className:"nodrag",onClick:e=>{e.stopPropagation()},size:"small",value:d,onChange:e=>{s(e.toString()),"node"!==e&&n(I)},options:[{icon:c().createElement(O,null),value:"input"},{icon:c().createElement(U,null),value:"ui",disabled:!0},{icon:c().createElement(L,null),value:"node",disabled:"File"===e.type}]}),c().createElement(V,null,e.name),(()=>{switch(e.type){case"Choice":return c().createElement(z,{className:"nodrag",disabled:"node"!==d,value:a&&a!=I?a:void 0,options:e.ty.choices.map((e=>({value:e,label:e}))),onChange:e=>{n(e)}});case"Num":return c().createElement(D,{className:"nodrag",disabled:"node"!==d,min:e.ty.min_value??void 0,max:e.ty.max_value??void 0,value:a&&a!=I?a:void 0,onChange:e=>{e&&n(e)}});case"String":return c().createElement(G,{className:"nodrag",disabled:"node"!==d,value:a&&a!=I?a:void 0,onChange:e=>{n(e.target.value)}});case"File":return null;default:throw e.type,new Error("Unhandled argument type")}})())}const B=function({callAfterUpdateInpOuts:e=(()=>{}),node:t,setNode:a}){const n=b.safeParse(t.data).success?t.data:Array(t.metadata.args.length).fill(null);return(0,r.useEffect)((()=>{a((e=>({...e,data:Array(t.metadata.args.length).fill(null),operator:`${p(t.remote.url)}/operator/${t.metadata.operator}`,num_inputs:0,num_outputs:t.metadata.num_outputs}))),e()}),[]),c().createElement(F,null,t.metadata.name?c().createElement(H,null,t.metadata.name):null,t.metadata.description?c().createElement(l.Z.Paragraph,null,t.metadata.description):null,t.metadata.args.map(((t,l)=>c().createElement(j,{arg:t,key:l,idx:l,callUpdate:e,argValue:n[l],setNode:a,setArg:e=>{a((t=>({...t,data:t.data.map(((t,a)=>a===l?e:t))})))}}))))};var A=(0,n.ZP)(o.Z).withConfig({displayName:"BaseNode___StyledSegmented",componentId:"sc-vkkiaj-0"})({pointerEvents:"auto",cursor:"pointer"}),O=(0,n.ZP)(m.Z).withConfig({displayName:"BaseNode___StyledLoginOutlined",componentId:"sc-vkkiaj-1"})({paddingTop:"3px"}),U=(0,n.ZP)(g.Z).withConfig({displayName:"BaseNode___StyledPlayCircleOutlined",componentId:"sc-vkkiaj-2"})({paddingTop:"3px"}),L=(0,n.ZP)(f.Z).withConfig({displayName:"BaseNode___StyledPicCenterOutlined",componentId:"sc-vkkiaj-3"})({paddingTop:"3px"}),V=(0,n.ZP)(l.Z.Text).withConfig({displayName:"BaseNode___StyledTypographyText",componentId:"sc-vkkiaj-4"})({width:"fit-content"}),z=(0,n.ZP)(i.Z).withConfig({displayName:"BaseNode___StyledSelect",componentId:"sc-vkkiaj-5"})({flexGrow:"1"}),D=(0,n.ZP)(d.Z).withConfig({displayName:"BaseNode___StyledInputNumber",componentId:"sc-vkkiaj-6"})({flexGrow:"1"}),G=(0,n.ZP)(s.Z).withConfig({displayName:"BaseNode___StyledInput",componentId:"sc-vkkiaj-7"})({flexGrow:"1"}),F=(0,n.ZP)("div").withConfig({displayName:"BaseNode___StyledDiv",componentId:"sc-vkkiaj-8"})({display:"flex",width:"24rem",flexDirection:"column","> :not([hidden]) ~ :not([hidden])":{"--tw-space-y-reverse":"0",marginTop:"calc(0.5rem * calc(1 - var(--tw-space-y-reverse)))",marginBottom:"calc(0.5rem * var(--tw-space-y-reverse))"}}),H=(0,n.ZP)(l.Z.Text).withConfig({displayName:"BaseNode___StyledTypographyText2",componentId:"sc-vkkiaj-9"})({fontWeight:"700"})},1802:(e,t,a)=>{a.d(t,{Z:()=>d});var n=a(4039),l=a.n(n),o=a(6499),i=a.n(o)()(l());i.push([e.id,"svg {\n  display: inline-block !important;\n  vertical-align: baseline !important;\n}\n",""]);const d=i}}]);