@jerryan/just-bash 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (958) hide show
  1. package/CHANGELOG.md +308 -0
  2. package/LICENSE +201 -0
  3. package/README.md +827 -0
  4. package/dist/AGENTS.md +383 -0
  5. package/dist/Bash.d.ts +317 -0
  6. package/dist/abort-signals.d.ts +10 -0
  7. package/dist/agent-sandbox.d.ts +104 -0
  8. package/dist/ast/types.d.ts +612 -0
  9. package/dist/banned-patterns-test.d.ts +1 -0
  10. package/dist/bin/chunks/alias-3R4G6HQY.js +3 -0
  11. package/dist/bin/chunks/awk2-KO7ZE3P7.js +3 -0
  12. package/dist/bin/chunks/base64-TQ5KOCNW.js +3 -0
  13. package/dist/bin/chunks/basename-C4CRGDXP.js +3 -0
  14. package/dist/bin/chunks/bash-CFCBBWVH.js +3 -0
  15. package/dist/bin/chunks/cat-BQ7FQTN5.js +3 -0
  16. package/dist/bin/chunks/chmod-WYYTXGVB.js +3 -0
  17. package/dist/bin/chunks/chunk-23OI2XDJ.js +20 -0
  18. package/dist/bin/chunks/chunk-2ETT4ELS.js +4 -0
  19. package/dist/bin/chunks/chunk-2UV6ZFHK.js +4 -0
  20. package/dist/bin/chunks/chunk-2YLY6FJA.js +10 -0
  21. package/dist/bin/chunks/chunk-3FQBUEB6.js +3 -0
  22. package/dist/bin/chunks/chunk-3MRB66F4.js +3 -0
  23. package/dist/bin/chunks/chunk-3PCPQIUD.js +3 -0
  24. package/dist/bin/chunks/chunk-42AMF6EE.js +3 -0
  25. package/dist/bin/chunks/chunk-43E7AR6A.js +3 -0
  26. package/dist/bin/chunks/chunk-45DUHCXR.js +7 -0
  27. package/dist/bin/chunks/chunk-472JZJ2D.js +22 -0
  28. package/dist/bin/chunks/chunk-47IFMQYS.js +3 -0
  29. package/dist/bin/chunks/chunk-4JF56A3P.js +15 -0
  30. package/dist/bin/chunks/chunk-5SKEZPTU.js +12 -0
  31. package/dist/bin/chunks/chunk-67XYNGRV.js +9 -0
  32. package/dist/bin/chunks/chunk-6ESRNSO7.js +7 -0
  33. package/dist/bin/chunks/chunk-6KHZX4HU.js +12 -0
  34. package/dist/bin/chunks/chunk-7FGDUBSN.js +14 -0
  35. package/dist/bin/chunks/chunk-7JZKVC3F.js +2 -0
  36. package/dist/bin/chunks/chunk-7PPAWLUI.js +12 -0
  37. package/dist/bin/chunks/chunk-7PUOS2OO.js +143 -0
  38. package/dist/bin/chunks/chunk-7VWOECJ3.js +101 -0
  39. package/dist/bin/chunks/chunk-7WBCA2BB.js +3 -0
  40. package/dist/bin/chunks/chunk-AGKL4LDL.js +4 -0
  41. package/dist/bin/chunks/chunk-AI7JUA46.js +13 -0
  42. package/dist/bin/chunks/chunk-AJF3OBTR.js +4 -0
  43. package/dist/bin/chunks/chunk-B2DRBHGQ.js +3 -0
  44. package/dist/bin/chunks/chunk-B2GCIQI2.js +16 -0
  45. package/dist/bin/chunks/chunk-B6WWC6K3.js +9 -0
  46. package/dist/bin/chunks/chunk-BIJXTWZ4.js +3 -0
  47. package/dist/bin/chunks/chunk-CC2AQ6B7.js +15 -0
  48. package/dist/bin/chunks/chunk-CL7IYCGG.js +20 -0
  49. package/dist/bin/chunks/chunk-CMTQFWZK.js +5 -0
  50. package/dist/bin/chunks/chunk-CPKBPQ2C.js +3 -0
  51. package/dist/bin/chunks/chunk-DJAX3ZRG.js +8 -0
  52. package/dist/bin/chunks/chunk-DN2YCFOR.js +3 -0
  53. package/dist/bin/chunks/chunk-DYIBFLS3.js +17 -0
  54. package/dist/bin/chunks/chunk-DZAFUADN.js +36 -0
  55. package/dist/bin/chunks/chunk-F3UDTTI7.js +13 -0
  56. package/dist/bin/chunks/chunk-FHMIEBRM.js +6 -0
  57. package/dist/bin/chunks/chunk-FONAGXRJ.js +17 -0
  58. package/dist/bin/chunks/chunk-FPWHWWXO.js +8 -0
  59. package/dist/bin/chunks/chunk-FUT3X2GJ.js +9 -0
  60. package/dist/bin/chunks/chunk-G4AUMZUY.js +4 -0
  61. package/dist/bin/chunks/chunk-GA5TPRMF.js +34 -0
  62. package/dist/bin/chunks/chunk-GOWX7VPU.js +7 -0
  63. package/dist/bin/chunks/chunk-GQKQEK5N.js +11 -0
  64. package/dist/bin/chunks/chunk-GR4ZHKXI.js +3 -0
  65. package/dist/bin/chunks/chunk-HDWHYM2T.js +18 -0
  66. package/dist/bin/chunks/chunk-HQ63MFHG.js +34 -0
  67. package/dist/bin/chunks/chunk-HW2VJKFH.js +4 -0
  68. package/dist/bin/chunks/chunk-HWI42GQO.js +7 -0
  69. package/dist/bin/chunks/chunk-HZGHQZSY.js +10 -0
  70. package/dist/bin/chunks/chunk-I4IRHQDW.js +3 -0
  71. package/dist/bin/chunks/chunk-I57EACSL.js +3 -0
  72. package/dist/bin/chunks/chunk-JELR4642.js +21 -0
  73. package/dist/bin/chunks/chunk-JQM3DKCH.js +12 -0
  74. package/dist/bin/chunks/chunk-K27FY3ES.js +3 -0
  75. package/dist/bin/chunks/chunk-KG2KXL4Y.js +3 -0
  76. package/dist/bin/chunks/chunk-KI54R2QB.js +3 -0
  77. package/dist/bin/chunks/chunk-KP2UH5CJ.js +22 -0
  78. package/dist/bin/chunks/chunk-KUMHQGUR.js +3 -0
  79. package/dist/bin/chunks/chunk-LE2XKKGQ.js +7 -0
  80. package/dist/bin/chunks/chunk-LJQIAFWS.js +5 -0
  81. package/dist/bin/chunks/chunk-LXFMIXGA.js +3 -0
  82. package/dist/bin/chunks/chunk-M7SIPZZZ.js +22 -0
  83. package/dist/bin/chunks/chunk-MF3GVFLC.js +11 -0
  84. package/dist/bin/chunks/chunk-MROECM42.js +3 -0
  85. package/dist/bin/chunks/chunk-MUFNRCMY.js +24 -0
  86. package/dist/bin/chunks/chunk-MVBK66TR.js +22 -0
  87. package/dist/bin/chunks/chunk-MYTNZ7MA.js +7 -0
  88. package/dist/bin/chunks/chunk-N26Y42L6.js +10 -0
  89. package/dist/bin/chunks/chunk-NE4R2FVV.js +5 -0
  90. package/dist/bin/chunks/chunk-NLU5LALY.js +37 -0
  91. package/dist/bin/chunks/chunk-NXUXZWS5.js +7 -0
  92. package/dist/bin/chunks/chunk-O2BCKSMK.js +3 -0
  93. package/dist/bin/chunks/chunk-OLEQNRKX.js +8 -0
  94. package/dist/bin/chunks/chunk-OUQKFRVR.js +6 -0
  95. package/dist/bin/chunks/chunk-OXLC2WWX.js +26 -0
  96. package/dist/bin/chunks/chunk-OYXHOZZ4.js +15 -0
  97. package/dist/bin/chunks/chunk-PBOVSFTJ.js +3 -0
  98. package/dist/bin/chunks/chunk-PPVF2N6C.js +3 -0
  99. package/dist/bin/chunks/chunk-PQ2INDRF.js +87 -0
  100. package/dist/bin/chunks/chunk-PXP4YYZA.js +13 -0
  101. package/dist/bin/chunks/chunk-PZQVSQX6.js +4 -0
  102. package/dist/bin/chunks/chunk-Q2GOPGDA.js +6 -0
  103. package/dist/bin/chunks/chunk-Q3LE3Y66.js +13 -0
  104. package/dist/bin/chunks/chunk-QES5OSUC.js +3 -0
  105. package/dist/bin/chunks/chunk-QFTZKD5O.js +13 -0
  106. package/dist/bin/chunks/chunk-QL33F2W6.js +8 -0
  107. package/dist/bin/chunks/chunk-QMPZXXEK.js +8 -0
  108. package/dist/bin/chunks/chunk-QYZN33JA.js +3 -0
  109. package/dist/bin/chunks/chunk-R2J5MJOM.js +20 -0
  110. package/dist/bin/chunks/chunk-RPUFEP5O.js +65 -0
  111. package/dist/bin/chunks/chunk-RVPTAYDS.js +4 -0
  112. package/dist/bin/chunks/chunk-SC5TEGMM.js +12 -0
  113. package/dist/bin/chunks/chunk-SDGPS6XI.js +10 -0
  114. package/dist/bin/chunks/chunk-TW2IJRUF.js +3 -0
  115. package/dist/bin/chunks/chunk-TYBXHT6W.js +10 -0
  116. package/dist/bin/chunks/chunk-V2XF3TTW.js +276 -0
  117. package/dist/bin/chunks/chunk-V4U26ZWL.js +16 -0
  118. package/dist/bin/chunks/chunk-VTAMGD42.js +3 -0
  119. package/dist/bin/chunks/chunk-WAJVRK5B.js +16 -0
  120. package/dist/bin/chunks/chunk-WEHA3JFD.js +3 -0
  121. package/dist/bin/chunks/chunk-WFHYGSLJ.js +6 -0
  122. package/dist/bin/chunks/chunk-WFVCEB5T.js +3 -0
  123. package/dist/bin/chunks/chunk-YERKK5B3.js +4 -0
  124. package/dist/bin/chunks/chunk-YIANER7Y.js +8 -0
  125. package/dist/bin/chunks/chunk-YJ5OCPSK.js +7 -0
  126. package/dist/bin/chunks/chunk-YOIFOOGX.js +9 -0
  127. package/dist/bin/chunks/chunk-YQEKKZTU.js +12 -0
  128. package/dist/bin/chunks/chunk-YUZRUF5F.js +10 -0
  129. package/dist/bin/chunks/chunk-ZMGLTHSU.js +15 -0
  130. package/dist/bin/chunks/clear-OE52K3TM.js +3 -0
  131. package/dist/bin/chunks/column-AJFK3TWF.js +3 -0
  132. package/dist/bin/chunks/comm-URDMZCXL.js +3 -0
  133. package/dist/bin/chunks/cp-OMVKM35F.js +3 -0
  134. package/dist/bin/chunks/curl-NHNZ46BU.js +31 -0
  135. package/dist/bin/chunks/cut-42X6363P.js +3 -0
  136. package/dist/bin/chunks/date-6MQGVWDY.js +3 -0
  137. package/dist/bin/chunks/diff-YXZZCUSQ.js +3 -0
  138. package/dist/bin/chunks/dirname-TPUFCYF6.js +3 -0
  139. package/dist/bin/chunks/dist-5MWO25Y4.js +141 -0
  140. package/dist/bin/chunks/du-LUFPVLNW.js +3 -0
  141. package/dist/bin/chunks/echo-NYDCCFWB.js +3 -0
  142. package/dist/bin/chunks/env-2TSVF4W7.js +3 -0
  143. package/dist/bin/chunks/expand-IQRKKT7D.js +3 -0
  144. package/dist/bin/chunks/expr-NNMDHOCN.js +3 -0
  145. package/dist/bin/chunks/file-4T64QNLS.js +3 -0
  146. package/dist/bin/chunks/find-AWH2KOY7.js +3 -0
  147. package/dist/bin/chunks/flag-coverage-J2ZHA465.js +3 -0
  148. package/dist/bin/chunks/fold-YEY7X54W.js +3 -0
  149. package/dist/bin/chunks/grep-CVU5V66H.js +3 -0
  150. package/dist/bin/chunks/gzip-FDPA6EKG.js +3 -0
  151. package/dist/bin/chunks/head-QKVY3SIO.js +3 -0
  152. package/dist/bin/chunks/help-HVIDHJ6M.js +3 -0
  153. package/dist/bin/chunks/history-3HAU45KT.js +3 -0
  154. package/dist/bin/chunks/hostname-2I76DUQL.js +3 -0
  155. package/dist/bin/chunks/html-to-markdown-XUMA42ZC.js +3 -0
  156. package/dist/bin/chunks/join-34DX7YK5.js +3 -0
  157. package/dist/bin/chunks/jq-V7OTAVU5.js +3 -0
  158. package/dist/bin/chunks/js-exec-DJQLXWCS.js +99 -0
  159. package/dist/bin/chunks/js-exec-worker.js +4809 -0
  160. package/dist/bin/chunks/ln-B35EKC2Q.js +3 -0
  161. package/dist/bin/chunks/ls-Q6ZZ6SQ2.js +3 -0
  162. package/dist/bin/chunks/md5sum-Z6KAYGDK.js +3 -0
  163. package/dist/bin/chunks/mkdir-74BP5NTG.js +3 -0
  164. package/dist/bin/chunks/mv-76LAHXFR.js +3 -0
  165. package/dist/bin/chunks/nl-4IZRRT7U.js +3 -0
  166. package/dist/bin/chunks/od-2GXD4D5K.js +3 -0
  167. package/dist/bin/chunks/paste-DWWA3JTW.js +3 -0
  168. package/dist/bin/chunks/printf-YXCSED2H.js +3 -0
  169. package/dist/bin/chunks/pwd-YKLNXWZI.js +3 -0
  170. package/dist/bin/chunks/python3-JCJHSX4Z.js +14 -0
  171. package/dist/bin/chunks/readlink-EHXJNW62.js +3 -0
  172. package/dist/bin/chunks/rev-CZTQCNOZ.js +3 -0
  173. package/dist/bin/chunks/rg-PXNKNIMY.js +3 -0
  174. package/dist/bin/chunks/rm-3PLW4O4B.js +3 -0
  175. package/dist/bin/chunks/rmdir-7ZIVFZJX.js +3 -0
  176. package/dist/bin/chunks/sed-4LVDFHIJ.js +3 -0
  177. package/dist/bin/chunks/seq-X2EAOGV5.js +3 -0
  178. package/dist/bin/chunks/sha1sum-CATBXX76.js +3 -0
  179. package/dist/bin/chunks/sha256sum-YGSNBVY3.js +3 -0
  180. package/dist/bin/chunks/sleep-DVFE2GSF.js +3 -0
  181. package/dist/bin/chunks/sort-HBOCBBJQ.js +3 -0
  182. package/dist/bin/chunks/split-ZNNNHKSP.js +3 -0
  183. package/dist/bin/chunks/sqlite3-KP42NNIY.js +3 -0
  184. package/dist/bin/chunks/sqlite3-worker.js +1928 -0
  185. package/dist/bin/chunks/stat-LROLDXHH.js +3 -0
  186. package/dist/bin/chunks/strings-CNUK76JL.js +3 -0
  187. package/dist/bin/chunks/tac-DG4BMYM5.js +3 -0
  188. package/dist/bin/chunks/tail-UOTUV25D.js +3 -0
  189. package/dist/bin/chunks/tar-7HGZIMZD.js +3 -0
  190. package/dist/bin/chunks/tee-L4HKV5PD.js +3 -0
  191. package/dist/bin/chunks/time-LF7BTSK5.js +3 -0
  192. package/dist/bin/chunks/timeout-YGFHQJKX.js +3 -0
  193. package/dist/bin/chunks/touch-TVQAUQOG.js +3 -0
  194. package/dist/bin/chunks/tr-PVFO6FRY.js +3 -0
  195. package/dist/bin/chunks/tree-ZGP6NPGS.js +3 -0
  196. package/dist/bin/chunks/true-KFTJGQLQ.js +3 -0
  197. package/dist/bin/chunks/unexpand-JPOQORZF.js +3 -0
  198. package/dist/bin/chunks/uniq-JMHDIJXT.js +3 -0
  199. package/dist/bin/chunks/wc-3KLVOCI2.js +3 -0
  200. package/dist/bin/chunks/which-4TPGVSBZ.js +3 -0
  201. package/dist/bin/chunks/whoami-B5HDVKW6.js +3 -0
  202. package/dist/bin/chunks/worker.js +3330 -0
  203. package/dist/bin/chunks/xan-WW53ETXT.js +3 -0
  204. package/dist/bin/chunks/xan-view-PD26QEFN.js +3 -0
  205. package/dist/bin/chunks/xargs-4AMMXFXL.js +3 -0
  206. package/dist/bin/chunks/yq-MYZOS2WN.js +3 -0
  207. package/dist/bin/just-bash.js +858 -0
  208. package/dist/bin/shell/chunks/alias-3R4G6HQY.js +3 -0
  209. package/dist/bin/shell/chunks/awk2-KO7ZE3P7.js +3 -0
  210. package/dist/bin/shell/chunks/base64-TQ5KOCNW.js +3 -0
  211. package/dist/bin/shell/chunks/basename-C4CRGDXP.js +3 -0
  212. package/dist/bin/shell/chunks/bash-CFCBBWVH.js +3 -0
  213. package/dist/bin/shell/chunks/cat-BQ7FQTN5.js +3 -0
  214. package/dist/bin/shell/chunks/chmod-WYYTXGVB.js +3 -0
  215. package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +20 -0
  216. package/dist/bin/shell/chunks/chunk-2ETT4ELS.js +4 -0
  217. package/dist/bin/shell/chunks/chunk-2UV6ZFHK.js +4 -0
  218. package/dist/bin/shell/chunks/chunk-2YLY6FJA.js +10 -0
  219. package/dist/bin/shell/chunks/chunk-3FQBUEB6.js +3 -0
  220. package/dist/bin/shell/chunks/chunk-3MRB66F4.js +3 -0
  221. package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +3 -0
  222. package/dist/bin/shell/chunks/chunk-42AMF6EE.js +3 -0
  223. package/dist/bin/shell/chunks/chunk-43E7AR6A.js +3 -0
  224. package/dist/bin/shell/chunks/chunk-45DUHCXR.js +7 -0
  225. package/dist/bin/shell/chunks/chunk-472JZJ2D.js +22 -0
  226. package/dist/bin/shell/chunks/chunk-47IFMQYS.js +3 -0
  227. package/dist/bin/shell/chunks/chunk-4JF56A3P.js +15 -0
  228. package/dist/bin/shell/chunks/chunk-5SKEZPTU.js +12 -0
  229. package/dist/bin/shell/chunks/chunk-67XYNGRV.js +9 -0
  230. package/dist/bin/shell/chunks/chunk-6ESRNSO7.js +7 -0
  231. package/dist/bin/shell/chunks/chunk-6KHZX4HU.js +12 -0
  232. package/dist/bin/shell/chunks/chunk-7FGDUBSN.js +14 -0
  233. package/dist/bin/shell/chunks/chunk-7JZKVC3F.js +2 -0
  234. package/dist/bin/shell/chunks/chunk-7PPAWLUI.js +12 -0
  235. package/dist/bin/shell/chunks/chunk-7PUOS2OO.js +143 -0
  236. package/dist/bin/shell/chunks/chunk-7VWOECJ3.js +101 -0
  237. package/dist/bin/shell/chunks/chunk-7WBCA2BB.js +3 -0
  238. package/dist/bin/shell/chunks/chunk-AGKL4LDL.js +4 -0
  239. package/dist/bin/shell/chunks/chunk-AI7JUA46.js +13 -0
  240. package/dist/bin/shell/chunks/chunk-AJF3OBTR.js +4 -0
  241. package/dist/bin/shell/chunks/chunk-B2DRBHGQ.js +3 -0
  242. package/dist/bin/shell/chunks/chunk-B2GCIQI2.js +16 -0
  243. package/dist/bin/shell/chunks/chunk-B6WWC6K3.js +9 -0
  244. package/dist/bin/shell/chunks/chunk-BIJXTWZ4.js +3 -0
  245. package/dist/bin/shell/chunks/chunk-CC2AQ6B7.js +15 -0
  246. package/dist/bin/shell/chunks/chunk-CL7IYCGG.js +20 -0
  247. package/dist/bin/shell/chunks/chunk-CMTQFWZK.js +5 -0
  248. package/dist/bin/shell/chunks/chunk-CPKBPQ2C.js +3 -0
  249. package/dist/bin/shell/chunks/chunk-DJAX3ZRG.js +8 -0
  250. package/dist/bin/shell/chunks/chunk-DN2YCFOR.js +3 -0
  251. package/dist/bin/shell/chunks/chunk-DYIBFLS3.js +17 -0
  252. package/dist/bin/shell/chunks/chunk-DZAFUADN.js +36 -0
  253. package/dist/bin/shell/chunks/chunk-F3UDTTI7.js +13 -0
  254. package/dist/bin/shell/chunks/chunk-FHMIEBRM.js +6 -0
  255. package/dist/bin/shell/chunks/chunk-FONAGXRJ.js +17 -0
  256. package/dist/bin/shell/chunks/chunk-FPWHWWXO.js +8 -0
  257. package/dist/bin/shell/chunks/chunk-FUT3X2GJ.js +9 -0
  258. package/dist/bin/shell/chunks/chunk-G4AUMZUY.js +4 -0
  259. package/dist/bin/shell/chunks/chunk-GA5TPRMF.js +34 -0
  260. package/dist/bin/shell/chunks/chunk-GOWX7VPU.js +7 -0
  261. package/dist/bin/shell/chunks/chunk-GQKQEK5N.js +11 -0
  262. package/dist/bin/shell/chunks/chunk-GR4ZHKXI.js +3 -0
  263. package/dist/bin/shell/chunks/chunk-HDWHYM2T.js +18 -0
  264. package/dist/bin/shell/chunks/chunk-HQ63MFHG.js +34 -0
  265. package/dist/bin/shell/chunks/chunk-HW2VJKFH.js +4 -0
  266. package/dist/bin/shell/chunks/chunk-HWI42GQO.js +7 -0
  267. package/dist/bin/shell/chunks/chunk-HZGHQZSY.js +10 -0
  268. package/dist/bin/shell/chunks/chunk-I4IRHQDW.js +3 -0
  269. package/dist/bin/shell/chunks/chunk-I57EACSL.js +3 -0
  270. package/dist/bin/shell/chunks/chunk-JELR4642.js +21 -0
  271. package/dist/bin/shell/chunks/chunk-JQM3DKCH.js +12 -0
  272. package/dist/bin/shell/chunks/chunk-K27FY3ES.js +3 -0
  273. package/dist/bin/shell/chunks/chunk-KG2KXL4Y.js +3 -0
  274. package/dist/bin/shell/chunks/chunk-KI54R2QB.js +3 -0
  275. package/dist/bin/shell/chunks/chunk-KP2UH5CJ.js +22 -0
  276. package/dist/bin/shell/chunks/chunk-KUMHQGUR.js +3 -0
  277. package/dist/bin/shell/chunks/chunk-LE2XKKGQ.js +7 -0
  278. package/dist/bin/shell/chunks/chunk-LJQIAFWS.js +5 -0
  279. package/dist/bin/shell/chunks/chunk-LXFMIXGA.js +3 -0
  280. package/dist/bin/shell/chunks/chunk-M7SIPZZZ.js +22 -0
  281. package/dist/bin/shell/chunks/chunk-MF3GVFLC.js +11 -0
  282. package/dist/bin/shell/chunks/chunk-MROECM42.js +3 -0
  283. package/dist/bin/shell/chunks/chunk-MUFNRCMY.js +24 -0
  284. package/dist/bin/shell/chunks/chunk-MVBK66TR.js +22 -0
  285. package/dist/bin/shell/chunks/chunk-MYTNZ7MA.js +7 -0
  286. package/dist/bin/shell/chunks/chunk-N26Y42L6.js +10 -0
  287. package/dist/bin/shell/chunks/chunk-NE4R2FVV.js +5 -0
  288. package/dist/bin/shell/chunks/chunk-NLU5LALY.js +37 -0
  289. package/dist/bin/shell/chunks/chunk-NXUXZWS5.js +7 -0
  290. package/dist/bin/shell/chunks/chunk-O2BCKSMK.js +3 -0
  291. package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +8 -0
  292. package/dist/bin/shell/chunks/chunk-OUQKFRVR.js +6 -0
  293. package/dist/bin/shell/chunks/chunk-OXLC2WWX.js +26 -0
  294. package/dist/bin/shell/chunks/chunk-OYXHOZZ4.js +15 -0
  295. package/dist/bin/shell/chunks/chunk-PBOVSFTJ.js +3 -0
  296. package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +3 -0
  297. package/dist/bin/shell/chunks/chunk-PQ2INDRF.js +87 -0
  298. package/dist/bin/shell/chunks/chunk-PXP4YYZA.js +13 -0
  299. package/dist/bin/shell/chunks/chunk-PZQVSQX6.js +4 -0
  300. package/dist/bin/shell/chunks/chunk-Q2GOPGDA.js +6 -0
  301. package/dist/bin/shell/chunks/chunk-Q3LE3Y66.js +13 -0
  302. package/dist/bin/shell/chunks/chunk-QES5OSUC.js +3 -0
  303. package/dist/bin/shell/chunks/chunk-QFTZKD5O.js +13 -0
  304. package/dist/bin/shell/chunks/chunk-QL33F2W6.js +8 -0
  305. package/dist/bin/shell/chunks/chunk-QMPZXXEK.js +8 -0
  306. package/dist/bin/shell/chunks/chunk-QYZN33JA.js +3 -0
  307. package/dist/bin/shell/chunks/chunk-R2J5MJOM.js +20 -0
  308. package/dist/bin/shell/chunks/chunk-RPUFEP5O.js +65 -0
  309. package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +4 -0
  310. package/dist/bin/shell/chunks/chunk-SC5TEGMM.js +12 -0
  311. package/dist/bin/shell/chunks/chunk-SDGPS6XI.js +10 -0
  312. package/dist/bin/shell/chunks/chunk-TW2IJRUF.js +3 -0
  313. package/dist/bin/shell/chunks/chunk-TYBXHT6W.js +10 -0
  314. package/dist/bin/shell/chunks/chunk-V2XF3TTW.js +276 -0
  315. package/dist/bin/shell/chunks/chunk-V4U26ZWL.js +16 -0
  316. package/dist/bin/shell/chunks/chunk-VTAMGD42.js +3 -0
  317. package/dist/bin/shell/chunks/chunk-WAJVRK5B.js +16 -0
  318. package/dist/bin/shell/chunks/chunk-WEHA3JFD.js +3 -0
  319. package/dist/bin/shell/chunks/chunk-WFHYGSLJ.js +6 -0
  320. package/dist/bin/shell/chunks/chunk-WFVCEB5T.js +3 -0
  321. package/dist/bin/shell/chunks/chunk-YERKK5B3.js +4 -0
  322. package/dist/bin/shell/chunks/chunk-YIANER7Y.js +8 -0
  323. package/dist/bin/shell/chunks/chunk-YJ5OCPSK.js +7 -0
  324. package/dist/bin/shell/chunks/chunk-YOIFOOGX.js +9 -0
  325. package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +12 -0
  326. package/dist/bin/shell/chunks/chunk-YUZRUF5F.js +10 -0
  327. package/dist/bin/shell/chunks/chunk-ZMGLTHSU.js +15 -0
  328. package/dist/bin/shell/chunks/clear-OE52K3TM.js +3 -0
  329. package/dist/bin/shell/chunks/column-AJFK3TWF.js +3 -0
  330. package/dist/bin/shell/chunks/comm-URDMZCXL.js +3 -0
  331. package/dist/bin/shell/chunks/cp-OMVKM35F.js +3 -0
  332. package/dist/bin/shell/chunks/curl-NHNZ46BU.js +31 -0
  333. package/dist/bin/shell/chunks/cut-42X6363P.js +3 -0
  334. package/dist/bin/shell/chunks/date-6MQGVWDY.js +3 -0
  335. package/dist/bin/shell/chunks/diff-YXZZCUSQ.js +3 -0
  336. package/dist/bin/shell/chunks/dirname-TPUFCYF6.js +3 -0
  337. package/dist/bin/shell/chunks/dist-5MWO25Y4.js +141 -0
  338. package/dist/bin/shell/chunks/du-LUFPVLNW.js +3 -0
  339. package/dist/bin/shell/chunks/echo-NYDCCFWB.js +3 -0
  340. package/dist/bin/shell/chunks/env-2TSVF4W7.js +3 -0
  341. package/dist/bin/shell/chunks/expand-IQRKKT7D.js +3 -0
  342. package/dist/bin/shell/chunks/expr-NNMDHOCN.js +3 -0
  343. package/dist/bin/shell/chunks/file-4T64QNLS.js +3 -0
  344. package/dist/bin/shell/chunks/find-AWH2KOY7.js +3 -0
  345. package/dist/bin/shell/chunks/flag-coverage-J2ZHA465.js +3 -0
  346. package/dist/bin/shell/chunks/fold-YEY7X54W.js +3 -0
  347. package/dist/bin/shell/chunks/grep-CVU5V66H.js +3 -0
  348. package/dist/bin/shell/chunks/gzip-FDPA6EKG.js +3 -0
  349. package/dist/bin/shell/chunks/head-QKVY3SIO.js +3 -0
  350. package/dist/bin/shell/chunks/help-HVIDHJ6M.js +3 -0
  351. package/dist/bin/shell/chunks/history-3HAU45KT.js +3 -0
  352. package/dist/bin/shell/chunks/hostname-2I76DUQL.js +3 -0
  353. package/dist/bin/shell/chunks/html-to-markdown-XUMA42ZC.js +3 -0
  354. package/dist/bin/shell/chunks/join-34DX7YK5.js +3 -0
  355. package/dist/bin/shell/chunks/jq-V7OTAVU5.js +3 -0
  356. package/dist/bin/shell/chunks/js-exec-DJQLXWCS.js +99 -0
  357. package/dist/bin/shell/chunks/ln-B35EKC2Q.js +3 -0
  358. package/dist/bin/shell/chunks/ls-Q6ZZ6SQ2.js +3 -0
  359. package/dist/bin/shell/chunks/md5sum-Z6KAYGDK.js +3 -0
  360. package/dist/bin/shell/chunks/mkdir-74BP5NTG.js +3 -0
  361. package/dist/bin/shell/chunks/mv-76LAHXFR.js +3 -0
  362. package/dist/bin/shell/chunks/nl-4IZRRT7U.js +3 -0
  363. package/dist/bin/shell/chunks/od-2GXD4D5K.js +3 -0
  364. package/dist/bin/shell/chunks/paste-DWWA3JTW.js +3 -0
  365. package/dist/bin/shell/chunks/printf-YXCSED2H.js +3 -0
  366. package/dist/bin/shell/chunks/pwd-YKLNXWZI.js +3 -0
  367. package/dist/bin/shell/chunks/python3-JCJHSX4Z.js +14 -0
  368. package/dist/bin/shell/chunks/readlink-EHXJNW62.js +3 -0
  369. package/dist/bin/shell/chunks/rev-CZTQCNOZ.js +3 -0
  370. package/dist/bin/shell/chunks/rg-PXNKNIMY.js +3 -0
  371. package/dist/bin/shell/chunks/rm-3PLW4O4B.js +3 -0
  372. package/dist/bin/shell/chunks/rmdir-7ZIVFZJX.js +3 -0
  373. package/dist/bin/shell/chunks/sed-4LVDFHIJ.js +3 -0
  374. package/dist/bin/shell/chunks/seq-X2EAOGV5.js +3 -0
  375. package/dist/bin/shell/chunks/sha1sum-CATBXX76.js +3 -0
  376. package/dist/bin/shell/chunks/sha256sum-YGSNBVY3.js +3 -0
  377. package/dist/bin/shell/chunks/sleep-DVFE2GSF.js +3 -0
  378. package/dist/bin/shell/chunks/sort-HBOCBBJQ.js +3 -0
  379. package/dist/bin/shell/chunks/split-ZNNNHKSP.js +3 -0
  380. package/dist/bin/shell/chunks/sqlite3-KP42NNIY.js +3 -0
  381. package/dist/bin/shell/chunks/stat-LROLDXHH.js +3 -0
  382. package/dist/bin/shell/chunks/strings-CNUK76JL.js +3 -0
  383. package/dist/bin/shell/chunks/tac-DG4BMYM5.js +3 -0
  384. package/dist/bin/shell/chunks/tail-UOTUV25D.js +3 -0
  385. package/dist/bin/shell/chunks/tar-7HGZIMZD.js +3 -0
  386. package/dist/bin/shell/chunks/tee-L4HKV5PD.js +3 -0
  387. package/dist/bin/shell/chunks/time-LF7BTSK5.js +3 -0
  388. package/dist/bin/shell/chunks/timeout-YGFHQJKX.js +3 -0
  389. package/dist/bin/shell/chunks/touch-TVQAUQOG.js +3 -0
  390. package/dist/bin/shell/chunks/tr-PVFO6FRY.js +3 -0
  391. package/dist/bin/shell/chunks/tree-ZGP6NPGS.js +3 -0
  392. package/dist/bin/shell/chunks/true-KFTJGQLQ.js +3 -0
  393. package/dist/bin/shell/chunks/unexpand-JPOQORZF.js +3 -0
  394. package/dist/bin/shell/chunks/uniq-JMHDIJXT.js +3 -0
  395. package/dist/bin/shell/chunks/wc-3KLVOCI2.js +3 -0
  396. package/dist/bin/shell/chunks/which-4TPGVSBZ.js +3 -0
  397. package/dist/bin/shell/chunks/whoami-B5HDVKW6.js +3 -0
  398. package/dist/bin/shell/chunks/xan-WW53ETXT.js +3 -0
  399. package/dist/bin/shell/chunks/xan-view-PD26QEFN.js +3 -0
  400. package/dist/bin/shell/chunks/xargs-4AMMXFXL.js +3 -0
  401. package/dist/bin/shell/chunks/yq-MYZOS2WN.js +3 -0
  402. package/dist/bin/shell/shell.js +834 -0
  403. package/dist/bounded-builder.d.ts +37 -0
  404. package/dist/browser.d.ts +23 -0
  405. package/dist/bundle/browser.js +1576 -0
  406. package/dist/bundle/chunks/alias-T5TO5GWK.js +2 -0
  407. package/dist/bundle/chunks/awk2-W6BNZEJN.js +2 -0
  408. package/dist/bundle/chunks/base64-MHVQ5XHI.js +2 -0
  409. package/dist/bundle/chunks/basename-SJZQ5W65.js +2 -0
  410. package/dist/bundle/chunks/bash-HIEWVHJ2.js +2 -0
  411. package/dist/bundle/chunks/cat-VZBWBIJB.js +2 -0
  412. package/dist/bundle/chunks/chmod-WM2JFFQC.js +2 -0
  413. package/dist/bundle/chunks/chunk-24NLAR7R.js +36 -0
  414. package/dist/bundle/chunks/chunk-26GP3ACY.js +12 -0
  415. package/dist/bundle/chunks/chunk-2KNTH3KH.js +9 -0
  416. package/dist/bundle/chunks/chunk-2SMD2AUA.js +3 -0
  417. package/dist/bundle/chunks/chunk-2TSZPVPI.js +21 -0
  418. package/dist/bundle/chunks/chunk-2VWG4LDT.js +11 -0
  419. package/dist/bundle/chunks/chunk-3WASQYTF.js +11 -0
  420. package/dist/bundle/chunks/chunk-44YCJWNC.js +6 -0
  421. package/dist/bundle/chunks/chunk-4EDQZIAN.js +5 -0
  422. package/dist/bundle/chunks/chunk-4MJ7VJG4.js +21 -0
  423. package/dist/bundle/chunks/chunk-4MZPEZTU.js +3 -0
  424. package/dist/bundle/chunks/chunk-57LGFT4S.js +3 -0
  425. package/dist/bundle/chunks/chunk-5I5U6IYI.js +142 -0
  426. package/dist/bundle/chunks/chunk-6DDRR56B.js +33 -0
  427. package/dist/bundle/chunks/chunk-6QF3PCMO.js +8 -0
  428. package/dist/bundle/chunks/chunk-6RK4AAB7.js +21 -0
  429. package/dist/bundle/chunks/chunk-6WGIZV3E.js +13 -0
  430. package/dist/bundle/chunks/chunk-73JQKNZT.js +33 -0
  431. package/dist/bundle/chunks/chunk-7AISL3XV.js +12 -0
  432. package/dist/bundle/chunks/chunk-7EUWTCWK.js +2 -0
  433. package/dist/bundle/chunks/chunk-7IJWBG4I.js +2 -0
  434. package/dist/bundle/chunks/chunk-7O2RDO2R.js +14 -0
  435. package/dist/bundle/chunks/chunk-A4R2GWRF.js +9 -0
  436. package/dist/bundle/chunks/chunk-AGH5UJJI.js +4 -0
  437. package/dist/bundle/chunks/chunk-ANCQ4SCV.js +2 -0
  438. package/dist/bundle/chunks/chunk-ASE6AYV3.js +17 -0
  439. package/dist/bundle/chunks/chunk-AYSZ5MAE.js +2 -0
  440. package/dist/bundle/chunks/chunk-BKUWXPEM.js +2 -0
  441. package/dist/bundle/chunks/chunk-BRJERIF4.js +2 -0
  442. package/dist/bundle/chunks/chunk-DAKEIWT3.js +21 -0
  443. package/dist/bundle/chunks/chunk-DLL7UR66.js +2 -0
  444. package/dist/bundle/chunks/chunk-DMWNBCXJ.js +10 -0
  445. package/dist/bundle/chunks/chunk-DVSA72LH.js +2 -0
  446. package/dist/bundle/chunks/chunk-EJFBIRMD.js +6 -0
  447. package/dist/bundle/chunks/chunk-EZNS4GF7.js +9 -0
  448. package/dist/bundle/chunks/chunk-F6XU52K3.js +35 -0
  449. package/dist/bundle/chunks/chunk-FHC24QSK.js +7 -0
  450. package/dist/bundle/chunks/chunk-FIMF2TLE.js +20 -0
  451. package/dist/bundle/chunks/chunk-FOCWZZDE.js +2 -0
  452. package/dist/bundle/chunks/chunk-FQUVK4Q5.js +11 -0
  453. package/dist/bundle/chunks/chunk-FSJ6TTCC.js +19 -0
  454. package/dist/bundle/chunks/chunk-FT6ODGOU.js +2 -0
  455. package/dist/bundle/chunks/chunk-FTET43KM.js +2 -0
  456. package/dist/bundle/chunks/chunk-FX4RBUYU.js +5 -0
  457. package/dist/bundle/chunks/chunk-FZRQOL3C.js +7 -0
  458. package/dist/bundle/chunks/chunk-FZZL53S2.js +275 -0
  459. package/dist/bundle/chunks/chunk-GN6CQ3J4.js +2 -0
  460. package/dist/bundle/chunks/chunk-HDRAUQK2.js +2 -0
  461. package/dist/bundle/chunks/chunk-HP7HWZ2S.js +15 -0
  462. package/dist/bundle/chunks/chunk-HRIJVWZS.js +14 -0
  463. package/dist/bundle/chunks/chunk-HXWB4Z5X.js +7 -0
  464. package/dist/bundle/chunks/chunk-ICLA3MUR.js +3 -0
  465. package/dist/bundle/chunks/chunk-IXFQXNL4.js +7 -0
  466. package/dist/bundle/chunks/chunk-KIGPB52X.js +2 -0
  467. package/dist/bundle/chunks/chunk-L2UW7DWF.js +2 -0
  468. package/dist/bundle/chunks/chunk-LI6PTSPD.js +9 -0
  469. package/dist/bundle/chunks/chunk-LPJEKUCB.js +8 -0
  470. package/dist/bundle/chunks/chunk-LSLPJOYM.js +3 -0
  471. package/dist/bundle/chunks/chunk-LVDUF74R.js +7 -0
  472. package/dist/bundle/chunks/chunk-MLIO3BK2.js +7 -0
  473. package/dist/bundle/chunks/chunk-MQKGGNPS.js +16 -0
  474. package/dist/bundle/chunks/chunk-N3A4JVFJ.js +2 -0
  475. package/dist/bundle/chunks/chunk-NBNI7G66.js +8 -0
  476. package/dist/bundle/chunks/chunk-NCUTH6QL.js +2 -0
  477. package/dist/bundle/chunks/chunk-OQ7C4FYO.js +2 -0
  478. package/dist/bundle/chunks/chunk-P57S6Z6R.js +6 -0
  479. package/dist/bundle/chunks/chunk-PCPW54JH.js +7 -0
  480. package/dist/bundle/chunks/chunk-PJM5C3HZ.js +25 -0
  481. package/dist/bundle/chunks/chunk-PPEXVPHR.js +19 -0
  482. package/dist/bundle/chunks/chunk-Q4JSJ3KQ.js +4 -0
  483. package/dist/bundle/chunks/chunk-QAYAQNCG.js +23 -0
  484. package/dist/bundle/chunks/chunk-QHDBQA5N.js +9 -0
  485. package/dist/bundle/chunks/chunk-QIQMJJZ4.js +4 -0
  486. package/dist/bundle/chunks/chunk-QJ7OXJAZ.js +6 -0
  487. package/dist/bundle/chunks/chunk-QJFYYEFV.js +11 -0
  488. package/dist/bundle/chunks/chunk-R2FBRMDU.js +14 -0
  489. package/dist/bundle/chunks/chunk-ROAWFE6V.js +5 -0
  490. package/dist/bundle/chunks/chunk-RPKJJFGZ.js +14 -0
  491. package/dist/bundle/chunks/chunk-S3ENGQML.js +15 -0
  492. package/dist/bundle/chunks/chunk-SBBYKIYU.js +3 -0
  493. package/dist/bundle/chunks/chunk-SGX4WOAM.js +2 -0
  494. package/dist/bundle/chunks/chunk-SHKOQWO4.js +3 -0
  495. package/dist/bundle/chunks/chunk-SIOONII3.js +2 -0
  496. package/dist/bundle/chunks/chunk-STHBFACM.js +1 -0
  497. package/dist/bundle/chunks/chunk-SX2HC7SO.js +2 -0
  498. package/dist/bundle/chunks/chunk-T6DNSPYO.js +100 -0
  499. package/dist/bundle/chunks/chunk-TBVD66LC.js +10 -0
  500. package/dist/bundle/chunks/chunk-TDD4NFYE.js +2 -0
  501. package/dist/bundle/chunks/chunk-TVCZIH6M.js +8 -0
  502. package/dist/bundle/chunks/chunk-U4K5ZDWK.js +9 -0
  503. package/dist/bundle/chunks/chunk-UC76ZOWM.js +15 -0
  504. package/dist/bundle/chunks/chunk-UIJUTQPH.js +3 -0
  505. package/dist/bundle/chunks/chunk-ULXTDFQC.js +2 -0
  506. package/dist/bundle/chunks/chunk-UTKGYVUZ.js +7 -0
  507. package/dist/bundle/chunks/chunk-UUIYAOD4.js +2 -0
  508. package/dist/bundle/chunks/chunk-VJ6UXG2R.js +64 -0
  509. package/dist/bundle/chunks/chunk-W2Z6LYL6.js +11 -0
  510. package/dist/bundle/chunks/chunk-W5DWRFSU.js +2 -0
  511. package/dist/bundle/chunks/chunk-WN54B5NQ.js +12 -0
  512. package/dist/bundle/chunks/chunk-WNH3HOQA.js +2 -0
  513. package/dist/bundle/chunks/chunk-WXPNKIIH.js +2 -0
  514. package/dist/bundle/chunks/chunk-WZQNMEQW.js +2 -0
  515. package/dist/bundle/chunks/chunk-XV2V56NQ.js +12 -0
  516. package/dist/bundle/chunks/chunk-XVSR5HHH.js +6 -0
  517. package/dist/bundle/chunks/chunk-XXBIOG4R.js +5 -0
  518. package/dist/bundle/chunks/chunk-Y62SXZKJ.js +12 -0
  519. package/dist/bundle/chunks/chunk-YEYSCLSJ.js +3 -0
  520. package/dist/bundle/chunks/chunk-YJKHREBZ.js +11 -0
  521. package/dist/bundle/chunks/chunk-YUSFCOM7.js +2 -0
  522. package/dist/bundle/chunks/chunk-ZBUZKIPX.js +6 -0
  523. package/dist/bundle/chunks/chunk-ZDPFA4L3.js +6 -0
  524. package/dist/bundle/chunks/chunk-ZT3WF5R7.js +16 -0
  525. package/dist/bundle/chunks/chunk-ZXFELXJH.js +6 -0
  526. package/dist/bundle/chunks/clear-KPIUNI6K.js +2 -0
  527. package/dist/bundle/chunks/column-QJI65SH2.js +2 -0
  528. package/dist/bundle/chunks/comm-DTWKU2MC.js +2 -0
  529. package/dist/bundle/chunks/cp-2KZIPZJS.js +2 -0
  530. package/dist/bundle/chunks/curl-K4WT7UPN.js +30 -0
  531. package/dist/bundle/chunks/cut-FMDNVWQN.js +2 -0
  532. package/dist/bundle/chunks/date-7OEDRA27.js +2 -0
  533. package/dist/bundle/chunks/diff-CSARC7WF.js +2 -0
  534. package/dist/bundle/chunks/dirname-Z2ZMOOW2.js +2 -0
  535. package/dist/bundle/chunks/du-7AZCLKR6.js +2 -0
  536. package/dist/bundle/chunks/echo-PLLZYM2L.js +2 -0
  537. package/dist/bundle/chunks/env-VUUMB47B.js +2 -0
  538. package/dist/bundle/chunks/expand-J3VOSOMK.js +2 -0
  539. package/dist/bundle/chunks/expr-XSBELPAC.js +2 -0
  540. package/dist/bundle/chunks/file-URNAD6FQ.js +2 -0
  541. package/dist/bundle/chunks/find-END3EAHV.js +2 -0
  542. package/dist/bundle/chunks/flag-coverage-DPSAPFXA.js +2 -0
  543. package/dist/bundle/chunks/fold-QJBPHRFJ.js +2 -0
  544. package/dist/bundle/chunks/grep-4AYF3A5J.js +2 -0
  545. package/dist/bundle/chunks/gzip-RQOBR22H.js +2 -0
  546. package/dist/bundle/chunks/head-6UIPFWVJ.js +2 -0
  547. package/dist/bundle/chunks/help-QDDMBDU7.js +2 -0
  548. package/dist/bundle/chunks/history-3N762S3K.js +2 -0
  549. package/dist/bundle/chunks/hostname-CESD3CQR.js +2 -0
  550. package/dist/bundle/chunks/html-to-markdown-PE6BPRPA.js +2 -0
  551. package/dist/bundle/chunks/join-C2B6NGXH.js +2 -0
  552. package/dist/bundle/chunks/jq-NY7PCVMH.js +2 -0
  553. package/dist/bundle/chunks/js-exec-XKF2B7C3.js +98 -0
  554. package/dist/bundle/chunks/js-exec-worker.js +4809 -0
  555. package/dist/bundle/chunks/ln-OPY2ZVGQ.js +2 -0
  556. package/dist/bundle/chunks/ls-ZPXGZX63.js +2 -0
  557. package/dist/bundle/chunks/md5sum-JEDX55KS.js +2 -0
  558. package/dist/bundle/chunks/mkdir-WDDKK2P3.js +2 -0
  559. package/dist/bundle/chunks/mv-ZF6UBVRB.js +2 -0
  560. package/dist/bundle/chunks/nl-IELOWYJG.js +2 -0
  561. package/dist/bundle/chunks/od-Z4AIL3P4.js +2 -0
  562. package/dist/bundle/chunks/paste-ZNHNSRBW.js +2 -0
  563. package/dist/bundle/chunks/printf-B2NSYQ3N.js +2 -0
  564. package/dist/bundle/chunks/pwd-76BPYV5F.js +2 -0
  565. package/dist/bundle/chunks/python3-F5S5TYGS.js +13 -0
  566. package/dist/bundle/chunks/readlink-U5OM5A3M.js +2 -0
  567. package/dist/bundle/chunks/rev-EPOS3MFH.js +2 -0
  568. package/dist/bundle/chunks/rg-NAMXBYKS.js +2 -0
  569. package/dist/bundle/chunks/rm-JQ4GDKDD.js +2 -0
  570. package/dist/bundle/chunks/rmdir-YJKPQVCK.js +2 -0
  571. package/dist/bundle/chunks/sed-LIRH26EA.js +2 -0
  572. package/dist/bundle/chunks/seq-B6KDLMYQ.js +2 -0
  573. package/dist/bundle/chunks/sha1sum-BLPZJ6MP.js +2 -0
  574. package/dist/bundle/chunks/sha256sum-VJZ4PHQ4.js +2 -0
  575. package/dist/bundle/chunks/sleep-PPRBTSVR.js +2 -0
  576. package/dist/bundle/chunks/sort-CB5GO7XH.js +2 -0
  577. package/dist/bundle/chunks/split-JICLAMP6.js +2 -0
  578. package/dist/bundle/chunks/sqlite3-4EZ4GXVD.js +2 -0
  579. package/dist/bundle/chunks/sqlite3-worker.js +1928 -0
  580. package/dist/bundle/chunks/stat-LXFZND2P.js +2 -0
  581. package/dist/bundle/chunks/strings-VLFTYX2Z.js +2 -0
  582. package/dist/bundle/chunks/tac-YXC4HBTR.js +2 -0
  583. package/dist/bundle/chunks/tail-UBGSN4JF.js +2 -0
  584. package/dist/bundle/chunks/tar-B72KU357.js +2 -0
  585. package/dist/bundle/chunks/tee-OOWSWHRQ.js +2 -0
  586. package/dist/bundle/chunks/time-NERE2JJ2.js +2 -0
  587. package/dist/bundle/chunks/timeout-C6WDYPLV.js +2 -0
  588. package/dist/bundle/chunks/touch-W4DF6Z4T.js +2 -0
  589. package/dist/bundle/chunks/tr-UI2LA3GA.js +2 -0
  590. package/dist/bundle/chunks/tree-7OOL2MH6.js +2 -0
  591. package/dist/bundle/chunks/true-QUBPEGGU.js +2 -0
  592. package/dist/bundle/chunks/unexpand-YD5BWFH4.js +2 -0
  593. package/dist/bundle/chunks/uniq-PAEPA27E.js +2 -0
  594. package/dist/bundle/chunks/wc-7WVM7GV4.js +2 -0
  595. package/dist/bundle/chunks/which-UWVKETYW.js +2 -0
  596. package/dist/bundle/chunks/whoami-KR6E7UIR.js +2 -0
  597. package/dist/bundle/chunks/worker.js +3330 -0
  598. package/dist/bundle/chunks/xan-UIGVJCMA.js +2 -0
  599. package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +2 -0
  600. package/dist/bundle/chunks/xargs-VQEXRD3C.js +2 -0
  601. package/dist/bundle/chunks/yq-FGNXZCGX.js +2 -0
  602. package/dist/bundle/index.cjs +2237 -0
  603. package/dist/bundle/index.js +809 -0
  604. package/dist/commands/alias/alias.d.ts +6 -0
  605. package/dist/commands/awk/ast.d.ts +202 -0
  606. package/dist/commands/awk/awk2.d.ts +9 -0
  607. package/dist/commands/awk/builtins.d.ts +17 -0
  608. package/dist/commands/awk/interpreter/context.d.ts +88 -0
  609. package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
  610. package/dist/commands/awk/interpreter/fields.d.ts +25 -0
  611. package/dist/commands/awk/interpreter/index.d.ts +8 -0
  612. package/dist/commands/awk/interpreter/interpreter.d.ts +54 -0
  613. package/dist/commands/awk/interpreter/statements.d.ts +11 -0
  614. package/dist/commands/awk/interpreter/type-coercion.d.ts +32 -0
  615. package/dist/commands/awk/interpreter/types.d.ts +13 -0
  616. package/dist/commands/awk/interpreter/variables.d.ts +35 -0
  617. package/dist/commands/awk/lexer.d.ts +101 -0
  618. package/dist/commands/awk/parser2-print.d.ts +38 -0
  619. package/dist/commands/awk/parser2.d.ts +96 -0
  620. package/dist/commands/base64/base64.d.ts +7 -0
  621. package/dist/commands/basename/basename.d.ts +4 -0
  622. package/dist/commands/bash/bash.d.ts +6 -0
  623. package/dist/commands/browser-excluded.d.ts +16 -0
  624. package/dist/commands/cat/cat.d.ts +4 -0
  625. package/dist/commands/chmod/chmod.d.ts +4 -0
  626. package/dist/commands/clear/clear.d.ts +4 -0
  627. package/dist/commands/column/column.d.ts +11 -0
  628. package/dist/commands/comm/comm.d.ts +12 -0
  629. package/dist/commands/compression/codec-budget.d.ts +35 -0
  630. package/dist/commands/cp/cp.d.ts +4 -0
  631. package/dist/commands/curl/curl.d.ts +8 -0
  632. package/dist/commands/curl/form.d.ts +23 -0
  633. package/dist/commands/curl/help.d.ts +9 -0
  634. package/dist/commands/curl/parse.d.ts +9 -0
  635. package/dist/commands/curl/response-formatting.d.ts +20 -0
  636. package/dist/commands/curl/types.d.ts +70 -0
  637. package/dist/commands/cut/cut.d.ts +4 -0
  638. package/dist/commands/date/date.d.ts +7 -0
  639. package/dist/commands/diff/diff.d.ts +7 -0
  640. package/dist/commands/dirname/dirname.d.ts +4 -0
  641. package/dist/commands/du/du.d.ts +4 -0
  642. package/dist/commands/duration.d.ts +5 -0
  643. package/dist/commands/echo/echo.d.ts +4 -0
  644. package/dist/commands/env/env.d.ts +6 -0
  645. package/dist/commands/expand/expand.d.ts +12 -0
  646. package/dist/commands/expand/unexpand.d.ts +12 -0
  647. package/dist/commands/expr/expr.d.ts +9 -0
  648. package/dist/commands/file/file.d.ts +9 -0
  649. package/dist/commands/find/find.d.ts +4 -0
  650. package/dist/commands/find/matcher.d.ts +53 -0
  651. package/dist/commands/find/parser.d.ts +2 -0
  652. package/dist/commands/find/types.d.ts +89 -0
  653. package/dist/commands/flag-coverage.d.ts +2 -0
  654. package/dist/commands/fold/fold.d.ts +12 -0
  655. package/dist/commands/format-mode.d.ts +4 -0
  656. package/dist/commands/fuzz-flags-types.d.ts +17 -0
  657. package/dist/commands/fuzz-flags.d.ts +8 -0
  658. package/dist/commands/grep/grep.d.ts +8 -0
  659. package/dist/commands/gzip/gzip.d.ts +13 -0
  660. package/dist/commands/head/head-tail-shared.d.ts +38 -0
  661. package/dist/commands/head/head.d.ts +4 -0
  662. package/dist/commands/help/help.d.ts +4 -0
  663. package/dist/commands/help.d.ts +16 -0
  664. package/dist/commands/history/history.d.ts +4 -0
  665. package/dist/commands/hostname/hostname.d.ts +11 -0
  666. package/dist/commands/html-to-markdown/html-to-markdown.d.ts +9 -0
  667. package/dist/commands/join/join.d.ts +12 -0
  668. package/dist/commands/jq/jq.d.ts +9 -0
  669. package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
  670. package/dist/commands/js-exec/js-exec-worker.d.ts +33 -0
  671. package/dist/commands/js-exec/js-exec.d.ts +13 -0
  672. package/dist/commands/js-exec/module-shims.d.ts +29 -0
  673. package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
  674. package/dist/commands/ln/ln.d.ts +4 -0
  675. package/dist/commands/ls/ls.d.ts +4 -0
  676. package/dist/commands/md5sum/checksum.d.ts +7 -0
  677. package/dist/commands/md5sum/md5sum.d.ts +4 -0
  678. package/dist/commands/md5sum/sha1sum.d.ts +4 -0
  679. package/dist/commands/md5sum/sha256sum.d.ts +4 -0
  680. package/dist/commands/mkdir/mkdir.d.ts +4 -0
  681. package/dist/commands/mv/mv.d.ts +4 -0
  682. package/dist/commands/nl/nl.d.ts +12 -0
  683. package/dist/commands/od/od.d.ts +12 -0
  684. package/dist/commands/paste/paste.d.ts +4 -0
  685. package/dist/commands/printf/escapes.d.ts +27 -0
  686. package/dist/commands/printf/printf.d.ts +4 -0
  687. package/dist/commands/printf/strftime.d.ts +14 -0
  688. package/dist/commands/pwd/pwd.d.ts +4 -0
  689. package/dist/commands/python3/python3.d.ts +16 -0
  690. package/dist/commands/python3/worker.d.ts +31 -0
  691. package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
  692. package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
  693. package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
  694. package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
  695. package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
  696. package/dist/commands/query-engine/builtins/index.d.ts +17 -0
  697. package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
  698. package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
  699. package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
  700. package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
  701. package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
  702. package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
  703. package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
  704. package/dist/commands/query-engine/evaluator.d.ts +62 -0
  705. package/dist/commands/query-engine/index.d.ts +8 -0
  706. package/dist/commands/query-engine/json-output.d.ts +11 -0
  707. package/dist/commands/query-engine/parser-types.d.ts +171 -0
  708. package/dist/commands/query-engine/parser.d.ts +14 -0
  709. package/dist/commands/query-engine/path-operations.d.ts +15 -0
  710. package/dist/commands/query-engine/safe-object.d.ts +84 -0
  711. package/dist/commands/query-engine/value-operations.d.ts +44 -0
  712. package/dist/commands/readlink/readlink.d.ts +4 -0
  713. package/dist/commands/registry.d.ts +56 -0
  714. package/dist/commands/rev/rev.d.ts +13 -0
  715. package/dist/commands/rg/file-types.d.ts +49 -0
  716. package/dist/commands/rg/gitignore.d.ts +98 -0
  717. package/dist/commands/rg/rg-options.d.ts +61 -0
  718. package/dist/commands/rg/rg-parser.d.ts +20 -0
  719. package/dist/commands/rg/rg-search.d.ts +15 -0
  720. package/dist/commands/rg/rg.d.ts +14 -0
  721. package/dist/commands/rm/rm.d.ts +4 -0
  722. package/dist/commands/rmdir/rmdir.d.ts +4 -0
  723. package/dist/commands/search-engine/index.d.ts +10 -0
  724. package/dist/commands/search-engine/matcher.d.ts +72 -0
  725. package/dist/commands/search-engine/regex.d.ts +46 -0
  726. package/dist/commands/sed/executor.d.ts +7 -0
  727. package/dist/commands/sed/lexer.d.ts +88 -0
  728. package/dist/commands/sed/parser.d.ts +21 -0
  729. package/dist/commands/sed/sed-regex.d.ts +23 -0
  730. package/dist/commands/sed/sed.d.ts +4 -0
  731. package/dist/commands/sed/types.d.ts +216 -0
  732. package/dist/commands/seq/seq.d.ts +16 -0
  733. package/dist/commands/sleep/sleep.d.ts +4 -0
  734. package/dist/commands/sort/comparator.d.ts +9 -0
  735. package/dist/commands/sort/parser.d.ts +11 -0
  736. package/dist/commands/sort/sort.d.ts +4 -0
  737. package/dist/commands/sort/types.d.ts +30 -0
  738. package/dist/commands/split/split.d.ts +12 -0
  739. package/dist/commands/sqlite3/formatters.d.ts +17 -0
  740. package/dist/commands/sqlite3/sqlite3.d.ts +24 -0
  741. package/dist/commands/sqlite3/worker.d.ts +50 -0
  742. package/dist/commands/sqlite3/worker.js +1928 -0
  743. package/dist/commands/stat/stat.d.ts +4 -0
  744. package/dist/commands/strings/strings.d.ts +12 -0
  745. package/dist/commands/tac/tac.d.ts +11 -0
  746. package/dist/commands/tail/tail.d.ts +4 -0
  747. package/dist/commands/tar/archive.d.ts +150 -0
  748. package/dist/commands/tar/bzip2-compress.d.ts +18 -0
  749. package/dist/commands/tar/tar-options.d.ts +37 -0
  750. package/dist/commands/tar/tar.d.ts +10 -0
  751. package/dist/commands/tee/tee.d.ts +4 -0
  752. package/dist/commands/time/time.d.ts +27 -0
  753. package/dist/commands/timeout/timeout.d.ts +4 -0
  754. package/dist/commands/touch/touch.d.ts +4 -0
  755. package/dist/commands/tr/tr.d.ts +4 -0
  756. package/dist/commands/tree/tree.d.ts +4 -0
  757. package/dist/commands/true/true.d.ts +6 -0
  758. package/dist/commands/uniq/uniq.d.ts +4 -0
  759. package/dist/commands/wc/wc.d.ts +4 -0
  760. package/dist/commands/which/which.d.ts +4 -0
  761. package/dist/commands/whoami/whoami.d.ts +11 -0
  762. package/dist/commands/worker-bridge/bridge-handler.d.ts +73 -0
  763. package/dist/commands/worker-bridge/protocol.d.ts +141 -0
  764. package/dist/commands/worker-bridge/sync-backend.d.ts +86 -0
  765. package/dist/commands/worker-request-controller.d.ts +36 -0
  766. package/dist/commands/xan/aggregation.d.ts +30 -0
  767. package/dist/commands/xan/bounded-output.d.ts +4 -0
  768. package/dist/commands/xan/column-selection.d.ts +20 -0
  769. package/dist/commands/xan/csv.d.ts +62 -0
  770. package/dist/commands/xan/moonblade-parser.d.ts +89 -0
  771. package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
  772. package/dist/commands/xan/moonblade-tokenizer.d.ts +32 -0
  773. package/dist/commands/xan/subcommands.d.ts +15 -0
  774. package/dist/commands/xan/xan-agg.d.ts +8 -0
  775. package/dist/commands/xan/xan-columns.d.ts +8 -0
  776. package/dist/commands/xan/xan-core.d.ts +10 -0
  777. package/dist/commands/xan/xan-data.d.ts +52 -0
  778. package/dist/commands/xan/xan-filter.d.ts +8 -0
  779. package/dist/commands/xan/xan-map.d.ts +11 -0
  780. package/dist/commands/xan/xan-reshape.d.ts +40 -0
  781. package/dist/commands/xan/xan-simple.d.ts +40 -0
  782. package/dist/commands/xan/xan-view.d.ts +12 -0
  783. package/dist/commands/xan/xan.d.ts +10 -0
  784. package/dist/commands/xargs/xargs.d.ts +4 -0
  785. package/dist/commands/yq/formats.d.ts +65 -0
  786. package/dist/commands/yq/yq.d.ts +13 -0
  787. package/dist/custom-commands.d.ts +65 -0
  788. package/dist/encoding.d.ts +131 -0
  789. package/dist/execution-output.d.ts +28 -0
  790. package/dist/execution-scope.d.ts +110 -0
  791. package/dist/fatal-execution-error.d.ts +27 -0
  792. package/dist/fs/encoding.d.ts +17 -0
  793. package/dist/fs/identity.d.ts +9 -0
  794. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +98 -0
  795. package/dist/fs/in-memory-fs/index.d.ts +1 -0
  796. package/dist/fs/init.d.ts +22 -0
  797. package/dist/fs/interface.d.ts +255 -0
  798. package/dist/fs/mountable-fs/index.d.ts +1 -0
  799. package/dist/fs/mountable-fs/mountable-fs.d.ts +118 -0
  800. package/dist/fs/overlay-fs/apply.d.ts +22 -0
  801. package/dist/fs/overlay-fs/index.d.ts +1 -0
  802. package/dist/fs/overlay-fs/overlay-fs.d.ts +360 -0
  803. package/dist/fs/overlay-fs/overlay-tree.d.ts +188 -0
  804. package/dist/fs/path-utils.d.ts +48 -0
  805. package/dist/fs/read-write-fs/index.d.ts +1 -0
  806. package/dist/fs/read-write-fs/read-write-fs.d.ts +150 -0
  807. package/dist/fs/real-fs-utils.d.ts +90 -0
  808. package/dist/fs/sanitize-error.d.ts +19 -0
  809. package/dist/fs/traversal.d.ts +98 -0
  810. package/dist/index.d.cts +30 -0
  811. package/dist/index.d.ts +30 -0
  812. package/dist/interpreter/alias-expansion.d.ts +27 -0
  813. package/dist/interpreter/arithmetic.d.ts +24 -0
  814. package/dist/interpreter/assignment-expansion.d.ts +24 -0
  815. package/dist/interpreter/builtin-dispatch.d.ts +46 -0
  816. package/dist/interpreter/builtins/break.d.ts +6 -0
  817. package/dist/interpreter/builtins/cd.d.ts +6 -0
  818. package/dist/interpreter/builtins/compgen.d.ts +26 -0
  819. package/dist/interpreter/builtins/complete.d.ts +17 -0
  820. package/dist/interpreter/builtins/compopt.d.ts +28 -0
  821. package/dist/interpreter/builtins/continue.d.ts +6 -0
  822. package/dist/interpreter/builtins/declare-array-parsing.d.ts +18 -0
  823. package/dist/interpreter/builtins/declare-print.d.ts +39 -0
  824. package/dist/interpreter/builtins/declare.d.ts +35 -0
  825. package/dist/interpreter/builtins/dirs.d.ts +29 -0
  826. package/dist/interpreter/builtins/eval.d.ts +15 -0
  827. package/dist/interpreter/builtins/exit.d.ts +5 -0
  828. package/dist/interpreter/builtins/export.d.ts +14 -0
  829. package/dist/interpreter/builtins/getopts.d.ts +18 -0
  830. package/dist/interpreter/builtins/hash.d.ts +19 -0
  831. package/dist/interpreter/builtins/help.d.ts +12 -0
  832. package/dist/interpreter/builtins/index.d.ts +44 -0
  833. package/dist/interpreter/builtins/let.d.ts +18 -0
  834. package/dist/interpreter/builtins/local.d.ts +6 -0
  835. package/dist/interpreter/builtins/mapfile.d.ts +17 -0
  836. package/dist/interpreter/builtins/read.d.ts +6 -0
  837. package/dist/interpreter/builtins/return.d.ts +6 -0
  838. package/dist/interpreter/builtins/set.d.ts +9 -0
  839. package/dist/interpreter/builtins/shift.d.ts +15 -0
  840. package/dist/interpreter/builtins/shopt.d.ts +7 -0
  841. package/dist/interpreter/builtins/source.d.ts +6 -0
  842. package/dist/interpreter/builtins/unset.d.ts +16 -0
  843. package/dist/interpreter/builtins/variable-assignment.d.ts +69 -0
  844. package/dist/interpreter/command-analysis.d.ts +30 -0
  845. package/dist/interpreter/command-resolution.d.ts +43 -0
  846. package/dist/interpreter/conditionals.d.ts +17 -0
  847. package/dist/interpreter/control-flow.d.ts +21 -0
  848. package/dist/interpreter/defense-aware-command-context.d.ts +6 -0
  849. package/dist/interpreter/errors.d.ts +161 -0
  850. package/dist/interpreter/expansion/analysis.d.ts +37 -0
  851. package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
  852. package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
  853. package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
  854. package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
  855. package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
  856. package/dist/interpreter/expansion/brace-range.d.ts +24 -0
  857. package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
  858. package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
  859. package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
  860. package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
  861. package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
  862. package/dist/interpreter/expansion/pattern-removal.d.ts +17 -0
  863. package/dist/interpreter/expansion/pattern-replacement.d.ts +4 -0
  864. package/dist/interpreter/expansion/pattern.d.ts +23 -0
  865. package/dist/interpreter/expansion/positional-params.d.ts +59 -0
  866. package/dist/interpreter/expansion/prompt.d.ts +39 -0
  867. package/dist/interpreter/expansion/quoting.d.ts +13 -0
  868. package/dist/interpreter/expansion/tilde.d.ts +14 -0
  869. package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
  870. package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
  871. package/dist/interpreter/expansion/variable.d.ts +36 -0
  872. package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
  873. package/dist/interpreter/expansion/word-split.d.ts +29 -0
  874. package/dist/interpreter/expansion.d.ts +53 -0
  875. package/dist/interpreter/fd-table.d.ts +130 -0
  876. package/dist/interpreter/functions.d.ts +14 -0
  877. package/dist/interpreter/helpers/array.d.ts +56 -0
  878. package/dist/interpreter/helpers/bounded-array.d.ts +2 -0
  879. package/dist/interpreter/helpers/condition.d.ts +19 -0
  880. package/dist/interpreter/helpers/errors.d.ts +8 -0
  881. package/dist/interpreter/helpers/file-tests.d.ts +33 -0
  882. package/dist/interpreter/helpers/ifs.d.ts +104 -0
  883. package/dist/interpreter/helpers/loop.d.ts +24 -0
  884. package/dist/interpreter/helpers/nameref.d.ts +65 -0
  885. package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
  886. package/dist/interpreter/helpers/quoting.d.ts +26 -0
  887. package/dist/interpreter/helpers/readonly.d.ts +45 -0
  888. package/dist/interpreter/helpers/regex.d.ts +8 -0
  889. package/dist/interpreter/helpers/result.d.ts +60 -0
  890. package/dist/interpreter/helpers/shell-constants.d.ts +41 -0
  891. package/dist/interpreter/helpers/shellopts.d.ts +28 -0
  892. package/dist/interpreter/helpers/string-compare.d.ts +24 -0
  893. package/dist/interpreter/helpers/string-tests.d.ts +13 -0
  894. package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
  895. package/dist/interpreter/helpers/word-matching.d.ts +16 -0
  896. package/dist/interpreter/helpers/word-parts.d.ts +22 -0
  897. package/dist/interpreter/helpers/xtrace.d.ts +18 -0
  898. package/dist/interpreter/index.d.ts +3 -0
  899. package/dist/interpreter/interpreter.d.ts +82 -0
  900. package/dist/interpreter/numeric-fd-redirects.d.ts +8 -0
  901. package/dist/interpreter/pipeline-execution.d.ts +16 -0
  902. package/dist/interpreter/process-substitution.d.ts +62 -0
  903. package/dist/interpreter/redirections.d.ts +50 -0
  904. package/dist/interpreter/simple-command-assignments.d.ts +36 -0
  905. package/dist/interpreter/state-transaction.d.ts +7 -0
  906. package/dist/interpreter/subshell-group.d.ts +40 -0
  907. package/dist/interpreter/type-command.d.ts +37 -0
  908. package/dist/interpreter/types.d.ts +402 -0
  909. package/dist/limits.d.ts +111 -0
  910. package/dist/network/allow-list/shared.d.ts +49 -0
  911. package/dist/network/allow-list.d.ts +59 -0
  912. package/dist/network/dns-pin.d.ts +42 -0
  913. package/dist/network/fetch.d.ts +27 -0
  914. package/dist/network/index.d.ts +7 -0
  915. package/dist/network/types.d.ts +182 -0
  916. package/dist/parser/arithmetic-parser.d.ts +23 -0
  917. package/dist/parser/arithmetic-primaries.d.ts +45 -0
  918. package/dist/parser/command-parser.d.ts +10 -0
  919. package/dist/parser/compound-parser.d.ts +28 -0
  920. package/dist/parser/conditional-parser.d.ts +8 -0
  921. package/dist/parser/expansion-parser.d.ts +18 -0
  922. package/dist/parser/lexer.d.ts +195 -0
  923. package/dist/parser/parser-substitution.d.ts +85 -0
  924. package/dist/parser/parser.d.ts +152 -0
  925. package/dist/parser/types.d.ts +40 -0
  926. package/dist/parser/word-parser.d.ts +35 -0
  927. package/dist/sandbox/Command.d.ts +35 -0
  928. package/dist/sandbox/Sandbox.d.ts +121 -0
  929. package/dist/sandbox/index.d.ts +2 -0
  930. package/dist/security/blocked-globals.d.ts +60 -0
  931. package/dist/security/defense-context.d.ts +13 -0
  932. package/dist/security/defense-in-depth-box.d.ts +354 -0
  933. package/dist/security/index.d.ts +33 -0
  934. package/dist/security/safe-timestamp.d.ts +1 -0
  935. package/dist/security/security-violation-logger.d.ts +99 -0
  936. package/dist/security/trusted-globals.d.ts +17 -0
  937. package/dist/security/types.d.ts +151 -0
  938. package/dist/security/violation-error-message.d.ts +3 -0
  939. package/dist/security/wasm-callback.d.ts +6 -0
  940. package/dist/security/worker-defense-in-depth.d.ts +228 -0
  941. package/dist/shell-metadata.d.ts +25 -0
  942. package/dist/source-limit.d.ts +2 -0
  943. package/dist/timers.d.ts +16 -0
  944. package/dist/transform/pipeline.d.ts +8 -0
  945. package/dist/transform/plugins/command-collector.d.ts +8 -0
  946. package/dist/transform/plugins/tee-plugin.d.ts +40 -0
  947. package/dist/transform/serialize.d.ts +4 -0
  948. package/dist/transform/types.d.ts +18 -0
  949. package/dist/types.d.ts +319 -0
  950. package/dist/utils/args.d.ts +55 -0
  951. package/dist/utils/constants.d.ts +15 -0
  952. package/dist/utils/file-reader.d.ts +76 -0
  953. package/dist/utils/glob.d.ts +25 -0
  954. package/dist/vitest-setup.d.ts +1 -0
  955. package/package.json +136 -0
  956. package/vendor/cpython-emscripten/python.cjs +2 -0
  957. package/vendor/cpython-emscripten/python.wasm +0 -0
  958. package/vendor/cpython-emscripten/python313.zip +0 -0
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a,b,c,d}from"./chunk-FHC24QSK.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as aliasCommand,c as flagsForFuzzing,b as unaliasCommand,d as unaliasFlagsForFuzzing};
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-2TSZPVPI.js";import"./chunk-DLL7UR66.js";import"./chunk-BKUWXPEM.js";import"./chunk-73JQKNZT.js";import"./chunk-AYSZ5MAE.js";import"./chunk-ZBUZKIPX.js";import"./chunk-57LGFT4S.js";import"./chunk-FTET43KM.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as awkCommand2,b as flagsForFuzzing};
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-PCPW54JH.js";import"./chunk-YEYSCLSJ.js";import"./chunk-AYSZ5MAE.js";import"./chunk-ZBUZKIPX.js";import"./chunk-STHBFACM.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as base64Command,b as flagsForFuzzing};
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-ZDPFA4L3.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as basenameCommand,b as flagsForFuzzing};
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a,b,c,d}from"./chunk-EJFBIRMD.js";import"./chunk-DLL7UR66.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as bashCommand,c as flagsForFuzzing,b as shCommand,d as shFlagsForFuzzing};
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-P57S6Z6R.js";import"./chunk-YEYSCLSJ.js";import"./chunk-AYSZ5MAE.js";import"./chunk-ZBUZKIPX.js";import"./chunk-STHBFACM.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as catCommand,b as flagsForFuzzing};
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-NBNI7G66.js";import"./chunk-AYSZ5MAE.js";import"./chunk-ZBUZKIPX.js";import"./chunk-FTET43KM.js";import"./chunk-7IJWBG4I.js";import"./chunk-YUSFCOM7.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-FOCWZZDE.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as chmodCommand,b as flagsForFuzzing};
@@ -0,0 +1,36 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a as W}from"./chunk-N3A4JVFJ.js";import{c as $}from"./chunk-BKUWXPEM.js";import{b as C}from"./chunk-ZBUZKIPX.js";import{a as V}from"./chunk-7IJWBG4I.js";import{d as I}from"./chunk-GN6CQ3J4.js";import{a as B,b}from"./chunk-FOCWZZDE.js";import{a as x}from"./chunk-W5DWRFSU.js";import{a as N,b as R}from"./chunk-QAYAQNCG.js";import{existsSync as ce}from"node:fs";import{dirname as de,join as T,sep as Q}from"node:path";import{fileURLToPath as me}from"node:url";import{Worker as he}from"node:worker_threads";import pe from"sql.js";function K(e,t){return e==null?Buffer.byteLength(t,"utf8"):e instanceof Uint8Array||Buffer.isBuffer(e)?e.byteLength:Buffer.byteLength(String(e),"utf8")}function X(e,t,r){let n=r.maxOutputSize??Number.MAX_SAFE_INTEGER,s=Buffer.byteLength(r.separator,"utf8");s+=Buffer.byteLength(r.newline,"utf8");for(let a of e)s+=Buffer.byteLength(a,"utf8");for(let a of t){s+=a.length*16;for(let i of a)s+=K(i,r.nullValue);if(s>n)break}let o=s*8+(t.length+3)*(e.length+3)*16;if(!Number.isSafeInteger(o)||o>n)throw new Error(`formatted output exceeds ${n} byte limit`);return n}function _(e,t,r){let n=X(e,t,r),s;switch(r.mode){case"list":s=Y(e,t,r);break;case"csv":s=Z(e,t,r);break;case"json":s=te(e,t);break;case"line":s=re(e,t,r);break;case"column":s=ne(e,t,r);break;case"table":s=se(e,t,r);break;case"markdown":s=oe(e,t,r);break;case"tabs":s=ie(e,t,r);break;case"box":s=ae(e,t,r);break;case"quote":s=le(e,t,r);break;case"html":s=fe(e,t,r);break;case"ascii":s=ue(e,t,r);break}if(Buffer.byteLength(s,"utf8")>n)throw new Error(`formatted output exceeds ${n} byte limit`);return s}function m(e,t){return e==null?t:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString("utf8"):typeof e=="number"&&!Number.isInteger(e)?e.toPrecision(17).replace(/\.?0+$/,""):String(e)}function Y(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.join(r.separator));for(let s of t)n.push(s.map(o=>m(o,r.nullValue)).join(r.separator));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function Z(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.map(v).join(","));for(let s of t)n.push(s.map(o=>v(m(o,r.nullValue))).join(","));return n.length>0?`${n.join(`
3
+ `)}
4
+ `:""}function v(e){return e.includes(",")||e.includes('"')||e.includes("'")||e.includes(`
5
+ `)?`"${e.replace(/"/g,'""')}"`:e}function F(e){return e.toPrecision(17).replace(/\.?0+$/,"")}function ee(e){return e===null?"null":typeof e=="number"?Number.isInteger(e)?String(e):F(e):JSON.stringify(e)}function te(e,t){return t.length===0?"":`[${t.map(n=>`{${e.map((o,a)=>`${JSON.stringify(o)}:${ee(n[a])}`).join(",")}}`).join(`,
6
+ `)}]
7
+ `}function re(e,t,r){if(e.length===0||t.length===0)return"";let n=Math.max(5,...e.map(o=>o.length)),s=[];for(let o of t)for(let a=0;a<e.length;a++){let i=e[a].padStart(n);s.push(`${i} = ${m(o[a],r.nullValue)}`)}return`${s.join(`
8
+ `)}
9
+ `}function ne(e,t,r){if(e.length===0)return"";let n=e.map(o=>o.length);for(let o of t)for(let a=0;a<o.length;a++){let i=m(o[a],r.nullValue).length;i>n[a]&&(n[a]=i)}let s=[];r.header&&(s.push(e.map((o,a)=>o.padEnd(n[a])).join(" ")),s.push(n.map(o=>"-".repeat(o)).join(" ")));for(let o of t)s.push(o.map((a,i)=>m(a,r.nullValue).padEnd(n[i])).join(" "));return s.length>0?`${s.join(`
10
+ `)}
11
+ `:""}function se(e,t,r){if(e.length===0)return"";let n=e.map(a=>a.length);for(let a of t)for(let i=0;i<a.length;i++){let c=m(a[i],r.nullValue).length;c>n[i]&&(n[i]=c)}let s=[],o=`+${n.map(a=>"-".repeat(a+2)).join("+")}+`;s.push(o),r.header&&(s.push(`| ${e.map((a,i)=>a.padEnd(n[i])).join(" | ")} |`),s.push(o));for(let a of t)s.push(`| ${a.map((i,c)=>m(i,r.nullValue).padEnd(n[c])).join(" | ")} |`);return s.push(o),`${s.join(`
12
+ `)}
13
+ `}function oe(e,t,r){if(e.length===0)return"";let n=[];r.header&&(n.push(`| ${e.join(" | ")} |`),n.push(`|${e.map(()=>"---").join("|")}|`));for(let s of t)n.push(`| ${s.map(o=>m(o,r.nullValue)).join(" | ")} |`);return n.length>0?`${n.join(`
14
+ `)}
15
+ `:""}function ie(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.join(" "));for(let s of t)n.push(s.map(o=>m(o,r.nullValue)).join(" "));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function ae(e,t,r){if(e.length===0)return"";let n=e.map(o=>o.length);for(let o of t)for(let a=0;a<o.length;a++){let i=m(o[a],r.nullValue).length;i>n[a]&&(n[a]=i)}let s=[];s.push(`\u250C${n.map(o=>"\u2500".repeat(o+2)).join("\u252C")}\u2510`),s.push(`\u2502 ${e.map((o,a)=>o.padEnd(n[a])).join(" \u2502 ")} \u2502`),s.push(`\u251C${n.map(o=>"\u2500".repeat(o+2)).join("\u253C")}\u2524`);for(let o of t)s.push(`\u2502 ${o.map((a,i)=>m(a,r.nullValue).padEnd(n[i])).join(" \u2502 ")} \u2502`);return s.push(`\u2514${n.map(o=>"\u2500".repeat(o+2)).join("\u2534")}\u2518`),`${s.join(`
16
+ `)}
17
+ `}function le(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.map(P).join(","));for(let s of t)n.push(s.map(P).join(","));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function P(e){if(e==null)return"NULL";if(e instanceof Uint8Array||Buffer.isBuffer(e))return`X'${Buffer.from(e).toString("hex").toUpperCase()}'`;if(typeof e=="number"){if(Number.isInteger(e))return String(e);if(Number.isFinite(e))return F(e)}return`'${String(e).replace(/'/g,"''")}'`}function fe(e,t,r){let n=[];r.header&&e.length>0&&(n.push(`<TR>${e.map(s=>`<TH>${D(s)}</TH>`).join("")}`),n.push("</TR>"));for(let s of t)n.push(`<TR>${s.map(o=>`<TD>${D(m(o,r.nullValue))}</TD>`).join("")}`),n.push("</TR>");return n.length>0?`${n.join(`
18
+ `)}
19
+ `:""}function D(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ue(e,t,r){let o=[];r.header&&e.length>0&&o.push(e.join(""));for(let a of t)o.push(a.map(i=>m(i,r.nullValue)).join(""));return o.length>0?o.join("")+"":""}var ge=1024,be=128,we=16,U="Worker termination was not acknowledged";function M(e,t){if(!Number.isSafeInteger(e)||e<0||e>t)throw new Error(`database exceeds ${t} byte limit`)}var O=new WeakMap;async function z(e,t,r){let n=O.get(e);n||(n=new Map,O.set(e,n));let s=n.get(t);if(s||(s={held:!1,waiters:[]},n.set(t,s)),s.poisonedError)throw new Error(s.poisonedError);if(s.held){if(s.waiters.length>=ge)throw new Error("too many concurrent database operations");await new Promise((a,i)=>{let c={signal:r,grant(){r&&c.abort&&r.removeEventListener("abort",c.abort),a()},reject:i};if(r&&(c.abort=()=>{let u=s?.waiters.indexOf(c)??-1;u!==-1&&s?.waiters.splice(u,1),i(new Error("database lock wait aborted"))},r.addEventListener("abort",c.abort,{once:!0}),r.aborted)){c.abort();return}s?.waiters.push(c)})}else s.held=!0;let o=!1;return()=>{if(o||(o=!0,s?.poisonedError))return;let a=s?.waiters.shift();a?a.grant():(s&&(s.held=!1),n?.delete(t))}}async function ye(e,t,r){let n=[];try{for(let s of[...new Set(t)].sort())n.push(await z(e,s,r))}catch(s){for(let o of n.reverse())o();throw s}return()=>{for(let s of n.reverse())s()}}function ke(e,t,r){let n=O.get(e)?.get(t);if(!(!n||n.poisonedError)){n.poisonedError=r;for(let s of n.waiters.splice(0))s.signal&&s.abort&&s.signal.removeEventListener("abort",s.abort),s.reject(new Error(r))}}var Ee={name:"sqlite3",summary:"SQLite database CLI",usage:"sqlite3 [OPTIONS] DATABASE [SQL]",options:["-list output in list mode (default)","-csv output in CSV mode","-json output in JSON mode","-line output in line mode","-column output in column mode","-table output as ASCII table","-markdown output as markdown table","-tabs output in tab-separated mode","-box output in Unicode box mode","-quote output in SQL quote mode","-html output as HTML table","-ascii output in ASCII mode (control chars)","-header show column headers","-noheader hide column headers","-separator SEP field separator for list mode (default: |)","-newline SEP row separator (default: \\n)","-nullvalue TEXT text for NULL values (default: empty)","-readonly open database read-only (no writeback)","-bail stop on first error","-echo print SQL before execution","-cmd COMMAND run SQL command before main SQL","-version show SQLite version","-- end of options","--help show this help"],examples:['sqlite3 :memory: "CREATE TABLE t(x); INSERT INTO t VALUES(1); SELECT * FROM t"','sqlite3 -json data.db "SELECT * FROM users"','sqlite3 -csv -header data.db "SELECT id, name FROM products"','sqlite3 -box data.db "SELECT * FROM users"']};function Se(e){let t={mode:"list",header:!1,separator:"|",newline:`
20
+ `,nullValue:"",readonly:!1,bail:!1,echo:!1,cmd:null},r=null,n=null,s=!1,o=!1;for(let a=0;a<e.length;a++){let i=e[a];if(o){r===null?r=i:n===null&&(n=i);continue}if(i==="--")o=!0;else if(i==="-version")s=!0;else if(i==="-list")t.mode="list";else if(i==="-csv")t.mode="csv";else if(i==="-json")t.mode="json";else if(i==="-line")t.mode="line";else if(i==="-column")t.mode="column";else if(i==="-table")t.mode="table";else if(i==="-markdown")t.mode="markdown";else if(i==="-tabs")t.mode="tabs";else if(i==="-box")t.mode="box";else if(i==="-quote")t.mode="quote";else if(i==="-html")t.mode="html";else if(i==="-ascii")t.mode="ascii";else if(i==="-header")t.header=!0;else if(i==="-noheader")t.header=!1;else if(i==="-readonly")t.readonly=!0;else if(i==="-bail")t.bail=!0;else if(i==="-echo")t.echo=!0;else if(i==="-separator"){if(a+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -separator
21
+ `,exitCode:1};t.separator=e[++a]}else if(i==="-newline"){if(a+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -newline
22
+ `,exitCode:1};t.newline=e[++a]}else if(i==="-nullvalue"){if(a+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -nullvalue
23
+ `,exitCode:1};t.nullValue=e[++a]}else if(i==="-cmd"){if(a+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -cmd
24
+ `,exitCode:1};t.cmd=e[++a]}else{if(i.startsWith("-"))return{stdout:"",stderr:`sqlite3: Error: unknown option: ${i.startsWith("--")?i.slice(1):i}
25
+ Use -help for a list of options.
26
+ `,exitCode:1};r===null?r=i:n===null&&(n=i)}}return{options:t,database:r,sql:n,showVersion:s}}async function Le(){let e=await C.runTrustedAsync(()=>pe()),t=new e.Database;try{let r=t.exec("SELECT sqlite_version()");return r.length>0&&r[0].values.length>0?String(r[0].values[0][0]):"unknown"}finally{t.close()}}function H(e=de(me(import.meta.url))){let t=[T(e,"sqlite3-worker.js"),T(e,"../../commands/sqlite3/worker.js")];(e.endsWith(`${Q}commands${Q}sqlite3`)||e.endsWith("/commands/sqlite3"))&&t.push(T(e,"worker.js")),t.push(T(e,"../../../dist/commands/sqlite3/worker.js"));for(let r of t)if(ce(r))return r;throw new Error("sqlite3 worker not found. Run 'pnpm build' to compile the worker.")}var $e={createWorker(e,t){return new he(e,{workerData:t,resourceLimits:{maxOldGenerationSizeMb:be,maxYoungGenerationSizeMb:we}})},findWorkerPath:H,acquireDatabaseLock:z};function qe(e,t){if(!e||typeof e!="object")return{success:!1,error:"Malformed worker response"};let r=e;return typeof r.protocolToken!="string"||r.protocolToken!==t?{success:!1,error:"Malformed worker response: invalid protocol token"}:r.type==="security-violation"?{success:!1,error:`Security violation: ${typeof r.violation?.type=="string"?r.violation.type:"unknown"}`}:typeof r.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:r.success?Array.isArray(r.results)?typeof r.hasModifications!="boolean"?{success:!1,error:"Malformed worker response: missing hasModifications flag"}:r.dbBuffer!==null&&r.dbBuffer!==void 0&&!(r.dbBuffer instanceof Uint8Array)?{success:!1,error:"Malformed worker response: invalid dbBuffer"}:{success:!0,results:r.results,hasModifications:r.hasModifications,dbBuffer:r.dbBuffer===void 0?null:r.dbBuffer,defenseStats:r.defenseStats}:{success:!1,error:"Malformed worker response: missing results array"}:{success:!1,error:typeof r.error=="string"&&r.error.length>0?r.error:"Worker execution failed"}}async function je(e,t,r){try{let n=H();return await new Promise(s=>{let o,a=!1,i=!1,c=()=>{!i||!o||(i=!1,o.removeListener?.("message",d),o.removeListener?.("error",p),o.removeListener?.("exit",L))},u=async(l,f)=>{if(a)return;a=!0,c();let g=f?await t.terminate(o):!1;t.close(),s(g?l:{success:!1,error:U})},w=$(r,"sqlite3","worker cancellation callback",l=>{u({success:!1,error:l==="abort"?t.abortMessage():t.timeoutMessage("Query")},!0)});if(t.arm(l=>{try{w(l)}catch(f){u({success:!1,error:b(x(f))},!0)}}),t.isCanceled)return;try{o=C.runTrusted(()=>$e.createWorker(n,e))}catch(l){throw t.close(),l}let y=$(r,"sqlite3","worker message callback",l=>{try{let f=l&&typeof l=="object"?{protocolToken:l.protocolToken,type:l.type,violation:l.violation,success:l.success,error:l.error,results:l.results,hasModifications:l.hasModifications,defenseStats:l.defenseStats}:l;t.assertMessageSize(f,"response"),u(qe(l,e.protocolToken),!0)}catch(f){u({success:!1,error:b(x(f))},!0)}}),S=$(r,"sqlite3","worker error callback",l=>{u({success:!1,error:b(x(l))},!0)}),q=$(r,"sqlite3","worker exit callback",l=>{l!==0&&u({success:!1,error:`Worker exited with code ${l}`},!1)}),d=l=>{try{y(l)}catch(f){let g=f instanceof Error?f.message:String(f);u({success:!1,error:b(g)},!0)}},p=l=>{try{S(l)}catch(f){let g=f instanceof Error?f.message:String(f);u({success:!1,error:b(g)},!0)}},L=l=>{try{q(l)}catch(f){let g=f instanceof Error?f.message:String(f);u({success:!1,error:b(g)},!0)}};o.on("message",d),o.on("error",p),o.on("exit",L),i=!0})}catch(n){let s=b(n.message);throw new Error(`sqlite3 worker failed to load: ${s}`)}}var _e={name:"sqlite3",async execute(e,t){if(R(e)||e.includes("-help"))return N(Ee);let r=Se(e);if("exitCode"in r)return r;let{options:n,database:s,sql:o,showVersion:a}=r;if(a)return{stdout:`${await Le()}
27
+ `,stderr:"",exitCode:0};if(!s)return{stdout:"",stderr:`sqlite3: missing database argument
28
+ `,exitCode:1};let i=o||I(t.stdin).trim();if(n.cmd&&(i=n.cmd+(i?`; ${i}`:"")),!i)return{stdout:"",stderr:`sqlite3: no SQL provided
29
+ `,exitCode:1};let c=s===":memory:",u="",w=[],y=null,S,q;try{if(!c){u=t.fs.resolvePath(t.cwd,s);let d=await V(t.fs,u);if(d.existence==="unknown")throw new Error("database identity cannot be determined safely");if(d.canonicalPath!==void 0&&(u=d.canonicalPath),w=[],d.canonicalPath!==void 0&&w.push(`path:${d.canonicalPath}`),d.existence==="existing"){if(d.stableIdentity===void 0)throw new Error("database identity cannot be determined safely");w.push(`identity:${d.stableIdentity}`)}if(w.length===0)throw new Error("database identity cannot be determined safely");if(S=await ye(t.fsIdentity??t.fs,w,t.signal),await t.fs.exists(u)){let p=await t.fs.stat(u);M(p.size,t.limits.maxDatabaseBytes),y=await t.fs.readFileBuffer(u),M(y.byteLength,t.limits.maxDatabaseBytes),q=t.executionScope?.reserveBytes("sqlite-database",y.byteLength,"sqlite3 database")}}}catch(d){S?.();let p=B(d.message);return{stdout:"",stderr:`sqlite3: unable to open database "${s}": ${p}
30
+ `,exitCode:1}}try{let d=t.limits.maxSqliteTimeoutMs,p=new W({commandName:"sqlite3",timeoutMs:d,signal:t.signal,maxMessageBytes:t.limits.maxWorkerMessageBytes}),L={protocolToken:p.protocolToken,dbBuffer:y,sql:i,options:{bail:n.bail,echo:n.echo},limits:{maxResultRows:t.limits.maxArrayElements,maxResultBytes:t.limits.maxDatabaseResultBytes,maxDatabaseBytes:t.limits.maxDatabaseBytes}};p.assertMessageSize({...L,dbBuffer:void 0},"request");let l,f;try{y&&(M(y.byteLength,t.limits.maxDatabaseBytes),f=t.executionScope?.reserveBytes("sqlite-worker-clone",y.byteLength,"sqlite3 worker clone")),l=await je(L,p,t.requireDefenseContext)}catch(h){return{stdout:"",stderr:`sqlite3: worker error: ${b(h.message)}
31
+ `,exitCode:1}}finally{f?.release()}if(!l.success){if(w.length>0&&l.error===U)for(let k of w)ke(t.fsIdentity??t.fs,k,l.error);return{stdout:"",stderr:`sqlite3: ${b(l.error)}
32
+ `,exitCode:1}}let g=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),G={mode:n.mode,header:n.header,separator:n.separator,newline:n.newline,nullValue:n.nullValue,maxOutputSize:g},E="";n.echo&&(E+=`${i}
33
+ `);let j="",A=!1;for(let h of l.results)if(h.type==="error"){if(j+=`Error: ${h.error??"SQL error"}
34
+ `,A=!0,n.bail)break}else if(h.columns&&h.rows&&(h.rows.length>0||n.header))try{let k=Math.max(0,g-Buffer.byteLength(E,"utf8"));E+=_(h.columns,h.rows,{...G,maxOutputSize:k})}catch(k){let J=B(k.message);return{stdout:E,stderr:`${j}sqlite3: ${J}
35
+ `,exitCode:1}}if(l.hasModifications&&!n.readonly&&!c&&u&&l.dbBuffer)try{M(l.dbBuffer.byteLength,t.limits.maxDatabaseBytes),await t.fs.writeFile(u,l.dbBuffer)}catch(h){let k=B(h.message);return{stdout:E,stderr:`${j}sqlite3: failed to write database: ${k}
36
+ `,exitCode:1}}return{stdout:E,stderr:j,exitCode:A?1:0}}finally{q?.release(),S?.()}}},Fe={name:"sqlite3",flags:[],needsArgs:!0};export{$e as a,_e as b,Fe as c};
@@ -0,0 +1,12 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a as k,b as E,c as _,d as Te,e as S,g as C,h as ce}from"./chunk-UUIYAOD4.js";import{a as ue,c as Me}from"./chunk-DLL7UR66.js";import{a as Ie}from"./chunk-BKUWXPEM.js";import{a as j}from"./chunk-73JQKNZT.js";import{d as G}from"./chunk-FTET43KM.js";import{l as g}from"./chunk-TVCZIH6M.js";import{a as x}from"./chunk-GN6CQ3J4.js";function I(e){return e!==!1&&e!==null}function J(e,n){return JSON.stringify(e)===JSON.stringify(n)}function Y(e,n){return typeof e=="number"&&typeof n=="number"?e-n:typeof e=="string"&&typeof n=="string"?e.localeCompare(n):0}function xe(e,n,t={}){let r=t.maxDepth??2e3,s=C(e),o=[{target:s,source:n,depth:0}];for(;o.length>0;){let p=o.pop();if(!p)break;if(p.depth>r)throw new g(`query depth limit exceeded (${r})`,"recursion");for(let u of Object.keys(p.source)){if(t.visit?.(),!k(u))continue;let f=_(p.target,u)?S(p.target[u]):null,i=S(p.source[u]);if(f&&i){let c=C(f);E(p.target,u,c),o.push({target:c,source:i,depth:p.depth+1})}else E(p.target,u,p.source[u])}}return s}function B(e,n=3e3){if(e===null||typeof e!="object")return 0;if(n<=1)return n;let t=(i,c)=>({value:i,keys:Array.isArray(i)?void 0:Object.keys(i),nextChild:0,pathDepth:c,maxChildDepth:0}),r=i=>i.keys!==void 0?i.keys.length:i.value.length,s=i=>{if(i.keys){let c=i.keys[i.nextChild++];return i.value[c]}return i.value[i.nextChild++]},o=new WeakMap,p=new WeakMap,u=e,f=[t(u,1)];for(o.set(u,"visiting");f.length>0;){let i=f[f.length-1];if(i.nextChild<r(i)){let a=s(i);if(a===null||typeof a!="object")continue;let l=o.get(a);if(l==="visiting")return n;if(l==="done"){let b=p.get(a)??0;if(i.pathDepth+b>=n)return n;i.maxChildDepth=Math.max(i.maxChildDepth,b);continue}let y=i.pathDepth+1;if(y>=n)return n;let m=a;o.set(a,"visiting"),f.push(t(m,y));continue}let c=i.maxChildDepth+1;p.set(i.value,c),o.set(i.value,"done"),f.pop();let h=f.at(-1);if(h)h.maxChildDepth=Math.max(h.maxChildDepth,c);else return c}return 0}function Z(e,n){let t=u=>u===null?0:typeof u=="boolean"?1:typeof u=="number"?2:typeof u=="string"?3:Array.isArray(u)?4:typeof u=="object"?5:6,r=t(e),s=t(n);if(r!==s)return r-s;if(typeof e=="number"&&typeof n=="number")return e-n;if(typeof e=="string"&&typeof n=="string")return e.localeCompare(n);if(typeof e=="boolean"&&typeof n=="boolean")return(e?1:0)-(n?1:0);if(Array.isArray(e)&&Array.isArray(n)){for(let u=0;u<Math.min(e.length,n.length);u++){let f=Z(e[u],n[u]);if(f!==0)return f}return e.length-n.length}let o=S(e),p=S(n);if(o&&p){let u=Object.keys(o).sort(),f=Object.keys(p).sort();for(let i=0;i<Math.min(u.length,f.length);i++){let c=u[i].localeCompare(f[i]);if(c!==0)return c}if(u.length!==f.length)return u.length-f.length;for(let i of u){let c=Z(o[i],p[i]);if(c!==0)return c}}return 0}function v(e,n){if(J(e,n))return!0;if(typeof e=="string"&&typeof n=="string")return e.includes(n);if(Array.isArray(e)&&Array.isArray(n))return n.every(s=>e.some(o=>v(o,s)));let t=S(e),r=S(n);return t&&r?Object.keys(r).every(s=>_(t,s)&&v(t[s],r[s])):!1}function z(e,n,t=1){let r=e.limits.maxArrayElements;if(t<0||n>r-t)throw new g(`query result element limit exceeded (${r})`,"array_elements")}function pe(e,n,t,r,s,o,p,u,f,i){switch(n){case"sort":return Array.isArray(e)?[[...e].sort(p)]:[null];case"sort_by":return!Array.isArray(e)||t.length===0?[null]:[[...e].sort((h,a)=>{let l=s(h,t[0],r)[0],y=s(a,t[0],r)[0];return p(l,y)})];case"bsearch":{if(!Array.isArray(e)){let h=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${h} (${JSON.stringify(e)}) cannot be searched from`)}return t.length===0?[null]:s(e,t[0],r).map(h=>{let a=0,l=e.length;for(;a<l;){let y=a+l>>>1;p(e[y],h)<0?a=y+1:l=y}return a<e.length&&p(e[a],h)===0?a:-a-1})}case"unique_by":{if(!Array.isArray(e)||t.length===0)return[null];let c=new Map;for(let a of e){let l=s(a,t[0],r)[0],y=JSON.stringify(l);c.has(y)||c.set(y,{item:a,key:l})}let h=[...c.values()];return h.sort((a,l)=>p(a.key,l.key)),[h.map(a=>a.item)]}case"group_by":{if(!Array.isArray(e)||t.length===0)return[null];let c=new Map;for(let h of e){let a=JSON.stringify(s(h,t[0],r)[0]);c.has(a)||c.set(a,[]),c.get(a)?.push(h)}return[[...c.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((c,h)=>p(c,h)>0?c:h)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||t.length===0?[null]:[e.reduce((c,h)=>{let a=s(c,t[0],r)[0],l=s(h,t[0],r)[0];return p(a,l)>0?c:h})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((c,h)=>p(c,h)<0?c:h)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||t.length===0?[null]:[e.reduce((c,h)=>{let a=s(c,t[0],r)[0],l=s(h,t[0],r)[0];return p(a,l)<0?c:h})];case"add":{let c=h=>{let a=h.filter(l=>l!==null);return a.length===0?null:a.every(l=>typeof l=="number")?a.reduce((l,y)=>l+y,0):a.every(l=>typeof l=="string")?a.join(""):a.every(l=>Array.isArray(l))?a.flat():a.every(l=>l&&typeof l=="object"&&!Array.isArray(l))?Me(...a):null};if(t.length>=1){let h=s(e,t[0],r);return[c(h)]}return Array.isArray(e)?[c(e)]:[null]}case"any":{if(t.length>=2){try{let c=o(e,t[0],r);for(let h of c)if(s(h,t[1],r).some(u))return[!0]}catch(c){if(c instanceof i)throw c}return[!1]}return t.length===1?Array.isArray(e)?[e.some(c=>u(s(c,t[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(u)]:[!1]}case"all":{if(t.length>=2){try{let c=o(e,t[0],r);for(let h of c)if(!s(h,t[1],r).some(u))return[!1]}catch(c){if(c instanceof i)throw c}return[!0]}return t.length===1?Array.isArray(e)?[e.every(c=>u(s(c,t[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(u)]:[!0]}case"select":return t.length===0?[e]:s(e,t[0],r).some(u)?[e]:[];case"map":{if(t.length===0||!Array.isArray(e))return[null];z(r,0,e.length);let c=[];for(let h of e){let a=s(h,t[0],r);z(r,c.length,a.length);for(let l of a)c.push(l)}return[c]}case"map_values":{if(t.length===0)return[null];if(Array.isArray(e)){z(r,0,e.length);let c=[];for(let h of e){let a=s(h,t[0],r);z(r,c.length,a.length);for(let l of a)c.push(l)}return[c]}if(e&&typeof e=="object"){let c=Object.create(null),h=Object.keys(e);z(r,0,h.length);for(let a of h){if(!k(a))continue;let l=e[a],y=s(l,t[0],r);y.length>0&&E(c,a,y[0])}return[c]}return[null]}case"has":{if(t.length===0)return[!1];let h=s(e,t[0],r)[0];return Array.isArray(e)&&typeof h=="number"?[h>=0&&h<e.length]:e&&typeof e=="object"&&typeof h=="string"?[Object.hasOwn(e,h)]:[!1]}case"in":{if(t.length===0)return[!1];let h=s(e,t[0],r)[0];return Array.isArray(h)&&typeof e=="number"?[e>=0&&e<h.length]:h&&typeof h=="object"&&typeof e=="string"?[Object.hasOwn(h,e)]:[!1]}case"contains":{if(t.length===0)return[!1];let c=s(e,t[0],r);return[f(e,c[0])]}case"inside":{if(t.length===0)return[!1];let c=s(e,t[0],r);return[f(c[0],e)]}default:return null}}function he(e,n,t,r,s,o,p,u){switch(n){case"first":if(t.length>0)try{let f=o(e,t[0],r);return f.length>0?[f[0]]:[]}catch(f){if(f instanceof u)throw f;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(t.length>0){let f=s(e,t[0],r);return f.length>0?[f[f.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(t.length<1)return[null];let f=s(e,t[0],r);if(t.length>1){for(let c of f)if(c<0)throw new Error("nth doesn't support negative indices");let i;try{i=o(e,t[1],r)}catch(c){if(c instanceof u)throw c;i=[]}return f.flatMap(c=>{let h=c;return h<i.length?[i[h]]:[]})}return Array.isArray(e)?f.flatMap(i=>{let c=i;if(c<0)throw new Error("nth doesn't support negative indices");return c<e.length?[e[c]]:[null]}):[null]}case"range":{if(t.length===0)return[];let f=r.limits.maxArrayElements,i=(y,m)=>{if(y.length>=f)throw new u(`query result element limit exceeded (${f})`,"array_elements");y.push(m)},c=s(e,t[0],r);if(t.length===1){let y=[];for(let m of c){let b=m;for(let A=0;A<b;A++)i(y,A)}return y}let h=s(e,t[1],r);if(t.length===2){let y=[];for(let m of c)for(let b of h){let A=m,w=b;for(let N=A;N<w;N++)i(y,N)}return y}let a=s(e,t[2],r),l=[];for(let y of c)for(let m of h)for(let b of a){let A=y,w=m,N=b;if(N!==0)if(N>0)for(let O=A;O<w;O+=N)i(l,O);else for(let O=A;O>w;O+=N)i(l,O)}return l}case"limit":return t.length<2?[]:s(e,t[0],r).flatMap(i=>{let c=i;if(c<0)throw new Error("limit doesn't support negative count");if(c===0)return[];let h;try{h=o(e,t[1],r)}catch(a){if(a instanceof u)throw a;h=[]}return h.slice(0,c)});case"isempty":{if(t.length<1)return[!0];try{return[o(e,t[0],r).length===0]}catch(f){if(f instanceof u)throw f;return[!0]}}case"isvalid":{if(t.length<1)return[!0];try{return[s(e,t[0],r).length>0]}catch(f){if(f instanceof u)throw f;return[!1]}}case"skip":return t.length<2?[]:s(e,t[0],r).flatMap(i=>{let c=i;if(c<0)throw new Error("skip doesn't support negative count");return s(e,t[1],r).slice(c)});case"until":{if(t.length<2)return[e];let f=e,i=r.limits.maxIterations;for(let c=0;c<i;c++){if(s(f,t[0],r).some(p))return[f];let a=s(f,t[1],r);if(a.length===0)return[f];f=a[0]}throw new u(`jq until: too many iterations (${i}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(t.length<2)return[e];let f=[],i=e,c=r.limits.maxIterations;for(let h=0;h<c&&s(i,t[0],r).some(p);h++){f.push(i);let l=s(i,t[1],r);if(l.length===0)break;i=l[0]}if(f.length>=c)throw new u(`jq while: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations");return f}case"repeat":{if(t.length===0)return[e];let f=[],i=e,c=r.limits.maxIterations;for(let h=0;h<c;h++){f.push(i);let a=s(i,t[0],r);if(a.length===0)break;i=a[0]}if(f.length>=c)throw new u(`jq repeat: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations");return f}default:return null}}var je="%Y-%m-%dT%H:%M:%SZ";function ae(e,n){if(!Number.isFinite(e)||Math.abs(e)>864e10)throw new Error(`${n} timestamp is outside the supported range`);return new Date(e*1e3)}function Pe(e){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(!n)return null;let[,t,r,s,o,p,u]=n.map(Number),f=Date.UTC(t,r-1,s,o,p,u);if(!Number.isFinite(f))return null;let i=new Date(f);return i.getUTCFullYear()!==t||i.getUTCMonth()!==r-1||i.getUTCDate()!==s||i.getUTCHours()!==o||i.getUTCMinutes()!==p||i.getUTCSeconds()!==u?null:i}function le(e,n,t,r,s){switch(n){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let o=ae(e,"gmtime"),p=o.getUTCFullYear(),u=o.getUTCMonth(),f=o.getUTCDate(),i=o.getUTCHours(),c=o.getUTCMinutes(),h=o.getUTCSeconds(),a=o.getUTCDay(),l=Date.UTC(p,0,1),y=Math.floor((o.getTime()-l)/(1440*60*1e3));return[[p,u,f,i,c,h,a,y]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[o,p,u,f=0,i=0,c=0]=e;if(typeof o!="number"||typeof p!="number")throw new Error("mktime requires parsed datetime inputs");let h=Date.UTC(o,p,u??1,f??0,i??0,c??0);return[Math.floor(h/1e3)]}case"strftime":{if(t.length===0)return[null];let p=s(e,t[0],r)[0];if(typeof p!="string")throw new Error("strftime/1 requires a string format");let u;if(typeof e=="number")u=ae(e,"strftime");else if(Array.isArray(e)){let[a,l,y,m=0,b=0,A=0]=e;if(typeof a!="number"||typeof l!="number")throw new Error("strftime/1 requires parsed datetime inputs");u=new Date(Date.UTC(a,l,y??1,m??0,b??0,A??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=["January","February","March","April","May","June","July","August","September","October","November","December"],c=(a,l=2)=>String(a).padStart(l,"0");return[p.replace(/%Y/g,String(u.getUTCFullYear())).replace(/%m/g,c(u.getUTCMonth()+1)).replace(/%d/g,c(u.getUTCDate())).replace(/%H/g,c(u.getUTCHours())).replace(/%M/g,c(u.getUTCMinutes())).replace(/%S/g,c(u.getUTCSeconds())).replace(/%A/g,f[u.getUTCDay()]).replace(/%B/g,i[u.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(t.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let p=s(e,t[0],r)[0];if(typeof p!="string")throw new Error("strptime/1 requires a string format");if(p!==je)throw new Error(`strptime format is not supported: ${p}`);let u=Pe(e);if(u){let f=u.getUTCFullYear(),i=u.getUTCMonth(),c=u.getUTCDate(),h=u.getUTCHours(),a=u.getUTCMinutes(),l=u.getUTCSeconds(),y=u.getUTCDay(),m=Date.UTC(f,0,1),b=Math.floor((u.getTime()-m)/(1440*60*1e3));return[[f,i,c,h,a,l,y,b]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let o=Pe(e);if(!o)throw new Error(`date "${e}" does not match format "${je}"`);return[Math.floor(o.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[ae(e,"todate").toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var ze=2e3;function We(e){let n=[];for(let r=0;r<e.length;r+=32768){let s=Math.min(r+32768,e.length),o="";for(let p=r;p<s;p++)o+=String.fromCharCode(e[p]);n.push(o)}return n.join("")}function Xe(e){let n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}function ye(e,n,t){switch(n){case"@base64":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"utf-8").toString("base64")];let r=new TextEncoder().encode(e);return[btoa(We(r))]}return[null];case"@base64d":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"base64").toString("utf-8")];let r=Xe(atob(e));return[new TextDecoder("utf-8",{fatal:!1}).decode(r)]}return[null];case"@uri":return typeof e=="string"?[encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof e=="string"?[decodeURIComponent(e)]:[null];case"@csv":return Array.isArray(e)?[e.map(s=>{if(s===null)return"";if(typeof s=="boolean")return s?"true":"false";if(typeof s=="number")return String(s);let o=String(s);return o.includes(",")||o.includes('"')||o.includes(`
3
+ `)||o.includes("\r")?`"${o.replace(/"/g,'""')}"`:o}).join(",")]:[null];case"@tsv":return Array.isArray(e)?[e.map(r=>String(r??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let r=t??ze;return B(e,r+1)>r?[null]:[JSON.stringify(e)]}case"@html":return typeof e=="string"?[e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")]:[null];case"@sh":return typeof e=="string"?[`'${e.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof e=="string"?[e]:e==null?[""]:[String(e)];default:return null}}function me(e,n,t,r,s,o){switch(n){case"index":return t.length===0?[null]:s(e,t[0],r).map(u=>{if(typeof e=="string"&&typeof u=="string"){if(u===""&&e==="")return null;let f=e.indexOf(u);return f>=0?f:null}if(Array.isArray(e)){if(Array.isArray(u)){for(let i=0;i<=e.length-u.length;i++){let c=!0;for(let h=0;h<u.length;h++)if(!o(e[i+h],u[h])){c=!1;break}if(c)return i}return null}let f=e.findIndex(i=>o(i,u));return f>=0?f:null}return null});case"rindex":return t.length===0?[null]:s(e,t[0],r).map(u=>{if(typeof e=="string"&&typeof u=="string"){let f=e.lastIndexOf(u);return f>=0?f:null}if(Array.isArray(e)){if(Array.isArray(u)){for(let f=e.length-u.length;f>=0;f--){let i=!0;for(let c=0;c<u.length;c++)if(!o(e[f+c],u[c])){i=!1;break}if(i)return f}return null}for(let f=e.length-1;f>=0;f--)if(o(e[f],u))return f;return null}return null});case"indices":return t.length===0?[[]]:s(e,t[0],r).map(u=>{let f=[];if(typeof e=="string"&&typeof u=="string"){let i=e.indexOf(u);for(;i!==-1;)f.push(i),i=e.indexOf(u,i+1)}else if(Array.isArray(e))if(Array.isArray(u)){let i=u.length;if(i===0)for(let c=0;c<=e.length;c++)f.push(c);else for(let c=0;c<=e.length-i;c++){let h=!0;for(let a=0;a<i;a++)if(!o(e[c+a],u[a])){h=!1;break}h&&f.push(c)}}else for(let i=0;i<e.length;i++)o(e[i],u)&&f.push(i);return f});default:return null}}function de(e,n,t,r,s){switch(n){case"fabs":case"abs":return typeof e=="number"?[Math.abs(e)]:typeof e=="string"?[e]:[null];case"exp10":return typeof e=="number"?[10**e]:[null];case"exp2":return typeof e=="number"?[2**e]:[null];case"pow":{if(t.length<2)return[null];let o=s(e,t[0],r),p=s(e,t[1],r),u=o[0],f=p[0];return typeof u!="number"||typeof f!="number"?[null]:[u**f]}case"atan2":{if(t.length<2)return[null];let o=s(e,t[0],r),p=s(e,t[1],r),u=o[0],f=p[0];return typeof u!="number"||typeof f!="number"?[null]:[Math.atan2(u,f)]}case"hypot":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.hypot(e,o)]}case"fma":{if(typeof e!="number"||t.length<2)return[null];let o=s(e,t[0],r)[0],p=s(e,t[1],r)[0];return[e*o+p]}case"copysign":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.sign(o)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e-Math.round(e/o)*o]}case"fdim":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.max(0,e-o)]}case"fmax":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.max(e,o)]}case"fmin":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.min(e,o)]}case"ldexp":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e*2**o]}case"scalbn":case"scalbln":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e*2**o]}case"nearbyint":return typeof e=="number"?[Math.round(e)]:[null];case"logb":return typeof e=="number"?[Math.floor(Math.log2(Math.abs(e)))]:[null];case"significand":if(typeof e=="number"){let o=Math.floor(Math.log2(Math.abs(e)));return[e/2**o]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let o=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**o,o]]}return[null];case"modf":if(typeof e=="number"){let o=Math.trunc(e);return[[e-o,o]]}return[null];default:return null}}function V(e){let n=e.limits.maxIterations;return{maxDepth:e.limits.maxDepth,maxResults:e.limits.maxArrayElements,maxIterations:n}}function H(e){throw new g(e,"array_elements")}function ge(e,n){let t=1;for(let r of e){if(!Number.isSafeInteger(r)||r<0)throw new Error("combinations requires finite array lengths");r!==0&&t>Math.floor(n/r)&&H(`query combination limit exceeded (${n})`),t*=r}return t}function be(e,n,t,r,s,o,p,u){switch(n){case"recurse":{let f=[],i=V(r),c=t.length>=2?t[1]:null,h=[{value:e,depth:0}],a=0;for(;h.length>0;){let l=h.pop();if(!l)break;if(++a>i.maxIterations)throw new g(`query iteration limit exceeded (${i.maxIterations})`,"iterations");if(l.depth>i.maxDepth)throw new g(`query depth limit exceeded (${i.maxDepth})`,"recursion");if(c&&!s(l.value,c,r).some(o))continue;f.length>=i.maxResults&&H(`query result element limit exceeded (${i.maxResults})`),f.push(l.value);let y=[];t.length===0?Array.isArray(l.value)?y=l.value:l.value&&typeof l.value=="object"&&(y=Object.keys(l.value).map(m=>l.value[m])):y=s(l.value,t[0],r).filter(m=>m!=null),h.length>i.maxResults-y.length&&H(`query traversal queue limit exceeded (${i.maxResults})`);for(let m=y.length-1;m>=0;m--)h.push({value:y[m],depth:l.depth+1})}return f}case"recurse_down":return u(e,"recurse",t,r);case"walk":{if(t.length===0)return[e];let f=V(r),i=new WeakSet,c=new WeakMap,h=[{value:e,depth:0,expanded:!1}],a=e,l=0;for(;h.length>0;){let y=h.pop();if(!y)break;if(++l>f.maxIterations)throw new g(`query iteration limit exceeded (${f.maxIterations})`,"iterations");if(y.depth>f.maxDepth)throw new g(`query depth limit exceeded (${f.maxDepth})`,"recursion");let m=y.value!==null&&typeof y.value=="object"?y.value:null;if(!y.expanded&&m){if(i.has(m))continue;i.add(m),h.push({...y,expanded:!0});let w=S(y.value),N=Array.isArray(y.value)?y.value:Object.keys(w??{}).map(O=>w?.[O]);h.length>f.maxResults-N.length&&H(`query traversal queue limit exceeded (${f.maxResults})`);for(let O=N.length-1;O>=0;O--)h.push({value:N[O],depth:y.depth+1,expanded:!1});continue}let b=y.value;if(Array.isArray(y.value))b=y.value.map(w=>w!==null&&typeof w=="object"?c.get(w)??w:w);else if(m){let w=Object.create(null),N=S(y.value);for(let O of Object.keys(N??{})){if(!k(O))continue;let $=N?.[O];E(w,O,$!==null&&typeof $=="object"?c.get($)??$:$)}b=w}let A=s(b,t[0],r)[0];m&&c.set(m,A),y.depth===0&&(a=A)}return[a]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let f=V(r),i=0;for(let h of e)Array.isArray(h)&&(i=Math.max(i,h.length));ge([e.length,i],f.maxResults);let c=[];for(let h=0;h<i;h++)c.push(e.map(a=>Array.isArray(a)?a[h]:null));return[c]}case"combinations":{if(t.length>0){let y=s(e,t[0],r)[0];if(!Array.isArray(e))return[];if(!Number.isFinite(y)||!Number.isSafeInteger(y)||y<0)throw new Error("combinations length must be a finite non-negative integer");let m=V(r);if(y>m.maxDepth||y>m.maxResults)throw new g(`query depth limit exceeded (${m.maxDepth})`,"recursion");if(y===0)return m.maxResults<1&&H("query combination limit exceeded (0)"),[[]];let b=ge(Array.from({length:y},()=>e.length),m.maxResults);if(b===0)return[];let A=[],w=new Array(y).fill(0);for(let N=0;N<b;N++){A.push(w.map(O=>e[O]));for(let O=y-1;O>=0&&(w[O]++,!(w[O]<e.length));O--)w[O]=0}return A}if(!Array.isArray(e))return[];if(e.length===0)return V(r).maxResults<1&&H("query combination limit exceeded (0)"),[[]];for(let l of e)if(!Array.isArray(l))return[];let f=V(r),i=e;if(i.length>f.maxDepth)throw new g(`query depth limit exceeded (${f.maxDepth})`,"recursion");let c=ge(i.map(l=>l.length),f.maxResults);if(c===0)return[];let h=[],a=new Array(i.length).fill(0);for(let l=0;l<c;l++){h.push(a.map((y,m)=>i[m][y]));for(let y=i.length-1;y>=0&&(a[y]++,!(a[y]<i[y].length));y--)a[y]=0}return h}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let f=r.currentPath;if(f.length===0)return[];let i=t.length>0?s(e,t[0],r)[0]:1;if(i>=0){if(i>f.length)return[];let c=f.slice(0,f.length-i);return[p(r.root,c)]}else{let c=-i-1;if(c>=f.length)return[e];let h=f.slice(0,c);return[p(r.root,h)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let f=r.currentPath,i=[];for(let c=f.length-1;c>=0;c--)i.push(p(r.root,f.slice(0,c)));return[i]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var Ae=2e3;function T(e){return e.limits.maxArrayElements}function ee(e,n){let t=T(e);if(n>=t)throw new g(`query result element limit exceeded (${t})`,"array_elements")}function Ge(e,n){let t=n.limits.maxDepth??Ae;if(e.length>t)throw new g(`query depth limit exceeded (${t})`,"recursion");let r=n.limits.maxArrayElements;for(let s of e)if(typeof s=="number"){if(!Number.isSafeInteger(s)||s<0||s>=r)throw new g(`query array index limit exceeded (${r})`,"array_elements")}else if(typeof s!="string")throw new Error("stream path components must be strings or integers")}function we(e,n,t,r,s){switch(n){case"keys":return Array.isArray(e)?[e.map((o,p)=>p)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((o,p)=>p)]:e&&typeof e=="object"?[Object.keys(e)]:[null];case"length":return typeof e=="string"?[e.length]:Array.isArray(e)?[e.length]:e&&typeof e=="object"?[Object.keys(e).length]:e===null?[0]:typeof e=="number"?[Math.abs(e)]:[null];case"utf8bytelength":{if(typeof e=="string")return[x(e)];let o=e===null?"null":Array.isArray(e)?"array":typeof e,p=o==="array"||o==="object"?JSON.stringify(e):String(e);throw new Error(`${o} (${p}) only strings have UTF-8 byte length`)}case"to_entries":{let o=S(e);if(o){let p=Object.keys(o);if(p.length>T(r))throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");return[p.map(u=>{let f=Object.create(null);return E(f,"key",u),E(f,"value",o[u]),f})]}return[null]}case"from_entries":if(Array.isArray(e)){let o=Object.create(null);for(let p of e){let u=S(p);if(u){let f=u.key??u.Key??u.name??u.Name??u.k,i=u.value??u.Value??u.v;if(f!==void 0){let c=String(f);k(c)&&E(o,c,i)}}}return[o]}return[null];case"with_entries":{if(t.length===0)return[e];let o=S(e);if(o){let p=Object.keys(o);if(p.length>T(r))throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");let u=[];for(let i of p){let c=Object.create(null);E(c,"key",i),E(c,"value",o[i]);let h=s(c,t[0],r);if(u.length>T(r)-h.length)throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");for(let a of h)u.push(a)}let f=Object.create(null);for(let i of u){let c=S(i);if(c){let h=c.key??c.name??c.k,a=c.value??c.v;if(h!==void 0){let l=String(h);k(l)&&E(f,l,a)}}}return[f]}return[null]}case"reverse":return Array.isArray(e)?[[...e].reverse()]:typeof e=="string"?[e.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(e)?(t.length>0?s(e,t[0],r):[Number.POSITIVE_INFINITY]).map(p=>{let u=p;if(u<0)throw new Error("flatten depth must not be negative");return e.flat(u)}):[null];case"unique":if(Array.isArray(e)){let o=new Set,p=[];for(let u of e){let f=JSON.stringify(u);o.has(f)||(o.add(f),p.push(u))}return[p]}return[null];case"tojson":case"tojsonstream":{let o=r.limits.maxDepth??Ae;return B(e,o+1)>o?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let o=e.trim().toLowerCase();if(o==="nan")return[Number.NaN];if(o==="inf"||o==="infinity")return[Number.POSITIVE_INFINITY];if(o==="-inf"||o==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[Te(JSON.parse(e),{maxDepth:r.limits.maxDepth,maxElements:r.limits.maxArrayElements})]}catch(p){throw p instanceof g?p:new Error(`Invalid JSON: ${e}`)}}return[e]}case"tostring":return typeof e=="string"?[e]:[JSON.stringify(e)];case"tonumber":if(typeof e=="number")return[e];if(typeof e=="string"){let o=Number(e);if(Number.isNaN(o))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[o]}throw new Error(`${typeof e} cannot be parsed as a number`);case"toboolean":{if(typeof e=="boolean")return[e];if(typeof e=="string"){if(e==="true")return[!0];if(e==="false")return[!1];throw new Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let o=e===null?"null":Array.isArray(e)?"array":typeof e,p=o==="array"||o==="object"?JSON.stringify(e):String(e);throw new Error(`${o} (${p}) cannot be parsed as a boolean`)}case"tostream":{let o=[],p=r.limits.maxDepth??Ae,u=[{value:e,path:[]}],f=new WeakSet,i=0;for(;u.length>0;){let c=u.pop();if(!c)break;if(++i>r.limits.maxIterations)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");if(c.path.length>p)throw new g(`query depth limit exceeded (${p})`,"recursion");let h=c.value;if(h===null||typeof h!="object")ee(r,o.length),o.push([c.path,h]);else if(Array.isArray(h)){if(f.has(h))throw new g("cyclic value cannot be converted to a stream","recursion");if(f.add(h),h.length===0)ee(r,o.length),o.push([c.path,[]]);else{if(u.length>T(r)-h.length)throw new g(`query traversal queue limit exceeded (${T(r)})`,"array_elements");for(let a=h.length-1;a>=0;a--)u.push({value:h[a],path:[...c.path,a]})}}else{if(f.has(h))throw new g("cyclic value cannot be converted to a stream","recursion");f.add(h);let a=Object.keys(h);if(a.length===0)ee(r,o.length),o.push([c.path,Object.create(null)]);else{if(u.length>T(r)-a.length)throw new g(`query traversal queue limit exceeded (${T(r)})`,"array_elements");for(let l=a.length-1;l>=0;l--){let y=a[l];u.push({value:h[y],path:[...c.path,y]})}}}}return ee(r,o.length),o.push([[]]),o}case"fromstream":{if(t.length===0)return[e];let o=s(e,t[0],r);if(o.length>T(r))throw new g(`query stream item limit exceeded (${T(r)})`,"array_elements");let p=null,u=0;for(let f of o){if(!Array.isArray(f)||f.length===1&&Array.isArray(f[0])&&f[0].length===0||f.length!==2)continue;let[i,c]=f;if(!Array.isArray(i))continue;if(Ge(i,r),i.length===0){p=c;continue}p===null&&(p=typeof i[0]=="number"?[]:Object.create(null));let h=p;for(let l=0;l<i.length-1;l++){let y=i[l],m=i[l+1];if(Array.isArray(h)&&typeof y=="number"){let b=y+1-h.length;if(b>r.limits.maxIterations-u)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(u+=Math.max(0,b);h.length<=y;)h.push(null);h[y]===null&&(h[y]=typeof m=="number"?[]:Object.create(null)),h=h[y]}else{let b=S(h);if(b){let A=String(y);if(!k(A))continue;(b[A]===null||b[A]===void 0)&&E(b,A,typeof m=="number"?[]:Object.create(null)),h=b[A]}}}let a=i[i.length-1];if(Array.isArray(h)&&typeof a=="number"){let l=a+1-h.length;if(l>r.limits.maxIterations-u)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(u+=Math.max(0,l);h.length<=a;)h.push(null);h[a]=c}else{let l=S(h);if(l){let y=String(a);k(y)&&E(l,y,c)}}}return[p]}case"truncate_stream":{let o=typeof e=="number"?Math.floor(e):0;if(t.length===0)return[];let p=[],u=s(e,t[0],r);for(let f of u)if(Array.isArray(f)){if(f.length===1&&Array.isArray(f[0])){let i=f[0];i.length>o&&p.push([i.slice(o)]);continue}if(f.length===2&&Array.isArray(f[0])){let i=f[0],c=f[1];i.length>o&&p.push([i.slice(o),c])}}return p}default:return null}}function $e(e,n){if(!Array.isArray(e))throw new Error("path must be an array");let t=n.limits.maxDepth;if(e.length>t)throw new g(`query depth limit exceeded (${t})`,"recursion");let r=n.limits.maxArrayElements,s=0;for(let o of e)if(typeof o=="number"){if(!Number.isSafeInteger(o)||o<0||o>=r)throw new g(`query array index limit exceeded (${r})`,"array_elements");let p=o+1;if(s>r-p)throw new g(`query cumulative array allocation limit exceeded (${r})`,"array_elements");s+=p}else if(typeof o!="string")throw new Error("path components must be strings or integers");return R(n,s+e.length),e}function Le(e,n,t){let r=[],s=[{value:e,path:[],isRoot:!0}];for(;s.length>0;){let o=s.pop();if(!o)break;if(R(n),o.path.length>n.limits.maxDepth)throw new g(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");if(!(o.value!==null&&typeof o.value=="object")){(t||!o.isRoot)&&(D(n,r.length),r.push(o.path));continue}!t&&!o.isRoot&&(D(n,r.length),r.push(o.path));let u=Array.isArray(o.value)?o.value.map((f,i)=>[i,f]):Object.keys(o.value).map(f=>[f,o.value[f]]);D(n,r.length,s.length+u.length);for(let f=u.length-1;f>=0;f--){let[i,c]=u[f],h=[...o.path,i];s.push({value:c,path:h,isRoot:!1})}}return r}function Ee(e,n,t,r,s,o,p,u,f,i){switch(n){case"getpath":{if(t.length===0)return[null];let c=s(e,t[0],r),h=[];for(let a of c){let l=a,y=e;for(let m of l){if(y==null){y=null;break}if(Array.isArray(y)&&typeof m=="number")y=y[m];else if(typeof m=="string"){let b=S(y);if(!b||!Object.hasOwn(b,m)){y=null;break}y=b[m]}else{y=null;break}}h.push(y)}return h}case"setpath":{if(t.length<2)return[null];let c=s(e,t[0],r),h=$e(c[0],r),l=s(e,t[1],r)[0];return[p(e,h,l)]}case"delpaths":{if(t.length===0)return[e];let h=s(e,t[0],r)[0],a=e;for(let l of h.sort((y,m)=>m.length-y.length))a=u(a,l);return[a]}case"path":{if(t.length===0)return[[]];let c=[];return i(e,t[0],r,[],c),c}case"del":return t.length===0?[e]:[f(e,t[0],r)];case"pick":{if(t.length===0)return[null];let c=[];for(let a of t)i(e,a,r,[],c);let h=null;for(let a of c){for(let y of a)if(typeof y=="number"&&y<0)throw new Error("Out of bounds negative array index");$e(a,r);let l=e;for(let y of a){if(l==null)break;if(Array.isArray(l)&&typeof y=="number")l=l[y];else if(typeof y=="string"){let m=S(l);if(!m||!Object.hasOwn(m,y)){l=null;break}l=m[y]}else{l=null;break}}h=p(h,a,l)}return[h]}case"paths":{let c=Le(e,r,!1);return t.length>0?c.filter(h=>{let a=e;for(let y of h)if(Array.isArray(a)&&typeof y=="number")a=a[y];else if(typeof y=="string"){let m=S(a);if(!m||!Object.hasOwn(m,y))return!1;a=m[y]}else return!1;return s(a,t[0],r).some(o)}):c}case"leaf_paths":return Le(e,r,!0);default:return null}}function ke(e,n,t,r,s,o){switch(n){case"IN":{if(t.length===0)return[!1];if(t.length===1){let i=s(e,t[0],r);for(let c of i)if(o(e,c))return[!0];return[!1]}let p=s(e,t[0],r),u=s(e,t[1],r),f=new Set(u.map(i=>JSON.stringify(i)));for(let i of p)if(f.has(JSON.stringify(i)))return[!0];return[!1]}case"INDEX":{if(t.length===0)return[Object.create(null)];if(t.length===1){let f=s(e,t[0],r),i=Object.create(null);for(let c of f){let h=String(c);k(h)&&E(i,h,c)}return[i]}if(t.length===2){let f=s(e,t[0],r),i=Object.create(null);for(let c of f){let h=s(c,t[1],r);if(h.length>0){let a=String(h[0]);k(a)&&E(i,a,c)}}return[i]}let p=s(e,t[0],r),u=Object.create(null);for(let f of p){let i=s(f,t[1],r),c=s(f,t[2],r);if(i.length>0&&c.length>0){let h=String(i[0]);k(h)&&E(u,h,c[0])}}return[u]}case"JOIN":{if(t.length<2)return[null];let p=S(s(e,t[0],r)[0]);if(!p)return[null];if(!Array.isArray(e))return[null];let u=[];for(let f of e){let i=s(f,t[1],r),c=i.length>0?String(i[0]):"",h=_(p,c)?p[c]:null;u.push([f,h])}return[u]}default:return null}}function Be(e){return e.limits.maxArrayElements}function _e(e){return Math.min(e.limits.maxStringLength,e.limits.maxOutputSize)}function U(e,n){let t=Be(e);if(!Number.isSafeInteger(n)||n<0||n>t)throw new g(`query result element limit exceeded (${t})`,"array_elements")}function Ze(e,n,t){if(e==="")return n===""?0:1;if(n==="")return e.length;let r=1,s=0;for(;;){let o=e.indexOf(n,s);if(o<0||(r++,r>t))return r;s=o+n.length}}function Se(e,n,t,r,s){switch(n){case"join":{if(!Array.isArray(e))return[null];let o=t.length>0?s(e,t[0],r):[""];for(let p of e)if(Array.isArray(p)||p!==null&&typeof p=="object")throw new Error("cannot join: contains arrays or objects");return U(r,o.length),o.map(p=>{let u=String(p),f=0;for(let i=0;i<e.length;i++){let c=e[i]===null?"":typeof e[i]=="string"?e[i]:String(e[i]);if(f+=x(c),i>0&&(f+=x(u)),f>_e(r))throw new g(`query string size limit exceeded (${_e(r)} bytes)`,"string_length")}return e.map(i=>i===null?"":typeof i=="string"?i:String(i)).join(u)})}case"split":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),p=String(o[0]);return U(r,Ze(e,p,Be(r))),[e.split(p)]}case"splits":{if(typeof e!="string"||t.length===0)return[];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"g",f=j(p,u.includes("g")?u:`${u}g`),i=1;for(let h of f.matchAll(e))i+=Math.max(1,h.length),U(r,i);let c=f.split(e);return U(r,c.length),c}catch(u){if(u instanceof g)throw u;return[]}}case"scan":{if(typeof e!="string"||t.length===0)return[];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",f=j(p,u.includes("g")?u:`${u}g`),i=[];for(let c of f.matchAll(e))U(r,i.length+1),c.length>1?(U(r,c.length-1),i.push(c.slice(1))):i.push(c[0]);return i}catch(u){if(u instanceof g)throw u;return[]}}case"test":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"";return[j(p,u).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",i=j(p,`${u}d`).exec(e);if(!i)return[];let c=i.indices;return[{offset:i.index,length:i[0].length,string:i[0],captures:i.slice(1).map((h,a)=>({offset:c?.[a+1]?.[0]??null,length:h?.length??0,string:h??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",i=j(p,u).match(e);return!i||!i.groups?[Object.create(null)]:[i.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||t.length<2)return[null];let o=s(e,t[0],r),p=s(e,t[1],r),u=String(o[0]),f=String(p[0]);try{let i=t.length>2?String(s(e,t[2],r)[0]):"";return[j(u,i).replace(e,f)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||t.length<2)return[null];let o=s(e,t[0],r),p=s(e,t[1],r),u=String(o[0]),f=String(p[0]);try{let i=t.length>2?String(s(e,t[2],r)[0]):"g",c=i.includes("g")?i:`${i}g`;return[j(u,c).replace(e,f)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,o=>String.fromCharCode(o.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,o=>String.fromCharCode(o.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),p=String(o[0]);return[e.startsWith(p)?e.slice(p.length):e]}case"rtrimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),p=String(o[0]);return p===""?[e]:[e.endsWith(p)?e.slice(0,-p.length):e]}case"trimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),p=String(o[0]);if(p==="")return[e];let u=e;return u.startsWith(p)&&(u=u.slice(p.length)),u.endsWith(p)&&(u=u.slice(0,-p.length)),[u]}case"trim":if(typeof e=="string")return[e.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof e=="string")return[e.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof e=="string")return[e.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r);return[e.startsWith(String(o[0]))]}case"endswith":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r);return[e.endsWith(String(o[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":if(typeof e=="string"){let o=0;for(let p of e)o++,U(r,o);return[Array.from(e).map(p=>p.codePointAt(0))]}return[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(u=>{if(typeof u=="string")throw new Error(`string (${JSON.stringify(u)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof u!="number"||Number.isNaN(u))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let f=Math.trunc(u);return f<0||f>1114111||f>=55296&&f<=57343?String.fromCodePoint(65533):String.fromCodePoint(f)}).join("")];default:return null}}function Oe(e,n){switch(n){case"type":return e===null?["null"]:Array.isArray(e)?["array"]:typeof e=="boolean"?["boolean"]:typeof e=="number"?["number"]:typeof e=="string"?["string"]:typeof e=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof e=="number"&&!Number.isFinite(e)];case"isnan":return[typeof e=="number"&&Number.isNaN(e)];case"isnormal":return[typeof e=="number"&&Number.isFinite(e)&&e!==0];case"isfinite":return[typeof e=="number"&&Number.isFinite(e)];case"numbers":return typeof e=="number"?[e]:[];case"strings":return typeof e=="string"?[e]:[];case"booleans":return typeof e=="boolean"?[e]:[];case"nulls":return e===null?[e]:[];case"arrays":return Array.isArray(e)?[e]:[];case"objects":return e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"iterables":return Array.isArray(e)||e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"scalars":return!Array.isArray(e)&&!(e&&typeof e=="object")?[e]:[];case"values":return e===null?[]:[e];case"not":return e===!1||e===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}function te(e,n,t){if(n.length===0)return t;let[r,...s]=n;if(typeof r=="number"){if(e&&typeof e=="object"&&!Array.isArray(e))throw new Error("Cannot index object with number");if(r>536870911)throw new Error("Array index too large");if(r<0)throw new Error("Out of bounds negative array index");let i=Array.isArray(e)?[...e]:[];for(;i.length<=r;)i.push(null);return i[r]=te(i[r],s,t),i}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!k(r))return e??Object.create(null);let o=S(e),p=o?C(o):Object.create(null),u=Object.hasOwn(p,r)?p[r]:void 0;return E(p,r,te(u,s,t)),p}function re(e,n){if(n.length===0)return null;if(n.length===1){let s=n[0];if(Array.isArray(e)&&typeof s=="number"){let o=[...e];return o.splice(s,1),o}if(e&&typeof e=="object"&&!Array.isArray(e)){let o=String(s);if(!k(o))return e;let p=C(e);return delete p[o],p}return e}let[t,...r]=n;if(Array.isArray(e)&&typeof t=="number"){let s=[...e];return s[t]=re(s[t],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(t);if(!k(s))return e;let o=C(e);return Object.hasOwn(o,s)&&E(o,s,re(o[s],r)),o}return e}var Q=class e extends Error{label;partialResults;constructor(n,t=[]){super(`break ${n}`),this.label=n,this.partialResults=t,this.name="BreakError"}withPrependedResults(n){return new e(this.label,[...n,...this.partialResults])}},ie=class extends Error{value;constructor(n){super(typeof n=="string"?n:JSON.stringify(n)),this.value=n,this.name="JqError"}},ve=1e4,Ue=10*1024*1024,Ke=2e3,et=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]]);function F(e,n){return new g(e,n)}function R(e,n=1){if(!Number.isSafeInteger(n)||n<0||e.budget.operations>e.limits.maxIterations-n)throw F(`query evaluation: too many iterations (${e.limits.maxIterations})`,"iterations");e.budget.operations+=n}function D(e,n,t=1){let r=e.limits.maxArrayElements;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(t)||n<0||t<0||n>r-t)throw F(`query result element limit exceeded (${r})`,"array_elements")}function q(e,n,t){D(e,n.length,t.length);for(let r of t)n.push(r)}function M(e,n,t){let r=[];for(let s of n){R(e);let o=t(s);q(e,r,o)}return r}function tt(e){let n=new Map;if(e?.namedArgs)for(let[t,r]of e.namedArgs)n.set(`$${t}`,r);return{vars:n,limits:{maxIterations:e?.limits?.maxIterations??ve,maxDepth:e?.limits?.maxDepth??Ke,maxStringLength:e?.limits?.maxStringLength??Ue,maxOutputSize:e?.limits?.maxOutputSize??Ue,maxArrayElements:e?.limits?.maxArrayElements??1e5},env:e?.env,namedArgs:e?.namedArgs,positionalArgs:e?.positionalArgs,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1,budget:e?.budget??{operations:0,callDepth:0}}}function se(e,n,t){let r=new Map(e.vars);return r.set(n,t),{vars:r,limits:e.limits,env:e.env,namedArgs:e.namedArgs,positionalArgs:e.positionalArgs,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage,budget:e.budget}}function W(e,n,t){switch(n.type){case"var":return se(e,n.name,t);case"array":{if(!Array.isArray(t))return null;let r=e;for(let s=0;s<n.elements.length;s++){let o=n.elements[s],p=s<t.length?t[s]:null,u=W(r,o,p);if(u===null)return null;r=u}return r}case"object":{let r=S(t);if(!r)return null;let s=e;for(let o of n.fields){let p;if(typeof o.key=="string")p=o.key;else{let i=d(t,o.key,e);if(i.length===0)return null;p=String(i[0])}let u=_(r,p)?r[p]:null;o.keyVar&&(s=se(s,o.keyVar,u));let f=W(s,o.pattern,u);if(f===null)return null;s=f}return s}}}function rt(e,n){let t=e;for(let r of n)if(t&&typeof t=="object")if(Array.isArray(t))if(typeof r=="number")t=t[r];else return;else{let s=S(t);if(s&&typeof r=="string"&&Object.hasOwn(s,r))t=s[r];else return}else return;return t}function P(e){if(e.type==="Identity")return[];if(e.type==="Field"){let n=e.base?P(e.base):[];return n===null?null:[...n,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let n=e.base?P(e.base):[];if(n===null)return null;let t=e.index.value;return typeof t=="number"||typeof t=="string"?[...n,t]:null}if(e.type==="Pipe"){let n=P(e.left);return n===null?null:Ne(n,e.right)}if(e.type==="Call"){if(e.name==="parent"||e.name==="root")return null;if(e.name==="first"&&e.args.length===0)return[0];if(e.name==="last"&&e.args.length===0)return[-1]}return null}function Ne(e,n){if(n.type==="Call"){if(n.name==="parent"){let t=1;if(n.args.length>0&&n.args[0].type==="Literal"){let r=n.args[0].value;typeof r=="number"&&(t=r)}if(t>=0)return e.slice(0,Math.max(0,e.length-t));{let r=-t-1;return e.slice(0,Math.min(r,e.length))}}if(n.name==="root")return[]}if(n.type==="Field"){let t=P(n);if(t!==null)return[...e,...t]}if(n.type==="Index"&&n.index.type==="Literal"){let t=P(n);if(t!==null)return[...e,...t]}if(n.type==="Pipe"){let t=Ne(e,n.left);return t===null?null:Ne(t,n.right)}return n.type==="Identity"?e:null}function qe(e,n,t){if(n.type==="Comma"){let r=[];try{let s=d(e,n.left,t);q(t,r,s)}catch(s){if(s instanceof g)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{let s=d(e,n.right,t);q(t,r,s)}catch(s){if(s instanceof g)throw s;return r}return r}return d(e,n,t)}function d(e,n,t){let r=t&&"vars"in t?t:tt(t);if(r.defenseContextChecked||(Ie(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),R(r),r.budget.callDepth++,r.budget.callDepth>r.limits.maxDepth)throw r.budget.callDepth--,F(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");try{let s=nt(e,n,r);return D(r,0,s.length),s}finally{r.budget.callDepth--}}function nt(e,n,t){switch(t.coverage?.hit(`jq:node:${n.type}`),n.type){case"Identity":return[e];case"Field":{let r=n.base?d(e,n.base,t):[e];return M(t,r,s=>{let o=S(s);if(o){if(!Object.hasOwn(o,n.name))return[null];let u=o[n.name];return[u===void 0?null:u]}if(s===null)return[null];let p=Array.isArray(s)?"array":typeof s;throw new Error(`Cannot index ${p} with string "${n.name}"`)})}case"Index":{let r=n.base?d(e,n.base,t):[e];return M(t,r,s=>{let o=d(s,n.index,t);return M(t,o,p=>{if(typeof p=="number"&&Array.isArray(s)){if(Number.isNaN(p))return[null];let u=Math.trunc(p),f=u<0?s.length+u:u;return f>=0&&f<s.length?[s[f]]:[null]}if(typeof p=="string"){let u=S(s);return!u||!Object.hasOwn(u,p)?[null]:[u[p]]}return[null]})})}case"Slice":{let r=n.base?d(e,n.base,t):[e];return M(t,r,s=>{if(s===null)return[null];if(!Array.isArray(s)&&typeof s!="string")throw new Error(`Cannot slice ${typeof s} (${JSON.stringify(s)})`);let o=s.length,p=n.start?d(e,n.start,t):[0],u=n.end?d(e,n.end,t):[o];return D(t,0,p.length*u.length),M(t,p,f=>u.map(i=>{let c=f,h=i,a=Number.isNaN(c)?0:Number.isInteger(c)?c:Math.floor(c),l=Number.isNaN(h)?o:Number.isInteger(h)?h:Math.ceil(h),y=Fe(a,o),m=Fe(l,o);return Array.isArray(s),s.slice(y,m)}))})}case"Iterate":{let r=n.base?d(e,n.base,t):[e];return M(t,r,s=>Array.isArray(s)?s:s&&typeof s=="object"?Object.values(s):[])}case"Pipe":{let r=d(e,n.left,t),s=P(n.left),o=[];for(let p of r)try{if(s!==null){let u={...t,currentPath:[...t.currentPath??[],...s]},f=d(p,n.right,u);q(t,o,f)}else{let u=d(p,n.right,t);q(t,o,u)}}catch(u){throw u instanceof Q?u.withPrependedResults(o):u}return o}case"Comma":{let r=d(e,n.left,t),s=d(e,n.right,t);return D(t,r.length,s.length),[...r,...s]}case"Literal":return[n.value];case"Array":return n.elements?[d(e,n.elements,t)]:[[]];case"Object":{let r=[Object.create(null)];for(let s of n.entries){let o=typeof s.key=="string"?[s.key]:d(e,s.key,t),p=d(e,s.value,t),u=[],f=o.filter(h=>typeof h=="string"&&k(h)).length,i=f+(o.length-f),c=r.length*i*p.length;D(t,0,c);for(let h of r)for(let a of o){if(typeof a!="string"){let l=a===null?"null":Array.isArray(a)?"array":typeof a;throw new Error(`Cannot use ${l} (${JSON.stringify(a)}) as object key`)}if(!k(a)){for(let l of p)u.push(C(h));continue}for(let l of p){let y=C(h);E(y,a,l),u.push(y)}}r.length=0,q(t,r,u)}return r}case"Paren":return d(e,n.expr,t);case"BinaryOp":return ot(e,n.op,n.left,n.right,t);case"UnaryOp":return d(e,n.operand,t).map(s=>{if(n.op==="-"){if(typeof s=="number")return-s;if(typeof s=="string"){let o=p=>p.length>5?`"${p.slice(0,3)}...`:JSON.stringify(p);throw new Error(`string (${o(s)}) cannot be negated`)}return null}return n.op==="not"?!I(s):null});case"Cond":{let r=d(e,n.cond,t);return M(t,r,s=>{if(I(s))return d(e,n.then,t);for(let o of n.elifs)if(d(e,o.cond,t).some(I))return d(e,o.then,t);return n.else?d(e,n.else,t):[e]})}case"Try":try{return d(e,n.body,t)}catch(r){if(r instanceof g)throw r;if(n.catch){let s=r instanceof ie?r.value:r instanceof Error?r.message:String(r);return d(s,n.catch,t)}return[]}case"Call":return Je(e,n.name,n.args,t);case"VarBind":{let r=d(e,n.value,t);return M(t,r,s=>{let o=null,p=[];if(n.pattern?p.push(n.pattern):n.name&&p.push({type:"var",name:n.name}),n.alternatives)for(let u of n.alternatives)p.push(u);for(let u of p)if(o=W(t,u,s),o!==null)break;return o===null?[]:d(e,n.body,o)})}case"VarRef":{if(n.name==="$ENV")return[t.env?ue(t.env):Object.create(null)];if(n.name==="$ARGS"){let s=Object.create(null);if(t.namedArgs)for(let[p,u]of t.namedArgs)Object.defineProperty(s,p,{value:u,enumerable:!0,writable:!0,configurable:!0});let o=Object.create(null);return o.positional=t.positionalArgs?[...t.positionalArgs]:[],o.named=s,[o]}let r=t.vars.get(n.name);return r!==void 0?[r]:[null]}case"Recurse":{let r=[],s=new WeakSet,o=[{val:e,depth:0}];for(;o.length>0;){let p=o.pop();if(!p)break;let{val:u,depth:f}=p;if(R(t),f>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");if(u&&typeof u=="object"){if(s.has(u))continue;s.add(u)}if(D(t,r.length),r.push(u),Array.isArray(u))for(let i=u.length-1;i>=0;i--)o.push({val:u[i],depth:f+1});else if(u&&typeof u=="object"){let i=Object.keys(u);for(let c=i.length-1;c>=0;c--)o.push({val:u[i[c]],depth:f+1})}}return r}case"Optional":try{return d(e,n.expr,t)}catch(r){if(r instanceof g)throw r;return[]}case"StringInterp":{let r=new G(t.limits.maxStringLength,"query string interpolation",()=>new g(`string size limit exceeded (${t.limits.maxStringLength} bytes)`,"string_length"));for(let s of n.parts){if(typeof s=="string"){r.append(s);continue}let o=d(e,s,t);for(let p of o){if(R(t),B(p,t.limits.maxDepth+1)>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");r.append(typeof p=="string"?p:JSON.stringify(p))}}return[r.build()]}case"UpdateOp":return[it(e,n.path,n.op,n.value,t)];case"Reduce":{let r=d(e,n.expr,t),s=d(e,n.init,t)[0],o=t.limits.maxDepth??Ke;for(let p of r){let u;if(n.pattern){if(u=W(t,n.pattern,p),u===null)continue}else u=se(t,n.varName,p);if(s=d(s,n.update,u)[0],B(s,o+1)>o)return[null]}return[s]}case"Foreach":{let r=d(e,n.expr,t),s=d(e,n.init,t)[0],o=[];for(let p of r)try{let u;if(n.pattern){if(u=W(t,n.pattern,p),u===null)continue}else u=se(t,n.varName,p);if(s=d(s,n.update,u)[0],n.extract){let f=d(s,n.extract,u);q(t,o,f)}else D(t,o.length),o.push(s)}catch(u){throw u instanceof Q?u.withPrependedResults(o):u}return o}case"Label":try{return d(e,n.body,{...t,labels:new Set([...t.labels??[],n.name])})}catch(r){if(r instanceof Q&&r.label===n.name)return r.partialResults;throw r}case"Break":throw new Q(n.name);case"Def":{let r=new Map(t.funcs??[]),s=`${n.name}/${n.params.length}`;r.set(s,{params:n.params,body:n.funcBody,closure:new Map(t.funcs??[])});let o={...t,funcs:r};return d(e,n.body,o)}default:{let r=n;throw new Error(`Unknown AST node type: ${r.type}`)}}}function Fe(e,n){return e<0?Math.max(0,n+e):Math.min(e,n)}function it(e,n,t,r,s){function o(f,i){switch(t){case"=":return i;case"|=":return d(f,r,s)[0]??null;case"+=":return typeof f=="number"&&typeof i=="number"||typeof f=="string"&&typeof i=="string"?f+i:Array.isArray(f)&&Array.isArray(i)?(D(s,f.length,i.length),[...f,...i]):f&&i&&typeof f=="object"&&typeof i=="object"?ce(f,i):i;case"-=":return typeof f=="number"&&typeof i=="number"?f-i:f;case"*=":return typeof f=="number"&&typeof i=="number"?f*i:f;case"/=":return typeof f=="number"&&typeof i=="number"?f/i:f;case"%=":return typeof f=="number"&&typeof i=="number"?f%i:f;case"//=":return f===null||f===!1?i:f;default:return i}}function p(f,i,c){switch(i.type){case"Identity":return c(f);case"Field":{if(!k(i.name))return f;if(i.base)return p(f,i.base,h=>{if(h&&typeof h=="object"&&!Array.isArray(h)){let a=C(h),l=Object.hasOwn(a,i.name)?a[i.name]:void 0;return E(a,i.name,c(l)),a}return h});if(f&&typeof f=="object"&&!Array.isArray(f)){let h=C(f),a=Object.hasOwn(h,i.name)?h[i.name]:void 0;return E(h,i.name,c(a)),h}return f}case"Index":{let a=d(e,i.index,s)[0];if(typeof a=="number"&&Number.isNaN(a))throw new Error("Cannot set array element at NaN index");if(typeof a=="number"&&!Number.isFinite(a))throw new Error("array index must be finite");if(typeof a=="number"&&!Number.isInteger(a)&&(a=Math.trunc(a)),i.base)return p(f,i.base,l=>{if(typeof a=="number"&&Array.isArray(l)){let y=[...l],m=a<0?y.length+a:a;if(m>=0){D(s,0,m+1),y.length<=m&&(y.length=m+1);for(let b=l.length;b<m;b++)y[b]=null;y[m]=c(y[m])}return y}if(typeof a=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!k(a))return l;let y=C(l),m=Object.hasOwn(y,a)?y[a]:void 0;return E(y,a,c(m)),y}return l});if(typeof a=="number"){if(!Number.isSafeInteger(a)||a>536870911)throw new Error("Array index too large");if(a<0&&(!f||!Array.isArray(f)))throw new Error("Out of bounds negative array index");if(Array.isArray(f)){let y=[...f],m=a<0?y.length+a:a;if(m>=0){D(s,0,m+1),y.length<=m&&(y.length=m+1);for(let b=f.length;b<m;b++)y[b]=null;y[m]=c(y[m])}return y}if(f==null){D(s,0,a+1);let y=new Array(a+1).fill(null);return y[a]=c(null),y}return f}if(typeof a=="string"&&f&&typeof f=="object"&&!Array.isArray(f)){if(!k(a))return f;let l=C(f),y=Object.hasOwn(l,a)?l[a]:void 0;return E(l,a,c(y)),l}return f}case"Iterate":{let h=a=>{if(Array.isArray(a)){D(s,0,a.length);let l=[];for(let y of a)R(s),l.push(c(y));return l}if(a&&typeof a=="object"){let l=Object.create(null);for(let[y,m]of Object.entries(a))k(y)&&E(l,y,c(m));return l}return a};return i.base?p(f,i.base,h):h(f)}case"Pipe":{let h=p(f,i.left,a=>a);return p(h,i.right,c)}default:return c(f)}}return p(e,n,f=>{if(t==="|=")return o(f,f);let i=d(e,r,s);return o(f,i[0]??null)})}function st(e,n,t){function r(o,p,u){switch(p.type){case"Identity":return u;case"Field":{if(!k(p.name))return o;if(p.base){let f=d(o,p.base,t)[0],i=r(f,{type:"Field",name:p.name},u);return r(o,p.base,i)}if(o&&typeof o=="object"&&!Array.isArray(o)){let f=C(o);return E(f,p.name,u),f}return o}case"Index":{if(p.base){let c=d(o,p.base,t)[0],h=r(c,{type:"Index",index:p.index},u);return r(o,p.base,h)}let i=d(e,p.index,t)[0];if(typeof i=="number"&&Array.isArray(o)){let c=[...o],h=i<0?c.length+i:i;return h>=0&&h<c.length&&(c[h]=u),c}if(typeof i=="string"&&o&&typeof o=="object"&&!Array.isArray(o)){if(!k(i))return o;let c=C(o);return E(c,i,u),c}return o}default:return o}}function s(o,p){switch(p.type){case"Identity":return null;case"Field":{if(!k(p.name))return o;if(p.base){let f=d(o,p.base,t)[0];if(f==null)return o;let i=s(f,{type:"Field",name:p.name});return r(o,p.base,i)}if(o&&typeof o=="object"&&!Array.isArray(o)){if(!k(p.name))return o;let f=C(o);return delete f[p.name],f}return o}case"Index":{if(p.base){let c=d(o,p.base,t)[0];if(c==null)return o;let h=s(c,{type:"Index",index:p.index});return r(o,p.base,h)}let i=d(e,p.index,t)[0];if(typeof i=="number"&&Array.isArray(o)){let c=[...o],h=i<0?c.length+i:i;return h>=0&&h<c.length&&c.splice(h,1),c}if(typeof i=="string"&&o&&typeof o=="object"&&!Array.isArray(o)){if(!k(i))return o;let c=C(o);return delete c[i],c}return o}case"Iterate":return Array.isArray(o)?[]:o&&typeof o=="object"?Object.create(null):o;case"Pipe":{let c=function(l,y,m){switch(y.type){case"Identity":return m;case"Field":{if(!k(y.name))return l;if(l&&typeof l=="object"&&!Array.isArray(l)){let b=C(l);return E(b,y.name,m),b}return l}case"Index":{let A=d(e,y.index,t)[0];if(typeof A=="number"&&Array.isArray(l)){let w=[...l],N=A<0?w.length+A:A;return N>=0&&N<w.length&&(w[N]=m),w}if(typeof A=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!k(A))return l;let w=C(l);return E(w,A,m),w}return l}case"Pipe":{let b=d(l,y.left,t)[0],A=c(b,y.right,m);return c(l,y.left,A)}default:return l}};var u=c;let f=p.left,i=p.right,h=d(o,f,t)[0];if(h==null)return o;let a=s(h,i);return c(o,f,a)}default:return o}}return s(e,n)}function ot(e,n,t,r,s){if(n==="and"){let f=d(e,t,s);return M(s,f,i=>{if(!I(i))return[!1];let c=d(e,r,s);return M(s,c,h=>[I(h)])})}if(n==="or"){let f=d(e,t,s);return M(s,f,i=>{if(I(i))return[!0];let c=d(e,r,s);return M(s,c,h=>[I(h)])})}if(n==="//"){let i=d(e,t,s).filter(c=>c!=null&&c!==!1);return i.length>0?i:d(e,r,s)}let o=d(e,t,s),p=d(e,r,s),u=o.length*p.length;return D(s,0,u),R(s,u),o.flatMap(f=>p.map(i=>{switch(n){case"+":if(f===null)return i;if(i===null)return f;if(typeof f=="number"&&typeof i=="number")return f+i;if(typeof f=="string"&&typeof i=="string"){let c=s.limits.maxStringLength;if(x(f)+x(i)>c)throw new g(`string size limit exceeded (${c} bytes)`,"string_length");return f+i}return Array.isArray(f)&&Array.isArray(i)?(D(s,f.length,i.length),[...f,...i]):f&&i&&typeof f=="object"&&typeof i=="object"&&!Array.isArray(f)&&!Array.isArray(i)?ce(f,i):null;case"-":if(typeof f=="number"&&typeof i=="number")return f-i;if(Array.isArray(f)&&Array.isArray(i)){let c=new Set(i.map(h=>JSON.stringify(h)));return f.filter(h=>!c.has(JSON.stringify(h)))}if(typeof f=="string"&&typeof i=="string"){let c=h=>h.length>10?`"${h.slice(0,10)}...`:JSON.stringify(h);throw new Error(`string (${c(f)}) and string (${c(i)}) cannot be subtracted`)}return null;case"*":if(typeof f=="number"&&typeof i=="number")return f*i;if(typeof f=="string"&&typeof i=="number"){if(!Number.isFinite(i))throw new Error(`invalid string repetition count: ${i}`);let c=Math.trunc(i);if(c<0)return null;let h=x(f),a=s.limits.maxStringLength;if(h>0&&c>Math.floor(a/h))throw new g(`string size limit exceeded (${a} bytes)`,"string_length");return f.repeat(c)}{let c=S(f),h=S(i);if(c&&h)return xe(c,h,{maxDepth:s.limits.maxDepth,visit:()=>R(s)})}return null;case"/":if(typeof f=="number"&&typeof i=="number"){if(i===0)throw new Error(`number (${f}) and number (${i}) cannot be divided because the divisor is zero`);return f/i}return typeof f=="string"&&typeof i=="string"?f.split(i):null;case"%":if(typeof f=="number"&&typeof i=="number"){if(i===0)throw new Error(`number (${f}) and number (${i}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(f)&&!Number.isNaN(f)?!Number.isFinite(i)&&!Number.isNaN(i)&&f<0&&i>0?-1:0:f%i}return null;case"==":return J(f,i);case"!=":return!J(f,i);case"<":return Y(f,i)<0;case"<=":return Y(f,i)<=0;case">":return Y(f,i)>0;case">=":return Y(f,i)>=0;default:return null}}))}function Je(e,n,t,r){let s=et.get(n);if(s)return typeof e=="number"?[s(e)]:[null];let o=de(e,n,t,r,d);if(o!==null)return o;let p=Se(e,n,t,r,d);if(p!==null)return p;let u=le(e,n,t,r,d);if(u!==null)return u;let f=ye(e,n,r.limits.maxDepth);if(f!==null)return f;let i=Oe(e,n);if(i!==null)return i;let c=we(e,n,t,r,d);if(c!==null)return c;let h=pe(e,n,t,r,d,qe,Z,I,v,g);if(h!==null)return h;let a=Ee(e,n,t,r,d,I,te,re,st,ne);if(a!==null)return a;let l=me(e,n,t,r,d,J);if(l!==null)return l;let y=he(e,n,t,r,d,qe,I,g);if(y!==null)return y;let m=be(e,n,t,r,d,I,rt,Je);if(m!==null)return m;let b=ke(e,n,t,r,d,J);if(b!==null)return b;switch(n){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let A=t.length>0?d(e,t[0],r)[0]:e;throw new ie(A)}case"env":return[r.env?ue(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let A=`${n}/${t.length}`,w=r.funcs?.get(A);if(w){let N=w.closure??r.funcs??new Map,O=new Map(N);O.set(A,w);for(let X=0;X<w.params.length;X++){let Ye=w.params[X],Re=t[X];if(Re){let L=d(e,Re,r),K;if(L.length===0)K={type:"Call",name:"empty",args:[]};else if(L.length===1)K={type:"Literal",value:L[0]};else{K={type:"Literal",value:L[L.length-1]};for(let fe=L.length-2;fe>=0;fe--)K={type:"Comma",left:{type:"Literal",value:L[fe]},right:K}}O.set(`${Ye}/0`,{params:[],body:K})}}let $={...r,funcs:O};return d(e,w.body,$)}throw new Error(`Unknown function: ${n}`)}}}function ne(e,n,t,r,s){if(R(t),r.length>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");let o=f=>{if(f.length>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");D(t,s.length),s.push(f)};if(n.type==="Comma"){let f=n;ne(e,f.left,t,r,s),ne(e,f.right,t,r,s);return}let p=P(n);if(p!==null){o([...r,...p]);return}if(n.type==="Iterate"){if(Array.isArray(e))for(let f=0;f<e.length;f++)R(t),o([...r,f]);else if(e&&typeof e=="object")for(let f of Object.keys(e))R(t),o([...r,f]);return}if(n.type==="Recurse"){let f=[{value:e,path:[]}];for(;f.length>0;){let i=f.pop();if(!i)break;if(R(t),o([...r,...i.path]),i.value&&typeof i.value=="object"){let c=Array.isArray(i.value)?i.value.map((h,a)=>[a,h]):Object.keys(i.value).map(h=>[h,i.value[h]]);D(t,0,f.length+c.length);for(let h=c.length-1;h>=0;h--){let[a,l]=c[h];f.push({value:l,path:[...i.path,a]})}}}return}if(n.type==="Pipe"){let f=P(n.left);if(f!==null){let i=d(e,n.left,t);for(let c of i)ne(c,n.right,t,[...r,...f],s);return}}d(e,n,t).length>0&&o(r)}var Ve=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]),oe=new Set(Ve.values());function He(e){let n=[],t=0,r=(i=0)=>e[t+i],s=()=>e[t++],o=()=>t>=e.length,p=i=>i>="0"&&i<="9",u=i=>i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="_",f=i=>u(i)||p(i);for(;!o();){let i=t,c=s();if(!(c===" "||c===" "||c===`
4
+ `||c==="\r")){if(c==="#"){for(;!o()&&r()!==`
5
+ `;)s();continue}if(c==="."&&r()==="."){s(),n.push({type:"DOTDOT",pos:i});continue}if(c==="="&&r()==="="){s(),n.push({type:"EQ",pos:i});continue}if(c==="!"&&r()==="="){s(),n.push({type:"NE",pos:i});continue}if(c==="<"&&r()==="="){s(),n.push({type:"LE",pos:i});continue}if(c===">"&&r()==="="){s(),n.push({type:"GE",pos:i});continue}if(c==="/"&&r()==="/"){s(),r()==="="?(s(),n.push({type:"UPDATE_ALT",pos:i})):n.push({type:"ALT",pos:i});continue}if(c==="+"&&r()==="="){s(),n.push({type:"UPDATE_ADD",pos:i});continue}if(c==="-"&&r()==="="){s(),n.push({type:"UPDATE_SUB",pos:i});continue}if(c==="*"&&r()==="="){s(),n.push({type:"UPDATE_MUL",pos:i});continue}if(c==="/"&&r()==="="){s(),n.push({type:"UPDATE_DIV",pos:i});continue}if(c==="%"&&r()==="="){s(),n.push({type:"UPDATE_MOD",pos:i});continue}if(c==="="&&r()!=="="){n.push({type:"ASSIGN",pos:i});continue}if(c==="."){n.push({type:"DOT",pos:i});continue}if(c==="|"){r()==="="?(s(),n.push({type:"UPDATE_PIPE",pos:i})):n.push({type:"PIPE",pos:i});continue}if(c===","){n.push({type:"COMMA",pos:i});continue}if(c===":"){n.push({type:"COLON",pos:i});continue}if(c===";"){n.push({type:"SEMICOLON",pos:i});continue}if(c==="("){n.push({type:"LPAREN",pos:i});continue}if(c===")"){n.push({type:"RPAREN",pos:i});continue}if(c==="["){n.push({type:"LBRACKET",pos:i});continue}if(c==="]"){n.push({type:"RBRACKET",pos:i});continue}if(c==="{"){n.push({type:"LBRACE",pos:i});continue}if(c==="}"){n.push({type:"RBRACE",pos:i});continue}if(c==="?"){n.push({type:"QUESTION",pos:i});continue}if(c==="+"){n.push({type:"PLUS",pos:i});continue}if(c==="-"){n.push({type:"MINUS",pos:i});continue}if(c==="*"){n.push({type:"STAR",pos:i});continue}if(c==="/"){n.push({type:"SLASH",pos:i});continue}if(c==="%"){n.push({type:"PERCENT",pos:i});continue}if(c==="<"){n.push({type:"LT",pos:i});continue}if(c===">"){n.push({type:"GT",pos:i});continue}if(p(c)){let h=c;for(;!o()&&(p(r())||r()==="."||r()==="e"||r()==="E");)(r()==="e"||r()==="E")&&(e[t+1]==="+"||e[t+1]==="-")&&(h+=s()),h+=s();n.push({type:"NUMBER",value:Number(h),pos:i});continue}if(c==='"'){let h="",a=0;for(;!o();){let l=r();if(a===0&&l==='"')break;if(a===0&&l==="\\"){if(s(),o())break;let y=s();switch(y){case"n":h+=`
6
+ `;break;case"r":h+="\r";break;case"t":h+=" ";break;case"\\":h+="\\";break;case'"':h+='"';break;case"(":h+="\\(",a=1;break;default:h+=y}continue}if(a>0){if(l==='"'){for(h+=s();!o();){let y=r();if(y==="\\"){h+=s(),o()||(h+=s());continue}if(h+=s(),y==='"')break}continue}l==="("?a++:l===")"&&a--,h+=s();continue}h+=s()}o()||s(),n.push({type:"STRING",value:h,pos:i});continue}if(u(c)||c==="$"||c==="@"){let h=c;for(;!o()&&f(r());)h+=s();let a=Ve.get(h);a?n.push({type:a,value:h,pos:i}):n.push({type:"IDENT",value:h,pos:i});continue}throw new Error(`Unexpected character '${c}' at position ${i}`)}}return n.push({type:"EOF",pos:t}),n}var Ce=class e{maxDepth;tokens;pos=0;depth;constructor(n,t,r=0){this.maxDepth=t,this.tokens=n,this.depth=r}peek(n=0){return this.tokens[this.pos+n]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(n){return this.peek().type===n}match(...n){for(let t of n)if(this.check(t))return this.advance();return null}expect(n,t){if(!this.check(n))throw new Error(`${t} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}withDepth(n){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return n()}finally{this.depth--}}isFieldNameAfterDot(n=0){let t=this.peek(n),r=this.peek(n+1);return r.type==="STRING"?!0:r.type==="IDENT"||oe.has(r.type)?r.pos===t.pos+1:!1}isIdentLike(){let n=this.peek().type;return n==="IDENT"||oe.has(n)}consumeFieldNameAfterDot(n){let t=this.peek();return t.type==="STRING"?this.advance().value:(t.type==="IDENT"||oe.has(t.type))&&t.pos===n.pos+1?this.advance().value:null}parse(){let n=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return n}parseExpr(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePipe()}finally{this.depth--}}parsePattern(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePatternInner()}finally{this.depth--}}parsePatternInner(){if(this.match("LBRACKET")){let r=[];if(!this.check("RBRACKET"))for(r.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)r.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:r}}if(this.match("LBRACE")){let r=[];if(!this.check("RBRACE"))for(r.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)r.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:r}}let n=this.expect("IDENT","Expected variable name in pattern"),t=n.value;if(!t.startsWith("$"))throw new Error(`Variable name must start with $ at position ${n.pos}`);return{type:"var",name:t}}parsePatternField(){if(this.match("LPAREN")){let t=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let r=this.parsePattern();return{key:t,pattern:r}}let n=this.peek();if(n.type==="IDENT"||oe.has(n.type)){let t=n.value;if(t.startsWith("$")){if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:t.slice(1),pattern:r,keyVar:t}}return{key:t.slice(1),pattern:{type:"var",name:t}}}if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:t,pattern:r}}return{key:t,pattern:{type:"var",name:`$${t}`}}}throw new Error(`Expected field name in object pattern at position ${n.pos}`)}parsePipe(){let n=this.parseComma();for(;this.match("PIPE");){let t=this.parseComma();n={type:"Pipe",left:n,right:t}}return n}parseComma(){let n=this.parseVarBind();for(;this.match("COMMA");){let t=this.parseVarBind();n={type:"Comma",left:n,right:t}}return n}parseVarBind(){let n=this.parseUpdate();if(this.match("AS")){let t=this.parsePattern(),r=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),r.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let s=this.parseExpr();return t.type==="var"&&r.length===0?{type:"VarBind",name:t.name,value:n,body:s}:{type:"VarBind",name:t.type==="var"?t.name:"",value:n,body:s,pattern:t.type!=="var"?t:void 0,alternatives:r.length>0?r:void 0}}return n}peekAhead(n){let t=this.pos+n;return t<this.tokens.length?this.tokens[t]:void 0}parseUpdate(){let n=this.parseAlt(),t=new Map([["ASSIGN","="],["UPDATE_ADD","+="],["UPDATE_SUB","-="],["UPDATE_MUL","*="],["UPDATE_DIV","/="],["UPDATE_MOD","%="],["UPDATE_ALT","//="],["UPDATE_PIPE","|="]]),r=this.match("ASSIGN","UPDATE_ADD","UPDATE_SUB","UPDATE_MUL","UPDATE_DIV","UPDATE_MOD","UPDATE_ALT","UPDATE_PIPE");if(r){let s=this.withDepth(()=>this.parseVarBind()),o=t.get(r.type);if(o)return{type:"UpdateOp",op:o,path:n,value:s}}return n}parseAlt(){let n=this.parseOr();for(;this.match("ALT");){let t=this.parseOr();n={type:"BinaryOp",op:"//",left:n,right:t}}return n}parseOr(){let n=this.parseAnd();for(;this.match("OR");){let t=this.parseAnd();n={type:"BinaryOp",op:"or",left:n,right:t}}return n}parseAnd(){let n=this.parseNot();for(;this.match("AND");){let t=this.parseNot();n={type:"BinaryOp",op:"and",left:n,right:t}}return n}parseNot(){return this.parseComparison()}parseComparison(){let n=this.parseAddSub(),t=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),r=this.match("EQ","NE","LT","LE","GT","GE");if(r){let s=t.get(r.type);if(s){let o=this.parseAddSub();n={type:"BinaryOp",op:s,left:n,right:o}}}return n}parseAddSub(){let n=this.parseMulDiv();for(;;)if(this.match("PLUS")){let t=this.parseMulDiv();n={type:"BinaryOp",op:"+",left:n,right:t}}else if(this.match("MINUS")){let t=this.parseMulDiv();n={type:"BinaryOp",op:"-",left:n,right:t}}else break;return n}parseMulDiv(){let n=this.parseUnary();for(;;)if(this.match("STAR")){let t=this.parseUnary();n={type:"BinaryOp",op:"*",left:n,right:t}}else if(this.match("SLASH")){let t=this.parseUnary();n={type:"BinaryOp",op:"/",left:n,right:t}}else if(this.match("PERCENT")){let t=this.parseUnary();n={type:"BinaryOp",op:"%",left:n,right:t}}else break;return n}parseUnary(){let n=0;for(;this.match("MINUS");)if(n++,this.depth+n>this.maxDepth)throw new Error(`query parse depth limit exceeded (${this.maxDepth})`);let t=this.parsePostfix();for(;n-- >0;)t={type:"UnaryOp",op:"-",operand:t};return t}parsePostfix(){let n=this.parsePrimary();for(;;)if(this.match("QUESTION"))n={type:"Optional",expr:n};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),n={type:"Field",name:this.advance().value,base:n};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))n={type:"Iterate",base:n};else if(this.check("COLON")){this.advance();let t=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),n={type:"Slice",end:t,base:n}}else{let t=this.parseExpr();if(this.match("COLON")){let r=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),n={type:"Slice",start:t,end:r,base:n}}else this.expect("RBRACKET","Expected ']'"),n={type:"Index",index:t,base:n}}else break;return n}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let n=this.advance();if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:s}}let r=this.parseExpr();if(this.match("COLON")){let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:r,end:s}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:r}}let t=this.consumeFieldNameAfterDot(n);return t!==null?{type:"Field",name:t}:{type:"Identity"}}if(this.match("TRUE"))return{type:"Literal",value:!0};if(this.match("FALSE"))return{type:"Literal",value:!1};if(this.match("NULL"))return{type:"Literal",value:null};if(this.check("NUMBER"))return{type:"Literal",value:this.advance().value};if(this.check("STRING")){let t=this.advance().value;return t.includes("\\(")?this.parseStringInterpolation(t):{type:"Literal",value:t}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let n=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:n}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let n=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:n}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let n=this.withDepth(()=>this.parsePostfix()),t;return this.match("CATCH")&&(t=this.withDepth(()=>this.parsePostfix())),{type:"Try",body:n,catch:t}}if(this.match("REDUCE")){let n=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let t=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let o=t.type==="var"?t.name:"";return{type:"Reduce",expr:n,varName:o,init:r,update:s,pattern:t.type!=="var"?t:void 0}}if(this.match("FOREACH")){let n=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let t=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr(),o;this.match("SEMICOLON")&&(o=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let p=t.type==="var"?t.name:"";return{type:"Foreach",expr:n,varName:p,init:r,update:s,extract:o,pattern:t.type!=="var"?t:void 0}}if(this.match("LABEL")){let n=this.expect("IDENT","Expected label name (e.g., $out)"),t=n.value;if(!t.startsWith("$"))throw new Error(`Label name must start with $ at position ${n.pos}`);this.expect("PIPE","Expected '|' after label name");let r=this.parseExpr();return{type:"Label",name:t,body:r}}if(this.match("BREAK")){let n=this.expect("IDENT","Expected label name to break to"),t=n.value;if(!t.startsWith("$"))throw new Error(`Break label must start with $ at position ${n.pos}`);return{type:"Break",name:t}}if(this.match("DEF")){let t=this.expect("IDENT","Expected function name after def").value,r=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let p=this.expect("IDENT","Expected parameter name");for(r.push(p.value);this.match("SEMICOLON");){let u=this.expect("IDENT","Expected parameter name");r.push(u.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let s=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let o=this.parseExpr();return{type:"Def",name:t,params:r,funcBody:s,body:o}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let t=this.advance().value;if(t.startsWith("$"))return{type:"VarRef",name:t};if(this.match("LPAREN")){let r=[];if(!this.check("RPAREN"))for(r.push(this.parseExpr());this.match("SEMICOLON");)r.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:t,args:r}}return{type:"Call",name:t,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parseObjectConstructionInner()}finally{this.depth--}}parseObjectConstructionInner(){let n=[];if(!this.check("RBRACE"))do{let t,r;if(this.match("LPAREN"))t=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else if(this.isIdentLike()){let s=this.advance().value;this.match("COLON")?(t=s,r=this.parseObjectValue()):(t=s,r={type:"Field",name:s})}else if(this.check("STRING"))t=this.advance().value,this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);n.push({key:t,value:r})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:n}}parseObjectValue(){let n=this.parseVarBind();for(;this.match("PIPE");){let t=this.parseVarBind();n={type:"Pipe",left:n,right:t}}return n}parseIf(){let n=this.parseExpr();this.expect("THEN","Expected 'then'");let t=this.parseExpr(),r=[];for(;this.match("ELIF");){let o=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let p=this.parseExpr();r.push({cond:o,then:p})}let s;return this.match("ELSE")&&(s=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:n,then:t,elifs:r,else:s}}parseStringInterpolation(n){let t=[],r="",s=0;for(;s<n.length;)if(n[s]==="\\"&&n[s+1]==="("){r&&(t.push(r),r=""),s+=2;let o=1,p="";for(;s<n.length&&o>0;){let i=n[s];if(i==='"'){for(p+=i,s++;s<n.length;){let c=n[s];if(c==="\\"){p+=c,s++,s<n.length&&(p+=n[s],s++);continue}if(p+=c,s++,c==='"')break}continue}i==="("?o++:i===")"&&o--,o>0&&(p+=i),s++}let u=He(p),f=new e(u,this.maxDepth,this.depth);t.push(f.parse())}else r+=n[s],s++;return r&&t.push(r),{type:"StringInterp",parts:t}}};function pr(e,n={}){let t=n.maxDepth??256,r=n.maxTokens??1e5,s=n.maxSourceLength??1048576;if(e.length>s)throw new Error(`query source length limit exceeded (${s} characters)`);if(e.length+1>r)throw new Error(`query token limit exceeded (${r})`);let o=He(e);return new Ce(o,t).parse()}function gr(e,n,t={}){let r=new G(n,"query JSON output",()=>new g(`output size limit exceeded (${n} bytes)`,t.limitKind??"output_size"));return De(r,e,t,0),r.build()}function De(e,n,t,r){if(n==null){e.append("null");return}if(typeof n=="boolean"){e.append(String(n));return}if(typeof n=="number"){e.append(Number.isFinite(n)?String(n):"null");return}if(typeof n=="string"){t.raw&&r===0?e.append(n):Qe(e,n);return}let s=t.compact??!1,o=t.indent??2,p=t.useTab?" ":" ".repeat(o);if(Array.isArray(n)){e.append("[");for(let f=0;f<n.length;f++)e.append(s?f===0?"":",":f===0?`
7
+ `:`,
8
+ `),s||e.repeat(p,r+1),De(e,n[f],t,r+1);!s&&n.length>0&&e.append(`
9
+ `).repeat(p,r),e.append("]");return}let u=Object.keys(n);t.sortKeys&&(u=u.sort()),e.append("{");for(let f=0;f<u.length;f++){let i=u[f];e.append(s?f===0?"":",":f===0?`
10
+ `:`,
11
+ `),s||e.repeat(p,r+1),Qe(e,i),e.append(s?":":": "),De(e,n[i],t,r+1)}!s&&u.length>0&&e.append(`
12
+ `).repeat(p,r),e.append("}")}function Qe(e,n){e.append('"');let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r),o="";s===34?o='\\"':s===92?o="\\\\":s===8?o="\\b":s===9?o="\\t":s===10?o="\\n":s===12?o="\\f":s===13?o="\\r":s<32&&(o=`\\u${s.toString(16).padStart(4,"0")}`),o&&(e.append(n.slice(t,r)).append(o),t=r+1)}e.append(n.slice(t)).append('"')}export{B as a,d as b,pr as c,gr as d};
@@ -0,0 +1,9 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{d as U}from"./chunk-GN6CQ3J4.js";import{a as $,b as F,c as k}from"./chunk-QAYAQNCG.js";var L=new Map([["sha1","SHA-1"],["sha256","SHA-256"]]);function D(n){function h(r,u){return r<<u|r>>>32-u}let g=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),A=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],b=n.length*8,c=(n.length%64<56?56:120)-n.length%64,s=new Uint8Array(n.length+c+8);s.set(n),s[n.length]=128;let d=new DataView(s.buffer);d.setUint32(s.length-8,b>>>0,!0),d.setUint32(s.length-4,Math.floor(b/4294967296),!0);let w=1732584193,l=4023233417,p=2562383102,e=271733878;for(let r=0;r<s.length;r+=64){let u=new Uint32Array(16);for(let t=0;t<16;t++)u[t]=d.getUint32(r+t*4,!0);let m=w,a=l,x=p,o=e;for(let t=0;t<64;t++){let i,y;t<16?(i=a&x|~a&o,y=t):t<32?(i=o&a|~o&x,y=(5*t+1)%16):t<48?(i=a^x^o,y=(3*t+5)%16):(i=x^(a|~o),y=7*t%16),i=i+m+g[t]+u[y]>>>0,m=o,o=x,x=a,a=a+h(i,A[t])>>>0}w=w+m>>>0,l=l+a>>>0,p=p+x>>>0,e=e+o>>>0}let f=new Uint8Array(16);return new DataView(f.buffer).setUint32(0,w,!0),new DataView(f.buffer).setUint32(4,l,!0),new DataView(f.buffer).setUint32(8,p,!0),new DataView(f.buffer).setUint32(12,e,!0),Array.from(f).map(r=>r.toString(16).padStart(2,"0")).join("")}async function C(n,h){if(n==="md5")return D(h);let g=L.get(n);if(!g)throw new Error(`Unknown algorithm: ${n}`);let A=await globalThis.crypto.subtle.digest(g,new Uint8Array(h).buffer);return Array.from(new Uint8Array(A)).map(b=>b.toString(16).padStart(2,"0")).join("")}function I(n,h,g){let A={name:n,summary:g,usage:`${n} [OPTION]... [FILE]...`,options:["-c, --check read checksums from FILEs and check them"," --help display this help and exit"]};return{name:n,async execute(b,c){if(F(b))return $(A);let s=!1,d=[];for(let e of b)if(e==="-c"||e==="--check")s=!0;else if(!(e==="-b"||e==="-t"||e==="--binary"||e==="--text")){if(e.startsWith("-")&&e!=="-")return k(n,e);d.push(e)}d.length===0&&d.push("-");let w=async e=>{if(e==="-")return Uint8Array.from(c.stdin,f=>f.charCodeAt(0));try{return await c.fs.readFileBuffer(c.fs.resolvePath(c.cwd,e))}catch{return null}};if(s){let e=0,f="";for(let r of d){let u=r==="-"?U(c.stdin):await c.fs.readFile(c.fs.resolvePath(c.cwd,r)).catch(()=>null);if(u===null)return{stdout:"",stderr:`${n}: ${r}: No such file or directory
3
+ `,exitCode:1};for(let m of u.split(`
4
+ `)){let a=m.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!a)continue;let[,x,o]=a,t=await w(o);if(t===null){f+=`${o}: FAILED open or read
5
+ `,e++;continue}let i=await C(h,t)===x.toLowerCase();f+=`${o}: ${i?"OK":"FAILED"}
6
+ `,i||e++}}return e>0&&(f+=`${n}: WARNING: ${e} computed checksum${e>1?"s":""} did NOT match
7
+ `),{stdout:f,stderr:"",exitCode:e>0?1:0}}let l="",p=0;for(let e of d){let f=await w(e);if(f===null){l+=`${n}: ${e}: No such file or directory
8
+ `,p=1;continue}l+=`${await C(h,f)} ${e}
9
+ `}return{stdout:l,stderr:"",exitCode:p}}}}export{I as a};
@@ -0,0 +1,3 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a as u}from"./chunk-QIQMJJZ4.js";import{a as f,b as h}from"./chunk-QAYAQNCG.js";var g={name:"which",summary:"locate a command",usage:"which [-as] program ...",options:["-a List all instances of executables found","-s No output, just return 0 if found, 1 if not","--help display this help and exit"]},w={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},A={name:"which",async execute(s,e){if(h(s))return f(g);let t=u("which",s,w);if(!t.ok)return t.error;let c=t.result.flags.showAll,p=t.result.flags.silent,o=t.result.positional;if(o.length===0)return{stdout:"",stderr:"",exitCode:1};let d=(e.env.get("PATH")||"/usr/bin:/bin").split(":"),n="",a=!0;for(let m of o){let l=!1;for(let r of d){if(!r)continue;let i=e.fs.resolvePath(r,m);if(await e.fs.exists(i)&&(l=!0,p||(n+=`${i}
3
+ `),!c))break}l||(a=!1)}return{stdout:n,stderr:"",exitCode:a?0:1}}},v={name:"which",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"boolean"}],needsArgs:!0};export{A as a,v as b};
@@ -0,0 +1,21 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a as Ie}from"./chunk-DLL7UR66.js";import{a as B,b as U}from"./chunk-BKUWXPEM.js";import{a as O,b as X}from"./chunk-73JQKNZT.js";import{b as z}from"./chunk-AYSZ5MAE.js";import{a as $}from"./chunk-ZBUZKIPX.js";import{d as ve}from"./chunk-FTET43KM.js";import{l as w}from"./chunk-TVCZIH6M.js";import{a as V,d as ee}from"./chunk-GN6CQ3J4.js";import{a as Re,b as Ae,c as pe}from"./chunk-QAYAQNCG.js";var Qe=1e4,Ze=100,Ye=new X(/\s+/);function fe(e={}){let{fieldSep:t=Ye,maxIterations:n=Qe,maxRecursionDepth:r=Ze,maxOutputSize:s=0,maxArrayElements:a=1e5,fs:o,cwd:l,exec:c,coverage:u,requireDefenseContext:f}=e;return{FS:" ",OFS:" ",ORS:`
3
+ `,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,getlineCommandStreams:new Map,getlineFileStreams:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:s,maxArrayElements:a,arrayElementCount:0,recordsProcessed:0,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:o,cwd:l,exec:c,coverage:u,requireDefenseContext:f}}function ke(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}function F(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function L(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}var be=10*1024*1024;function Ee(e){return new ve(e,"awk string",()=>new w(`string size limit exceeded (${e} bytes)`,"string_length"))}function _(e){return e.maxOutputSize>0?e.maxOutputSize:be}function te(e,t,n,r,s){let a=Ee(s),o=0,l=0,c=0;for(let u of t.matchAll(e)){let f=u.index??0;l++,a.append(e.slice(o,f)),n(l)?(a.append(r(u)),c++):a.append(u[0]),o=f+u[0].length}return a.append(e.slice(o)),{value:a.build(),replacements:c}}async function ne(e,t){if(e.type==="regex")return e.pattern;let n=L(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function Oe(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(F(await t.evalExpr(e.index)))}`:"$0":"$0"}function Le(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return L(t.vars[e]??"")}function Te(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let r=parseInt(e.slice(1),10)-1;for(;n.fields.length<=r;)n.fields.push("");n.fields[r]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function Je(e,t,n){return e.length===0?t.line.length:L(await n.evalExpr(e[0])).length}async function et(e,t,n){if(e.length<2)return"";let r=L(await n.evalExpr(e[0])),s=Math.floor(F(await n.evalExpr(e[1])))-1;if(e.length>=3){let a=Math.floor(F(await n.evalExpr(e[2])));return r.substr(Math.max(0,s),a)}return r.substr(Math.max(0,s))}async function tt(e,t,n){if(e.length<2)return 0;let r=L(await n.evalExpr(e[0])),s=L(await n.evalExpr(e[1])),a=r.indexOf(s);return a===-1?0:a+1}async function nt(e,t,n){if(e.length<2)return 0;let r=L(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let a=s.name,o=t.FS;if(e.length>=3){let f=e[2];if(f.type==="regex")o=O(f.pattern);else{let k=L(await n.evalExpr(f));o=k===" "?O("\\s+"):k}}else t.FS===" "&&(o=O("\\s+"));let l=Object.keys(t.arrays[a]??{}).length,c=t.maxArrayElements-t.arrayElementCount+l,u=typeof o=="string"?r.split(o,c+1):o.split(r,c+1);if(u.length>c)throw new w(`array element limit exceeded (${t.maxArrayElements})`,"array_elements");t.arrays[a]=Object.create(null);for(let f=0;f<u.length;f++)t.arrays[a][String(f+1)]=u[f];return t.arrayElementCount+=u.length-l,u.length}async function it(e,t,n){if(e.length<2)return 0;let r=await ne(e[0],n),s=L(await n.evalExpr(e[1])),a=await Oe(e[2],n),o=Le(a,t);try{let l=O(r,"g"),c=te(o,l,u=>u===1,u=>Pe(s,u[0],_(t)),_(t));return Te(a,c.value,t),c.replacements}catch(l){return z(l),0}}async function rt(e,t,n){if(e.length<2)return 0;let r=await ne(e[0],n),s=L(await n.evalExpr(e[1])),a=await Oe(e[2],n),o=Le(a,t);try{let l=O(r,"g"),c=te(o,l,()=>!0,u=>Pe(s,u[0],_(t)),_(t));return Te(a,c.value,t),c.replacements}catch(l){return z(l),0}}function Pe(e,t,n){let r=Ee(n),s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];a==="&"?(r.append("&"),s+=2):a==="\\"?(r.append("\\"),s+=2):(r.append(e[s+1]),s+=2)}else e[s]==="&"?(r.append(t),s++):(r.append(e[s]),s++);return r.build()}async function st(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=L(await n.evalExpr(e[0])),s=await ne(e[1],n);try{let o=O(s).exec(r);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function at(e,t,n){if(e.length<3)return"";let r=await ne(e[0],n),s=L(await n.evalExpr(e[1])),a=L(await n.evalExpr(e[2])),o=e.length>=4?L(await n.evalExpr(e[3])):t.line;try{let l=a.toLowerCase()==="g",c=l?0:parseInt(a,10)||1;if(l){let u=O(r,"g");return te(o,u,()=>!0,f=>Ce(s,f[0],f.slice(1),_(t)),_(t)).value}else{let u=O(r,"g");return te(o,u,f=>f===c,f=>Ce(s,f[0],f.slice(1),_(t)),_(t)).value}}catch(l){return z(l),o}}function Ce(e,t,n,r){let s=Ee(r),a=0;for(;a<e.length;)if(e[a]==="\\"&&a+1<e.length){let o=e[a+1];if(o==="&")s.append("&"),a+=2;else if(o==="0")s.append(t),a+=2;else if(o>="1"&&o<="9"){let l=parseInt(o,10)-1;s.append(n[l]||""),a+=2}else o==="n"?(s.append(`
4
+ `),a+=2):o==="t"?(s.append(" "),a+=2):(s.append(o),a+=2)}else e[a]==="&"?(s.append(t),a++):(s.append(e[a]),a++);return s.build()}async function ot(e,t,n){return e.length===0?"":L(await n.evalExpr(e[0])).toLowerCase()}async function lt(e,t,n){return e.length===0?"":L(await n.evalExpr(e[0])).toUpperCase()}async function ut(e,t,n){if(e.length===0)return"";let r=L(await n.evalExpr(e[0])),s=[];for(let a=1;a<e.length;a++)s.push(await n.evalExpr(e[a]));return ie(r,s,_(t))}async function ct(e,t,n){return e.length===0?0:Math.floor(F(await n.evalExpr(e[0])))}async function ht(e,t,n){return e.length===0?0:Math.sqrt(F(await n.evalExpr(e[0])))}async function pt(e,t,n){return e.length===0?0:Math.sin(F(await n.evalExpr(e[0])))}async function ft(e,t,n){return e.length===0?0:Math.cos(F(await n.evalExpr(e[0])))}async function dt(e,t,n){let r=e.length>0?F(await n.evalExpr(e[0])):0,s=e.length>1?F(await n.evalExpr(e[1])):0;return Math.atan2(r,s)}async function Et(e,t,n){return e.length===0?0:Math.log(F(await n.evalExpr(e[0])))}async function mt(e,t,n){return e.length===0?1:Math.exp(F(await n.evalExpr(e[0])))}function Nt(e,t,n){return t.random?t.random():Math.random()}async function yt(e,t,n){let r=e.length>0?F(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function wt(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function de(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var gt=1e4;function ie(e,t,n=be){let r=0,s="",a=0,o=0,l=Math.min(gt,n),c=u=>{let f=V(u);if(f>n-a)throw new w(`formatted string size limit exceeded (${n} bytes)`,"string_length");s+=u,a+=f};for(;o<e.length;)if(e[o]==="%"&&o+1<e.length){let u=o+1,f="",k="",C="",A,T=u;for(;u<e.length&&/\d/.test(e[u]);)u++;u>T&&e[u]==="$"?(A=parseInt(e.substring(T,u),10)-1,u++):u=T;let he=()=>{if(u<e.length){if(u+1<e.length&&(e[u]==="h"&&e[u+1]==="h"||e[u]==="l"&&e[u+1]==="l")){u+=2;return}/[lzjh]/.test(e[u])&&u++}};for(;u<e.length&&/[-+ #0]/.test(e[u]);)f+=e[u++];if(e[u]==="*"){let p=t[r++],N=p!==void 0?Math.floor(Number(p)):0;if(!Number.isFinite(N)||!Number.isSafeInteger(N))throw new w(`printf width limit exceeded (${l} bytes)`,"string_length");N<0?(f+="-",k=String(-N)):k=String(N),u++}else for(;u<e.length&&/\d/.test(e[u]);)k+=e[u++];if(k&&parseInt(k,10)>l)throw new w(`printf width limit exceeded (${l} bytes)`,"string_length");if(e[u]==="."){if(u++,e[u]==="*"){let p=t[r++],N=p!==void 0?Math.floor(Number(p)):0;if(!Number.isFinite(N)||!Number.isSafeInteger(N))throw new w(`printf precision limit exceeded (${l} bytes)`,"string_length");C=N<0?"":String(N),u++}else for(;u<e.length&&/\d/.test(e[u]);)C+=e[u++];if(C&&parseInt(C,10)>l)throw new w(`printf precision limit exceeded (${l} bytes)`,"string_length")}he();let W=e[u],y=t[A!==void 0?A:r];switch(W){case"s":{let p=y!==void 0?String(y):"";if(C&&(p=p.substring(0,parseInt(C,10))),k){let N=parseInt(k,10);f.includes("-")?p=p.padEnd(N):p=p.padStart(N)}c(p),A===void 0&&r++;break}case"d":case"i":{let p=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(p)&&(p=0);let N=p<0,g=Math.abs(p).toString();if(C){let x=parseInt(C,10);g=g.padStart(x,"0")}let d="";N?d="-":f.includes("+")?d="+":f.includes(" ")&&(d=" ");let I=d+g;if(k){let x=parseInt(k,10);f.includes("-")?I=I.padEnd(x):f.includes("0")&&!C?I=d+g.padStart(x-d.length,"0"):I=I.padStart(x)}c(I),A===void 0&&r++;break}case"f":{let p=y!==void 0?Number(y):0;Number.isNaN(p)&&(p=0);let N=C?parseInt(C,10):6;if(N>100)throw new w("printf floating-point precision limit exceeded (100 digits)","string_length");let g=p.toFixed(N);if(k){let d=parseInt(k,10);f.includes("-")?g=g.padEnd(d):g=g.padStart(d)}c(g),A===void 0&&r++;break}case"e":case"E":{let p=y!==void 0?Number(y):0;Number.isNaN(p)&&(p=0);let N=C?parseInt(C,10):6;if(N>100)throw new w("printf floating-point precision limit exceeded (100 digits)","string_length");let g=p.toExponential(N);if(W==="E"&&(g=g.toUpperCase()),k){let d=parseInt(k,10);f.includes("-")?g=g.padEnd(d):g=g.padStart(d)}c(g),A===void 0&&r++;break}case"g":case"G":{let p=y!==void 0?Number(y):0;Number.isNaN(p)&&(p=0);let N=C?parseInt(C,10):6;if(N>100)throw new w("printf floating-point precision limit exceeded (100 digits)","string_length");let g=p!==0?Math.floor(Math.log10(Math.abs(p))):0,d;if(p===0?d="0":g<-4||g>=N?(d=p.toExponential(N-1),W==="G"&&(d=d.toUpperCase())):d=p.toPrecision(N),d.includes(".")&&(d=d.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),d.includes("e")&&(d=d.replace(/\.?0+e/,"e")),k){let I=parseInt(k,10);f.includes("-")?d=d.padEnd(I):d=d.padStart(I)}c(d),A===void 0&&r++;break}case"x":case"X":{let p=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(p)&&(p=0);let N=Math.abs(p).toString(16);if(W==="X"&&(N=N.toUpperCase()),C){let I=parseInt(C,10);N=N.padStart(I,"0")}let g=p<0?"-":"",d=g+N;if(k){let I=parseInt(k,10);f.includes("-")?d=d.padEnd(I):f.includes("0")&&!C?d=g+N.padStart(I-g.length,"0"):d=d.padStart(I)}c(d),A===void 0&&r++;break}case"o":{let p=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(p)&&(p=0);let N=Math.abs(p).toString(8);if(C){let I=parseInt(C,10);N=N.padStart(I,"0")}let g=p<0?"-":"",d=g+N;if(k){let I=parseInt(k,10);f.includes("-")?d=d.padEnd(I):f.includes("0")&&!C?d=g+N.padStart(I-g.length,"0"):d=d.padStart(I)}c(d),A===void 0&&r++;break}case"c":{c(typeof y=="number"?String.fromCharCode(y):String(y??"").charAt(0)||""),A===void 0&&r++;break}case"%":c("%");break;default:c(e.substring(o,u+1))}o=u+1}else if(e[o]==="\\"&&o+1<e.length){let u=e[o+1];switch(u){case"n":c(`
5
+ `);break;case"t":c(" ");break;case"r":c("\r");break;case"\\":c("\\");break;default:c(u)}o+=2}else c(e[o++]);return s}var Me=new Map([["length",Je],["substr",et],["index",tt],["split",nt],["sub",it],["gsub",rt],["match",st],["gensub",at],["tolower",ot],["toupper",lt],["sprintf",ut],["int",ct],["sqrt",ht],["sin",pt],["cos",ft],["atan2",dt],["log",Et],["exp",mt],["rand",Nt],["srand",yt],["system",wt("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",de("systime")],["mktime",de("mktime")],["strftime",de("strftime")]]);function P(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function b(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function v(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function me(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function Z(e,t){try{return O(e).test(t)}catch{return!1}}function Fe(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function re(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Ne(e,t,n){if(t===0)e.line=v(n),e.fields=Fe(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=v(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function K(e,t){e.line=t,e.fields=Fe(e,t),e.NF=e.fields.length}function De(e,t){if(e.FS=t,t===" ")e.fieldSep=new X(/\s+/);else try{e.fieldSep=O(t)}catch{e.fieldSep=O(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function se(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function j(e,t,n){switch(t){case"FS":De(e,v(n));return;case"OFS":e.OFS=v(n);return;case"ORS":e.ORS=v(n);return;case"OFMT":e.OFMT=v(n);return;case"NR":e.NR=Math.floor(b(n));return;case"NF":{let r=Math.floor(b(n));if(r<e.NF)e.fields=e.fields.slice(0,r),e.line=e.fields.join(e.OFS);else if(r>e.NF){for(;e.fields.length<r;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=r;return}case"FNR":e.FNR=Math.floor(b(n));return;case"FILENAME":e.FILENAME=v(n);return;case"RSTART":e.RSTART=Math.floor(b(n));return;case"RLENGTH":e.RLENGTH=Math.floor(b(n));return;case"SUBSEP":e.SUBSEP=v(n);return}e.vars[t]=n}function Y(e,t){let n=t,r=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!r.has(n);)r.add(n),n=s,s=e.arrayAliases.get(n);return n}function ae(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=Y(e,t);return e.arrays[r]?.[n]??""}function ye(e,t,n,r){let s=Y(e,t);if(e.arrays[s]||(e.arrays[s]=Object.create(null)),!(n in e.arrays[s])){if(e.arrayElementCount>=e.maxArrayElements)throw new w(`array element limit exceeded (${e.maxArrayElements})`,"array_elements");e.arrayElementCount++}e.arrays[s][n]=r}function xe(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=Y(e,t);return e.arrays[r]?.[n]!==void 0}function _e(e,t,n){let r=Y(e,t);e.arrays[r]&&(n in e.arrays[r]&&e.arrayElementCount--,delete e.arrays[r][n])}function Ge(e,t){let n=Y(e,t);e.arrayElementCount-=Object.keys(e.arrays[n]??{}).length,delete e.arrays[n]}var Be=null;function Ue(e){Be=e}function M(e,t){B(e.requireDefenseContext,"awk",t)}function R(e,t,n){return U(e.requireDefenseContext,"awk",t,n)}async function E(e,t){switch(M(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return Z(t.pattern,e.line)?1:0;case"field":return St(e,t);case"variable":return se(e,t.name);case"array_access":return Rt(e,t);case"binary":return At(e,t);case"unary":return kt(e,t);case"ternary":return P(await R(e,"ternary condition evaluation",()=>E(e,t.condition)))?await R(e,"ternary consequent evaluation",()=>E(e,t.consequent)):await R(e,"ternary alternate evaluation",()=>E(e,t.alternate));case"call":return Ct(e,t.name,t.args);case"assignment":return Ot(e,t);case"pre_increment":return Lt(e,t.operand);case"pre_decrement":return Tt(e,t.operand);case"post_increment":return Pt(e,t.operand);case"post_decrement":return Mt(e,t.operand);case"in":return Ft(e,t.key,t.array);case"getline":return Dt(e,t.variable,t.file,t.command);case"tuple":return Gt(e,t.elements);default:return""}}async function St(e,t){M(e,"field reference evaluation");let n=Math.floor(b(await R(e,"field index evaluation",()=>E(e,t.index))));return re(e,n)}async function Rt(e,t){M(e,"array access evaluation");let n=v(await R(e,"array key evaluation",()=>E(e,t.key)));return ae(e,t.array,n)}async function At(e,t){M(e,"binary expression evaluation");let n=t.operator;if(n==="||")return P(await R(e,"logical-or left evaluation",()=>E(e,t.left)))||P(await R(e,"logical-or right evaluation",()=>E(e,t.right)))?1:0;if(n==="&&")return P(await R(e,"logical-and left evaluation",()=>E(e,t.left)))&&P(await R(e,"logical-and right evaluation",()=>E(e,t.right)))?1:0;if(n==="~"){let l=await R(e,"regex left evaluation",()=>E(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let c=t.right.type==="regex"?t.right.pattern:v(await R(e,"regex right evaluation",()=>E(e,t.right)));try{return O(c).test(v(l))?1:0}catch{return 0}}if(n==="!~"){let l=await R(e,"negated-regex left evaluation",()=>E(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let c=t.right.type==="regex"?t.right.pattern:v(await R(e,"negated-regex right evaluation",()=>E(e,t.right)));try{return O(c).test(v(l))?0:1}catch{return 1}}let r=await R(e,"binary left evaluation",()=>E(e,t.left)),s=await R(e,"binary right evaluation",()=>E(e,t.right));if(n===" "){let l=v(r)+v(s);if(e.maxOutputSize>0&&l.length>e.maxOutputSize)throw new w(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return l}if(vt(n))return It(r,s,n);let a=b(r),o=b(s);return ke(a,o,n)}function vt(e){return["<","<=",">",">=","==","!="].includes(e)}function It(e,t,n){let r=me(e),s=me(t);if(r&&s){let l=b(e),c=b(t);switch(n){case"<":return l<c?1:0;case"<=":return l<=c?1:0;case">":return l>c?1:0;case">=":return l>=c?1:0;case"==":return l===c?1:0;case"!=":return l!==c?1:0}}let a=v(e),o=v(t);switch(n){case"<":return a<o?1:0;case"<=":return a<=o?1:0;case">":return a>o?1:0;case">=":return a>=o?1:0;case"==":return a===o?1:0;case"!=":return a!==o?1:0}return 0}async function kt(e,t){M(e,"unary expression evaluation");let n=await R(e,"unary operand evaluation",()=>E(e,t.operand));switch(t.operator){case"!":return P(n)?0:1;case"-":return-b(n);case"+":return+b(n);default:return n}}async function Ct(e,t,n){M(e,"function call evaluation");let r=Me.get(t);if(r)return r(n,e,{evalExpr:a=>E(e,a)});let s=e.functions.get(t);return s?bt(e,s,n):""}async function bt(e,t,n){if(M(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new w(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let r=Object.create(null);for(let l of t.params)r[l]=e.vars[l];let s=[];for(let l=0;l<t.params.length;l++){let c=t.params[l];if(l<n.length){let u=n[l];u.type==="variable"&&(e.arrayAliases.set(c,u.name),s.push(c));let f=await R(e,"user function argument evaluation",()=>E(e,u));e.vars[c]=f}else e.vars[c]=""}e.hasReturn=!1,e.returnValue=void 0;let a=Be;a&&await R(e,"user function body execution",()=>a(e,t.body.statements));let o=e.returnValue??"";for(let l of t.params)r[l]!==void 0?e.vars[l]=r[l]:delete e.vars[l];for(let l of s)e.arrayAliases.delete(l);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function Ot(e,t){M(e,"assignment evaluation");let n=await R(e,"assignment value evaluation",()=>E(e,t.value)),r=t.target,s=t.operator,a;if(s==="=")a=n;else{let o;if(r.type==="field"){let u=Math.floor(b(await R(e,"assignment field index",()=>E(e,r.index))));o=re(e,u)}else if(r.type==="variable")o=se(e,r.name);else{let u=v(await R(e,"assignment array key",()=>E(e,r.key)));o=ae(e,r.array,u)}let l=b(o),c=b(n);switch(s){case"+=":a=l+c;break;case"-=":a=l-c;break;case"*=":a=l*c;break;case"/=":a=c!==0?l/c:0;break;case"%=":a=c!==0?l%c:0;break;case"^=":a=l**c;break;default:a=n}}if(r.type==="field"){let o=Math.floor(b(await R(e,"assignment target field index",()=>E(e,r.index))));Ne(e,o,a)}else if(r.type==="variable")j(e,r.name,a);else{let o=v(await R(e,"assignment target array key",()=>E(e,r.key)));ye(e,r.array,o,a)}return a}async function oe(e,t,n,r){M(e,"inc/dec evaluation");let s;if(t.type==="field"){let a=Math.floor(b(await R(e,"inc/dec field index",()=>E(e,t.index))));s=b(re(e,a)),Ne(e,a,s+n)}else if(t.type==="variable")s=b(se(e,t.name)),j(e,t.name,s+n);else{let a=v(await R(e,"inc/dec array key",()=>E(e,t.key)));s=b(ae(e,t.array,a)),ye(e,t.array,a,s+n)}return r?s+n:s}async function Lt(e,t){return oe(e,t,1,!0)}async function Tt(e,t){return oe(e,t,-1,!0)}async function Pt(e,t){return oe(e,t,1,!1)}async function Mt(e,t){return oe(e,t,-1,!1)}async function Ft(e,t,n){M(e,"in-expression evaluation");let r;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let a of t.elements)s.push(v(await R(e,"tuple key element evaluation",()=>E(e,a))));r=s.join(e.SUBSEP)}else r=v(await R(e,"in-expression key evaluation",()=>E(e,t)));return xe(e,n,r)?1:0}async function Dt(e,t,n,r){if(M(e,"getline evaluation"),r)return xt(e,t,r);if(n)return _t(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let a=e.lines[s];return t?j(e,t,a):K(e,a),e.NR++,e.lineIndex=s,1}async function xt(e,t,n){let r=e.exec;if(!r)return-1;M(e,"getline command source");let s=v(await R(e,"getline command expression",()=>E(e,n))),a=e.getlineCommandStreams.get(s);if(!a)try{let c=await R(e,"getline command exec",()=>r(s)),f=ee(c.stdout).split(`
6
+ `);f.length>0&&f[f.length-1]===""&&f.pop(),a={lines:f,index:-1},e.getlineCommandStreams.set(s,a)}catch(c){if(c instanceof $)throw c;return-1}let o=a.index+1;if(o>=a.lines.length)return 0;let l=a.lines[o];return a.index=o,t?j(e,t,l):K(e,l),1}async function _t(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;M(e,"getline file source");let s=v(await R(e,"getline filename evaluation",()=>E(e,n)));if(s==="/dev/null")return 0;let a=r.resolvePath(e.cwd,s),o=e.getlineFileStreams.get(a);if(!o)try{let f=(await R(e,"getline file read",()=>r.readFile(a))).split(`
7
+ `);f.length>0&&f[f.length-1]===""&&f.pop(),o={lines:f,index:-1},e.getlineFileStreams.set(a,o)}catch(u){if(u instanceof $)throw u;return-1}let l=o.index+1;if(l>=o.lines.length)return 0;let c=o.lines[l];return o.index=l,t?j(e,t,c):K(e,c),1}async function Gt(e,t){if(M(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await R(e,"tuple intermediate element",()=>E(e,t[n]));return R(e,"tuple final element",()=>E(e,t[t.length-1]))}Ue(q);function we(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new w(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function D(e,t){B(e.requireDefenseContext,"awk",t)}function S(e,t,n){return U(e.requireDefenseContext,"awk",t,n)}async function q(e,t){D(e,"block execution");for(let n of t)if(await S(e,"statement execution",()=>H(e,n)),Bt(e))break}function Bt(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function H(e,t){switch(D(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await S(e,"nested block statement",()=>q(e,t.statements));break;case"expr_stmt":await S(e,"expression statement",()=>E(e,t.expression));break;case"print":await S(e,"print statement",()=>Ut(e,t.args,t.output));break;case"printf":await S(e,"printf statement",()=>$t(e,t.format,t.args,t.output));break;case"if":await S(e,"if statement",()=>Ht(e,t));break;case"while":await S(e,"while statement",()=>Wt(e,t));break;case"do_while":await S(e,"do-while statement",()=>Vt(e,t));break;case"for":await S(e,"for statement",()=>zt(e,t));break;case"for_in":await S(e,"for-in statement",()=>Xt(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;{let n=t.code;e.exitCode=n?Math.floor(b(await S(e,"exit code expression",()=>E(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await S(e,"return expression",()=>E(e,n)):""}break;case"delete":await S(e,"delete statement",()=>Kt(e,t.target));break}}async function Ut(e,t,n){D(e,"print execution");let r=[];for(let a of t){let o=await S(e,"print argument evaluation",()=>E(e,a));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?r.push(String(o)):r.push(ie(e.OFMT,[o],e.maxOutputSize||void 0)):r.push(v(o))}let s=r.join(e.OFS)+e.ORS;n?await S(e,"print redirection write",()=>$e(e,n.redirect,n.file,s)):(e.output+=s,we(e))}async function $t(e,t,n,r){D(e,"printf execution");let s=v(await S(e,"printf format evaluation",()=>E(e,t))),a=[];for(let c of n)a.push(await S(e,"printf argument evaluation",()=>E(e,c)));let o=e.maxOutputSize>0?Math.max(0,e.maxOutputSize-V(e.output)):void 0,l=ie(s,a,o);r?await S(e,"printf redirection write",()=>$e(e,r.redirect,r.file,l)):(e.output+=l,we(e))}async function $e(e,t,n,r){D(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=r,we(e);return}let a=v(await S(e,"redirection filename evaluation",()=>E(e,n))),o=s.resolvePath(e.cwd,a);t===">"?e.openedFiles.has(o)?await S(e,"redirection append write",()=>s.appendFile(o,r)):(await S(e,"redirection overwrite write",()=>s.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await S(e,"redirection append mode write",()=>s.appendFile(o,r)))}async function Ht(e,t){if(D(e,"if execution"),P(await S(e,"if condition evaluation",()=>E(e,t.condition))))await S(e,"if consequent execution",()=>H(e,t.consequent));else if(t.alternate){let n=t.alternate;await S(e,"if alternate execution",()=>H(e,n))}}async function Wt(e,t){D(e,"while execution");let n=0;for(;P(await S(e,"while condition evaluation",()=>E(e,t.condition)));){if(n++,n>e.maxIterations)throw new w(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await S(e,"while body execution",()=>H(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Vt(e,t){D(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new w(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await S(e,"do-while body execution",()=>H(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(P(await S(e,"do-while condition evaluation",()=>E(e,t.condition))))}async function zt(e,t){D(e,"for execution");let n=t.init,r=t.condition,s=t.update;n&&await S(e,"for init evaluation",()=>E(e,n));let a=0;for(;!r||P(await S(e,"for condition evaluation",()=>E(e,r)));){if(a++,a>e.maxIterations)throw new w(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await S(e,"for body execution",()=>H(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await S(e,"for update evaluation",()=>E(e,s))}}async function Xt(e,t){D(e,"for-in execution");let n=e.arrays[t.array];if(n)for(let r of Object.keys(n)){if(e.vars[t.variable]=r,e.loopContinue=!1,await S(e,"for-in body execution",()=>H(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Kt(e,t){if(D(e,"delete execution"),t.type==="array_access"){let n=v(await S(e,"delete key evaluation",()=>E(e,t.key)));_e(e,t.array,n)}else t.type==="variable"&&Ge(e,t.name)}var J=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){B(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return U(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),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.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>q(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){if(this.ctx.recordsProcessed++,this.ctx.recordsProcessed>this.ctx.maxIterations)throw new w(`record limit exceeded (${this.ctx.maxIterations})`,"iterations");K(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 r=this.program.rules[n];r.pattern?.type==="begin"||r.pattern?.type==="end"||await this.withDefenseContext("rule match",()=>this.matchesRule(r,n))&&await this.withDefenseContext("rule block execution",()=>q(this.ctx,r.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!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 this.withDefenseContext("END block execution",()=>q(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){this.assertDefenseContext("rule matching");let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return Z(r.pattern,this.ctx.line);case"expr_pattern":return P(await this.withDefenseContext("expression pattern evaluation",()=>E(this.ctx,r.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(r.start)),a=await this.withDefenseContext("range end pattern",()=>this.matchPattern(r.end));return this.rangeStates[n]?(a&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,a&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return Z(t.pattern,this.ctx.line);case"expr_pattern":return P(await this.withDefenseContext("nested expression pattern",()=>E(this.ctx,t.expression)));default:return!1}}};var i;(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"})(i||(i={}));var jt=new Map([["BEGIN",i.BEGIN],["END",i.END],["if",i.IF],["else",i.ELSE],["while",i.WHILE],["do",i.DO],["for",i.FOR],["in",i.IN],["break",i.BREAK],["continue",i.CONTINUE],["next",i.NEXT],["nextfile",i.NEXTFILE],["exit",i.EXIT],["return",i.RETURN],["delete",i.DELETE],["function",i.FUNCTION],["print",i.PRINT],["printf",i.PRINTF],["getline",i.GETLINE]]);function qt(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 Qt=new Set([i.COMMA,i.LBRACE,i.AND,i.OR,i.QUESTION,i.COLON,i.DO,i.ELSE,i.IF,i.WHILE]),le=class{maxTokens;input;pos=0;line=1;column=1;lastTokenType=null;constructor(t,n=1e5){this.maxTokens=n,this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();if(n){if(t.length>=this.maxTokens)throw new w(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");t.push(n),this.lastTokenType=n.type}}if(t.length>=this.maxTokens)throw new w(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");return t.push(this.makeToken(i.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(){for(this.skipWhitespace();this.peek()===`
11
+ `&&this.lastTokenType!==null&&Qt.has(this.lastTokenType);)this.advance(),this.skipWhitespace();if(this.pos>=this.input.length)return null;let t=this.line,n=this.column,r=this.peek();return r===`
12
+ `?(this.advance(),{type:i.NEWLINE,value:`
13
+ `,line:t,column:n}):r==='"'?this.readString():r==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(r)||r==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(r)||r==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,i.NEWLINE,i.SEMICOLON,i.LBRACE,i.RBRACE,i.LPAREN,i.LBRACKET,i.COMMA,i.ASSIGN,i.PLUS_ASSIGN,i.MINUS_ASSIGN,i.STAR_ASSIGN,i.SLASH_ASSIGN,i.PERCENT_ASSIGN,i.CARET_ASSIGN,i.AND,i.OR,i.NOT,i.MATCH,i.NOT_MATCH,i.QUESTION,i.COLON,i.LT,i.GT,i.LE,i.GE,i.EQ,i.NE,i.PLUS,i.MINUS,i.STAR,i.PERCENT,i.CARET,i.PRINT,i.PRINTF,i.IF,i.WHILE,i.DO,i.FOR,i.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let r="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let s=this.advance();switch(s){case"n":r+=`
14
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"f":r+="\f";break;case"b":r+="\b";break;case"v":r+="\v";break;case"a":r+="\x07";break;case"\\":r+="\\";break;case'"':r+='"';break;case"/":r+="/";break;case"x":{let a="";for(;a.length<2&&/[0-9a-fA-F]/.test(this.peek());)a+=this.advance();a.length>0?r+=String.fromCharCode(parseInt(a,16)):r+="x";break}default:if(/[0-7]/.test(s)){let a=s;for(;a.length<3&&/[0-7]/.test(this.peek());)a+=this.advance();r+=String.fromCharCode(parseInt(a,8))}else r+=s}}else r+=this.advance();return this.peek()==='"'&&this.advance(),{type:i.STRING,value:r,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let r="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")r+=this.advance(),this.pos<this.input.length&&(r+=this.advance());else{if(this.peek()===`
15
+ `)break;r+=this.advance()}return this.peek()==="/"&&this.advance(),r=qt(r),{type:i.REGEX,value:r,line:t,column:n}}readNumber(){let t=this.line,n=this.column,r="";for(;this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(r+=this.advance();this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(r+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(r+=this.advance());this.isDigit(this.peek());)r+=this.advance();return{type:i.NUMBER,value:parseFloat(r),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,r="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)r+=this.advance();let s=jt.get(r);return s!==void 0?{type:s,value:r,line:t,column:n}:{type:i.IDENT,value:r,line:t,column:n}}readOperator(){let t=this.line,n=this.column,r=this.advance(),s=this.peek();switch(r){case"+":return s==="+"?(this.advance(),{type:i.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:i.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:i.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:i.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:i.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:i.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:i.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:i.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:i.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:i.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:i.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:i.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:i.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:i.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:i.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:i.EQ,value:"==",line:t,column:n}):{type:i.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:i.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:i.NOT_MATCH,value:"!~",line:t,column:n}):{type:i.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:i.LE,value:"<=",line:t,column:n}):{type:i.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:i.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:i.APPEND,value:">>",line:t,column:n}):{type:i.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:i.AND,value:"&&",line:t,column:n}):{type:i.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:i.OR,value:"||",line:t,column:n}):{type:i.PIPE,value:"|",line:t,column:n};case"~":return{type:i.MATCH,value:"~",line:t,column:n};case"?":return{type:i.QUESTION,value:"?",line:t,column:n};case":":return{type:i.COLON,value:":",line:t,column:n};case",":return{type:i.COMMA,value:",",line:t,column:n};case";":return{type:i.SEMICOLON,value:";",line:t,column:n};case"(":return{type:i.LPAREN,value:"(",line:t,column:n};case")":return{type:i.RPAREN,value:")",line:t,column:n};case"{":return{type:i.LBRACE,value:"{",line:t,column:n};case"}":return{type:i.RBRACE,value:"}",line:t,column:n};case"[":return{type:i.LBRACKET,value:"[",line:t,column:n};case"]":return{type:i.RBRACKET,value:"]",line:t,column:n};case"$":return{type:i.DOLLAR,value:"$",line:t,column:n};default:return{type:i.IDENT,value:r,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 h={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 Xe(e){e.expect(h.PRINT);let t=[];if(e.check(h.NEWLINE)||e.check(h.SEMICOLON)||e.check(h.RBRACE)||e.check(h.PIPE)||e.check(h.GT)||e.check(h.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(e.assertArrayLength(t.length),t.push(ue(e));e.check(h.COMMA);)e.advance(),e.assertArrayLength(t.length),t.push(ue(e));let n;return e.check(h.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(h.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function ue(e){return Zt(e)?ge(e,!0):ge(e,!1)}function ge(e,t){let n=t?e.parseTernary():Yt(e);if(e.match(h.ASSIGN,h.PLUS_ASSIGN,h.MINUS_ASSIGN,h.STAR_ASSIGN,h.SLASH_ASSIGN,h.PERCENT_ASSIGN,h.CARET_ASSIGN)){let r=e.advance(),s=e.withDepth(()=>ge(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(r.value)??"=",target:n,value:s}}return n}function Zt(e){let t=0,n=e.pos;for(;n<e.tokens.length;){e.useOperation();let r=e.tokens[n];if(r.type===h.LPAREN&&t++,r.type===h.RPAREN&&t--,r.type===h.QUESTION&&t===0)return!0;if(r.type===h.NEWLINE||r.type===h.SEMICOLON||r.type===h.RBRACE||r.type===h.COMMA||r.type===h.PIPE)return!1;n++}return!1}function Yt(e){let t=He(e);for(;e.check(h.OR);){e.advance();let n=He(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function He(e){let t=We(e);for(;e.check(h.AND);){e.advance();let n=We(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function We(e){let t=Jt(e);if(e.check(h.IN)){e.advance();let n=String(e.expect(h.IDENT).value);return{type:"in",key:t,array:n}}return t}function Jt(e){let t=Ve(e);for(;en(e)&&!tn(e);){let n=Ve(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function Ve(e){let t=ze(e);for(;e.match(h.MATCH,h.NOT_MATCH);){let n=e.advance().type===h.MATCH?"~":"!~",r=ze(e);t={type:"binary",operator:n,left:t,right:r}}return t}function ze(e){let t=e.parseAddSub();for(;e.match(h.LT,h.LE,h.GE,h.EQ,h.NE);){let n=e.advance(),r=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}function en(e){return e.match(h.NUMBER,h.STRING,h.IDENT,h.DOLLAR,h.LPAREN,h.NOT,h.MINUS,h.PLUS,h.INCREMENT,h.DECREMENT)}function tn(e){return e.match(h.AND,h.OR,h.QUESTION,h.ASSIGN,h.PLUS_ASSIGN,h.MINUS_ASSIGN,h.STAR_ASSIGN,h.SLASH_ASSIGN,h.PERCENT_ASSIGN,h.CARET_ASSIGN,h.COMMA,h.SEMICOLON,h.NEWLINE,h.RBRACE,h.RPAREN,h.RBRACKET,h.COLON,h.PIPE,h.APPEND,h.GT,h.IN)}function Ke(e){e.expect(h.PRINTF);let t=e.check(h.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():ue(e),r=[];for(;e.check(h.COMMA);)e.advance(),t&&e.skipNewlines(),e.assertArrayLength(r.length),r.push(t?e.parseExpression():ue(e));t&&(e.skipNewlines(),e.expect(h.RPAREN));let s;return e.check(h.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(h.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:r,output:s}}var ce=class{tokens=[];pos=0;depth=0;operations=0;limits;constructor(t={}){this.limits={maxSourceLength:t.maxSourceLength??10*1024*1024,maxTokens:t.maxTokens??1e5,maxDepth:t.maxDepth??100,maxOperations:t.maxOperations??1e5}}parse(t){if(t.length>this.limits.maxSourceLength)throw new w(`awk: source length limit exceeded (${this.limits.maxSourceLength})`,"string_length");let n=new le(t,this.limits.maxTokens);this.tokens=n.tokenize(),this.pos=0,this.depth=0,this.operations=0;let r=0;for(let s of this.tokens)if(this.useOperation(),s.type===i.LPAREN||s.type===i.LBRACKET||s.type===i.LBRACE){if(r++,r>this.limits.maxDepth)throw new w(`awk: parser depth limit exceeded (${this.limits.maxDepth})`,"recursion")}else(s.type===i.RPAREN||s.type===i.RBRACKET||s.type===i.RBRACE)&&(r=Math.max(0,r-1));return this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:i.EOF,value:"",line:0,column:0}}advance(){this.useOperation();let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}useOperation(t=1){if(t>this.limits.maxOperations-this.operations)throw new w(`awk: parser operation limit exceeded (${this.limits.maxOperations})`,"iterations");this.operations+=t}withDepth(t){if(this.depth>=this.limits.maxDepth)throw new w(`awk: parser depth limit exceeded (${this.limits.maxDepth})`,"recursion");this.depth++;try{return t()}finally{this.depth--}}assertArrayLength(t){if(t>=this.limits.maxTokens)throw new w(`awk: AST array limit exceeded (${this.limits.maxTokens})`,"array_elements")}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let r=this.current();throw new Error(n||`Expected ${t}, got ${r.type} at line ${r.line}:${r.column}`)}return this.advance()}skipNewlines(){for(;this.check(i.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(i.NEWLINE)||this.check(i.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(i.EOF)&&(this.skipNewlines(),!this.check(i.EOF));)this.check(i.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(i.FUNCTION);let t=this.expect(i.IDENT).value;this.expect(i.LPAREN);let n=[];if(!this.check(i.RPAREN))for(n.push(this.expect(i.IDENT).value);this.check(i.COMMA);)this.advance(),n.push(this.expect(i.IDENT).value);this.expect(i.RPAREN),this.skipNewlines();let r=this.parseBlock();return{name:t,params:n,body:r}}parseRule(){let t;if(this.check(i.BEGIN))this.advance(),t={type:"begin"};else if(this.check(i.END))this.advance(),t={type:"end"};else if(this.check(i.LBRACE))t=void 0;else if(this.check(i.REGEX)){let r=this.advance();if(this.check(i.AND)||this.check(i.OR)){let s={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:r.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(s)}}else{let s={type:"regex_pattern",pattern:r.value};if(this.check(i.COMMA)){this.advance();let a;this.check(i.REGEX)?a={type:"regex_pattern",pattern:this.advance().value}:a={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:a}}else t=s}}else{let s={type:"expr_pattern",expression:this.parseExpression()};if(this.check(i.COMMA)){this.advance();let a;this.check(i.REGEX)?a={type:"regex_pattern",pattern:this.advance().value}:a={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:a}}else t=s}this.skipNewlines();let n;return this.check(i.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(i.LBRACE),this.skipNewlines();let t=[];for(;!this.check(i.RBRACE)&&!this.check(i.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(i.RBRACE),{type:"block",statements:t}}parseStatement(){return this.withDepth(()=>this.parseStatementAtDepth())}parseStatementAtDepth(){if(this.check(i.SEMICOLON)||this.check(i.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(i.LBRACE))return this.parseBlock();if(this.check(i.IF))return this.parseIf();if(this.check(i.WHILE))return this.parseWhile();if(this.check(i.DO))return this.parseDoWhile();if(this.check(i.FOR))return this.parseFor();if(this.check(i.BREAK))return this.advance(),{type:"break"};if(this.check(i.CONTINUE))return this.advance(),{type:"continue"};if(this.check(i.NEXT))return this.advance(),{type:"next"};if(this.check(i.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(i.EXIT)){this.advance();let n;return!this.check(i.NEWLINE)&&!this.check(i.SEMICOLON)&&!this.check(i.RBRACE)&&!this.check(i.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(i.RETURN)){this.advance();let n;return!this.check(i.NEWLINE)&&!this.check(i.SEMICOLON)&&!this.check(i.RBRACE)&&!this.check(i.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(i.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(i.PRINT)?Xe(this):this.check(i.PRINTF)?Ke(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(i.IF),this.expect(i.LPAREN);let t=this.parseExpression();this.expect(i.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let r;return this.check(i.ELSE)&&(this.advance(),this.skipNewlines(),r=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:r}}parseWhile(){this.expect(i.WHILE),this.expect(i.LPAREN);let t=this.parseExpression();this.expect(i.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(i.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(i.WHILE),this.expect(i.LPAREN);let n=this.parseExpression();return this.expect(i.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(i.FOR),this.expect(i.LPAREN),this.check(i.IDENT)){let a=this.advance();if(this.check(i.IN)){this.advance();let o=this.expect(i.IDENT).value;this.expect(i.RPAREN),this.skipNewlines();let l=this.parseStatement();return{type:"for_in",variable:a.value,array:o,body:l}}this.pos--}let t;this.check(i.SEMICOLON)||(t=this.parseExpression()),this.expect(i.SEMICOLON);let n;this.check(i.SEMICOLON)||(n=this.parseExpression()),this.expect(i.SEMICOLON);let r;this.check(i.RPAREN)||(r=this.parseExpression()),this.expect(i.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:r,body:s}}parseExpression(){return this.withDepth(()=>this.parseAssignment())}parseAssignment(){let t=this.parseTernary();if(this.match(i.ASSIGN,i.PLUS_ASSIGN,i.MINUS_ASSIGN,i.STAR_ASSIGN,i.SLASH_ASSIGN,i.PERCENT_ASSIGN,i.CARET_ASSIGN)){let n=this.advance(),r=this.parseExpression();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");let s=new Set(["=","+=","-=","*=","/=","%=","^="]),a=n.value;if(!s.has(a))throw new Error(`Unknown assignment operator: ${a}`);return{type:"assignment",operator:a,target:t,value:r}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(i.QUESTION)){this.advance();let n=this.parseExpression();this.expect(i.COLON);let r=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:r}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(i.PIPE)){if(this.advance(),!this.check(i.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(i.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(i.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(i.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(i.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(i.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(i.IN)){this.advance();let n=this.expect(i.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(i.MATCH,i.NOT_MATCH);){let n=this.advance().type===i.MATCH?"~":"!~",r=this.parseComparison();t={type:"binary",operator:n,left:t,right:r}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(i.LT,i.LE,i.GT,i.GE,i.EQ,i.NE);){let n=this.advance(),r=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}canStartExpression(){return this.match(i.NUMBER,i.STRING,i.IDENT,i.DOLLAR,i.LPAREN,i.NOT,i.MINUS,i.PLUS,i.INCREMENT,i.DECREMENT)}isConcatTerminator(){return this.match(i.AND,i.OR,i.QUESTION,i.ASSIGN,i.PLUS_ASSIGN,i.MINUS_ASSIGN,i.STAR_ASSIGN,i.SLASH_ASSIGN,i.PERCENT_ASSIGN,i.CARET_ASSIGN,i.COMMA,i.SEMICOLON,i.NEWLINE,i.RBRACE,i.RPAREN,i.RBRACKET,i.COLON,i.PIPE,i.APPEND,i.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(i.PLUS,i.MINUS);){let n=this.advance().value,r=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:r}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(i.STAR,i.SLASH,i.PERCENT);){let n=this.advance(),r=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:r}}return t}parseUnary(){if(this.check(i.INCREMENT)){this.advance();let t=this.withDepth(()=>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(i.DECREMENT)){this.advance();let t=this.withDepth(()=>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(i.NOT,i.MINUS,i.PLUS)){let t=this.advance().value,n=this.withDepth(()=>this.parseUnary());return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(i.CARET)){this.advance();let n=this.withDepth(()=>this.parsePower());t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(i.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(i.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(i.INCREMENT)){this.advance();let t=this.withDepth(()=>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(i.DECREMENT)){this.advance();let t=this.withDepth(()=>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(i.NOT,i.MINUS,i.PLUS)){let t=this.advance().value,n=this.withDepth(()=>this.parseFieldIndex());return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(i.CARET)){this.advance();let n=this.withDepth(()=>this.parseFieldIndexPower());t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(i.NUMBER))return{type:"number",value:this.advance().value};if(this.check(i.STRING))return{type:"string",value:this.advance().value};if(this.check(i.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(i.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(i.RPAREN),t}if(this.check(i.IDENT)){let t=this.advance().value;if(this.check(i.LPAREN)){this.advance();let n=[];if(!this.check(i.RPAREN))for(n.push(this.parseExpression());this.check(i.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(i.RPAREN),{type:"call",name:t,args:n}}if(this.check(i.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(i.COMMA)){let r=[n];for(;this.check(i.COMMA);)this.advance(),r.push(this.parseExpression());this.expect(i.RBRACKET);let s=r.reduce((a,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:a,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:s}}return this.expect(i.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(i.NUMBER))return{type:"number",value:this.advance().value};if(this.check(i.STRING))return{type:"string",value:this.advance().value};if(this.check(i.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(i.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(i.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(i.COMMA)){let n=[t];for(;this.check(i.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(i.RPAREN),{type:"tuple",elements:n}}return this.expect(i.RPAREN),t}if(this.check(i.GETLINE)){this.advance();let t,n;return this.check(i.IDENT)&&(t=this.advance().value),this.check(i.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(i.IDENT)){let t=this.advance().value;if(this.check(i.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(i.RPAREN))for(n.push(this.parseExpression());this.check(i.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(i.RPAREN),{type:"call",name:t,args:n}}if(this.check(i.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(i.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(i.RBRACKET);let r;if(n.length===1)r=n[0];else{r=n[0];for(let s=1;s<n.length;s++)r={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:r,right:{type:"variable",name:"SUBSEP"}},right:n[s]}}return{type:"array_access",array:t,key:r}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}};var nn={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"]},mi={name:"awk",async execute(e,t){B(t.requireDefenseContext,"awk","execution entry");let n=(m,y)=>U(t.requireDefenseContext,"awk",m,y);if(Ae(e))return Re(nn);let r=new X(/\s+/),s=" ",a=Object.create(null),o=0;for(let m=0;m<e.length;m++){let y=e[m];if(y==="-F"&&m+1<e.length)s=Se(e[++m]),r=je(s),o=m+1;else if(y.startsWith("-F"))s=Se(y.slice(2)),r=je(s),o=m+1;else if(y==="-v"&&m+1<e.length){let p=e[++m],N=p.indexOf("=");if(N>0){let g=p.slice(0,N),d=Se(p.slice(N+1));a[g]=d}o=m+1}else{if(y.startsWith("--"))return pe("awk",y);if(y.startsWith("-")&&y.length>1){let p=y[1];if(p!=="F"&&p!=="v")return pe("awk",`-${p}`);o=m+1}else if(!y.startsWith("-")){o=m;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program
16
+ `,exitCode:1};let l=e[o],c=e.slice(o+1),u=new ce({maxSourceLength:t.limits.maxStringLength,maxTokens:t.limits.maxAwkParserTokens,maxDepth:t.limits.maxAwkParserDepth,maxOperations:t.limits.maxAwkParserOperations}),f;try{f=u.parse(l)}catch(m){return z(m),{stdout:"",stderr:`awk: ${m instanceof Error?m.message:String(m)}
17
+ `,exitCode:1}}let k={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(m,y)=>{try{let p=await n("appendFile read",()=>t.fs.readFile(m));await n("appendFile write",()=>t.fs.writeFile(m,p+y))}catch(p){if(p instanceof $)throw p;await n("appendFile create",()=>t.fs.writeFile(m,y))}},resolvePath:t.fs.resolvePath.bind(t.fs)},C=t.exec,A=fe({fieldSep:r,maxIterations:t.limits.maxAwkIterations,maxOutputSize:Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),maxArrayElements:t.limits.maxArrayElements,fs:k,cwd:t.cwd,exec:C?m=>n("command pipe exec",()=>C(m,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});A.FS=s,A.vars=Object.assign(Object.create(null),a),A.ARGC=c.length+1,A.ARGV=Object.create(null),A.ARGV[0]="awk";for(let m=0;m<c.length;m++)A.ARGV[String(m+1)]=c[m];A.ENVIRON=Ie(t.env);let T=new J(A);T.execute(f);let he=f.rules.some(m=>m.pattern?.type!=="begin"&&m.pattern?.type!=="end"),W=f.rules.some(m=>m.pattern?.type==="end");try{if(await n("BEGIN execution",()=>T.executeBegin()),A.shouldExit)return await n("END execution after BEGIN exit",()=>T.executeEnd()),{stdout:T.getOutput(),stderr:"",exitCode:T.getExitCode()};if(!he&&!W)return{stdout:T.getOutput(),stderr:"",exitCode:T.getExitCode()};let m=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),y=t.limits.maxArrayElements,p=0,N=async(g,d)=>{let I=V(d);if(I>m-p)throw new w(`aggregate input size limit exceeded (${m} bytes)`,"string_length");p+=I;let x=d.length>0?1:0;for(let Q=0;Q<d.length;Q++)if(d.charCodeAt(Q)===10&&x++,x>y+1)throw new w(`record array limit exceeded (${y})`,"array_elements");let G=d.split(`
18
+ `);if(G.length>0&&G[G.length-1]===""&&G.pop(),G.length>y)throw new w(`record array limit exceeded (${y})`,"array_elements");for(A.FILENAME=g,A.FNR=0,A.lines=G,A.lineIndex=-1,A.shouldNextFile=!1;A.lineIndex<G.length-1;){A.lineIndex++;let Q=A.lineIndex;if(await n("line execution",()=>T.executeLine(G[Q])),A.shouldExit||A.shouldNextFile)break}};if(c.length>0)for(let g of c){let d;try{let I=t.fs.resolvePath(t.cwd,g);if((await n("input file stat",()=>t.fs.stat(I))).size>m-p)throw new w(`aggregate input size limit exceeded (${m} bytes)`,"string_length");d=await n("input file read",()=>t.fs.readFile(I))}catch(I){if(I instanceof $||I instanceof w)throw I;return{stdout:"",stderr:`awk: ${g}: No such file or directory
19
+ `,exitCode:1}}if(await n("input processing",()=>N(g,d)),A.shouldExit)break}else await n("stdin processing",()=>N("",ee(t.stdin)));return await n("END execution",()=>T.executeEnd()),{stdout:T.getOutput(),stderr:"",exitCode:T.getExitCode()}}catch(m){if(m instanceof $)throw m;let y=m instanceof Error?m.message:String(m),p=m instanceof w?w.EXIT_CODE:2;return{stdout:T.getOutput(),stderr:`awk: ${y}
20
+ `,exitCode:p}}}};function Se(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 je(e){if(e===" ")return O("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return O(e)}catch{return O(qe(e))}return O(qe(e))}function qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ni={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{mi as a,Ni as b};
@@ -0,0 +1,11 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{d as g}from"./chunk-GN6CQ3J4.js";import{a as b,b as m,c as v}from"./chunk-QAYAQNCG.js";var L={name:"unexpand",summary:"convert spaces to tabs",usage:"unexpand [OPTION]... [FILE]...",description:"Convert blanks in each FILE to TABs, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-a Convert all sequences of blanks (not just leading)"],examples:["unexpand file.txt # Convert leading spaces to tabs","unexpand -a file.txt # Convert all space sequences","unexpand -t 4 file.txt # Use 4-space tabs"]};function f(s){let i=s.split(",").map(o=>o.trim()),e=[];for(let o of i){let n=parseInt(o,10);if(Number.isNaN(n)||n<1)return null;e.push(n)}for(let o=1;o<e.length;o++)if(e[o]<=e[o-1])return null;return e}function C(s,i){if(i.length===1){let e=i[0];return s+(e-s%e)}for(let e of i)if(e>s)return e;if(i.length>=2){let e=i[i.length-1]-i[i.length-2],o=i[i.length-1],n=Math.floor((s-o)/e)+1;return o+n*e}return-1}function N(s,i){let{tabStops:e,allBlanks:o}=i,n="",a=0,t="",l=0,u=!0,d=()=>{if(t.length===0)return;let r=l+t.length;if(!o&&!u){n+=t,t="";return}let p=l,c="";for(;p<r;){let h=C(p,e);if(h<=r&&h>p)c+=" ",p=h;else break}let x=r-p;x>0&&(c+=" ".repeat(x)),n+=c,t=""};for(let r of s)r===" "?(t.length===0&&(l=a),t+=r,a++):r===" "?(d(),n+=r,a=C(a,e)):(d(),n+=r,a++,u=!1);return d(),n}function k(s,i){if(s==="")return"";let e=s.split(`
3
+ `),o=s.endsWith(`
4
+ `)&&e[e.length-1]==="";return o&&e.pop(),e.map(a=>N(a,i)).join(`
5
+ `)+(o?`
6
+ `:"")}var I={name:"unexpand",execute:async(s,i)=>{if(m(s))return b(L);let e={tabStops:[8],allBlanks:!1},o=[],n=0;for(;n<s.length;){let t=s[n];if(t==="-t"&&n+1<s.length){let l=f(s[n+1]);if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${s[n+1]}'
7
+ `};e.tabStops=l,n+=2}else if(t.startsWith("-t")&&t.length>2){let l=f(t.slice(2));if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${t.slice(2)}'
8
+ `};e.tabStops=l,n++}else if(t==="--tabs"&&n+1<s.length){let l=f(s[n+1]);if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${s[n+1]}'
9
+ `};e.tabStops=l,n+=2}else if(t.startsWith("--tabs=")){let l=f(t.slice(7));if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${t.slice(7)}'
10
+ `};e.tabStops=l,n++}else if(t==="-a"||t==="--all")e.allBlanks=!0,n++;else if(t==="--"){o.push(...s.slice(n+1));break}else{if(t.startsWith("-")&&t!=="-")return v("unexpand",t);o.push(t),n++}}let a="";if(o.length===0){let t=g(i.stdin)??"";a=k(t,e)}else for(let t of o){let l=i.fs.resolvePath(i.cwd,t),u=await i.fs.readFile(l);if(u===null)return{exitCode:1,stdout:a,stderr:`unexpand: ${t}: No such file or directory
11
+ `};a+=k(u,e)}return{exitCode:0,stdout:a,stderr:""}}},T={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0};export{I as a,T as b};