import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{m as t}from"./vendor-dnd-C1cICjTT.js";import{s as n}from"./vendor-markdown-Db1-9wH7.js";import{n as r,r as i}from"./api-DwzfFfgX.js";import{n as a,t as o}from"./useLongPressContextMenu-6CogA2Tu.js";import{t as s}from"./SessionContextMenu-CxZcWNC2.js";var c=e(t(),1),l=n();function u(e,t){return`rgba(${parseInt(e.slice(1,3),16)}, ${parseInt(e.slice(3,5),16)}, ${parseInt(e.slice(5,7),16)}, ${t})`}function d({session:e,onOpen:t,brand:n,projectName:d,showProjectBadge:f=!1,depth:p=0,childCount:m=0,displayCost:h}){let[g,_]=(0,c.useState)(null),v=r(e),y=!!e.awaiting_approval,b=e.task_status===`in_review`,x=e.title??e.id.slice(0,8),S=x.startsWith(`🌙 Dream`)||e.id.startsWith(`deep_dream_`),C=h??e.cost?.total??0,w=o(({x:e,y:t})=>_({x:e,y:t})),T=S?{backgroundColor:`#a78bfa`,boxShadow:`0 0 0 3px rgba(167, 139, 250, 0.22), 0 0 12px rgba(167, 139, 250, 0.70)`}:y||b?{backgroundColor:`#3b82f6`,boxShadow:`0 0 0 3px rgba(59, 130, 246, 0.25), 0 0 10px rgba(59, 130, 246, 0.75)`}:v===`active`?{backgroundColor:`rgb(var(--terminal-green))`,boxShadow:`0 0 0 3px rgb(var(--terminal-green) / 0.18), 0 0 14px rgb(var(--terminal-green) / 0.70)`}:n?{backgroundColor:v===`idle`?u(n,.6):u(n,.25)}:{backgroundColor:v===`idle`?`rgb(var(--terminal-green) / 0.6)`:`rgb(var(--terminal-muted) / 0.4)`},E=p>0?p*14:0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`button`,{type:`button`,onClick:t,onPointerDown:w.onPointerDown,onPointerMove:w.onPointerMove,onPointerUp:w.onPointerUp,onPointerCancel:w.onPointerCancel,onClickCapture:w.onClickCapture,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),_({x:e.clientX,y:e.clientY})},className:`w-full select-none text-left flex items-center gap-2 px-2 py-1.5 rounded hover:bg-white/[0.03] transition-colors group`,style:{...E?{paddingLeft:8+E}:void 0,WebkitUserSelect:`none`,WebkitTouchCallout:`none`},children:[p>0&&(0,l.jsx)(`span`,{className:`text-[11px] font-mono text-terminal-muted/40 shrink-0 select-none`,"aria-hidden":!0,children:`├─`}),(0,l.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${y||v===`active`?`animate-pulse`:``}`,style:T,title:y&&e.awaiting_approval_question?`Awaiting human input: ${e.awaiting_approval_question}`:b?`Ready for review`:void 0}),S&&(0,l.jsx)(`span`,{className:`text-[8px] font-mono px-1 py-0.5 rounded shrink-0 bg-violet-500/15 text-violet-200 border border-violet-300/30`,children:`Dream`}),y&&(0,l.jsx)(`span`,{className:`text-[8px] font-mono px-1 py-0.5 rounded shrink-0 bg-blue-500/15 text-blue-300 border border-blue-400/40 animate-pulse`,title:e.awaiting_approval_question??`Awaiting human input`,children:`waiting on you`}),p>0&&(0,l.jsx)(`span`,{className:`text-[8px] font-mono px-1 py-0.5 rounded shrink-0 bg-terminal-purple/15 text-terminal-purple/80 border border-terminal-purple/25`,children:`sub`}),m>0&&p===0&&(0,l.jsxs)(`span`,{className:`text-[8px] font-mono px-1 py-0.5 rounded shrink-0 bg-terminal-cyan/15 text-terminal-cyan/90 border border-terminal-cyan/25`,title:`${m} sub-agent session${m===1?``:`s`}`,children:[m,` sub`,m===1?``:`s`]}),f&&d&&(0,l.jsx)(`span`,{className:`text-[8px] font-mono px-1 py-0.5 rounded shrink-0 truncate max-w-[100px] hidden sm:inline`,style:n?{color:u(n,.7),backgroundColor:u(n,.08),border:`1px solid ${u(n,.15)}`}:void 0,children:d}),(0,l.jsx)(`span`,{className:`text-[11px] font-mono truncate shrink-0 max-w-[35%] ${S?`text-violet-100`:`text-terminal-text/80`}`,children:x}),e.lastActivitySummary&&(0,l.jsx)(`span`,{className:`text-[9px] font-mono text-terminal-muted/30 truncate flex-1 min-w-0 hidden sm:inline`,children:e.lastActivitySummary}),C>0&&(0,l.jsx)(`span`,{className:`text-[9px] font-mono text-terminal-cyan/50 shrink-0 tabular-nums`,children:i(C)}),e.lastActivity&&(0,l.jsx)(a,{timestamp:e.lastActivity,className:`text-[9px] font-mono text-terminal-muted/40 shrink-0`})]}),g&&(0,l.jsx)(s,{x:g.x,y:g.y,sessionId:e.id,sessionFilePath:e.filePath,sessionTitle:x,onClose:()=>_(null)})]})}export{d as t};