{"version":3,"file":"shell-quote-DiUQZdE-.mjs","names":[],"sources":["../node_modules/.pnpm/@anthropic-ai+sandbox-runtime@0.0.70/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.js"],"sourcesContent":["/**\n * Shell-escape an array of arguments into a single string that, when parsed\n * by a POSIX shell (`sh -c`, `bash -c`, `zsh -c`), yields exactly the\n * original argument list.\n *\n * This intentionally replaces the npm `shell-quote` package. Its quote()\n * switches to a double-quote + backslash strategy whenever an argument\n * contains a single quote, and in that mode it backslash-escapes `!` — a\n * guard against history expansion that only applies to *interactive*\n * shells. Every string this library produces is executed through a\n * non-interactive `<shell> -c`, where bash treats `\\!` inside double quotes\n * as two literal characters (the backslash is NOT removed). The wrapped\n * user command almost always contains a single quote, so every `!` in it\n * reached the program corrupted to `\\!`: heredoc-written source like\n * `if (!x)` became unparseable, and `jq 'a != b'`, `awk '!seen[$0]++'`,\n * and `find ! -name` filters were silently rewritten.\n *\n * Single-quoting never has that problem. Inside POSIX single quotes every\n * byte is literal, so nothing needs escaping; the only character that\n * needs handling is the single quote itself, emitted as the standard\n * `'\"'\"'` sequence (close the quote, a double-quoted `'`, reopen).\n *\n * @param args - The argument list to escape\n * @returns A single space-joined string safe to pass to `<shell> -c`\n */\nexport function quote(args) {\n    return args\n        .map(arg => {\n        if (arg === '') {\n            return \"''\";\n        }\n        // Bare fast path: nothing in this character set is special to a\n        // POSIX shell (no whitespace, globs, expansions, quotes, or\n        // operators), so the bare word re-parses to exactly itself. The one\n        // position-sensitive case is a LEADING \"=\": zsh (a common binShell,\n        // even non-interactive `zsh -c`) performs \"equals expansion\" on an\n        // unquoted word starting with \"=\" (`=ls` becomes /bin/ls; an unknown\n        // name aborts the whole command line), so such a word must be quoted.\n        // \"=\" elsewhere in the word (NAME=value env assignments) is fine.\n        if (/^[A-Za-z0-9_./:@+,-][A-Za-z0-9_./:=@+,-]*$/.test(arg)) {\n            return arg;\n        }\n        return \"'\" + arg.replace(/'/g, `'\"'\"'`) + \"'\";\n    })\n        .join(' ');\n}\n//# sourceMappingURL=shell-quote.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,MAAM,MAAM;CACxB,OAAO,KACF,KAAI,QAAO;EACZ,IAAI,QAAQ,IACR,OAAO;EAUX,IAAI,6CAA6C,KAAK,GAAG,GACrD,OAAO;EAEX,OAAO,MAAM,IAAI,QAAQ,MAAM,OAAO,IAAI;CAC9C,CAAC,EACI,KAAK,GAAG;AACjB"}