//#region src/infra/gateway-process-argv.ts
function normalizeProcArg(arg) {
	return arg.trim().replaceAll("\\", "/").toLowerCase();
}
function parseProcCmdline(raw) {
	return raw.split("\0").map((entry) => entry.trim()).filter(Boolean);
}
function isGatewayArgv(args, opts) {
	const normalized = args.map(normalizeProcArg);
	if (!normalized.includes("gateway")) return false;
	const entryCandidates = [
		"dist/cli/index.js",
		"dist/src/cli/index.js",
		"dist/index.js",
		"xopc.mjs",
		"scripts/run-node.mjs",
		"src/cli/index.ts"
	];
	if (normalized.some((arg) => entryCandidates.some((entry) => arg.endsWith(entry)))) return true;
	if (normalized.map((arg) => arg.replace(/\.(bat|cmd|exe)$/i, "")).some((exe) => exe.endsWith("/xopc") || exe === "xopc" || opts?.allowGatewayBinary === true && exe.endsWith("/xopc-gateway"))) return true;
	return false;
}
//#endregion
export { isGatewayArgv, parseProcCmdline };

//# sourceMappingURL=gateway-process-argv.js.map