just-bash 2.12.3 → 2.12.5

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 (312) hide show
  1. package/dist/bin/chunks/awk2-4MK3F3NZ.js +2 -0
  2. package/dist/bin/chunks/{chmod-4O2C4V42.js → chmod-N5CQATDW.js} +1 -1
  3. package/dist/bin/chunks/chunk-2HDH5VPF.js +12 -0
  4. package/dist/bin/chunks/chunk-5ATRLST6.js +100 -0
  5. package/dist/bin/chunks/{chunk-3NVWSLHI.js → chunk-6W7JTG6A.js} +99 -99
  6. package/dist/bin/chunks/chunk-7ADG3DNO.js +8 -0
  7. package/dist/bin/chunks/chunk-DERQIX2O.js +36 -0
  8. package/dist/bin/{shell/chunks/chunk-7SWOLTCR.js → chunks/chunk-EMSJEY2U.js} +1 -1
  9. package/dist/bin/chunks/{chunk-2SIXTZCJ.js → chunk-EZS766DD.js} +4 -4
  10. package/dist/bin/chunks/chunk-LWKIHJ5L.js +13 -0
  11. package/dist/bin/chunks/chunk-MY5PY2PL.js +2 -0
  12. package/dist/bin/chunks/{chunk-OKL2SPHK.js → chunk-O5B6WWQQ.js} +39 -39
  13. package/dist/bin/chunks/chunk-OQV5J23L.js +7 -0
  14. package/dist/bin/chunks/chunk-Q5MYEU7X.js +5 -0
  15. package/dist/bin/chunks/chunk-QZNF3Y3J.js +2 -0
  16. package/dist/bin/chunks/chunk-R2LDP472.js +8 -0
  17. package/dist/bin/chunks/chunk-RDGXTKIB.js +21 -0
  18. package/dist/bin/chunks/chunk-RS2PRILS.js +10 -0
  19. package/dist/bin/chunks/chunk-STOAUD75.js +11 -0
  20. package/dist/bin/chunks/chunk-SXB55JOI.js +2 -0
  21. package/dist/bin/chunks/chunk-SYG3IW7P.js +2 -0
  22. package/dist/bin/chunks/chunk-SYL34GE7.js +21 -0
  23. package/dist/bin/chunks/chunk-UT6LUTWP.js +2 -0
  24. package/dist/bin/chunks/chunk-VIYJJTN2.js +14 -0
  25. package/dist/bin/chunks/chunk-W752QGNZ.js +6 -0
  26. package/dist/bin/chunks/{chunk-435ZOZCY.js → chunk-WWVVJW3F.js} +13 -13
  27. package/dist/bin/{shell/chunks/chunk-GA6KXSOC.js → chunks/chunk-YFPDB4PH.js} +1 -1
  28. package/dist/bin/chunks/chunk-YMMJLYIX.js +2 -0
  29. package/dist/bin/chunks/chunk-YTIURC67.js +2 -0
  30. package/dist/bin/chunks/chunk-YWZOGBFE.js +9 -0
  31. package/dist/bin/chunks/chunk-YX7OOTPO.js +9 -0
  32. package/dist/bin/chunks/chunk-ZRRNCS7N.js +2 -0
  33. package/dist/bin/chunks/chunk-ZSVBYEY4.js +6 -0
  34. package/dist/bin/chunks/curl-GIQ5S66Y.js +26 -0
  35. package/dist/bin/{shell/chunks/expansion-TCB3WZP5.js → chunks/expansion-JBCP2CHQ.js} +1 -1
  36. package/dist/bin/chunks/expr-VEFRBJT4.js +2 -0
  37. package/dist/bin/chunks/find-MTLF23HX.js +2 -0
  38. package/dist/bin/chunks/flag-coverage-NDF6MQAO.js +2 -0
  39. package/dist/bin/{shell/chunks/grep-F3GT2VPG.js → chunks/grep-OZJTRD4D.js} +1 -1
  40. package/dist/bin/chunks/jq-F7FJ46VM.js +2 -0
  41. package/dist/bin/chunks/ln-VAOSD4HK.js +2 -0
  42. package/dist/bin/chunks/mkdir-CH7JGW4N.js +2 -0
  43. package/dist/bin/chunks/python3-QBGIYRFR.js +17 -0
  44. package/dist/bin/{shell/chunks/readlink-YNOUXNUY.js → chunks/readlink-BD5VFOC5.js} +1 -1
  45. package/dist/bin/chunks/rm-GWYJO4W7.js +2 -0
  46. package/dist/bin/chunks/sed-ENUQOCBB.js +2 -0
  47. package/dist/bin/chunks/sleep-5T34UFNF.js +2 -0
  48. package/dist/bin/chunks/sqlite3-4SBQACEE.js +2 -0
  49. package/dist/bin/chunks/stat-XS2LXYS2.js +2 -0
  50. package/dist/bin/chunks/tar-3UIZ4IRM.js +2 -0
  51. package/dist/bin/chunks/time-GZSHCM77.js +2 -0
  52. package/dist/bin/chunks/timeout-7ECKKPNP.js +2 -0
  53. package/dist/bin/chunks/tr-LZF57GYP.js +2 -0
  54. package/dist/bin/chunks/worker.js +162 -31
  55. package/dist/bin/chunks/xan-5QTBTP4U.js +2 -0
  56. package/dist/bin/chunks/yq-O5RSLLA3.js +2 -0
  57. package/dist/bin/just-bash.js +281 -281
  58. package/dist/bin/shell/chunks/awk2-4MK3F3NZ.js +2 -0
  59. package/dist/bin/shell/chunks/{chmod-4O2C4V42.js → chmod-N5CQATDW.js} +1 -1
  60. package/dist/bin/shell/chunks/chunk-2HDH5VPF.js +12 -0
  61. package/dist/bin/shell/chunks/chunk-5ATRLST6.js +100 -0
  62. package/dist/bin/shell/chunks/{chunk-3NVWSLHI.js → chunk-6W7JTG6A.js} +99 -99
  63. package/dist/bin/shell/chunks/chunk-7ADG3DNO.js +8 -0
  64. package/dist/bin/shell/chunks/chunk-D64U2VGQ.js +2 -0
  65. package/dist/bin/shell/chunks/chunk-DERQIX2O.js +36 -0
  66. package/dist/bin/{chunks/chunk-7SWOLTCR.js → shell/chunks/chunk-EMSJEY2U.js} +1 -1
  67. package/dist/bin/shell/chunks/{chunk-2SIXTZCJ.js → chunk-EZS766DD.js} +4 -4
  68. package/dist/bin/shell/chunks/chunk-LWKIHJ5L.js +13 -0
  69. package/dist/bin/shell/chunks/{chunk-OKL2SPHK.js → chunk-O5B6WWQQ.js} +39 -39
  70. package/dist/bin/shell/chunks/chunk-OQV5J23L.js +7 -0
  71. package/dist/bin/shell/chunks/chunk-Q5MYEU7X.js +5 -0
  72. package/dist/bin/shell/chunks/chunk-QZNF3Y3J.js +2 -0
  73. package/dist/bin/shell/chunks/chunk-R2LDP472.js +8 -0
  74. package/dist/bin/shell/chunks/chunk-RDGXTKIB.js +21 -0
  75. package/dist/bin/shell/chunks/chunk-RS2PRILS.js +10 -0
  76. package/dist/bin/shell/chunks/chunk-STOAUD75.js +11 -0
  77. package/dist/bin/shell/chunks/chunk-SXB55JOI.js +2 -0
  78. package/dist/bin/shell/chunks/chunk-SYG3IW7P.js +2 -0
  79. package/dist/bin/shell/chunks/chunk-SYL34GE7.js +21 -0
  80. package/dist/bin/shell/chunks/chunk-UT6LUTWP.js +2 -0
  81. package/dist/bin/shell/chunks/chunk-VIYJJTN2.js +14 -0
  82. package/dist/bin/shell/chunks/chunk-W752QGNZ.js +6 -0
  83. package/dist/bin/shell/chunks/{chunk-435ZOZCY.js → chunk-WWVVJW3F.js} +13 -13
  84. package/dist/bin/{chunks/chunk-GA6KXSOC.js → shell/chunks/chunk-YFPDB4PH.js} +1 -1
  85. package/dist/bin/shell/chunks/chunk-YMMJLYIX.js +2 -0
  86. package/dist/bin/shell/chunks/chunk-YTIURC67.js +2 -0
  87. package/dist/bin/shell/chunks/chunk-YWZOGBFE.js +9 -0
  88. package/dist/bin/shell/chunks/chunk-YX7OOTPO.js +9 -0
  89. package/dist/bin/shell/chunks/chunk-ZRRNCS7N.js +2 -0
  90. package/dist/bin/shell/chunks/chunk-ZSVBYEY4.js +6 -0
  91. package/dist/bin/shell/chunks/curl-GIQ5S66Y.js +26 -0
  92. package/dist/bin/{chunks/expansion-TCB3WZP5.js → shell/chunks/expansion-JBCP2CHQ.js} +1 -1
  93. package/dist/bin/shell/chunks/expr-VEFRBJT4.js +2 -0
  94. package/dist/bin/shell/chunks/find-MTLF23HX.js +2 -0
  95. package/dist/bin/shell/chunks/flag-coverage-NDF6MQAO.js +2 -0
  96. package/dist/bin/{chunks/grep-F3GT2VPG.js → shell/chunks/grep-OZJTRD4D.js} +1 -1
  97. package/dist/bin/shell/chunks/jq-F7FJ46VM.js +2 -0
  98. package/dist/bin/shell/chunks/ln-VAOSD4HK.js +2 -0
  99. package/dist/bin/shell/chunks/mkdir-CH7JGW4N.js +2 -0
  100. package/dist/bin/shell/chunks/python3-XN7O5X3A.js +17 -0
  101. package/dist/bin/{chunks/readlink-YNOUXNUY.js → shell/chunks/readlink-BD5VFOC5.js} +1 -1
  102. package/dist/bin/shell/chunks/rm-GWYJO4W7.js +2 -0
  103. package/dist/bin/shell/chunks/sed-ENUQOCBB.js +2 -0
  104. package/dist/bin/shell/chunks/sleep-5T34UFNF.js +2 -0
  105. package/dist/bin/shell/chunks/sqlite3-4SBQACEE.js +2 -0
  106. package/dist/bin/shell/chunks/stat-XS2LXYS2.js +2 -0
  107. package/dist/bin/shell/chunks/tar-3UIZ4IRM.js +2 -0
  108. package/dist/bin/shell/chunks/time-GZSHCM77.js +2 -0
  109. package/dist/bin/shell/chunks/timeout-7ECKKPNP.js +2 -0
  110. package/dist/bin/shell/chunks/tr-LZF57GYP.js +2 -0
  111. package/dist/bin/shell/chunks/xan-5QTBTP4U.js +2 -0
  112. package/dist/bin/shell/chunks/yq-O5RSLLA3.js +2 -0
  113. package/dist/bin/shell/shell.js +241 -241
  114. package/dist/bundle/browser.js +718 -721
  115. package/dist/bundle/chunks/awk2-ID6QVUYU.js +1 -0
  116. package/dist/bundle/chunks/{chmod-MIKE3OIT.js → chmod-SYMGL4JA.js} +1 -1
  117. package/dist/bundle/chunks/chunk-2OZNLYX4.js +9 -0
  118. package/dist/bundle/chunks/{chunk-C6ZZC5FL.js → chunk-3J4BCKUH.js} +99 -99
  119. package/dist/bundle/chunks/chunk-3ZBKQKTX.js +11 -0
  120. package/dist/bundle/chunks/chunk-3ZUFRYJ4.js +1 -0
  121. package/dist/bundle/chunks/chunk-4GTNDTRF.js +7 -0
  122. package/dist/bundle/chunks/chunk-5QVNJEHU.js +8 -0
  123. package/dist/bundle/chunks/chunk-64CW2LGZ.js +6 -0
  124. package/dist/bundle/chunks/chunk-AYQ5FKKK.js +20 -0
  125. package/dist/bundle/chunks/chunk-C764MECG.js +35 -0
  126. package/dist/bundle/chunks/{chunk-XULIVM35.js → chunk-CBAJ47B3.js} +1 -1
  127. package/dist/bundle/chunks/chunk-CCNMISUL.js +1 -0
  128. package/dist/bundle/chunks/chunk-D2FZX7A2.js +10 -0
  129. package/dist/bundle/chunks/chunk-EX62JIX3.js +13 -0
  130. package/dist/bundle/chunks/chunk-FD7SFJNJ.js +4 -0
  131. package/dist/bundle/chunks/chunk-FGALERPA.js +8 -0
  132. package/dist/bundle/chunks/chunk-HJWBQKYG.js +5 -0
  133. package/dist/bundle/chunks/chunk-HOFSUCIB.js +99 -0
  134. package/dist/bundle/chunks/chunk-IP7G3BNA.js +7 -0
  135. package/dist/bundle/chunks/chunk-J642UCRS.js +1 -0
  136. package/dist/bundle/chunks/chunk-L75XCEQX.js +1 -0
  137. package/dist/bundle/chunks/chunk-QI4EPYAT.js +5 -0
  138. package/dist/bundle/chunks/chunk-R5XRHEZH.js +12 -0
  139. package/dist/bundle/chunks/chunk-RH6GWZAJ.js +1 -0
  140. package/dist/bundle/chunks/{chunk-U7QI5ZS5.js → chunk-RVT3MU3A.js} +4 -4
  141. package/dist/bundle/chunks/chunk-SJ5LXPUH.js +1 -0
  142. package/dist/bundle/chunks/{chunk-4VCAQZKQ.js → chunk-TRD56HID.js} +39 -39
  143. package/dist/bundle/chunks/{chunk-5CJQNRNJ.js → chunk-TVHAURH5.js} +13 -13
  144. package/dist/bundle/chunks/chunk-X2AJGDEF.js +1 -0
  145. package/dist/bundle/chunks/chunk-XHM67O4N.js +1 -0
  146. package/dist/bundle/chunks/chunk-XXZ46GOX.js +20 -0
  147. package/dist/bundle/chunks/{chunk-CYTBPLPE.js → chunk-YS3AZT3J.js} +1 -1
  148. package/dist/bundle/chunks/curl-743M564K.js +25 -0
  149. package/dist/bundle/chunks/{expansion-HJ6B4DDG.js → expansion-XG7G47TX.js} +1 -1
  150. package/dist/bundle/chunks/expr-74QHYJL5.js +1 -0
  151. package/dist/bundle/chunks/find-DOIVMX6X.js +1 -0
  152. package/dist/bundle/chunks/flag-coverage-4M54QHNZ.js +1 -0
  153. package/dist/bundle/chunks/{grep-LXKUQUAE.js → grep-3AIAIJVR.js} +1 -1
  154. package/dist/bundle/chunks/jq-5FRYP6YP.js +1 -0
  155. package/dist/bundle/chunks/ln-UJ6YJVBK.js +1 -0
  156. package/dist/bundle/chunks/mkdir-F6XHPXZC.js +1 -0
  157. package/dist/bundle/chunks/python3-WANWDR22.js +16 -0
  158. package/dist/bundle/chunks/{readlink-IEQO24KU.js → readlink-MI4GCHJF.js} +1 -1
  159. package/dist/bundle/chunks/rm-FYNVTQIU.js +1 -0
  160. package/dist/bundle/chunks/sed-TS7M7I25.js +1 -0
  161. package/dist/bundle/chunks/sleep-RRZXXEW2.js +1 -0
  162. package/dist/bundle/chunks/sqlite3-IH5QMEIK.js +1 -0
  163. package/dist/bundle/chunks/stat-BT5A227F.js +1 -0
  164. package/dist/bundle/chunks/tar-JCULQ5J2.js +1 -0
  165. package/dist/bundle/chunks/time-XL42Z4U5.js +1 -0
  166. package/dist/bundle/chunks/timeout-DNGO7OHT.js +1 -0
  167. package/dist/bundle/chunks/tr-GVTWMRZB.js +1 -0
  168. package/dist/bundle/chunks/worker.js +162 -31
  169. package/dist/bundle/chunks/xan-LAW2EMOM.js +1 -0
  170. package/dist/bundle/chunks/yq-MFJEXB7R.js +1 -0
  171. package/dist/bundle/index.cjs +942 -945
  172. package/dist/bundle/index.js +274 -274
  173. package/dist/commands/awk/interpreter/context.d.ts +2 -0
  174. package/dist/commands/awk/interpreter/interpreter.d.ts +2 -0
  175. package/dist/commands/duration.d.ts +5 -0
  176. package/dist/commands/format-mode.d.ts +4 -0
  177. package/dist/commands/query-engine/evaluator.d.ts +3 -0
  178. package/dist/commands/sed/types.d.ts +0 -4
  179. package/dist/commands/tar/archive.d.ts +18 -4
  180. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +0 -3
  181. package/dist/fs/mountable-fs/mountable-fs.d.ts +0 -4
  182. package/dist/fs/overlay-fs/overlay-fs.d.ts +6 -7
  183. package/dist/fs/path-utils.d.ts +46 -0
  184. package/dist/fs/read-write-fs/read-write-fs.d.ts +0 -4
  185. package/dist/fs/real-fs-utils.d.ts +17 -11
  186. package/dist/interpreter/defense-aware-command-context.d.ts +6 -0
  187. package/dist/interpreter/interpreter.d.ts +8 -0
  188. package/dist/interpreter/types.d.ts +5 -0
  189. package/dist/timers.d.ts +2 -14
  190. package/dist/types.d.ts +6 -0
  191. package/package.json +34 -33
  192. package/vendor/cpython-emscripten/python.wasm +0 -0
  193. package/dist/bin/chunks/awk2-ZE5HJBNV.js +0 -2
  194. package/dist/bin/chunks/chunk-253LRF5J.js +0 -11
  195. package/dist/bin/chunks/chunk-2FFXXW3F.js +0 -14
  196. package/dist/bin/chunks/chunk-4E3LY6YK.js +0 -10
  197. package/dist/bin/chunks/chunk-4FNW6LFM.js +0 -5
  198. package/dist/bin/chunks/chunk-4PZYIYYG.js +0 -36
  199. package/dist/bin/chunks/chunk-5VFN7VVJ.js +0 -9
  200. package/dist/bin/chunks/chunk-6L4K3UGO.js +0 -100
  201. package/dist/bin/chunks/chunk-D2GFNFUN.js +0 -7
  202. package/dist/bin/chunks/chunk-DREQRXNN.js +0 -12
  203. package/dist/bin/chunks/chunk-EPIOK4SY.js +0 -6
  204. package/dist/bin/chunks/chunk-GIFF636B.js +0 -2
  205. package/dist/bin/chunks/chunk-IYZRLSTQ.js +0 -2
  206. package/dist/bin/chunks/chunk-JJHAWOIB.js +0 -2
  207. package/dist/bin/chunks/chunk-JNPUO56K.js +0 -10
  208. package/dist/bin/chunks/chunk-KPWFKFSD.js +0 -21
  209. package/dist/bin/chunks/chunk-KWLLB7S3.js +0 -7
  210. package/dist/bin/chunks/chunk-RYXW3SZQ.js +0 -13
  211. package/dist/bin/chunks/chunk-VZKEP45B.js +0 -21
  212. package/dist/bin/chunks/chunk-XAL6VWGA.js +0 -9
  213. package/dist/bin/chunks/chunk-YYQ22ZRL.js +0 -8
  214. package/dist/bin/chunks/curl-RWQO3SBN.js +0 -26
  215. package/dist/bin/chunks/expr-MLHUWFYI.js +0 -2
  216. package/dist/bin/chunks/find-4YAO7JQS.js +0 -2
  217. package/dist/bin/chunks/flag-coverage-23ZUDENJ.js +0 -2
  218. package/dist/bin/chunks/jq-CXSPO2J5.js +0 -2
  219. package/dist/bin/chunks/ln-5TCJXDGY.js +0 -2
  220. package/dist/bin/chunks/mkdir-6OKMS3KO.js +0 -2
  221. package/dist/bin/chunks/python3-74B25WCY.js +0 -17
  222. package/dist/bin/chunks/rm-5QIBTLJG.js +0 -2
  223. package/dist/bin/chunks/sed-DNLJZZXZ.js +0 -2
  224. package/dist/bin/chunks/sleep-GUJH2AMQ.js +0 -2
  225. package/dist/bin/chunks/sqlite3-57UI7HYL.js +0 -2
  226. package/dist/bin/chunks/stat-XH7E4E2C.js +0 -2
  227. package/dist/bin/chunks/tar-VIYVHMER.js +0 -2
  228. package/dist/bin/chunks/time-FAWHHOMA.js +0 -2
  229. package/dist/bin/chunks/timeout-4O4YYRTS.js +0 -2
  230. package/dist/bin/chunks/tr-4V5A3V2C.js +0 -2
  231. package/dist/bin/chunks/xan-7NIVZ3HP.js +0 -2
  232. package/dist/bin/chunks/yq-L5ZSGLLO.js +0 -2
  233. package/dist/bin/shell/chunks/awk2-ZE5HJBNV.js +0 -2
  234. package/dist/bin/shell/chunks/chunk-253LRF5J.js +0 -11
  235. package/dist/bin/shell/chunks/chunk-2FFXXW3F.js +0 -14
  236. package/dist/bin/shell/chunks/chunk-4E3LY6YK.js +0 -10
  237. package/dist/bin/shell/chunks/chunk-4FNW6LFM.js +0 -5
  238. package/dist/bin/shell/chunks/chunk-4PZYIYYG.js +0 -36
  239. package/dist/bin/shell/chunks/chunk-5VFN7VVJ.js +0 -9
  240. package/dist/bin/shell/chunks/chunk-6L4K3UGO.js +0 -100
  241. package/dist/bin/shell/chunks/chunk-D2GFNFUN.js +0 -7
  242. package/dist/bin/shell/chunks/chunk-DREQRXNN.js +0 -12
  243. package/dist/bin/shell/chunks/chunk-EPIOK4SY.js +0 -6
  244. package/dist/bin/shell/chunks/chunk-GIFF636B.js +0 -2
  245. package/dist/bin/shell/chunks/chunk-IYZRLSTQ.js +0 -2
  246. package/dist/bin/shell/chunks/chunk-JJHAWOIB.js +0 -2
  247. package/dist/bin/shell/chunks/chunk-JNPUO56K.js +0 -10
  248. package/dist/bin/shell/chunks/chunk-KPWFKFSD.js +0 -21
  249. package/dist/bin/shell/chunks/chunk-KWLLB7S3.js +0 -7
  250. package/dist/bin/shell/chunks/chunk-RYXW3SZQ.js +0 -13
  251. package/dist/bin/shell/chunks/chunk-VZKEP45B.js +0 -21
  252. package/dist/bin/shell/chunks/chunk-XAL6VWGA.js +0 -9
  253. package/dist/bin/shell/chunks/chunk-YYQ22ZRL.js +0 -8
  254. package/dist/bin/shell/chunks/curl-RWQO3SBN.js +0 -26
  255. package/dist/bin/shell/chunks/expr-MLHUWFYI.js +0 -2
  256. package/dist/bin/shell/chunks/find-4YAO7JQS.js +0 -2
  257. package/dist/bin/shell/chunks/flag-coverage-23ZUDENJ.js +0 -2
  258. package/dist/bin/shell/chunks/jq-CXSPO2J5.js +0 -2
  259. package/dist/bin/shell/chunks/ln-5TCJXDGY.js +0 -2
  260. package/dist/bin/shell/chunks/mkdir-6OKMS3KO.js +0 -2
  261. package/dist/bin/shell/chunks/python3-74B25WCY.js +0 -17
  262. package/dist/bin/shell/chunks/rm-5QIBTLJG.js +0 -2
  263. package/dist/bin/shell/chunks/sed-DNLJZZXZ.js +0 -2
  264. package/dist/bin/shell/chunks/sleep-GUJH2AMQ.js +0 -2
  265. package/dist/bin/shell/chunks/sqlite3-57UI7HYL.js +0 -2
  266. package/dist/bin/shell/chunks/stat-XH7E4E2C.js +0 -2
  267. package/dist/bin/shell/chunks/tar-VIYVHMER.js +0 -2
  268. package/dist/bin/shell/chunks/time-FAWHHOMA.js +0 -2
  269. package/dist/bin/shell/chunks/timeout-4O4YYRTS.js +0 -2
  270. package/dist/bin/shell/chunks/tr-4V5A3V2C.js +0 -2
  271. package/dist/bin/shell/chunks/xan-7NIVZ3HP.js +0 -2
  272. package/dist/bin/shell/chunks/yq-L5ZSGLLO.js +0 -2
  273. package/dist/bundle/chunks/awk2-T6LHPVZE.js +0 -1
  274. package/dist/bundle/chunks/chunk-27LMNKBP.js +0 -7
  275. package/dist/bundle/chunks/chunk-5BFLZVGH.js +0 -20
  276. package/dist/bundle/chunks/chunk-7BQDVPII.js +0 -9
  277. package/dist/bundle/chunks/chunk-7KHLIOOW.js +0 -4
  278. package/dist/bundle/chunks/chunk-AOFQVUAD.js +0 -99
  279. package/dist/bundle/chunks/chunk-BAAVD5NO.js +0 -20
  280. package/dist/bundle/chunks/chunk-BEFDX7IY.js +0 -1
  281. package/dist/bundle/chunks/chunk-GZ2N3SXD.js +0 -8
  282. package/dist/bundle/chunks/chunk-IJXFPKNC.js +0 -1
  283. package/dist/bundle/chunks/chunk-IKZ5LEGB.js +0 -6
  284. package/dist/bundle/chunks/chunk-KPFCTJEX.js +0 -12
  285. package/dist/bundle/chunks/chunk-LN5KAJOV.js +0 -5
  286. package/dist/bundle/chunks/chunk-NBAARP4B.js +0 -1
  287. package/dist/bundle/chunks/chunk-OFJTSXN6.js +0 -8
  288. package/dist/bundle/chunks/chunk-RHOPHAL6.js +0 -35
  289. package/dist/bundle/chunks/chunk-SL4FN3A5.js +0 -9
  290. package/dist/bundle/chunks/chunk-UJIR5V54.js +0 -11
  291. package/dist/bundle/chunks/chunk-XZ3MZS57.js +0 -6
  292. package/dist/bundle/chunks/chunk-YCABLDKV.js +0 -10
  293. package/dist/bundle/chunks/chunk-YIY2RKBW.js +0 -13
  294. package/dist/bundle/chunks/curl-6L7YZUIH.js +0 -25
  295. package/dist/bundle/chunks/expr-3572LAOT.js +0 -1
  296. package/dist/bundle/chunks/find-DQFMWHAC.js +0 -1
  297. package/dist/bundle/chunks/flag-coverage-L3DCLG6V.js +0 -1
  298. package/dist/bundle/chunks/jq-MYSLFARY.js +0 -1
  299. package/dist/bundle/chunks/ln-YAIFIHCT.js +0 -1
  300. package/dist/bundle/chunks/mkdir-QWGXDWUS.js +0 -1
  301. package/dist/bundle/chunks/python3-6BKA3FYA.js +0 -16
  302. package/dist/bundle/chunks/rm-KPTLPKPH.js +0 -1
  303. package/dist/bundle/chunks/sed-3ZCNFRHI.js +0 -1
  304. package/dist/bundle/chunks/sleep-LB7FI6AB.js +0 -1
  305. package/dist/bundle/chunks/sqlite3-FVNA4KNF.js +0 -1
  306. package/dist/bundle/chunks/stat-74KBZFAX.js +0 -1
  307. package/dist/bundle/chunks/tar-E2DVQEWO.js +0 -1
  308. package/dist/bundle/chunks/time-AGNW2ZY6.js +0 -1
  309. package/dist/bundle/chunks/timeout-VN35D5O7.js +0 -1
  310. package/dist/bundle/chunks/tr-2N7Q3KKJ.js +0 -1
  311. package/dist/bundle/chunks/xan-VTO4FP3H.js +0 -1
  312. package/dist/bundle/chunks/yq-JRZFRYSK.js +0 -1
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as oe}from"./chunk-4PRVMER6.js";import{a as A,b as T}from"./chunk-SE4C7FJY.js";import{k as L}from"./chunk-6KZRLMG3.js";import{a as se,b as ae,c as Q}from"./chunk-GTNBSMZR.js";var Me=1e4,Pe=100,Te=new T(/\s+/);function q(e={}){let{fieldSep:t=Te,maxIterations:n=Me,maxRecursionDepth:i=Pe,maxOutputSize:a=0,fs:s,cwd:o,exec:l,coverage:c}=e;return{FS:" ",OFS:" ",ORS:`
3
- `,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,fieldSep:t,maxIterations:n,maxRecursionDepth:i,maxOutputSize:a,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:s,cwd:o,exec:l,coverage:c}}function le(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 O(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function w(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function B(e,t){if(e.type==="regex")return e.pattern;let n=w(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function ue(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(O(await t.evalExpr(e.index)))}`:"$0":"$0"}function he(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return w(t.vars[e]??"")}function pe(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 i=parseInt(e.slice(1),10)-1;for(;n.fields.length<=i;)n.fields.push("");n.fields[i]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function Fe(e,t,n){return e.length===0?t.line.length:w(await n.evalExpr(e[0])).length}async function _e(e,t,n){if(e.length<2)return"";let i=w(await n.evalExpr(e[0])),a=Math.floor(O(await n.evalExpr(e[1])))-1;if(e.length>=3){let s=Math.floor(O(await n.evalExpr(e[2])));return i.substr(Math.max(0,a),s)}return i.substr(Math.max(0,a))}async function Ge(e,t,n){if(e.length<2)return 0;let i=w(await n.evalExpr(e[0])),a=w(await n.evalExpr(e[1])),s=i.indexOf(a);return s===-1?0:s+1}async function De(e,t,n){if(e.length<2)return 0;let i=w(await n.evalExpr(e[0])),a=e[1];if(a.type!=="variable")return 0;let s=a.name,o=t.FS;if(e.length>=3){let c=e[2];if(c.type==="regex")o=A(c.pattern);else{let N=w(await n.evalExpr(c));o=N===" "?A("\\s+"):N}}else t.FS===" "&&(o=A("\\s+"));let l=typeof o=="string"?i.split(o):o.split(i);t.arrays[s]=Object.create(null);for(let c=0;c<l.length;c++)t.arrays[s][String(c+1)]=l[c];return l.length}async function xe(e,t,n){if(e.length<2)return 0;let i=await B(e[0],n),a=w(await n.evalExpr(e[1])),s=await ue(e[2],n),o=he(s,t);try{let c=A(i).replace(o,fe(a)),N=c!==o?1:0;return pe(s,c,t),N}catch{return 0}}async function Ue(e,t,n){if(e.length<2)return 0;let i=await B(e[0],n),a=w(await n.evalExpr(e[1])),s=await ue(e[2],n),o=he(s,t);try{let l=A(i,"g"),c=l.match(o),N=c?c.length:0,v=l.replace(o,fe(a));return pe(s,v,t),N}catch{return 0}}function fe(e){return t=>{let n="",i=0;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length){let a=e[i+1];a==="&"?(n+="&",i+=2):a==="\\"?(n+="\\",i+=2):(n+=e[i+1],i+=2)}else e[i]==="&"?(n+=t,i++):(n+=e[i],i++);return n}}async function Be(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let i=w(await n.evalExpr(e[0])),a=await B(e[1],n);try{let o=A(a).exec(i);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 He(e,t,n){if(e.length<3)return"";let i=await B(e[0],n),a=w(await n.evalExpr(e[1])),s=w(await n.evalExpr(e[2])),o=e.length>=4?w(await n.evalExpr(e[3])):t.line;try{let l=s.toLowerCase()==="g",c=l?0:parseInt(s,10)||1;if(l)return A(i,"g").replace(o,(v,...b)=>ce(a,v,b.slice(0,-2)));{let N=0;return A(i,"g").replace(o,(b,...y)=>(N++,N===c?ce(a,b,y.slice(0,-2)):b))}}catch{return o}}function ce(e,t,n){let i="",a=0;for(;a<e.length;)if(e[a]==="\\"&&a+1<e.length){let s=e[a+1];if(s==="&")i+="&",a+=2;else if(s==="0")i+=t,a+=2;else if(s>="1"&&s<="9"){let o=parseInt(s,10)-1;i+=n[o]||"",a+=2}else s==="n"?(i+=`
4
- `,a+=2):s==="t"?(i+=" ",a+=2):(i+=s,a+=2)}else e[a]==="&"?(i+=t,a++):(i+=e[a],a++);return i}async function $e(e,t,n){return e.length===0?"":w(await n.evalExpr(e[0])).toLowerCase()}async function We(e,t,n){return e.length===0?"":w(await n.evalExpr(e[0])).toUpperCase()}async function Ve(e,t,n){if(e.length===0)return"";let i=w(await n.evalExpr(e[0])),a=[];for(let s=1;s<e.length;s++)a.push(await n.evalExpr(e[s]));return H(i,a)}async function Ke(e,t,n){return e.length===0?0:Math.floor(O(await n.evalExpr(e[0])))}async function Xe(e,t,n){return e.length===0?0:Math.sqrt(O(await n.evalExpr(e[0])))}async function je(e,t,n){return e.length===0?0:Math.sin(O(await n.evalExpr(e[0])))}async function ze(e,t,n){return e.length===0?0:Math.cos(O(await n.evalExpr(e[0])))}async function Qe(e,t,n){let i=e.length>0?O(await n.evalExpr(e[0])):0,a=e.length>1?O(await n.evalExpr(e[1])):0;return Math.atan2(i,a)}async function qe(e,t,n){return e.length===0?0:Math.log(O(await n.evalExpr(e[0])))}async function Je(e,t,n){return e.length===0?1:Math.exp(O(await n.evalExpr(e[0])))}function Ze(e,t,n){return t.random?t.random():Math.random()}async function Ye(e,t,n){let i=e.length>0?O(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=i,i}function et(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function J(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var M=1e4;function H(e,t){let n=0,i="",a=0;for(;a<e.length;)if(e[a]==="%"&&a+1<e.length){let s=a+1,o="",l="",c="",N,v=s;for(;s<e.length&&/\d/.test(e[s]);)s++;s>v&&e[s]==="$"?(N=parseInt(e.substring(v,s),10)-1,s++):s=v;let b=()=>{if(s<e.length){if(s+1<e.length&&(e[s]==="h"&&e[s+1]==="h"||e[s]==="l"&&e[s+1]==="l")){s+=2;return}/[lzjh]/.test(e[s])&&s++}};for(;s<e.length&&/[-+ #0]/.test(e[s]);)o+=e[s++];if(e[s]==="*"){let E=t[n++],h=E!==void 0?Math.floor(Number(E)):0;h<0?(o+="-",l=String(Math.min(-h,M))):l=String(Math.min(h,M)),s++}else for(;s<e.length&&/\d/.test(e[s]);)l+=e[s++];if(l&&parseInt(l,10)>M&&(l=String(M)),e[s]==="."){if(s++,e[s]==="*"){let E=t[n++];c=String(Math.min(E!==void 0?Math.floor(Number(E)):0,M)),s++}else for(;s<e.length&&/\d/.test(e[s]);)c+=e[s++];c&&parseInt(c,10)>M&&(c=String(M))}b();let y=e[s],g=t[N!==void 0?N:n];switch(y){case"s":{let E=g!==void 0?String(g):"";if(c&&(E=E.substring(0,parseInt(c,10))),l){let h=parseInt(l,10);o.includes("-")?E=E.padEnd(h):E=E.padStart(h)}i+=E,N===void 0&&n++;break}case"d":case"i":{let E=g!==void 0?Math.floor(Number(g)):0;Number.isNaN(E)&&(E=0);let h=E<0,p=Math.abs(E).toString();if(c){let C=parseInt(c,10);p=p.padStart(C,"0")}let f="";h?f="-":o.includes("+")?f="+":o.includes(" ")&&(f=" ");let R=f+p;if(l){let C=parseInt(l,10);o.includes("-")?R=R.padEnd(C):o.includes("0")&&!c?R=f+p.padStart(C-f.length,"0"):R=R.padStart(C)}i+=R,N===void 0&&n++;break}case"f":{let E=g!==void 0?Number(g):0;Number.isNaN(E)&&(E=0);let h=c?parseInt(c,10):6,p=E.toFixed(h);if(l){let f=parseInt(l,10);o.includes("-")?p=p.padEnd(f):p=p.padStart(f)}i+=p,N===void 0&&n++;break}case"e":case"E":{let E=g!==void 0?Number(g):0;Number.isNaN(E)&&(E=0);let h=c?parseInt(c,10):6,p=E.toExponential(h);if(y==="E"&&(p=p.toUpperCase()),l){let f=parseInt(l,10);o.includes("-")?p=p.padEnd(f):p=p.padStart(f)}i+=p,N===void 0&&n++;break}case"g":case"G":{let E=g!==void 0?Number(g):0;Number.isNaN(E)&&(E=0);let h=c?parseInt(c,10):6,p=E!==0?Math.floor(Math.log10(Math.abs(E))):0,f;if(E===0?f="0":p<-4||p>=h?(f=E.toExponential(h-1),y==="G"&&(f=f.toUpperCase())):f=E.toPrecision(h),f.includes(".")&&(f=f.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),f.includes("e")&&(f=f.replace(/\.?0+e/,"e")),l){let R=parseInt(l,10);o.includes("-")?f=f.padEnd(R):f=f.padStart(R)}i+=f,N===void 0&&n++;break}case"x":case"X":{let E=g!==void 0?Math.floor(Number(g)):0;Number.isNaN(E)&&(E=0);let h=Math.abs(E).toString(16);if(y==="X"&&(h=h.toUpperCase()),c){let R=parseInt(c,10);h=h.padStart(R,"0")}let p=E<0?"-":"",f=p+h;if(l){let R=parseInt(l,10);o.includes("-")?f=f.padEnd(R):o.includes("0")&&!c?f=p+h.padStart(R-p.length,"0"):f=f.padStart(R)}i+=f,N===void 0&&n++;break}case"o":{let E=g!==void 0?Math.floor(Number(g)):0;Number.isNaN(E)&&(E=0);let h=Math.abs(E).toString(8);if(c){let R=parseInt(c,10);h=h.padStart(R,"0")}let p=E<0?"-":"",f=p+h;if(l){let R=parseInt(l,10);o.includes("-")?f=f.padEnd(R):o.includes("0")&&!c?f=p+h.padStart(R-p.length,"0"):f=f.padStart(R)}i+=f,N===void 0&&n++;break}case"c":{typeof g=="number"?i+=String.fromCharCode(g):i+=String(g??"").charAt(0)||"",N===void 0&&n++;break}case"%":i+="%";break;default:i+=e.substring(a,s+1)}a=s+1}else if(e[a]==="\\"&&a+1<e.length){let s=e[a+1];switch(s){case"n":i+=`
5
- `;break;case"t":i+=" ";break;case"r":i+="\r";break;case"\\":i+="\\";break;default:i+=s}a+=2}else i+=e[a++];return i}var de=new Map([["length",Fe],["substr",_e],["index",Ge],["split",De],["sub",xe],["gsub",Ue],["match",Be],["gensub",He],["tolower",$e],["toupper",We],["sprintf",Ve],["int",Ke],["sqrt",Xe],["sin",je],["cos",ze],["atan2",Qe],["log",qe],["exp",Je],["rand",Ze],["srand",Ye],["system",et("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",J("systime")],["mktime",J("mktime")],["strftime",J("strftime")]]);function I(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function m(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function S(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function Z(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function D(e,t){try{return A(e).test(t)}catch{return!1}}function Ee(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function $(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Y(e,t,n){if(t===0)e.line=S(n),e.fields=Ee(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=S(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function F(e,t){e.line=t,e.fields=Ee(e,t),e.NF=e.fields.length}function Ne(e,t){if(e.FS=t,t===" ")e.fieldSep=new T(/\s+/);else try{e.fieldSep=A(t)}catch{e.fieldSep=A(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function W(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 _(e,t,n){switch(t){case"FS":Ne(e,S(n));return;case"OFS":e.OFS=S(n);return;case"ORS":e.ORS=S(n);return;case"OFMT":e.OFMT=S(n);return;case"NR":e.NR=Math.floor(m(n));return;case"NF":{let i=Math.floor(m(n));if(i<e.NF)e.fields=e.fields.slice(0,i),e.line=e.fields.join(e.OFS);else if(i>e.NF){for(;e.fields.length<i;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=i;return}case"FNR":e.FNR=Math.floor(m(n));return;case"FILENAME":e.FILENAME=S(n);return;case"RSTART":e.RSTART=Math.floor(m(n));return;case"RLENGTH":e.RLENGTH=Math.floor(m(n));return;case"SUBSEP":e.SUBSEP=S(n);return}e.vars[t]=n}function x(e,t){let n=t,i=new Set,a=e.arrayAliases.get(n);for(;a!==void 0&&!i.has(n);)i.add(n),n=a,a=e.arrayAliases.get(n);return n}function V(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let i=x(e,t);return e.arrays[i]?.[n]??""}function ee(e,t,n,i){let a=x(e,t);e.arrays[a]||(e.arrays[a]=Object.create(null)),e.arrays[a][n]=i}function Se(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let i=x(e,t);return e.arrays[i]?.[n]!==void 0}function ye(e,t,n){let i=x(e,t);e.arrays[i]&&delete e.arrays[i][n]}function Re(e,t){let n=x(e,t);delete e.arrays[n]}var te=null;function me(e){te=e}async function d(e,t){switch(e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return D(t.pattern,e.line)?1:0;case"field":return tt(e,t);case"variable":return W(e,t.name);case"array_access":return nt(e,t);case"binary":return rt(e,t);case"unary":return at(e,t);case"ternary":return I(await d(e,t.condition))?await d(e,t.consequent):await d(e,t.alternate);case"call":return ot(e,t.name,t.args);case"assignment":return ct(e,t);case"pre_increment":return ut(e,t.operand);case"pre_decrement":return ht(e,t.operand);case"post_increment":return pt(e,t.operand);case"post_decrement":return ft(e,t.operand);case"in":return dt(e,t.key,t.array);case"getline":return Et(e,t.variable,t.file,t.command);case"tuple":return yt(e,t.elements);default:return""}}async function tt(e,t){let n=Math.floor(m(await d(e,t.index)));return $(e,n)}async function nt(e,t){let n=S(await d(e,t.key));return V(e,t.array,n)}async function rt(e,t){let n=t.operator;if(n==="||")return I(await d(e,t.left))||I(await d(e,t.right))?1:0;if(n==="&&")return I(await d(e,t.left))&&I(await d(e,t.right))?1:0;if(n==="~"){let l=await d(e,t.left);t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let c=t.right.type==="regex"?t.right.pattern:S(await d(e,t.right));try{return A(c).test(S(l))?1:0}catch{return 0}}if(n==="!~"){let l=await d(e,t.left);t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let c=t.right.type==="regex"?t.right.pattern:S(await d(e,t.right));try{return A(c).test(S(l))?0:1}catch{return 1}}let i=await d(e,t.left),a=await d(e,t.right);if(n===" "){let l=S(i)+S(a);if(e.maxOutputSize>0&&l.length>e.maxOutputSize)throw new L(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return l}if(it(n))return st(i,a,n);let s=m(i),o=m(a);return le(s,o,n)}function it(e){return["<","<=",">",">=","==","!="].includes(e)}function st(e,t,n){let i=Z(e),a=Z(t);if(i&&a){let l=m(e),c=m(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 s=S(e),o=S(t);switch(n){case"<":return s<o?1:0;case"<=":return s<=o?1:0;case">":return s>o?1:0;case">=":return s>=o?1:0;case"==":return s===o?1:0;case"!=":return s!==o?1:0}return 0}async function at(e,t){let n=await d(e,t.operand);switch(t.operator){case"!":return I(n)?0:1;case"-":return-m(n);case"+":return+m(n);default:return n}}async function ot(e,t,n){let i=de.get(t);if(i)return i(n,e,{evalExpr:s=>d(e,s)});let a=e.functions.get(t);return a?lt(e,a,n):""}async function lt(e,t,n){if(e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new L(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let i=Object.create(null);for(let o of t.params)i[o]=e.vars[o];let a=[];for(let o=0;o<t.params.length;o++){let l=t.params[o];if(o<n.length){let c=n[o];c.type==="variable"&&(e.arrayAliases.set(l,c.name),a.push(l));let N=await d(e,c);e.vars[l]=N}else e.vars[l]=""}e.hasReturn=!1,e.returnValue=void 0,te&&await te(e,t.body.statements);let s=e.returnValue??"";for(let o of t.params)i[o]!==void 0?e.vars[o]=i[o]:delete e.vars[o];for(let o of a)e.arrayAliases.delete(o);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,s}async function ct(e,t){let n=await d(e,t.value),i=t.target,a=t.operator,s;if(a==="=")s=n;else{let o;if(i.type==="field"){let N=Math.floor(m(await d(e,i.index)));o=$(e,N)}else if(i.type==="variable")o=W(e,i.name);else{let N=S(await d(e,i.key));o=V(e,i.array,N)}let l=m(o),c=m(n);switch(a){case"+=":s=l+c;break;case"-=":s=l-c;break;case"*=":s=l*c;break;case"/=":s=c!==0?l/c:0;break;case"%=":s=c!==0?l%c:0;break;case"^=":s=l**c;break;default:s=n}}if(i.type==="field"){let o=Math.floor(m(await d(e,i.index)));Y(e,o,s)}else if(i.type==="variable")_(e,i.name,s);else{let o=S(await d(e,i.key));ee(e,i.array,o,s)}return s}async function K(e,t,n,i){let a;if(t.type==="field"){let s=Math.floor(m(await d(e,t.index)));a=m($(e,s)),Y(e,s,a+n)}else if(t.type==="variable")a=m(W(e,t.name)),_(e,t.name,a+n);else{let s=S(await d(e,t.key));a=m(V(e,t.array,s)),ee(e,t.array,s,a+n)}return i?a+n:a}async function ut(e,t){return K(e,t,1,!0)}async function ht(e,t){return K(e,t,-1,!0)}async function pt(e,t){return K(e,t,1,!1)}async function ft(e,t){return K(e,t,-1,!1)}async function dt(e,t,n){let i;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let a=[];for(let s of t.elements)a.push(S(await d(e,s)));i=a.join(e.SUBSEP)}else i=S(await d(e,t));return Se(e,n,i)?1:0}async function Et(e,t,n,i){if(i)return Nt(e,t,i);if(n)return St(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let a=e.lineIndex+1;if(a>=e.lines.length)return 0;let s=e.lines[a];return t?_(e,t,s):F(e,s),e.NR++,e.lineIndex=a,1}async function Nt(e,t,n){if(!e.exec)return-1;let i=S(await d(e,n)),a=`__cmd_${i}`,s=`__cmdi_${i}`,o,l;if(e.vars[a]===void 0)try{o=(await e.exec(i)).stdout.split(`
6
- `),o.length>0&&o[o.length-1]===""&&o.pop(),e.vars[a]=JSON.stringify(o),e.vars[s]=-1,l=-1}catch{return-1}else o=JSON.parse(e.vars[a]),l=e.vars[s];let c=l+1;if(c>=o.length)return 0;let N=o[c];return e.vars[s]=c,t?_(e,t,N):F(e,N),1}async function St(e,t,n){if(!e.fs||!e.cwd)return-1;let i=S(await d(e,n));if(i==="/dev/null")return 0;let a=e.fs.resolvePath(e.cwd,i),s=`__fc_${a}`,o=`__fi_${a}`,l,c;if(e.vars[s]===void 0)try{l=(await e.fs.readFile(a)).split(`
7
- `),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[s]=JSON.stringify(l),e.vars[o]=-1,c=-1}catch{return-1}else l=JSON.parse(e.vars[s]),c=e.vars[o];let N=c+1;if(N>=l.length)return 0;let v=l[N];return e.vars[o]=N,t?_(e,t,v):F(e,v),1}async function yt(e,t){if(t.length===0)return"";for(let n=0;n<t.length-1;n++)await d(e,t[n]);return d(e,t[t.length-1])}me(G);function ne(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new L(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}async function G(e,t){for(let n of t)if(await P(e,n),Rt(e))break}function Rt(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function P(e,t){switch(e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await G(e,t.statements);break;case"expr_stmt":await d(e,t.expression);break;case"print":await mt(e,t.args,t.output);break;case"printf":await At(e,t.format,t.args,t.output);break;case"if":await gt(e,t);break;case"while":await wt(e,t);break;case"do_while":await It(e,t);break;case"for":await vt(e,t);break;case"for_in":await kt(e,t);break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0,e.exitCode=t.code?Math.floor(m(await d(e,t.code))):0;break;case"return":e.hasReturn=!0,e.returnValue=t.value?await d(e,t.value):"";break;case"delete":await Ct(e,t.target);break}}async function mt(e,t,n){let i=[];for(let s of t){let o=await d(e,s);typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?i.push(String(o)):i.push(H(e.OFMT,[o])):i.push(S(o))}let a=i.join(e.OFS)+e.ORS;n?await Ae(e,n.redirect,n.file,a):(e.output+=a,ne(e))}async function At(e,t,n,i){let a=S(await d(e,t)),s=[];for(let l of n)s.push(await d(e,l));let o=H(a,s);i?await Ae(e,i.redirect,i.file,o):(e.output+=o,ne(e))}async function Ae(e,t,n,i){if(!e.fs||!e.cwd){e.output+=i,ne(e);return}let a=S(await d(e,n)),s=e.fs.resolvePath(e.cwd,a);t===">"?e.openedFiles.has(s)?await e.fs.appendFile(s,i):(await e.fs.writeFile(s,i),e.openedFiles.add(s)):(e.openedFiles.has(s)||e.openedFiles.add(s),await e.fs.appendFile(s,i))}async function gt(e,t){I(await d(e,t.condition))?await P(e,t.consequent):t.alternate&&await P(e,t.alternate)}async function wt(e,t){let n=0;for(;I(await d(e,t.condition));){if(n++,n>e.maxIterations)throw new L(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await P(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function It(e,t){let n=0;do{if(n++,n>e.maxIterations)throw new L(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await P(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(I(await d(e,t.condition)))}async function vt(e,t){t.init&&await d(e,t.init);let n=0;for(;!t.condition||I(await d(e,t.condition));){if(n++,n>e.maxIterations)throw new L(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await P(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;t.update&&await d(e,t.update)}}async function kt(e,t){let n=e.arrays[t.array];if(n)for(let i of Object.keys(n)){if(e.vars[t.variable]=i,e.loopContinue=!1,await P(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Ct(e,t){if(t.type==="array_access"){let n=S(await d(e,t.key));ye(e,t.array,n)}else t.type==="variable"&&Re(e,t.name)}var U=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}execute(t){this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await G(this.ctx,t.action.statements),this.ctx.shouldExit))break}}async executeLine(t){if(!(!this.program||this.ctx.shouldExit)){F(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let i=this.program.rules[n];i.pattern?.type==="begin"||i.pattern?.type==="end"||await this.matchesRule(i,n)&&await G(this.ctx,i.action.statements)}}}async executeEnd(){if(this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await G(this.ctx,t.action.statements),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){let i=t.pattern;if(!i)return!0;switch(i.type){case"begin":case"end":return!1;case"regex_pattern":return D(i.pattern,this.ctx.line);case"expr_pattern":return I(await d(this.ctx,i.expression));case"range":{let a=await this.matchPattern(i.start),s=await this.matchPattern(i.end);return this.rangeStates[n]?(s&&(this.rangeStates[n]=!1),!0):a?(this.rangeStates[n]=!0,s&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(t.type){case"regex_pattern":return D(t.pattern,this.ctx.line);case"expr_pattern":return I(await d(this.ctx,t.expression));default:return!1}}};var r;(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(r||(r={}));var Ot=new Map([["BEGIN",r.BEGIN],["END",r.END],["if",r.IF],["else",r.ELSE],["while",r.WHILE],["do",r.DO],["for",r.FOR],["in",r.IN],["break",r.BREAK],["continue",r.CONTINUE],["next",r.NEXT],["nextfile",r.NEXTFILE],["exit",r.EXIT],["return",r.RETURN],["delete",r.DELETE],["function",r.FUNCTION],["print",r.PRINT],["printf",r.PRINTF],["getline",r.GETLINE]]);function bt(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var X=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(r.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
8
- `?(this.line++,this.column=1):this.column++,t}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="\\")if(this.peek(1)===`
9
- `)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
10
- `;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,i=this.peek();return i===`
11
- `?(this.advance(),{type:r.NEWLINE,value:`
12
- `,line:t,column:n}):i==='"'?this.readString():i==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(i)||i==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(i)||i==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,r.NEWLINE,r.SEMICOLON,r.LBRACE,r.RBRACE,r.LPAREN,r.LBRACKET,r.COMMA,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.AND,r.OR,r.NOT,r.MATCH,r.NOT_MATCH,r.QUESTION,r.COLON,r.LT,r.GT,r.LE,r.GE,r.EQ,r.NE,r.PLUS,r.MINUS,r.STAR,r.PERCENT,r.CARET,r.PRINT,r.PRINTF,r.IF,r.WHILE,r.DO,r.FOR,r.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let a=this.advance();switch(a){case"n":i+=`
13
- `;break;case"t":i+=" ";break;case"r":i+="\r";break;case"f":i+="\f";break;case"b":i+="\b";break;case"v":i+="\v";break;case"a":i+="\x07";break;case"\\":i+="\\";break;case'"':i+='"';break;case"/":i+="/";break;case"x":{let s="";for(;s.length<2&&/[0-9a-fA-F]/.test(this.peek());)s+=this.advance();s.length>0?i+=String.fromCharCode(parseInt(s,16)):i+="x";break}default:if(/[0-7]/.test(a)){let s=a;for(;s.length<3&&/[0-7]/.test(this.peek());)s+=this.advance();i+=String.fromCharCode(parseInt(s,8))}else i+=a}}else i+=this.advance();return this.peek()==='"'&&this.advance(),{type:r.STRING,value:i,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")i+=this.advance(),this.pos<this.input.length&&(i+=this.advance());else{if(this.peek()===`
14
- `)break;i+=this.advance()}return this.peek()==="/"&&this.advance(),i=bt(i),{type:r.REGEX,value:i,line:t,column:n}}readNumber(){let t=this.line,n=this.column,i="";for(;this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(i+=this.advance();this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(i+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(i+=this.advance());this.isDigit(this.peek());)i+=this.advance();return{type:r.NUMBER,value:parseFloat(i),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,i="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)i+=this.advance();let a=Ot.get(i);return a!==void 0?{type:a,value:i,line:t,column:n}:{type:r.IDENT,value:i,line:t,column:n}}readOperator(){let t=this.line,n=this.column,i=this.advance(),a=this.peek();switch(i){case"+":return a==="+"?(this.advance(),{type:r.INCREMENT,value:"++",line:t,column:n}):a==="="?(this.advance(),{type:r.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:r.PLUS,value:"+",line:t,column:n};case"-":return a==="-"?(this.advance(),{type:r.DECREMENT,value:"--",line:t,column:n}):a==="="?(this.advance(),{type:r.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:r.MINUS,value:"-",line:t,column:n};case"*":return a==="*"?(this.advance(),{type:r.CARET,value:"**",line:t,column:n}):a==="="?(this.advance(),{type:r.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:r.STAR,value:"*",line:t,column:n};case"/":return a==="="?(this.advance(),{type:r.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:r.SLASH,value:"/",line:t,column:n};case"%":return a==="="?(this.advance(),{type:r.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:r.PERCENT,value:"%",line:t,column:n};case"^":return a==="="?(this.advance(),{type:r.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:r.CARET,value:"^",line:t,column:n};case"=":return a==="="?(this.advance(),{type:r.EQ,value:"==",line:t,column:n}):{type:r.ASSIGN,value:"=",line:t,column:n};case"!":return a==="="?(this.advance(),{type:r.NE,value:"!=",line:t,column:n}):a==="~"?(this.advance(),{type:r.NOT_MATCH,value:"!~",line:t,column:n}):{type:r.NOT,value:"!",line:t,column:n};case"<":return a==="="?(this.advance(),{type:r.LE,value:"<=",line:t,column:n}):{type:r.LT,value:"<",line:t,column:n};case">":return a==="="?(this.advance(),{type:r.GE,value:">=",line:t,column:n}):a===">"?(this.advance(),{type:r.APPEND,value:">>",line:t,column:n}):{type:r.GT,value:">",line:t,column:n};case"&":return a==="&"?(this.advance(),{type:r.AND,value:"&&",line:t,column:n}):{type:r.IDENT,value:"&",line:t,column:n};case"|":return a==="|"?(this.advance(),{type:r.OR,value:"||",line:t,column:n}):{type:r.PIPE,value:"|",line:t,column:n};case"~":return{type:r.MATCH,value:"~",line:t,column:n};case"?":return{type:r.QUESTION,value:"?",line:t,column:n};case":":return{type:r.COLON,value:":",line:t,column:n};case",":return{type:r.COMMA,value:",",line:t,column:n};case";":return{type:r.SEMICOLON,value:";",line:t,column:n};case"(":return{type:r.LPAREN,value:"(",line:t,column:n};case")":return{type:r.RPAREN,value:")",line:t,column:n};case"{":return{type:r.LBRACE,value:"{",line:t,column:n};case"}":return{type:r.RBRACE,value:"}",line:t,column:n};case"[":return{type:r.LBRACKET,value:"[",line:t,column:n};case"]":return{type:r.RBRACKET,value:"]",line:t,column:n};case"$":return{type:r.DOLLAR,value:"$",line:t,column:n};default:return{type:r.IDENT,value:i,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}};var u={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"};function ke(e){e.expect(u.PRINT);let t=[];if(e.check(u.NEWLINE)||e.check(u.SEMICOLON)||e.check(u.RBRACE)||e.check(u.PIPE)||e.check(u.GT)||e.check(u.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(j(e));e.check(u.COMMA);)e.advance(),t.push(j(e));let n;return e.check(u.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(u.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function j(e){return Lt(e)?re(e,!0):re(e,!1)}function re(e,t){let n=t?e.parseTernary():Mt(e);if(e.match(u.ASSIGN,u.PLUS_ASSIGN,u.MINUS_ASSIGN,u.STAR_ASSIGN,u.SLASH_ASSIGN,u.PERCENT_ASSIGN,u.CARET_ASSIGN)){let i=e.advance(),a=re(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(i.value)??"=",target:n,value:a}}return n}function Lt(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let i=e.tokens[n];if(i.type===u.LPAREN&&t++,i.type===u.RPAREN&&t--,i.type===u.QUESTION&&t===0)return!0;if(i.type===u.NEWLINE||i.type===u.SEMICOLON||i.type===u.RBRACE||i.type===u.COMMA||i.type===u.PIPE)return!1;n++}return!1}function Mt(e){let t=ge(e);for(;e.check(u.OR);){e.advance();let n=ge(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function ge(e){let t=we(e);for(;e.check(u.AND);){e.advance();let n=we(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function we(e){let t=Pt(e);if(e.check(u.IN)){e.advance();let n=String(e.expect(u.IDENT).value);return{type:"in",key:t,array:n}}return t}function Pt(e){let t=Ie(e);for(;Tt(e)&&!Ft(e);){let n=Ie(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function Ie(e){let t=ve(e);for(;e.match(u.MATCH,u.NOT_MATCH);){let n=e.advance().type===u.MATCH?"~":"!~",i=ve(e);t={type:"binary",operator:n,left:t,right:i}}return t}function ve(e){let t=e.parseAddSub();for(;e.match(u.LT,u.LE,u.GE,u.EQ,u.NE);){let n=e.advance(),i=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}function Tt(e){return e.match(u.NUMBER,u.STRING,u.IDENT,u.DOLLAR,u.LPAREN,u.NOT,u.MINUS,u.PLUS,u.INCREMENT,u.DECREMENT)}function Ft(e){return e.match(u.AND,u.OR,u.QUESTION,u.ASSIGN,u.PLUS_ASSIGN,u.MINUS_ASSIGN,u.STAR_ASSIGN,u.SLASH_ASSIGN,u.PERCENT_ASSIGN,u.CARET_ASSIGN,u.COMMA,u.SEMICOLON,u.NEWLINE,u.RBRACE,u.RPAREN,u.RBRACKET,u.COLON,u.PIPE,u.APPEND,u.GT,u.IN)}function Ce(e){e.expect(u.PRINTF);let t=e.check(u.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():j(e),i=[];for(;e.check(u.COMMA);)e.advance(),t&&e.skipNewlines(),i.push(t?e.parseExpression():j(e));t&&(e.skipNewlines(),e.expect(u.RPAREN));let a;return e.check(u.GT)?(e.advance(),a={redirect:">",file:e.parsePrimary()}):e.check(u.APPEND)&&(e.advance(),a={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:i,output:a}}var z=class{tokens=[];pos=0;parse(t){let n=new X(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:r.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let i=this.current();throw new Error(n||`Expected ${t}, got ${i.type} at line ${i.line}:${i.column}`)}return this.advance()}skipNewlines(){for(;this.check(r.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(r.NEWLINE)||this.check(r.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(r.EOF)&&(this.skipNewlines(),!this.check(r.EOF));)this.check(r.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(r.FUNCTION);let t=this.expect(r.IDENT).value;this.expect(r.LPAREN);let n=[];if(!this.check(r.RPAREN))for(n.push(this.expect(r.IDENT).value);this.check(r.COMMA);)this.advance(),n.push(this.expect(r.IDENT).value);this.expect(r.RPAREN),this.skipNewlines();let i=this.parseBlock();return{name:t,params:n,body:i}}parseRule(){let t;if(this.check(r.BEGIN))this.advance(),t={type:"begin"};else if(this.check(r.END))this.advance(),t={type:"end"};else if(this.check(r.LBRACE))t=void 0;else if(this.check(r.REGEX)){let i=this.advance();if(this.check(r.AND)||this.check(r.OR)){let a={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:i.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(a)}}else{let a={type:"regex_pattern",pattern:i.value};if(this.check(r.COMMA)){this.advance();let s;this.check(r.REGEX)?s={type:"regex_pattern",pattern:this.advance().value}:s={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:a,end:s}}else t=a}}else{let a={type:"expr_pattern",expression:this.parseExpression()};if(this.check(r.COMMA)){this.advance();let s;this.check(r.REGEX)?s={type:"regex_pattern",pattern:this.advance().value}:s={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:a,end:s}}else t=a}this.skipNewlines();let n;return this.check(r.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(r.LBRACE),this.skipNewlines();let t=[];for(;!this.check(r.RBRACE)&&!this.check(r.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(r.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(r.SEMICOLON)||this.check(r.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(r.LBRACE))return this.parseBlock();if(this.check(r.IF))return this.parseIf();if(this.check(r.WHILE))return this.parseWhile();if(this.check(r.DO))return this.parseDoWhile();if(this.check(r.FOR))return this.parseFor();if(this.check(r.BREAK))return this.advance(),{type:"break"};if(this.check(r.CONTINUE))return this.advance(),{type:"continue"};if(this.check(r.NEXT))return this.advance(),{type:"next"};if(this.check(r.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(r.EXIT)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(r.RETURN)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(r.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(r.PRINT)?ke(this):this.check(r.PRINTF)?Ce(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(r.IF),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let i;return this.check(r.ELSE)&&(this.advance(),this.skipNewlines(),i=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:i}}parseWhile(){this.expect(r.WHILE),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(r.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(r.WHILE),this.expect(r.LPAREN);let n=this.parseExpression();return this.expect(r.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(r.FOR),this.expect(r.LPAREN),this.check(r.IDENT)){let s=this.advance();if(this.check(r.IN)){this.advance();let o=this.expect(r.IDENT).value;this.expect(r.RPAREN),this.skipNewlines();let l=this.parseStatement();return{type:"for_in",variable:s.value,array:o,body:l}}this.pos--}let t;this.check(r.SEMICOLON)||(t=this.parseExpression()),this.expect(r.SEMICOLON);let n;this.check(r.SEMICOLON)||(n=this.parseExpression()),this.expect(r.SEMICOLON);let i;this.check(r.RPAREN)||(i=this.parseExpression()),this.expect(r.RPAREN),this.skipNewlines();let a=this.parseStatement();return{type:"for",init:t,condition:n,update:i,body:a}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN)){let n=this.advance(),i=this.parseAssignment();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:{"=":"=","+=":"+=","-=":"-=","*=":"*=","/=":"/=","%=":"%=","^=":"^="}[n.value],target:t,value:i}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(r.QUESTION)){this.advance();let n=this.parseExpression();this.expect(r.COLON);let i=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:i}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(r.PIPE)){if(this.advance(),!this.check(r.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(r.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(r.IN)){this.advance();let n=this.expect(r.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(r.MATCH,r.NOT_MATCH);){let n=this.advance().type===r.MATCH?"~":"!~",i=this.parseComparison();t={type:"binary",operator:n,left:t,right:i}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(r.LT,r.LE,r.GT,r.GE,r.EQ,r.NE);){let n=this.advance(),i=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}canStartExpression(){return this.match(r.NUMBER,r.STRING,r.IDENT,r.DOLLAR,r.LPAREN,r.NOT,r.MINUS,r.PLUS,r.INCREMENT,r.DECREMENT)}isConcatTerminator(){return this.match(r.AND,r.OR,r.QUESTION,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.COMMA,r.SEMICOLON,r.NEWLINE,r.RBRACE,r.RPAREN,r.RBRACKET,r.COLON,r.PIPE,r.APPEND,r.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(r.PLUS,r.MINUS);){let n=this.advance().value,i=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:i}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(r.STAR,r.SLASH,r.PERCENT);){let n=this.advance(),i=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:i}}return t}parseUnary(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(r.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(r.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(r.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(r.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(r.RPAREN),t}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(r.COMMA)){let i=[n];for(;this.check(r.COMMA);)this.advance(),i.push(this.parseExpression());this.expect(r.RBRACKET);let a=i.reduce((s,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:s,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:a}}return this.expect(r.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(r.COMMA)){let n=[t];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"tuple",elements:n}}return this.expect(r.RPAREN),t}if(this.check(r.GETLINE)){this.advance();let t,n;return this.check(r.IDENT)&&(t=this.advance().value),this.check(r.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(r.RBRACKET);let i;if(n.length===1)i=n[0];else{i=n[0];for(let a=1;a<n.length;a++)i={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:n[a]}}return{type:"array_access",array:t,key:i}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}};var _t={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},bn={name:"awk",async execute(e,t){if(ae(e))return se(_t);let n=new T(/\s+/),i=" ",a=Object.create(null),s=0;for(let h=0;h<e.length;h++){let p=e[h];if(p==="-F"&&h+1<e.length)i=ie(e[++h]),n=Oe(i),s=h+1;else if(p.startsWith("-F"))i=ie(p.slice(2)),n=Oe(i),s=h+1;else if(p==="-v"&&h+1<e.length){let f=e[++h],R=f.indexOf("=");if(R>0){let C=f.slice(0,R),Le=ie(f.slice(R+1));a[C]=Le}s=h+1}else{if(p.startsWith("--"))return Q("awk",p);if(p.startsWith("-")&&p.length>1){let f=p[1];if(f!=="F"&&f!=="v")return Q("awk",`-${f}`);s=h+1}else if(!p.startsWith("-")){s=h;break}}}if(s>=e.length)return{stdout:"",stderr:`awk: missing program
15
- `,exitCode:1};let o=e[s],l=e.slice(s+1),c=new z,N;try{N=c.parse(o)}catch(h){return{stdout:"",stderr:`awk: ${h instanceof Error?h.message:String(h)}
16
- `,exitCode:1}}let v={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(h,p)=>{try{let f=await t.fs.readFile(h);await t.fs.writeFile(h,f+p)}catch{await t.fs.writeFile(h,p)}},resolvePath:t.fs.resolvePath.bind(t.fs)},b=t.exec,y=q({fieldSep:n,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:v,cwd:t.cwd,exec:b?h=>b(h,{cwd:t.cwd,signal:t.signal}):void 0,coverage:t.coverage});y.FS=i,y.vars=Object.assign(Object.create(null),a),y.ARGC=l.length+1,y.ARGV=Object.create(null),y.ARGV[0]="awk";for(let h=0;h<l.length;h++)y.ARGV[String(h+1)]=l[h];y.ENVIRON=oe(t.env);let k=new U(y);k.execute(N);let g=N.rules.some(h=>h.pattern?.type!=="begin"&&h.pattern?.type!=="end"),E=N.rules.some(h=>h.pattern?.type==="end");try{if(await k.executeBegin(),y.shouldExit)return await k.executeEnd(),{stdout:k.getOutput(),stderr:"",exitCode:k.getExitCode()};if(!g&&!E)return{stdout:k.getOutput(),stderr:"",exitCode:k.getExitCode()};let h=[];if(l.length>0)for(let p of l)try{let f=t.fs.resolvePath(t.cwd,p),C=(await t.fs.readFile(f)).split(`
17
- `);C.length>0&&C[C.length-1]===""&&C.pop(),h.push({filename:p,lines:C})}catch{return{stdout:"",stderr:`awk: ${p}: No such file or directory
18
- `,exitCode:1}}else{let p=t.stdin.split(`
19
- `);p.length>0&&p[p.length-1]===""&&p.pop(),h.push({filename:"",lines:p})}for(let p of h){for(y.FILENAME=p.filename,y.FNR=0,y.lines=p.lines,y.lineIndex=-1,y.shouldNextFile=!1;y.lineIndex<p.lines.length-1&&(y.lineIndex++,await k.executeLine(p.lines[y.lineIndex]),!(y.shouldExit||y.shouldNextFile)););if(y.shouldExit)break}return await k.executeEnd(),{stdout:k.getOutput(),stderr:"",exitCode:k.getExitCode()}}catch(h){let p=h instanceof Error?h.message:String(h),f=h instanceof L?L.EXIT_CODE:2;return{stdout:k.getOutput(),stderr:`awk: ${p}
20
- `,exitCode:f}}}};function ie(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
21
- `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function Oe(e){if(e===" ")return A("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return A(e)}catch{return A(be(e))}return A(be(e))}function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ln={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{bn as a,Ln as b};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as d}from"./chunk-JBABAK44.js";import{a as g,b as u}from"./chunk-GTNBSMZR.js";var S={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},$={format:{short:"c",type:"string"}},O={name:"stat",async execute(e,a){if(u(e))return g(S);let s=d("stat",e,$);if(!s.ok)return s.error;let l=s.result.flags.format??null,c=s.result.positional;if(c.length===0)return{stdout:"",stderr:`stat: missing operand
3
- `,exitCode:1};let o="",p="",f=!1;for(let n of c){let h=a.fs.resolvePath(a.cwd,n);try{let r=await a.fs.stat(h);if(l){let t=l,i=r.mode.toString(8),y=m(r.mode,r.isDirectory);t=t.replace(/%n/g,n),t=t.replace(/%N/g,`'${n}'`),t=t.replace(/%s/g,String(r.size)),t=t.replace(/%F/g,r.isDirectory?"directory":"regular file"),t=t.replace(/%a/g,i),t=t.replace(/%A/g,y),t=t.replace(/%u/g,"1000"),t=t.replace(/%U/g,"user"),t=t.replace(/%g/g,"1000"),t=t.replace(/%G/g,"group"),o+=`${t}
4
- `}else{let t=r.mode.toString(8).padStart(4,"0"),i=m(r.mode,r.isDirectory);o+=` File: ${n}
5
- `,o+=` Size: ${r.size} Blocks: ${Math.ceil(r.size/512)}
6
- `,o+=`Access: (${t}/${i})
7
- `,o+=`Modify: ${r.mtime.toISOString()}
8
- `}}catch{p+=`stat: cannot stat '${n}': No such file or directory
9
- `,f=!0}}return{stdout:o,stderr:p,exitCode:f?1:0}}};function m(e,a){let s=a?"d":"-",l=[e&256?"r":"-",e&128?"w":"-",e&64?"x":"-",e&32?"r":"-",e&16?"w":"-",e&8?"x":"-",e&4?"r":"-",e&2?"w":"-",e&1?"x":"-"];return s+l.join("")}var w={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0};export{O as a,w as b};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as u}from"./chunk-JBABAK44.js";import{a as m}from"./chunk-4VDEBYW7.js";var d={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},b={name:"rm",async execute(p,s){let e=u("rm",p,d);if(!e.ok)return e.error;let c=e.result.flags.recursive||e.result.flags.recursiveUpper,a=e.result.flags.force,g=e.result.flags.verbose,i=e.result.positional;if(i.length===0)return a?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
3
- `,exitCode:1};let f="",t="",l=0;for(let r of i)try{let n=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(n)).isDirectory&&!c){t+=`rm: cannot remove '${r}': Is a directory
4
- `,l=1;continue}await s.fs.rm(n,{recursive:c,force:a}),g&&(f+=`removed '${r}'
5
- `)}catch(n){if(!a){let o=m(n);o.includes("ENOENT")||o.includes("no such file")?t+=`rm: cannot remove '${r}': No such file or directory
6
- `:o.includes("ENOTEMPTY")||o.includes("not empty")?t+=`rm: cannot remove '${r}': Directory not empty
7
- `:t+=`rm: cannot remove '${r}': ${o}
8
- `,l=1}}return{stdout:f,stderr:t,exitCode:l}}},h={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{b as a,h as b};
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as w}from"./chunk-UYBH3FNE.js";import{a as b}from"./chunk-4VDEBYW7.js";import{a as T,b as y,c as f}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";function u(s){let t=s.indexOf("=");if(t>=0){let r=s.slice(0,t),e=s.slice(t+1);return r?`${encodeURIComponent(r)}=${encodeURIComponent(e)}`:encodeURIComponent(e)}return encodeURIComponent(s)}function c(s){let t=s.indexOf("=");if(t<0)return null;let r=s.slice(0,t),e=s.slice(t+1),i,o,a=e.match(/;type=([^;]+)$/);a&&(o=a[1],e=e.slice(0,-a[0].length));let n=e.match(/;filename=([^;]+)/);return n&&(i=n[1],e=e.replace(n[0],"")),(e.startsWith("@")||e.startsWith("<"))&&(i=i??e.slice(1).split("/").pop()),{name:r,value:e,filename:i,contentType:o}}function O(s,t){let r=`----CurlFormBoundary${Date.now().toString(36)}`,e=[];for(let i of s){let o=i.value;if(o.startsWith("@")||o.startsWith("<")){let n=o.slice(1);o=t.get(n)??""}let a=`--${r}\r
3
- `;i.filename?(a+=`Content-Disposition: form-data; name="${i.name}"; filename="${i.filename}"\r
4
- `,i.contentType&&(a+=`Content-Type: ${i.contentType}\r
5
- `)):a+=`Content-Disposition: form-data; name="${i.name}"\r
6
- `,a+=`\r
7
- ${o}\r
8
- `,e.push(a)}return e.push(`--${r}--\r
9
- `),{body:e.join(""),boundary:r}}var S={name:"curl",summary:"transfer a URL",usage:"curl [OPTIONS] URL",options:["-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)","-H, --header HEADER Add header (can be used multiple times)","-d, --data DATA HTTP POST data"," --data-raw DATA HTTP POST data (no @ interpretation)"," --data-binary DATA HTTP POST binary data"," --data-urlencode DATA URL-encode and POST data","-F, --form NAME=VALUE Multipart form data","-u, --user USER:PASS HTTP authentication","-A, --user-agent STR Set User-Agent header","-e, --referer URL Set Referer header","-b, --cookie DATA Send cookies (name=value or @file)","-c, --cookie-jar FILE Save cookies to file","-T, --upload-file FILE Upload file (PUT)","-o, --output FILE Write output to file","-O, --remote-name Write to file named from URL","-I, --head Show headers only (HEAD request)","-i, --include Include response headers in output","-s, --silent Silent mode (no progress)","-S, --show-error Show errors even when silent","-f, --fail Fail silently on HTTP errors (no output)","-L, --location Follow redirects (default)"," --max-redirs NUM Maximum redirects (default: 20)","-m, --max-time SECS Maximum time for request"," --connect-timeout SECS Connection timeout","-w, --write-out FMT Output format after completion","-v, --verbose Verbose output"," --help Display this help and exit","","Note: Network access must be configured via BashEnv network option."," curl is not available by default for security reasons."]};function E(s){let t={method:"GET",headers:Object.create(null),dataBinary:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1};for(let r=0;r<s.length;r++){let e=s[r];if(e==="-X"||e==="--request")t.method=s[++r]??"GET";else if(e.startsWith("-X"))t.method=e.slice(2);else if(e.startsWith("--request="))t.method=e.slice(10);else if(e==="-H"||e==="--header"){let i=s[++r];if(i){let o=i.indexOf(":");if(o>0){let a=i.slice(0,o).trim(),n=i.slice(o+1).trim();t.headers[a]=n}}}else if(e.startsWith("--header=")){let i=e.slice(9),o=i.indexOf(":");if(o>0){let a=i.slice(0,o).trim(),n=i.slice(o+1).trim();t.headers[a]=n}}else if(e==="-d"||e==="--data"||e==="--data-raw")t.data=s[++r]??"",t.method==="GET"&&(t.method="POST");else if(e.startsWith("-d"))t.data=e.slice(2),t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data="))t.data=e.slice(7),t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data-raw="))t.data=e.slice(11),t.method==="GET"&&(t.method="POST");else if(e==="--data-binary")t.data=s[++r]??"",t.dataBinary=!0,t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data-binary="))t.data=e.slice(14),t.dataBinary=!0,t.method==="GET"&&(t.method="POST");else if(e==="--data-urlencode"){let i=s[++r]??"";t.data=(t.data?`${t.data}&`:"")+u(i),t.method==="GET"&&(t.method="POST")}else if(e.startsWith("--data-urlencode=")){let i=e.slice(17);t.data=(t.data?`${t.data}&`:"")+u(i),t.method==="GET"&&(t.method="POST")}else if(e==="-F"||e==="--form"){let i=s[++r]??"",o=c(i);o&&t.formFields.push(o),t.method==="GET"&&(t.method="POST")}else if(e.startsWith("--form=")){let i=e.slice(7),o=c(i);o&&t.formFields.push(o),t.method==="GET"&&(t.method="POST")}else if(e==="-u"||e==="--user")t.user=s[++r];else if(e.startsWith("-u"))t.user=e.slice(2);else if(e.startsWith("--user="))t.user=e.slice(7);else if(e==="-A"||e==="--user-agent")t.headers["User-Agent"]=s[++r]??"";else if(e.startsWith("-A"))t.headers["User-Agent"]=e.slice(2);else if(e.startsWith("--user-agent="))t.headers["User-Agent"]=e.slice(13);else if(e==="-e"||e==="--referer")t.headers.Referer=s[++r]??"";else if(e.startsWith("-e"))t.headers.Referer=e.slice(2);else if(e.startsWith("--referer="))t.headers.Referer=e.slice(10);else if(e==="-b"||e==="--cookie")t.headers.Cookie=s[++r]??"";else if(e.startsWith("-b"))t.headers.Cookie=e.slice(2);else if(e.startsWith("--cookie="))t.headers.Cookie=e.slice(9);else if(e==="-c"||e==="--cookie-jar")t.cookieJar=s[++r];else if(e.startsWith("--cookie-jar="))t.cookieJar=e.slice(13);else if(e==="-T"||e==="--upload-file")t.uploadFile=s[++r],t.method==="GET"&&(t.method="PUT");else if(e.startsWith("--upload-file="))t.uploadFile=e.slice(14),t.method==="GET"&&(t.method="PUT");else if(e==="-m"||e==="--max-time"){let i=parseFloat(s[++r]??"0");!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(e.startsWith("--max-time=")){let i=parseFloat(e.slice(11));!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(e==="--connect-timeout"){let i=parseFloat(s[++r]??"0");!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(e.startsWith("--connect-timeout=")){let i=parseFloat(e.slice(18));!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(e==="-o"||e==="--output")t.outputFile=s[++r];else if(e.startsWith("--output="))t.outputFile=e.slice(9);else if(e==="-O"||e==="--remote-name")t.useRemoteName=!0;else if(e==="-I"||e==="--head")t.headOnly=!0,t.method="HEAD";else if(e==="-i"||e==="--include")t.includeHeaders=!0;else if(e==="-s"||e==="--silent")t.silent=!0;else if(e==="-S"||e==="--show-error")t.showError=!0;else if(e==="-f"||e==="--fail")t.failSilently=!0;else if(e==="-L"||e==="--location")t.followRedirects=!0;else if(e==="--max-redirs")r++;else if(!e.startsWith("--max-redirs="))if(e==="-w"||e==="--write-out")t.writeOut=s[++r];else if(e.startsWith("--write-out="))t.writeOut=e.slice(12);else if(e==="-v"||e==="--verbose")t.verbose=!0;else{if(e.startsWith("--")&&e!=="--")return f("curl",e);if(e.startsWith("-")&&e!=="-")for(let i of e.slice(1))switch(i){case"s":t.silent=!0;break;case"S":t.showError=!0;break;case"f":t.failSilently=!0;break;case"L":t.followRedirects=!0;break;case"I":t.headOnly=!0,t.method="HEAD";break;case"i":t.includeHeaders=!0;break;case"O":t.useRemoteName=!0;break;case"v":t.verbose=!0;break;default:return f("curl",`-${i}`)}else e.startsWith("-")||(t.url=e)}}return t}function m(s){return Object.entries(s).map(([t,r])=>`${t}: ${r}`).join(`\r
10
- `)}function P(s){try{return new URL(s).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function h(s,t){let r=s;return r=r.replace(/%\{http_code\}/g,String(t.status)),r=r.replace(/%\{content_type\}/g,t.headers["content-type"]||""),r=r.replace(/%\{url_effective\}/g,t.url),r=r.replace(/%\{size_download\}/g,String(t.bodyLength)),r=r.replace(/\\n/g,`
11
- `),r}async function F(s,t){if(s.uploadFile){let r=t.fs.resolvePath(t.cwd,s.uploadFile);return{body:await t.fs.readFile(r)}}if(s.formFields.length>0){let r=new Map;for(let o of s.formFields)if(o.value.startsWith("@")||o.value.startsWith("<")){let a=t.fs.resolvePath(t.cwd,o.value.slice(1));try{let n=await t.fs.readFile(a);r.set(o.value.slice(1),n)}catch{r.set(o.value.slice(1),"")}}let{body:e,boundary:i}=O(s.formFields,r);return{body:e,contentType:`multipart/form-data; boundary=${i}`}}return s.data!==void 0?{body:s.data}:{}}function W(s,t){let r=w(s.headers??{});if(s.user){let e=Buffer.from(s.user).toString("base64");r.Authorization=`Basic ${e}`}return t&&!r["Content-Type"]&&(r["Content-Type"]=t),r}async function $(s,t,r){if(!s.cookieJar)return;let e=t["set-cookie"];if(!e)return;let i=r.fs.resolvePath(r.cwd,s.cookieJar);await r.fs.writeFile(i,e)}function k(s,t,r){let e="";if(s.verbose){e+=`> ${s.method} ${r}
12
- `;for(let[i,o]of Object.entries(s.headers))e+=`> ${i}: ${o}
13
- `;e+=`>
14
- `,e+=`< HTTP/1.1 ${t.status} ${t.statusText}
15
- `;for(let[i,o]of Object.entries(t.headers))e+=`< ${i}: ${o}
16
- `;e+=`<
17
- `}return s.includeHeaders&&!s.verbose&&(e+=`HTTP/1.1 ${t.status} ${t.statusText}\r
18
- `,e+=m(t.headers),e+=`\r
19
- \r
20
- `),s.headOnly?s.includeHeaders||s.verbose||(e+=`HTTP/1.1 ${t.status} ${t.statusText}\r
21
- `,e+=m(t.headers),e+=`\r
22
- `):e+=t.body,s.writeOut&&(e+=h(s.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.length})),e}var j={name:"curl",async execute(s,t){if(y(s))return T(S);let r=E(s);if("exitCode"in r)return r;let e=r;if(!e.url)return{stdout:"",stderr:`curl: no URL specified
23
- `,exitCode:2};if(!t.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available
24
- `,exitCode:1};let i=e.url;i.match(/^https?:\/\//)||(i=`https://${i}`);try{let{body:o,contentType:a}=await F(e,t),n=W(e,a),l=await t.fetch(i,{method:e.method,headers:Object.keys(n).length>0?n:void 0,body:o,followRedirects:e.followRedirects,timeoutMs:e.timeoutMs});if(await $(e,l.headers,t),e.failSilently&&l.status>=400)return{stdout:"",stderr:e.showError||!e.silent?`curl: (22) The requested URL returned error: ${l.status}
25
- `:"",exitCode:22};let d=k(e,l,i);if(e.outputFile||e.useRemoteName){let p=e.outputFile||P(i),v=t.fs.resolvePath(t.cwd,p);await t.fs.writeFile(v,e.headOnly?"":l.body),e.verbose||(d=""),e.writeOut&&(d=h(e.writeOut,{status:l.status,headers:l.headers,url:l.url,bodyLength:l.body.length}))}return{stdout:d,stderr:"",exitCode:0}}catch(o){let a=b(o),n=1;return a.includes("Network access denied")?n=7:a.includes("HTTP method")&&a.includes("not allowed")?n=3:a.includes("Redirect target not in allow-list")||a.includes("Too many redirects")?n=47:a.includes("aborted")&&(n=28),{stdout:"",stderr:!e.silent||e.showError?`curl: (${n}) ${a}
26
- `:"",exitCode:n}}}};export{j as curlCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-2SIXTZCJ.js";import"./chunk-SE4C7FJY.js";import"./chunk-KGOUQS5A.js";export{a as exprCommand,b as flagsForFuzzing};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-253LRF5J.js";import"./chunk-GIFF636B.js";import"./chunk-4OALHZXB.js";import"./chunk-SE4C7FJY.js";import"./chunk-D5WP4CKS.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as findCommand,b as flagsForFuzzing};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{b as yr}from"./chunk-435ZOZCY.js";import{b as Ar}from"./chunk-3NVWSLHI.js";import{b as $r}from"./chunk-7SWOLTCR.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import{c as Sr}from"./chunk-4PZYIYYG.js";import{b as wr}from"./chunk-XKPFI566.js";import{b as xr}from"./chunk-2BC3N3L2.js";import{b as vr}from"./chunk-IDGH4PGU.js";import{b as kr}from"./chunk-F3LGZXLQ.js";import{b as qr}from"./chunk-BYDV4VEF.js";import{b as Cr}from"./chunk-JLX6YWGA.js";import{b as br}from"./chunk-FLPVVSN5.js";import{d as Ir,e as Mr,f as jr}from"./chunk-54G6AE72.js";import{b as tr}from"./chunk-DREQRXNN.js";import{b as lr}from"./chunk-2FFXXW3F.js";import{b as ur}from"./chunk-THALLNXT.js";import{b as pr}from"./chunk-2SIXTZCJ.js";import{b as er}from"./chunk-3Y32LPNT.js";import{b as dr}from"./chunk-7BORMNPQ.js";import{b as cr}from"./chunk-N43DJTSI.js";import"./chunk-OBI37ZY4.js";import{b as hr}from"./chunk-N5OTVT4F.js";import{c as or,d as ar}from"./chunk-MAVV76T4.js";import{b as sr}from"./chunk-JTF74J6E.js";import{c as ir,d as gr}from"./chunk-GO6FXSC4.js";import{b as mr}from"./chunk-RYXW3SZQ.js";import"./chunk-EPIOK4SY.js";import"./chunk-UYBH3FNE.js";import{b as Fr}from"./chunk-GOJZHH3L.js";import{b as zr}from"./chunk-P6GNZPVW.js";import{b as fr}from"./chunk-LOJMXC4F.js";import{b as nr}from"./chunk-JNPUO56K.js";import{b as R}from"./chunk-PQNTKMH3.js";import{b as U}from"./chunk-PPBQJBC2.js";import{b as V}from"./chunk-NSUMEERA.js";import{b as W}from"./chunk-XY5HGZW5.js";import{c as X,d as Y}from"./chunk-N4EU64Y4.js";import{c as Z,d as _}from"./chunk-3MBAUIBB.js";import{b as N}from"./chunk-RT7TRQVZ.js";import{b as rr}from"./chunk-47HZU3SY.js";import{b as G}from"./chunk-RJSAGJQJ.js";import{b as H}from"./chunk-YEKSVVRC.js";import{b as J}from"./chunk-26NO42TF.js";import{b as K}from"./chunk-LGJM5YFT.js";import{b as L}from"./chunk-LMK6G2HH.js";import{b as O}from"./chunk-ZKC5HQYO.js";import{b as P}from"./chunk-ROJPSS6N.js";import{b as Q}from"./chunk-253LRF5J.js";import{b as y}from"./chunk-CGE2EHYP.js";import{b as A}from"./chunk-ZA4HUKJ3.js";import{b as $}from"./chunk-WWZVR5NN.js";import{b as S}from"./chunk-JQBC3FXE.js";import{b as T}from"./chunk-KPWFKFSD.js";import{b as B}from"./chunk-5G2VOPPJ.js";import{b as D}from"./chunk-SGA7Y45Z.js";import{b as E}from"./chunk-EUXCM6C4.js";import{b as w}from"./chunk-YLE2OYY6.js";import{b as x}from"./chunk-S7OHMN3F.js";import{b as v}from"./chunk-XAL6VWGA.js";import{d as k,e as q,f as C}from"./chunk-GA6KXSOC.js";import"./chunk-GIFF636B.js";import{b}from"./chunk-35JD7YEM.js";import"./chunk-4OALHZXB.js";import"./chunk-G43H2WGH.js";import{b as I}from"./chunk-6L4K3UGO.js";import{b as M}from"./chunk-VZKEP45B.js";import{b as j}from"./chunk-FA2CHD73.js";import{b as t}from"./chunk-YYQ22ZRL.js";import{b as l}from"./chunk-PS4LOXE5.js";import{b as u}from"./chunk-VNER2XXL.js";import{b as p}from"./chunk-4E3LY6YK.js";import{b as e}from"./chunk-5VFN7VVJ.js";import{b as d}from"./chunk-TEFXEYX3.js";import{b as c}from"./chunk-D2GFNFUN.js";import{b as h}from"./chunk-SXRVLCZ4.js";import"./chunk-FSZWFMB4.js";import"./chunk-4FNW6LFM.js";import"./chunk-JJHAWOIB.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import{b as i}from"./chunk-LJKIWB5F.js";import{b as g}from"./chunk-MRP4ZCD7.js";import"./chunk-5WFYIUU2.js";import{b as m}from"./chunk-ND23BJUM.js";import"./chunk-D5WP4CKS.js";import"./chunk-6KZRLMG3.js";import{b as F}from"./chunk-MXVNCVD6.js";import"./chunk-OBH7XN5N.js";import{b as z}from"./chunk-KWLLB7S3.js";import{b as f}from"./chunk-EJQKHROT.js";import"./chunk-JBABAK44.js";import{b as n}from"./chunk-ITA43A73.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-RYXW3SZQ.js";import"./chunk-EPIOK4SY.js";import"./chunk-UYBH3FNE.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as jqCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-4E3LY6YK.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as lnCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-KWLLB7S3.js";import"./chunk-JBABAK44.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as mkdirCommand};
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as A}from"./chunk-IYZRLSTQ.js";import{b as _}from"./chunk-4FNW6LFM.js";import{a as D,b as x,c as C,d as h}from"./chunk-JJHAWOIB.js";import{a as U}from"./chunk-4PRVMER6.js";import{a as I,b as P}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{fileURLToPath as b}from"node:url";import{Worker as v}from"node:worker_threads";var c={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,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200},a={PENDING:0,READY:1,SUCCESS:2,ERROR:3},l={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},r={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},p={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},R={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 L(){return new C(p.TOTAL)}var m=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return h.load(this.int32View,r.OP_CODE/4)}setOpCode(t){h.store(this.int32View,r.OP_CODE/4,t)}getStatus(){return h.load(this.int32View,r.STATUS/4)}setStatus(t){h.store(this.int32View,r.STATUS/4,t)}getPathLength(){return h.load(this.int32View,r.PATH_LENGTH/4)}setPathLength(t){h.store(this.int32View,r.PATH_LENGTH/4,t)}getDataLength(){return h.load(this.int32View,r.DATA_LENGTH/4)}setDataLength(t){h.store(this.int32View,r.DATA_LENGTH/4,t)}getResultLength(){return h.load(this.int32View,r.RESULT_LENGTH/4)}setResultLength(t){h.store(this.int32View,r.RESULT_LENGTH/4,t)}getErrorCode(){return h.load(this.int32View,r.ERROR_CODE/4)}setErrorCode(t){h.store(this.int32View,r.ERROR_CODE/4,t)}getFlags(){return h.load(this.int32View,r.FLAGS/4)}setFlags(t){h.store(this.int32View,r.FLAGS/4,t)}getMode(){return h.load(this.int32View,r.MODE/4)}setMode(t){h.store(this.int32View,r.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(r.PATH_BUFFER,r.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>p.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${p.PATH_BUFFER}`);this.uint8View.set(e,r.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(r.DATA_BUFFER,r.DATA_BUFFER+t)}setData(t){if(t.length>p.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,r.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(r.DATA_BUFFER,r.DATA_BUFFER+t)}setResult(t){if(t.length>p.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,r.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[r.DATA_BUFFER+u.IS_FILE]=t.isFile?1:0,this.uint8View[r.DATA_BUFFER+u.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[r.DATA_BUFFER+u.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(r.DATA_BUFFER+u.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(r.DATA_BUFFER+u.SIZE,e,!0),this.dataView.setFloat64(r.DATA_BUFFER+u.MTIME,t.mtime.getTime(),!0),this.setResultLength(u.TOTAL)}decodeStat(){return{isFile:this.uint8View[r.DATA_BUFFER+u.IS_FILE]===1,isDirectory:this.uint8View[r.DATA_BUFFER+u.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[r.DATA_BUFFER+u.IS_SYMLINK]===1,mode:this.dataView.getInt32(r.DATA_BUFFER+u.MODE,!0),size:this.dataView.getFloat64(r.DATA_BUFFER+u.SIZE,!0),mtime:new Date(this.dataView.getFloat64(r.DATA_BUFFER+u.MTIME,!0))}}waitForReady(t){return h.wait(this.int32View,r.STATUS/4,a.PENDING,t)}waitForReadyAsync(t){return h.waitAsync(this.int32View,r.STATUS/4,a.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getStatus();if(s===a.READY)return!0;let o=Date.now()-e;if(o>=t)return!1;let n=t-o,d=h.waitAsync(this.int32View,r.STATUS/4,s,n);if(d.async&&await d.value==="timed-out")return!1}}waitForResult(t){return h.wait(this.int32View,r.STATUS/4,a.READY,t)}notify(){return h.notify(this.int32View,r.STATUS/4)}reset(){this.setOpCode(c.NOOP),this.setStatus(a.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(l.NONE),this.setFlags(R.NONE),this.setMode(0)}};var g=class{fs;cwd;secureFetch;maxOutputSize;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;constructor(t,e,s,o=void 0,n=0){this.fs=e,this.cwd=s,this.secureFetch=o,this.maxOutputSize=n,this.protocol=new m(t)}async run(t){this.running=!0;let e=Date.now();for(;this.running;){let s=Date.now()-e;if(s>=t){this.output.stderr+=`
3
- python3: execution timeout exceeded
4
- `,this.output.exitCode=124;break}let o=t-s;if(!await this.protocol.waitUntilReady(o)){this.output.stderr+=`
5
- python3: execution timeout exceeded
6
- `,this.output.exitCode=124;break}let d=this.protocol.getOpCode();await this.handleOperation(d),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case c.READ_FILE:await this.handleReadFile();break;case c.WRITE_FILE:await this.handleWriteFile();break;case c.STAT:await this.handleStat();break;case c.LSTAT:await this.handleLstat();break;case c.READDIR:await this.handleReaddir();break;case c.MKDIR:await this.handleMkdir();break;case c.RM:await this.handleRm();break;case c.EXISTS:await this.handleExists();break;case c.APPEND_FILE:await this.handleAppendFile();break;case c.SYMLINK:await this.handleSymlink();break;case c.READLINK:await this.handleReadlink();break;case c.CHMOD:await this.handleChmod();break;case c.REALPATH:await this.handleRealpath();break;case c.WRITE_STDOUT:this.handleWriteStdout();break;case c.WRITE_STDERR:this.handleWriteStderr();break;case c.EXIT:this.handleExit();break;case c.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setStatus(a.ERROR)}}catch(e){this.setErrorFromException(e)}}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.protocol.setResult(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(a.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.setStatus(a.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.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&R.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setStatus(a.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&R.RECURSIVE)!==0,o=(e&R.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:o}),this.protocol.setStatus(a.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.setStatus(a.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.setStatus(a.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.setStatus(a.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(a.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.setStatus(a.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.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(a.ERROR);return}this.protocol.setStatus(a.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(a.ERROR);return}this.protocol.setStatus(a.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setStatus(a.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=`python3: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
7
- `,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let o=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(o>0)if(this.output.stdout.length>=o)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-o);else{let n=o-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(){if(!this.secureFetch){this.protocol.setErrorCode(l.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(a.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},o=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),n=JSON.stringify({status:o.status,statusText:o.statusText,headers:o.headers,body:o.body,url:o.url});this.protocol.setResultFromString(n),this.protocol.setStatus(a.SUCCESS)}catch(s){let o=A(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(l.NETWORK_ERROR),this.protocol.setResultFromString(o),this.protocol.setStatus(a.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=A(e),o=l.IO_ERROR,n=e.toLowerCase();n.includes("no such file")||n.includes("not found")||n.includes("enoent")?o=l.NOT_FOUND:n.includes("is a directory")||n.includes("eisdir")?o=l.IS_DIRECTORY:n.includes("not a directory")||n.includes("enotdir")?o=l.NOT_DIRECTORY:n.includes("already exists")||n.includes("eexist")?o=l.EXISTS:(n.includes("permission")||n.includes("eperm")||n.includes("eacces"))&&(o=l.PERMISSION_DENIED),this.protocol.setErrorCode(o),this.protocol.setResultFromString(s),this.protocol.setStatus(a.ERROR)}};var B=3e4,H={name:"python3",summary:"Execute Python code via CPython Emscripten",usage:"python3 [OPTIONS] [-c CODE | -m MODULE | FILE] [ARGS...]",description:["Execute Python code using CPython compiled to WebAssembly via Emscripten.","","This command runs Python in an isolated environment with access to","the virtual filesystem. Standard library modules are available."],options:["-c CODE Execute CODE as Python script","-m MODULE Run library module as a script","--version Show Python version","--help Show this help"],examples:['python3 -c "print(1 + 2)"','python3 -c "import sys; print(sys.version)"',"python3 script.py","python3 script.py arg1 arg2",`echo 'print("hello")' | python3`],notes:["CPython runs in WebAssembly, so execution may be slower than native Python.","Standard library modules are available (no pip install).","Maximum execution time is 30 seconds by default."]};function W(i){let t={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(i.length===0)return t;let e=i.findIndex(s=>!s.startsWith("-")||s==="-"||s==="--");for(let s=0;s<(e===-1?i.length:e);s++){let o=i[s];if(o==="-c")return s+1>=i.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
8
- `,exitCode:2}:(t.code=i[s+1],t.scriptArgs=i.slice(s+2),t);if(o==="-m")return s+1>=i.length?{stdout:"",stderr:`python3: option requires an argument -- 'm'
9
- `,exitCode:2}:(t.module=i[s+1],t.scriptArgs=i.slice(s+2),t);if(o==="--version"||o==="-V")return t.showVersion=!0,t;if(o.startsWith("-")&&o!=="-")return{stdout:"",stderr:`python3: unrecognized option '${o}'
10
- `,exitCode:2}}if(e!==-1){let s=i[e];s==="--"?e+1<i.length&&(t.scriptFile=i[e+1],t.scriptArgs=i.slice(e+2)):(t.scriptFile=s,t.scriptArgs=i.slice(e+1))}return t}var O=new WeakMap;function z(i){let t=O.get(i);return t||(t={executionQueue:[],isExecuting:!1},O.set(i,t)),t}function at(){O=new WeakMap}var G=b(new URL("./worker.js",import.meta.url));function $(i){if(!i||typeof i!="object")return{success:!1,error:"Malformed worker response"};let t=i;return t.type==="security-violation"?{success:!1,error:`Security violation: ${typeof t.violation?.type=="string"?t.violation.type:"unknown"}`}:typeof t.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:t.success?{success:!0}:{success:!1,error:typeof t.error=="string"&&t.error.length>0?t.error:"Worker execution failed"}}function f(i){if(i.isExecuting||i.executionQueue.length===0)return;for(;i.executionQueue.length>0&&i.executionQueue[0].canceled;)i.executionQueue.shift();if(i.executionQueue.length===0)return;let t=i.executionQueue.shift();if(!t)return;i.isExecuting=!0;let e=_.runTrusted(()=>new v(G,{workerData:t.input}));t.workerRef&&(t.workerRef.current=e),e.on("message",s=>{t.resolve($(s)),i.isExecuting=!1,e.terminate(),f(i)}),e.on("error",s=>{t.resolve({success:!1,error:s.message}),i.isExecuting=!1,f(i)}),e.on("exit",()=>{i.isExecuting&&(t.resolve({success:!1,error:"Worker exited unexpectedly"}),i.isExecuting=!1,f(i))})}async function Y(i,t,e,s=[]){let o=L(),n=new g(o,t.fs,t.cwd,t.fetch,t.limits?.maxOutputSize??0),d=t.limits?.maxPythonTimeoutMs??B,w=z(t.fs),N={sharedBuffer:o,pythonCode:i,cwd:t.cwd,env:U(t.env),args:s,scriptPath:e},T={current:null},V=new Promise(E=>{let y={input:N,resolve:()=>{},workerRef:T},M=D(()=>{T.current?T.current.terminate():y.canceled=!0,E({success:!1,error:`Execution timeout: exceeded ${d}ms limit`})},d);y.resolve=k=>{x(M),E(k)},w.executionQueue.push(y),f(w)}),[S,F]=await Promise.all([n.run(d).catch(E=>({stdout:"",stderr:`python3: bridge error: ${E.message}
11
- `,exitCode:1})),V.catch(E=>({success:!1,error:E.message}))]);return!F.success&&F.error?{stdout:S.stdout,stderr:`${S.stderr}python3: ${F.error}
12
- `,exitCode:S.exitCode||1}:S}var K={name:"python3",async execute(i,t){if(P(i))return I(H);let e=W(i);if("exitCode"in e)return e;if(e.showVersion)return{stdout:`Python 3.13.2 (Emscripten)
13
- `,stderr:"",exitCode:0};let s,o;if(e.code!==null)s=e.code,o="-c";else if(e.module!==null){if(!/^[a-zA-Z_][a-zA-Z0-9_.]*$/.test(e.module))return{stdout:"",stderr:`python3: No module named '${e.module.slice(0,200)}'
14
- `,exitCode:1};s=`import runpy; runpy.run_module('${e.module}', run_name='__main__')`,o=e.module}else if(e.scriptFile!==null){let n=t.fs.resolvePath(t.cwd,e.scriptFile);if(!await t.fs.exists(n))return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': [Errno 2] No such file or directory
15
- `,exitCode:2};try{s=await t.fs.readFile(n),o=e.scriptFile}catch(d){return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': ${d.message}
16
- `,exitCode:2}}}else if(t.stdin.trim())s=t.stdin,o="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
17
- `,exitCode:2};return Y(s,t,o,e.scriptArgs)}},ht={name:"python",async execute(i,t){return K.execute(i,t)}};export{at as _resetExecutionQueue,K as python3Command,ht as pythonCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-YYQ22ZRL.js";import"./chunk-JBABAK44.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as rmCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-6L4K3UGO.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as sedCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-JNPUO56K.js";import"./chunk-JJHAWOIB.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as sleepCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b,c}from"./chunk-4PZYIYYG.js";import"./chunk-4FNW6LFM.js";import"./chunk-JJHAWOIB.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as _internals,c as flagsForFuzzing,b as sqlite3Command};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-XAL6VWGA.js";import"./chunk-JBABAK44.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as statCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-435ZOZCY.js";import"./chunk-4FNW6LFM.js";import"./chunk-SE4C7FJY.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as tarCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-2FFXXW3F.js";import"./chunk-4OALHZXB.js";import"./chunk-JJHAWOIB.js";import"./chunk-4PRVMER6.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as timeCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-DREQRXNN.js";import"./chunk-4OALHZXB.js";import"./chunk-JJHAWOIB.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as timeoutCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-KPWFKFSD.js";import"./chunk-JBABAK44.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as trCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-7SWOLTCR.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import"./chunk-EPIOK4SY.js";import"./chunk-UYBH3FNE.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as xanCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-3NVWSLHI.js";import"./chunk-QSDVMMYI.js";import"./chunk-EPIOK4SY.js";import"./chunk-UYBH3FNE.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as yqCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b}from"./chunk-VZKEP45B.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as awkCommand2,b as flagsForFuzzing};
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as Y}from"./chunk-GIFF636B.js";import{a as ne}from"./chunk-4OALHZXB.js";import{a as te}from"./chunk-SE4C7FJY.js";import{a as oe,b as pe,c as ce}from"./chunk-D5WP4CKS.js";import{a as ie,b as le}from"./chunk-GTNBSMZR.js";function N(e,t){switch(e.type){case"name":{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let s=r[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,r=t.relativePath,s=n.split("/");for(let i=0;i<s.length-1;i++){let a=s[i];if(a&&a!=="."&&a!==".."&&!a.includes("*")&&!a.includes("?")&&!a.includes("[")){let p=`/${a}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let i=o[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:te(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let r=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=r>e.days:e.comparison==="less"?s=r<e.days:s=Math.floor(r)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let r;return e.comparison==="more"?r=t.size>n:e.comparison==="less"?r=t.size<n:e.unit==="b"?r=Math.ceil(t.size/512)===e.value:r=t.size===n,{matches:r,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,r=e.mode&511,s;return e.matchType==="exact"?s=n===r:e.matchType==="all"?s=(n&r)===r:s=(n&r)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=N(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=N(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=N(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case"or":{let n=N(e.left,t);if(n.matches)return n;let r=N(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function _(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right)}}function j(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return j(e.expr);case"and":case"or":return j(e.left)||j(e.right);default:return!1}}function fe(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=ve(e);if(Ee(e)&&n.length===1){let o=n[0].split("/").filter(i=>i.length>0);if(o.length>=2)for(let i=o.length-2;i>=0;i--){let a=o[i];if(!a.includes("*")&&!a.includes("?")&&!a.includes("[")&&a!=="."&&a!==".."){let p=o[i+1];if(p&&(p.includes("*")||p.includes("?"))){t.terminalDirName=a;let l=p.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function ve(e){let t=[],n=r=>{r.type==="path"?t.push(r.pattern):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right))};return n(e),t}function Ee(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function ue(e){let t=[],n=r=>{r&&(r.type==="newer"?t.push(r.refPath):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function H(e,t,n,r,s){switch(e.type){case"name":{let o=e.pattern,i=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(i){let a=i[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,i=o.split("/");for(let p=0;p<i.length-1;p++){let l=i[p];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let d=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(d))return{matches:!1,pruned:!1,printed:!1}}}let a=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let p=a[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(p))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:te(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:r,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let o=H(e.expr,t,n,r,s);return{matches:!o.matches,pruned:o.pruned,printed:!1}}case"and":{let o=H(e.left,t,n,r,s);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1};let i=H(e.right,t,n,r,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:o.printed||i.printed}}case"or":{let o=H(e.left,t,n,r,s);if(o.matches)return o;let i=H(e.right,t,n,r,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:i.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function V(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return V(e.expr);case"and":case"or":return V(e.left)||V(e.right);default:return!1}}function W(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return W(e.expr);case"and":case"or":return W(e.left)&&W(e.right)}}function he(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!W(e))return se(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:N(e,n).pruned}}function se(e,t){switch(e.type){case"or":{if(W(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(N(e.left,n).pruned)return{shouldPrune:!0}}return se(e.right,t)}case"and":{if(W(e.left)&&W(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:N(e,n).pruned}}if(W(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return N(e.left,n).matches?se(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function de(e,t){let n=[],r=[],s=t;for(;s<e.length;){let i=e[s];if(i==="("||i==="\\("){n.push({type:"lparen"}),s++;continue}if(i===")"||i==="\\)"){n.push({type:"rparen"}),s++;continue}if(i==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(i==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(i==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(i==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(i==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(i==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(i==="-type"&&s+1<e.length){let a=e[++s];if(a==="f"||a==="d")n.push({type:"expr",expr:{type:"type",fileType:a}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${a}
3
- `,actions:[]}}else if(i==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(i==="-mtime"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("+")?(p="more",l=a.slice(1)):a.startsWith("-")&&(p="less",l=a.slice(1));let d=parseInt(l,10);Number.isNaN(d)||n.push({type:"expr",expr:{type:"mtime",days:d,comparison:p}})}else if(i==="-newer"&&s+1<e.length){let a=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:a}})}else if(i==="-size"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("+")?(p="more",l=a.slice(1)):a.startsWith("-")&&(p="less",l=a.slice(1));let d=l.match(/^(\d+)([ckMGb])?$/);if(d){let B=parseInt(d[1],10),I=d[2]||"b";n.push({type:"expr",expr:{type:"size",value:B,unit:I,comparison:p}})}}else if(i==="-perm"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("-")?(p="all",l=a.slice(1)):a.startsWith("/")&&(p="any",l=a.slice(1));let d=parseInt(l,8);Number.isNaN(d)||n.push({type:"expr",expr:{type:"perm",mode:d,matchType:p}})}else if(i==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(i==="-not"||i==="!")n.push({type:"not"});else if(i==="-o"||i==="-or")n.push({type:"op",op:"or"});else if(i==="-a"||i==="-and")n.push({type:"op",op:"and"});else if(i==="-maxdepth"||i==="-mindepth")s++;else if(i!=="-depth")if(i==="-exec"){let a=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)a.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let p=e[s]==="+";r.push({type:"exec",command:a,batchMode:p})}else if(i==="-print")n.push({type:"expr",expr:{type:"print"}}),r.push({type:"print"});else if(i==="-print0")r.push({type:"print0"});else if(i==="-printf"&&s+1<e.length){let a=e[++s];r.push({type:"printf",format:a})}else if(i==="-delete")r.push({type:"delete"});else{if(i.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${i}'
4
- `,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:r};let o=Me(n);return o.error?{expr:null,pathIndex:s,error:o.error,actions:r}:{expr:o.expr,pathIndex:s,actions:r}}function Me(e){let t=0;function n(){let a=r();if(!a)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="or"){t++;let l=r();if(!l)return a;a={type:"or",left:a,right:l}}else break}return a}function r(){let a=s();if(!a)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="and"){t++;let l=s();if(!l)return a;a={type:"and",left:a,right:l}}else if(p.type==="expr"||p.type==="not"||p.type==="lparen"){let l=s();if(!l)return a;a={type:"and",left:a,right:l}}else break}return a}function s(){if(t<e.length&&e[t].type==="not"){t++;let a=s();return a?{type:"not",expr:a}:null}return o()}function o(){if(t>=e.length)return null;let a=e[t];if(a.type==="lparen"){t++;let p=n();return t<e.length&&e[t].type==="rparen"&&t++,p}return a.type==="expr"?(t++,a.expr):(a.type==="rparen",null)}return{expr:n()}}var me=500;function xe(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function Fe(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var Ie={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},$e=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),_e={name:"find",async execute(e,t){if(le(e))return ie(Ie);let n=[],r=null,s=null,o=!1,i=!1;for(let c=0;c<e.length;c++){let f=e[c];if(f==="-maxdepth"&&c+1<e.length)i=!0,r=parseInt(e[++c],10);else if(f==="-mindepth"&&c+1<e.length)i=!0,s=parseInt(e[++c],10);else if(f==="-depth")i=!0,o=!0;else if(f==="-exec")for(i=!0,c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else!f.startsWith("-")&&f!==";"&&f!=="+"&&f!=="("&&f!==")"&&f!=="\\("&&f!=="\\)"&&f!=="!"?i||n.push(f):$e.has(f)?(i=!0,c++):(f.startsWith("-")||f==="("||f==="\\("||f==="!")&&(i=!0)}n.length===0&&n.push(".");let{expr:a,error:p,actions:l}=de(e,0);if(p)return{stdout:"",stderr:p,exitCode:1};let d=l.some(c=>c.type==="print"),B=l.length===0,I=[],ye=l.some(c=>c.type==="printf"),re=[],q="",G=0,ge=ue(a),U=new Map;for(let c of ge){let f=t.fs.resolvePath(t.cwd,c);try{let h=await t.fs.stat(f);U.set(c,h.mtime?.getTime()??Date.now())}catch{}}let we=l.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),De=_(a)||we,Te=j(a),K=fe(a),ae=V(a),Ce=J(a),Pe=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let z=function(u){let R=s===null||u.depth>=s,P=!1;if(R&&a!==null){let S=Date.now(),y;if(Ce)y=H(a,u.name,u.relativePath,u.isFile,u.isDirectory);else{let m={name:u.name,relativePath:u.relativePath,isFile:u.isFile,isDirectory:u.isDirectory,isEmpty:u.isEmpty,mtime:u.stat?.mtime?.getTime()??Date.now(),size:u.stat?.size??0,mode:u.stat?.mode??420,newerRefTimes:U};y=N(a,m)}R=y.matches,P=d?y.printed:R,h.evalCalls++,h.evalTime+=Date.now()-S}else R&&(P=!0);return P?{print:!0,printfData:ye?{path:u.relativePath,name:u.name,size:u.stat?.size??0,mtime:u.stat?.mtime?.getTime()??Date.now(),mode:u.stat?.mode??420,isDirectory:u.isDirectory,depth:u.depth,startingPoint:c}:null}:{print:!1,printfData:null}};var We=z;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{q+=`find: ${c}: No such file or directory
5
- `,G=1;continue}let h=xe(),$=Date.now();async function v(u){let{path:b,depth:R,typeInfo:P}=u;if(h.nodeCount++,R>(r??256))return null;let E,S,y;if(P&&!De)E=P.isFile,S=P.isDirectory;else{try{let L=Date.now();y=await t.fs.stat(b),h.statCalls++,h.statTime+=Date.now()-L}catch{return null}if(!y)return null;E=y.isFile,S=y.isDirectory}let m;b===f?m=c.split("/").pop()||c:m=b.split("/").pop()||"";let g=b===f?c:c==="."?`./${b.slice(f==="/"?f.length:f.length+1)}`:c+b.slice(f.length),T=[],C=null,w=null,D=!1;S&&ae&&!o&&(D=he(a,{name:m,relativePath:g,isFile:E,isDirectory:S}).shouldPrune,D&&h.earlyPrunes++);let x=R>=(r??256),F=K.terminalDirName!==null&&m===K.terminalDirName,Z=!x&&!F&&!D;if(S&&((Z||Te||F)&&!D)){let L=Date.now();if(Pe&&t.fs.readdirWithFileTypes){if(C=await t.fs.readdirWithFileTypes(b),w=C.map(M=>M.name),h.readdirCalls++,h.readdirTime+=Date.now()-L,Z)T=C.map((M,k)=>({path:b==="/"?`/${M.name}`:`${b}/${M.name}`,depth:R+1,typeInfo:{isFile:M.isFile,isDirectory:M.isDirectory},resultIndex:k}));else if(F){let M=K.requiredExtension;T=C.filter(k=>k.isFile&&(!M||k.name.endsWith(M))).map((k,be)=>({path:b==="/"?`/${k.name}`:`${b}/${k.name}`,depth:R+1,typeInfo:{isFile:k.isFile,isDirectory:k.isDirectory},resultIndex:be}))}}else w=await t.fs.readdir(b),h.readdirCalls++,h.readdirTime+=Date.now()-L,Z&&(T=w.map((M,k)=>({path:b==="/"?`/${M}`:`${b}/${M}`,depth:R+1,resultIndex:k})))}let Q=E?(y?.size??0)===0:w!==null&&w.length===0,O=D;if(!o&&a!==null&&!D&&ae){let L=Date.now(),M={name:m,relativePath:g,isFile:E,isDirectory:S,isEmpty:Q,mtime:y?.mtime?.getTime()??Date.now(),size:y?.size??0,mode:y?.mode??420,newerRefTimes:U};O=N(a,M).pruned,h.evalCalls++,h.evalTime+=Date.now()-L}return{relativePath:g,name:m,isFile:E,isDirectory:S,isEmpty:Q,stat:y,depth:R,children:O?[]:T,pruned:O}}async function Se(){let u={paths:[],printfData:[]};if(o){let y=function(m){let g={paths:[],printfData:[]},T=P[m];if(!T)return g;for(let D of T.childIndices){let x=y(D);g.paths.push(...x.paths),g.printfData.push(...x.printfData)}let{print:C,printfData:w}=z(T.node);return C&&(g.paths.push(T.node.relativePath),w&&g.printfData.push(w)),g};var b=y;let P=[],E=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map;for(;E.length>0;){let m=Date.now(),g=E.splice(0,me),T=await Promise.all(g.map(C=>v(C.item)));h.batchCount++,h.batchTime+=Date.now()-m;for(let C=0;C<g.length;C++){let w=T[C],D=g[C];if(!w)continue;let x=P.length;if(D.parentIndex>=0){let F=S.get(D.parentIndex)||[];F.push(x),S.set(D.parentIndex,F)}P.push({node:w,parentIndex:D.parentIndex,childIndices:[]});for(let F=0;F<w.children.length;F++)E.push({item:w.children[F],parentIndex:x,childOrderInParent:F})}}for(let[m,g]of S)m>=0&&m<P.length&&(P[m].childIndices=g);if(P.length>0){let m=y(0);u.paths.push(...m.paths),u.printfData.push(...m.printfData)}}else{let m=function(g){let T=P.get(g);T&&(u.paths.push(T.path),T.printfData&&u.printfData.push(T.printfData));let C=y.get(g);if(C)for(let w of C)m(w)};var R=m;let P=new Map,E=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:E++}],y=new Map;for(;S.length>0;){let g=Date.now(),T=S.splice(0,me),C=await Promise.all(T.map(async({item:w,orderIndex:D})=>{let x=await v(w);return x?{node:x,orderIndex:D}:null}));h.batchCount++,h.batchTime+=Date.now()-g;for(let w of C){if(!w)continue;let{node:D,orderIndex:x}=w,{print:F,printfData:Z}=z(D);if(F&&P.set(x,{path:D.relativePath,printfData:Z}),D.children.length>0){let ee=[];for(let Q of D.children){let O=E++;ee.push(O),S.push({item:Q,orderIndex:O})}y.set(x,ee)}}}m(0)}return u}let X=await Se();if(I.push(...X.paths),re.push(...X.printfData),t.trace){let u=Date.now()-$;Fe(t.trace,h,u),t.trace({category:"find",name:"searchPath",durationMs:u,details:{path:c,resultsFound:X.paths.length}})}}let A="";if(l.length>0)for(let c of l)switch(c.type){case"print":A+=I.length>0?`${I.join(`
6
- `)}
7
- `:"";break;case"print0":A+=I.length>0?`${I.join("\0")}\0`:"";break;case"delete":{let f=[...I].sort((h,$)=>$.length-h.length);for(let h of f){let $=t.fs.resolvePath(t.cwd,h);try{await t.fs.rm($,{recursive:!1})}catch(v){let z=v instanceof Error?v.message:String(v);q+=`find: cannot delete '${h}': ${z}
8
- `,G=1}}break}case"printf":for(let f of re)A+=Re(c.format,f);break;case"exec":if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
9
- `,exitCode:1};if(c.batchMode){let f=[];for(let v of c.command)v==="{}"?f.push(...I):f.push(v);let h=ne(f),$=await t.exec(h,{cwd:t.cwd,signal:t.signal});A+=$.stdout,q+=$.stderr,$.exitCode!==0&&(G=$.exitCode)}else for(let f of I){let h=c.command.map(z=>z==="{}"?f:z),$=ne(h),v=await t.exec($,{cwd:t.cwd,signal:t.signal});A+=v.stdout,q+=v.stderr,v.exitCode!==0&&(G=v.exitCode)}break}else B&&(A=I.length>0?`${I.join(`
10
- `)}
11
- `:"");return{stdout:A,stderr:q,exitCode:G}}};function Re(e,t){let n=ce(e),r="",s=0;for(;s<n.length;)if(n[s]==="%"&&s+1<n.length){if(s++,n[s]==="%"){r+="%",s++;continue}let[o,i,a]=pe(n,s);if(s+=a,s>=n.length){r+="%";break}let p=n[s],l;switch(p){case"f":l=t.name,s++;break;case"h":{let d=t.path.lastIndexOf("/");l=d>0?t.path.slice(0,d):".",s++;break}case"p":l=t.path,s++;break;case"P":{let d=t.startingPoint;t.path===d?l="":t.path.startsWith(`${d}/`)?l=t.path.slice(d.length+1):d==="."&&t.path.startsWith("./")?l=t.path.slice(2):l=t.path,s++;break}case"s":l=String(t.size),s++;break;case"d":l=String(t.depth),s++;break;case"m":l=(t.mode&511).toString(8),s++;break;case"M":l=ke(t.mode,t.isDirectory),s++;break;case"t":{let d=new Date(t.mtime);l=Ne(d),s++;break}case"T":{if(s+1<n.length){let d=n[s+1],B=new Date(t.mtime);l=ze(B,d),s+=2}else l="%T",s++;break}default:r+=`%${o!==0||i!==-1?`${o}.${i}`:""}${p}`,s++;continue}r+=oe(l,o,i)}else r+=n[s],s++;return r}function ke(e,t){let n=e&511,r=t?"d":"-";return r+=n&256?"r":"-",r+=n&128?"w":"-",r+=n&64?"x":"-",r+=n&32?"r":"-",r+=n&16?"w":"-",r+=n&8?"x":"-",r+=n&4?"r":"-",r+=n&2?"w":"-",r+=n&1?"x":"-",r}function Ne(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=t[e.getDay()],s=n[e.getMonth()],o=String(e.getDate()).padStart(2," "),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),p=String(e.getSeconds()).padStart(2,"0"),l=e.getFullYear();return`${r} ${s} ${o} ${i}:${a}:${p} ${l}`}function ze(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var je={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0};export{_e as a,je as b};
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as p}from"./chunk-4OALHZXB.js";import{e as m}from"./chunk-JJHAWOIB.js";import{a as c}from"./chunk-4PRVMER6.js";var M={name:"time",async execute(r,i){let a="%e %M",o=null,f=!1,u=!1,t=0;for(;t<r.length;){let e=r[t];if(e==="-f"||e==="--format"){if(t++,t>=r.length)return{stdout:"",stderr:`time: missing argument to '-f'
3
- `,exitCode:1};a=r[t],t++}else if(e==="-o"||e==="--output"){if(t++,t>=r.length)return{stdout:"",stderr:`time: missing argument to '-o'
4
- `,exitCode:1};o=r[t],t++}else if(e==="-a"||e==="--append")f=!0,t++;else if(e==="-v"||e==="--verbose")a=`Command being timed: %C
5
- Elapsed (wall clock) time: %e seconds
6
- Maximum resident set size (kbytes): %M`,t++;else if(e==="-p"||e==="--portability")u=!0,t++;else if(e==="--"){t++;break}else if(e.startsWith("-"))t++;else break}let l=r.slice(t);if(l.length===0)return{stdout:"",stderr:"",exitCode:0};let g=m(),h=p(l),w=l.join(" "),s;try{if(!i.exec)return{stdout:"",stderr:`time: exec not available
7
- `,exitCode:1};s=await i.exec(h,{env:c(i.env),cwd:i.cwd,stdin:i.stdin,signal:i.signal})}catch(e){s={stdout:"",stderr:`time: ${e.message}
8
- `,exitCode:127}}let d=(m()-g)/1e3,n;if(u?n=`real ${d.toFixed(2)}
9
- user 0.00
10
- sys 0.00
11
- `:(n=a.replace(/%e/g,d.toFixed(2)).replace(/%E/g,F(d)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,w),n.endsWith(`
12
- `)||(n+=`
13
- `)),o)try{let e=i.fs.resolvePath(i.cwd,o);if(f&&await i.fs.exists(e)){let C=await i.fs.readFile(e);await i.fs.writeFile(e,C+n)}else await i.fs.writeFile(e,n)}catch(e){return{stdout:s.stdout,stderr:s.stderr+`time: cannot write to '${o}': ${e.message}
14
- `,exitCode:s.exitCode}}else s={...s,stderr:s.stderr+n};return s}};function F(r){let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i>0?`${i}:${a.toString().padStart(2,"0")}:${o.toFixed(2).padStart(5,"0")}`:`${a}:${o.toFixed(2).padStart(5,"0")}`}var S={name:"time",flags:[{flag:"-p",type:"boolean"}],needsArgs:!0};export{M as a,S as b};
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as m,b as h}from"./chunk-GTNBSMZR.js";var g={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},p={name:"ln",async execute(n,s){if(h(n))return m(g);let l=!1,a=!1,f=!1,t=0;for(;t<n.length&&n[t].startsWith("-");){let e=n[t];if(e==="-s"||e==="--symbolic")l=!0,t++;else if(e==="-f"||e==="--force")a=!0,t++;else if(e==="-v"||e==="--verbose")f=!0,t++;else if(e==="-n"||e==="--no-dereference")t++;else if(/^-[sfvn]+$/.test(e))e.includes("s")&&(l=!0),e.includes("f")&&(a=!0),e.includes("v")&&(f=!0),t++;else if(e==="--"){t++;break}else return{stdout:"",stderr:`ln: invalid option -- '${e.slice(1)}'
3
- `,exitCode:1}}let d=n.slice(t);if(d.length<2)return{stdout:"",stderr:`ln: missing file operand
4
- `,exitCode:1};let i=d[0],r=d[1],o=s.fs.resolvePath(s.cwd,r);if(await s.fs.exists(o))if(a)try{await s.fs.rm(o,{force:!0})}catch{return{stdout:"",stderr:`ln: cannot remove '${r}': Permission denied
5
- `,exitCode:1}}else return{stdout:"",stderr:`ln: failed to create ${l?"symbolic ":""}link '${r}': File exists
6
- `,exitCode:1};try{if(l)await s.fs.symlink(i,o);else{let e=s.fs.resolvePath(s.cwd,i);if(!await s.fs.exists(e))return{stdout:"",stderr:`ln: failed to access '${i}': No such file or directory
7
- `,exitCode:1};await s.fs.link(e,o)}}catch(e){let u=e;return u.message.includes("EPERM")?{stdout:"",stderr:`ln: '${i}': hard link not allowed for directory
8
- `,exitCode:1}:{stdout:"",stderr:`ln: ${u.message}
9
- `,exitCode:1}}let c="";return f&&(c=`'${r}' -> '${i}'
10
- `),{stdout:c,stderr:"",exitCode:0}}},b={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{p as a,b};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as g}from"./chunk-KGOUQS5A.js";function m(){let c=[{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","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:"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:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{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 e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&c.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&c.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let e=Object.getPrototypeOf(async function*(){}).constructor;e&&e!==Function&&e!==Object.getPrototypeOf(async()=>{}).constructor&&c.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{}return c.filter(e=>{try{return e.target[e.prop]!==void 0}catch{return!1}})}var h=typeof __BROWSER__<"u"&&__BROWSER__;function _(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,c=>{let e=Math.random()*16|0;return(c==="x"?e:e&3|8).toString(16)})}var b=null;if(!h)try{let{AsyncLocalStorage:c}=g("node:async_hooks");b=c}catch{}var w=`
3
-
4
- This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,p=class extends Error{violation;constructor(e,t){super(e+w),this.violation=t,this.name="SecurityViolationError"}},l=!h&&b?new b:null,T=1e3,y={enabled:!0,auditMode:!1};function k(c){return c===void 0?{...y,enabled:!1}:typeof c=="boolean"?{...y,enabled:c}:{...y,...c}}var x=class c{static instance=null;static importHooksRegistered=!1;config;refCount=0;patchFailures=[];originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=k(e);if(!c.instance)c.instance=new c(t);else{let r=c.instance.config;if(t.enabled!==r.enabled||t.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${t.enabled}, auditMode: ${t.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return c.instance}static resetInstance(){c.instance&&(c.instance.forceDeactivate(),c.instance=null)}static isInSandboxedContext(){return l?l?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(l)return l?.getStore()?.executionId}isEnabled(){return this.config.enabled===!0&&l!==null&&!h}updateConfig(e){this.config={...this.config,...e}}activate(){if(h||!this.config.enabled||!l){let t=_();return{run:r=>r(),deactivate:()=>{},executionId:t}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let e=_();return{run:t=>l.run({sandboxActive:!0,executionId:e},t),deactivate:()=>{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.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(!l)return e();let t=l.getStore();return t?l.run({...t,trusted:!0},e):e()}static async runTrustedAsync(e){if(!l)return e();let t=l.getStore();return t?l.run({...t,trusted:!0},e):e()}shouldBlock(){if(h||this.config.auditMode||!l)return!1;let e=l?.getStore();return!(e?.sandboxActive!==!0||e.trusted)}recordViolation(e,t,r){let s={timestamp:Date.now(),type:e,message:r,path:t,stack:new Error().stack,executionId:l?.getStore()?.executionId};if(this.violations.length<T&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(o){console.debug("[DefenseInDepthBox] onViolation callback threw:",o instanceof Error?o.message:o)}return s}createBlockingProxy(e,t,r){let s=this;return new Proxy(e,{apply(o,n,i){if(s.shouldBlock()){let a=`${t} is blocked during script execution`,u=s.recordViolation(r,t,a);throw new p(a,u)}return s.config.auditMode&&l?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} called (audit mode)`),Reflect.apply(o,n,i)},construct(o,n,i){if(s.shouldBlock()){let a=`${t} constructor is blocked during script execution`,u=s.recordViolation(r,t,a);throw new p(a,u)}return s.config.auditMode&&l?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} constructor called (audit mode)`),Reflect.construct(o,n,i)}})}createBlockingObjectProxy(e,t,r,s){let o=this;return new Proxy(e,{get(n,i,a){if(o.shouldBlock()){if(s&&typeof i=="string"&&s.has(i))return Reflect.get(n,i,a);let u=`${t}.${String(i)}`,d=`${u} is blocked during script execution`,f=o.recordViolation(r,u,d);throw new p(d,f)}if(o.config.auditMode&&l?.getStore()?.sandboxActive===!0){let u=`${t}.${String(i)}`;o.recordViolation(r,u,`${u} accessed (audit mode)`)}return Reflect.get(n,i,a)},set(n,i,a,u){if(o.shouldBlock()){let d=`${t}.${String(i)}`,f=`${d} modification is blocked during script execution`,v=o.recordViolation(r,d,f);throw new p(f,v)}return Reflect.set(n,i,a,u)},ownKeys(n){if(o.shouldBlock()){let i=`${t} enumeration is blocked during script execution`,a=o.recordViolation(r,t,i);throw new p(i,a)}return Reflect.ownKeys(n)},getOwnPropertyDescriptor(n,i){if(o.shouldBlock()){let a=`${t}.${String(i)}`,u=`${a} descriptor access is blocked during script execution`,d=o.recordViolation(r,a,u);throw new p(u,d)}return Reflect.getOwnPropertyDescriptor(n,i)},has(n,i){if(o.shouldBlock()){let a=`${t}.${String(i)}`,u=`${a} existence check is blocked during script execution`,d=o.recordViolation(r,a,u);throw new p(u,d)}return Reflect.has(n,i)}})}applyPatches(){this.patchFailures=[];let e=m(),t=new Set(["process_send","process_channel","process_stdout","process_stderr"]);for(let o of e)t.has(o.violationType)||this.applyPatch(o);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath();let r=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(o=>r.includes(o));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}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 r=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){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 p(o,n)}e.config.auditMode&&l?.getStore()?.sandboxActive===!0&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}patchPrototypeConstructor(e,t,r){let s=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(s.shouldBlock()){let i=`${t} access is blocked during script execution`,a=s.recordViolation(r,t,i);throw new p(i,a)}return s.config.auditMode&&l?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} accessed (audit mode)`),n},set(i){if(s.shouldBlock()){let a=`${t} modification is blocked during script execution`,u=s.recordViolation(r,t,a);throw new p(a,u)}Object.defineProperty(this,"constructor",{value:i,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 r=t?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let s="process.mainModule access is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",s);throw new p(s,o)}return e.config.auditMode&&l?.getStore()?.sandboxActive===!0&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let o="process.mainModule modification is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",o);throw new p(o,n)}Object.defineProperty(process,"mainModule",{value:s,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 r=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let s="process.execPath access is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",s);throw new p(s,o)}return e.config.auditMode&&l?.getStore()?.sandboxActive===!0&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let o="process.execPath modification is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",o);throw new p(o,n)}Object.defineProperty(process,"execPath",{value:s,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)}}protectDynamicImport(){if(!(h||c.importHooksRegistered))try{let e=g("node:module");if(typeof e.registerHooks=="function"){e.registerHooks({resolve(t,r,s){if(t.startsWith("data:")||t.startsWith("blob:"))throw new Error(`dynamic import of ${t.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);return s(t,r)}}),c.importHooksRegistered=!0;return}if(typeof e.register=="function"){let t=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(`
5
- `);e.register(`data:text/javascript,${encodeURIComponent(t)}`),c.importHooksRegistered=!0}}catch(e){console.debug("[DefenseInDepthBox] Could not register import() hooks:",e instanceof Error?e.message:e)}}protectModuleLoad(){if(!h)try{let e=null;if(typeof process<"u"){let n=process.mainModule;n&&typeof n=="object"&&(e=n.constructor)}if(!e&&typeof g<"u"&&typeof g.main<"u"&&(e=g.main.constructor),!e||typeof e._load!="function")return;let t=e._load,r=Object.getOwnPropertyDescriptor(e,"_load");this.originalDescriptors.push({target:e,prop:"_load",descriptor:r});let o=this.createBlockingProxy(t,"Module._load","module_load");Object.defineProperty(e,"_load",{value:o,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",e instanceof Error?e.message:e)}}protectModuleResolveFilename(){if(!h)try{let e=null;if(typeof process<"u"){let n=process.mainModule;n&&typeof n=="object"&&(e=n.constructor)}if(!e&&typeof g<"u"&&typeof g.main<"u"&&(e=g.main.constructor),!e||typeof e._resolveFilename!="function")return;let t=e._resolveFilename,r=Object.getOwnPropertyDescriptor(e,"_resolveFilename");this.originalDescriptors.push({target:e,prop:"_resolveFilename",descriptor:r});let o=this.createBlockingProxy(t,"Module._resolveFilename","module_resolve_filename");Object.defineProperty(e,"_resolveFilename",{value:o,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._resolveFilename"),console.debug("[DefenseInDepthBox] Could not protect Module._resolveFilename:",e instanceof Error?e.message:e)}}applyPatch(e){let{target:t,prop:r,violationType:s,strategy:o}=e;try{let n=t[r];if(n===void 0)return;let i=Object.getOwnPropertyDescriptor(t,r);if(this.originalDescriptors.push({target:t,prop:r,descriptor:i}),o==="freeze")typeof n=="object"&&n!==null&&Object.freeze(n);else{let a=this.getPathForTarget(t,r),u=typeof n=="function"?this.createBlockingProxy(n,a,s):this.createBlockingObjectProxy(n,a,s,e.allowedKeys);Object.defineProperty(t,r,{value:u,writable:!0,configurable:!0})}}catch(n){let i=this.getPathForTarget(t,r);this.patchFailures.push(i),console.debug(`[DefenseInDepthBox] Could not patch ${i}:`,n instanceof Error?n.message:n)}}restorePatches(){for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:r,descriptor:s}=this.originalDescriptors[e];try{s?Object.defineProperty(t,r,s):delete t[r]}catch(o){let n=this.getPathForTarget(t,r);console.debug(`[DefenseInDepthBox] Could not restore ${n}:`,o instanceof Error?o.message:o)}}this.originalDescriptors=[]}};export{p as a,x as b};