(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[627],{3686:(e,t,r)=>{Promise.resolve().then(r.bind(r,8462))},7437:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(8258).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},7960:(e,t,r)=>{"use strict";r.d(t,{E:()=>l});var s=r(5386),a=r(7437),n=r(8414),c=r.n(n);function l(e){let{href:t,label:r="Back"}=e;return(0,s.jsxs)(c(),{href:t,className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-2",children:[(0,s.jsx)(a.A,{className:"h-4 w-4"}),r]})}},8462:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>x});var s=r(5386),a=r(3283),n=r(4773),c=r(7394),l=r(6090),i=r(2338),d=r(8052),o=r(7960);function u(e){let{env:t,streamId:r}=e,c=(0,a.useParams)().runId,[u,x]=(0,n.useState)([]),[m,h]=(0,n.useState)(!0),[f,g]=(0,n.useState)(null),j=(0,n.useRef)(null),p=(0,n.useRef)(null),v=(0,n.useRef)(0);(0,n.useEffect)(()=>{j.current&&(j.current.scrollTop=j.current.scrollHeight)},[u.length]),(0,n.useEffect)(()=>{let e=!0;p.current=new AbortController;let s=()=>{e&&h(!1)},a=t=>{if(e&&t){let e=v.current++;x(r=>[...r,{id:e,text:t}])}},n=async(e,t)=>{for(;;){var r;if(null==(r=p.current)?void 0:r.signal.aborted)break;let{value:n,done:c}=await e.read();if(c){s();break}n&&n.byteLength>0&&a(t.decode(n,{stream:!0}))}};return(async()=>{try{let e=(await (0,l.bv)(t,r)).getReader(),s=new TextDecoder;await n(e,s)}catch(t){e&&(g(t instanceof Error?t.message:String(t)),h(!1))}})(),()=>{e=!1,p.current&&p.current.abort()}},[t,r]);let b=c?(0,d.g0)("/run/".concat(c),t):(0,d.g0)("/",t);return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(o.E,{href:b}),(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)(i.aR,{children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(i.ZB,{className:"font-mono text-sm",children:r}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsx)("span",{className:"text-sm ".concat(m?"text-green-600 dark:text-green-400":"text-gray-600 dark:text-gray-400"),children:m?"● Live":"● Closed"})})]})}),(0,s.jsx)(i.Wu,{children:(0,s.jsx)("div",{ref:j,className:"bg-black text-green-400 font-mono text-sm p-4 rounded-md h-[600px] overflow-auto whitespace-pre-wrap break-words",children:f?(0,s.jsxs)("div",{className:"text-red-400",children:[(0,s.jsx)("div",{children:"Error reading stream:"}),(0,s.jsx)("div",{children:f})]}):0===u.length?(0,s.jsx)("div",{className:"text-gray-500",children:m?"Waiting for stream data...":"Stream is empty"}):(0,s.jsx)(s.Fragment,{children:u.map(e=>(0,s.jsx)("span",{children:e.text},"".concat(r,"-chunk-").concat(e.id)))})})})]})]})}function x(){let e=(0,a.useParams)(),t=(0,d.Nt)(),r=(0,n.useMemo)(()=>(0,d.nO)(t),[t]),l=e.streamId;return(0,s.jsx)(c.t,{title:"Stream Error",description:"Failed to load stream data. Please try navigating back and selecting the stream again.",children:(0,s.jsx)(u,{env:r,streamId:l})})}}},e=>{e.O(0,[246,590,378,990,909,624,358],()=>e(e.s=3686)),_N_E=e.O()}]);