@jerryan/just-bash 3.9.0 → 3.11.0

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 (446) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +2 -2
  3. package/dist/AGENTS.md +2 -2
  4. package/dist/abort-signals.d.ts +10 -0
  5. package/dist/bin/chunks/awk2-LCV2AUIX.js +3 -0
  6. package/dist/bin/{shell/chunks/base64-TQ5KOCNW.js → chunks/base64-OLYCF2PC.js} +1 -1
  7. package/dist/bin/chunks/builtin-manifest-ORBIZM7I.js +3 -0
  8. package/dist/bin/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
  9. package/dist/bin/{shell/chunks/chmod-GX5SYTRL.js → chunks/chmod-V5F4BXZ2.js} +1 -1
  10. package/dist/bin/{shell/chunks/chunk-V4S4A7M6.js → chunks/chunk-2TEF4USR.js} +1 -1
  11. package/dist/bin/{shell/chunks/chunk-GBKR5KTT.js → chunks/chunk-3ASHUC7C.js} +13 -13
  12. package/dist/bin/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
  13. package/dist/bin/chunks/chunk-4NYJ4ZTO.js +17 -0
  14. package/dist/bin/chunks/{chunk-M3Z5NZXT.js → chunk-572NXISH.js} +1 -1
  15. package/dist/bin/chunks/chunk-5NWK7A4R.js +13 -0
  16. package/dist/bin/{shell/chunks/chunk-YXPSX3SI.js → chunks/chunk-623Q77WZ.js} +1 -1
  17. package/dist/bin/chunks/chunk-6NG4ULJM.js +7 -0
  18. package/dist/bin/{shell/chunks/chunk-QFOXSCOD.js → chunks/chunk-726WDFMQ.js} +1 -1
  19. package/dist/bin/chunks/{chunk-DRPHNXG7.js → chunk-7LGT4LHQ.js} +1 -1
  20. package/dist/bin/chunks/{chunk-MBREBDZQ.js → chunk-AIWBN36Z.js} +1 -1
  21. package/dist/bin/chunks/{chunk-3ROYEBJI.js → chunk-AJ3CSZ34.js} +1 -1
  22. package/dist/bin/{shell/chunks/chunk-VTAMGD42.js → chunks/chunk-APEQNYAO.js} +1 -1
  23. package/dist/bin/chunks/chunk-AQKIHX3Q.js +3 -0
  24. package/dist/bin/chunks/chunk-BFLKIASG.js +7 -0
  25. package/dist/bin/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
  26. package/dist/bin/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
  27. package/dist/bin/chunks/{chunk-T6OIISUC.js → chunk-BZJ77YQD.js} +1 -1
  28. package/dist/bin/{shell/chunks/chunk-GR4ZHKXI.js → chunks/chunk-C2BLJ3AE.js} +1 -1
  29. package/dist/bin/{shell/chunks/chunk-KMYJMEON.js → chunks/chunk-C45GTJTD.js} +1 -1
  30. package/dist/bin/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
  31. package/dist/bin/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
  32. package/dist/bin/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
  33. package/dist/bin/{shell/chunks/chunk-E54Z6VIE.js → chunks/chunk-ERYPQAZE.js} +5 -5
  34. package/dist/bin/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
  35. package/dist/bin/chunks/chunk-HFVQCXYX.js +10 -0
  36. package/dist/bin/chunks/chunk-HSWCKN2X.js +14 -0
  37. package/dist/bin/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
  38. package/dist/bin/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
  39. package/dist/bin/chunks/chunk-IX6QY5JW.js +5 -0
  40. package/dist/bin/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
  41. package/dist/bin/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
  42. package/dist/bin/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
  43. package/dist/bin/chunks/{chunk-6JEDM6CZ.js → chunk-KH6YLKPE.js} +1 -1
  44. package/dist/bin/chunks/chunk-KXSDVBJA.js +12 -0
  45. package/dist/bin/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
  46. package/dist/bin/chunks/{chunk-L345YZ6R.js → chunk-LVT5R45K.js} +1 -1
  47. package/dist/bin/chunks/{chunk-PTUQEN6I.js → chunk-M345X45Z.js} +7 -7
  48. package/dist/bin/chunks/{chunk-6FGMEZZP.js → chunk-NDS7PYKD.js} +1 -1
  49. package/dist/bin/chunks/chunk-O3PNT72D.js +3 -0
  50. package/dist/bin/chunks/chunk-OGOISDGZ.js +3 -0
  51. package/dist/bin/chunks/chunk-OSW4MDDH.js +21 -0
  52. package/dist/bin/{shell/chunks/chunk-ABP4OLJV.js → chunks/chunk-OXEDIWNZ.js} +1 -1
  53. package/dist/bin/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
  54. package/dist/bin/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
  55. package/dist/bin/chunks/{chunk-O2BCKSMK.js → chunk-PEJXCXSY.js} +1 -1
  56. package/dist/bin/{shell/chunks/chunk-6KHZX4HU.js → chunks/chunk-PLLMJHMV.js} +1 -1
  57. package/dist/bin/{shell/chunks/chunk-6TUILMPB.js → chunks/chunk-QELDDRV5.js} +1 -1
  58. package/dist/bin/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
  59. package/dist/bin/{shell/chunks/chunk-H7PD6FLC.js → chunks/chunk-RE7Z53A3.js} +1 -1
  60. package/dist/bin/chunks/chunk-SCQRBEQW.js +275 -0
  61. package/dist/bin/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
  62. package/dist/bin/{shell/chunks/chunk-CC2AQ6B7.js → chunks/chunk-U6JTVQU6.js} +1 -1
  63. package/dist/bin/chunks/chunk-UBA7DOWE.js +3 -0
  64. package/dist/bin/chunks/{chunk-VPSBWWXM.js → chunk-UFAYH3WW.js} +7 -6
  65. package/dist/bin/chunks/chunk-UPUFWGHR.js +3 -0
  66. package/dist/bin/{shell/chunks/chunk-QJWFCA7P.js → chunks/chunk-UU42WPB7.js} +1 -1
  67. package/dist/bin/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
  68. package/dist/bin/chunks/chunk-VMVXACZ5.js +6 -0
  69. package/dist/bin/chunks/chunk-WLQ2KWS3.js +10 -0
  70. package/dist/bin/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
  71. package/dist/bin/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
  72. package/dist/bin/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
  73. package/dist/bin/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
  74. package/dist/bin/chunks/{cp-YLP7ULVT.js → cp-XJWV46T5.js} +1 -1
  75. package/dist/bin/{shell/chunks/curl-NHNZ46BU.js → chunks/curl-HZ5SBTVY.js} +11 -11
  76. package/dist/bin/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
  77. package/dist/bin/{shell/chunks/diff-DM47S5PT.js → chunks/diff-YLVT27CZ.js} +1 -1
  78. package/dist/bin/chunks/dist-4NZ74CRE.js +141 -0
  79. package/dist/bin/chunks/{du-DH76GZJ3.js → du-YNAJTGCR.js} +1 -1
  80. package/dist/bin/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
  81. package/dist/bin/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
  82. package/dist/bin/chunks/find-3QDGII35.js +3 -0
  83. package/dist/bin/chunks/flag-coverage-AGEO3F6X.js +3 -0
  84. package/dist/bin/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
  85. package/dist/bin/chunks/{gzip-UQZL4R74.js → gzip-W5CL2E2W.js} +1 -1
  86. package/dist/bin/{shell/chunks/head-QKVY3SIO.js → chunks/head-ABLEKDMV.js} +1 -1
  87. package/dist/bin/{shell/chunks/help-HVIDHJ6M.js → chunks/help-EXVKU23F.js} +1 -1
  88. package/dist/bin/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
  89. package/dist/bin/{shell/chunks/jq-YS4PR46D.js → chunks/jq-5SOTL7D7.js} +1 -1
  90. package/dist/bin/chunks/{js-exec-ZAAIZQWI.js → js-exec-LISDW7YC.js} +2 -2
  91. package/dist/bin/chunks/js-exec-worker.js +1 -0
  92. package/dist/bin/chunks/{ls-5Z45FV4U.js → ls-EEX3YIOF.js} +1 -1
  93. package/dist/bin/chunks/mkdir-KDEZTR53.js +3 -0
  94. package/dist/bin/chunks/mktemp-OYQYUB5H.js +3 -0
  95. package/dist/bin/{shell/chunks/mv-EOOP2TO3.js → chunks/mv-35V6IA5V.js} +1 -1
  96. package/dist/bin/{shell/chunks/od-2GXD4D5K.js → chunks/od-TD5LZDUM.js} +1 -1
  97. package/dist/bin/{shell/chunks/paste-DWWA3JTW.js → chunks/paste-QJG6BYAP.js} +1 -1
  98. package/dist/bin/chunks/{python3-TJ6DCPIA.js → python3-P6MZ44HK.js} +5 -5
  99. package/dist/bin/{shell/chunks/readlink-EJ3IKLWW.js → chunks/readlink-BF435HNQ.js} +1 -1
  100. package/dist/bin/chunks/rg-B2DVJQVY.js +3 -0
  101. package/dist/bin/chunks/rm-HCMKNRM2.js +3 -0
  102. package/dist/bin/{shell/chunks/rmdir-PRNISPBA.js → chunks/rmdir-WGVUYGPF.js} +1 -1
  103. package/dist/bin/{shell/chunks/sed-SY63U2YX.js → chunks/sed-66XZQ75T.js} +1 -1
  104. package/dist/bin/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
  105. package/dist/bin/chunks/{sleep-MOJQBZMY.js → sleep-4O22Z4DI.js} +1 -1
  106. package/dist/bin/{shell/chunks/split-HIFKSV2A.js → chunks/split-OK6JHDWZ.js} +1 -1
  107. package/dist/bin/chunks/sqlite3-57ACN7ES.js +3 -0
  108. package/dist/bin/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
  109. package/dist/bin/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
  110. package/dist/bin/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
  111. package/dist/bin/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
  112. package/dist/bin/chunks/timeout-XMTXHNFF.js +3 -0
  113. package/dist/bin/{shell/chunks/tr-PVFO6FRY.js → chunks/tr-ETPC3LHV.js} +1 -1
  114. package/dist/bin/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
  115. package/dist/bin/chunks/worker.js +5 -0
  116. package/dist/bin/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
  117. package/dist/bin/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
  118. package/dist/bin/chunks/yes-2EQTNSIB.js +3 -0
  119. package/dist/bin/chunks/yq-T6S3IDKY.js +3 -0
  120. package/dist/bin/just-bash.js +299 -293
  121. package/dist/bin/shell/chunks/awk2-LCV2AUIX.js +3 -0
  122. package/dist/bin/{chunks/base64-TQ5KOCNW.js → shell/chunks/base64-OLYCF2PC.js} +1 -1
  123. package/dist/bin/shell/chunks/builtin-manifest-ORBIZM7I.js +3 -0
  124. package/dist/bin/shell/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
  125. package/dist/bin/{chunks/chmod-GX5SYTRL.js → shell/chunks/chmod-V5F4BXZ2.js} +1 -1
  126. package/dist/bin/{chunks/chunk-V4S4A7M6.js → shell/chunks/chunk-2TEF4USR.js} +1 -1
  127. package/dist/bin/{chunks/chunk-GBKR5KTT.js → shell/chunks/chunk-3ASHUC7C.js} +13 -13
  128. package/dist/bin/shell/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
  129. package/dist/bin/shell/chunks/chunk-4NYJ4ZTO.js +17 -0
  130. package/dist/bin/shell/chunks/{chunk-M3Z5NZXT.js → chunk-572NXISH.js} +1 -1
  131. package/dist/bin/shell/chunks/chunk-5NWK7A4R.js +13 -0
  132. package/dist/bin/{chunks/chunk-YXPSX3SI.js → shell/chunks/chunk-623Q77WZ.js} +1 -1
  133. package/dist/bin/shell/chunks/chunk-6NG4ULJM.js +7 -0
  134. package/dist/bin/{chunks/chunk-QFOXSCOD.js → shell/chunks/chunk-726WDFMQ.js} +1 -1
  135. package/dist/bin/shell/chunks/{chunk-DRPHNXG7.js → chunk-7LGT4LHQ.js} +1 -1
  136. package/dist/bin/shell/chunks/{chunk-MBREBDZQ.js → chunk-AIWBN36Z.js} +1 -1
  137. package/dist/bin/shell/chunks/{chunk-3ROYEBJI.js → chunk-AJ3CSZ34.js} +1 -1
  138. package/dist/bin/{chunks/chunk-VTAMGD42.js → shell/chunks/chunk-APEQNYAO.js} +1 -1
  139. package/dist/bin/shell/chunks/chunk-AQKIHX3Q.js +3 -0
  140. package/dist/bin/shell/chunks/chunk-BFLKIASG.js +7 -0
  141. package/dist/bin/shell/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
  142. package/dist/bin/shell/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
  143. package/dist/bin/shell/chunks/{chunk-T6OIISUC.js → chunk-BZJ77YQD.js} +1 -1
  144. package/dist/bin/{chunks/chunk-GR4ZHKXI.js → shell/chunks/chunk-C2BLJ3AE.js} +1 -1
  145. package/dist/bin/{chunks/chunk-KMYJMEON.js → shell/chunks/chunk-C45GTJTD.js} +1 -1
  146. package/dist/bin/shell/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
  147. package/dist/bin/shell/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
  148. package/dist/bin/shell/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
  149. package/dist/bin/{chunks/chunk-E54Z6VIE.js → shell/chunks/chunk-ERYPQAZE.js} +5 -5
  150. package/dist/bin/shell/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
  151. package/dist/bin/shell/chunks/chunk-HFVQCXYX.js +10 -0
  152. package/dist/bin/shell/chunks/chunk-HSWCKN2X.js +14 -0
  153. package/dist/bin/shell/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
  154. package/dist/bin/shell/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
  155. package/dist/bin/shell/chunks/chunk-IX6QY5JW.js +5 -0
  156. package/dist/bin/shell/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
  157. package/dist/bin/shell/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
  158. package/dist/bin/shell/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
  159. package/dist/bin/shell/chunks/{chunk-6JEDM6CZ.js → chunk-KH6YLKPE.js} +1 -1
  160. package/dist/bin/shell/chunks/chunk-KXSDVBJA.js +12 -0
  161. package/dist/bin/shell/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
  162. package/dist/bin/shell/chunks/{chunk-L345YZ6R.js → chunk-LVT5R45K.js} +1 -1
  163. package/dist/bin/shell/chunks/{chunk-PTUQEN6I.js → chunk-M345X45Z.js} +7 -7
  164. package/dist/bin/shell/chunks/{chunk-6FGMEZZP.js → chunk-NDS7PYKD.js} +1 -1
  165. package/dist/bin/shell/chunks/chunk-O3PNT72D.js +3 -0
  166. package/dist/bin/shell/chunks/chunk-OGOISDGZ.js +3 -0
  167. package/dist/bin/shell/chunks/chunk-OSW4MDDH.js +21 -0
  168. package/dist/bin/{chunks/chunk-ABP4OLJV.js → shell/chunks/chunk-OXEDIWNZ.js} +1 -1
  169. package/dist/bin/shell/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
  170. package/dist/bin/shell/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
  171. package/dist/bin/shell/chunks/{chunk-O2BCKSMK.js → chunk-PEJXCXSY.js} +1 -1
  172. package/dist/bin/{chunks/chunk-6KHZX4HU.js → shell/chunks/chunk-PLLMJHMV.js} +1 -1
  173. package/dist/bin/{chunks/chunk-6TUILMPB.js → shell/chunks/chunk-QELDDRV5.js} +1 -1
  174. package/dist/bin/shell/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
  175. package/dist/bin/{chunks/chunk-H7PD6FLC.js → shell/chunks/chunk-RE7Z53A3.js} +1 -1
  176. package/dist/bin/shell/chunks/chunk-SCQRBEQW.js +275 -0
  177. package/dist/bin/shell/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
  178. package/dist/bin/{chunks/chunk-CC2AQ6B7.js → shell/chunks/chunk-U6JTVQU6.js} +1 -1
  179. package/dist/bin/shell/chunks/chunk-UBA7DOWE.js +3 -0
  180. package/dist/bin/shell/chunks/{chunk-VPSBWWXM.js → chunk-UFAYH3WW.js} +7 -6
  181. package/dist/bin/shell/chunks/chunk-UPUFWGHR.js +3 -0
  182. package/dist/bin/{chunks/chunk-QJWFCA7P.js → shell/chunks/chunk-UU42WPB7.js} +1 -1
  183. package/dist/bin/shell/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
  184. package/dist/bin/shell/chunks/chunk-VMVXACZ5.js +6 -0
  185. package/dist/bin/shell/chunks/chunk-WLQ2KWS3.js +10 -0
  186. package/dist/bin/shell/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
  187. package/dist/bin/shell/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
  188. package/dist/bin/shell/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
  189. package/dist/bin/shell/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
  190. package/dist/bin/shell/chunks/{cp-YLP7ULVT.js → cp-XJWV46T5.js} +1 -1
  191. package/dist/bin/{chunks/curl-NHNZ46BU.js → shell/chunks/curl-HZ5SBTVY.js} +11 -11
  192. package/dist/bin/shell/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
  193. package/dist/bin/{chunks/diff-DM47S5PT.js → shell/chunks/diff-YLVT27CZ.js} +1 -1
  194. package/dist/bin/shell/chunks/dist-4NZ74CRE.js +141 -0
  195. package/dist/bin/shell/chunks/{du-DH76GZJ3.js → du-YNAJTGCR.js} +1 -1
  196. package/dist/bin/shell/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
  197. package/dist/bin/shell/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
  198. package/dist/bin/shell/chunks/find-3QDGII35.js +3 -0
  199. package/dist/bin/shell/chunks/flag-coverage-AGEO3F6X.js +3 -0
  200. package/dist/bin/shell/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
  201. package/dist/bin/shell/chunks/{gzip-UQZL4R74.js → gzip-W5CL2E2W.js} +1 -1
  202. package/dist/bin/{chunks/head-QKVY3SIO.js → shell/chunks/head-ABLEKDMV.js} +1 -1
  203. package/dist/bin/{chunks/help-HVIDHJ6M.js → shell/chunks/help-EXVKU23F.js} +1 -1
  204. package/dist/bin/shell/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
  205. package/dist/bin/{chunks/jq-YS4PR46D.js → shell/chunks/jq-5SOTL7D7.js} +1 -1
  206. package/dist/bin/shell/chunks/{js-exec-ZAAIZQWI.js → js-exec-LISDW7YC.js} +2 -2
  207. package/dist/bin/shell/chunks/{ls-5Z45FV4U.js → ls-EEX3YIOF.js} +1 -1
  208. package/dist/bin/shell/chunks/mkdir-KDEZTR53.js +3 -0
  209. package/dist/bin/shell/chunks/mktemp-OYQYUB5H.js +3 -0
  210. package/dist/bin/{chunks/mv-EOOP2TO3.js → shell/chunks/mv-35V6IA5V.js} +1 -1
  211. package/dist/bin/{chunks/od-2GXD4D5K.js → shell/chunks/od-TD5LZDUM.js} +1 -1
  212. package/dist/bin/{chunks/paste-DWWA3JTW.js → shell/chunks/paste-QJG6BYAP.js} +1 -1
  213. package/dist/bin/shell/chunks/{python3-TJ6DCPIA.js → python3-P6MZ44HK.js} +5 -5
  214. package/dist/bin/{chunks/readlink-EJ3IKLWW.js → shell/chunks/readlink-BF435HNQ.js} +1 -1
  215. package/dist/bin/shell/chunks/rg-B2DVJQVY.js +3 -0
  216. package/dist/bin/shell/chunks/rm-HCMKNRM2.js +3 -0
  217. package/dist/bin/{chunks/rmdir-PRNISPBA.js → shell/chunks/rmdir-WGVUYGPF.js} +1 -1
  218. package/dist/bin/{chunks/sed-SY63U2YX.js → shell/chunks/sed-66XZQ75T.js} +1 -1
  219. package/dist/bin/shell/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
  220. package/dist/bin/shell/chunks/{sleep-MOJQBZMY.js → sleep-4O22Z4DI.js} +1 -1
  221. package/dist/bin/{chunks/split-HIFKSV2A.js → shell/chunks/split-OK6JHDWZ.js} +1 -1
  222. package/dist/bin/shell/chunks/sqlite3-57ACN7ES.js +3 -0
  223. package/dist/bin/shell/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
  224. package/dist/bin/shell/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
  225. package/dist/bin/shell/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
  226. package/dist/bin/shell/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
  227. package/dist/bin/shell/chunks/timeout-XMTXHNFF.js +3 -0
  228. package/dist/bin/{chunks/tr-PVFO6FRY.js → shell/chunks/tr-ETPC3LHV.js} +1 -1
  229. package/dist/bin/shell/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
  230. package/dist/bin/shell/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
  231. package/dist/bin/shell/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
  232. package/dist/bin/shell/chunks/yes-2EQTNSIB.js +3 -0
  233. package/dist/bin/shell/chunks/yq-T6S3IDKY.js +3 -0
  234. package/dist/bin/shell/shell.js +369 -363
  235. package/dist/browser.d.ts +1 -1
  236. package/dist/bundle/browser.js +746 -726
  237. package/dist/bundle/chunks/awk2-TLK6FCHV.js +2 -0
  238. package/dist/bundle/chunks/{base64-MHVQ5XHI.js → base64-GUZMZ645.js} +1 -1
  239. package/dist/bundle/chunks/builtin-manifest-7MJJDZ2T.js +2 -0
  240. package/dist/bundle/chunks/{cat-VZBWBIJB.js → cat-LG4YGKUE.js} +1 -1
  241. package/dist/bundle/chunks/{chmod-TEY5MD2W.js → chmod-XUKPG2M4.js} +1 -1
  242. package/dist/bundle/chunks/{chunk-E2F4A3CM.js → chunk-2A4OZBCS.js} +5 -5
  243. package/dist/bundle/chunks/{chunk-WNH3HOQA.js → chunk-353VO5TF.js} +1 -1
  244. package/dist/bundle/chunks/chunk-37UJACD6.js +9 -0
  245. package/dist/bundle/chunks/{chunk-H3A45X3W.js → chunk-3LGQ6XEC.js} +1 -1
  246. package/dist/bundle/chunks/{chunk-P57S6Z6R.js → chunk-3ZY5QX3G.js} +1 -1
  247. package/dist/bundle/chunks/{chunk-45QZRGYF.js → chunk-4VU4IF3W.js} +7 -6
  248. package/dist/bundle/chunks/{chunk-SIOONII3.js → chunk-52W2IWA7.js} +1 -1
  249. package/dist/bundle/chunks/chunk-5IB57TIJ.js +274 -0
  250. package/dist/bundle/chunks/chunk-5J4S2LP5.js +2 -0
  251. package/dist/bundle/chunks/{chunk-PCPW54JH.js → chunk-5LDRJ22P.js} +1 -1
  252. package/dist/bundle/chunks/{chunk-BKUWXPEM.js → chunk-654CJKE3.js} +1 -1
  253. package/dist/bundle/chunks/{chunk-EZNS4GF7.js → chunk-67ODVGSB.js} +1 -1
  254. package/dist/bundle/chunks/{chunk-6QF3PCMO.js → chunk-6HQQON3N.js} +1 -1
  255. package/dist/bundle/chunks/chunk-6L6OYVLY.js +2 -0
  256. package/dist/bundle/chunks/{chunk-U57DSHID.js → chunk-6P2DITXT.js} +1 -1
  257. package/dist/bundle/chunks/chunk-74IR77AZ.js +11 -0
  258. package/dist/bundle/chunks/{chunk-S3ENGQML.js → chunk-7DVD6YCI.js} +1 -1
  259. package/dist/bundle/chunks/{chunk-HXWB4Z5X.js → chunk-7II7XIVI.js} +1 -1
  260. package/dist/bundle/chunks/{chunk-AYSZ5MAE.js → chunk-A3C4Z3Q3.js} +1 -1
  261. package/dist/bundle/chunks/chunk-A6SU3BZX.js +6 -0
  262. package/dist/bundle/chunks/{chunk-6HO6HX7V.js → chunk-AMXNXHXK.js} +1 -1
  263. package/dist/bundle/chunks/{chunk-QJ7OXJAZ.js → chunk-BLG7RWH4.js} +1 -1
  264. package/dist/bundle/chunks/chunk-BMBITA6Y.js +2 -0
  265. package/dist/bundle/chunks/{chunk-XQ2ZZFO6.js → chunk-BQTWRHZR.js} +2 -2
  266. package/dist/bundle/chunks/{chunk-WE7BJ7YU.js → chunk-BZ2OMW2T.js} +1 -1
  267. package/dist/bundle/chunks/{chunk-S6DNKKUL.js → chunk-CM4T4GB4.js} +1 -1
  268. package/dist/bundle/chunks/{chunk-CH7SUFFO.js → chunk-CORCIYJD.js} +1 -1
  269. package/dist/bundle/chunks/{chunk-LGIJSCWH.js → chunk-EQDVNHQS.js} +1 -1
  270. package/dist/bundle/chunks/{chunk-U4K5ZDWK.js → chunk-EZEO6MFE.js} +1 -1
  271. package/dist/bundle/chunks/{chunk-SE23TEGG.js → chunk-EZT6M2HG.js} +1 -1
  272. package/dist/bundle/chunks/{chunk-4MJ7VJG4.js → chunk-H7UVJSZR.js} +1 -1
  273. package/dist/bundle/chunks/{chunk-5EI7WSRV.js → chunk-HYQGYXGZ.js} +1 -1
  274. package/dist/bundle/chunks/{chunk-6IA4DXG2.js → chunk-IPKSYZ3R.js} +1 -1
  275. package/dist/bundle/chunks/{chunk-TLPMB3FO.js → chunk-KJBPGFZD.js} +1 -1
  276. package/dist/bundle/chunks/chunk-L7NEGEOJ.js +16 -0
  277. package/dist/bundle/chunks/{chunk-YFFU74KY.js → chunk-MJEJ7QEY.js} +1 -1
  278. package/dist/bundle/chunks/{chunk-QJFYYEFV.js → chunk-N36I27VM.js} +1 -1
  279. package/dist/bundle/chunks/chunk-N5L7E4EL.js +6 -0
  280. package/dist/bundle/chunks/{chunk-6QAM55HM.js → chunk-NFODJFHN.js} +1 -1
  281. package/dist/bundle/chunks/{chunk-IXFQXNL4.js → chunk-NFW4YKDO.js} +1 -1
  282. package/dist/bundle/chunks/{chunk-HCKTU6IR.js → chunk-NOX3PCUH.js} +1 -1
  283. package/dist/bundle/chunks/{chunk-MQKGGNPS.js → chunk-NXBUT5V2.js} +2 -2
  284. package/dist/bundle/chunks/{chunk-4KZT23KR.js → chunk-O5BHWBYH.js} +1 -1
  285. package/dist/bundle/chunks/{chunk-DVSA72LH.js → chunk-QTL2XC4B.js} +1 -1
  286. package/dist/bundle/chunks/chunk-RK2WBVP4.js +2 -0
  287. package/dist/bundle/chunks/{chunk-BLPYR4TN.js → chunk-RVBBGZ22.js} +1 -1
  288. package/dist/bundle/chunks/{chunk-PS2RJNZZ.js → chunk-SXQJYLP7.js} +1 -1
  289. package/dist/bundle/chunks/{chunk-MWL2I5BV.js → chunk-T7OAZEXT.js} +1 -1
  290. package/dist/bundle/chunks/{chunk-O452S4KX.js → chunk-URIKBXSE.js} +1 -1
  291. package/dist/bundle/chunks/{chunk-6BSOPPZH.js → chunk-UVQC75LS.js} +7 -7
  292. package/dist/bundle/chunks/chunk-VCREDMWH.js +4 -0
  293. package/dist/bundle/chunks/{chunk-DDPD7SIB.js → chunk-VQ6EUBJ3.js} +1 -1
  294. package/dist/bundle/chunks/chunk-VQEB6E2M.js +13 -0
  295. package/dist/bundle/chunks/{chunk-R2FBRMDU.js → chunk-VWUMR4IC.js} +1 -1
  296. package/dist/bundle/chunks/{chunk-XXBIOG4R.js → chunk-WDY2TNMK.js} +1 -1
  297. package/dist/bundle/chunks/chunk-XT7EK6BR.js +9 -0
  298. package/dist/bundle/chunks/{chunk-BS6EJR2R.js → chunk-XUTEQMTL.js} +5 -5
  299. package/dist/bundle/chunks/{chunk-KIGPB52X.js → chunk-XZ34OGNM.js} +1 -1
  300. package/dist/bundle/chunks/{chunk-FSKXIFYT.js → chunk-Y6UHNLT5.js} +1 -1
  301. package/dist/bundle/chunks/chunk-YUITEK6N.js +12 -0
  302. package/dist/bundle/chunks/chunk-YZCPEJRE.js +20 -0
  303. package/dist/bundle/chunks/chunk-ZIQS5QAW.js +5 -0
  304. package/dist/bundle/chunks/chunk-ZUEPJPYA.js +2 -0
  305. package/dist/bundle/chunks/{column-QJI65SH2.js → column-T4LGMRJG.js} +1 -1
  306. package/dist/bundle/chunks/{cp-UR762VVT.js → cp-ZDDVNITX.js} +1 -1
  307. package/dist/bundle/chunks/{curl-K4WT7UPN.js → curl-RCRD36LD.js} +11 -11
  308. package/dist/bundle/chunks/{cut-FMDNVWQN.js → cut-35WER2E2.js} +1 -1
  309. package/dist/bundle/chunks/{diff-R7TXVVLN.js → diff-Z3XOLW44.js} +1 -1
  310. package/dist/bundle/chunks/{du-EQKH3UNA.js → du-YBSJVBXP.js} +1 -1
  311. package/dist/bundle/chunks/{expr-A5XITHQD.js → expr-KSNRNE7V.js} +1 -1
  312. package/dist/bundle/chunks/{file-6AYYTULJ.js → file-XH37HMGV.js} +1 -1
  313. package/dist/bundle/chunks/find-3AONTPPM.js +2 -0
  314. package/dist/bundle/chunks/flag-coverage-6YGO7STE.js +2 -0
  315. package/dist/bundle/chunks/{grep-Q2O5EIXQ.js → grep-WW5KJPUG.js} +1 -1
  316. package/dist/bundle/chunks/{gzip-KC5ENBD2.js → gzip-ISZXQNJJ.js} +1 -1
  317. package/dist/bundle/chunks/{head-6UIPFWVJ.js → head-VYXZQLPZ.js} +1 -1
  318. package/dist/bundle/chunks/{help-QDDMBDU7.js → help-62M75TSG.js} +1 -1
  319. package/dist/bundle/chunks/{html-to-markdown-PE6BPRPA.js → html-to-markdown-4LXS3A44.js} +1 -1
  320. package/dist/bundle/chunks/{jq-UKAA3QWU.js → jq-3IVOWP3G.js} +1 -1
  321. package/dist/bundle/chunks/{js-exec-MUZRDUJ3.js → js-exec-T2WEE4KG.js} +2 -2
  322. package/dist/bundle/chunks/js-exec-worker.js +1 -0
  323. package/dist/bundle/chunks/{ls-WH5S4PPL.js → ls-FC3CSHKE.js} +1 -1
  324. package/dist/bundle/chunks/mkdir-DPFWDY25.js +2 -0
  325. package/dist/bundle/chunks/mktemp-SW2AHXZW.js +2 -0
  326. package/dist/bundle/chunks/{mv-WE7DBLEK.js → mv-PWCFXEF2.js} +1 -1
  327. package/dist/bundle/chunks/{od-Z4AIL3P4.js → od-VJ6PBBEI.js} +1 -1
  328. package/dist/bundle/chunks/{paste-ZNHNSRBW.js → paste-TIQETHSO.js} +1 -1
  329. package/dist/bundle/chunks/{python3-W4UMQJAQ.js → python3-6JEP7ZZK.js} +5 -5
  330. package/dist/bundle/chunks/{readlink-JSRKXLLQ.js → readlink-7XGQ3PL7.js} +1 -1
  331. package/dist/bundle/chunks/rg-2OPJ5V3D.js +2 -0
  332. package/dist/bundle/chunks/rm-AZZM5DCE.js +2 -0
  333. package/dist/bundle/chunks/{rmdir-3WTXMVKI.js → rmdir-YXYSZD4X.js} +1 -1
  334. package/dist/bundle/chunks/{sed-6G32B25J.js → sed-HYSBLGO5.js} +1 -1
  335. package/dist/bundle/chunks/{seq-B6KDLMYQ.js → seq-M2S4FRN4.js} +1 -1
  336. package/dist/bundle/chunks/{sleep-25QUPVDK.js → sleep-YC4HFEGC.js} +1 -1
  337. package/dist/bundle/chunks/{split-HUKVGJTW.js → split-UOPIWKKE.js} +1 -1
  338. package/dist/bundle/chunks/sqlite3-XCROTL6G.js +2 -0
  339. package/dist/bundle/chunks/{stat-LXFZND2P.js → stat-I3FPUTR7.js} +1 -1
  340. package/dist/bundle/chunks/{tail-UBGSN4JF.js → tail-WK3WACZK.js} +1 -1
  341. package/dist/bundle/chunks/{tar-LE7LAAIX.js → tar-VZYMNZV2.js} +1 -1
  342. package/dist/bundle/chunks/{time-NERE2JJ2.js → time-N6J6DC6C.js} +1 -1
  343. package/dist/bundle/chunks/timeout-UDR5J2MP.js +2 -0
  344. package/dist/bundle/chunks/{tr-UI2LA3GA.js → tr-VI5PIA4A.js} +1 -1
  345. package/dist/bundle/chunks/{which-UWVKETYW.js → which-BP5YY5BR.js} +1 -1
  346. package/dist/bundle/chunks/worker.js +5 -0
  347. package/dist/bundle/chunks/{xan-UIL24CGT.js → xan-DL576EIT.js} +1 -1
  348. package/dist/bundle/chunks/xan-view-GJVN6IHX.js +2 -0
  349. package/dist/bundle/chunks/yes-OVJMX6NM.js +2 -0
  350. package/dist/bundle/chunks/yq-KYPU4LQP.js +2 -0
  351. package/dist/bundle/index.cjs +1079 -1059
  352. package/dist/bundle/index.js +345 -339
  353. package/dist/commands/mktemp/mktemp.d.ts +4 -0
  354. package/dist/commands/registry.d.ts +1 -1
  355. package/dist/commands/which/which.d.ts +10 -0
  356. package/dist/commands/yes/yes.d.ts +4 -0
  357. package/dist/custom-commands.d.ts +12 -0
  358. package/dist/fs/create-exclusive.d.ts +30 -0
  359. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +8 -1
  360. package/dist/fs/interface.d.ts +37 -0
  361. package/dist/fs/mountable-fs/mountable-fs.d.ts +18 -1
  362. package/dist/fs/overlay-fs/overlay-fs.d.ts +19 -1
  363. package/dist/fs/path-utils.d.ts +0 -4
  364. package/dist/fs/read-write-fs/read-write-fs.d.ts +22 -1
  365. package/dist/index.d.cts +1 -1
  366. package/dist/index.d.ts +1 -1
  367. package/dist/interpreter/expansion/array-prefix-suffix.d.ts +2 -1
  368. package/dist/interpreter/expansion/parameter-ops.d.ts +1 -0
  369. package/dist/interpreter/expansion/pattern-removal.d.ts +3 -0
  370. package/dist/interpreter/expansion/variable.d.ts +1 -1
  371. package/dist/interpreter/helpers/loop.d.ts +32 -0
  372. package/dist/limits.d.ts +0 -3
  373. package/dist/network/dns-pin.d.ts +1 -32
  374. package/dist/network/fetch.d.ts +1 -1
  375. package/dist/security/trusted-globals.d.ts +8 -0
  376. package/dist/types.d.ts +6 -0
  377. package/package.json +3 -4
  378. package/dist/bin/chunks/awk2-NTRVFXRA.js +0 -3
  379. package/dist/bin/chunks/chunk-3PCPQIUD.js +0 -3
  380. package/dist/bin/chunks/chunk-6JUPBMCR.js +0 -13
  381. package/dist/bin/chunks/chunk-BB5VTPMQ.js +0 -16
  382. package/dist/bin/chunks/chunk-CN4JKMTR.js +0 -8
  383. package/dist/bin/chunks/chunk-F2PYTUMR.js +0 -9
  384. package/dist/bin/chunks/chunk-HWI42GQO.js +0 -7
  385. package/dist/bin/chunks/chunk-HWK7KFGB.js +0 -3
  386. package/dist/bin/chunks/chunk-I57EACSL.js +0 -3
  387. package/dist/bin/chunks/chunk-ONF4KUYV.js +0 -13
  388. package/dist/bin/chunks/chunk-PRVPFKTC.js +0 -276
  389. package/dist/bin/chunks/chunk-RTN6X652.js +0 -11
  390. package/dist/bin/chunks/chunk-RVPTAYDS.js +0 -4
  391. package/dist/bin/chunks/chunk-U5JLGI56.js +0 -21
  392. package/dist/bin/chunks/dist-5MWO25Y4.js +0 -141
  393. package/dist/bin/chunks/find-MHC4QV6H.js +0 -3
  394. package/dist/bin/chunks/flag-coverage-LLAQBVIG.js +0 -3
  395. package/dist/bin/chunks/mkdir-YJ3SOVRP.js +0 -3
  396. package/dist/bin/chunks/rg-WHVR3YDT.js +0 -3
  397. package/dist/bin/chunks/rm-B4LVIG7A.js +0 -3
  398. package/dist/bin/chunks/sqlite3-CXQTZRPZ.js +0 -3
  399. package/dist/bin/chunks/timeout-RQOWSWYG.js +0 -3
  400. package/dist/bin/chunks/yq-CWBZMGUV.js +0 -3
  401. package/dist/bin/shell/chunks/awk2-NTRVFXRA.js +0 -3
  402. package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +0 -3
  403. package/dist/bin/shell/chunks/chunk-6JUPBMCR.js +0 -13
  404. package/dist/bin/shell/chunks/chunk-BB5VTPMQ.js +0 -16
  405. package/dist/bin/shell/chunks/chunk-CN4JKMTR.js +0 -8
  406. package/dist/bin/shell/chunks/chunk-F2PYTUMR.js +0 -9
  407. package/dist/bin/shell/chunks/chunk-HWI42GQO.js +0 -7
  408. package/dist/bin/shell/chunks/chunk-HWK7KFGB.js +0 -3
  409. package/dist/bin/shell/chunks/chunk-I57EACSL.js +0 -3
  410. package/dist/bin/shell/chunks/chunk-ONF4KUYV.js +0 -13
  411. package/dist/bin/shell/chunks/chunk-PRVPFKTC.js +0 -276
  412. package/dist/bin/shell/chunks/chunk-RTN6X652.js +0 -11
  413. package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +0 -4
  414. package/dist/bin/shell/chunks/chunk-U5JLGI56.js +0 -21
  415. package/dist/bin/shell/chunks/dist-5MWO25Y4.js +0 -141
  416. package/dist/bin/shell/chunks/find-MHC4QV6H.js +0 -3
  417. package/dist/bin/shell/chunks/flag-coverage-LLAQBVIG.js +0 -3
  418. package/dist/bin/shell/chunks/mkdir-YJ3SOVRP.js +0 -3
  419. package/dist/bin/shell/chunks/rg-WHVR3YDT.js +0 -3
  420. package/dist/bin/shell/chunks/rm-B4LVIG7A.js +0 -3
  421. package/dist/bin/shell/chunks/sqlite3-CXQTZRPZ.js +0 -3
  422. package/dist/bin/shell/chunks/timeout-RQOWSWYG.js +0 -3
  423. package/dist/bin/shell/chunks/yq-CWBZMGUV.js +0 -3
  424. package/dist/bundle/chunks/awk2-VS5QVYHU.js +0 -2
  425. package/dist/bundle/chunks/chunk-2SMD2AUA.js +0 -3
  426. package/dist/bundle/chunks/chunk-35MBA3VY.js +0 -12
  427. package/dist/bundle/chunks/chunk-3OBCZP7T.js +0 -12
  428. package/dist/bundle/chunks/chunk-4CC3OZPU.js +0 -2
  429. package/dist/bundle/chunks/chunk-A257L6QO.js +0 -7
  430. package/dist/bundle/chunks/chunk-ATGOUOX2.js +0 -15
  431. package/dist/bundle/chunks/chunk-BRJERIF4.js +0 -2
  432. package/dist/bundle/chunks/chunk-FTET43KM.js +0 -2
  433. package/dist/bundle/chunks/chunk-GRUZ4SBY.js +0 -275
  434. package/dist/bundle/chunks/chunk-LRFR25IP.js +0 -8
  435. package/dist/bundle/chunks/chunk-RWQWFXMH.js +0 -10
  436. package/dist/bundle/chunks/chunk-Y6JBSHCM.js +0 -20
  437. package/dist/bundle/chunks/chunk-ZBUZKIPX.js +0 -6
  438. package/dist/bundle/chunks/find-RLKBCGJR.js +0 -2
  439. package/dist/bundle/chunks/flag-coverage-YQGACUSN.js +0 -2
  440. package/dist/bundle/chunks/mkdir-Z6MMWH3D.js +0 -2
  441. package/dist/bundle/chunks/rg-JKB7DR66.js +0 -2
  442. package/dist/bundle/chunks/rm-IGPLE632.js +0 -2
  443. package/dist/bundle/chunks/sqlite3-DQNCWDG5.js +0 -2
  444. package/dist/bundle/chunks/timeout-37GM7IIL.js +0 -2
  445. package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +0 -2
  446. package/dist/bundle/chunks/yq-ZRNZKDLE.js +0 -2
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{d as C}from"./chunk-MBREBDZQ.js";import{a as g}from"./chunk-NE4R2FVV.js";import{a as v}from"./chunk-I4IRHQDW.js";var y=`Usage: rmdir [-pv] DIRECTORY...
3
+ import{d as C}from"./chunk-AIWBN36Z.js";import{a as v}from"./chunk-I4IRHQDW.js";import{a as g}from"./chunk-NE4R2FVV.js";var y=`Usage: rmdir [-pv] DIRECTORY...
4
4
  Remove empty directories.
5
5
 
6
6
  Options:
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{a as n,b as i,c as r}from"./chunk-6KHZX4HU.js";import{a,b as s}from"./chunk-MUFNRCMY.js";var f={name:"head",summary:"output the first part of files",usage:"head [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the first NUM bytes","-n, --lines=NUM print the first NUM lines (default 10)","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},m={name:"head",async execute(t,l){if(s(t))return a(f);let e=n(t,"head");if(!e.ok)return e.error;let{lines:o,bytes:p}=e.options;return i(l,e.options,"head",d=>r(d,o,p))}},g={name:"head",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0};export{m as a,g as b};
3
+ import{a as n,b as i,c as r}from"./chunk-PLLMJHMV.js";import{a,b as s}from"./chunk-MUFNRCMY.js";var f={name:"head",summary:"output the first part of files",usage:"head [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the first NUM bytes","-n, --lines=NUM print the first NUM lines (default 10)","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},m={name:"head",async execute(t,l){if(s(t))return a(f);let e=n(t,"head");if(!e.ok)return e.error;let{lines:o,bytes:p}=e.options;return i(l,e.options,"head",d=>r(d,o,p))}},g={name:"head",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0};export{m as a,g as b};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
+ var d={export:{kind:"handler",phase:"early"},unset:{kind:"handler",phase:"early"},exit:{kind:"handler",phase:"early"},local:{kind:"handler",phase:"early"},set:{kind:"handler",phase:"early"},break:{kind:"handler",phase:"early"},continue:{kind:"handler",phase:"early"},return:{kind:"handler",phase:"early"},shift:{kind:"handler",phase:"early"},getopts:{kind:"handler",phase:"early"},compgen:{kind:"handler",phase:"early"},complete:{kind:"handler",phase:"early"},compopt:{kind:"handler",phase:"early"},pushd:{kind:"handler",phase:"early"},popd:{kind:"handler",phase:"early"},dirs:{kind:"handler",phase:"early"},source:{kind:"handler",phase:"early"},".":{kind:"handler",phase:"early"},read:{kind:"handler",phase:"early"},mapfile:{kind:"handler",phase:"early"},readarray:{kind:"handler",phase:"early"},declare:{kind:"handler",phase:"early"},typeset:{kind:"handler",phase:"early"},readonly:{kind:"handler",phase:"early"},eval:{kind:"handler",phase:"late",posixEarly:!0},cd:{kind:"handler",phase:"late"},":":{kind:"handler",phase:"late"},true:{kind:"handler",phase:"late"},false:{kind:"handler",phase:"late"},let:{kind:"handler",phase:"late"},command:{kind:"handler",phase:"late"},builtin:{kind:"handler",phase:"late"},shopt:{kind:"handler",phase:"late"},exec:{kind:"handler",phase:"late"},wait:{kind:"handler",phase:"late"},type:{kind:"handler",phase:"late"},hash:{kind:"handler",phase:"late"},help:{kind:"handler",phase:"late"},"[":{kind:"handler",phase:"late"},test:{kind:"handler",phase:"late"},echo:{kind:"registry"},printf:{kind:"registry"},pwd:{kind:"registry"},alias:{kind:"registry"},unalias:{kind:"registry"},history:{kind:"registry"},bg:{kind:"unimplemented"},caller:{kind:"unimplemented"},disown:{kind:"unimplemented"},enable:{kind:"unimplemented"},fc:{kind:"unimplemented"},fg:{kind:"unimplemented"},jobs:{kind:"unimplemented"},kill:{kind:"unimplemented"},suspend:{kind:"unimplemented"},times:{kind:"unimplemented"},trap:{kind:"unimplemented"},ulimit:{kind:"unimplemented"},umask:{kind:"unimplemented"}};for(let e of Object.values(d))Object.freeze(e);Object.freeze(d);var l=d,i=new Set(Object.keys(l)),r=new Set(Object.entries(l).filter(([,e])=>e.kind==="unimplemented").map(([e])=>e)),a=l;function t(e){let n=Object.hasOwn(a,e)?a[e]:void 0;return n?.kind==="handler"?n.phase:void 0}function h(e){let n=Object.hasOwn(a,e)?a[e]:void 0;return n?.kind==="handler"&&n.posixEarly===!0}export{l as a,i as b,r as c,t as d,h as e};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
+ import*as M from"node:async_hooks";import*as $ from"node:module";var v;function T(){return v||w(),v}function w(){let a=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","NODE_ENV","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},...["on","once","addListener","prependListener","prependOnceListener"].map(t=>({prop:t,target:process,violationType:"process_exception_handler",strategy:"throw",reason:"process-global listeners can outlive the sandbox and lose its security context"})),{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&a.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}let e=a.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}});return v??=new Set(e.map(({violationType:t})=>t)),e}var j=performance.timeOrigin,V=performance.now.bind(performance);function k(){return Math.floor(j+V())}var E=new Set(["function_constructor","async_function_constructor","generator_function_constructor","async_generator_function_constructor"]);function D(a){let e=a?.find(t=>E.has(t));if(e)throw new RangeError(`defenseInDepth.excludeViolationTypes cannot disable the non-excludable "${e}" protection`)}var R=`
4
+
5
+ This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`;function O(a,e,t){let i=t&&!E.has(e)?`
6
+
7
+ If this access is required by trusted host-runtime code, add "${e}" to defenseInDepth.excludeViolationTypes.`:"";return a+R+i}var f=typeof __BROWSER__<"u"&&__BROWSER__;function S(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var P=null,m=null,A=null;if(!f)try{P=M.AsyncLocalStorage,m=$,A=m.Module??m.default??null}catch{}var d=class extends Error{violation;constructor(e,t){super(O(e,t.type,t.type==="error_prepare_stack_trace"||T().has(t.type))),this.violation=t,this.name="SecurityViolationError"}},p=!f&&P?new P:null,L=1e3;function G(a,e,...t){return p.run(a,()=>e(...t))}var N={enabled:!0,auditMode:!1,processLifetimeIntrinsicHardening:!1};function I(){return!f&&typeof m?.registerHooks=="function"}function C(a){let e=typeof a=="boolean"?{enabled:a}:a??{};if(D(e.excludeViolationTypes),e.enabled!==void 0&&e.enabled!==!0&&e.enabled!==!1&&e.enabled!=="auto")throw new RangeError('defenseInDepth.enabled must be true, false, or "auto"');let t={...N,...e},i=t.enabled==="auto"?"auto":t.enabled?"enabled":"disabled",r={...t,enabled:i!=="disabled",requested:i};return r.excludeViolationTypes&&(r.excludeViolationTypes=[...new Set(r.excludeViolationTypes)].sort()),r}function H(a,e){if(a.enabled!==e.enabled||a.auditMode!==e.auditMode||a.processLifetimeIntrinsicHardening!==e.processLifetimeIntrinsicHardening||a.onViolation!==e.onViolation)return!1;let t=a.excludeViolationTypes??[],i=e.excludeViolationTypes??[];return t.length===i.length&&t.every((r,o)=>r===i[o])}var B=class a{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];temporaryIntrinsicDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=C(e);if(!a.instance)a.instance=new a(t);else{let i=a.instance.config;if(!H(t,i))throw new Error("DefenseInDepthBox config conflict: all resolved defense options, including exclusions and the violation callback, must match across Bash instances. Call DefenseInDepthBox.resetInstance() between incompatible configurations.")}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null),a.trustedExecutionDepth.clear()}static isInSandboxedContext(){return p?p?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(p)return p?.getStore()?.executionId}static enterTrustedScope(e){let t=a.trustedExecutionDepth.get(e)??0;a.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=a.trustedExecutionDepth.get(e);if(t){if(t===1){a.trustedExecutionDepth.delete(e);return}a.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(a.trustedExecutionDepth.get(e)??0)>0:!1}static isTrustedContext(e){return!e||e.forceUntrusted?!1:e.trusted===!0||a.isTrustedScopeActive(e.executionId)}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}static bindCurrentContext(e){if(!p)return e;let t=p.getStore(),i=t?.sandboxActive===!0?t.executionId:void 0;if(!i)return e;let o=a.instance?.getCachedContext(i)??{sandboxActive:!0,executionId:i},n=t?.forceUntrusted?{...o,forceUntrusted:!0}:o;return((...s)=>{let c=a.instance;if(!(c&&!c.isExecutionIdActive(i)&&(c.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!c.config.auditMode)))return G(n,e,...s)})}isEnabled(){return this.getStatus().state==="enabled"}getStatus(){let e=I();return this.config.requested==="disabled"?{requested:"disabled",state:"disabled",level:"none",contextualDynamicImportProtection:e,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort"}:!p||f?{requested:this.config.requested,state:"unsupported",level:"none",contextualDynamicImportProtection:!1,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:"context-aware ESM loader hooks (node:module.registerHooks) are unavailable"}:{requested:this.config.requested,state:"enabled",level:this.config.auditMode?"none":e?"full":"best-effort",contextualDynamicImportProtection:e,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:this.config.auditMode?"audit mode records violations but does not block them":e?void 0:"best-effort protection; context-aware ESM loader hooks are unavailable"}}updateConfig(e){if(this.refCount>0)throw new Error("DefenseInDepthBox configuration cannot change while protection is active");this.config=C({...this.config,...e})}activate(){if(!f&&this.config.enabled&&!p)throw new Error("DefenseInDepthBox: enabled protection requires node:async_hooks and node:module");if(f||!this.config.enabled){let i=S(),r=!1;return{run:o=>r?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):o(),deactivate:()=>{r=!0},executionId:i}}if(this.refCount++,this.refCount===1){try{this.applyPatches()}catch(i){throw this.restorePatches(),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0,i}this.activationTime=Date.now()}let e=S(),t=!1;return{run:i=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),p.run({sandboxActive:!0,executionId:e},i)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),a.trustedExecutionDepth.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!p)return e();let t=p.getStore();if(!t)return e();let{executionId:i}=t;return p.run({...t,trusted:!0,forceUntrusted:!1},()=>{a.enterTrustedScope(i);try{let r=e();return typeof r=="object"&&r!==null&&"finally"in r&&typeof r.finally=="function"?r.finally(()=>{a.leaveTrustedScope(i)}):(a.leaveTrustedScope(i),r)}catch(r){throw a.leaveTrustedScope(i),r}})}static async runTrustedAsync(e){if(!p)return e();let t=p.getStore();if(!t)return e();let{executionId:i}=t;return await p.run({...t,trusted:!0,forceUntrusted:!1},async()=>{a.enterTrustedScope(i);try{return await e()}finally{a.leaveTrustedScope(i)}})}static async runUntrustedAsync(e){if(!p)return e();let t=p.getStore();return t?p.run({...t,trusted:!1,forceUntrusted:!0},e):e()}shouldBlock(){if(f||this.config.auditMode||!p)return!1;let e=p?.getStore();return!(e?.sandboxActive!==!0||a.isTrustedContext(e))}shouldAudit(){if(!this.config.auditMode||!p)return!1;let e=p.getStore();return e?.sandboxActive===!0&&!a.isTrustedContext(e)}recordViolation(e,t,i){let r={timestamp:k(),type:e,message:i,path:t,stack:new Error().stack,executionId:p?.getStore()?.executionId};if(this.violations.length<L&&this.violations.push(r),this.config.onViolation)try{this.config.onViolation(r)}catch(o){console.debug("[DefenseInDepthBox] onViolation callback threw:",o instanceof Error?o.message:o)}return r}createBlockingProxy(e,t,i){let r=this;return new Proxy(e,{apply(o,n,s){if(r.shouldBlock()){let c=`${t} is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} called (audit mode)`),Reflect.apply(o,n,s)},construct(o,n,s){if(r.shouldBlock()){let c=`${t} constructor is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} constructor called (audit mode)`),Reflect.construct(o,n,s)}})}createBlockingObjectProxy(e,t,i,r){let o=this;return new Proxy(e,{get(n,s,c){if(o.shouldBlock()){if(r&&typeof s=="string"&&r.has(s))return Reflect.get(n,s,c);let l=`${t}.${String(s)}`,u=`${l} is blocked during script execution`,h=o.recordViolation(i,l,u);throw new d(u,h)}if(o.shouldAudit()){let l=`${t}.${String(s)}`;o.recordViolation(i,l,`${l} accessed (audit mode)`)}return Reflect.get(n,s,c)},set(n,s,c,l){if(o.shouldBlock()){let u=`${t}.${String(s)}`,h=`${u} modification is blocked during script execution`,y=o.recordViolation(i,u,h);throw new d(h,y)}return t==="process.env"&&s==="DEBUG"?Reflect.set(n,s,c):Reflect.set(n,s,c,l)},ownKeys(n){if(o.shouldBlock()){let s=`${t} enumeration is blocked during script execution`,c=o.recordViolation(i,t,s);throw new d(s,c)}return Reflect.ownKeys(n)},getOwnPropertyDescriptor(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} descriptor access is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.getOwnPropertyDescriptor(n,s)},has(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} existence check is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.has(n,s)},deleteProperty(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} deletion is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.deleteProperty(n,s)},setPrototypeOf(n,s){if(o.shouldBlock()){let c=`${t} setPrototypeOf is blocked during script execution`,l=o.recordViolation(i,t,c);throw new d(c,l)}return Reflect.setPrototypeOf(n,s)},defineProperty(n,s,c){if(o.shouldBlock()){let l=`${t}.${String(s)}`,u=`${l} defineProperty is blocked during script execution`,h=o.recordViolation(i,l,u);throw new d(u,h)}return Reflect.defineProperty(n,s,c)}})}createReadonlyObjectProxy(e,t,i){let r=this,o=n=>{let s=`${t} ${n} is blocked during script execution`,c=r.recordViolation(i,t,s);throw new d(s,c)};return new Proxy(e,{set(n,s,c,l){return r.shouldBlock()&&o("modification"),Reflect.set(n,s,c,l)},defineProperty(n,s,c){return r.shouldBlock()&&o("defineProperty"),Reflect.defineProperty(n,s,c)},deleteProperty(n,s){return r.shouldBlock()&&o("deletion"),Reflect.deleteProperty(n,s)},setPrototypeOf(n,s){return r.shouldBlock()&&o("setPrototypeOf"),Reflect.setPrototypeOf(n,s)},preventExtensions(n){return r.shouldBlock()&&o("preventExtensions"),Reflect.preventExtensions(n)}})}applyPatches(){this.patchFailures=[];let e=w(),t=new Set(this.config.excludeViolationTypes??[]),i=new Set(["process_send","process_channel","process_stdout","process_stderr"]),r=[];for(let s of e)if(!t.has(s.violationType)&&!i.has(s.violationType)){if(s.strategy==="freeze"){r.push(s);continue}this.applyPatch(s)}this.protectConstructorChain(),t.has("error_prepare_stack_trace")||this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),I()&&this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.protectProxyRevocable();let o=["Function.prototype.constructor","Module._load","Module._resolveFilename"],n=this.patchFailures.filter(s=>o.includes(s));if(n.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${n.join(", ")}`);this.config.processLifetimeIntrinsicHardening||this.protectReversibleIntrinsics(r);for(let s of r)this.applyPatch(s,this.config.processLifetimeIntrinsicHardening===!0);this.config.processLifetimeIntrinsicHardening&&this.lockWellKnownSymbols()}protectReversibleIntrinsics(e){let t=new Set,i=(n,s)=>{let c=Object.getOwnPropertyDescriptor(n,s);!c||!("value"in c)||c.writable!==!0||c.configurable!==!0||(this.temporaryIntrinsicDescriptors.push({target:n,prop:s,descriptor:c}),Object.defineProperty(n,s,{...c,writable:!1}))};for(let{target:n,prop:s}of e){let c=n[s];if(!(typeof c!="object"||c===null)){t.add(c);for(let l of Reflect.ownKeys(c))i(c,l)}}let r=[];for(let n of[Array,Map,Set,RegExp,Promise])r.push([n,Symbol.species]);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])r.push([n,Symbol.iterator]);r.push([Symbol.prototype,Symbol.toPrimitive],[Date.prototype,Symbol.toPrimitive],[Function.prototype,Symbol.hasInstance],[Array.prototype,Symbol.unscopables]);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])r.push([RegExp.prototype,n]);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])r.push([n,Symbol.toStringTag]);for(let[n,s]of r)t.add(n),i(n,s);let o=(n,s,c)=>{let l=Object.getOwnPropertyDescriptor(n,s);if(!l||!("value"in l)||typeof l.value!="function"||l.configurable!==!0)return;let u=l.value,h=this,y=function(...b){let g=b[0];if(h.shouldBlock()&&typeof g=="object"&&g!==null&&t.has(g)){let x=`${c}.${s}`,_=`${x} is blocked for protected intrinsics during script execution`,F=h.recordViolation("prototype_mutation",x,_);throw new d(_,F)}return Reflect.apply(u,this,b)};this.temporaryIntrinsicDescriptors.push({target:n,prop:s,descriptor:l}),Object.defineProperty(n,s,{...l,value:y,writable:!1})};for(let n of["assign","defineProperties","defineProperty","freeze","preventExtensions","seal","setPrototypeOf"])o(Object,n,"Object");for(let n of["defineProperty","deleteProperty","preventExtensions","set","setPrototypeOf"])o(Reflect,n,"Reflect")}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let i=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return i},set(r){if(e.shouldBlock()){let o="Error.prepareStackTrace modification is blocked during script execution",n=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",o);throw new d(o,n)}e.shouldAudit()&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),i=r},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let o=function(...n){return p.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,n);if(this.kind==="fulfilled")return n[0];throw n[0]}return Reflect.apply(this.cb,void 0,n)})};var t=o;let i=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:i});let r=i?.value;if(typeof r!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(s,c){if(!p)return Reflect.apply(r,this,[s,c]);let l=p.getStore(),u=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!u)return Reflect.apply(r,this,[s,c]);let h=e.getCachedContext(u),y=l?.forceUntrusted?{...h,forceUntrusted:!0}:h,b=(g,x)=>typeof g!="function"?g:o.bind({box:e,executionId:u,captured:y,cb:g,kind:x});return Reflect.apply(r,this,[b(s,"fulfilled"),b(c,"rejected")])},writable:!0,configurable:!0})}catch(i){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",i instanceof Error?i.message:i)}}patchPrototypeConstructor(e,t,i){let r=this;try{let o=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:o});let n=o?.value;Object.defineProperty(e,"constructor",{get(){if(r.shouldBlock()){let s=`${t} access is blocked during script execution`,c=r.recordViolation(i,t,s);throw new d(s,c)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} accessed (audit mode)`),n},set(s){if(r.shouldBlock()){let c=`${t} modification is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}Object.defineProperty(this,"constructor",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(o){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,o instanceof Error?o.message:o)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let i=t?.value;i!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let r="process.mainModule access is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",r);throw new d(r,o)}return e.shouldAudit()&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),i},set(r){if(e.shouldBlock()){let o="process.mainModule modification is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",o);throw new d(o,n)}Object.defineProperty(process,"mainModule",{value:r,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let i=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let r="process.execPath access is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",r);throw new d(r,o)}return e.shouldAudit()&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),i},set(r){if(e.shouldBlock()){let o="process.execPath modification is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",o);throw new d(o,n)}Object.defineProperty(process,"execPath",{value:r,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}lockWellKnownSymbols(){let e=(t,i)=>{try{let r=Object.getOwnPropertyDescriptor(t,i);if(r?.configurable){if("value"in r){Object.defineProperty(t,i,{...r,configurable:!1,writable:!1});return}Object.defineProperty(t,i,{...r,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive);for(let t of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])e(RegExp.prototype,t);e(Function.prototype,Symbol.hasInstance),e(Array.prototype,Symbol.unscopables);for(let t of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])e(t,Symbol.toStringTag)}protectProxyRevocable(){let e=this;try{let t=Proxy.revocable;if(typeof t!="function")return;let i=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:i}),Object.defineProperty(Proxy,"revocable",{value:function(o,n){if(e.shouldBlock()){let s="Proxy.revocable is blocked during script execution",c=e.recordViolation("proxy","Proxy.revocable",s);throw new d(s,c)}return e.shouldAudit()&&e.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),t(o,n)},writable:!1,configurable:!0})}catch(t){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",t instanceof Error?t.message:t)}}protectDynamicImport(){if(!(f||a.importHooksRegistered))try{let e=m;if(!e)throw new Error("node:module is unavailable");let t=new Set;for(let o of e.builtinModules??[]){let n=o.startsWith("node:")?o.slice(5):o;t.add(n);let s=n.indexOf("/");s>0&&t.add(n.slice(0,s))}let i=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let n=o.startsWith("node:")?o.slice(5):o;if(!n)return!1;if(typeof e.isBuiltin=="function"&&e.isBuiltin(n)||t.has(n))return!0;let s=n.indexOf("/");return s>0&&t.has(n.slice(0,s))},r=o=>{let n=p?.getStore();return o.config.auditMode===!0&&n?.sandboxActive===!0&&!a.isTrustedContext(n)};if(typeof e.registerHooks=="function"){e.registerHooks({resolve(o,n,s){let c=a.instance;if(!c)return s(o,n);if((o.startsWith("data:")||o.startsWith("blob:"))&&c.shouldBlock()){let l=`import(${o.startsWith("data:")?"data:":"blob:"})`,u=`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`,h=c.recordViolation("dynamic_import_builtin",l,u);throw new d(u,h)}if(i(o)){let l=`import(${o})`,u=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(c.shouldBlock()){let h=c.recordViolation("dynamic_import_builtin",l,u);throw new d(u,h)}r(c)&&c.recordViolation("dynamic_import_builtin",l,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return s(o,n)}}),a.importHooksRegistered=!0;return}throw new Error("context-aware ESM loader hooks (node:module.registerHooks) are unavailable")}catch(e){throw new Error(`DefenseInDepthBox: could not register dynamic-import hooks: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}protectModuleLoad(){this.protectModuleMethod("_load","module_load")}protectModuleResolveFilename(){this.protectModuleMethod("_resolveFilename","module_resolve_filename")}protectModuleMethod(e,t){if(f)return;let i=`Module.${e}`;try{let r=A,o=r?.[e];if(!r||typeof o!="function")throw new Error("node:module Module class or method is unavailable");let n=Object.getOwnPropertyDescriptor(r,e);if(!n)throw new Error("method has no own property descriptor");if(n.configurable===!1&&n.writable===!1)throw new Error("method is non-configurable and non-writable");let s=this.createBlockingProxy(o,i,t);this.originalDescriptors.push({target:r,prop:e,descriptor:n}),Object.defineProperty(r,e,{...n,value:s});let c=Object.getOwnPropertyDescriptor(r,e);if(r[e]!==s||c?.value!==s)throw new Error("installed patch failed verification")}catch{this.patchFailures.push(i)}}applyPatch(e,t=!1){let{target:i,prop:r,violationType:o,strategy:n}=e;try{let s=i[r];if(s===void 0)return;let c=Object.getOwnPropertyDescriptor(i,r);if(this.originalDescriptors.push({target:i,prop:r,descriptor:c}),n==="freeze"){if(typeof s=="object"&&s!==null){t&&Object.freeze(s);let l=this.getPathForTarget(i,r),u=this.createReadonlyObjectProxy(s,l,o);Object.defineProperty(i,r,{...c,value:u})}}else{let l=this.getPathForTarget(i,r),u=typeof s=="function"?this.createBlockingProxy(s,l,o):this.createBlockingObjectProxy(s,l,o,e.allowedKeys);Object.defineProperty(i,r,{value:u,writable:!0,configurable:!0})}}catch(s){let c=this.getPathForTarget(i,r);this.patchFailures.push(c),console.debug(`[DefenseInDepthBox] Could not patch ${c}:`,s instanceof Error?s.message:s)}}restorePatches(){for(let e=this.temporaryIntrinsicDescriptors.length-1;e>=0;e--){let{target:t,prop:i,descriptor:r}=this.temporaryIntrinsicDescriptors[e];try{Object.defineProperty(t,i,r)}catch(o){console.debug(`[DefenseInDepthBox] Could not restore temporary intrinsic ${String(i)}:`,o instanceof Error?o.message:o)}}this.temporaryIntrinsicDescriptors=[];for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:i,descriptor:r}=this.originalDescriptors[e];try{r?Object.defineProperty(t,i,r):delete t[i]}catch(o){let n=this.getPathForTarget(t,i);console.debug(`[DefenseInDepthBox] Could not restore ${n}:`,o instanceof Error?o.message:o)}}this.originalDescriptors=[]}};export{d as a,B as b};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{a as r}from"./chunk-YXPSX3SI.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
3
+ import{a as r}from"./chunk-623Q77WZ.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{a as Ie}from"./chunk-MROECM42.js";import{a as B,b as U}from"./chunk-42AMF6EE.js";import{a as O,b as X}from"./chunk-YXPSX3SI.js";import{b as z}from"./chunk-GR4ZHKXI.js";import{a as $}from"./chunk-HWI42GQO.js";import{d as ve}from"./chunk-I57EACSL.js";import{l as w}from"./chunk-FUT3X2GJ.js";import{a as V,b as ee}from"./chunk-CPKBPQ2C.js";import{a as Re,b as Ae,c as pe}from"./chunk-MUFNRCMY.js";var Qe=1e4,Ze=100,Ye=new X(/\s+/);function fe(e={}){let{fieldSep:t=Ye,maxIterations:n=Qe,maxRecursionDepth:r=Ze,maxOutputSize:s=0,maxArrayElements:a=1e5,fs:o,cwd:l,exec:c,coverage:u,requireDefenseContext:f}=e;return{FS:" ",OFS:" ",ORS:`
3
+ import{a as Ie}from"./chunk-MROECM42.js";import{a as B,b as U}from"./chunk-DTNGYQCJ.js";import{a as O,b as X}from"./chunk-623Q77WZ.js";import{b as z}from"./chunk-C2BLJ3AE.js";import{a as $}from"./chunk-BFLKIASG.js";import{e as ve}from"./chunk-O3PNT72D.js";import{l as w}from"./chunk-FUT3X2GJ.js";import{a as V,b as ee}from"./chunk-CPKBPQ2C.js";import{a as Re,b as Ae,c as pe}from"./chunk-MUFNRCMY.js";var Qe=1e4,Ze=100,Ye=new X(/\s+/);function fe(e={}){let{fieldSep:t=Ye,maxIterations:n=Qe,maxRecursionDepth:r=Ze,maxOutputSize:s=0,maxArrayElements:a=1e5,fs:o,cwd:l,exec:c,coverage:u,requireDefenseContext:f}=e;return{FS:" ",OFS:" ",ORS:`
4
4
  `,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,getlineCommandStreams:new Map,getlineFileStreams:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:s,maxArrayElements:a,arrayElementCount:0,recordsProcessed:0,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:o,cwd:l,exec:c,coverage:u,requireDefenseContext:f}}function ke(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}function F(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function L(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}var be=10*1024*1024;function Ee(e){return new ve(e,"awk string",()=>new w(`string size limit exceeded (${e} bytes)`,"string_length"))}function _(e){return e.maxOutputSize>0?e.maxOutputSize:be}function te(e,t,n,r,s){let a=Ee(s),o=0,l=0,c=0;for(let u of t.matchAll(e)){let f=u.index??0;l++,a.append(e.slice(o,f)),n(l)?(a.append(r(u)),c++):a.append(u[0]),o=f+u[0].length}return a.append(e.slice(o)),{value:a.build(),replacements:c}}async function ne(e,t){if(e.type==="regex")return e.pattern;let n=L(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function Oe(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(F(await t.evalExpr(e.index)))}`:"$0":"$0"}function Le(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return L(t.vars[e]??"")}function Te(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let r=parseInt(e.slice(1),10)-1;for(;n.fields.length<=r;)n.fields.push("");n.fields[r]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function Je(e,t,n){return e.length===0?t.line.length:L(await n.evalExpr(e[0])).length}async function et(e,t,n){if(e.length<2)return"";let r=L(await n.evalExpr(e[0])),s=Math.floor(F(await n.evalExpr(e[1])))-1;if(e.length>=3){let a=Math.floor(F(await n.evalExpr(e[2])));return r.substr(Math.max(0,s),a)}return r.substr(Math.max(0,s))}async function tt(e,t,n){if(e.length<2)return 0;let r=L(await n.evalExpr(e[0])),s=L(await n.evalExpr(e[1])),a=r.indexOf(s);return a===-1?0:a+1}async function nt(e,t,n){if(e.length<2)return 0;let r=L(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let a=s.name,o=t.FS;if(e.length>=3){let f=e[2];if(f.type==="regex")o=O(f.pattern);else{let k=L(await n.evalExpr(f));o=k===" "?O("\\s+"):k}}else t.FS===" "&&(o=O("\\s+"));let l=Object.keys(t.arrays[a]??{}).length,c=t.maxArrayElements-t.arrayElementCount+l,u=typeof o=="string"?r.split(o,c+1):o.split(r,c+1);if(u.length>c)throw new w(`array element limit exceeded (${t.maxArrayElements})`,"array_elements");t.arrays[a]=Object.create(null);for(let f=0;f<u.length;f++)t.arrays[a][String(f+1)]=u[f];return t.arrayElementCount+=u.length-l,u.length}async function it(e,t,n){if(e.length<2)return 0;let r=await ne(e[0],n),s=L(await n.evalExpr(e[1])),a=await Oe(e[2],n),o=Le(a,t);try{let l=O(r,"g"),c=te(o,l,u=>u===1,u=>Pe(s,u[0],_(t)),_(t));return Te(a,c.value,t),c.replacements}catch(l){return z(l),0}}async function rt(e,t,n){if(e.length<2)return 0;let r=await ne(e[0],n),s=L(await n.evalExpr(e[1])),a=await Oe(e[2],n),o=Le(a,t);try{let l=O(r,"g"),c=te(o,l,()=>!0,u=>Pe(s,u[0],_(t)),_(t));return Te(a,c.value,t),c.replacements}catch(l){return z(l),0}}function Pe(e,t,n){let r=Ee(n),s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];a==="&"?(r.append("&"),s+=2):a==="\\"?(r.append("\\"),s+=2):(r.append(e[s+1]),s+=2)}else e[s]==="&"?(r.append(t),s++):(r.append(e[s]),s++);return r.build()}async function st(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=L(await n.evalExpr(e[0])),s=await ne(e[1],n);try{let o=O(s).exec(r);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function at(e,t,n){if(e.length<3)return"";let r=await ne(e[0],n),s=L(await n.evalExpr(e[1])),a=L(await n.evalExpr(e[2])),o=e.length>=4?L(await n.evalExpr(e[3])):t.line;try{let l=a.toLowerCase()==="g",c=l?0:parseInt(a,10)||1;if(l){let u=O(r,"g");return te(o,u,()=>!0,f=>Ce(s,f[0],f.slice(1),_(t)),_(t)).value}else{let u=O(r,"g");return te(o,u,f=>f===c,f=>Ce(s,f[0],f.slice(1),_(t)),_(t)).value}}catch(l){return z(l),o}}function Ce(e,t,n,r){let s=Ee(r),a=0;for(;a<e.length;)if(e[a]==="\\"&&a+1<e.length){let o=e[a+1];if(o==="&")s.append("&"),a+=2;else if(o==="0")s.append(t),a+=2;else if(o>="1"&&o<="9"){let l=parseInt(o,10)-1;s.append(n[l]||""),a+=2}else o==="n"?(s.append(`
5
5
  `),a+=2):o==="t"?(s.append(" "),a+=2):(s.append(o),a+=2)}else e[a]==="&"?(s.append(t),a++):(s.append(e[a]),a++);return s.build()}async function ot(e,t,n){return e.length===0?"":L(await n.evalExpr(e[0])).toLowerCase()}async function lt(e,t,n){return e.length===0?"":L(await n.evalExpr(e[0])).toUpperCase()}async function ut(e,t,n){if(e.length===0)return"";let r=L(await n.evalExpr(e[0])),s=[];for(let a=1;a<e.length;a++)s.push(await n.evalExpr(e[a]));return ie(r,s,_(t))}async function ct(e,t,n){return e.length===0?0:Math.floor(F(await n.evalExpr(e[0])))}async function ht(e,t,n){return e.length===0?0:Math.sqrt(F(await n.evalExpr(e[0])))}async function pt(e,t,n){return e.length===0?0:Math.sin(F(await n.evalExpr(e[0])))}async function ft(e,t,n){return e.length===0?0:Math.cos(F(await n.evalExpr(e[0])))}async function dt(e,t,n){let r=e.length>0?F(await n.evalExpr(e[0])):0,s=e.length>1?F(await n.evalExpr(e[1])):0;return Math.atan2(r,s)}async function Et(e,t,n){return e.length===0?0:Math.log(F(await n.evalExpr(e[0])))}async function mt(e,t,n){return e.length===0?1:Math.exp(F(await n.evalExpr(e[0])))}function Nt(e,t,n){return t.random?t.random():Math.random()}async function yt(e,t,n){let r=e.length>0?F(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function wt(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function de(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var gt=1e4;function ie(e,t,n=be){let r=0,s="",a=0,o=0,l=Math.min(gt,n),c=u=>{let f=V(u);if(f>n-a)throw new w(`formatted string size limit exceeded (${n} bytes)`,"string_length");s+=u,a+=f};for(;o<e.length;)if(e[o]==="%"&&o+1<e.length){let u=o+1,f="",k="",C="",A,T=u;for(;u<e.length&&/\d/.test(e[u]);)u++;u>T&&e[u]==="$"?(A=parseInt(e.substring(T,u),10)-1,u++):u=T;let he=()=>{if(u<e.length){if(u+1<e.length&&(e[u]==="h"&&e[u+1]==="h"||e[u]==="l"&&e[u+1]==="l")){u+=2;return}/[lzjh]/.test(e[u])&&u++}};for(;u<e.length&&/[-+ #0]/.test(e[u]);)f+=e[u++];if(e[u]==="*"){let p=t[r++],N=p!==void 0?Math.floor(Number(p)):0;if(!Number.isFinite(N)||!Number.isSafeInteger(N))throw new w(`printf width limit exceeded (${l} bytes)`,"string_length");N<0?(f+="-",k=String(-N)):k=String(N),u++}else for(;u<e.length&&/\d/.test(e[u]);)k+=e[u++];if(k&&parseInt(k,10)>l)throw new w(`printf width limit exceeded (${l} bytes)`,"string_length");if(e[u]==="."){if(u++,e[u]==="*"){let p=t[r++],N=p!==void 0?Math.floor(Number(p)):0;if(!Number.isFinite(N)||!Number.isSafeInteger(N))throw new w(`printf precision limit exceeded (${l} bytes)`,"string_length");C=N<0?"":String(N),u++}else for(;u<e.length&&/\d/.test(e[u]);)C+=e[u++];if(C&&parseInt(C,10)>l)throw new w(`printf precision limit exceeded (${l} bytes)`,"string_length")}he();let W=e[u],y=t[A!==void 0?A:r];switch(W){case"s":{let p=y!==void 0?String(y):"";if(C&&(p=p.substring(0,parseInt(C,10))),k){let N=parseInt(k,10);f.includes("-")?p=p.padEnd(N):p=p.padStart(N)}c(p),A===void 0&&r++;break}case"d":case"i":{let p=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(p)&&(p=0);let N=p<0,g=Math.abs(p).toString();if(C){let x=parseInt(C,10);g=g.padStart(x,"0")}let d="";N?d="-":f.includes("+")?d="+":f.includes(" ")&&(d=" ");let I=d+g;if(k){let x=parseInt(k,10);f.includes("-")?I=I.padEnd(x):f.includes("0")&&!C?I=d+g.padStart(x-d.length,"0"):I=I.padStart(x)}c(I),A===void 0&&r++;break}case"f":{let p=y!==void 0?Number(y):0;Number.isNaN(p)&&(p=0);let N=C?parseInt(C,10):6;if(N>100)throw new w("printf floating-point precision limit exceeded (100 digits)","string_length");let g=p.toFixed(N);if(k){let d=parseInt(k,10);f.includes("-")?g=g.padEnd(d):g=g.padStart(d)}c(g),A===void 0&&r++;break}case"e":case"E":{let p=y!==void 0?Number(y):0;Number.isNaN(p)&&(p=0);let N=C?parseInt(C,10):6;if(N>100)throw new w("printf floating-point precision limit exceeded (100 digits)","string_length");let g=p.toExponential(N);if(W==="E"&&(g=g.toUpperCase()),k){let d=parseInt(k,10);f.includes("-")?g=g.padEnd(d):g=g.padStart(d)}c(g),A===void 0&&r++;break}case"g":case"G":{let p=y!==void 0?Number(y):0;Number.isNaN(p)&&(p=0);let N=C?parseInt(C,10):6;if(N>100)throw new w("printf floating-point precision limit exceeded (100 digits)","string_length");let g=p!==0?Math.floor(Math.log10(Math.abs(p))):0,d;if(p===0?d="0":g<-4||g>=N?(d=p.toExponential(N-1),W==="G"&&(d=d.toUpperCase())):d=p.toPrecision(N),d.includes(".")&&(d=d.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),d.includes("e")&&(d=d.replace(/\.?0+e/,"e")),k){let I=parseInt(k,10);f.includes("-")?d=d.padEnd(I):d=d.padStart(I)}c(d),A===void 0&&r++;break}case"x":case"X":{let p=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(p)&&(p=0);let N=Math.abs(p).toString(16);if(W==="X"&&(N=N.toUpperCase()),C){let I=parseInt(C,10);N=N.padStart(I,"0")}let g=p<0?"-":"",d=g+N;if(k){let I=parseInt(k,10);f.includes("-")?d=d.padEnd(I):f.includes("0")&&!C?d=g+N.padStart(I-g.length,"0"):d=d.padStart(I)}c(d),A===void 0&&r++;break}case"o":{let p=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(p)&&(p=0);let N=Math.abs(p).toString(8);if(C){let I=parseInt(C,10);N=N.padStart(I,"0")}let g=p<0?"-":"",d=g+N;if(k){let I=parseInt(k,10);f.includes("-")?d=d.padEnd(I):f.includes("0")&&!C?d=g+N.padStart(I-g.length,"0"):d=d.padStart(I)}c(d),A===void 0&&r++;break}case"c":{c(typeof y=="number"?String.fromCharCode(y):String(y??"").charAt(0)||""),A===void 0&&r++;break}case"%":c("%");break;default:c(e.substring(o,u+1))}o=u+1}else if(e[o]==="\\"&&o+1<e.length){let u=e[o+1];switch(u){case"n":c(`
6
6
  `);break;case"t":c(" ");break;case"r":c("\r");break;case"\\":c("\\");break;default:c(u)}o+=2}else c(e[o++]);return s}var Me=new Map([["length",Je],["substr",et],["index",tt],["split",nt],["sub",it],["gsub",rt],["match",st],["gensub",at],["tolower",ot],["toupper",lt],["sprintf",ut],["int",ct],["sqrt",ht],["sin",pt],["cos",ft],["atan2",dt],["log",Et],["exp",mt],["rand",Nt],["srand",yt],["system",wt("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",de("systime")],["mktime",de("mktime")],["strftime",de("strftime")]]);function P(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function b(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function v(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function me(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function Z(e,t){try{return O(e).test(t)}catch{return!1}}function Fe(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function re(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Ne(e,t,n){if(t===0)e.line=v(n),e.fields=Fe(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=v(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function K(e,t){e.line=t,e.fields=Fe(e,t),e.NF=e.fields.length}function De(e,t){if(e.FS=t,t===" ")e.fieldSep=new X(/\s+/);else try{e.fieldSep=O(t)}catch{e.fieldSep=O(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function se(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function j(e,t,n){switch(t){case"FS":De(e,v(n));return;case"OFS":e.OFS=v(n);return;case"ORS":e.ORS=v(n);return;case"OFMT":e.OFMT=v(n);return;case"NR":e.NR=Math.floor(b(n));return;case"NF":{let r=Math.floor(b(n));if(r<e.NF)e.fields=e.fields.slice(0,r),e.line=e.fields.join(e.OFS);else if(r>e.NF){for(;e.fields.length<r;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=r;return}case"FNR":e.FNR=Math.floor(b(n));return;case"FILENAME":e.FILENAME=v(n);return;case"RSTART":e.RSTART=Math.floor(b(n));return;case"RLENGTH":e.RLENGTH=Math.floor(b(n));return;case"SUBSEP":e.SUBSEP=v(n);return}e.vars[t]=n}function Y(e,t){let n=t,r=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!r.has(n);)r.add(n),n=s,s=e.arrayAliases.get(n);return n}function ae(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=Y(e,t);return e.arrays[r]?.[n]??""}function ye(e,t,n,r){let s=Y(e,t);if(e.arrays[s]||(e.arrays[s]=Object.create(null)),!(n in e.arrays[s])){if(e.arrayElementCount>=e.maxArrayElements)throw new w(`array element limit exceeded (${e.maxArrayElements})`,"array_elements");e.arrayElementCount++}e.arrays[s][n]=r}function xe(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=Y(e,t);return e.arrays[r]?.[n]!==void 0}function _e(e,t,n){let r=Y(e,t);e.arrays[r]&&(n in e.arrays[r]&&e.arrayElementCount--,delete e.arrays[r][n])}function Ge(e,t){let n=Y(e,t);e.arrayElementCount-=Object.keys(e.arrays[n]??{}).length,delete e.arrays[n]}var Be=null;function Ue(e){Be=e}function M(e,t){B(e.requireDefenseContext,"awk",t)}function R(e,t,n){return U(e.requireDefenseContext,"awk",t,n)}async function E(e,t){switch(M(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return Z(t.pattern,e.line)?1:0;case"field":return St(e,t);case"variable":return se(e,t.name);case"array_access":return Rt(e,t);case"binary":return At(e,t);case"unary":return kt(e,t);case"ternary":return P(await R(e,"ternary condition evaluation",()=>E(e,t.condition)))?await R(e,"ternary consequent evaluation",()=>E(e,t.consequent)):await R(e,"ternary alternate evaluation",()=>E(e,t.alternate));case"call":return Ct(e,t.name,t.args);case"assignment":return Ot(e,t);case"pre_increment":return Lt(e,t.operand);case"pre_decrement":return Tt(e,t.operand);case"post_increment":return Pt(e,t.operand);case"post_decrement":return Mt(e,t.operand);case"in":return Ft(e,t.key,t.array);case"getline":return Dt(e,t.variable,t.file,t.command);case"tuple":return Gt(e,t.elements);default:return""}}async function St(e,t){M(e,"field reference evaluation");let n=Math.floor(b(await R(e,"field index evaluation",()=>E(e,t.index))));return re(e,n)}async function Rt(e,t){M(e,"array access evaluation");let n=v(await R(e,"array key evaluation",()=>E(e,t.key)));return ae(e,t.array,n)}async function At(e,t){M(e,"binary expression evaluation");let n=t.operator;if(n==="||")return P(await R(e,"logical-or left evaluation",()=>E(e,t.left)))||P(await R(e,"logical-or right evaluation",()=>E(e,t.right)))?1:0;if(n==="&&")return P(await R(e,"logical-and left evaluation",()=>E(e,t.left)))&&P(await R(e,"logical-and right evaluation",()=>E(e,t.right)))?1:0;if(n==="~"){let l=await R(e,"regex left evaluation",()=>E(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let c=t.right.type==="regex"?t.right.pattern:v(await R(e,"regex right evaluation",()=>E(e,t.right)));try{return O(c).test(v(l))?1:0}catch{return 0}}if(n==="!~"){let l=await R(e,"negated-regex left evaluation",()=>E(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let c=t.right.type==="regex"?t.right.pattern:v(await R(e,"negated-regex right evaluation",()=>E(e,t.right)));try{return O(c).test(v(l))?0:1}catch{return 1}}let r=await R(e,"binary left evaluation",()=>E(e,t.left)),s=await R(e,"binary right evaluation",()=>E(e,t.right));if(n===" "){let l=v(r)+v(s);if(e.maxOutputSize>0&&l.length>e.maxOutputSize)throw new w(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return l}if(vt(n))return It(r,s,n);let a=b(r),o=b(s);return ke(a,o,n)}function vt(e){return["<","<=",">",">=","==","!="].includes(e)}function It(e,t,n){let r=me(e),s=me(t);if(r&&s){let l=b(e),c=b(t);switch(n){case"<":return l<c?1:0;case"<=":return l<=c?1:0;case">":return l>c?1:0;case">=":return l>=c?1:0;case"==":return l===c?1:0;case"!=":return l!==c?1:0}}let a=v(e),o=v(t);switch(n){case"<":return a<o?1:0;case"<=":return a<=o?1:0;case">":return a>o?1:0;case">=":return a>=o?1:0;case"==":return a===o?1:0;case"!=":return a!==o?1:0}return 0}async function kt(e,t){M(e,"unary expression evaluation");let n=await R(e,"unary operand evaluation",()=>E(e,t.operand));switch(t.operator){case"!":return P(n)?0:1;case"-":return-b(n);case"+":return+b(n);default:return n}}async function Ct(e,t,n){M(e,"function call evaluation");let r=Me.get(t);if(r)return r(n,e,{evalExpr:a=>E(e,a)});let s=e.functions.get(t);return s?bt(e,s,n):""}async function bt(e,t,n){if(M(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new w(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let r=Object.create(null);for(let l of t.params)r[l]=e.vars[l];let s=[];for(let l=0;l<t.params.length;l++){let c=t.params[l];if(l<n.length){let u=n[l];u.type==="variable"&&(e.arrayAliases.set(c,u.name),s.push(c));let f=await R(e,"user function argument evaluation",()=>E(e,u));e.vars[c]=f}else e.vars[c]=""}e.hasReturn=!1,e.returnValue=void 0;let a=Be;a&&await R(e,"user function body execution",()=>a(e,t.body.statements));let o=e.returnValue??"";for(let l of t.params)r[l]!==void 0?e.vars[l]=r[l]:delete e.vars[l];for(let l of s)e.arrayAliases.delete(l);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function Ot(e,t){M(e,"assignment evaluation");let n=await R(e,"assignment value evaluation",()=>E(e,t.value)),r=t.target,s=t.operator,a;if(s==="=")a=n;else{let o;if(r.type==="field"){let u=Math.floor(b(await R(e,"assignment field index",()=>E(e,r.index))));o=re(e,u)}else if(r.type==="variable")o=se(e,r.name);else{let u=v(await R(e,"assignment array key",()=>E(e,r.key)));o=ae(e,r.array,u)}let l=b(o),c=b(n);switch(s){case"+=":a=l+c;break;case"-=":a=l-c;break;case"*=":a=l*c;break;case"/=":a=c!==0?l/c:0;break;case"%=":a=c!==0?l%c:0;break;case"^=":a=l**c;break;default:a=n}}if(r.type==="field"){let o=Math.floor(b(await R(e,"assignment target field index",()=>E(e,r.index))));Ne(e,o,a)}else if(r.type==="variable")j(e,r.name,a);else{let o=v(await R(e,"assignment target array key",()=>E(e,r.key)));ye(e,r.array,o,a)}return a}async function oe(e,t,n,r){M(e,"inc/dec evaluation");let s;if(t.type==="field"){let a=Math.floor(b(await R(e,"inc/dec field index",()=>E(e,t.index))));s=b(re(e,a)),Ne(e,a,s+n)}else if(t.type==="variable")s=b(se(e,t.name)),j(e,t.name,s+n);else{let a=v(await R(e,"inc/dec array key",()=>E(e,t.key)));s=b(ae(e,t.array,a)),ye(e,t.array,a,s+n)}return r?s+n:s}async function Lt(e,t){return oe(e,t,1,!0)}async function Tt(e,t){return oe(e,t,-1,!0)}async function Pt(e,t){return oe(e,t,1,!1)}async function Mt(e,t){return oe(e,t,-1,!1)}async function Ft(e,t,n){M(e,"in-expression evaluation");let r;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let a of t.elements)s.push(v(await R(e,"tuple key element evaluation",()=>E(e,a))));r=s.join(e.SUBSEP)}else r=v(await R(e,"in-expression key evaluation",()=>E(e,t)));return xe(e,n,r)?1:0}async function Dt(e,t,n,r){if(M(e,"getline evaluation"),r)return xt(e,t,r);if(n)return _t(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let a=e.lines[s];return t?j(e,t,a):K(e,a),e.NR++,e.lineIndex=s,1}async function xt(e,t,n){let r=e.exec;if(!r)return-1;M(e,"getline command source");let s=v(await R(e,"getline command expression",()=>E(e,n))),a=e.getlineCommandStreams.get(s);if(!a)try{let c=await R(e,"getline command exec",()=>r(s)),f=ee(c.stdout).split(`
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{b as w}from"./chunk-GR4ZHKXI.js";import{d as b}from"./chunk-I57EACSL.js";import{d as S,e as F}from"./chunk-MBREBDZQ.js";import{a as v,b as $,c as y}from"./chunk-MUFNRCMY.js";var E={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},O={name:"chmod",async execute(e,a){if($(e))return v(E);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
3
+ import{b as w}from"./chunk-C2BLJ3AE.js";import{e as b}from"./chunk-O3PNT72D.js";import{d as S,e as F}from"./chunk-AIWBN36Z.js";import{a as v,b as $,c as y}from"./chunk-MUFNRCMY.js";var E={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},O={name:"chmod",async execute(e,a){if($(e))return v(E);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
4
4
  `,exitCode:1};let i=!1,f=!1,n=0;for(;n<e.length&&e[n].startsWith("-");){let t=e[n];if(t==="-R"||t==="--recursive")i=!0,n++;else if(t==="-v"||t==="--verbose")f=!0,n++;else if(t==="--"){n++;break}else{if(/^[+-]?[rwxugo]+/.test(t)||/^\d+$/.test(t))break;if(/^-[Rv]+$/.test(t)){t.includes("R")&&(i=!0),t.includes("v")&&(f=!0),n++;continue}return y("chmod",t)}}if(e.length-n<2)return{stdout:"",stderr:`chmod: missing operand
5
5
  `,exitCode:1};let r=e[n],d=e.slice(n+1),o=/^[0-7]+$/.test(r),s;if(o)s=parseInt(r,8);else try{p(r,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${r}'
6
6
  `,exitCode:1}}let u=new b(Math.min(a.limits.maxOutputSize,a.limits.maxStringLength),"chmod"),l="",c=!1;for(let t of d){let m=a.fs.resolvePath(a.cwd,t);try{let h;if(o&&s!==void 0)h=s;else{let g=await a.fs.stat(m);h=p(r,g.mode)}await a.fs.chmod(m,h),f&&u.append(`mode of '${t}' changed to ${h.toString(8).padStart(4,"0")}
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{a as t}from"./chunk-HWI42GQO.js";import{l as n,m as r,n as i}from"./chunk-FUT3X2GJ.js";function e(o){return o instanceof n||o instanceof r||o instanceof t||o instanceof i}function E(o){if(e(o))throw o}export{e as a,E as b};
3
+ import{a as t}from"./chunk-BFLKIASG.js";import{l as n,m as r,n as i}from"./chunk-FUT3X2GJ.js";function e(o){return o instanceof n||o instanceof r||o instanceof t||o instanceof i}function E(o){if(e(o))throw o}export{e as a,E as b};
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{b as E}from"./chunk-GR4ZHKXI.js";import{a as h}from"./chunk-MBREBDZQ.js";import{l as $}from"./chunk-FUT3X2GJ.js";import{a as k}from"./chunk-CPKBPQ2C.js";import{a as C,b as L,c as F}from"./chunk-MUFNRCMY.js";var A={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},S=1e5,_=0;function U(e){return Uint8Array.from(e,t=>t.charCodeAt(0))}function N(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let i=Number(t[1]);if(!Number.isSafeInteger(i)||i<1)return null;let u=(t[2]||"").toUpperCase(),a=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(u);return a===void 0||i>Math.floor(Number.MAX_SAFE_INTEGER/a)?null:i*a}function x(e){if(!/^[0-9]+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}function H(e,t,i){if(t)return e.toString().padStart(i,"0");let u="abcdefghijklmnopqrstuvwxyz",n=new Array(i),a=e;for(let o=i-1;o>=0;o--)n[o]=u[a%26],a=Math.floor(a/26);return n.join("")}function B(e,t){let i=[],u=0,n=0;for(let a=0;a<e.length;a++)e[a]===10&&(n++,n===t&&(i.push(e.subarray(u,a+1)),u=a+1,n=0));return u<e.length&&i.push(e.subarray(u)),i}function T(e,t){let i=[];for(let u=0;u<e.length;u+=t)i.push(e.subarray(u,u+t));return i}function X(e,t){let i=[],u=Math.ceil(e.length/t);for(let n=0;n<t;n++){let a=n*u,o=Math.min(a+u,e.length);a<o&&i.push(e.subarray(a,o))}return i}function z(e,t){let i=e?10**t:26**t;return Number.isSafeInteger(i)?i:Number.MAX_SAFE_INTEGER}function G(e){if(e.existence!=="unknown")return e.existence==="existing"?e.stableIdentity:e.canonicalPath===void 0?void 0:`missing:${e.canonicalPath}`}function I(e,t){return e.existence!==t.existence||e.existence==="unknown"||t.existence==="unknown"?!1:e.existence==="missing"&&t.existence==="missing"?e.canonicalPath===t.canonicalPath:e.existence==="existing"&&t.existence==="existing"?e.stableIdentity!==void 0&&e.stableIdentity===t.stableIdentity:!1}async function M(e,t,i){let u=t.lastIndexOf("/"),n=u<=0?"/":t.slice(0,u),a=t.slice(u+1);for(let o=0;o<100;o++){let d=_++,c=e.fs.resolvePath(n,`.${a}.just-bash-split-${i}-${d}`),p=await h(e.fs,c);if(p.existence==="missing")return c;if(p.existence==="unknown")break}throw new Error("unable to allocate transaction path")}var Z={name:"split",execute:async(e,t)=>{if(L(e))return C(A);let i={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},u=[],n=0;for(;n<e.length;){let s=e[n];if(s==="-l"&&n+1<e.length){let l=x(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[n+1]}'
3
+ import{b as E}from"./chunk-C2BLJ3AE.js";import{a as h}from"./chunk-AIWBN36Z.js";import{l as $}from"./chunk-FUT3X2GJ.js";import{a as k}from"./chunk-CPKBPQ2C.js";import{a as C,b as L,c as F}from"./chunk-MUFNRCMY.js";var A={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},S=1e5,_=0;function U(e){return Uint8Array.from(e,t=>t.charCodeAt(0))}function N(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let i=Number(t[1]);if(!Number.isSafeInteger(i)||i<1)return null;let u=(t[2]||"").toUpperCase(),a=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(u);return a===void 0||i>Math.floor(Number.MAX_SAFE_INTEGER/a)?null:i*a}function x(e){if(!/^[0-9]+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}function H(e,t,i){if(t)return e.toString().padStart(i,"0");let u="abcdefghijklmnopqrstuvwxyz",n=new Array(i),a=e;for(let o=i-1;o>=0;o--)n[o]=u[a%26],a=Math.floor(a/26);return n.join("")}function B(e,t){let i=[],u=0,n=0;for(let a=0;a<e.length;a++)e[a]===10&&(n++,n===t&&(i.push(e.subarray(u,a+1)),u=a+1,n=0));return u<e.length&&i.push(e.subarray(u)),i}function T(e,t){let i=[];for(let u=0;u<e.length;u+=t)i.push(e.subarray(u,u+t));return i}function X(e,t){let i=[],u=Math.ceil(e.length/t);for(let n=0;n<t;n++){let a=n*u,o=Math.min(a+u,e.length);a<o&&i.push(e.subarray(a,o))}return i}function z(e,t){let i=e?10**t:26**t;return Number.isSafeInteger(i)?i:Number.MAX_SAFE_INTEGER}function G(e){if(e.existence!=="unknown")return e.existence==="existing"?e.stableIdentity:e.canonicalPath===void 0?void 0:`missing:${e.canonicalPath}`}function I(e,t){return e.existence!==t.existence||e.existence==="unknown"||t.existence==="unknown"?!1:e.existence==="missing"&&t.existence==="missing"?e.canonicalPath===t.canonicalPath:e.existence==="existing"&&t.existence==="existing"?e.stableIdentity!==void 0&&e.stableIdentity===t.stableIdentity:!1}async function M(e,t,i){let u=t.lastIndexOf("/"),n=u<=0?"/":t.slice(0,u),a=t.slice(u+1);for(let o=0;o<100;o++){let d=_++,c=e.fs.resolvePath(n,`.${a}.just-bash-split-${i}-${d}`),p=await h(e.fs,c);if(p.existence==="missing")return c;if(p.existence==="unknown")break}throw new Error("unable to allocate transaction path")}var Z={name:"split",execute:async(e,t)=>{if(L(e))return C(A);let i={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},u=[],n=0;for(;n<e.length;){let s=e[n];if(s==="-l"&&n+1<e.length){let l=x(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[n+1]}'
4
4
  `};i.mode="lines",i.lines=l,n+=2}else if(s.match(/^-l\d+$/)){let l=x(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${s.slice(2)}'
5
5
  `};i.mode="lines",i.lines=l,n++}else if(s==="-b"&&n+1<e.length){let l=N(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${e[n+1]}'
6
6
  `};i.mode="bytes",i.bytes=l,n+=2}else if(s.match(/^-b.+$/)){let l=N(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${s.slice(2)}'
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{c as E}from"./chunk-2UV6ZFHK.js";import{d as W}from"./chunk-I57EACSL.js";import{l as h}from"./chunk-FUT3X2GJ.js";import{b as N}from"./chunk-CPKBPQ2C.js";import{a as v,b as L,c as b}from"./chunk-MUFNRCMY.js";var k={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function M(r,o){let l=[],a=r.split(",");if(a.length>o)throw new h(`cut: range count limit exceeded (${o})`,"array_elements");for(let s of a)if(s.includes("-")){let[i,u]=s.split("-"),t=i?Number(i):1,f=u?Number(u):null;if(!Number.isSafeInteger(t)||t<1||f!==null&&(!Number.isSafeInteger(f)||f<t))throw new h("cut: invalid range","array_elements");l.push({start:t,end:f})}else{let i=Number(s);if(!Number.isSafeInteger(i)||i<1)throw new h("cut: invalid range","array_elements");l.push({start:i,end:i})}return l}function B(r,o){let l=[],a=new Set;for(let s of o){let i=s.start-1,u=s.end===null?r.length:s.end;for(let t=i;t<u&&t<r.length;t++)t>=0&&!a.has(t)&&(a.add(t),l.push(r[t]))}return l}var R={name:"cut",async execute(r,o){if(L(r))return v(k);let l=" ",a=null,s=null,i=!1,u=[];for(let n=0;n<r.length;n++){let e=r[n];if(e==="-d")l=r[++n]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")a=r[++n];else if(e.startsWith("-f"))a=e.slice(2);else if(e==="-c")s=r[++n];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")i=!0;else{if(e.startsWith("--"))return b("cut",e);if(e.startsWith("-")){let d=!1;for(let c of e.slice(1))if(c==="s")i=!0;else if(!"dfc".includes(c)){d=!0;break}if(d)return b("cut",e)}else u.push(e)}}if(!a&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
3
+ import{c as E}from"./chunk-2UV6ZFHK.js";import{e as W}from"./chunk-O3PNT72D.js";import{l as h}from"./chunk-FUT3X2GJ.js";import{b as N}from"./chunk-CPKBPQ2C.js";import{a as v,b as L,c as b}from"./chunk-MUFNRCMY.js";var k={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function M(r,o){let l=[],a=r.split(",");if(a.length>o)throw new h(`cut: range count limit exceeded (${o})`,"array_elements");for(let s of a)if(s.includes("-")){let[i,u]=s.split("-"),t=i?Number(i):1,f=u?Number(u):null;if(!Number.isSafeInteger(t)||t<1||f!==null&&(!Number.isSafeInteger(f)||f<t))throw new h("cut: invalid range","array_elements");l.push({start:t,end:f})}else{let i=Number(s);if(!Number.isSafeInteger(i)||i<1)throw new h("cut: invalid range","array_elements");l.push({start:i,end:i})}return l}function B(r,o){let l=[],a=new Set;for(let s of o){let i=s.start-1,u=s.end===null?r.length:s.end;for(let t=i;t<u&&t<r.length;t++)t>=0&&!a.has(t)&&(a.add(t),l.push(r[t]))}return l}var R={name:"cut",async execute(r,o){if(L(r))return v(k);let l=" ",a=null,s=null,i=!1,u=[];for(let n=0;n<r.length;n++){let e=r[n];if(e==="-d")l=r[++n]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")a=r[++n];else if(e.startsWith("-f"))a=e.slice(2);else if(e==="-c")s=r[++n];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")i=!0;else{if(e.startsWith("--"))return b("cut",e);if(e.startsWith("-")){let d=!1;for(let c of e.slice(1))if(c==="s")i=!0;else if(!"dfc".includes(c)){d=!0;break}if(d)return b("cut",e)}else u.push(e)}}if(!a&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
4
4
  `,exitCode:1};let t=await E(o,u,{cmdName:"cut"});if(!t.ok)return t.error;let m=(s?N(t.content):t.content).split(`
5
5
  `);m.length>0&&m[m.length-1]===""&&m.pop();let x=M(a||s||"1",o.limits.maxArrayElements),g=new W(Math.min(o.limits.maxOutputSize,o.limits.maxStringLength),"cut"),S=0,I=n=>{if(!Number.isSafeInteger(n)||n<0||n>o.limits.maxLoopIterations-S)throw new h(`cut: range expansion limit exceeded (${o.limits.maxLoopIterations})`,"iterations");S+=n,o.executionScope?.consumeWork(n,"cut range expansion")};for(let n of m)if(s){let e=Array.from(n),d=[];for(let c of x){let y=c.start-1,w=c.end===null?e.length:c.end;I(Math.max(0,Math.min(w,e.length)-y));for(let p=y;p<w&&p<e.length;p++)p>=0&&d.push(e[p])}g.append(`${d.join("")}
6
6
  `)}else{if(i&&!n.includes(l))continue;let e=n.split(l);for(let c of x){let y=c.start-1,w=c.end===null?e.length:c.end;I(Math.max(0,Math.min(w,e.length)-y))}let d=B(e,x);g.append(`${d.join(l)}
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{a as s,b as i}from"./chunk-HWI42GQO.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
3
+ import{a as s,b as i}from"./chunk-BFLKIASG.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- var o=globalThis.SharedArrayBuffer,r=globalThis.Atomics,e=performance.now.bind(performance),a=globalThis.Headers,s=globalThis.Proxy;export{o as a,r as b,e as c,a as d,s as e};
3
+ var o=globalThis.SharedArrayBuffer,r=globalThis.Atomics,e=performance.now.bind(performance),t=globalThis.Headers,s=globalThis.Proxy,a=Promise.prototype.then;export{o as a,r as b,e as c,t as d,s as e,a as f};
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{a as C}from"./chunk-3MRB66F4.js";import{b as L}from"./chunk-O2BCKSMK.js";import{a as I,b as l}from"./chunk-TW2IJRUF.js";import{d as A,e as m}from"./chunk-QKJAAJ7J.js";import{b as w}from"./chunk-HWI42GQO.js";import{a as _,b as f}from"./chunk-OHFB3M3X.js";import{a as F,b as D}from"./chunk-PBOVSFTJ.js";var h={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,RENAME:14,COPY_FILE:15,WRITE_FILE_RANGE:17,READ_RESULT_RANGE:18,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300,INVOKE_TOOL:400},S={IDLE:0,REQUEST:1,CANCELLED:2},r={NONE:0,SUCCESS:1,ERROR:2},a={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10,NOT_EMPTY:11,LOOP:12,FILE_TOO_LARGE:13,NO_SPACE:14,BUSY:15,READ_ONLY:16,CROSS_DEVICE:17},O=Object.assign(Object.create(null),{ENOENT:a.NOT_FOUND,EISDIR:a.IS_DIRECTORY,ENOTDIR:a.NOT_DIRECTORY,ENOTEMPTY:a.NOT_EMPTY,EEXIST:a.EXISTS,EPERM:a.PERMISSION_DENIED,EACCES:a.PERMISSION_DENIED,EINVAL:a.INVALID_PATH,ELOOP:a.LOOP,EFBIG:a.FILE_TOO_LARGE,ENOSPC:a.NO_SPACE,EBUSY:a.BUSY,EROFS:a.READ_ONLY,EXDEV:a.CROSS_DEVICE}),P=Object.create(null);for(let[d,t]of Object.entries(O))P[t]=d;var o={OP_CODE:0,REQUEST:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,RESULT_STATE:32,PATH_BUFFER:36,DATA_BUFFER:4132},R={PATH_BUFFER:4096,DATA_BUFFER:8388608,TOTAL:8392740},g={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},u={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function M(){return new I(R.TOTAL)}var T=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return l.load(this.int32View,o.OP_CODE/4)}setOpCode(t){l.store(this.int32View,o.OP_CODE/4,t)}getRequest(){return l.load(this.int32View,o.REQUEST/4)}setRequest(t){l.store(this.int32View,o.REQUEST/4,t)}getResultState(){return l.load(this.int32View,o.RESULT_STATE/4)}setResultState(t){l.store(this.int32View,o.RESULT_STATE/4,t)}getPathLength(){return l.load(this.int32View,o.PATH_LENGTH/4)}setPathLength(t){l.store(this.int32View,o.PATH_LENGTH/4,t)}getDataLength(){return l.load(this.int32View,o.DATA_LENGTH/4)}setDataLength(t){l.store(this.int32View,o.DATA_LENGTH/4,t)}getResultLength(){return l.load(this.int32View,o.RESULT_LENGTH/4)}setResultLength(t){l.store(this.int32View,o.RESULT_LENGTH/4,t)}getErrorCode(){return l.load(this.int32View,o.ERROR_CODE/4)}setErrorCode(t){l.store(this.int32View,o.ERROR_CODE/4,t)}getFlags(){return l.load(this.int32View,o.FLAGS/4)}setFlags(t){l.store(this.int32View,o.FLAGS/4,t)}getMode(){return l.load(this.int32View,o.MODE/4)}setMode(t){l.store(this.int32View,o.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(o.PATH_BUFFER,o.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>R.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${R.PATH_BUFFER}`);this.uint8View.set(e,o.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setData(t){if(t.length>R.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${R.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setResult(t){if(t.length>R.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${R.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setResultLength(t.length)}setResultPrefix(t){if(t.length>2147483647)throw new Error(`Result too large: ${t.length} exceeds int32`);let e=Math.min(t.length,R.DATA_BUFFER);this.uint8View.set(t.subarray(0,e),o.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[o.DATA_BUFFER+u.IS_FILE]=t.isFile?1:0,this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(o.DATA_BUFFER+u.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(o.DATA_BUFFER+u.SIZE,e,!0),this.dataView.setFloat64(o.DATA_BUFFER+u.MTIME,t.mtime.getTime(),!0),this.setResultLength(u.TOTAL)}decodeStat(){return{isFile:this.uint8View[o.DATA_BUFFER+u.IS_FILE]===1,isDirectory:this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]===1,mode:this.dataView.getInt32(o.DATA_BUFFER+u.MODE,!0),size:this.dataView.getFloat64(o.DATA_BUFFER+u.SIZE,!0),mtime:new Date(this.dataView.getFloat64(o.DATA_BUFFER+u.MTIME,!0))}}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getRequest();if(s===S.REQUEST)return!0;if(s!==S.IDLE)return!1;let i=Date.now()-e;if(i>=t)return!1;let n=t-i,c=l.waitAsync(this.int32View,o.REQUEST/4,S.IDLE,n);if(c.async&&await c.value==="timed-out")return!1}}waitForResult(t){return l.wait(this.int32View,o.RESULT_STATE/4,r.NONE,t)}notifyRequest(){return l.notify(this.int32View,o.REQUEST/4)}notifyResult(){return l.notify(this.int32View,o.RESULT_STATE/4)}reset(){this.setOpCode(h.NOOP),this.setRequest(S.IDLE),this.setResultState(r.NONE),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(a.NONE),this.setFlags(g.NONE),this.setMode(0)}};function U(d){return d!==void 0&&Object.hasOwn(O,d)?O[d]:a.IO_ERROR}var N=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;invokeTool;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;lastResult=null;constructor(t,e,s,i,n=void 0,c=0,E=void 0,p=void 0){this.fs=e,this.cwd=s,this.commandName=i,this.secureFetch=n,this.maxOutputSize=c,this.exec=E,this.invokeTool=p,this.protocol=new T(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
3
+ import{a as C}from"./chunk-3MRB66F4.js";import{b as L}from"./chunk-PEJXCXSY.js";import{d as w,e as A}from"./chunk-IXTPVJ6W.js";import{a as I,b as l}from"./chunk-ENEHPI32.js";import{b as F}from"./chunk-BFLKIASG.js";import{a as _,b as f}from"./chunk-OHFB3M3X.js";import{a as m,b as D}from"./chunk-PBOVSFTJ.js";var h={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,RENAME:14,COPY_FILE:15,WRITE_FILE_RANGE:17,READ_RESULT_RANGE:18,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300,INVOKE_TOOL:400},S={IDLE:0,REQUEST:1,CANCELLED:2},r={NONE:0,SUCCESS:1,ERROR:2},n={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10,NOT_EMPTY:11,LOOP:12,FILE_TOO_LARGE:13,NO_SPACE:14,BUSY:15,READ_ONLY:16,CROSS_DEVICE:17},O=Object.assign(Object.create(null),{ENOENT:n.NOT_FOUND,EISDIR:n.IS_DIRECTORY,ENOTDIR:n.NOT_DIRECTORY,ENOTEMPTY:n.NOT_EMPTY,EEXIST:n.EXISTS,EPERM:n.PERMISSION_DENIED,EACCES:n.PERMISSION_DENIED,EINVAL:n.INVALID_PATH,ELOOP:n.LOOP,EFBIG:n.FILE_TOO_LARGE,ENOSPC:n.NO_SPACE,EBUSY:n.BUSY,EROFS:n.READ_ONLY,EXDEV:n.CROSS_DEVICE}),P=Object.create(null);for(let[d,t]of Object.entries(O))P[t]=d;var o={OP_CODE:0,REQUEST:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,RESULT_STATE:32,PATH_BUFFER:36,DATA_BUFFER:4132},R={PATH_BUFFER:4096,DATA_BUFFER:8388608,TOTAL:8392740},g={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},u={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function M(){return new I(R.TOTAL)}var T=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return l.load(this.int32View,o.OP_CODE/4)}setOpCode(t){l.store(this.int32View,o.OP_CODE/4,t)}getRequest(){return l.load(this.int32View,o.REQUEST/4)}setRequest(t){l.store(this.int32View,o.REQUEST/4,t)}getResultState(){return l.load(this.int32View,o.RESULT_STATE/4)}setResultState(t){l.store(this.int32View,o.RESULT_STATE/4,t)}getPathLength(){return l.load(this.int32View,o.PATH_LENGTH/4)}setPathLength(t){l.store(this.int32View,o.PATH_LENGTH/4,t)}getDataLength(){return l.load(this.int32View,o.DATA_LENGTH/4)}setDataLength(t){l.store(this.int32View,o.DATA_LENGTH/4,t)}getResultLength(){return l.load(this.int32View,o.RESULT_LENGTH/4)}setResultLength(t){l.store(this.int32View,o.RESULT_LENGTH/4,t)}getErrorCode(){return l.load(this.int32View,o.ERROR_CODE/4)}setErrorCode(t){l.store(this.int32View,o.ERROR_CODE/4,t)}getFlags(){return l.load(this.int32View,o.FLAGS/4)}setFlags(t){l.store(this.int32View,o.FLAGS/4,t)}getMode(){return l.load(this.int32View,o.MODE/4)}setMode(t){l.store(this.int32View,o.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(o.PATH_BUFFER,o.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>R.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${R.PATH_BUFFER}`);this.uint8View.set(e,o.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setData(t){if(t.length>R.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${R.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setResult(t){if(t.length>R.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${R.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setResultLength(t.length)}setResultPrefix(t){if(t.length>2147483647)throw new Error(`Result too large: ${t.length} exceeds int32`);let e=Math.min(t.length,R.DATA_BUFFER);this.uint8View.set(t.subarray(0,e),o.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[o.DATA_BUFFER+u.IS_FILE]=t.isFile?1:0,this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(o.DATA_BUFFER+u.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(o.DATA_BUFFER+u.SIZE,e,!0),this.dataView.setFloat64(o.DATA_BUFFER+u.MTIME,t.mtime.getTime(),!0),this.setResultLength(u.TOTAL)}decodeStat(){return{isFile:this.uint8View[o.DATA_BUFFER+u.IS_FILE]===1,isDirectory:this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]===1,mode:this.dataView.getInt32(o.DATA_BUFFER+u.MODE,!0),size:this.dataView.getFloat64(o.DATA_BUFFER+u.SIZE,!0),mtime:new Date(this.dataView.getFloat64(o.DATA_BUFFER+u.MTIME,!0))}}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getRequest();if(s===S.REQUEST)return!0;if(s!==S.IDLE)return!1;let i=Date.now()-e;if(i>=t)return!1;let a=t-i,c=l.waitAsync(this.int32View,o.REQUEST/4,S.IDLE,a);if(c.async&&await c.value==="timed-out")return!1}}waitForResult(t){return l.wait(this.int32View,o.RESULT_STATE/4,r.NONE,t)}notifyRequest(){return l.notify(this.int32View,o.REQUEST/4)}notifyResult(){return l.notify(this.int32View,o.RESULT_STATE/4)}reset(){this.setOpCode(h.NOOP),this.setRequest(S.IDLE),this.setResultState(r.NONE),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(n.NONE),this.setFlags(g.NONE),this.setMode(0)}};function y(d){return d!==void 0&&Object.hasOwn(O,d)?O[d]:n.IO_ERROR}var N=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;invokeTool;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;lastResult=null;constructor(t,e,s,i,a=void 0,c=0,E=void 0,p=void 0){this.fs=e,this.cwd=s,this.commandName=i,this.secureFetch=a,this.maxOutputSize=c,this.exec=E,this.invokeTool=p,this.protocol=new T(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
4
4
  ${this.commandName}: execution timeout exceeded
5
- `,Promise.reject(new Error("Operation timed out"));let s=t();return e===Number.POSITIVE_INFINITY?s:new Promise((i,n)=>{let c=A(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
5
+ `,Promise.reject(new Error("Operation timed out"));let s=t();return e===Number.POSITIVE_INFINITY?s:new Promise((i,a)=>{let c=w(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
6
6
  ${this.commandName}: execution timeout exceeded
7
- `,n(new Error("Operation timed out"))},e);s.then(E=>{m(c),i(E)},E=>{m(c),n(E)})})}async run(t){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=t;this.running;){if(Date.now()-this.startTime>=t){this.output.stderr+=`
7
+ `,a(new Error("Operation timed out"))},e);(async()=>{try{i(await s)}catch(E){a(E)}finally{A(c)}})()})}async run(t){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=t;this.running;){if(Date.now()-this.startTime>=t){this.output.stderr+=`
8
8
  ${this.commandName}: execution timeout exceeded
9
9
  `,this.output.exitCode=124;break}let s=this.remainingMs();if(!await this.protocol.waitUntilReady(s)){if(!this.running)break;this.output.stderr+=`
10
10
  ${this.commandName}: execution timeout exceeded
11
- `,this.output.exitCode=124;break}if(!this.running)break;this.protocol.setRequest(S.IDLE);let n=this.protocol.getOpCode();await this.handleOperation(n),this.protocol.notifyResult()}return this.output}stop(){this.running=!1,this.lastResult=null,this.protocol.setRequest(S.CANCELLED),this.protocol.notifyRequest()}async handleOperation(t){try{switch(t){case h.READ_FILE:await this.handleReadFile();break;case h.WRITE_FILE:await this.handleWriteFile();break;case h.STAT:await this.handleStat();break;case h.LSTAT:await this.handleLstat();break;case h.READDIR:await this.handleReaddir();break;case h.MKDIR:await this.handleMkdir();break;case h.READ_RESULT_RANGE:this.handleReadResultRange();break;case h.WRITE_FILE_RANGE:await this.handleWriteFileRange();break;case h.RM:await this.handleRm();break;case h.EXISTS:await this.handleExists();break;case h.APPEND_FILE:await this.handleAppendFile();break;case h.SYMLINK:await this.handleSymlink();break;case h.READLINK:await this.handleReadlink();break;case h.CHMOD:await this.handleChmod();break;case h.REALPATH:await this.handleRealpath();break;case h.RENAME:await this.handleRename();break;case h.COPY_FILE:await this.handleCopyFile();break;case h.WRITE_STDOUT:this.handleWriteStdout();break;case h.WRITE_STDERR:this.handleWriteStderr();break;case h.EXIT:this.handleExit();break;case h.HTTP_REQUEST:await this.handleHttpRequest();break;case h.EXEC_COMMAND:await this.handleExecCommand();break;case h.INVOKE_TOOL:await this.handleInvokeTool();break;default:this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultState(r.ERROR)}}catch(e){this.setErrorFromException(e)}}publishResult(t){let e=typeof t=="string"?new TextEncoder().encode(t):t;this.lastResult=e,this.protocol.setResultPrefix(e),this.protocol.setResultState(r.SUCCESS)}handleReadResultRange(){let t=this.protocol.getFlags(),e=this.protocol.getMode(),s=this.lastResult;if(!s||t>=s.length){this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString(`No retained result for range read (offset=${t}, length=${e}, retained=${s?.length??"none"})`),this.protocol.setResultState(r.ERROR);return}this.protocol.setResult(s.subarray(t,t+e)),this.protocol.setResultState(r.SUCCESS)}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.publishResult(e)}catch(e){this.setErrorFromException(e)}}async handleWriteFileRange(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=this.protocol.getData();try{if(e===0)await this.fs.writeFile(t,s);else{let i=await this.fs.stat(t);if(i.size!==e)throw new _("EIO",`non-sequential range write to '${t}': offset ${e} != size ${i.size}`);await this.fs.appendFile(t,s)}this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.publishResult(JSON.stringify(e))}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&g.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&g.RECURSIVE)!==0,i=(e&g.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:i}),this.protocol.setResultState(r.SUCCESS)}catch(n){this.setErrorFromException(n)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleCopyFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(r.ERROR);return}this.protocol.setResultState(r.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(r.ERROR);return}this.protocol.setResultState(r.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setResultState(r.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
12
- `,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let i=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(i>0)if(this.output.stdout.length>=i)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-i);else{let n=i-this.output.stdout.length;this.output.stdout="",n>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-n)}this.output.stderr+=e}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(a.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let i=s?JSON.parse(s):{},n=this.remainingMs(),c=await this.raceDeadline(()=>t(e,{method:i.method,headers:i.headers,body:i.body,timeoutMs:n})),E=JSON.stringify({status:c.status,statusText:c.statusText,headers:c.headers,bodyBase64:L(c.body,"base64"),url:c.url});this.publishResult(E)}catch(i){let n=F(i instanceof Error?i.message:String(i));this.protocol.setErrorCode(a.NETWORK_ERROR),this.protocol.setResultFromString(n),this.protocol.setResultState(r.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString(),i=new AbortController;try{let n={cwd:this.cwd,signal:i.signal};if(s){let p=JSON.parse(s);p.stdin&&(n.stdin=p.stdin),p.args&&Array.isArray(p.args)&&(n.args=p.args.map(x=>String(x)),e=C([e]))}let c=await this.raceDeadline(()=>t(e,n)),E=JSON.stringify({stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode});this.publishResult(E)}catch(n){i.abort();let c=n instanceof Error?n.message:String(n);this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString(c),this.protocol.setResultState(r.ERROR)}}async handleInvokeTool(){let t=this.invokeTool;if(!t){this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString("Tool invocation not available in this context."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let i=await this.raceDeadline(()=>w.runTrustedAsync(()=>t(e,s)));this.publishResult(i)}catch(i){let n=D(i instanceof Error?i.message:String(i));this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString(n),this.protocol.setResultState(r.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=F(e);this.protocol.setErrorCode(U(f(t))),this.protocol.setResultFromString(s),this.protocol.setResultState(r.ERROR)}};export{M as a,N as b};
11
+ `,this.output.exitCode=124;break}if(!this.running)break;this.protocol.setRequest(S.IDLE);let a=this.protocol.getOpCode();await this.handleOperation(a),this.protocol.notifyResult()}return this.output}stop(){this.running=!1,this.lastResult=null,this.protocol.setRequest(S.CANCELLED),this.protocol.notifyRequest()}async handleOperation(t){try{switch(t){case h.READ_FILE:await this.handleReadFile();break;case h.WRITE_FILE:await this.handleWriteFile();break;case h.STAT:await this.handleStat();break;case h.LSTAT:await this.handleLstat();break;case h.READDIR:await this.handleReaddir();break;case h.MKDIR:await this.handleMkdir();break;case h.READ_RESULT_RANGE:this.handleReadResultRange();break;case h.WRITE_FILE_RANGE:await this.handleWriteFileRange();break;case h.RM:await this.handleRm();break;case h.EXISTS:await this.handleExists();break;case h.APPEND_FILE:await this.handleAppendFile();break;case h.SYMLINK:await this.handleSymlink();break;case h.READLINK:await this.handleReadlink();break;case h.CHMOD:await this.handleChmod();break;case h.REALPATH:await this.handleRealpath();break;case h.RENAME:await this.handleRename();break;case h.COPY_FILE:await this.handleCopyFile();break;case h.WRITE_STDOUT:this.handleWriteStdout();break;case h.WRITE_STDERR:this.handleWriteStderr();break;case h.EXIT:this.handleExit();break;case h.HTTP_REQUEST:await this.handleHttpRequest();break;case h.EXEC_COMMAND:await this.handleExecCommand();break;case h.INVOKE_TOOL:await this.handleInvokeTool();break;default:this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultState(r.ERROR)}}catch(e){this.setErrorFromException(e)}}publishResult(t){let e=typeof t=="string"?new TextEncoder().encode(t):t;this.lastResult=e,this.protocol.setResultPrefix(e),this.protocol.setResultState(r.SUCCESS)}handleReadResultRange(){let t=this.protocol.getFlags(),e=this.protocol.getMode(),s=this.lastResult;if(!s||t>=s.length){this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString(`No retained result for range read (offset=${t}, length=${e}, retained=${s?.length??"none"})`),this.protocol.setResultState(r.ERROR);return}this.protocol.setResult(s.subarray(t,t+e)),this.protocol.setResultState(r.SUCCESS)}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.publishResult(e)}catch(e){this.setErrorFromException(e)}}async handleWriteFileRange(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=this.protocol.getData();try{if(e===0)await this.fs.writeFile(t,s);else{let i=await this.fs.stat(t);if(i.size!==e)throw new _("EIO",`non-sequential range write to '${t}': offset ${e} != size ${i.size}`);await this.fs.appendFile(t,s)}this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.publishResult(JSON.stringify(e))}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&g.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&g.RECURSIVE)!==0,i=(e&g.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:i}),this.protocol.setResultState(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleCopyFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(r.ERROR);return}this.protocol.setResultState(r.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(r.ERROR);return}this.protocol.setResultState(r.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setResultState(r.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
12
+ `,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let i=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(i>0)if(this.output.stdout.length>=i)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-i);else{let a=i-this.output.stdout.length;this.output.stdout="",a>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-a)}this.output.stderr+=e}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(n.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let i=s?JSON.parse(s):{},a=this.remainingMs(),c=await this.raceDeadline(()=>t(e,{method:i.method,headers:i.headers,body:i.body,timeoutMs:a})),E=JSON.stringify({status:c.status,statusText:c.statusText,headers:c.headers,bodyBase64:L(c.body,"base64"),url:c.url});this.publishResult(E)}catch(i){let a=m(i instanceof Error?i.message:String(i));this.protocol.setErrorCode(n.NETWORK_ERROR),this.protocol.setResultFromString(a),this.protocol.setResultState(r.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString(),i=new AbortController;try{let a={cwd:this.cwd,signal:i.signal};if(s){let p=JSON.parse(s);p.stdin&&(a.stdin=p.stdin),p.args&&Array.isArray(p.args)&&(a.args=p.args.map(x=>String(x)),e=C([e]))}let c=await this.raceDeadline(()=>t(e,a)),E=JSON.stringify({stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode});this.publishResult(E)}catch(a){i.abort();let c=a instanceof Error?a.message:String(a);this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString(c),this.protocol.setResultState(r.ERROR)}}async handleInvokeTool(){let t=this.invokeTool;if(!t){this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString("Tool invocation not available in this context."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let i=await this.raceDeadline(()=>F.runTrustedAsync(()=>t(e,s)));this.publishResult(i)}catch(i){let a=D(i instanceof Error?i.message:String(i));this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString(a),this.protocol.setResultState(r.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=m(e);this.protocol.setErrorCode(y(f(t))),this.protocol.setResultFromString(s),this.protocol.setResultState(r.ERROR)}};export{M as a,N as b};