import{gd as m,hd as v,id as wk}from"./cli-0.5.12-k976aej3.mjs";import{Ps as l,Qs as Vk,UD as n,VD as V,WD as i,Yl as p,ZD as Tk,Zl as zk,fL as o,hL as t,kL as Dk,oL as e,pL as Uk,sC as g,tC as a,tO as r,uO as kk,vy as s,wy as Gk,yC as Lk,yO as jk}from"./cli-0.5.12-zc0qwdy2.mjs";import{P0 as d,R0 as Ok,n0 as T,s0 as Jk}from"./cli-0.5.12-pycnjaeg.mjs";import{j4 as f,k4 as Ik,u4 as c,x4 as Mk}from"./cli-0.5.12-8v5w8znc.mjs";import{l6 as S,q6 as _k}from"./cli-0.5.12-ecgx5n54.mjs";import{H$ as j,M6 as K,Maa as x,O6 as Zk,P7 as P,Qaa as b,T7 as $k,W$ as Kk,Zaa as u,eba as $,mca as _,pca as Hk}from"./cli-0.5.12-g4wb8mj2.mjs";import{jda as J,oda as Yk}from"./cli-0.5.12-vp5smcs1.mjs";import{bfa as L,cfa as Bk}from"./cli-0.5.12-k1crwtdc.mjs";import{fga as B,ifa as O,iga as U,kfa as Rk}from"./cli-0.5.12-p5ps8gf0.mjs";import{Gga as Xk,tga as h,zga as Y}from"./cli-0.5.12-tfdwzg37.mjs";import{Mga as E,Wga as Wk}from"./cli-0.5.12-60w1a0bs.mjs";import{Xja as F,Zja as y,nka as w,rma as z}from"./cli-0.5.12-c8f4daey.mjs";import{Qma as A,Rma as Qk}from"./cli-0.5.12-0qasc0ef.mjs";import{boa as W}from"./cli-0.5.12-xzeb7mtb.mjs";Yk();z();$();Qk();z();z();Vk();Ok();Lk();Tk();Bk();Hk();Jk();var G=!1;function D(){if(G)return;if(G=!0,T()!=="firstParty")return;let k=_()?.transport;if(k==="bedrock"||k==="vertex"||k==="foundry")return;if(process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ANTHROPIC_UNIX_SOCKET||process.env.CLAUDE_CODE_CLIENT_CERT||process.env.CLAUDE_CODE_CLIENT_KEY)return;let q=_(),N=(q?.transport==="anthropic"?q.baseUrl:void 0)||L().BASE_API_URL;fetch(N,{method:"HEAD",signal:AbortSignal.timeout(1e4)}).catch(()=>{})}$();U();Kk();function C(){if(process.env.NODE_EXTRA_CA_CERTS)return;let k=Nk();if(k)process.env.NODE_EXTRA_CA_CERTS=k,B(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${k}`)}function Nk(){try{let q=x()?.env,Q=j("userSettings")?.env;B(`CA certs: Config fallback - globalEnv keys: ${q?Object.keys(q).join(","):"none"}, settingsEnv keys: ${Q?Object.keys(Q).join(","):"none"}`);let R=Q?.NODE_EXTRA_CA_CERTS||q?.NODE_EXTRA_CA_CERTS;if(R)B(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${R}`);return R}catch(k){B(`CA certs: Config fallback failed: ${k}`,{level:"error"});return}}Rk();$();U();_k();Zk();zk();Wk();Xk();jk();wk();Ik();Dk();Mk();Uk();Gk();$k();var I=!1,Yq=A(async()=>{let k=Date.now();K("info","init_started"),J("init_function_start");try{let q=Date.now();b(),K("info","init_configs_enabled",{duration_ms:Date.now()-q}),J("init_configs_enabled");let N=Date.now();if(m(),C(),K("info","init_safe_env_vars_applied",{duration_ms:Date.now()-N}),J("init_safe_env_vars_applied"),r(),J("init_after_graceful_shutdown"),Promise.all([import("./firstPartyEventLogger-0.5.12-jbg4z87y.mjs"),import("./growthbook-0.5.12-d3dr2a5b.mjs")]).then(([H,X])=>{H.initialize1PEventLogging(),X.onGrowthBookRefresh(()=>{H.reinitialize1PEventLoggingIfConfigChanged()})}),J("init_after_1p_event_logging"),d(),J("init_after_oauth_populate"),p(),J("init_after_jetbrains_detection"),S(),V())n();if(a())g();J("init_after_remote_settings_check"),u();let Q=Date.now();B("[init] configureGlobalMTLS starting"),f(),K("info","init_mtls_configured",{duration_ms:Date.now()-Q}),B("[init] configureGlobalMTLS complete");let R=Date.now();if(B("[init] configureGlobalAgents starting"),c(),K("info","init_proxy_configured",{duration_ms:Date.now()-R}),B("[init] configureGlobalAgents complete"),J("init_network_configured"),D(),E(process.env.CLAUDE_CODE_REMOTE))try{let{initUpstreamProxy:H,getUpstreamProxyEnv:X}=await import("./upstreamproxy-0.5.12-1v1wp95x.mjs"),{registerUpstreamProxyEnvFn:Z}=await import("./subprocessEnv-0.5.12-bbjh5kcq.mjs");Z(X),await H()}catch(H){B(`[init] upstreamproxy init failed: ${H instanceof Error?H.message:String(H)}; continuing without proxy`,{level:"warn"})}if(P(),O(l),O(async()=>{let{cleanupSessionTeams:H}=await import("./teamHelpers-0.5.12-4993s40p.mjs");await H()}),o()){let H=Date.now();await t(),K("info","init_scratchpad_created",{duration_ms:Date.now()-H})}K("info","init_completed",{duration_ms:Date.now()-k}),J("init_function_end")}catch(q){if(q instanceof h){if(w()){process.stderr.write(`Configuration error in ${q.filePath}: ${q.message}
`),kk(1);return}return import("./InvalidConfigDialog-0.5.12-q3wspzrk.mjs").then((N)=>N.showInvalidConfigDialog({error:q}))}else throw q}});function Zq(){if(V()){if(w()&&e())M().catch((k)=>{B(`[3P telemetry] Eager telemetry init failed (beta tracing): ${Y(k)}`,{level:"error"})});B("[3P telemetry] Waiting for remote managed settings before telemetry init"),i().then(async()=>{B("[3P telemetry] Remote managed settings loaded, initializing telemetry"),v(),await M()}).catch((k)=>{B(`[3P telemetry] Telemetry init failed (remote settings path): ${Y(k)}`,{level:"error"})})}else M().catch((k)=>{B(`[3P telemetry] Telemetry init failed: ${Y(k)}`,{level:"error"})})}async function M(){if(I)return;I=!0;try{await xk()}catch(k){throw I=!1,k}}async function xk(){let{initializeTelemetry:k}=await import("./instrumentation-0.5.12-t5wdqnhp.mjs"),q=await k();if(q)F(q,(Q,R)=>{let H=q?.createCounter(Q,R);return{add(X,Z={}){let qk={...s(),...Z};H?.add(X,qk)}}}),y()?.add(1)}
export{Yq as da,Zq as ea};
