import{i as e}from"./logger-BZJOAWrs.js";import{t}from"./proxy-env-CBtwyB-W.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(t(`https`))try{let e=new n;return((t,n)=>i(t,{...n,dispatcher:e}))}catch(t){e(`Proxy env var set but agent creation failed — falling back to direct fetch: ${t instanceof Error?t.message:String(t)}`);return}}export{o as n,c as r,s as t};
