const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
const require_index = require('../../../../node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.cjs');
const require_ofetch_CWycOUEr = require('./shared/ofetch.CWycOUEr.cjs');
let node_http = require("node:http");
node_http = require_rolldown_runtime.__toESM(node_http);
let node_https = require("node:https");
node_https = require_rolldown_runtime.__toESM(node_https);

//#region ../../node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs
function createNodeFetch() {
	if (!JSON.parse(process.env.FETCH_KEEP_ALIVE || "false")) return require_index.r;
	const agentOptions = { keepAlive: true };
	const httpAgent = new node_http.default.Agent(agentOptions);
	const httpsAgent = new node_https.default.Agent(agentOptions);
	const nodeFetchOptions = { agent(parsedURL) {
		return parsedURL.protocol === "http:" ? httpAgent : httpsAgent;
	} };
	return function nodeFetchWithKeepAlive(input, init) {
		return require_index.r(input, {
			...nodeFetchOptions,
			...init
		});
	};
}
const fetch = globalThis.fetch ? (...args) => globalThis.fetch(...args) : createNodeFetch();
const Headers = globalThis.Headers || require_index.n;
const AbortController = globalThis.AbortController || require_index.T;
const ofetch = require_ofetch_CWycOUEr.createFetch({
	fetch,
	Headers,
	AbortController
});
const $fetch = ofetch;

//#endregion
exports.$fetch = $fetch;