import{s as x}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as f}from"./react-Bj1aDYRI.js";import{E as h,Fr as g,J as u,M as j,q as y}from"./cells-CJLUCcQg.js";import"./react-dom-CSu739Rf.js";import{t as v}from"./compiler-runtime-B3qBwwSJ.js";import{t as m}from"./cn-DYvqRARy.js";import{t as N}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-CTDqNQr6.js";import"./dist-12S8I4CH.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import"./dist-DcwTQG1A.js";import"./dist-DnjsPBRJ.js";import"./dist-BJZAIIze.js";import"./dist-aRc_dRed.js";import"./dist-CPjTeT8p.js";import"./session-BmukRjSi.js";import"./purify.es-CWmnYhGI.js";import{t as b}from"./cell-link-CWQ4BYr-.js";import{t as w}from"./empty-state-JOk_hLQe.js";import{t as _}from"./clear-button-clPKQb-5.js";var n=v();f();var s=x(N(),1),k=()=>{let e=(0,n.c)(9),r=j(),{clearLogs:i}=h();if(r.length===0){let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)("code",{className:"border rounded px-1",children:"stdout"}),e[0]=a):a=e[0];let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,s.jsx)(w,{title:"No logs",description:(0,s.jsxs)("span",{children:[a," and"," ",(0,s.jsx)("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:(0,s.jsx)(g,{})}),e[1]=l):l=e[1],l}let o;e[2]===i?o=e[3]:(o=(0,s.jsx)("div",{className:"flex flex-row justify-start px-2 py-1",children:(0,s.jsx)(_,{dataTestId:"clear-logs-button",onClick:i})}),e[2]=i,e[3]=o);let t;e[4]===r?t=e[5]:(t=(0,s.jsx)(d,{logs:r,className:"min-w-[300px]"}),e[4]=r,e[5]=t);let c;return e[6]!==o||e[7]!==t?(c=(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-auto",children:[o,t]}),e[6]=o,e[7]=t,e[8]=c):c=e[8],c};const d=e=>{let r=(0,n.c)(10),{logs:i,className:o}=e,t;r[0]===o?t=r[1]:(t=m("flex flex-col",o),r[0]=o,r[1]=t);let c;r[2]===Symbol.for("react.memo_cache_sentinel")?(c={whiteSpace:"pre-wrap"},r[2]=c):c=r[2];let a;r[3]===i?a=r[4]:(a=i.map(C),r[3]=i,r[4]=a);let l;r[5]===a?l=r[6]:(l=(0,s.jsx)("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:(0,s.jsx)("div",{className:"grid grid-cols-[30px_1fr]",style:c,children:a})}),r[5]=a,r[6]=l);let p;return r[7]!==t||r[8]!==l?(p=(0,s.jsx)("div",{className:t,children:l}),r[7]=t,r[8]=l,r[9]=p):p=r[9],p};function S(e){let r=y(e.timestamp),i=I[e.level],o=e.level.toUpperCase();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"shrink-0 text-(--gray-10) dark:text-(--gray-11)",children:["[",r,"]"]}),(0,s.jsx)("span",{className:m("shrink-0",i),children:o}),(0,s.jsxs)("span",{className:"shrink-0 text-(--gray-10)",children:["(",e.source.type==="cell"?(0,s.jsx)(b,{cellId:e.source.cellId}):u(e.source),")"]}),e.message]})}var I={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function C(e,r){return(0,s.jsxs)("div",{className:"contents group",children:[(0,s.jsx)("span",{className:m("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:r+1}),(0,s.jsx)("span",{className:m("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:S(e)})]},r)}export{d as LogViewer,k as default};
