@poe-platform/safe-bash 0.1.710 → 0.1.712

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +21 -1
  2. package/dist/safe-bash/commands/fmt/index.d.ts +2 -0
  3. package/dist/safe-bash/commands/fmt/index.d.ts.map +1 -0
  4. package/dist/safe-bash/commands/fmt/index.js +2 -0
  5. package/dist/safe-bash/commands/fmt/index.js.map +1 -0
  6. package/dist/safe-bash/commands/fmt.d.ts +1 -2
  7. package/dist/safe-bash/commands/fmt.d.ts.map +1 -1
  8. package/dist/safe-bash/commands/fmt.js +1 -838
  9. package/dist/safe-bash/commands/fmt.js.map +1 -1
  10. package/dist/safe-bash/commands/time-env/printenv.d.ts +1 -1
  11. package/dist/safe-bash/commands/time-env/printenv.d.ts.map +1 -1
  12. package/dist/safe-bash/commands/time-env/sleep.d.ts +1 -1
  13. package/dist/safe-bash/commands/time-env/sleep.d.ts.map +1 -1
  14. package/dist/safe-bash/core.browser.js +155 -2099
  15. package/dist/safe-bash/core.browser.js.map +3 -3
  16. package/dist/safe-bash/playwright/private-target-transport.d.ts.map +1 -1
  17. package/dist/safe-bash/playwright/private-target-transport.js +18 -2
  18. package/dist/safe-bash/playwright/private-target-transport.js.map +1 -1
  19. package/dist/safe-bash/playwright/profile.d.ts +3 -1
  20. package/dist/safe-bash/playwright/profile.d.ts.map +1 -1
  21. package/dist/safe-bash/playwright/profile.js +3 -3
  22. package/dist/safe-bash/playwright/profile.js.map +1 -1
  23. package/dist/safe-bash-command-exiftool/index.js +1401 -6
  24. package/dist/safe-bash-command-exiftool/index.js.map +7 -0
  25. package/dist/safe-bash-command-fmt/arguments.d.ts +8 -0
  26. package/dist/safe-bash-command-fmt/command.d.ts +20 -0
  27. package/dist/safe-bash-command-fmt/contracts.d.ts +42 -0
  28. package/dist/safe-bash-command-fmt/engine.d.ts +20 -0
  29. package/dist/safe-bash-command-fmt/index.d.ts +5 -0
  30. package/dist/safe-bash-command-fmt/index.js +2419 -0
  31. package/dist/safe-bash-command-fmt/index.js.map +7 -0
  32. package/dist/safe-bash-command-fmt/sdk.d.ts +15 -0
  33. package/dist/safe-bash-command-wkhtmltopdf/index.js +1458 -7
  34. package/dist/safe-bash-command-wkhtmltopdf/index.js.map +7 -0
  35. package/dist/safe-bash-contracts/index.d.ts +8 -0
  36. package/dist/safe-bash-contracts/index.js +8 -0
  37. package/dist/safe-playwright-cloudflare/browser-run-code.js +15 -1
  38. package/package.json +6 -2
  39. package/dist/safe-bash-command-exiftool/argfiles.js +0 -163
  40. package/dist/safe-bash-command-exiftool/arguments.js +0 -128
  41. package/dist/safe-bash-command-exiftool/command.js +0 -324
  42. package/dist/safe-bash-command-exiftool/csv.js +0 -78
  43. package/dist/safe-bash-command-exiftool/paths.js +0 -18
  44. package/dist/safe-bash-command-exiftool/png.js +0 -308
  45. package/dist/safe-bash-command-exiftool/publication.js +0 -80
  46. package/dist/safe-bash-command-exiftool/registry.js +0 -14
  47. package/dist/safe-bash-command-exiftool/resources.js +0 -29
  48. package/dist/safe-bash-command-exiftool/scalar.js +0 -103
  49. package/dist/safe-bash-command-exiftool/sdk.js +0 -113
  50. package/dist/safe-bash-command-exiftool/shifts.js +0 -29
  51. package/dist/safe-bash-command-wkhtmltopdf/command.js +0 -373
  52. package/dist/safe-bash-command-wkhtmltopdf/engine.js +0 -99
  53. package/dist/safe-bash-command-wkhtmltopdf/errors.js +0 -11
  54. package/dist/safe-bash-command-wkhtmltopdf/limits.js +0 -69
  55. package/dist/safe-bash-command-wkhtmltopdf/outcome.js +0 -38
  56. package/dist/safe-bash-command-wkhtmltopdf/parser.js +0 -146
  57. package/dist/safe-bash-command-wkhtmltopdf/resources.js +0 -284
  58. package/dist/safe-bash-command-wkhtmltopdf/settings.js +0 -35
  59. package/dist/safe-bash-command-wkhtmltopdf/switches.js +0 -127
  60. package/dist/safe-bash-command-wkhtmltopdf/values.js +0 -66
@@ -241,7 +241,7 @@ __export(core_browser_exports, {
241
241
  EreSyntaxError: () => EreSyntaxError,
242
242
  EreUnsupportedError: () => EreUnsupportedError,
243
243
  EreUsageUnknownError: () => EreUsageUnknownError,
244
- FsError: () => FsError52,
244
+ FsError: () => FsError51,
245
245
  MemoryFileSystem: () => MemoryFileSystem,
246
246
  MountFileSystem: () => MountFileSystem,
247
247
  OverlayFileSystem: () => OverlayFileSystem,
@@ -257,7 +257,7 @@ __export(core_browser_exports, {
257
257
  agentCommands: () => agentCommands,
258
258
  applyPatchCommands: () => applyPatchCommands,
259
259
  archiveCommands: () => archiveCommands,
260
- assertCommandRequirements: () => assertCommandRequirements11,
260
+ assertCommandRequirements: () => assertCommandRequirements10,
261
261
  assertPathWithin: () => assertPathWithin,
262
262
  basename: () => basename2,
263
263
  byteCommands: () => byteCommands,
@@ -373,7 +373,7 @@ __export(core_browser_exports, {
373
373
  factorCommands: () => factorCommands,
374
374
  fgrepCommand: () => fgrepCommand,
375
375
  fileCommands: () => fileCommands,
376
- getCommandArguments: () => getCommandArguments15,
376
+ getCommandArguments: () => getCommandArguments14,
377
377
  getoptCommands: () => getoptCommands,
378
378
  grepAliasCommands: () => grepAliasCommands,
379
379
  hexdumpCommands: () => hexdumpCommands,
@@ -382,7 +382,7 @@ __export(core_browser_exports, {
382
382
  inspectPythonCapabilities: () => inspectPythonCapabilities,
383
383
  isAbsolutePath: () => isAbsolutePath2,
384
384
  isErrnoCode: () => isErrnoCode,
385
- isFsError: () => isFsError10,
385
+ isFsError: () => isFsError9,
386
386
  isPathWithin: () => isPathWithin2,
387
387
  joinPath: () => joinPath2,
388
388
  lineEndingCommands: () => lineEndingCommands,
@@ -422,7 +422,7 @@ __export(core_browser_exports, {
422
422
  validateExitCode: () => validateExitCode2,
423
423
  validatePath: () => validatePath2,
424
424
  whichCommands: () => whichCommands,
425
- writeBytes: () => writeBytes32,
425
+ writeBytes: () => writeBytes31,
426
426
  writeText: () => writeText3,
427
427
  xmlCommands: () => xmlCommands,
428
428
  yqCommands: () => yqCommands
@@ -3427,7 +3427,7 @@ async function splitString(source2, environment, work) {
3427
3427
  const result = [];
3428
3428
  let parts = [];
3429
3429
  let active = false;
3430
- let quote5 = "";
3430
+ let quote4 = "";
3431
3431
  const start = () => {
3432
3432
  if (!active) {
3433
3433
  work.argument();
@@ -3447,28 +3447,28 @@ async function splitString(source2, environment, work) {
3447
3447
  for (let index = 0; index < source2.length; ) {
3448
3448
  if (work.tick()) await work.pause();
3449
3449
  const character = String.fromCodePoint(source2.codePointAt(index));
3450
- if ((character === "'" || character === '"') && (!quote5 || character === quote5)) {
3450
+ if ((character === "'" || character === '"') && (!quote4 || character === quote4)) {
3451
3451
  start();
3452
- quote5 = quote5 ? "" : character;
3452
+ quote4 = quote4 ? "" : character;
3453
3453
  index++;
3454
3454
  continue;
3455
3455
  }
3456
- if (!quote5 && /[ \t\n\r\v\f]/u.test(character)) {
3456
+ if (!quote4 && /[ \t\n\r\v\f]/u.test(character)) {
3457
3457
  finish();
3458
3458
  index++;
3459
3459
  continue;
3460
3460
  }
3461
3461
  if (character === "#" && !active) break;
3462
- if (character === "\\" && (quote5 !== "'" || source2[index + 1] === "\\" || source2[index + 1] === "'")) {
3462
+ if (character === "\\" && (quote4 !== "'" || source2[index + 1] === "\\" || source2[index + 1] === "'")) {
3463
3463
  const escaped3 = source2[index + 1];
3464
3464
  if (escaped3 === void 0) throw new EnvSplitError("invalid backslash at end of string in -S");
3465
3465
  index += 2;
3466
3466
  if (escaped3 === "c") {
3467
- if (quote5 === '"') throw new EnvSplitError("'\\c' must not appear in double-quoted -S string");
3467
+ if (quote4 === '"') throw new EnvSplitError("'\\c' must not appear in double-quoted -S string");
3468
3468
  break;
3469
3469
  }
3470
3470
  if (escaped3 === "_") {
3471
- if (quote5 === '"') append(" ");
3471
+ if (quote4 === '"') append(" ");
3472
3472
  else finish();
3473
3473
  continue;
3474
3474
  }
@@ -3478,7 +3478,7 @@ async function splitString(source2, environment, work) {
3478
3478
  else throw new EnvSplitError(`invalid sequence '\\${escaped3}' in -S`);
3479
3479
  continue;
3480
3480
  }
3481
- if (character === "$" && quote5 !== "'") {
3481
+ if (character === "$" && quote4 !== "'") {
3482
3482
  let end = index + 2;
3483
3483
  if (source2[index + 1] !== "{" || !/^[A-Za-z_]$/u.test(source2[end] ?? "")) {
3484
3484
  throw new EnvSplitError(`only \${VARNAME} expansion is supported, error at: ${source2.slice(index)}`);
@@ -3500,7 +3500,7 @@ async function splitString(source2, environment, work) {
3500
3500
  append(character);
3501
3501
  index += character.length;
3502
3502
  }
3503
- if (quote5) throw new EnvSplitError("no terminating quote in -S string");
3503
+ if (quote4) throw new EnvSplitError("no terminating quote in -S string");
3504
3504
  finish();
3505
3505
  return result;
3506
3506
  }
@@ -3510,7 +3510,7 @@ async function splitBytes(source2, environment, work) {
3510
3510
  const result = [];
3511
3511
  let pending = [];
3512
3512
  let active = false;
3513
- let quote5 = 0;
3513
+ let quote4 = 0;
3514
3514
  const start = () => {
3515
3515
  if (!active) {
3516
3516
  work.argument();
@@ -3531,28 +3531,28 @@ async function splitBytes(source2, environment, work) {
3531
3531
  for (let index = 0; index < source2.length; ) {
3532
3532
  if (work.tick()) await work.pause();
3533
3533
  const character = source2[index];
3534
- if ((character === 39 || character === 34) && (!quote5 || character === quote5)) {
3534
+ if ((character === 39 || character === 34) && (!quote4 || character === quote4)) {
3535
3535
  start();
3536
- quote5 = quote5 ? 0 : character;
3536
+ quote4 = quote4 ? 0 : character;
3537
3537
  index++;
3538
3538
  continue;
3539
3539
  }
3540
- if (!quote5 && [32, 9, 10, 13, 11, 12].includes(character)) {
3540
+ if (!quote4 && [32, 9, 10, 13, 11, 12].includes(character)) {
3541
3541
  finish();
3542
3542
  index++;
3543
3543
  continue;
3544
3544
  }
3545
3545
  if (character === 35 && !active) break;
3546
- if (character === 92 && (quote5 !== 39 || source2[index + 1] === 92 || source2[index + 1] === 39)) {
3546
+ if (character === 92 && (quote4 !== 39 || source2[index + 1] === 92 || source2[index + 1] === 39)) {
3547
3547
  const escaped3 = source2[index + 1];
3548
3548
  if (escaped3 === void 0) throw new EnvSplitError("invalid backslash at end of string in -S");
3549
3549
  index += 2;
3550
3550
  if (escaped3 === 99) {
3551
- if (quote5 === 34) throw new EnvSplitError("'\\c' must not appear in double-quoted -S string");
3551
+ if (quote4 === 34) throw new EnvSplitError("'\\c' must not appear in double-quoted -S string");
3552
3552
  break;
3553
3553
  }
3554
3554
  if (escaped3 === 95) {
3555
- if (quote5 === 34) append(Uint8Array.of(32));
3555
+ if (quote4 === 34) append(Uint8Array.of(32));
3556
3556
  else finish();
3557
3557
  continue;
3558
3558
  }
@@ -3562,7 +3562,7 @@ async function splitBytes(source2, environment, work) {
3562
3562
  else throw new EnvSplitError(`invalid sequence '\\${String.fromCharCode(escaped3)}' in -S`);
3563
3563
  continue;
3564
3564
  }
3565
- if (character === 36 && quote5 !== 39) {
3565
+ if (character === 36 && quote4 !== 39) {
3566
3566
  let end = index + 2;
3567
3567
  if (source2[index + 1] !== 123 || !nameStart(source2[end])) throw new EnvSplitError(`only \${VARNAME} expansion is supported, error at: ${decoder.decode(source2.subarray(index))}`);
3568
3568
  while (nameStart(source2[end]) || source2[end] !== void 0 && source2[end] >= 48 && source2[end] <= 57) {
@@ -3582,7 +3582,7 @@ async function splitBytes(source2, environment, work) {
3582
3582
  append(source2.subarray(index, index + 1));
3583
3583
  index++;
3584
3584
  }
3585
- if (quote5) throw new EnvSplitError("no terminating quote in -S string");
3585
+ if (quote4) throw new EnvSplitError("no terminating quote in -S string");
3586
3586
  finish();
3587
3587
  return result;
3588
3588
  }
@@ -3813,22 +3813,22 @@ async function* argumentsFrom(source2, signal, replacement = false) {
3813
3813
  let current = "";
3814
3814
  let active = false;
3815
3815
  let escaped3 = false;
3816
- let quote5 = "";
3817
- const parse19 = function* (text3) {
3816
+ let quote4 = "";
3817
+ const parse18 = function* (text3) {
3818
3818
  for (const character of text3) {
3819
3819
  if (escaped3) {
3820
3820
  current += character;
3821
3821
  active = true;
3822
3822
  escaped3 = false;
3823
- } else if (quote5) {
3823
+ } else if (quote4) {
3824
3824
  if (character === "\n") throw new UsageError("unmatched quote in input");
3825
- if (character === quote5) quote5 = "";
3825
+ if (character === quote4) quote4 = "";
3826
3826
  else current += character;
3827
3827
  } else if (character === "\\") {
3828
3828
  escaped3 = true;
3829
3829
  active = true;
3830
3830
  } else if (character === "'" || character === '"') {
3831
- quote5 = character;
3831
+ quote4 = character;
3832
3832
  active = true;
3833
3833
  } else if (character === "\n" || !replacement && /[ \t\r\v\f]/u.test(character)) {
3834
3834
  if (active) {
@@ -3846,10 +3846,10 @@ async function* argumentsFrom(source2, signal, replacement = false) {
3846
3846
  };
3847
3847
  for await (const chunk of (0, contracts_exports.readBytes)(source2, signal)) {
3848
3848
  signal.throwIfAborted();
3849
- yield* parse19(utf82.decode(chunk, { stream: true }));
3849
+ yield* parse18(utf82.decode(chunk, { stream: true }));
3850
3850
  }
3851
- yield* parse19(utf82.decode());
3852
- if (quote5 || escaped3) throw new UsageError(quote5 ? "unmatched quote in input" : "trailing backslash in input");
3851
+ yield* parse18(utf82.decode());
3852
+ if (quote4 || escaped3) throw new UsageError(quote4 ? "unmatched quote in input" : "trailing backslash in input");
3853
3853
  if (active) yield current;
3854
3854
  }
3855
3855
  function executionCommands(execute4, configuration = {}) {
@@ -5317,1958 +5317,14 @@ ${error instanceof UsageError ? "cmp: Try 'cmp --help' for more information.\n"
5317
5317
 
5318
5318
  // packages/safe-bash/src/commands/fmt.ts
5319
5319
  init_platform();
5320
- var OptionDiagnostic = class extends Error {
5321
- constructor(bytes3) {
5322
- super("invalid fmt option");
5323
- this.bytes = bytes3;
5324
- }
5325
- bytes;
5326
- };
5327
- function optionError(message3) {
5328
- throw new OptionDiagnostic(Uint8Array.from(`fmt: ${message3}
5329
- Try 'fmt --help' for more information.
5330
- `, (unit2) => unit2.charCodeAt(0)));
5331
- }
5332
- function widthValue(text3, maximum, unicode) {
5333
- let offset = 0;
5334
- while (text3.charCodeAt(offset) === 32 || text3.charCodeAt(offset) >= 9 && text3.charCodeAt(offset) <= 13) offset++;
5335
- if (text3[offset] === "+") offset++;
5336
- const start = offset;
5337
- let number6 = 0;
5338
- while (text3.charCodeAt(offset) >= 48 && text3.charCodeAt(offset) <= 57) {
5339
- number6 = Math.min(1073741824, number6 * 10 + text3.charCodeAt(offset++) - 48);
5340
- }
5341
- if (offset === start || offset !== text3.length || number6 > maximum) {
5342
- const range3 = offset === text3.length && offset !== start && number6 > maximum;
5343
- throw new PublicDiagnostic(`invalid width: ${quote(Uint8Array.from(text3, (unit2) => unit2.charCodeAt(0)), false, unicode)}${range3 ? number6 > 1073741823 ? ": Value too large for defined data type" : ": Numerical result out of range" : ""}`);
5344
- }
5345
- return number6;
5346
- }
5347
- function parse3(context2) {
5348
- const settings17 = { width: 75, goal: 70, crown: false, tagged: false, split: false, uniform: false, prefix: new Uint8Array(), leading: 0, fullPrefix: 0, files: [] };
5349
- let width;
5350
- let goal;
5351
- let stopped = false;
5352
- const long = { "crown-margin": "c", prefix: "p", "split-only": "s", "tagged-paragraph": "t", "uniform-spacing": "u", width: "w", goal: "g", help: "help", version: "version" };
5353
- let size = 0;
5354
- for (const argument2 of context2.args) {
5355
- size += argument2.length;
5356
- if (size > 65536 || context2.args.length > 4096) throw new PublicDiagnostic("argument limit exceeded");
5357
- }
5358
- const argumentsWithBytes = (0, contracts_exports.getCommandArguments)(context2);
5359
- size = 0;
5360
- const args = context2.args.map((_argument, position) => {
5361
- const bytes3 = argumentsWithBytes.bytes(position);
5362
- size += bytes3.length;
5363
- if (size > 65536) throw new PublicDiagnostic("argument limit exceeded");
5364
- return Array.from(bytes3, (byte) => String.fromCharCode(byte)).join("");
5365
- });
5366
- let index = 0;
5367
- const first = args[0];
5368
- if (first?.startsWith("-") && first.charCodeAt(1) >= 48 && first.charCodeAt(1) <= 57) {
5369
- width = first.slice(1);
5370
- index++;
5371
- }
5372
- for (; index < args.length; index++) {
5373
- const argument2 = args[index];
5374
- if (stopped || !argument2.startsWith("-") || argument2 === "-") {
5375
- settings17.files.push({ name: context2.args[index], bytes: argumentsWithBytes.bytes(index) });
5376
- if (context2.env.POSIXLY_CORRECT !== void 0) stopped = true;
5377
- continue;
5378
- }
5379
- if (argument2 === "--") {
5380
- stopped = true;
5381
- continue;
5382
- }
5383
- const expanded = [];
5384
- if (argument2.startsWith("--")) {
5385
- const equals = argument2.indexOf("=");
5386
- const name2 = argument2.slice(2, equals < 0 ? void 0 : equals);
5387
- const matches2 = Object.keys(long).filter((key2) => key2.startsWith(name2));
5388
- const selected = Object.hasOwn(long, name2) ? name2 : matches2.length === 1 ? matches2[0] : void 0;
5389
- if (!selected) {
5390
- if (matches2.length > 1) optionError(`option '${argument2}' is ambiguous; possibilities: ${matches2.map((key2) => `'--${key2}'`).join(" ")}`);
5391
- optionError(`unrecognized option '${argument2}'`);
5392
- }
5393
- const key = long[selected];
5394
- let value2;
5395
- let position = index;
5396
- if ("pwg".includes(key)) {
5397
- value2 = equals < 0 ? args[++index] : argument2.slice(equals + 1);
5398
- position = index;
5399
- if (value2 === void 0) optionError(`option '--${selected}' requires an argument`);
5400
- } else if (equals >= 0) optionError(`option '--${selected}' doesn't allow an argument`);
5401
- expanded.push({ key, ...value2 === void 0 ? {} : { value: value2 }, position, valueOffset: equals < 0 ? 0 : equals + 1 });
5402
- } else {
5403
- for (let offset = 1; offset < argument2.length; offset++) {
5404
- const key = argument2[offset];
5405
- if (key >= "0" && key <= "9") optionError(`invalid option -- ${key}; -WIDTH is recognized only when it is the first
5406
- option; use -w N instead`);
5407
- if (!"cstuwpg".includes(key)) optionError(`invalid option -- '${key}'`);
5408
- let value2;
5409
- let valueOffset = 0;
5410
- if ("pwg".includes(key)) {
5411
- if (offset + 1 < argument2.length) valueOffset = offset + 1;
5412
- value2 = argument2.slice(offset + 1) || args[++index];
5413
- if (value2 === void 0) optionError(`option requires an argument -- '${key}'`);
5414
- offset = argument2.length;
5415
- }
5416
- expanded.push({ key, ...value2 === void 0 ? {} : { value: value2 }, position: index, valueOffset });
5417
- }
5418
- }
5419
- for (const option of expanded) {
5420
- switch (option.key) {
5421
- case "c":
5422
- settings17.crown = true;
5423
- break;
5424
- case "t":
5425
- settings17.tagged = true;
5426
- break;
5427
- case "s":
5428
- settings17.split = true;
5429
- break;
5430
- case "u":
5431
- settings17.uniform = true;
5432
- break;
5433
- case "w":
5434
- width = option.value;
5435
- break;
5436
- case "g":
5437
- goal = option.value;
5438
- break;
5439
- case "help":
5440
- case "version":
5441
- settings17.information = option.key;
5442
- return settings17;
5443
- case "p": {
5444
- const bytes3 = argumentsWithBytes.bytes(option.position).subarray(option.valueOffset);
5445
- let start = 0;
5446
- let end = bytes3.indexOf(0);
5447
- if (end < 0) end = bytes3.length;
5448
- while (start < end && bytes3[start] === 32) start++;
5449
- settings17.leading = start;
5450
- settings17.fullPrefix = end - start;
5451
- while (end > start && bytes3[end - 1] === 32) end--;
5452
- settings17.prefix = new Uint8Array(bytes3.subarray(start, end));
5453
- break;
5454
- }
5455
- }
5456
- }
5457
- }
5458
- const unicode = unicodeLocale(context2);
5459
- if (width !== void 0) settings17.width = widthValue(width, 2500, unicode);
5460
- if (goal !== void 0) {
5461
- settings17.goal = widthValue(goal, settings17.width, unicode);
5462
- if (width === void 0) settings17.width = settings17.goal + 10;
5463
- } else settings17.goal = Math.trunc(settings17.width * 187 / 200);
5464
- if (!settings17.files.length) settings17.files.push({ name: "-", bytes: Uint8Array.of(45) });
5465
- return settings17;
5466
- }
5467
- var WorkBudget = class {
5468
- operations = 0;
5469
- output = 0;
5470
- *step() {
5471
- if (++this.operations > 128 * 1024 * 1024) throw new PublicDiagnostic("work limit exceeded");
5472
- if (this.operations % 4096 === 0) yield void 0;
5473
- }
5474
- };
5475
- var Formatter = class {
5476
- constructor(settings17, budget) {
5477
- this.settings = settings17;
5478
- this.budget = budget;
5479
- }
5480
- settings;
5481
- budget;
5482
- chunk = new Uint8Array();
5483
- offset = 0;
5484
- eof = false;
5485
- pending = [];
5486
- text = new Uint8Array(5e3);
5487
- used = 0;
5488
- words = [];
5489
- costs = [];
5490
- breaks = [];
5491
- lengths = [];
5492
- column = 0;
5493
- nextPrefix = 0;
5494
- prefixIndent = 0;
5495
- firstIndent = 0;
5496
- otherIndent = 0;
5497
- lastLength = 0;
5498
- outColumn = 0;
5499
- tabs = false;
5500
- *read() {
5501
- yield* this.budget.step();
5502
- while (this.offset === this.chunk.length) {
5503
- if (this.eof) return -1;
5504
- const incoming = yield "input";
5505
- if (incoming === null) {
5506
- this.eof = true;
5507
- return -1;
5508
- }
5509
- this.chunk = incoming;
5510
- this.offset = 0;
5511
- }
5512
- return this.chunk[this.offset++];
5513
- }
5514
- *emit(byte) {
5515
- if (++this.budget.output > bufferLimit) throw new PublicDiagnostic("output limit exceeded");
5516
- this.pending.push(byte);
5517
- if (this.pending.length === 16384) {
5518
- yield Uint8Array.from(this.pending);
5519
- this.pending = [];
5520
- }
5521
- }
5522
- *spaces(count2) {
5523
- const target = this.outColumn + count2;
5524
- const tabEnd = Math.trunc(target / 8) * 8;
5525
- if (this.tabs && this.outColumn + 1 < tabEnd) {
5526
- while (this.outColumn < tabEnd) {
5527
- yield* this.emit(9);
5528
- this.outColumn = (Math.trunc(this.outColumn / 8) + 1) * 8;
5529
- }
5530
- }
5531
- while (this.outColumn < target) {
5532
- yield* this.emit(32);
5533
- this.outColumn++;
5534
- }
5535
- }
5536
- *whitespace(byte) {
5537
- while (byte === 32 || byte === 9) {
5538
- if (byte === 32) this.column++;
5539
- else {
5540
- this.tabs = true;
5541
- this.column = (Math.trunc(this.column / 8) + 1) * 8;
5542
- }
5543
- byte = yield* this.read();
5544
- }
5545
- return byte;
5546
- }
5547
- *lineStart() {
5548
- this.column = 0;
5549
- let byte = yield* this.whitespace(yield* this.read());
5550
- const { prefix: prefix3, leading } = this.settings;
5551
- this.nextPrefix = prefix3.length ? this.column : Math.min(leading, this.column);
5552
- if (prefix3.length) {
5553
- for (const expected of prefix3) {
5554
- if (byte !== expected) return byte;
5555
- this.column++;
5556
- byte = yield* this.read();
5557
- }
5558
- byte = yield* this.whitespace(byte);
5559
- }
5560
- return byte;
5561
- }
5562
- compatible(byte) {
5563
- return byte !== -1 && byte !== 10 && this.nextPrefix === this.prefixIndent && this.column >= this.nextPrefix + this.settings.fullPrefix;
5564
- }
5565
- secondary(compatible) {
5566
- if (this.settings.split) this.otherIndent = this.firstIndent;
5567
- else if (this.settings.crown) this.otherIndent = compatible ? this.column : this.firstIndent;
5568
- else if (this.settings.tagged) {
5569
- if (compatible && this.column !== this.firstIndent) this.otherIndent = this.column;
5570
- else if (this.otherIndent === this.firstIndent) this.otherIndent = this.firstIndent === 0 ? 3 : 0;
5571
- } else this.otherIndent = this.firstIndent;
5572
- }
5573
- *optimize() {
5574
- const count2 = this.words.length;
5575
- this.costs[count2] = 0;
5576
- for (let start = count2 - 1; start >= 0; start--) {
5577
- const word = this.words[start];
5578
- let penalty = 4900;
5579
- const previous = this.words[start - 1];
5580
- if (previous?.period) penalty += previous.final ? -2500 : 36e4;
5581
- else if (previous?.punctuation) penalty -= 1600;
5582
- else if (previous && this.words[start - 2]?.final) penalty += Math.trunc(4e4 / (previous.length + 2));
5583
- if (word.opening) penalty -= 1600;
5584
- else if (word.final) penalty += Math.trunc(22500 / (word.length + 2));
5585
- let length = (start === 0 ? this.firstIndent : this.otherIndent) + word.length;
5586
- let best = Infinity;
5587
- for (let end = start + 1; ; end++) {
5588
- yield* this.budget.step();
5589
- let cost = this.costs[end];
5590
- if (end !== count2) {
5591
- cost += 100 * (this.settings.goal - length) ** 2;
5592
- if (this.breaks[end] !== count2) cost += 50 * (length - this.lengths[end]) ** 2;
5593
- }
5594
- if (start === 0 && this.lastLength > 0) cost += 50 * (length - this.lastLength) ** 2;
5595
- if (cost < best) {
5596
- best = cost;
5597
- this.breaks[start] = end;
5598
- this.lengths[start] = length;
5599
- }
5600
- if (end === count2) break;
5601
- length += this.words[end - 1].space + this.words[end].length;
5602
- if (length >= this.settings.width) break;
5603
- }
5604
- this.costs[start] = best + penalty;
5605
- }
5606
- }
5607
- *render(finish) {
5608
- for (let start = 0; start < finish; start = this.breaks[start]) {
5609
- this.outColumn = 0;
5610
- yield* this.spaces(this.prefixIndent);
5611
- for (const byte of this.settings.prefix) yield* this.emit(byte);
5612
- this.outColumn += this.settings.prefix.length;
5613
- yield* this.spaces((start === 0 ? this.firstIndent : this.otherIndent) - this.outColumn);
5614
- const end = this.breaks[start];
5615
- for (let index = start; index < end; index++) {
5616
- const word = this.words[index];
5617
- for (let position = word.start; position < word.start + word.length; position++) yield* this.emit(this.text[position]);
5618
- this.outColumn += word.length;
5619
- if (index + 1 !== end) yield* this.spaces(word.space);
5620
- }
5621
- this.lastLength = this.outColumn;
5622
- yield* this.emit(10);
5623
- }
5624
- }
5625
- *makeRoom(current) {
5626
- this.secondary(true);
5627
- if (!this.words.length) {
5628
- for (let position = 0; position < this.used; position++) yield* this.emit(this.text[position]);
5629
- this.used = 0;
5630
- current.start = 0;
5631
- return;
5632
- }
5633
- yield* this.optimize();
5634
- let cut = this.words.length;
5635
- let score = Infinity;
5636
- for (let line = this.breaks[0]; line !== this.words.length; line = this.breaks[line]) {
5637
- const candidate = this.costs[line] - this.costs[this.breaks[line]];
5638
- if (candidate < score) {
5639
- cut = line;
5640
- score = candidate;
5641
- }
5642
- score += 9;
5643
- }
5644
- yield* this.render(cut);
5645
- const offset = cut === this.words.length ? current.start : this.words[cut].start;
5646
- this.text.copyWithin(0, offset, this.used);
5647
- this.used -= offset;
5648
- this.words = this.words.slice(cut);
5649
- for (const word of this.words) word.start -= offset;
5650
- current.start -= offset;
5651
- }
5652
- *readLine(byte) {
5653
- do {
5654
- const word = { start: this.used, length: 0, space: 0, opening: false, period: false, punctuation: false, final: false };
5655
- do {
5656
- if (this.used === this.text.length) yield* this.makeRoom(word);
5657
- this.text[this.used++] = byte;
5658
- byte = yield* this.read();
5659
- } while (byte !== -1 && byte !== 32 && !(byte >= 9 && byte <= 13));
5660
- word.length = this.used - word.start;
5661
- this.column += word.length;
5662
- const first = this.text[word.start];
5663
- const last = this.text[this.used - 1];
5664
- word.opening = first === 0 || "(['`\"".includes(String.fromCharCode(first));
5665
- word.punctuation = last >= 33 && last <= 47 || last >= 58 && last <= 64 || last >= 91 && last <= 96 || last >= 123 && last <= 126;
5666
- let terminal = this.used - 1;
5667
- while (terminal > word.start && (this.text[terminal] === 0 || `)]'"`.includes(String.fromCharCode(this.text[terminal])))) terminal--;
5668
- word.period = this.text[terminal] === 0 || ".?!".includes(String.fromCharCode(this.text[terminal]));
5669
- const before = this.column;
5670
- byte = yield* this.whitespace(byte);
5671
- word.space = this.column - before;
5672
- word.final = byte === -1 || word.period && (byte === 10 || word.space > 1);
5673
- if (byte === 10 || byte === -1 || this.settings.uniform) word.space = word.final ? 2 : 1;
5674
- if (this.words.length === 998) yield* this.makeRoom(word);
5675
- this.words.push(word);
5676
- } while (byte !== -1 && byte !== 10);
5677
- return yield* this.lineStart();
5678
- }
5679
- *run() {
5680
- let byte = yield* this.lineStart();
5681
- while (true) {
5682
- if (byte === 10 || byte === -1 || this.nextPrefix < this.settings.leading || this.column < this.nextPrefix + this.settings.fullPrefix) {
5683
- this.outColumn = 0;
5684
- if (this.column > this.nextPrefix || byte !== 10 && byte !== -1) {
5685
- yield* this.spaces(this.nextPrefix);
5686
- for (const prefixByte of this.settings.prefix) {
5687
- if (this.outColumn === this.column) break;
5688
- yield* this.emit(prefixByte);
5689
- this.outColumn++;
5690
- }
5691
- if (byte !== -1 && byte !== 10) yield* this.spaces(this.column - this.outColumn);
5692
- if (byte === -1 && this.column >= this.nextPrefix + this.settings.prefix.length) yield* this.emit(10);
5693
- }
5694
- while (byte !== -1 && byte !== 10) {
5695
- yield* this.emit(byte);
5696
- byte = yield* this.read();
5697
- }
5698
- if (byte === -1) break;
5699
- yield* this.emit(10);
5700
- byte = yield* this.lineStart();
5701
- continue;
5702
- }
5703
- this.lastLength = 0;
5704
- this.prefixIndent = this.nextPrefix;
5705
- this.firstIndent = this.column;
5706
- this.words = [];
5707
- this.used = 0;
5708
- byte = yield* this.readLine(byte);
5709
- this.secondary(this.compatible(byte));
5710
- if (!this.settings.split) {
5711
- const acceptSecond = this.compatible(byte) && (this.settings.crown || this.settings.tagged ? this.settings.crown || this.column !== this.firstIndent : this.column === this.otherIndent);
5712
- if (acceptSecond) {
5713
- do {
5714
- byte = yield* this.readLine(byte);
5715
- } while (this.compatible(byte) && this.column === this.otherIndent);
5716
- }
5717
- }
5718
- const last = this.words[this.words.length - 1];
5719
- last.period = true;
5720
- last.final = true;
5721
- yield* this.optimize();
5722
- yield* this.render(this.words.length);
5723
- }
5724
- if (this.pending.length) {
5725
- yield Uint8Array.from(this.pending);
5726
- this.pending = [];
5727
- }
5728
- }
5729
- };
5730
- var InputScope = class {
5731
- constructor(context2, budget) {
5732
- this.context = context2;
5733
- this.budget = budget;
5734
- }
5735
- context;
5736
- budget;
5737
- iterator;
5738
- reader;
5739
- finished = false;
5740
- retirement;
5741
- closing;
5742
- acquisition;
5743
- async open(name2, bytes3) {
5744
- const { context: context2 } = this;
5745
- context2.signal.throwIfAborted();
5746
- let file;
5747
- if (name2 !== "-") {
5748
- const encoded2 = new TextEncoder().encode(name2);
5749
- if (encoded2.length !== bytes3.length || encoded2.some((byte, index) => byte !== bytes3[index])) throw new contracts_exports.FsError("ENOENT", { path: name2 });
5750
- const path = pathOf(context2, name2);
5751
- const capabilities = await context2.fs.capabilitiesFor?.(path, { signal: context2.signal }) ?? context2.fs.capabilities;
5752
- context2.signal.throwIfAborted();
5753
- file = { path, capabilities };
5754
- }
5755
- this.acquisition = Promise.resolve().then(() => {
5756
- context2.signal.throwIfAborted();
5757
- let source2 = context2.stdin;
5758
- if (file) {
5759
- const { path, capabilities } = file;
5760
- (0, command_requirements_exports.assertCommandRequirements)(context2, inputRequirements, ["file"], capabilities);
5761
- if (context2.fs.readStream && capabilities.streamingRead !== false) source2 = context2.fs.readStream(path, { signal: context2.signal, chunkSize: 65536 });
5762
- else {
5763
- if (capabilities.read === false) throw new contracts_exports.FsError("ENOTSUP", { path, syscall: "readFile" });
5764
- source2 = { async *[Symbol.asyncIterator]() {
5765
- yield await context2.fs.readFile(path, { signal: context2.signal, maxBytes: bufferLimit });
5766
- } };
5767
- }
5768
- }
5769
- context2.signal.throwIfAborted();
5770
- this.iterator = source2[Symbol.asyncIterator]();
5771
- this.reader = this.budget.read({ [Symbol.asyncIterator]: () => ({
5772
- next: async () => {
5773
- const item = await this.iterator.next();
5774
- if (item.done) this.finished = true;
5775
- return item;
5776
- },
5777
- return: async () => {
5778
- await this.retire();
5779
- return { done: true, value: void 0 };
5780
- }
5781
- }) }, context2.signal)[Symbol.asyncIterator]();
5782
- });
5783
- return this.acquisition;
5784
- }
5785
- async next() {
5786
- const item = await this.reader.next();
5787
- return item.done ? null : new Uint8Array(item.value);
5788
- }
5789
- retire() {
5790
- this.retirement ??= Promise.resolve().then(async () => {
5791
- if (!this.finished) await this.iterator?.return?.();
5792
- });
5793
- return this.retirement;
5794
- }
5795
- close() {
5796
- this.closing ??= (async () => {
5797
- await this.acquisition?.catch(() => void 0);
5798
- const results = await Promise.allSettled([this.retire(), this.reader?.return?.()]);
5799
- for (const result of results) if (result.status === "rejected") throw result.reason;
5800
- })();
5801
- return this.closing;
5802
- }
5803
- };
5804
- var glibc231PrintableRanges = [
5805
- 32,
5806
- 126,
5807
- 160,
5808
- 887,
5809
- 890,
5810
- 895,
5811
- 900,
5812
- 906,
5813
- 908,
5814
- 908,
5815
- 910,
5816
- 929,
5817
- 931,
5818
- 1327,
5819
- 1329,
5820
- 1366,
5821
- 1369,
5822
- 1375,
5823
- 1377,
5824
- 1415,
5825
- 1417,
5826
- 1418,
5827
- 1421,
5828
- 1423,
5829
- 1425,
5830
- 1479,
5831
- 1488,
5832
- 1514,
5833
- 1520,
5834
- 1524,
5835
- 1536,
5836
- 1564,
5837
- 1566,
5838
- 1805,
5839
- 1807,
5840
- 1866,
5841
- 1869,
5842
- 1969,
5843
- 1984,
5844
- 2042,
5845
- 2048,
5846
- 2093,
5847
- 2096,
5848
- 2110,
5849
- 2112,
5850
- 2139,
5851
- 2142,
5852
- 2142,
5853
- 2208,
5854
- 2228,
5855
- 2230,
5856
- 2237,
5857
- 2260,
5858
- 2435,
5859
- 2437,
5860
- 2444,
5861
- 2447,
5862
- 2448,
5863
- 2451,
5864
- 2472,
5865
- 2474,
5866
- 2480,
5867
- 2482,
5868
- 2482,
5869
- 2486,
5870
- 2489,
5871
- 2492,
5872
- 2500,
5873
- 2503,
5874
- 2504,
5875
- 2507,
5876
- 2510,
5877
- 2519,
5878
- 2519,
5879
- 2524,
5880
- 2525,
5881
- 2527,
5882
- 2531,
5883
- 2534,
5884
- 2555,
5885
- 2561,
5886
- 2563,
5887
- 2565,
5888
- 2570,
5889
- 2575,
5890
- 2576,
5891
- 2579,
5892
- 2600,
5893
- 2602,
5894
- 2608,
5895
- 2610,
5896
- 2611,
5897
- 2613,
5898
- 2614,
5899
- 2616,
5900
- 2617,
5901
- 2620,
5902
- 2620,
5903
- 2622,
5904
- 2626,
5905
- 2631,
5906
- 2632,
5907
- 2635,
5908
- 2637,
5909
- 2641,
5910
- 2641,
5911
- 2649,
5912
- 2652,
5913
- 2654,
5914
- 2654,
5915
- 2662,
5916
- 2677,
5917
- 2689,
5918
- 2691,
5919
- 2693,
5920
- 2701,
5921
- 2703,
5922
- 2705,
5923
- 2707,
5924
- 2728,
5925
- 2730,
5926
- 2736,
5927
- 2738,
5928
- 2739,
5929
- 2741,
5930
- 2745,
5931
- 2748,
5932
- 2757,
5933
- 2759,
5934
- 2761,
5935
- 2763,
5936
- 2765,
5937
- 2768,
5938
- 2768,
5939
- 2784,
5940
- 2787,
5941
- 2790,
5942
- 2801,
5943
- 2809,
5944
- 2809,
5945
- 2817,
5946
- 2819,
5947
- 2821,
5948
- 2828,
5949
- 2831,
5950
- 2832,
5951
- 2835,
5952
- 2856,
5953
- 2858,
5954
- 2864,
5955
- 2866,
5956
- 2867,
5957
- 2869,
5958
- 2873,
5959
- 2876,
5960
- 2884,
5961
- 2887,
5962
- 2888,
5963
- 2891,
5964
- 2893,
5965
- 2902,
5966
- 2903,
5967
- 2908,
5968
- 2909,
5969
- 2911,
5970
- 2915,
5971
- 2918,
5972
- 2935,
5973
- 2946,
5974
- 2947,
5975
- 2949,
5976
- 2954,
5977
- 2958,
5978
- 2960,
5979
- 2962,
5980
- 2965,
5981
- 2969,
5982
- 2970,
5983
- 2972,
5984
- 2972,
5985
- 2974,
5986
- 2975,
5987
- 2979,
5988
- 2980,
5989
- 2984,
5990
- 2986,
5991
- 2990,
5992
- 3001,
5993
- 3006,
5994
- 3010,
5995
- 3014,
5996
- 3016,
5997
- 3018,
5998
- 3021,
5999
- 3024,
6000
- 3024,
6001
- 3031,
6002
- 3031,
6003
- 3046,
6004
- 3066,
6005
- 3072,
6006
- 3075,
6007
- 3077,
6008
- 3084,
6009
- 3086,
6010
- 3088,
6011
- 3090,
6012
- 3112,
6013
- 3114,
6014
- 3129,
6015
- 3133,
6016
- 3140,
6017
- 3142,
6018
- 3144,
6019
- 3146,
6020
- 3149,
6021
- 3157,
6022
- 3158,
6023
- 3160,
6024
- 3162,
6025
- 3168,
6026
- 3171,
6027
- 3174,
6028
- 3183,
6029
- 3192,
6030
- 3203,
6031
- 3205,
6032
- 3212,
6033
- 3214,
6034
- 3216,
6035
- 3218,
6036
- 3240,
6037
- 3242,
6038
- 3251,
6039
- 3253,
6040
- 3257,
6041
- 3260,
6042
- 3268,
6043
- 3270,
6044
- 3272,
6045
- 3274,
6046
- 3277,
6047
- 3285,
6048
- 3286,
6049
- 3294,
6050
- 3294,
6051
- 3296,
6052
- 3299,
6053
- 3302,
6054
- 3311,
6055
- 3313,
6056
- 3314,
6057
- 3329,
6058
- 3331,
6059
- 3333,
6060
- 3340,
6061
- 3342,
6062
- 3344,
6063
- 3346,
6064
- 3386,
6065
- 3389,
6066
- 3396,
6067
- 3398,
6068
- 3400,
6069
- 3402,
6070
- 3407,
6071
- 3412,
6072
- 3427,
6073
- 3430,
6074
- 3455,
6075
- 3458,
6076
- 3459,
6077
- 3461,
6078
- 3478,
6079
- 3482,
6080
- 3505,
6081
- 3507,
6082
- 3515,
6083
- 3517,
6084
- 3517,
6085
- 3520,
6086
- 3526,
6087
- 3530,
6088
- 3530,
6089
- 3535,
6090
- 3540,
6091
- 3542,
6092
- 3542,
6093
- 3544,
6094
- 3551,
6095
- 3558,
6096
- 3567,
6097
- 3570,
6098
- 3572,
6099
- 3585,
6100
- 3642,
6101
- 3647,
6102
- 3675,
6103
- 3713,
6104
- 3714,
6105
- 3716,
6106
- 3716,
6107
- 3719,
6108
- 3720,
6109
- 3722,
6110
- 3722,
6111
- 3725,
6112
- 3725,
6113
- 3732,
6114
- 3735,
6115
- 3737,
6116
- 3743,
6117
- 3745,
6118
- 3747,
6119
- 3749,
6120
- 3749,
6121
- 3751,
6122
- 3751,
6123
- 3754,
6124
- 3755,
6125
- 3757,
6126
- 3769,
6127
- 3771,
6128
- 3773,
6129
- 3776,
6130
- 3780,
6131
- 3782,
6132
- 3782,
6133
- 3784,
6134
- 3789,
6135
- 3792,
6136
- 3801,
6137
- 3804,
6138
- 3807,
6139
- 3840,
6140
- 3911,
6141
- 3913,
6142
- 3948,
6143
- 3953,
6144
- 3991,
6145
- 3993,
6146
- 4028,
6147
- 4030,
6148
- 4044,
6149
- 4046,
6150
- 4058,
6151
- 4096,
6152
- 4293,
6153
- 4295,
6154
- 4295,
6155
- 4301,
6156
- 4301,
6157
- 4304,
6158
- 4680,
6159
- 4682,
6160
- 4685,
6161
- 4688,
6162
- 4694,
6163
- 4696,
6164
- 4696,
6165
- 4698,
6166
- 4701,
6167
- 4704,
6168
- 4744,
6169
- 4746,
6170
- 4749,
6171
- 4752,
6172
- 4784,
6173
- 4786,
6174
- 4789,
6175
- 4792,
6176
- 4798,
6177
- 4800,
6178
- 4800,
6179
- 4802,
6180
- 4805,
6181
- 4808,
6182
- 4822,
6183
- 4824,
6184
- 4880,
6185
- 4882,
6186
- 4885,
6187
- 4888,
6188
- 4954,
6189
- 4957,
6190
- 4988,
6191
- 4992,
6192
- 5017,
6193
- 5024,
6194
- 5109,
6195
- 5112,
6196
- 5117,
6197
- 5120,
6198
- 5788,
6199
- 5792,
6200
- 5880,
6201
- 5888,
6202
- 5900,
6203
- 5902,
6204
- 5908,
6205
- 5920,
6206
- 5942,
6207
- 5952,
6208
- 5971,
6209
- 5984,
6210
- 5996,
6211
- 5998,
6212
- 6e3,
6213
- 6002,
6214
- 6003,
6215
- 6016,
6216
- 6109,
6217
- 6112,
6218
- 6121,
6219
- 6128,
6220
- 6137,
6221
- 6144,
6222
- 6158,
6223
- 6160,
6224
- 6169,
6225
- 6176,
6226
- 6263,
6227
- 6272,
6228
- 6314,
6229
- 6320,
6230
- 6389,
6231
- 6400,
6232
- 6430,
6233
- 6432,
6234
- 6443,
6235
- 6448,
6236
- 6459,
6237
- 6464,
6238
- 6464,
6239
- 6468,
6240
- 6509,
6241
- 6512,
6242
- 6516,
6243
- 6528,
6244
- 6571,
6245
- 6576,
6246
- 6601,
6247
- 6608,
6248
- 6618,
6249
- 6622,
6250
- 6683,
6251
- 6686,
6252
- 6750,
6253
- 6752,
6254
- 6780,
6255
- 6783,
6256
- 6793,
6257
- 6800,
6258
- 6809,
6259
- 6816,
6260
- 6829,
6261
- 6832,
6262
- 6846,
6263
- 6912,
6264
- 6987,
6265
- 6992,
6266
- 7036,
6267
- 7040,
6268
- 7155,
6269
- 7164,
6270
- 7223,
6271
- 7227,
6272
- 7241,
6273
- 7245,
6274
- 7304,
6275
- 7360,
6276
- 7367,
6277
- 7376,
6278
- 7414,
6279
- 7416,
6280
- 7417,
6281
- 7424,
6282
- 7669,
6283
- 7675,
6284
- 7957,
6285
- 7960,
6286
- 7965,
6287
- 7968,
6288
- 8005,
6289
- 8008,
6290
- 8013,
6291
- 8016,
6292
- 8023,
6293
- 8025,
6294
- 8025,
6295
- 8027,
6296
- 8027,
6297
- 8029,
6298
- 8029,
6299
- 8031,
6300
- 8061,
6301
- 8064,
6302
- 8116,
6303
- 8118,
6304
- 8132,
6305
- 8134,
6306
- 8147,
6307
- 8150,
6308
- 8155,
6309
- 8157,
6310
- 8175,
6311
- 8178,
6312
- 8180,
6313
- 8182,
6314
- 8190,
6315
- 8192,
6316
- 8231,
6317
- 8234,
6318
- 8292,
6319
- 8294,
6320
- 8305,
6321
- 8308,
6322
- 8334,
6323
- 8336,
6324
- 8348,
6325
- 8352,
6326
- 8382,
6327
- 8400,
6328
- 8432,
6329
- 8448,
6330
- 8587,
6331
- 8592,
6332
- 9214,
6333
- 9216,
6334
- 9254,
6335
- 9280,
6336
- 9290,
6337
- 9312,
6338
- 11123,
6339
- 11126,
6340
- 11157,
6341
- 11160,
6342
- 11193,
6343
- 11197,
6344
- 11208,
6345
- 11210,
6346
- 11217,
6347
- 11244,
6348
- 11247,
6349
- 11264,
6350
- 11310,
6351
- 11312,
6352
- 11358,
6353
- 11360,
6354
- 11507,
6355
- 11513,
6356
- 11557,
6357
- 11559,
6358
- 11559,
6359
- 11565,
6360
- 11565,
6361
- 11568,
6362
- 11623,
6363
- 11631,
6364
- 11632,
6365
- 11647,
6366
- 11670,
6367
- 11680,
6368
- 11686,
6369
- 11688,
6370
- 11694,
6371
- 11696,
6372
- 11702,
6373
- 11704,
6374
- 11710,
6375
- 11712,
6376
- 11718,
6377
- 11720,
6378
- 11726,
6379
- 11728,
6380
- 11734,
6381
- 11736,
6382
- 11742,
6383
- 11744,
6384
- 11844,
6385
- 11904,
6386
- 11929,
6387
- 11931,
6388
- 12019,
6389
- 12032,
6390
- 12245,
6391
- 12272,
6392
- 12283,
6393
- 12288,
6394
- 12351,
6395
- 12353,
6396
- 12438,
6397
- 12441,
6398
- 12543,
6399
- 12549,
6400
- 12589,
6401
- 12593,
6402
- 12686,
6403
- 12688,
6404
- 12730,
6405
- 12736,
6406
- 12771,
6407
- 12784,
6408
- 12830,
6409
- 12832,
6410
- 13054,
6411
- 13056,
6412
- 19893,
6413
- 19904,
6414
- 40917,
6415
- 40960,
6416
- 42124,
6417
- 42128,
6418
- 42182,
6419
- 42192,
6420
- 42539,
6421
- 42560,
6422
- 42743,
6423
- 42752,
6424
- 42926,
6425
- 42928,
6426
- 42935,
6427
- 42999,
6428
- 43051,
6429
- 43056,
6430
- 43065,
6431
- 43072,
6432
- 43127,
6433
- 43136,
6434
- 43205,
6435
- 43214,
6436
- 43225,
6437
- 43232,
6438
- 43261,
6439
- 43264,
6440
- 43347,
6441
- 43359,
6442
- 43388,
6443
- 43392,
6444
- 43469,
6445
- 43471,
6446
- 43481,
6447
- 43486,
6448
- 43518,
6449
- 43520,
6450
- 43574,
6451
- 43584,
6452
- 43597,
6453
- 43600,
6454
- 43609,
6455
- 43612,
6456
- 43714,
6457
- 43739,
6458
- 43766,
6459
- 43777,
6460
- 43782,
6461
- 43785,
6462
- 43790,
6463
- 43793,
6464
- 43798,
6465
- 43808,
6466
- 43814,
6467
- 43816,
6468
- 43822,
6469
- 43824,
6470
- 43877,
6471
- 43888,
6472
- 44013,
6473
- 44016,
6474
- 44025,
6475
- 44032,
6476
- 55203,
6477
- 55216,
6478
- 55238,
6479
- 55243,
6480
- 55291,
6481
- 57344,
6482
- 64109,
6483
- 64112,
6484
- 64217,
6485
- 64256,
6486
- 64262,
6487
- 64275,
6488
- 64279,
6489
- 64285,
6490
- 64310,
6491
- 64312,
6492
- 64316,
6493
- 64318,
6494
- 64318,
6495
- 64320,
6496
- 64321,
6497
- 64323,
6498
- 64324,
6499
- 64326,
6500
- 64449,
6501
- 64467,
6502
- 64831,
6503
- 64848,
6504
- 64911,
6505
- 64914,
6506
- 64967,
6507
- 65008,
6508
- 65021,
6509
- 65024,
6510
- 65049,
6511
- 65056,
6512
- 65106,
6513
- 65108,
6514
- 65126,
6515
- 65128,
6516
- 65131,
6517
- 65136,
6518
- 65140,
6519
- 65142,
6520
- 65276,
6521
- 65279,
6522
- 65279,
6523
- 65281,
6524
- 65470,
6525
- 65474,
6526
- 65479,
6527
- 65482,
6528
- 65487,
6529
- 65490,
6530
- 65495,
6531
- 65498,
6532
- 65500,
6533
- 65504,
6534
- 65510,
6535
- 65512,
6536
- 65518,
6537
- 65529,
6538
- 65533,
6539
- 65536,
6540
- 65547,
6541
- 65549,
6542
- 65574,
6543
- 65576,
6544
- 65594,
6545
- 65596,
6546
- 65597,
6547
- 65599,
6548
- 65613,
6549
- 65616,
6550
- 65629,
6551
- 65664,
6552
- 65786,
6553
- 65792,
6554
- 65794,
6555
- 65799,
6556
- 65843,
6557
- 65847,
6558
- 65934,
6559
- 65936,
6560
- 65947,
6561
- 65952,
6562
- 65952,
6563
- 66e3,
6564
- 66045,
6565
- 66176,
6566
- 66204,
6567
- 66208,
6568
- 66256,
6569
- 66272,
6570
- 66299,
6571
- 66304,
6572
- 66339,
6573
- 66352,
6574
- 66378,
6575
- 66384,
6576
- 66426,
6577
- 66432,
6578
- 66461,
6579
- 66463,
6580
- 66499,
6581
- 66504,
6582
- 66517,
6583
- 66560,
6584
- 66717,
6585
- 66720,
6586
- 66729,
6587
- 66736,
6588
- 66771,
6589
- 66776,
6590
- 66811,
6591
- 66816,
6592
- 66855,
6593
- 66864,
6594
- 66915,
6595
- 66927,
6596
- 66927,
6597
- 67072,
6598
- 67382,
6599
- 67392,
6600
- 67413,
6601
- 67424,
6602
- 67431,
6603
- 67584,
6604
- 67589,
6605
- 67592,
6606
- 67592,
6607
- 67594,
6608
- 67637,
6609
- 67639,
6610
- 67640,
6611
- 67644,
6612
- 67644,
6613
- 67647,
6614
- 67669,
6615
- 67671,
6616
- 67742,
6617
- 67751,
6618
- 67759,
6619
- 67808,
6620
- 67826,
6621
- 67828,
6622
- 67829,
6623
- 67835,
6624
- 67867,
6625
- 67871,
6626
- 67897,
6627
- 67903,
6628
- 67903,
6629
- 67968,
6630
- 68023,
6631
- 68028,
6632
- 68047,
6633
- 68050,
6634
- 68099,
6635
- 68101,
6636
- 68102,
6637
- 68108,
6638
- 68115,
6639
- 68117,
6640
- 68119,
6641
- 68121,
6642
- 68147,
6643
- 68152,
6644
- 68154,
6645
- 68159,
6646
- 68167,
6647
- 68176,
6648
- 68184,
6649
- 68192,
6650
- 68255,
6651
- 68288,
6652
- 68326,
6653
- 68331,
6654
- 68342,
6655
- 68352,
6656
- 68405,
6657
- 68409,
6658
- 68437,
6659
- 68440,
6660
- 68466,
6661
- 68472,
6662
- 68497,
6663
- 68505,
6664
- 68508,
6665
- 68521,
6666
- 68527,
6667
- 68608,
6668
- 68680,
6669
- 68736,
6670
- 68786,
6671
- 68800,
6672
- 68850,
6673
- 68858,
6674
- 68863,
6675
- 69216,
6676
- 69246,
6677
- 69632,
6678
- 69709,
6679
- 69714,
6680
- 69743,
6681
- 69759,
6682
- 69825,
6683
- 69840,
6684
- 69864,
6685
- 69872,
6686
- 69881,
6687
- 69888,
6688
- 69940,
6689
- 69942,
6690
- 69955,
6691
- 69968,
6692
- 70006,
6693
- 70016,
6694
- 70093,
6695
- 70096,
6696
- 70111,
6697
- 70113,
6698
- 70132,
6699
- 70144,
6700
- 70161,
6701
- 70163,
6702
- 70206,
6703
- 70272,
6704
- 70278,
6705
- 70280,
6706
- 70280,
6707
- 70282,
6708
- 70285,
6709
- 70287,
6710
- 70301,
6711
- 70303,
6712
- 70313,
6713
- 70320,
6714
- 70378,
6715
- 70384,
6716
- 70393,
6717
- 70400,
6718
- 70403,
6719
- 70405,
6720
- 70412,
6721
- 70415,
6722
- 70416,
6723
- 70419,
6724
- 70440,
6725
- 70442,
6726
- 70448,
6727
- 70450,
6728
- 70451,
6729
- 70453,
6730
- 70457,
6731
- 70460,
6732
- 70468,
6733
- 70471,
6734
- 70472,
6735
- 70475,
6736
- 70477,
6737
- 70480,
6738
- 70480,
6739
- 70487,
6740
- 70487,
6741
- 70493,
6742
- 70499,
6743
- 70502,
6744
- 70508,
6745
- 70512,
6746
- 70516,
6747
- 70656,
6748
- 70745,
6749
- 70747,
6750
- 70747,
6751
- 70749,
6752
- 70749,
6753
- 70784,
6754
- 70855,
6755
- 70864,
6756
- 70873,
6757
- 71040,
6758
- 71093,
6759
- 71096,
6760
- 71133,
6761
- 71168,
6762
- 71236,
6763
- 71248,
6764
- 71257,
6765
- 71264,
6766
- 71276,
6767
- 71296,
6768
- 71351,
6769
- 71360,
6770
- 71369,
6771
- 71424,
6772
- 71449,
6773
- 71453,
6774
- 71467,
6775
- 71472,
6776
- 71487,
6777
- 71840,
6778
- 71922,
6779
- 71935,
6780
- 71935,
6781
- 72384,
6782
- 72440,
6783
- 72704,
6784
- 72712,
6785
- 72714,
6786
- 72758,
6787
- 72760,
6788
- 72773,
6789
- 72784,
6790
- 72812,
6791
- 72816,
6792
- 72847,
6793
- 72850,
6794
- 72871,
6795
- 72873,
6796
- 72886,
6797
- 73728,
6798
- 74649,
6799
- 74752,
6800
- 74862,
6801
- 74864,
6802
- 74868,
6803
- 74880,
6804
- 75075,
6805
- 77824,
6806
- 78894,
6807
- 82944,
6808
- 83526,
6809
- 92160,
6810
- 92728,
6811
- 92736,
6812
- 92766,
6813
- 92768,
6814
- 92777,
6815
- 92782,
6816
- 92783,
6817
- 92880,
6818
- 92909,
6819
- 92912,
6820
- 92917,
6821
- 92928,
6822
- 92997,
6823
- 93008,
6824
- 93017,
6825
- 93019,
6826
- 93025,
6827
- 93027,
6828
- 93047,
6829
- 93053,
6830
- 93071,
6831
- 93952,
6832
- 94020,
6833
- 94032,
6834
- 94078,
6835
- 94095,
6836
- 94111,
6837
- 94176,
6838
- 94176,
6839
- 94208,
6840
- 100332,
6841
- 100352,
6842
- 101106,
6843
- 110592,
6844
- 110593,
6845
- 113664,
6846
- 113770,
6847
- 113776,
6848
- 113788,
6849
- 113792,
6850
- 113800,
6851
- 113808,
6852
- 113817,
6853
- 113820,
6854
- 113827,
6855
- 118784,
6856
- 119029,
6857
- 119040,
6858
- 119078,
6859
- 119081,
6860
- 119272,
6861
- 119296,
6862
- 119365,
6863
- 119552,
6864
- 119638,
6865
- 119648,
6866
- 119665,
6867
- 119808,
6868
- 119892,
6869
- 119894,
6870
- 119964,
6871
- 119966,
6872
- 119967,
6873
- 119970,
6874
- 119970,
6875
- 119973,
6876
- 119974,
6877
- 119977,
6878
- 119980,
6879
- 119982,
6880
- 119993,
6881
- 119995,
6882
- 119995,
6883
- 119997,
6884
- 120003,
6885
- 120005,
6886
- 120069,
6887
- 120071,
6888
- 120074,
6889
- 120077,
6890
- 120084,
6891
- 120086,
6892
- 120092,
6893
- 120094,
6894
- 120121,
6895
- 120123,
6896
- 120126,
6897
- 120128,
6898
- 120132,
6899
- 120134,
6900
- 120134,
6901
- 120138,
6902
- 120144,
6903
- 120146,
6904
- 120485,
6905
- 120488,
6906
- 120779,
6907
- 120782,
6908
- 121483,
6909
- 121499,
6910
- 121503,
6911
- 121505,
6912
- 121519,
6913
- 122880,
6914
- 122886,
6915
- 122888,
6916
- 122904,
6917
- 122907,
6918
- 122913,
6919
- 122915,
6920
- 122916,
6921
- 122918,
6922
- 122922,
6923
- 124928,
6924
- 125124,
6925
- 125127,
6926
- 125142,
6927
- 125184,
6928
- 125258,
6929
- 125264,
6930
- 125273,
6931
- 125278,
6932
- 125279,
6933
- 126464,
6934
- 126467,
6935
- 126469,
6936
- 126495,
6937
- 126497,
6938
- 126498,
6939
- 126500,
6940
- 126500,
6941
- 126503,
6942
- 126503,
6943
- 126505,
6944
- 126514,
6945
- 126516,
6946
- 126519,
6947
- 126521,
6948
- 126521,
6949
- 126523,
6950
- 126523,
6951
- 126530,
6952
- 126530,
6953
- 126535,
6954
- 126535,
6955
- 126537,
6956
- 126537,
6957
- 126539,
6958
- 126539,
6959
- 126541,
6960
- 126543,
6961
- 126545,
6962
- 126546,
6963
- 126548,
6964
- 126548,
6965
- 126551,
6966
- 126551,
6967
- 126553,
6968
- 126553,
6969
- 126555,
6970
- 126555,
6971
- 126557,
6972
- 126557,
6973
- 126559,
6974
- 126559,
6975
- 126561,
6976
- 126562,
6977
- 126564,
6978
- 126564,
6979
- 126567,
6980
- 126570,
6981
- 126572,
6982
- 126578,
6983
- 126580,
6984
- 126583,
6985
- 126585,
6986
- 126588,
6987
- 126590,
6988
- 126590,
6989
- 126592,
6990
- 126601,
6991
- 126603,
6992
- 126619,
6993
- 126625,
6994
- 126627,
6995
- 126629,
6996
- 126633,
6997
- 126635,
6998
- 126651,
6999
- 126704,
7000
- 126705,
7001
- 126976,
7002
- 127019,
7003
- 127024,
7004
- 127123,
7005
- 127136,
7006
- 127150,
7007
- 127153,
7008
- 127167,
7009
- 127169,
7010
- 127183,
7011
- 127185,
7012
- 127221,
7013
- 127232,
7014
- 127244,
7015
- 127248,
7016
- 127278,
7017
- 127280,
7018
- 127339,
7019
- 127344,
7020
- 127404,
7021
- 127462,
7022
- 127490,
7023
- 127504,
7024
- 127547,
7025
- 127552,
7026
- 127560,
7027
- 127568,
7028
- 127569,
7029
- 127744,
7030
- 128722,
7031
- 128736,
7032
- 128748,
7033
- 128752,
7034
- 128758,
7035
- 128768,
7036
- 128883,
7037
- 128896,
7038
- 128980,
7039
- 129024,
7040
- 129035,
7041
- 129040,
7042
- 129095,
7043
- 129104,
7044
- 129113,
7045
- 129120,
7046
- 129159,
7047
- 129168,
7048
- 129197,
7049
- 129296,
7050
- 129310,
7051
- 129312,
7052
- 129319,
7053
- 129328,
7054
- 129328,
7055
- 129331,
7056
- 129342,
7057
- 129344,
7058
- 129355,
7059
- 129360,
7060
- 129374,
7061
- 129408,
7062
- 129425,
7063
- 129472,
7064
- 129472,
7065
- 131072,
7066
- 173782,
7067
- 173824,
7068
- 177972,
7069
- 177984,
7070
- 178205,
7071
- 178208,
7072
- 183969,
7073
- 194560,
7074
- 195101,
7075
- 917505,
7076
- 917505,
7077
- 917536,
7078
- 917631,
7079
- 917760,
7080
- 917999,
7081
- 983040,
7082
- 1048573,
7083
- 1048576,
7084
- 1114109
7085
- ];
7086
- function unicodeLocale(context2) {
7087
- const locale = (context2.env.LC_ALL || context2.env.LC_CTYPE || context2.env.LANG || "C").toLowerCase();
7088
- return locale.endsWith("utf-8") || locale.endsWith("utf8");
7089
- }
7090
- function quote(bytes3, shell, unicode = false) {
7091
- const decoder2 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
7092
- const units = [];
7093
- for (let offset = 0; offset < bytes3.length; ) {
7094
- const first = bytes3[offset];
7095
- let length = 1;
7096
- let text3 = String.fromCharCode(first);
7097
- let valid = first < 128;
7098
- if (unicode && first >= 194 && first <= 244) {
7099
- const size = first < 224 ? 2 : first < 240 ? 3 : 4;
7100
- try {
7101
- text3 = decoder2.decode(bytes3.subarray(offset, offset + size));
7102
- length = size;
7103
- valid = true;
7104
- } catch {
7105
- valid = false;
7106
- }
7107
- }
7108
- units.push({ text: text3, bytes: bytes3.subarray(offset, offset + length), valid });
7109
- offset += length;
7110
- }
7111
- const escapes2 = { "\x07": "\\a", "\b": "\\b", " ": "\\t", "\n": "\\n", "\v": "\\v", "\f": "\\f", "\r": "\\r" };
7112
- const printable = (unit2) => {
7113
- if (!unit2.valid) return false;
7114
- const point = unit2.text.codePointAt(0);
7115
- if (point < 128) return point >= 32 && point < 127;
7116
- if (!unicode) return false;
7117
- let low = 0;
7118
- let high = glibc231PrintableRanges.length / 2;
7119
- while (low < high) {
7120
- const middle = Math.trunc((low + high) / 2);
7121
- if (point < glibc231PrintableRanges[middle * 2]) high = middle;
7122
- else if (point > glibc231PrintableRanges[middle * 2 + 1]) low = middle + 1;
7123
- else return true;
7124
- }
7125
- return false;
7126
- };
7127
- if (shell && bytes3.includes(39) && units.every(
7128
- (unit2, index) => printable(unit2) && !'!"$&()*;<=>?[^`|\\{}'.includes(unit2.text) && (index === 0 || !"#~".includes(unit2.text))
7129
- )) return `"${units.map((unit2) => unit2.text).join("")}"`;
7130
- const left = !shell && unicode ? "\u2018" : "'";
7131
- const right = !shell && unicode ? "\u2019" : "'";
7132
- let result = left;
7133
- let escaping = shell && bytes3.includes(39) && units.length > 0 && !printable(units[units.length - 1]);
7134
- for (const unit2 of units) {
7135
- if (shell && unit2.text === "'") {
7136
- result += "'\\''";
7137
- escaping = false;
7138
- } else if (!printable(unit2)) {
7139
- if (shell && !escaping) result += "'$'";
7140
- escaping = true;
7141
- result += escapes2[unit2.text] ?? Array.from(unit2.bytes, (byte) => `\\${byte.toString(8).padStart(3, "0")}`).join("");
7142
- } else {
7143
- if (shell && escaping) result += "''";
7144
- escaping = false;
7145
- if (!shell && (unit2.text === right || unit2.text === "\\")) result += "\\";
7146
- result += unit2.text;
7147
- }
7148
- }
7149
- return result + right;
7150
- }
7151
- function fileError(error, name2, bytes3, opening, context2) {
7152
- if (!(error instanceof contracts_exports.FsError)) return error;
7153
- const messages = { ENOENT: "No such file or directory", EACCES: "Permission denied", EISDIR: "Is a directory", ENOTDIR: "Not a directory", ELOOP: "Too many levels of symbolic links", EIO: "Input/output error", EBADF: "Bad file descriptor" };
7154
- const message3 = messages[error.code];
7155
- if (!message3) return error;
7156
- return new PublicDiagnostic(`${opening ? `cannot open ${quote(bytes3, true, unicodeLocale(context2))} for reading` : name2 === "-" ? "standard input" : name2}: ${message3}`);
7157
- }
7158
- function fmtCommand() {
7159
- return { name: "fmt", filesystemRequirements: inputRequirements, async execute(context2) {
7160
- context2.signal.throwIfAborted();
7161
- const controller = new AbortController();
7162
- const local = { ...context2, signal: AbortSignal.any([context2.signal, controller.signal]) };
7163
- let current;
7164
- let closing;
7165
- const close = () => {
7166
- if (!closing) {
7167
- controller.abort(new contracts_exports.FsError("EPIPE", { message: "fmt input closed" }));
7168
- closing = current?.close() ?? Promise.resolve();
7169
- }
7170
- return closing;
7171
- };
7172
- context2.registerCleanup?.(close);
7173
- let failed = false;
7174
- const run4 = async () => {
7175
- try {
7176
- const settings17 = parse3(context2);
7177
- if (settings17.information) {
7178
- await output(context2, settings17.information === "version" ? "fmt (virtual-bash)\n" : "Usage: fmt [-WIDTH] [OPTION]... [FILE]...\nReformat paragraphs; omitted FILE or '-' reads standard input.\n -c, --crown-margin preserve indentation of first two lines\n -t, --tagged-paragraph use distinct first and following margins\n -p, --prefix=STRING format only lines with this prefix\n -s, --split-only split lines without joining\n -u, --uniform-spacing one space between words, two after sentences\n -w, --width=WIDTH maximum width (default 75)\n -g, --goal=WIDTH preferred width (default 93% of width)\n --help display this help\n --version display virtual command identity\n");
7179
- return { exitCode: 0 };
7180
- }
7181
- const budget = new ByteInputBudget(bufferLimit);
7182
- const work = new WorkBudget();
7183
- let stdinDone = false;
7184
- let emptyChunks = 0;
7185
- let chunks = 0;
7186
- let exitCode = 0;
7187
- for (const { name: name2, bytes: nameBytes } of settings17.files) {
7188
- local.signal.throwIfAborted();
7189
- if (name2 === "-" && stdinDone) continue;
7190
- current = new InputScope(local, budget);
7191
- try {
7192
- await current.open(name2, nameBytes);
7193
- } catch (error) {
7194
- local.signal.throwIfAborted();
7195
- await diagnostic(context2, fileError(error, name2, nameBytes, true, context2));
7196
- await current.close();
7197
- exitCode = 1;
7198
- continue;
7199
- }
7200
- const machine = new Formatter(settings17, work).run();
7201
- let step = machine.next();
7202
- let readFailed = false;
7203
- let readError;
7204
- let received = false;
7205
- while (!step.done) {
7206
- local.signal.throwIfAborted();
7207
- if (step.value === "input") {
7208
- let bytes3 = null;
7209
- if (!readFailed) {
7210
- try {
7211
- bytes3 = await current.next();
7212
- if (bytes3?.length) received = true;
7213
- } catch (error) {
7214
- local.signal.throwIfAborted();
7215
- if ((0, contracts_exports.isFsError)(error, "EFBIG")) throw new PublicDiagnostic("byte command input limit exceeded");
7216
- readFailed = true;
7217
- readError = !received && name2 !== "-" && error instanceof contracts_exports.FsError && ["ENOENT", "EACCES", "ENOTDIR", "ELOOP"].includes(error.code) ? fileError(error, name2, nameBytes, true, context2) : error;
7218
- }
7219
- }
7220
- if (bytes3?.length === 0 && ++emptyChunks > 4096) throw new PublicDiagnostic("empty input chunk limit exceeded");
7221
- if (++chunks % 64 === 0) await yieldTurn(local.signal);
7222
- step = machine.next(bytes3);
7223
- } else {
7224
- if (step.value) await output(context2, step.value);
7225
- else await yieldTurn(local.signal);
7226
- step = machine.next();
7227
- }
7228
- }
7229
- try {
7230
- await current.close();
7231
- } catch (error) {
7232
- if (!readFailed) throw error;
7233
- }
7234
- current = void 0;
7235
- if (name2 === "-") stdinDone = true;
7236
- if (readFailed && !(0, contracts_exports.isFsError)(readError, "EISDIR") && !(0, contracts_exports.isFsError)(readError, "EIO") && !(0, contracts_exports.isFsError)(readError, "EBADF")) {
7237
- await diagnostic(context2, fileError(readError, name2, nameBytes, false, context2));
7238
- exitCode = 1;
7239
- }
7240
- }
7241
- return { exitCode };
7242
- } catch (error) {
7243
- failed = true;
7244
- context2.signal.throwIfAborted();
7245
- if (error instanceof OptionDiagnostic) await (0, contracts_exports.writeBytes)(context2.stderr, error.bytes, context2.signal);
7246
- else await diagnostic(context2, error);
7247
- return { exitCode: 1 };
7248
- }
7249
- };
7250
- let outcome;
7251
- try {
7252
- outcome = { result: await run4() };
7253
- } catch (error) {
7254
- outcome = { error };
7255
- }
7256
- try {
7257
- await close();
7258
- } catch (error) {
7259
- if (!failed) throw error;
7260
- }
7261
- if ("error" in outcome) throw outcome.error;
7262
- return outcome.result;
7263
- } };
7264
- }
5320
+ import { fmtCommand } from "../safe-bash-command-fmt/index.js";
7265
5321
 
7266
5322
  // packages/safe-bash/src/commands/shuf.ts
7267
5323
  init_platform();
7268
5324
  var maximumLines = 1024 * 1024;
7269
5325
  var reservoirThreshold = 8 * 1024 * 1024;
7270
5326
  var unsignedMaximum = (1n << 64n) - 1n;
7271
- var glibc231PrintableRanges2 = [
5327
+ var glibc231PrintableRanges = [
7272
5328
  32,
7273
5329
  126,
7274
5330
  160,
@@ -8559,11 +6615,11 @@ var ShufDiagnostic = class extends Error {
8559
6615
  detail;
8560
6616
  usage;
8561
6617
  };
8562
- function unicodeLocale2(context2) {
6618
+ function unicodeLocale(context2) {
8563
6619
  const locale = (context2.env.LC_ALL || context2.env.LC_CTYPE || context2.env.LANG || "C").toLowerCase();
8564
6620
  return locale.endsWith("utf-8") || locale.endsWith("utf8");
8565
6621
  }
8566
- function quote2(text3, filename = false, unicode = false) {
6622
+ function quote(text3, filename = false, unicode = false) {
8567
6623
  const controls2 = { "\x07": "\\a", "\b": "\\b", " ": "\\t", "\n": "\\n", "\v": "\\v", "\f": "\\f", "\r": "\\r" };
8568
6624
  const decoder2 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
8569
6625
  const units = [];
@@ -8584,11 +6640,11 @@ function quote2(text3, filename = false, unicode = false) {
8584
6640
  }
8585
6641
  let printable = valid && point >= 32 && point < 127;
8586
6642
  if (valid && point >= 128) {
8587
- let low = 0, high = glibc231PrintableRanges2.length / 2;
6643
+ let low = 0, high = glibc231PrintableRanges.length / 2;
8588
6644
  while (low < high) {
8589
6645
  const middle = Math.floor((low + high) / 2);
8590
- if (point < glibc231PrintableRanges2[middle * 2]) high = middle;
8591
- else if (point > glibc231PrintableRanges2[middle * 2 + 1]) low = middle + 1;
6646
+ if (point < glibc231PrintableRanges[middle * 2]) high = middle;
6647
+ else if (point > glibc231PrintableRanges[middle * 2 + 1]) low = middle + 1;
8592
6648
  else {
8593
6649
  printable = true;
8594
6650
  break;
@@ -8640,12 +6696,12 @@ function decimal(text3, count2, unicode) {
8640
6696
  offset++;
8641
6697
  }
8642
6698
  if (offset === start || !count2 && offset !== text3.length || !count2 && value2 > unsignedMaximum) {
8643
- throw new ShufDiagnostic(`invalid ${count2 ? "line count" : "input range"}: ${quote2(text3, false, unicode)}${!count2 && offset === text3.length && value2 > unsignedMaximum ? ": Value too large for defined data type" : ""}`);
6699
+ throw new ShufDiagnostic(`invalid ${count2 ? "line count" : "input range"}: ${quote(text3, false, unicode)}${!count2 && offset === text3.length && value2 > unsignedMaximum ? ": Value too large for defined data type" : ""}`);
8644
6700
  }
8645
6701
  return value2;
8646
6702
  }
8647
- function parse4(context2) {
8648
- const unicode = unicodeLocale2(context2);
6703
+ function parse3(context2) {
6704
+ const unicode = unicodeLocale(context2);
8649
6705
  if (context2.args.length > 4096) throw new PublicDiagnostic("argument limit exceeded");
8650
6706
  let total = 0;
8651
6707
  for (const argument2 of context2.args) {
@@ -8675,7 +6731,7 @@ function parse4(context2) {
8675
6731
  const low = dash < 0 ? unsignedMaximum : decimal(value2.slice(0, dash), false, unicode);
8676
6732
  const high = decimal(value2.slice(dash + 1), false, unicode);
8677
6733
  const length = high - low + 1n;
8678
- if (dash < 0 || length < 0n || length > unsignedMaximum) throw new ShufDiagnostic(`invalid input range: ${quote2(value2, false, unicode)}`);
6734
+ if (dash < 0 || length < 0n || length > unsignedMaximum) throw new ShufDiagnostic(`invalid input range: ${quote(value2, false, unicode)}`);
8679
6735
  settings17.range = { low, length };
8680
6736
  } else {
8681
6737
  const property = key === "o" ? "output" : "random";
@@ -8720,7 +6776,7 @@ function parse4(context2) {
8720
6776
  }
8721
6777
  if (settings17.echo && settings17.range) throw new ShufDiagnostic("cannot combine -e and -i options", true);
8722
6778
  const maximum = settings17.range ? 0 : settings17.echo ? Infinity : 1;
8723
- if (settings17.operands.length > maximum) throw new ShufDiagnostic(`extra operand ${quote2(settings17.operands[maximum], false, unicode)}`, true);
6779
+ if (settings17.operands.length > maximum) throw new ShufDiagnostic(`extra operand ${quote(settings17.operands[maximum], false, unicode)}`, true);
8724
6780
  return settings17;
8725
6781
  }
8726
6782
  function filePath(context2, name2) {
@@ -8781,7 +6837,7 @@ var Input = class {
8781
6837
  file = { path, capabilities, retained };
8782
6838
  } catch (error) {
8783
6839
  signal.throwIfAborted();
8784
- throw ioError(error, quote2(name2, true, unicodeLocale2(context2)));
6840
+ throw ioError(error, quote(name2, true, unicodeLocale(context2)));
8785
6841
  }
8786
6842
  }
8787
6843
  const pending = Promise.resolve().then(async () => {
@@ -8817,7 +6873,7 @@ var Input = class {
8817
6873
  }
8818
6874
  } catch (error) {
8819
6875
  signal.throwIfAborted();
8820
- throw ioError(error, quote2(name2, true, unicodeLocale2(context2)));
6876
+ throw ioError(error, quote(name2, true, unicodeLocale(context2)));
8821
6877
  }
8822
6878
  }
8823
6879
  signal.throwIfAborted();
@@ -8913,7 +6969,7 @@ var Random = class {
8913
6969
  if (this.offset === this.bytes.length) {
8914
6970
  if (this.input) {
8915
6971
  const bytes3 = await this.input.next();
8916
- if (!bytes3) throw new ShufDiagnostic(`${quote2(this.name, false, this.unicode)}: end of file`);
6972
+ if (!bytes3) throw new ShufDiagnostic(`${quote(this.name, false, this.unicode)}: end of file`);
8917
6973
  this.bytes = bytes3;
8918
6974
  } else {
8919
6975
  const state = this.state;
@@ -9013,8 +7069,8 @@ function shufCommand() {
9013
7069
  let failure = false;
9014
7070
  const run4 = async () => {
9015
7071
  try {
9016
- const unicode = unicodeLocale2(context2);
9017
- const settings17 = parse4(context2);
7072
+ const unicode = unicodeLocale(context2);
7073
+ const settings17 = parse3(context2);
9018
7074
  operation2 = settings17.output === void 0 || settings17.information ? root.child(context2.stdout) : root;
9019
7075
  const signal = operation2.signal;
9020
7076
  if (settings17.information) {
@@ -9042,7 +7098,7 @@ function shufCommand() {
9042
7098
  const needsRandom = reservoir || settings17.repeat || count2 > 0 && length > 1;
9043
7099
  let randomInput;
9044
7100
  if (settings17.random !== void 0 && needsRandom) {
9045
- randomInput = new Input(context2, operation2, new ByteInputBudget(bufferLimit), `${quote2(settings17.random, false, unicode)}: read error`);
7101
+ randomInput = new Input(context2, operation2, new ByteInputBudget(bufferLimit), `${quote(settings17.random, false, unicode)}: read error`);
9046
7102
  await randomInput.open(settings17.random);
9047
7103
  }
9048
7104
  const random = new Random(randomInput, settings17.random, signal, unicode, needsRandom);
@@ -9114,7 +7170,7 @@ function shufCommand() {
9114
7170
  });
9115
7171
  } catch (error) {
9116
7172
  signal.throwIfAborted();
9117
- throw ioError(error, quote2(name2, true, unicode));
7173
+ throw ioError(error, quote(name2, true, unicode));
9118
7174
  }
9119
7175
  }
9120
7176
  return { exitCode: 0 };
@@ -9144,7 +7200,7 @@ ${error.usage ? "Try 'shuf --help' for more information.\n" : ""}`, (character)
9144
7200
 
9145
7201
  // packages/safe-bash/src/commands/numfmt.ts
9146
7202
  init_platform();
9147
- var glibc231PrintableRanges3 = [
7203
+ var glibc231PrintableRanges2 = [
9148
7204
  32,
9149
7205
  126,
9150
7206
  160,
@@ -10677,7 +8733,7 @@ function utf8Size(text3) {
10677
8733
  return bytes3;
10678
8734
  }
10679
8735
  var utf8Decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
10680
- function quote3(text3, unicode) {
8736
+ function quote2(text3, unicode) {
10681
8737
  const right = unicode ? "\xE2\x80\x99" : "'";
10682
8738
  let result = unicode ? "\xE2\x80\x98" : "'";
10683
8739
  const escapes2 = { "\x07": "\\a", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t", "\v": "\\v" };
@@ -10702,12 +8758,12 @@ function quote3(text3, unicode) {
10702
8758
  }
10703
8759
  const point = decoded?.codePointAt(0) ?? -1;
10704
8760
  let low = 0;
10705
- let high = glibc231PrintableRanges3.length / 2;
8761
+ let high = glibc231PrintableRanges2.length / 2;
10706
8762
  let printable = false;
10707
8763
  while (low < high) {
10708
8764
  const middle = Math.trunc((low + high) / 2);
10709
- if (point < glibc231PrintableRanges3[middle * 2]) high = middle;
10710
- else if (point > glibc231PrintableRanges3[middle * 2 + 1]) low = middle + 1;
8765
+ if (point < glibc231PrintableRanges2[middle * 2]) high = middle;
8766
+ else if (point > glibc231PrintableRanges2[middle * 2 + 1]) low = middle + 1;
10711
8767
  else {
10712
8768
  printable = true;
10713
8769
  break;
@@ -10786,9 +8842,9 @@ function fields(text3, unicode) {
10786
8842
  if (value2 >= unsignedMaximum2) {
10787
8843
  let end = offset + 1;
10788
8844
  while (digit(text3[end])) end++;
10789
- throw new NumfmtDiagnostic(`field number ${quote3(text3.slice(digitsStart, end), unicode)} is too large`, 1, true);
8845
+ throw new NumfmtDiagnostic(`field number ${quote2(text3.slice(digitsStart, end), unicode)} is too large`, 1, true);
10790
8846
  }
10791
- } else throw new NumfmtDiagnostic(`invalid field value ${quote3(text3.slice(offset), unicode)}`, 1, true);
8847
+ } else throw new NumfmtDiagnostic(`invalid field value ${quote2(text3.slice(offset), unicode)}`, 1, true);
10792
8848
  }
10793
8849
  result.sort(([left2], [right2]) => Number(BigInt.asIntN(32, left2)) - Number(BigInt.asIntN(32, right2)));
10794
8850
  const merged = [];
@@ -10814,10 +8870,10 @@ function unit(text3, unicode) {
10814
8870
  valid &&= power2 > 0 && (tail.length === 1 || tail.length === 2 && tail[1] === "i");
10815
8871
  if (valid) value2 *= BigInt(tail.length === 2 ? 1024 : 1e3) ** BigInt(power2);
10816
8872
  }
10817
- if (!valid || parsed.overflow || value2 <= 0n || value2 > unsignedMaximum2) throw new NumfmtDiagnostic(`invalid unit size: ${quote3(text3, unicode)}`);
8873
+ if (!valid || parsed.overflow || value2 <= 0n || value2 > unsignedMaximum2) throw new NumfmtDiagnostic(`invalid unit size: ${quote2(text3, unicode)}`);
10818
8874
  return value2;
10819
8875
  }
10820
- function parse5(context2) {
8876
+ function parse4(context2) {
10821
8877
  const locale = context2.env.LC_ALL || context2.env.LC_MESSAGES || context2.env.LANG || "C";
10822
8878
  const numericLocale = context2.env.LC_ALL || context2.env.LC_NUMERIC || context2.env.LANG || "C";
10823
8879
  const settings17 = { from: "none", to: "none", fromUnit: 1n, toUnit: 1n, rounding: "from-zero", invalid: "abort", padding: 0n, left: false, zeroPadding: 0n, precision: void 0, grouping: false, delimiter: void 0, separator: "\n", suffix: "", header: 0n, fields: void 0, format: void 0, prefix: "", postfix: "", debug: false, developer: false, unicode: locale.toLowerCase().includes("utf"), thousands: numericLocale.toLowerCase().startsWith("en_us."), localeValid: ["c", "posix", "c.utf-8", "c.utf8", "en_us.utf8", "en_us.utf-8"].includes(locale.toLowerCase()), operands: [] };
@@ -10840,8 +8896,8 @@ function parse5(context2) {
10840
8896
  const matches2 = choices.filter((choice) => choice.startsWith(value2));
10841
8897
  if (choices.includes(value2)) return value2;
10842
8898
  if (matches2.length === 1) return matches2[0];
10843
- throw new NumfmtDiagnostic(`${matches2.length ? "ambiguous" : "invalid"} argument ${quote3(value2, settings17.unicode)} for ${quote3(`--${name2}`, settings17.unicode)}`, 1, true, `Valid arguments are:
10844
- ${choices.map((choice) => ` - ${quote3(choice, settings17.unicode)}
8899
+ throw new NumfmtDiagnostic(`${matches2.length ? "ambiguous" : "invalid"} argument ${quote2(value2, settings17.unicode)} for ${quote2(`--${name2}`, settings17.unicode)}`, 1, true, `Valid arguments are:
8900
+ ${choices.map((choice) => ` - ${quote2(choice, settings17.unicode)}
10845
8901
  `).join("")}`);
10846
8902
  };
10847
8903
  const apply = (name2, value2) => {
@@ -10853,7 +8909,7 @@ ${choices.map((choice) => ` - ${quote3(choice, settings17.unicode)}
10853
8909
  else if (name2 === "to-unit") settings17.toUnit = unit(value2, settings17.unicode);
10854
8910
  else if (name2 === "padding" || name2 === "header") {
10855
8911
  const parsed = decimal2(value2 ?? "1");
10856
- if (!parsed.found || parsed.end !== (value2 ?? "1").length || parsed.overflow || parsed.value === 0n || (name2 === "header" ? parsed.value < 0n : parsed.value > signedMaximum || parsed.value < -signedMaximum - 1n)) throw new NumfmtDiagnostic(`invalid ${name2} value ${quote3(value2, settings17.unicode)}`);
8912
+ if (!parsed.found || parsed.end !== (value2 ?? "1").length || parsed.overflow || parsed.value === 0n || (name2 === "header" ? parsed.value < 0n : parsed.value > signedMaximum || parsed.value < -signedMaximum - 1n)) throw new NumfmtDiagnostic(`invalid ${name2} value ${quote2(value2, settings17.unicode)}`);
10857
8913
  if (name2 === "header") settings17.header = parsed.value;
10858
8914
  else {
10859
8915
  if (parsed.value < 0n) settings17.left = true;
@@ -10948,7 +9004,7 @@ var Converter = class {
10948
9004
  }
10949
9005
  async parseFormat(text3) {
10950
9006
  const settings17 = this.settings;
10951
- const quoted2 = quote3(text3, settings17.unicode);
9007
+ const quoted2 = quote2(text3, settings17.unicode);
10952
9008
  let offset = 0;
10953
9009
  let prefix3 = 0;
10954
9010
  while (!(text3[offset] === "%" && text3[offset + 1] !== "%")) {
@@ -11000,16 +9056,16 @@ var Converter = class {
11000
9056
  grouping: ${settings17.grouping ? "yes" : "no"}
11001
9057
  padding width: ${settings17.padding}
11002
9058
  alignment: ${settings17.left ? "Left" : "Right"}
11003
- prefix: ${quote3(settings17.prefix, settings17.unicode)}
11004
- suffix: ${quote3(settings17.postfix, settings17.unicode)}
9059
+ prefix: ${quote2(settings17.prefix, settings17.unicode)}
9060
+ suffix: ${quote2(settings17.postfix, settings17.unicode)}
11005
9061
  `, true);
11006
9062
  }
11007
9063
  async number(text3, backing, start) {
11008
9064
  const settings17 = this.settings;
11009
- const quoted2 = quote3(text3, settings17.unicode);
9065
+ const quoted2 = quote2(text3, settings17.unicode);
11010
9066
  if (settings17.developer) await this.output.emit(`simple_strtod_human:
11011
9067
  input string: ${quoted2}
11012
- locale decimal-point: ${quote3(".", settings17.unicode)}
9068
+ locale decimal-point: ${quote2(".", settings17.unicode)}
11013
9069
  MAX_UNSCALED_DIGITS: 18
11014
9070
  `, true);
11015
9071
  let offset = 0;
@@ -11089,7 +9145,7 @@ var Converter = class {
11089
9145
  await this.tick((tailEnd - tailStart) % 4096);
11090
9146
  tail = byteText(backing.subarray(tailStart, tailEnd));
11091
9147
  }
11092
- if (tail) return this.failure(`invalid suffix in input ${quoted2}: ${quote3(tail, settings17.unicode)}`);
9148
+ if (tail) return this.failure(`invalid suffix in input ${quoted2}: ${quote2(tail, settings17.unicode)}`);
11093
9149
  if (loss && settings17.debug) await this.warning(`large input value ${quoted2}: possible precision loss`);
11094
9150
  if (settings17.fromUnit !== 1n || settings17.toUnit !== 1n) value2 = divide(multiply(value2, binary(settings17.fromUnit)), binary(settings17.toUnit));
11095
9151
  return { value: value2, precision };
@@ -11145,17 +9201,17 @@ var Converter = class {
11145
9201
  if (settings17.to !== "none") rendered += powerIndex ? "KMGTPEZY"[powerIndex - 1] ?? "(error)" : "";
11146
9202
  if (rendered.length >= (settings17.to === "none" ? 128 : 127)) throw new NumfmtDiagnostic(`failed to prepare value '${fixed(printedValue, 6)}' for printing`);
11147
9203
  if (settings17.to === "iec-i" && powerIndex) rendered += "i";
11148
- if (settings17.developer && settings17.to !== "none") await this.output.emit(` returning value: ${quote3(rendered, settings17.unicode)}
9204
+ if (settings17.developer && settings17.to !== "none") await this.output.emit(` returning value: ${quote2(rendered, settings17.unicode)}
11149
9205
  `, true);
11150
9206
  rendered += settings17.suffix.slice(0, 127 - rendered.length);
11151
9207
  if (settings17.developer) await this.output.emit(`formatting output:
11152
9208
  value: ${fixed(value2, 6)}
11153
- humanized: ${quote3(rendered, settings17.unicode)}
9209
+ humanized: ${quote2(rendered, settings17.unicode)}
11154
9210
  `, true);
11155
9211
  if (settings17.padding > BigInt(rendered.length)) {
11156
9212
  if (settings17.padding > BigInt(this.output.remaining - settings17.prefix.length - settings17.postfix.length)) throw new PublicDiagnostic("numfmt output limit exceeded");
11157
9213
  rendered = settings17.left ? rendered.padEnd(Number(settings17.padding)) : rendered.padStart(Number(settings17.padding));
11158
- if (settings17.developer) await this.output.emit(` After padding: ${quote3(rendered, settings17.unicode)}
9214
+ if (settings17.developer) await this.output.emit(` After padding: ${quote2(rendered, settings17.unicode)}
11159
9215
  `, true);
11160
9216
  }
11161
9217
  return rendered;
@@ -11183,7 +9239,7 @@ var Converter = class {
11183
9239
  if (text3.endsWith(settings17.suffix)) {
11184
9240
  text3 = text3.slice(0, -settings17.suffix.length);
11185
9241
  backing[start + text3.length] = 0;
11186
- if (settings17.developer) await this.output.emit(`trimming suffix ${quote3(settings17.suffix, settings17.unicode)}
9242
+ if (settings17.developer) await this.output.emit(`trimming suffix ${quote2(settings17.suffix, settings17.unicode)}
11187
9243
  `, true);
11188
9244
  } else if (settings17.developer) await this.output.emit("no valid suffix found\n", true);
11189
9245
  }
@@ -11249,7 +9305,7 @@ function numfmtCommand() {
11249
9305
  try {
11250
9306
  stdout = (0, output_exports.createOutputOperation)(local, context2.stdout);
11251
9307
  stderr = (0, output_exports.createOutputOperation)(local, context2.stderr);
11252
- const settings17 = parse5(context2);
9308
+ const settings17 = parse4(context2);
11253
9309
  const converter = new Converter(settings17, local, output2);
11254
9310
  if (settings17.information) {
11255
9311
  await output2.emit(settings17.information === "version" ? "numfmt (virtual-bash)\n" : helpText);
@@ -12116,7 +10172,7 @@ async function substitute(text3, pattern, replacement, budget, global, occurrenc
12116
10172
  }
12117
10173
 
12118
10174
  // packages/safe-bash/src/commands/text-programs/sed.ts
12119
- function parse6(source2, extended, separator, maxProgramInstructions) {
10175
+ function parse5(source2, extended, separator, maxProgramInstructions) {
12120
10176
  if (source2.length > 1024 * 1024) throw new ProgramError("sed program exceeds 1 MiB");
12121
10177
  const result = [];
12122
10178
  const groups = [];
@@ -12652,7 +10708,7 @@ function sedCommand(options2 = {}) {
12652
10708
  sources2.push(byteString(files.shift()));
12653
10709
  }
12654
10710
  if (sources2[0]?.startsWith("#n")) quiet = true;
12655
- const program = parse6(sources2.join("\n"), extended, separator, maxProgramInstructions);
10711
+ const program = parse5(sources2.join("\n"), extended, separator, maxProgramInstructions);
12656
10712
  const outputFiles = program.flatMap((instruction) => instruction.kind !== "r" && instruction.file !== void 0 ? [instruction.file] : []);
12657
10713
  await assertPathRequirements(context2, sedRequirements, ["script-output"], outputFiles);
12658
10714
  if (inPlace !== void 0 || outputFiles.length) {
@@ -14886,7 +12942,7 @@ function count(value2, flag) {
14886
12942
  if (!/^[0-9]+$/u.test(value2) || !Number.isSafeInteger(Number(value2))) throw new SearchError(`${flag} requires a nonnegative integer`);
14887
12943
  return Number(value2);
14888
12944
  }
14889
- function parse7(args) {
12945
+ function parse6(args) {
14890
12946
  const result = {
14891
12947
  patterns: [],
14892
12948
  patternFiles: [],
@@ -15809,7 +13865,7 @@ function createRgCommand(executor, options2 = {}) {
15809
13865
  let found = false;
15810
13866
  try {
15811
13867
  const limits = new Limits(context2, options2);
15812
- args = parse7(context2.args);
13868
+ args = parse6(context2.args);
15813
13869
  if (args.mode !== "files" && args.patternFiles.includes("-") && args.paths.includes("-")) {
15814
13870
  throw new SearchError("cannot search stdin while also reading patterns from stdin");
15815
13871
  }
@@ -16005,9 +14061,9 @@ init_platform();
16005
14061
  // packages/safe-bash/src/commands/bytes/encoding/shared.ts
16006
14062
  init_platform();
16007
14063
  var blockSize = 8192;
16008
- function validatedOption(parsed, key, parse19, fallback) {
14064
+ function validatedOption(parsed, key, parse18, fallback) {
16009
14065
  let result = fallback;
16010
- for (const text3 of parsed.values.get(key) ?? []) result = parse19(text3);
14066
+ for (const text3 of parsed.values.get(key) ?? []) result = parse18(text3);
16011
14067
  return result;
16012
14068
  }
16013
14069
  async function* sources(context2, operands, maxInputBytes) {
@@ -16620,7 +14676,7 @@ function parseCksum(args) {
16620
14676
  if (!["crc", "md5", "sha1", "sha224", "sha256", "sha384", "sha512"].includes(algorithm)) throw new UsageError(`unsupported checksum algorithm '${algorithm}'`);
16621
14677
  return { algorithm, settings: { operands: parsed.operands, binary: false, check: false, zero: parsed.flags.has("z"), tag: true, strict: false, ignoreMissing: false, report: "normal" } };
16622
14678
  }
16623
- function parse8(args, algorithm) {
14679
+ function parse7(args, algorithm) {
16624
14680
  const settings17 = { operands: [], binary: false, check: false, zero: false, tag: false, strict: false, ignoreMissing: false, report: "normal" };
16625
14681
  if (algorithm === "crc") {
16626
14682
  const parsed = options(args, "z", { zero: "z" });
@@ -16875,7 +14931,7 @@ async function verify(context2, manifest2, algorithm, settings17, state) {
16875
14931
  }
16876
14932
  function command2(name2, algorithm, maxInputBytes) {
16877
14933
  return define(name2, async (context2) => {
16878
- const selected = name2 === "cksum" ? parseCksum(context2.args) : { algorithm, settings: parse8(context2.args, algorithm) };
14934
+ const selected = name2 === "cksum" ? parseCksum(context2.args) : { algorithm, settings: parse7(context2.args, algorithm) };
16879
14935
  const selectedAlgorithm = selected.algorithm;
16880
14936
  const settings17 = selected.settings;
16881
14937
  const state = { stdinUsed: false, budget: new ByteInputBudget(maxInputBytes) };
@@ -23038,7 +21094,7 @@ function createChmodCommand(configuration = {}) {
23038
21094
 
23039
21095
  // packages/safe-bash/src/commands/metadata/stat.ts
23040
21096
  init_platform();
23041
- function parse9(args) {
21097
+ function parse8(args) {
23042
21098
  let follow = false;
23043
21099
  let format3;
23044
21100
  let printf = false;
@@ -23251,7 +21307,7 @@ function createStatCommand(configuration = {}) {
23251
21307
  const configured = settings(configuration);
23252
21308
  return metadataCommand("stat", async (context2) => {
23253
21309
  const budget = new MetadataBudget(context2, configured.limits);
23254
- const parsed = parse9(context2.args);
21310
+ const parsed = parse8(context2.args);
23255
21311
  let exitCode = 0;
23256
21312
  for (const name2 of parsed.paths) {
23257
21313
  await budget.step();
@@ -23291,7 +21347,7 @@ function randomInteger(maximum) {
23291
21347
  }
23292
21348
 
23293
21349
  // packages/safe-bash/src/commands/metadata/mktemp.ts
23294
- function parse10(args) {
21350
+ function parse9(args) {
23295
21351
  let directory2 = false;
23296
21352
  let dryRun = false;
23297
21353
  let quiet = false;
@@ -23346,7 +21402,7 @@ function createMktempCommand(configuration = {}) {
23346
21402
  const configured = settings(configuration);
23347
21403
  return metadataCommand("mktemp", async (context2) => {
23348
21404
  const budget = new MetadataBudget(context2, configured.limits);
23349
- const parsed = parse10(context2.args);
21405
+ const parsed = parse9(context2.args);
23350
21406
  const parent = parsed.tmpdir || context2.env.TMPDIR || "/tmp";
23351
21407
  validatePath(parent);
23352
21408
  const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
@@ -23402,7 +21458,7 @@ init_platform();
23402
21458
  var signedMaximum2 = (1n << 63n) - 1n;
23403
21459
  var signedMinimum = -signedMaximum2 - 1n;
23404
21460
  var helpText2 = "Usage: truncate OPTION... FILE...\nShrink or extend the size of each FILE to the specified size\n\nA FILE argument that does not exist is created.\n\nIf a FILE is larger than the specified size, the extra data is lost.\nIf a FILE is shorter, it is extended and the extended part (hole)\nreads as zero bytes.\n\nMandatory arguments to long options are mandatory for short options too.\n -c, --no-create do not create any files\n -o, --io-blocks treat SIZE as number of IO blocks instead of bytes\n -r, --reference=RFILE base size on RFILE\n -s, --size=SIZE set or adjust the file size by SIZE bytes\n --help display this help and exit\n --version output version information and exit\n\nThe SIZE argument is an integer and optional unit (example: 10K is 10*1024).\nUnits are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).\n\nSIZE may also be prefixed by one of the following modifying characters:\n'+' extend by, '-' reduce by, '<' at most, '>' at least,\n'/' round down to multiple of, '%' round up to multiple of.\n\nGNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport truncate translation bugs to <https://translationproject.org/team/>\nFull documentation at: <https://www.gnu.org/software/coreutils/truncate>\nor available locally via: info '(coreutils) truncate invocation'\n";
23405
- var glibc231PrintableRanges4 = [
21461
+ var glibc231PrintableRanges3 = [
23406
21462
  32,
23407
21463
  126,
23408
21464
  160,
@@ -24693,11 +22749,11 @@ var TruncateDiagnostic = class extends Error {
24693
22749
  detail;
24694
22750
  usage;
24695
22751
  };
24696
- function unicodeLocale3(context2) {
22752
+ function unicodeLocale2(context2) {
24697
22753
  const locale = (context2.env.LC_ALL || context2.env.LC_CTYPE || context2.env.LANG || "C").toLowerCase();
24698
22754
  return locale.endsWith("utf-8") || locale.endsWith("utf8");
24699
22755
  }
24700
- function quote4(text3, filename = false, unicode = false) {
22756
+ function quote3(text3, filename = false, unicode = false) {
24701
22757
  const controls2 = { "\x07": "\\a", "\b": "\\b", " ": "\\t", "\n": "\\n", "\v": "\\v", "\f": "\\f", "\r": "\\r" };
24702
22758
  const decoder2 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
24703
22759
  const units = [];
@@ -24718,11 +22774,11 @@ function quote4(text3, filename = false, unicode = false) {
24718
22774
  }
24719
22775
  let printable = valid && point >= 32 && point < 127;
24720
22776
  if (valid && point >= 128) {
24721
- let low = 0, high = glibc231PrintableRanges4.length / 2;
22777
+ let low = 0, high = glibc231PrintableRanges3.length / 2;
24722
22778
  while (low < high) {
24723
22779
  const middle = Math.floor((low + high) / 2);
24724
- if (point < glibc231PrintableRanges4[middle * 2]) high = middle;
24725
- else if (point > glibc231PrintableRanges4[middle * 2 + 1]) low = middle + 1;
22780
+ if (point < glibc231PrintableRanges3[middle * 2]) high = middle;
22781
+ else if (point > glibc231PrintableRanges3[middle * 2 + 1]) low = middle + 1;
24726
22782
  else {
24727
22783
  printable = true;
24728
22784
  break;
@@ -24796,10 +22852,10 @@ function number2(text3, unicode) {
24796
22852
  invalid ||= offset !== text3.length;
24797
22853
  }
24798
22854
  }
24799
- if (invalid || overflow) throw new TruncateDiagnostic(`Invalid number: ${quote4(text3, false, unicode)}${overflow && !invalid ? ": Value too large for defined data type" : ""}`);
22855
+ if (invalid || overflow) throw new TruncateDiagnostic(`Invalid number: ${quote3(text3, false, unicode)}${overflow && !invalid ? ": Value too large for defined data type" : ""}`);
24800
22856
  return value2;
24801
22857
  }
24802
- function parse11(context2, argumentLimit) {
22858
+ function parse10(context2, argumentLimit) {
24803
22859
  if (context2.args.length > 4096) throw new PublicDiagnostic("argument limit exceeded");
24804
22860
  let total = 0;
24805
22861
  for (const argument2 of context2.args) {
@@ -24822,7 +22878,7 @@ function parse11(context2, argumentLimit) {
24822
22878
  }
24823
22879
  const args = context2.args.map((_argument, index) => Array.from(carrier.bytes(index), (byte) => String.fromCharCode(byte)).join(""));
24824
22880
  const settings17 = { modifier: "absolute", blocks: false, noCreate: false, operands: [] };
24825
- const unicode = unicodeLocale3(context2);
22881
+ const unicode = unicodeLocale2(context2);
24826
22882
  const long = { "no-create": "c", "io-blocks": "o", reference: "r", size: "s", help: "help", version: "version" };
24827
22883
  const apply = (key, value2 = "") => {
24828
22884
  if (key === "c") settings17.noCreate = true;
@@ -24878,9 +22934,9 @@ function parse11(context2, argumentLimit) {
24878
22934
  }
24879
22935
  if (settings17.information) return settings17;
24880
22936
  }
24881
- if (settings17.reference === void 0 && settings17.size === void 0) throw new TruncateDiagnostic(`you must specify either ${quote4("--size", false, unicode)} or ${quote4("--reference", false, unicode)}`, true);
24882
- if (settings17.reference !== void 0 && settings17.size !== void 0 && settings17.modifier === "absolute") throw new TruncateDiagnostic(`you must specify a relative ${quote4("--size", false, unicode)} with ${quote4("--reference", false, unicode)}`, true);
24883
- if (settings17.blocks && settings17.size === void 0) throw new TruncateDiagnostic(`${quote4("--io-blocks", false, unicode)} was specified but ${quote4("--size", false, unicode)} was not`, true);
22937
+ if (settings17.reference === void 0 && settings17.size === void 0) throw new TruncateDiagnostic(`you must specify either ${quote3("--size", false, unicode)} or ${quote3("--reference", false, unicode)}`, true);
22938
+ if (settings17.reference !== void 0 && settings17.size !== void 0 && settings17.modifier === "absolute") throw new TruncateDiagnostic(`you must specify a relative ${quote3("--size", false, unicode)} with ${quote3("--reference", false, unicode)}`, true);
22939
+ if (settings17.blocks && settings17.size === void 0) throw new TruncateDiagnostic(`${quote3("--io-blocks", false, unicode)} was specified but ${quote3("--size", false, unicode)} was not`, true);
24884
22940
  if (!settings17.operands.length) throw new TruncateDiagnostic("missing file operand", true);
24885
22941
  return settings17;
24886
22942
  }
@@ -25035,15 +23091,15 @@ ${error.usage ? "Try 'truncate --help' for more information.\n" : ""}`);
25035
23091
  };
25036
23092
  let outcome;
25037
23093
  try {
25038
- const settings17 = parse11(context2, argumentLimit);
25039
- const unicode = unicodeLocale3(context2);
23094
+ const settings17 = parse10(context2, argumentLimit);
23095
+ const unicode = unicodeLocale2(context2);
25040
23096
  if (settings17.information) {
25041
23097
  await emit2(settings17.information === "help" ? helpText2 : "truncate (virtual-bash)\n", false);
25042
23098
  outcome = { exitCode: 0 };
25043
23099
  } else {
25044
23100
  let reference;
25045
23101
  if (settings17.reference !== void 0) {
25046
- const label = quote4(settings17.reference, true, unicode);
23102
+ const label = quote3(settings17.reference, true, unicode);
25047
23103
  let stat;
25048
23104
  try {
25049
23105
  const filesystem = context2.fs;
@@ -25089,7 +23145,7 @@ ${error.usage ? "Try 'truncate --help' for more information.\n" : ""}`);
25089
23145
  signal.throwIfAborted();
25090
23146
  if (index >= configured.limits.maxEntries) throw new PublicDiagnostic("entry limit exceeded");
25091
23147
  const name2 = settings17.operands[index];
25092
- const label = quote4(name2, true, unicode);
23148
+ const label = quote3(name2, true, unicode);
25093
23149
  let handle;
25094
23150
  try {
25095
23151
  const path = filePath2(context2, name2);
@@ -28393,21 +26449,21 @@ init_platform();
28393
26449
  function parseZipTestCommand(value2) {
28394
26450
  const words = [];
28395
26451
  let word = "";
28396
- let quote5 = "";
26452
+ let quote4 = "";
28397
26453
  let active = false;
28398
26454
  for (let index = 0; index < value2.length; index++) {
28399
26455
  const character = value2[index];
28400
26456
  if ("\n\r\0;|&<>$`".includes(character)) throw new ZipFailure(16, "Invalid command arguments", "unsupported virtual test-command syntax");
28401
- if (character === "\\" && quote5 !== "'") {
26457
+ if (character === "\\" && quote4 !== "'") {
28402
26458
  const next = value2[++index];
28403
26459
  if (next === void 0 || "\n\r\0;|&<>$`".includes(next)) throw new ZipFailure(16, "Invalid command arguments", "invalid test-command escape");
28404
26460
  word += next;
28405
26461
  active = true;
28406
- } else if (quote5) {
28407
- if (character === quote5) quote5 = "";
26462
+ } else if (quote4) {
26463
+ if (character === quote4) quote4 = "";
28408
26464
  else word += character;
28409
26465
  } else if (character === "'" || character === '"') {
28410
- quote5 = character;
26466
+ quote4 = character;
28411
26467
  active = true;
28412
26468
  } else if (character === " " || character === " ") {
28413
26469
  if (active) {
@@ -28420,7 +26476,7 @@ function parseZipTestCommand(value2) {
28420
26476
  active = true;
28421
26477
  }
28422
26478
  }
28423
- if (quote5) throw new ZipFailure(16, "Invalid command arguments", "unterminated test-command quote");
26479
+ if (quote4) throw new ZipFailure(16, "Invalid command arguments", "unterminated test-command quote");
28424
26480
  if (active) words.push(word);
28425
26481
  if (!words[0] || words[0].includes("{}")) throw new ZipFailure(16, "Invalid command arguments", "invalid virtual test command");
28426
26482
  return words;
@@ -29734,7 +27790,7 @@ var Answers = class {
29734
27790
 
29735
27791
  // packages/safe-bash/src/commands/archive/zip.ts
29736
27792
  var defaultStoreSuffixes = [".Z", ".zip", ".zoo", ".arc", ".lzh", ".arj"];
29737
- async function parse12(scope, limits, defaults) {
27793
+ async function parse11(scope, limits, defaults) {
29738
27794
  const context2 = scope.context;
29739
27795
  const args = zipEnvironmentArguments(context2.env, context2.args, limits);
29740
27796
  const rawArguments = context2.argumentValues ? (0, contracts_exports.getCommandArguments)(context2) : void 0;
@@ -30753,7 +28809,7 @@ function createZipCommand(options2 = {}) {
30753
28809
  let budget = new Budget14(context2, limits);
30754
28810
  let log;
30755
28811
  try {
30756
- let parsed = await parse12(scope, limits, options2.zip);
28812
+ let parsed = await parse11(scope, limits, options2.zip);
30757
28813
  if ("information" in parsed) {
30758
28814
  if (parsed.debug) await budget.output("sd: Command line read\n");
30759
28815
  if (parsed.information === "command") {
@@ -31947,7 +30003,7 @@ function number4(value2, label) {
31947
30003
  if (!/^[0-9]+$/u.test(value2) || !Number.isSafeInteger(Number(value2)) || Number(value2) < 1) fail2(`invalid ${label}: ${value2}`);
31948
30004
  return Number(value2);
31949
30005
  }
31950
- function parse13(context2, budget) {
30006
+ function parse12(context2, budget) {
31951
30007
  const options2 = { files: [], fields: [0, 0], unpaired: /* @__PURE__ */ new Set(), paired: true, separator: 10, delimiter: void 0, whole: false, replacement: empty, format: void 0, fold: false, header: false, order: "default" };
31952
30008
  let literal = false;
31953
30009
  let delimiterChoice;
@@ -32070,7 +30126,7 @@ function split2(bytes3, options2, budget) {
32070
30126
  function createJoinCommand(factory = {}) {
32071
30127
  const limits = settings3(factory);
32072
30128
  return command3("join", async (context2) => {
32073
- const budget = new Budget18(context2, limits), options2 = parse13(context2, budget);
30129
+ const budget = new Budget18(context2, limits), options2 = parse12(context2, budget);
32074
30130
  requireCLocale(context2);
32075
30131
  const inputs2 = new Inputs(context2, budget, options2.separator), order = new OrderCheck(options2.order, context2);
32076
30132
  const terminator = Uint8Array.of(options2.separator), delimiter = Uint8Array.of(options2.delimiter ?? 32);
@@ -34915,7 +32971,7 @@ function environmentCharset(budget) {
34915
32971
  }
34916
32972
 
34917
32973
  // packages/safe-bash/src/commands/tree/arguments.ts
34918
- function parse14(args, budget) {
32974
+ function parse13(args, budget) {
34919
32975
  budget.check(args.length, budget.limits.maxArguments, "argument count");
34920
32976
  let bytes3 = 0;
34921
32977
  for (const arg of args) {
@@ -35284,7 +33340,7 @@ function createTreeCommand(options2 = {}) {
35284
33340
  const budget = new WalkBudget(context2, limits);
35285
33341
  let args;
35286
33342
  try {
35287
- args = parse14(context2.args, budget);
33343
+ args = parse13(context2.args, budget);
35288
33344
  } catch (error) {
35289
33345
  context2.signal.throwIfAborted();
35290
33346
  if (!(error instanceof UsageError2)) throw error;
@@ -35494,7 +33550,7 @@ function limitMessage(error) {
35494
33550
  // packages/safe-bash/src/commands/file/index.ts
35495
33551
  var profile = "virtual-bash-file-v1";
35496
33552
  var help2 = "Usage: file [-bihL] [--mime-type] [--mime-encoding] [--] FILE...\nClassify bounded VFS content; '-' reads stdin. -h is the default.\nOptions: --brief, --mime, --dereference, --no-dereference, --help, --version\nNo decompression, external magic database, or complete format validation.\n";
35497
- async function parse15(args, budget) {
33553
+ async function parse14(args, budget) {
35498
33554
  const result = { brief: false, follow: false, mimeType: false, mimeEncoding: false, names: [] };
35499
33555
  let argumentBytes = 0;
35500
33556
  budget.check(args.length, budget.limits.maxArgumentBytes, "argument");
@@ -35642,7 +33698,7 @@ function createFileCommand(options2 = {}) {
35642
33698
  const budget = new SharedBudget(context2, limits);
35643
33699
  let writing = false;
35644
33700
  try {
35645
- const args = await parse15(context2.args, budget);
33701
+ const args = await parse14(context2.args, budget);
35646
33702
  if (args.action) {
35647
33703
  writing = true;
35648
33704
  await budget.output(context2.stdout, args.action === "help" ? help2 : `file (${profile})
@@ -35870,7 +33926,7 @@ function readerSettings(limits) {
35870
33926
  function usage(message3) {
35871
33927
  throw new contracts_exports.FsError("EINVAL", { message: message3 });
35872
33928
  }
35873
- function parse16(args, limits) {
33929
+ function parse15(args, limits) {
35874
33930
  if (args.length > limits.maxArgumentBytes) usage("argument count limit exceeded");
35875
33931
  let argumentBytes = 0;
35876
33932
  for (const token of args) {
@@ -36262,7 +34318,7 @@ function createColumnCommand(options2 = {}) {
36262
34318
  let rejection;
36263
34319
  try {
36264
34320
  try {
36265
- const parsed = parse16(context2.args, limits);
34321
+ const parsed = parse15(context2.args, limits);
36266
34322
  inputs2 = new ColumnInputs(context2, limits);
36267
34323
  const budget = inputs2.budget;
36268
34324
  if (parsed.help) await budget.text(helpText3);
@@ -36789,15 +34845,15 @@ var Parser = class {
36789
34845
  position++;
36790
34846
  await this.budget.checkpoint();
36791
34847
  }
36792
- const quote5 = tail[position] === '"' || tail[position] === "'" ? tail[position++] : "";
34848
+ const quote4 = tail[position] === '"' || tail[position] === "'" ? tail[position++] : "";
36793
34849
  const startValue = position;
36794
- while (position < tail.length && (quote5 ? tail[position] !== quote5 : !/\s/u.test(tail[position]))) {
34850
+ while (position < tail.length && (quote4 ? tail[position] !== quote4 : !/\s/u.test(tail[position]))) {
36795
34851
  this.budget.work(1);
36796
34852
  position++;
36797
34853
  await this.budget.checkpoint();
36798
34854
  }
36799
34855
  value2 = tail.slice(startValue, position);
36800
- if (quote5 && tail[position] === quote5) position++;
34856
+ if (quote4 && tail[position] === quote4) position++;
36801
34857
  }
36802
34858
  if (!attributes.has(key)) attributes.set(key, await entities(value2, this.budget));
36803
34859
  }
@@ -37588,7 +35644,7 @@ function formatSize(value2, format3) {
37588
35644
  }
37589
35645
 
37590
35646
  // packages/safe-bash/src/commands/du/arguments.ts
37591
- function parse17(budget) {
35647
+ function parse16(budget) {
37592
35648
  const { args, env } = budget.context;
37593
35649
  budget.check(args.length, budget.limits.maxArguments, "argument count");
37594
35650
  let bytes3 = 0;
@@ -38042,7 +36098,7 @@ function createDuCommand(options2 = {}) {
38042
36098
  const budget = new Budget22(work, limits, context2);
38043
36099
  context2.registerCleanup?.(budget.close);
38044
36100
  try {
38045
- const args = parse17(budget);
36101
+ const args = parse16(budget);
38046
36102
  if (context2.stdout.ownedOutput) operation2 = (0, contracts_exports.createOutputOperation)(context2, context2.stdout);
38047
36103
  if (args.help) {
38048
36104
  await budget.emit(work.stdout, helpText5);
@@ -38386,7 +36442,7 @@ async function evaluateExpression(args, budget, match, start = 0) {
38386
36442
  budget.charge(size);
38387
36443
  throw new ExprError(message3);
38388
36444
  }
38389
- function quote5(text3) {
36445
+ function quote4(text3) {
38390
36446
  const input3 = budget.encode(text3);
38391
36447
  const fragments = ["'"];
38392
36448
  let size = 2;
@@ -38413,13 +36469,13 @@ async function evaluateExpression(args, budget, match, start = 0) {
38413
36469
  }
38414
36470
  async function prefix3(depth, active) {
38415
36471
  budget.check(depth, budget.limits.maxDepth, "parser depth");
38416
- if (position === args.length) fail3(`syntax error: missing argument after ${quote5(args[position - 1])}`);
36472
+ if (position === args.length) fail3(`syntax error: missing argument after ${quote4(args[position - 1])}`);
38417
36473
  const token = args[position++];
38418
36474
  if (token === ")") fail3("syntax error: unexpected ')'");
38419
36475
  if (token === "(") {
38420
36476
  const result2 = await expression(1, depth + 1, active);
38421
- if (position === args.length) fail3(`syntax error: expecting ')' after ${quote5(args[position - 1])}`);
38422
- if (args[position] !== ")") fail3(`syntax error: expecting ')' instead of ${quote5(args[position])}`);
36477
+ if (position === args.length) fail3(`syntax error: expecting ')' after ${quote4(args[position - 1])}`);
36478
+ if (args[position] !== ")") fail3(`syntax error: expecting ')' instead of ${quote4(args[position])}`);
38423
36479
  position++;
38424
36480
  return result2;
38425
36481
  }
@@ -38468,7 +36524,7 @@ async function evaluateExpression(args, budget, match, start = 0) {
38468
36524
  }
38469
36525
  if (position === args.length) fail3("missing operand\nTry 'expr --help' for more information.");
38470
36526
  const result = await expression(1, 1, true);
38471
- if (position !== args.length) fail3(`syntax error: unexpected argument ${quote5(args[position])}`);
36527
+ if (position !== args.length) fail3(`syntax error: unexpected argument ${quote4(args[position])}`);
38472
36528
  if (!result.active) throw new ExprError("inactive expression", 3);
38473
36529
  return result.value;
38474
36530
  }
@@ -39513,7 +37569,7 @@ async function targetPath(value2, work) {
39513
37569
  if (absolute2.split("/").length - 1 > work.limits.maxPathComponents) throw new PatchError("maxPathComponents limit exceeded");
39514
37570
  return absolute2;
39515
37571
  }
39516
- async function parse18(text3, work) {
37572
+ async function parse17(text3, work) {
39517
37573
  await work.utf8(work.cwd, work.limits.maxPathBytes, 2);
39518
37574
  if (!work.cwd.startsWith("/") || work.cwd.includes("\0")) throw new PatchError("cwd must be an absolute virtual path", 2);
39519
37575
  const lines3 = await patchLines(text3, work);
@@ -39941,7 +37997,7 @@ var Invocation2 = class {
39941
37997
  let summary;
39942
37998
  try {
39943
37999
  try {
39944
- const files = await parse18(await this.input(), work);
38000
+ const files = await parse17(await this.input(), work);
39945
38001
  const plans = await this.prepare(files);
39946
38002
  const lines3 = ["Success. Updated the following files:\n"];
39947
38003
  let bytes3 = lines3[0].length;
@@ -40409,30 +38465,30 @@ function parseArithmetic(source2, offset = 0, budget = new ParseBudget()) {
40409
38465
  }
40410
38466
  function arithmeticEnd(source2, start, allowSubshell = false) {
40411
38467
  let depth = 0;
40412
- let quote5 = "";
38468
+ let quote4 = "";
40413
38469
  let ansiQuote = false;
40414
38470
  const quotedSubstitutions = [];
40415
38471
  for (let position = start; position < source2.length; position++) {
40416
38472
  const character = source2[position];
40417
38473
  if (allowSubshell) {
40418
- if (character === "\\" && (quote5 !== "'" || ansiQuote)) {
38474
+ if (character === "\\" && (quote4 !== "'" || ansiQuote)) {
40419
38475
  position++;
40420
38476
  continue;
40421
38477
  }
40422
- if (quote5 === '"' && character === "$" && source2[position + 1] === "(") {
38478
+ if (quote4 === '"' && character === "$" && source2[position + 1] === "(") {
40423
38479
  if (quotedSubstitutions.length >= 64) throw new ShellSyntaxError("Syntax nesting exceeds 64", position);
40424
38480
  quotedSubstitutions.push(depth);
40425
38481
  depth++;
40426
38482
  position++;
40427
- quote5 = "";
38483
+ quote4 = "";
40428
38484
  continue;
40429
38485
  }
40430
- if (quote5) {
40431
- if (character === quote5) quote5 = "";
38486
+ if (quote4) {
38487
+ if (character === quote4) quote4 = "";
40432
38488
  continue;
40433
38489
  }
40434
38490
  if (character === "'" || character === '"' || character === "`") {
40435
- quote5 = character;
38491
+ quote4 = character;
40436
38492
  ansiQuote = character === "'" && source2[position - 1] === "$";
40437
38493
  continue;
40438
38494
  }
@@ -40446,7 +38502,7 @@ function arithmeticEnd(source2, start, allowSubshell = false) {
40446
38502
  }
40447
38503
  if (quotedSubstitutions.at(-1) === depth) {
40448
38504
  quotedSubstitutions.pop();
40449
- quote5 = '"';
38505
+ quote4 = '"';
40450
38506
  }
40451
38507
  }
40452
38508
  }
@@ -41358,20 +39414,20 @@ shell: command substitution: line ${line}: \`${sourceLine}'
41358
39414
  };
41359
39415
  this.position += backtick ? 1 : 2;
41360
39416
  const closers = [backtick ? "`" : opening === "(" ? ")" : "}"];
41361
- let quote5 = "";
39417
+ let quote4 = "";
41362
39418
  while (this.position < this.source.length) {
41363
39419
  const current = this.source[this.position++];
41364
- if (current === "\\" && quote5 !== "'") {
39420
+ if (current === "\\" && quote4 !== "'") {
41365
39421
  const next = this.source[this.position++];
41366
39422
  if (next === void 0) this.error("Trailing delimiter escape");
41367
39423
  if (next !== "\n") {
41368
- if (quote5 === '"' && !/[$`"\\]/u.test(next)) value2 += current;
39424
+ if (quote4 === '"' && !/[$`"\\]/u.test(next)) value2 += current;
41369
39425
  append(next, this.position - 1);
41370
39426
  }
41371
- } else if (quote5) {
41372
- if (current === quote5) quote5 = "";
39427
+ } else if (quote4) {
39428
+ if (current === quote4) quote4 = "";
41373
39429
  else append(current, this.position - 1);
41374
- } else if (current === "'" || current === '"') quote5 = current;
39430
+ } else if (current === "'" || current === '"') quote4 = current;
41375
39431
  else {
41376
39432
  append(current, this.position - 1);
41377
39433
  if (current === closers.at(-1)) {
@@ -44334,15 +42390,15 @@ function diagnosticCommandName(value2, byteLocale2, allocation) {
44334
42390
  const maximum = (0, value_exports.shellValueByteLength)(value2) * 4 + 3;
44335
42391
  if (!Number.isSafeInteger(maximum)) throw new RangeError("Command diagnostic is too large");
44336
42392
  const bytes3 = (0, value_exports.shellValueBytes)(value2, allocation);
44337
- let quote5 = false;
42393
+ let quote4 = false;
44338
42394
  let length = 3;
44339
42395
  for (let index = 0; index < bytes3.length; ) {
44340
42396
  const width = printableWidth(bytes3, index, byteLocale2);
44341
- quote5 ||= width === 0;
42397
+ quote4 ||= width === 0;
44342
42398
  length += escapes.has(bytes3[index]) ? 2 : width || 4;
44343
42399
  index += width || 1;
44344
42400
  }
44345
- if (!quote5) return value2;
42401
+ if (!quote4) return value2;
44346
42402
  const reservation = allocation.reserve(length, 1);
44347
42403
  try {
44348
42404
  const result = new Uint8Array(length);
@@ -56921,11 +54977,11 @@ function makeSafeJsShellModule(executor, options2) {
56921
54977
 
56922
54978
  // packages/safe-bash/src/core.browser.ts
56923
54979
  __reExport(core_browser_exports, core_exports);
56924
- import { CommandArgumentIdentityError, createCommandArguments as createCommandArguments4, getCommandArguments as getCommandArguments15, commandRuntimeIdentity as commandRuntimeIdentity2, CommandRegistry as CommandRegistry3, validateExitCode as validateExitCode2 } from "../safe-bash-contracts/command.js";
56925
- import { evaluateCommandSupport, assertCommandRequirements as assertCommandRequirements11 } from "../safe-bash-contracts/command-requirements.js";
56926
- import { isErrnoCode, isFsError as isFsError10, toFsError, FsError as FsError52 } from "../safe-bash-contracts/errors.js";
54980
+ import { CommandArgumentIdentityError, createCommandArguments as createCommandArguments4, getCommandArguments as getCommandArguments14, commandRuntimeIdentity as commandRuntimeIdentity2, CommandRegistry as CommandRegistry3, validateExitCode as validateExitCode2 } from "../safe-bash-contracts/command.js";
54981
+ import { evaluateCommandSupport, assertCommandRequirements as assertCommandRequirements10 } from "../safe-bash-contracts/command-requirements.js";
54982
+ import { isErrnoCode, isFsError as isFsError9, toFsError, FsError as FsError51 } from "../safe-bash-contracts/errors.js";
56927
54983
  import { ACCESS_MODES as ACCESS_MODES3 } from "../safe-bash-contracts/filesystem.js";
56928
- import { collectBytes as collectBytes11, readBytes as readBytes35, toByteSource as toByteSource7, outputFailure as outputFailure3, createBytePipe as createBytePipe2, writeText as writeText3, writeBytes as writeBytes32, pipeBytes as pipeBytes2, collectText } from "../safe-bash-contracts/io.js";
54984
+ import { collectBytes as collectBytes11, readBytes as readBytes35, toByteSource as toByteSource7, outputFailure as outputFailure3, createBytePipe as createBytePipe2, writeText as writeText3, writeBytes as writeBytes31, pipeBytes as pipeBytes2, collectText } from "../safe-bash-contracts/io.js";
56929
54985
  import { createOutputOperation as createOutputOperation11 } from "../safe-bash-contracts/output.js";
56930
54986
  import { composeMiddleware as composeMiddleware2 } from "../safe-bash-contracts/plugin.js";
56931
54987
  export {
@@ -56939,7 +54995,7 @@ export {
56939
54995
  EreSyntaxError,
56940
54996
  EreUnsupportedError,
56941
54997
  EreUsageUnknownError,
56942
- FsError52 as FsError,
54998
+ FsError51 as FsError,
56943
54999
  MemoryFileSystem,
56944
55000
  MountFileSystem,
56945
55001
  OverlayFileSystem,
@@ -56955,7 +55011,7 @@ export {
56955
55011
  agentCommands,
56956
55012
  applyPatchCommands,
56957
55013
  archiveCommands,
56958
- assertCommandRequirements11 as assertCommandRequirements,
55014
+ assertCommandRequirements10 as assertCommandRequirements,
56959
55015
  assertPathWithin,
56960
55016
  basename2 as basename,
56961
55017
  byteCommands,
@@ -57071,7 +55127,7 @@ export {
57071
55127
  factorCommands,
57072
55128
  fgrepCommand,
57073
55129
  fileCommands,
57074
- getCommandArguments15 as getCommandArguments,
55130
+ getCommandArguments14 as getCommandArguments,
57075
55131
  getoptCommands,
57076
55132
  grepAliasCommands,
57077
55133
  hexdumpCommands,
@@ -57080,7 +55136,7 @@ export {
57080
55136
  inspectPythonCapabilities,
57081
55137
  isAbsolutePath2 as isAbsolutePath,
57082
55138
  isErrnoCode,
57083
- isFsError10 as isFsError,
55139
+ isFsError9 as isFsError,
57084
55140
  isPathWithin2 as isPathWithin,
57085
55141
  joinPath2 as joinPath,
57086
55142
  lineEndingCommands,
@@ -57120,7 +55176,7 @@ export {
57120
55176
  validateExitCode2 as validateExitCode,
57121
55177
  validatePath2 as validatePath,
57122
55178
  whichCommands,
57123
- writeBytes32 as writeBytes,
55179
+ writeBytes31 as writeBytes,
57124
55180
  writeText3 as writeText,
57125
55181
  xmlCommands,
57126
55182
  yqCommands