import{t as e}from"./proxy-env-BWBLvN-u.js";import{i as t}from"./logger-Cb-sKDne.js";import{EnvHttpProxyAgent as n,ProxyAgent as r,fetch as i}from"undici";const a=Symbol.for(`openclaw.proxyFetch.proxyUrl`);function o(e){let t=null,n=()=>(t||=new r(e),t),o=((e,t)=>i(e,{...t,dispatcher:n()}));return Object.defineProperty(o,a,{value:e,enumerable:!1,configurable:!1,writable:!1}),o}function s(e){let t=e?.[a];return typeof t==`string`&&t.trim()||void 0}function c(){if(e(`https`))try{let e=new n;return((t,n)=>i(t,{...n,dispatcher:e}))}catch(e){t(`Proxy env var set but agent creation failed — falling back to direct fetch: ${e instanceof Error?e.message:String(e)}`);return}}export{o as n,c as r,s as t};
