import{_ as z}from"./Cd5yfd14.js";import{d as B,G as D,r as g,v as b,l as I,m as L,o as M,y as k,s as N,c as n,f as O,e as s,h as c,t,j as $,F as v,p as C,b as r,q as P,_ as j}from"./tpFEFzWU.js";import{u as S}from"./Grz13CMP.js";import{u as q}from"./B-hNDTeU.js";import"./DM9QX0ua.js";const E={class:"issue-terminal-page"},G={class:"terminal-content card"},W={class:"terminal-header"},X={class:"terminal-actions"},J={key:0,class:"terminal-empty"},K={class:"section-header"},Q={class:"section-icon"},U={class:"section-column"},Y={class:"section-session"},Z={key:0,class:"log-time"},x={class:"log-message"},ee=B({__name:"terminal",async setup(se){let a,u;const m=D().params.id,o=g(null),i=g(!0),{data:l}=([a,u]=b(()=>S(`/api/issues/${m}`,"$s3Vbd9k-VO")),a=await a,u(),a),H=I(()=>{if(!l.value)return null;const e={id:l.value.key,title:l.value.title,column:l.value.column_slug};return l.value.priority&&(e.priority=l.value.priority),e}),{data:f,refresh:h}=([a,u]=b(()=>S(`/api/issues/${m}/full-terminal`,"$XMztO43Pyz")),a=await a,u(),a),{lastMessage:T}=q();L(T,e=>{e?.type==="claude_end"&&e.issue===m&&h(),i.value&&k(()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight)})}),M(()=>{k(()=>{o.value&&i.value&&(o.value.scrollTop=o.value.scrollHeight)})});const w=e=>{if(!e)return"";try{return new Date(e).toLocaleTimeString()}catch{return e}},V=e=>e===0?"1":String(e+1),A=()=>{i.value=!i.value};return N({title:`Terminal - ${m} - AutoCode`}),(e,y)=>{const F=z;return r(),n("div",E,[O(F,{issue:c(H),"active-tab":"terminal"},null,8,["issue"]),s("div",G,[s("div",W,[s("h2",null,t(e.$t("issue.terminal"))+" ("+t(e.$t("terminal.fullHistory"))+")",1),s("div",X,[s("button",{class:"btn btn-secondary btn-sm",onClick:A},t(c(i)?"Pause":"Resume")+" Auto-scroll ",1),s("button",{class:"btn btn-secondary btn-sm",onClick:y[0]||(y[0]=()=>c(h)())},t(e.$t("btn.refresh")),1)])]),s("div",{ref_key:"terminalRef",ref:o,class:"terminal-output"},[c(f)?.logFiles?.length?$("",!0):(r(),n("div",J,t(e.$t("terminal.noLogs")),1)),(r(!0),n(v,null,C(c(f)?.logFiles,(_,p)=>(r(),n(v,{key:p},[s("div",K,[s("span",Q,t(V(p)),1),s("span",U,t(_.column),1),s("span",Y,t(_.sessionId),1)]),(r(!0),n(v,null,C(_.logs,(d,R)=>(r(),n("div",{key:`${p}-${R}`,class:P(["log-line",`log-${d.level}`])},[d.timestamp?(r(),n("span",Z,t(w(d.timestamp)),1)):$("",!0),s("span",x,t(d.message),1)],2))),128))],64))),128))],512)])])}}}),ie=j(ee,[["__scopeId","data-v-3b499d2c"]]);export{ie as default};
