import{s as n}from"./chunk-DZLz74EQ.js";import"./jotai-DDOP7CKM.js";import{t as g}from"./react-BcIddLXZ.js";import{E as h,M as f,W as j}from"./cells-B6jS0AIj.js";import"./react-dom-D6bRRS5R.js";import"./zod-U2NFpcFA.js";import{n as u,t as y}from"./jsx-runtime-DvsdsEjx.js";import"./_Uint8Array-D5Z9rM2X.js";import"./isSymbol-xTSywenE.js";import"./_arrayMap-DQI2GUNb.js";import"./toNumber-CTOPJrpu.js";import"./toInteger-Bor4StOs.js";import"./isArrayLikeObject-DKyJYtr8.js";import"./_getTag-CVRrQL_Q.js";import"./_baseIsEqual-BF8660ot.js";import"./merge-BgA7kxZb.js";import"./_baseProperty-CIKnF2iY.js";import"./now-B6JN1xKT.js";import"./debounce-70y9MzDK.js";import"./hotkeys-Lbk6RHir.js";import"./invariant-DPGusy7Z.js";import"./utils-DnJCRgaX.js";import"./constants-DIZnpo2K.js";import"./config-BjdJmdrN.js";import"./useEventListener-C5BS4xuN.js";import{t as c}from"./cn-C5VTNYKf.js";import"./button-nRVaalxL.js";import"./dist-BPcMnGQn.js";import"./dist-pZAIwcZo.js";import"./once-Co7xi2Ip.js";import"./capabilities-DdXtcIOa.js";import"./createReducer-80xvKyHq.js";import"./requests-D3Z6okhb.js";import"./preload-helper-BpItL31i.js";import"./dist-C13bkrcz.js";import"./dist-DZNGKufD.js";import"./dist-DBeOBCHw.js";import"./dist-Ba10OKR3.js";import"./dist-D-CsU-_R.js";import"./dist-ClBFnEcy.js";import"./stex-LEaAsvUb.js";import"./Deferred-zIiWPYX3.js";import"./uuid-Dj56ryH_.js";import"./key-DWQdrH_J.js";import"./use-toast-BiL_AQz9.js";import"./main-CD7jouuS.js";import"./marked.esm-DCf1d_lA.js";import"./connection-DnLUBy9M.js";import"./dist-Q3T6mWQ0.js";import"./useTheme-BMknLtnH.js";import"./createLucideIcon-DA8ZBm4D.js";import"./type-Cpth3na1.js";import"./check-BUgsJwxM.js";import"./select-DJ0A_oCR.js";import"./toDate-sQp07c5U.js";import{t as v}from"./file-text-Cng4_CT2.js";import"./input-BPw9p_8N.js";import"./useNonce-DECX9FAH.js";import"./badge-CFi0nvIx.js";import"./Combination-DR4iFoRS.js";import"./dist-Cei_8ikW.js";import"./tooltip-BQKXsEoT.js";import"./useLifecycle-CuZnZLRp.js";import"./menu-items-DOc2hwO2.js";import"./tslib.es6-sakIzgHM.js";import"./alert-dialog-DM1h8RhU.js";import"./dialog-CEqVOFHc.js";import"./context-BMtIGcq8.js";import"./useNumberFormatter-DynX1ecE.js";import"./numbers-Hxwz5HuE.js";import"./useEvent-d8iQXgui.js";import"./useDebounce-BDmbJDbT.js";import"./ImperativeModal-CmOSTULR.js";import{t as N}from"./cell-link-D9FNaXGs.js";import{t as b}from"./empty-state-NyXKwoVS.js";import{t as w}from"./clear-button-Bzu9pPir.js";var d=n(u(),1);g();var o=n(y(),1),_=()=>{let t=(0,d.c)(9),r=f(),{clearLogs:s}=h();if(r.length===0){let p;t[0]===Symbol.for("react.memo_cache_sentinel")?(p=(0,o.jsx)("code",{className:"border rounded px-1",children:"stdout"}),t[0]=p):p=t[0];let m;return t[1]===Symbol.for("react.memo_cache_sentinel")?(m=(0,o.jsx)(b,{title:"No logs",description:(0,o.jsxs)("span",{children:[p," and"," ",(0,o.jsx)("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:(0,o.jsx)(v,{})}),t[1]=m):m=t[1],m}let e;t[2]===s?e=t[3]:(e=(0,o.jsx)("div",{className:"flex flex-row justify-end px-2 py-1",children:(0,o.jsx)(w,{dataTestId:"clear-logs-button",onClick:s})}),t[2]=s,t[3]=e);let i;t[4]===r?i=t[5]:(i=(0,o.jsx)("div",{className:"overflow-auto flex-1",children:(0,o.jsx)(x,{logs:r,className:"min-w-[300px]"})}),t[4]=r,t[5]=i);let a;return t[6]!==e||t[7]!==i?(a=(0,o.jsxs)(o.Fragment,{children:[e,i]}),t[6]=e,t[7]=i,t[8]=a):a=t[8],a};const x=t=>{let r=(0,d.c)(10),{logs:s,className:e}=t,i;r[0]===e?i=r[1]:(i=c("flex flex-col",e),r[0]=e,r[1]=i);let a;r[2]===Symbol.for("react.memo_cache_sentinel")?(a={whiteSpace:"pre-wrap"},r[2]=a):a=r[2];let p;r[3]===s?p=r[4]:(p=s.map(I),r[3]=s,r[4]=p);let m;r[5]===p?m=r[6]:(m=(0,o.jsx)("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:(0,o.jsx)("div",{className:"grid grid-cols-[30px_1fr]",style:a,children:p})}),r[5]=p,r[6]=m);let l;return r[7]!==i||r[8]!==m?(l=(0,o.jsx)("div",{className:i,children:m}),r[7]=i,r[8]=m,r[9]=l):l=r[9],l};function k(t){let r=j(t.timestamp),s=S[t.level],e=t.level.toUpperCase();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("span",{className:"shrink-0 text-(--gray-10) dark:text-(--gray-11)",children:["[",r,"]"]}),(0,o.jsx)("span",{className:c("shrink-0",s),children:e}),(0,o.jsxs)("span",{className:"shrink-0 text-(--gray-10)",children:["(",(0,o.jsx)(N,{cellId:t.cellId}),")"]}),t.message]})}var S={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function I(t,r){return(0,o.jsxs)("div",{className:"contents group",children:[(0,o.jsx)("span",{className:c("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:r+1}),(0,o.jsx)("span",{className:c("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:k(t)})]},r)}export{x as LogViewer,_ as default};
