/* Socket Lib - Built with esbuild */
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var temporary_executor_exports = {};
__export(temporary_executor_exports, {
  isRunningInTemporaryExecutor: () => isRunningInTemporaryExecutor
});
module.exports = __toCommonJS(temporary_executor_exports);
var import_path = require("./path");
function isRunningInTemporaryExecutor(cwd = process.cwd()) {
  const userAgent = process.env["npm_config_user_agent"];
  if (userAgent?.includes("exec") || userAgent?.includes("npx") || userAgent?.includes("dlx")) {
    return true;
  }
  const normalizedCwd = (0, import_path.normalizePath)(cwd);
  const npmCache = process.env["npm_config_cache"];
  if (npmCache && normalizedCwd.includes((0, import_path.normalizePath)(npmCache))) {
    return true;
  }
  const tempPatterns = [
    // npm's npx cache directory
    "_npx",
    // pnpm dlx temporary store
    ".pnpm-store",
    // Common dlx directory prefix
    "dlx-",
    // Yarn Berry PnP virtual packages.
    ".yarn/$$"
  ];
  if (process.platform === "win32") {
    tempPatterns.push("AppData/Local/Temp/xfs-");
  }
  return tempPatterns.some((pattern) => normalizedCwd.includes(pattern));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  isRunningInTemporaryExecutor
});
//# sourceMappingURL=temporary-executor.js.map
