(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,396521,e=>{"use strict";var t=e.i(910092);e.s(["Card",()=>t.default])},884413,e=>{"use strict";var t=e.i(843476),l=e.i(271645);e.i(838730);var s=e.i(396521),r=e.i(339114),n=e.i(243616);let a={LOG:"text-green-400",INFO:"text-blue-400",WARN:"text-yellow-400",ERROR:"text-red-400",DEBUG:"text-purple-400"};e.s(["default",0,function(){let[e,c]=(0,l.useState)([]),[o,i]=(0,l.useState)(!1),u=(0,l.useRef)(null),d=async()=>{try{await fetch("/api/translator/console-logs",{method:"DELETE"})}catch(e){console.error("Failed to clear console logs:",e)}};return(0,l.useEffect)(()=>{let e=new EventSource("/api/translator/console-logs/stream");return e.onopen=()=>i(!0),e.onmessage=e=>{let t=JSON.parse(e.data);"init"===t.type?c(t.logs.slice(-n.CONSOLE_LOG_CONFIG.maxLines)):"line"===t.type?c(e=>{let l=[...e,t.line];return l.length>n.CONSOLE_LOG_CONFIG.maxLines?l.slice(-n.CONSOLE_LOG_CONFIG.maxLines):l}):"clear"===t.type&&c([])},e.onerror=()=>i(!1),()=>e.close()},[]),(0,l.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[e]),(0,t.jsx)("div",{className:"",children:(0,t.jsxs)(s.Card,{children:[(0,t.jsx)("div",{className:"flex items-center justify-end px-4 pt-3 pb-2",children:(0,t.jsx)(r.Button,{size:"sm",variant:"outline",icon:"delete",onClick:d,children:"Clear"})}),(0,t.jsx)("div",{ref:u,className:"bg-black rounded-b-lg p-4 text-xs font-mono h-[calc(100vh-220px)] overflow-y-auto",children:0===e.length?(0,t.jsx)("span",{className:"text-text-muted",children:"No console logs yet."}):(0,t.jsx)("div",{className:"space-y-0.5",children:e.map((e,l)=>{let s,r;return(0,t.jsx)("div",{children:(r=a[(s=e.match(/\[(\w+)\]/g))?s[1]?.replace(/\[|\]/g,""):null]||"text-green-400",(0,t.jsx)("span",{className:r,children:e}))},l)})})})]})})}])}]);