import{n as e}from"./chunk-DR8-3Aex.js";import{Cn as t,t as n}from"./src-Di342QoJ.js";import{Ct as r,M as i,cn as a}from"./state-sIHsFpDu.js";import{Bc as o,Ka as s,Uc as c,dn as l,en as u,on as d,oo as f}from"./paths-Ci1iwL5Y.js";import{n as p,t as m}from"./cwd--iizewsn.js";import{C as h,D as g,E as _,x as v}from"./startupProfiler-CAntGAbs.js";import{Fr as y,Yr as b}from"./loadAgentsDir-C_wFhytF.js";import{r as x,t as S}from"./semver-Di5OaTd5.js";import{c as C,s as w,u as T}from"./releaseNotes-C8KQGZHq.js";function E(e){return e>=70?`horizontal`:`compact`}function D(e,t,n){if(t===`horizontal`){let t=n,r=e-(R+B+z+t),i=Math.max(30,r),a=Math.min(t+i+z+B,e-R);return a<t+i+z+B&&(i=a-t-z-B),{leftWidth:t,rightWidth:i,totalWidth:a}}let r=Math.min(e-R,I+20);return{leftWidth:r,rightWidth:r,totalWidth:r}}function O(e,n,r){let i=Math.max(t(e),t(n),t(r),20);return Math.min(i+4,I)}function k(e){return!e||e.length>L?`Welcome back!`:`Welcome back ${e}!`}function A(e,n){if(t(e)<=n)return e;let r=e.split(`/`),i=r[0]||``,a=r[r.length-1]||``,o=t(i),s=t(a);if(r.length===1)return _(e,n);if(i===``&&2+s>=n)return`/${_(a,Math.max(1,n-1))}`;if(i!==``&&3+s>=n)return`…/${_(a,Math.max(1,n-1-1))}`;if(r.length===2)return`${g(i,n-1-1-s)}…/${a}`;let c=n-o-s-1-2;if(c<=0)return`${g(i,Math.max(0,n-s-1-2))}/…/${a}`;let l=[];for(let e=r.length-2;e>0;e--){let n=r[e];if(n&&t(n)+1<=c)l.unshift(n),c-=t(n)+1;else break}return l.length===0?`${i}/…/${a}`:`${i}/…/${l.join(`/`)}/${a}`}async function j(){if(H)return H;let e=r();return H=b(10).then(t=>(V=t.filter(t=>{if(t.isSidechain||t.sessionId===e||t.summary?.includes(`I apologize`))return!1;let n=t.summary&&t.summary!==`No prompt`,r=t.firstPrompt&&t.firstPrompt!==`No prompt`;return n||r}).slice(0,3),V)).catch(()=>(V=[],V)),H}function M(){return V}function N(){let e=process.env.DEMO_VERSION??`2.7.1`,t=i(),n=process.env.DEMO_VERSION?`/code/claude`:o(m());return{version:e,cwd:t?`${n} in ${t.replace(/^https?:\/\//,``)}`:n,billingType:l()?u():`API Usage Billing`,agentName:s().agent}}function P(e,n,r){return t(e)+3+t(n)>r?{shouldSplit:!0,truncatedModel:h(e,r),truncatedBilling:h(n,r)}:{shouldSplit:!1,truncatedModel:h(e,Math.max(r-t(n)-3,10)),truncatedBilling:n}}function F(e){if(process.env.USER_TYPE===`ant`)return[];let t=w();if(!t)return[];let n;try{n=T(t)}catch{return[]}let r=[],i=Object.keys(n).sort((e,t)=>S(e,t)?-1:1).slice(0,3);for(let e of i){let t=n[e];t&&r.push(...t)}return r.slice(0,e)}var I,L,R,z,B,V,H,U=e((()=>{a(),n(),d(),p(),c(),v(),C(),x(),y(),f(),I=50,L=20,R=4,z=1,B=2,V=[],H=null}));export{E as a,M as c,A as d,k as i,F as l,O as n,N as o,P as r,j as s,D as t,U as u};