(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[712],{44493:(e,t,l)=>{"use strict";l.d(t,{default:()=>o});var s=l(95155),n=l(12115),r=l(35497),a=l(90620);let c={LOG:"text-green-400",INFO:"text-blue-400",WARN:"text-yellow-400",ERROR:"text-red-400",DEBUG:"text-purple-400"};function o(){let[e,t]=(0,n.useState)([]),[l,o]=(0,n.useState)(!1),i=(0,n.useRef)(null),u=async()=>{try{await fetch("/api/translator/console-logs",{method:"DELETE"})}catch(e){console.error("Failed to clear console logs:",e)}};return(0,n.useEffect)(()=>{let e=new EventSource("/api/translator/console-logs/stream");return e.onopen=()=>o(!0),e.onmessage=e=>{let l=JSON.parse(e.data);"init"===l.type?t(l.logs.slice(-a.UY.maxLines)):"line"===l.type?t(e=>{let t=[...e,l.line];return t.length>a.UY.maxLines?t.slice(-a.UY.maxLines):t}):"clear"===l.type&&t([])},e.onerror=()=>o(!1),()=>e.close()},[]),(0,n.useEffect)(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e]),(0,s.jsx)("div",{className:"",children:(0,s.jsxs)(r.Zp,{children:[(0,s.jsx)("div",{className:"flex items-center justify-end px-4 pt-3 pb-2",children:(0,s.jsx)(r.$n,{size:"sm",variant:"outline",icon:"delete",onClick:u,children:"Clear"})}),(0,s.jsx)("div",{ref:i,className:"bg-black rounded-b-lg p-4 text-xs font-mono h-[calc(100vh-220px)] overflow-y-auto",children:0===e.length?(0,s.jsx)("span",{className:"text-text-muted",children:"No console logs yet."}):(0,s.jsx)("div",{className:"space-y-0.5",children:e.map((e,t)=>{let l,n;return(0,s.jsx)("div",{children:(n=c[(l=e.match(/\[(\w+)\]/g))?l[1]?.replace(/\[|\]/g,""):null]||"text-green-400",(0,s.jsx)("span",{className:n,children:e}))},t)})})})]})})}},68678:(e,t,l)=>{Promise.resolve().then(l.bind(l,44493))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=68678)),_N_E=e.O()}]);