import{XY as N,YY as V,ZY as D}from"./cli-0.5.3-ngnshpb7.mjs";import{$2 as J,A2 as Z,GZ as Y,LZ as _,b3 as $,e3 as B,z3 as x}from"./cli-0.5.3-1vt6twff.mjs";import{D5 as X,V5 as R}from"./cli-0.5.3-vpcrbd8n.mjs";import{Eea as Q,Kea as P}from"./cli-0.5.3-66650sba.mjs";import{Xma as W}from"./cli-0.5.3-0df3r78b.mjs";function E(){let z=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:"",F=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:"";return`claude-cli/99.0.0 (${process.env.CLAUDE_CODE_ENTRYPOINT??"cli"}${z}${F})`}function I(){let z=[];if(process.env.CLAUDE_CODE_ENTRYPOINT)z.push(process.env.CLAUDE_CODE_ENTRYPOINT);if(process.env.CLAUDE_AGENT_SDK_VERSION)z.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`);if(process.env.CLAUDE_AGENT_SDK_CLIENT_APP)z.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);return`claude-code/99.0.0${z.length>0?` (${z.join(", ")})`:""}`}function w(){if(Y()==="firstParty")return`Claude-User (${N()}; +https://support.anthropic.com/)`;return`Claudio-User (${V()})`}function C(){if(B()){let F=J();if(!F?.accessToken)return{headers:{},error:"No OAuth token available"};return{headers:{Authorization:`Bearer ${F.accessToken}`,"anthropic-beta":Q}}}let z=Z();if(!z)return{headers:{},error:"No API key available"};return{headers:{"x-api-key":z}}}async function O(z,F){try{return await z()}catch(G){if(!X.isAxiosError(G))throw G;let L=G.response?.status;if(!(L===401||F?.also403Revoked&&L===403&&typeof G.response?.data==="string"&&G.response.data.includes("OAuth token has been revoked")))throw G;let M=J()?.accessToken;if(!M)throw G;return await $(M),await z()}}var H=W(()=>{R();P();x();_();D()});
export{E as RY,I as SY,w as TY,C as UY,O as VY,H as WY};
