"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_primordials_map_set = require('../../primordials/map-set.js');
const require_ansi_strip = require('../../ansi/strip.js');

//#region src/process/spawn/_internal.ts
/**
* @file Private internals for `spawn/*` modules — the `@npmcli/promise-spawn`
*   lazy loader, the per-spawn ANSI-stripping helper, the WeakMap stack cache,
*   and the binary-path cache shared between `spawn` and `spawnSync`.
*   Underscore prefix excludes this file from the public exports map.
*/
const stackCache = new require_primordials_map_set.WeakMapCtor();
const spawnBinPathCache = new require_primordials_map_set.MapCtor();
const windowsScriptExtRegExp = /\.(?:cmd|bat|ps1)$/i;
let _npmCliPromiseSpawn;
/**
* Lazily load the `@npmcli/promise-spawn` module to avoid Webpack bundling
* issues. Required because the upstream module uses CJS dynamic-require
* patterns that Webpack flags.
*/
/*@__NO_SIDE_EFFECTS__*/
function getNpmCliPromiseSpawn() {
	if (_npmCliPromiseSpawn === void 0) _npmCliPromiseSpawn = /*@__PURE__*/ require("../../external/@npmcli/promise-spawn");
	return _npmCliPromiseSpawn;
}
/**
* Strip ANSI escape codes from spawn result stdout and stderr. Modifies the
* result object in place to remove color codes and formatting.
*
* @param {unknown} result - Spawn result object with stdout/stderr properties.
*
* @returns {unknown} The modified result object
*/
/*@__NO_SIDE_EFFECTS__*/
function stripAnsiFromSpawnResult(result) {
	const res = result;
	const { stderr, stdout } = res;
	if (typeof stdout === "string") res.stdout = /* @__PURE__ */ require_ansi_strip.stripAnsi(stdout);
	if (typeof stderr === "string") res.stderr = /* @__PURE__ */ require_ansi_strip.stripAnsi(stderr);
	return res;
}

//#endregion
exports.getNpmCliPromiseSpawn = getNpmCliPromiseSpawn;
exports.spawnBinPathCache = spawnBinPathCache;
exports.stackCache = stackCache;
exports.stripAnsiFromSpawnResult = stripAnsiFromSpawnResult;
exports.windowsScriptExtRegExp = windowsScriptExtRegExp;