"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[584],{68584:(e,l,r)=>{r.r(l),r.d(l,{default:()=>v});var a=r(74848),o=r(31024),n=r(72748),d=r(37399),t=r(87947),s=r(96540),i=r(71468),c=r(40851),u=r(43346),h=r(90923);let w=e=>{let{workflowData:l,workflowID:r,onDownloadImageInit:t}=e,[c,w]=(0,s.useState)(400),[v,b]=(0,s.useState)(!1),[x,g]=(0,s.useState)(!0),k=(0,s.useRef)(null),m=(0,i.d4)(e=>e.flow.selectedNode),j=(0,s.useCallback)(e=>{b(!0),e.preventDefault()},[]),p=(0,s.useCallback)(()=>{b(!1)},[]),I=(0,s.useCallback)(e=>{if(v&&k.current){let l=k.current.getBoundingClientRect(),r=l.right-e.clientX;r>200&&r<.8*l.width&&w(r)}},[v]);return(0,s.useEffect)(()=>(window.addEventListener("mousemove",I),window.addEventListener("mouseup",p),()=>{window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",p)}),[I,p]),(0,a.jsxs)("div",{ref:k,className:"relative flex h-full w-full overflow-hidden bg-background dark:bg-background",style:{cursor:v?"col-resize":"default"},children:[(0,a.jsx)("div",{className:"flex-grow relative h-full overflow-hidden",children:(0,a.jsx)(h.default,{workflowData:l,workflowID:r,onDownloadImageInit:t,renderNodeSidebarExternally:!0,extraPanelButtons:(0,a.jsx)(o.I,{content:x?"Hide Chat":"Show Chat",children:(0,a.jsx)(n.T,{isIconOnly:!0,variant:"flat",size:"sm",onPress:()=>{g(e=>!e)},"aria-label":x?"Hide Chat":"Show Chat",children:(0,a.jsx)(d.In,{icon:x?"lucide:panel-right-close":"lucide:panel-right-open",width:20})})})})}),m&&(0,a.jsx)("div",{className:"absolute top-0 right-0 h-full bg-background dark:bg-background/80 border-l border-divider",style:{zIndex:30},children:(0,a.jsx)(u.A,{nodeID:m,readOnly:!1},m)}),x&&(0,a.jsx)(f,{workflowID:r,width:c,onResizeStart:j})]})},f=s.memo(e=>{let{workflowID:l,width:r,onResizeStart:o}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"w-1 bg-border hover:bg-primary cursor-col-resize h-[calc(100vh-48px)] relative z-5",onMouseDown:o}),(0,a.jsx)("div",{className:"h-[calc(100vh-48px)] bg-background dark:bg-background/80 border-l border-divider overflow-hidden flex flex-col",style:{width:"".concat(r,"px"),zIndex:20},children:(0,a.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,a.jsx)(c.A,{workflowID:l})})})]})});f.displayName="ChatPanel";let v=e=>{let{workflowData:l,workflowID:r,onDownloadImageInit:o}=e;return(0,a.jsx)(t.Ln,{children:(0,a.jsx)(w,{workflowData:l,workflowID:r,onDownloadImageInit:o})})}}}]);