@jerryan/just-bash 3.9.0 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +2 -2
  3. package/dist/AGENTS.md +2 -2
  4. package/dist/abort-signals.d.ts +10 -0
  5. package/dist/bin/chunks/awk2-LCV2AUIX.js +3 -0
  6. package/dist/bin/{shell/chunks/base64-TQ5KOCNW.js → chunks/base64-OLYCF2PC.js} +1 -1
  7. package/dist/bin/chunks/builtin-manifest-ORBIZM7I.js +3 -0
  8. package/dist/bin/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
  9. package/dist/bin/{shell/chunks/chmod-GX5SYTRL.js → chunks/chmod-V5F4BXZ2.js} +1 -1
  10. package/dist/bin/{shell/chunks/chunk-V4S4A7M6.js → chunks/chunk-2TEF4USR.js} +1 -1
  11. package/dist/bin/{shell/chunks/chunk-GBKR5KTT.js → chunks/chunk-3ASHUC7C.js} +13 -13
  12. package/dist/bin/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
  13. package/dist/bin/chunks/chunk-4NYJ4ZTO.js +17 -0
  14. package/dist/bin/chunks/{chunk-M3Z5NZXT.js → chunk-572NXISH.js} +1 -1
  15. package/dist/bin/chunks/chunk-5NWK7A4R.js +13 -0
  16. package/dist/bin/{shell/chunks/chunk-YXPSX3SI.js → chunks/chunk-623Q77WZ.js} +1 -1
  17. package/dist/bin/chunks/chunk-6NG4ULJM.js +7 -0
  18. package/dist/bin/{shell/chunks/chunk-QFOXSCOD.js → chunks/chunk-726WDFMQ.js} +1 -1
  19. package/dist/bin/chunks/{chunk-DRPHNXG7.js → chunk-7LGT4LHQ.js} +1 -1
  20. package/dist/bin/chunks/{chunk-MBREBDZQ.js → chunk-AIWBN36Z.js} +1 -1
  21. package/dist/bin/chunks/{chunk-3ROYEBJI.js → chunk-AJ3CSZ34.js} +1 -1
  22. package/dist/bin/{shell/chunks/chunk-VTAMGD42.js → chunks/chunk-APEQNYAO.js} +1 -1
  23. package/dist/bin/chunks/chunk-AQKIHX3Q.js +3 -0
  24. package/dist/bin/chunks/chunk-BFLKIASG.js +7 -0
  25. package/dist/bin/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
  26. package/dist/bin/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
  27. package/dist/bin/chunks/{chunk-T6OIISUC.js → chunk-BZJ77YQD.js} +1 -1
  28. package/dist/bin/{shell/chunks/chunk-GR4ZHKXI.js → chunks/chunk-C2BLJ3AE.js} +1 -1
  29. package/dist/bin/{shell/chunks/chunk-KMYJMEON.js → chunks/chunk-C45GTJTD.js} +1 -1
  30. package/dist/bin/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
  31. package/dist/bin/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
  32. package/dist/bin/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
  33. package/dist/bin/{shell/chunks/chunk-E54Z6VIE.js → chunks/chunk-ERYPQAZE.js} +5 -5
  34. package/dist/bin/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
  35. package/dist/bin/chunks/chunk-HFVQCXYX.js +10 -0
  36. package/dist/bin/chunks/chunk-HSWCKN2X.js +14 -0
  37. package/dist/bin/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
  38. package/dist/bin/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
  39. package/dist/bin/chunks/chunk-IX6QY5JW.js +5 -0
  40. package/dist/bin/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
  41. package/dist/bin/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
  42. package/dist/bin/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
  43. package/dist/bin/chunks/{chunk-6JEDM6CZ.js → chunk-KH6YLKPE.js} +1 -1
  44. package/dist/bin/chunks/chunk-KXSDVBJA.js +12 -0
  45. package/dist/bin/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
  46. package/dist/bin/chunks/{chunk-L345YZ6R.js → chunk-LVT5R45K.js} +1 -1
  47. package/dist/bin/chunks/{chunk-PTUQEN6I.js → chunk-M345X45Z.js} +7 -7
  48. package/dist/bin/chunks/{chunk-6FGMEZZP.js → chunk-NDS7PYKD.js} +1 -1
  49. package/dist/bin/chunks/chunk-O3PNT72D.js +3 -0
  50. package/dist/bin/chunks/chunk-OGOISDGZ.js +3 -0
  51. package/dist/bin/chunks/chunk-OSW4MDDH.js +21 -0
  52. package/dist/bin/{shell/chunks/chunk-ABP4OLJV.js → chunks/chunk-OXEDIWNZ.js} +1 -1
  53. package/dist/bin/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
  54. package/dist/bin/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
  55. package/dist/bin/chunks/{chunk-O2BCKSMK.js → chunk-PEJXCXSY.js} +1 -1
  56. package/dist/bin/{shell/chunks/chunk-6KHZX4HU.js → chunks/chunk-PLLMJHMV.js} +1 -1
  57. package/dist/bin/{shell/chunks/chunk-6TUILMPB.js → chunks/chunk-QELDDRV5.js} +1 -1
  58. package/dist/bin/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
  59. package/dist/bin/{shell/chunks/chunk-H7PD6FLC.js → chunks/chunk-RE7Z53A3.js} +1 -1
  60. package/dist/bin/chunks/chunk-SCQRBEQW.js +275 -0
  61. package/dist/bin/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
  62. package/dist/bin/{shell/chunks/chunk-CC2AQ6B7.js → chunks/chunk-U6JTVQU6.js} +1 -1
  63. package/dist/bin/chunks/chunk-UBA7DOWE.js +3 -0
  64. package/dist/bin/chunks/{chunk-VPSBWWXM.js → chunk-UFAYH3WW.js} +7 -6
  65. package/dist/bin/chunks/chunk-UPUFWGHR.js +3 -0
  66. package/dist/bin/{shell/chunks/chunk-QJWFCA7P.js → chunks/chunk-UU42WPB7.js} +1 -1
  67. package/dist/bin/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
  68. package/dist/bin/chunks/chunk-VMVXACZ5.js +6 -0
  69. package/dist/bin/chunks/chunk-WLQ2KWS3.js +10 -0
  70. package/dist/bin/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
  71. package/dist/bin/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
  72. package/dist/bin/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
  73. package/dist/bin/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
  74. package/dist/bin/chunks/{cp-YLP7ULVT.js → cp-XJWV46T5.js} +1 -1
  75. package/dist/bin/{shell/chunks/curl-NHNZ46BU.js → chunks/curl-HZ5SBTVY.js} +11 -11
  76. package/dist/bin/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
  77. package/dist/bin/{shell/chunks/diff-DM47S5PT.js → chunks/diff-YLVT27CZ.js} +1 -1
  78. package/dist/bin/chunks/dist-4NZ74CRE.js +141 -0
  79. package/dist/bin/chunks/{du-DH76GZJ3.js → du-YNAJTGCR.js} +1 -1
  80. package/dist/bin/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
  81. package/dist/bin/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
  82. package/dist/bin/chunks/find-3QDGII35.js +3 -0
  83. package/dist/bin/chunks/flag-coverage-AGEO3F6X.js +3 -0
  84. package/dist/bin/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
  85. package/dist/bin/chunks/{gzip-UQZL4R74.js → gzip-W5CL2E2W.js} +1 -1
  86. package/dist/bin/{shell/chunks/head-QKVY3SIO.js → chunks/head-ABLEKDMV.js} +1 -1
  87. package/dist/bin/{shell/chunks/help-HVIDHJ6M.js → chunks/help-EXVKU23F.js} +1 -1
  88. package/dist/bin/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
  89. package/dist/bin/{shell/chunks/jq-YS4PR46D.js → chunks/jq-5SOTL7D7.js} +1 -1
  90. package/dist/bin/chunks/{js-exec-ZAAIZQWI.js → js-exec-LISDW7YC.js} +2 -2
  91. package/dist/bin/chunks/js-exec-worker.js +1 -0
  92. package/dist/bin/chunks/{ls-5Z45FV4U.js → ls-EEX3YIOF.js} +1 -1
  93. package/dist/bin/chunks/mkdir-KDEZTR53.js +3 -0
  94. package/dist/bin/chunks/mktemp-OYQYUB5H.js +3 -0
  95. package/dist/bin/{shell/chunks/mv-EOOP2TO3.js → chunks/mv-35V6IA5V.js} +1 -1
  96. package/dist/bin/{shell/chunks/od-2GXD4D5K.js → chunks/od-TD5LZDUM.js} +1 -1
  97. package/dist/bin/{shell/chunks/paste-DWWA3JTW.js → chunks/paste-QJG6BYAP.js} +1 -1
  98. package/dist/bin/chunks/{python3-TJ6DCPIA.js → python3-P6MZ44HK.js} +5 -5
  99. package/dist/bin/{shell/chunks/readlink-EJ3IKLWW.js → chunks/readlink-BF435HNQ.js} +1 -1
  100. package/dist/bin/chunks/rg-B2DVJQVY.js +3 -0
  101. package/dist/bin/chunks/rm-HCMKNRM2.js +3 -0
  102. package/dist/bin/{shell/chunks/rmdir-PRNISPBA.js → chunks/rmdir-WGVUYGPF.js} +1 -1
  103. package/dist/bin/{shell/chunks/sed-SY63U2YX.js → chunks/sed-66XZQ75T.js} +1 -1
  104. package/dist/bin/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
  105. package/dist/bin/chunks/{sleep-MOJQBZMY.js → sleep-4O22Z4DI.js} +1 -1
  106. package/dist/bin/{shell/chunks/split-HIFKSV2A.js → chunks/split-OK6JHDWZ.js} +1 -1
  107. package/dist/bin/chunks/sqlite3-57ACN7ES.js +3 -0
  108. package/dist/bin/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
  109. package/dist/bin/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
  110. package/dist/bin/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
  111. package/dist/bin/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
  112. package/dist/bin/chunks/timeout-XMTXHNFF.js +3 -0
  113. package/dist/bin/{shell/chunks/tr-PVFO6FRY.js → chunks/tr-ETPC3LHV.js} +1 -1
  114. package/dist/bin/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
  115. package/dist/bin/chunks/worker.js +5 -0
  116. package/dist/bin/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
  117. package/dist/bin/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
  118. package/dist/bin/chunks/yes-2EQTNSIB.js +3 -0
  119. package/dist/bin/chunks/yq-T6S3IDKY.js +3 -0
  120. package/dist/bin/just-bash.js +299 -293
  121. package/dist/bin/shell/chunks/awk2-LCV2AUIX.js +3 -0
  122. package/dist/bin/{chunks/base64-TQ5KOCNW.js → shell/chunks/base64-OLYCF2PC.js} +1 -1
  123. package/dist/bin/shell/chunks/builtin-manifest-ORBIZM7I.js +3 -0
  124. package/dist/bin/shell/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
  125. package/dist/bin/{chunks/chmod-GX5SYTRL.js → shell/chunks/chmod-V5F4BXZ2.js} +1 -1
  126. package/dist/bin/{chunks/chunk-V4S4A7M6.js → shell/chunks/chunk-2TEF4USR.js} +1 -1
  127. package/dist/bin/{chunks/chunk-GBKR5KTT.js → shell/chunks/chunk-3ASHUC7C.js} +13 -13
  128. package/dist/bin/shell/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
  129. package/dist/bin/shell/chunks/chunk-4NYJ4ZTO.js +17 -0
  130. package/dist/bin/shell/chunks/{chunk-M3Z5NZXT.js → chunk-572NXISH.js} +1 -1
  131. package/dist/bin/shell/chunks/chunk-5NWK7A4R.js +13 -0
  132. package/dist/bin/{chunks/chunk-YXPSX3SI.js → shell/chunks/chunk-623Q77WZ.js} +1 -1
  133. package/dist/bin/shell/chunks/chunk-6NG4ULJM.js +7 -0
  134. package/dist/bin/{chunks/chunk-QFOXSCOD.js → shell/chunks/chunk-726WDFMQ.js} +1 -1
  135. package/dist/bin/shell/chunks/{chunk-DRPHNXG7.js → chunk-7LGT4LHQ.js} +1 -1
  136. package/dist/bin/shell/chunks/{chunk-MBREBDZQ.js → chunk-AIWBN36Z.js} +1 -1
  137. package/dist/bin/shell/chunks/{chunk-3ROYEBJI.js → chunk-AJ3CSZ34.js} +1 -1
  138. package/dist/bin/{chunks/chunk-VTAMGD42.js → shell/chunks/chunk-APEQNYAO.js} +1 -1
  139. package/dist/bin/shell/chunks/chunk-AQKIHX3Q.js +3 -0
  140. package/dist/bin/shell/chunks/chunk-BFLKIASG.js +7 -0
  141. package/dist/bin/shell/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
  142. package/dist/bin/shell/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
  143. package/dist/bin/shell/chunks/{chunk-T6OIISUC.js → chunk-BZJ77YQD.js} +1 -1
  144. package/dist/bin/{chunks/chunk-GR4ZHKXI.js → shell/chunks/chunk-C2BLJ3AE.js} +1 -1
  145. package/dist/bin/{chunks/chunk-KMYJMEON.js → shell/chunks/chunk-C45GTJTD.js} +1 -1
  146. package/dist/bin/shell/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
  147. package/dist/bin/shell/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
  148. package/dist/bin/shell/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
  149. package/dist/bin/{chunks/chunk-E54Z6VIE.js → shell/chunks/chunk-ERYPQAZE.js} +5 -5
  150. package/dist/bin/shell/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
  151. package/dist/bin/shell/chunks/chunk-HFVQCXYX.js +10 -0
  152. package/dist/bin/shell/chunks/chunk-HSWCKN2X.js +14 -0
  153. package/dist/bin/shell/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
  154. package/dist/bin/shell/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
  155. package/dist/bin/shell/chunks/chunk-IX6QY5JW.js +5 -0
  156. package/dist/bin/shell/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
  157. package/dist/bin/shell/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
  158. package/dist/bin/shell/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
  159. package/dist/bin/shell/chunks/{chunk-6JEDM6CZ.js → chunk-KH6YLKPE.js} +1 -1
  160. package/dist/bin/shell/chunks/chunk-KXSDVBJA.js +12 -0
  161. package/dist/bin/shell/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
  162. package/dist/bin/shell/chunks/{chunk-L345YZ6R.js → chunk-LVT5R45K.js} +1 -1
  163. package/dist/bin/shell/chunks/{chunk-PTUQEN6I.js → chunk-M345X45Z.js} +7 -7
  164. package/dist/bin/shell/chunks/{chunk-6FGMEZZP.js → chunk-NDS7PYKD.js} +1 -1
  165. package/dist/bin/shell/chunks/chunk-O3PNT72D.js +3 -0
  166. package/dist/bin/shell/chunks/chunk-OGOISDGZ.js +3 -0
  167. package/dist/bin/shell/chunks/chunk-OSW4MDDH.js +21 -0
  168. package/dist/bin/{chunks/chunk-ABP4OLJV.js → shell/chunks/chunk-OXEDIWNZ.js} +1 -1
  169. package/dist/bin/shell/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
  170. package/dist/bin/shell/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
  171. package/dist/bin/shell/chunks/{chunk-O2BCKSMK.js → chunk-PEJXCXSY.js} +1 -1
  172. package/dist/bin/{chunks/chunk-6KHZX4HU.js → shell/chunks/chunk-PLLMJHMV.js} +1 -1
  173. package/dist/bin/{chunks/chunk-6TUILMPB.js → shell/chunks/chunk-QELDDRV5.js} +1 -1
  174. package/dist/bin/shell/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
  175. package/dist/bin/{chunks/chunk-H7PD6FLC.js → shell/chunks/chunk-RE7Z53A3.js} +1 -1
  176. package/dist/bin/shell/chunks/chunk-SCQRBEQW.js +275 -0
  177. package/dist/bin/shell/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
  178. package/dist/bin/{chunks/chunk-CC2AQ6B7.js → shell/chunks/chunk-U6JTVQU6.js} +1 -1
  179. package/dist/bin/shell/chunks/chunk-UBA7DOWE.js +3 -0
  180. package/dist/bin/shell/chunks/{chunk-VPSBWWXM.js → chunk-UFAYH3WW.js} +7 -6
  181. package/dist/bin/shell/chunks/chunk-UPUFWGHR.js +3 -0
  182. package/dist/bin/{chunks/chunk-QJWFCA7P.js → shell/chunks/chunk-UU42WPB7.js} +1 -1
  183. package/dist/bin/shell/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
  184. package/dist/bin/shell/chunks/chunk-VMVXACZ5.js +6 -0
  185. package/dist/bin/shell/chunks/chunk-WLQ2KWS3.js +10 -0
  186. package/dist/bin/shell/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
  187. package/dist/bin/shell/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
  188. package/dist/bin/shell/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
  189. package/dist/bin/shell/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
  190. package/dist/bin/shell/chunks/{cp-YLP7ULVT.js → cp-XJWV46T5.js} +1 -1
  191. package/dist/bin/{chunks/curl-NHNZ46BU.js → shell/chunks/curl-HZ5SBTVY.js} +11 -11
  192. package/dist/bin/shell/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
  193. package/dist/bin/{chunks/diff-DM47S5PT.js → shell/chunks/diff-YLVT27CZ.js} +1 -1
  194. package/dist/bin/shell/chunks/dist-4NZ74CRE.js +141 -0
  195. package/dist/bin/shell/chunks/{du-DH76GZJ3.js → du-YNAJTGCR.js} +1 -1
  196. package/dist/bin/shell/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
  197. package/dist/bin/shell/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
  198. package/dist/bin/shell/chunks/find-3QDGII35.js +3 -0
  199. package/dist/bin/shell/chunks/flag-coverage-AGEO3F6X.js +3 -0
  200. package/dist/bin/shell/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
  201. package/dist/bin/shell/chunks/{gzip-UQZL4R74.js → gzip-W5CL2E2W.js} +1 -1
  202. package/dist/bin/{chunks/head-QKVY3SIO.js → shell/chunks/head-ABLEKDMV.js} +1 -1
  203. package/dist/bin/{chunks/help-HVIDHJ6M.js → shell/chunks/help-EXVKU23F.js} +1 -1
  204. package/dist/bin/shell/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
  205. package/dist/bin/{chunks/jq-YS4PR46D.js → shell/chunks/jq-5SOTL7D7.js} +1 -1
  206. package/dist/bin/shell/chunks/{js-exec-ZAAIZQWI.js → js-exec-LISDW7YC.js} +2 -2
  207. package/dist/bin/shell/chunks/{ls-5Z45FV4U.js → ls-EEX3YIOF.js} +1 -1
  208. package/dist/bin/shell/chunks/mkdir-KDEZTR53.js +3 -0
  209. package/dist/bin/shell/chunks/mktemp-OYQYUB5H.js +3 -0
  210. package/dist/bin/{chunks/mv-EOOP2TO3.js → shell/chunks/mv-35V6IA5V.js} +1 -1
  211. package/dist/bin/{chunks/od-2GXD4D5K.js → shell/chunks/od-TD5LZDUM.js} +1 -1
  212. package/dist/bin/{chunks/paste-DWWA3JTW.js → shell/chunks/paste-QJG6BYAP.js} +1 -1
  213. package/dist/bin/shell/chunks/{python3-TJ6DCPIA.js → python3-P6MZ44HK.js} +5 -5
  214. package/dist/bin/{chunks/readlink-EJ3IKLWW.js → shell/chunks/readlink-BF435HNQ.js} +1 -1
  215. package/dist/bin/shell/chunks/rg-B2DVJQVY.js +3 -0
  216. package/dist/bin/shell/chunks/rm-HCMKNRM2.js +3 -0
  217. package/dist/bin/{chunks/rmdir-PRNISPBA.js → shell/chunks/rmdir-WGVUYGPF.js} +1 -1
  218. package/dist/bin/{chunks/sed-SY63U2YX.js → shell/chunks/sed-66XZQ75T.js} +1 -1
  219. package/dist/bin/shell/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
  220. package/dist/bin/shell/chunks/{sleep-MOJQBZMY.js → sleep-4O22Z4DI.js} +1 -1
  221. package/dist/bin/{chunks/split-HIFKSV2A.js → shell/chunks/split-OK6JHDWZ.js} +1 -1
  222. package/dist/bin/shell/chunks/sqlite3-57ACN7ES.js +3 -0
  223. package/dist/bin/shell/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
  224. package/dist/bin/shell/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
  225. package/dist/bin/shell/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
  226. package/dist/bin/shell/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
  227. package/dist/bin/shell/chunks/timeout-XMTXHNFF.js +3 -0
  228. package/dist/bin/{chunks/tr-PVFO6FRY.js → shell/chunks/tr-ETPC3LHV.js} +1 -1
  229. package/dist/bin/shell/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
  230. package/dist/bin/shell/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
  231. package/dist/bin/shell/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
  232. package/dist/bin/shell/chunks/yes-2EQTNSIB.js +3 -0
  233. package/dist/bin/shell/chunks/yq-T6S3IDKY.js +3 -0
  234. package/dist/bin/shell/shell.js +369 -363
  235. package/dist/browser.d.ts +1 -1
  236. package/dist/bundle/browser.js +746 -726
  237. package/dist/bundle/chunks/awk2-TLK6FCHV.js +2 -0
  238. package/dist/bundle/chunks/{base64-MHVQ5XHI.js → base64-GUZMZ645.js} +1 -1
  239. package/dist/bundle/chunks/builtin-manifest-7MJJDZ2T.js +2 -0
  240. package/dist/bundle/chunks/{cat-VZBWBIJB.js → cat-LG4YGKUE.js} +1 -1
  241. package/dist/bundle/chunks/{chmod-TEY5MD2W.js → chmod-XUKPG2M4.js} +1 -1
  242. package/dist/bundle/chunks/{chunk-E2F4A3CM.js → chunk-2A4OZBCS.js} +5 -5
  243. package/dist/bundle/chunks/{chunk-WNH3HOQA.js → chunk-353VO5TF.js} +1 -1
  244. package/dist/bundle/chunks/chunk-37UJACD6.js +9 -0
  245. package/dist/bundle/chunks/{chunk-H3A45X3W.js → chunk-3LGQ6XEC.js} +1 -1
  246. package/dist/bundle/chunks/{chunk-P57S6Z6R.js → chunk-3ZY5QX3G.js} +1 -1
  247. package/dist/bundle/chunks/{chunk-45QZRGYF.js → chunk-4VU4IF3W.js} +7 -6
  248. package/dist/bundle/chunks/{chunk-SIOONII3.js → chunk-52W2IWA7.js} +1 -1
  249. package/dist/bundle/chunks/chunk-5IB57TIJ.js +274 -0
  250. package/dist/bundle/chunks/chunk-5J4S2LP5.js +2 -0
  251. package/dist/bundle/chunks/{chunk-PCPW54JH.js → chunk-5LDRJ22P.js} +1 -1
  252. package/dist/bundle/chunks/{chunk-BKUWXPEM.js → chunk-654CJKE3.js} +1 -1
  253. package/dist/bundle/chunks/{chunk-EZNS4GF7.js → chunk-67ODVGSB.js} +1 -1
  254. package/dist/bundle/chunks/{chunk-6QF3PCMO.js → chunk-6HQQON3N.js} +1 -1
  255. package/dist/bundle/chunks/chunk-6L6OYVLY.js +2 -0
  256. package/dist/bundle/chunks/{chunk-U57DSHID.js → chunk-6P2DITXT.js} +1 -1
  257. package/dist/bundle/chunks/chunk-74IR77AZ.js +11 -0
  258. package/dist/bundle/chunks/{chunk-S3ENGQML.js → chunk-7DVD6YCI.js} +1 -1
  259. package/dist/bundle/chunks/{chunk-HXWB4Z5X.js → chunk-7II7XIVI.js} +1 -1
  260. package/dist/bundle/chunks/{chunk-AYSZ5MAE.js → chunk-A3C4Z3Q3.js} +1 -1
  261. package/dist/bundle/chunks/chunk-A6SU3BZX.js +6 -0
  262. package/dist/bundle/chunks/{chunk-6HO6HX7V.js → chunk-AMXNXHXK.js} +1 -1
  263. package/dist/bundle/chunks/{chunk-QJ7OXJAZ.js → chunk-BLG7RWH4.js} +1 -1
  264. package/dist/bundle/chunks/chunk-BMBITA6Y.js +2 -0
  265. package/dist/bundle/chunks/{chunk-XQ2ZZFO6.js → chunk-BQTWRHZR.js} +2 -2
  266. package/dist/bundle/chunks/{chunk-WE7BJ7YU.js → chunk-BZ2OMW2T.js} +1 -1
  267. package/dist/bundle/chunks/{chunk-S6DNKKUL.js → chunk-CM4T4GB4.js} +1 -1
  268. package/dist/bundle/chunks/{chunk-CH7SUFFO.js → chunk-CORCIYJD.js} +1 -1
  269. package/dist/bundle/chunks/{chunk-LGIJSCWH.js → chunk-EQDVNHQS.js} +1 -1
  270. package/dist/bundle/chunks/{chunk-U4K5ZDWK.js → chunk-EZEO6MFE.js} +1 -1
  271. package/dist/bundle/chunks/{chunk-SE23TEGG.js → chunk-EZT6M2HG.js} +1 -1
  272. package/dist/bundle/chunks/{chunk-4MJ7VJG4.js → chunk-H7UVJSZR.js} +1 -1
  273. package/dist/bundle/chunks/{chunk-5EI7WSRV.js → chunk-HYQGYXGZ.js} +1 -1
  274. package/dist/bundle/chunks/{chunk-6IA4DXG2.js → chunk-IPKSYZ3R.js} +1 -1
  275. package/dist/bundle/chunks/{chunk-TLPMB3FO.js → chunk-KJBPGFZD.js} +1 -1
  276. package/dist/bundle/chunks/chunk-L7NEGEOJ.js +16 -0
  277. package/dist/bundle/chunks/{chunk-YFFU74KY.js → chunk-MJEJ7QEY.js} +1 -1
  278. package/dist/bundle/chunks/{chunk-QJFYYEFV.js → chunk-N36I27VM.js} +1 -1
  279. package/dist/bundle/chunks/chunk-N5L7E4EL.js +6 -0
  280. package/dist/bundle/chunks/{chunk-6QAM55HM.js → chunk-NFODJFHN.js} +1 -1
  281. package/dist/bundle/chunks/{chunk-IXFQXNL4.js → chunk-NFW4YKDO.js} +1 -1
  282. package/dist/bundle/chunks/{chunk-HCKTU6IR.js → chunk-NOX3PCUH.js} +1 -1
  283. package/dist/bundle/chunks/{chunk-MQKGGNPS.js → chunk-NXBUT5V2.js} +2 -2
  284. package/dist/bundle/chunks/{chunk-4KZT23KR.js → chunk-O5BHWBYH.js} +1 -1
  285. package/dist/bundle/chunks/{chunk-DVSA72LH.js → chunk-QTL2XC4B.js} +1 -1
  286. package/dist/bundle/chunks/chunk-RK2WBVP4.js +2 -0
  287. package/dist/bundle/chunks/{chunk-BLPYR4TN.js → chunk-RVBBGZ22.js} +1 -1
  288. package/dist/bundle/chunks/{chunk-PS2RJNZZ.js → chunk-SXQJYLP7.js} +1 -1
  289. package/dist/bundle/chunks/{chunk-MWL2I5BV.js → chunk-T7OAZEXT.js} +1 -1
  290. package/dist/bundle/chunks/{chunk-O452S4KX.js → chunk-URIKBXSE.js} +1 -1
  291. package/dist/bundle/chunks/{chunk-6BSOPPZH.js → chunk-UVQC75LS.js} +7 -7
  292. package/dist/bundle/chunks/chunk-VCREDMWH.js +4 -0
  293. package/dist/bundle/chunks/{chunk-DDPD7SIB.js → chunk-VQ6EUBJ3.js} +1 -1
  294. package/dist/bundle/chunks/chunk-VQEB6E2M.js +13 -0
  295. package/dist/bundle/chunks/{chunk-R2FBRMDU.js → chunk-VWUMR4IC.js} +1 -1
  296. package/dist/bundle/chunks/{chunk-XXBIOG4R.js → chunk-WDY2TNMK.js} +1 -1
  297. package/dist/bundle/chunks/chunk-XT7EK6BR.js +9 -0
  298. package/dist/bundle/chunks/{chunk-BS6EJR2R.js → chunk-XUTEQMTL.js} +5 -5
  299. package/dist/bundle/chunks/{chunk-KIGPB52X.js → chunk-XZ34OGNM.js} +1 -1
  300. package/dist/bundle/chunks/{chunk-FSKXIFYT.js → chunk-Y6UHNLT5.js} +1 -1
  301. package/dist/bundle/chunks/chunk-YUITEK6N.js +12 -0
  302. package/dist/bundle/chunks/chunk-YZCPEJRE.js +20 -0
  303. package/dist/bundle/chunks/chunk-ZIQS5QAW.js +5 -0
  304. package/dist/bundle/chunks/chunk-ZUEPJPYA.js +2 -0
  305. package/dist/bundle/chunks/{column-QJI65SH2.js → column-T4LGMRJG.js} +1 -1
  306. package/dist/bundle/chunks/{cp-UR762VVT.js → cp-ZDDVNITX.js} +1 -1
  307. package/dist/bundle/chunks/{curl-K4WT7UPN.js → curl-RCRD36LD.js} +11 -11
  308. package/dist/bundle/chunks/{cut-FMDNVWQN.js → cut-35WER2E2.js} +1 -1
  309. package/dist/bundle/chunks/{diff-R7TXVVLN.js → diff-Z3XOLW44.js} +1 -1
  310. package/dist/bundle/chunks/{du-EQKH3UNA.js → du-YBSJVBXP.js} +1 -1
  311. package/dist/bundle/chunks/{expr-A5XITHQD.js → expr-KSNRNE7V.js} +1 -1
  312. package/dist/bundle/chunks/{file-6AYYTULJ.js → file-XH37HMGV.js} +1 -1
  313. package/dist/bundle/chunks/find-3AONTPPM.js +2 -0
  314. package/dist/bundle/chunks/flag-coverage-6YGO7STE.js +2 -0
  315. package/dist/bundle/chunks/{grep-Q2O5EIXQ.js → grep-WW5KJPUG.js} +1 -1
  316. package/dist/bundle/chunks/{gzip-KC5ENBD2.js → gzip-ISZXQNJJ.js} +1 -1
  317. package/dist/bundle/chunks/{head-6UIPFWVJ.js → head-VYXZQLPZ.js} +1 -1
  318. package/dist/bundle/chunks/{help-QDDMBDU7.js → help-62M75TSG.js} +1 -1
  319. package/dist/bundle/chunks/{html-to-markdown-PE6BPRPA.js → html-to-markdown-4LXS3A44.js} +1 -1
  320. package/dist/bundle/chunks/{jq-UKAA3QWU.js → jq-3IVOWP3G.js} +1 -1
  321. package/dist/bundle/chunks/{js-exec-MUZRDUJ3.js → js-exec-T2WEE4KG.js} +2 -2
  322. package/dist/bundle/chunks/js-exec-worker.js +1 -0
  323. package/dist/bundle/chunks/{ls-WH5S4PPL.js → ls-FC3CSHKE.js} +1 -1
  324. package/dist/bundle/chunks/mkdir-DPFWDY25.js +2 -0
  325. package/dist/bundle/chunks/mktemp-SW2AHXZW.js +2 -0
  326. package/dist/bundle/chunks/{mv-WE7DBLEK.js → mv-PWCFXEF2.js} +1 -1
  327. package/dist/bundle/chunks/{od-Z4AIL3P4.js → od-VJ6PBBEI.js} +1 -1
  328. package/dist/bundle/chunks/{paste-ZNHNSRBW.js → paste-TIQETHSO.js} +1 -1
  329. package/dist/bundle/chunks/{python3-W4UMQJAQ.js → python3-6JEP7ZZK.js} +5 -5
  330. package/dist/bundle/chunks/{readlink-JSRKXLLQ.js → readlink-7XGQ3PL7.js} +1 -1
  331. package/dist/bundle/chunks/rg-2OPJ5V3D.js +2 -0
  332. package/dist/bundle/chunks/rm-AZZM5DCE.js +2 -0
  333. package/dist/bundle/chunks/{rmdir-3WTXMVKI.js → rmdir-YXYSZD4X.js} +1 -1
  334. package/dist/bundle/chunks/{sed-6G32B25J.js → sed-HYSBLGO5.js} +1 -1
  335. package/dist/bundle/chunks/{seq-B6KDLMYQ.js → seq-M2S4FRN4.js} +1 -1
  336. package/dist/bundle/chunks/{sleep-25QUPVDK.js → sleep-YC4HFEGC.js} +1 -1
  337. package/dist/bundle/chunks/{split-HUKVGJTW.js → split-UOPIWKKE.js} +1 -1
  338. package/dist/bundle/chunks/sqlite3-XCROTL6G.js +2 -0
  339. package/dist/bundle/chunks/{stat-LXFZND2P.js → stat-I3FPUTR7.js} +1 -1
  340. package/dist/bundle/chunks/{tail-UBGSN4JF.js → tail-WK3WACZK.js} +1 -1
  341. package/dist/bundle/chunks/{tar-LE7LAAIX.js → tar-VZYMNZV2.js} +1 -1
  342. package/dist/bundle/chunks/{time-NERE2JJ2.js → time-N6J6DC6C.js} +1 -1
  343. package/dist/bundle/chunks/timeout-UDR5J2MP.js +2 -0
  344. package/dist/bundle/chunks/{tr-UI2LA3GA.js → tr-VI5PIA4A.js} +1 -1
  345. package/dist/bundle/chunks/{which-UWVKETYW.js → which-BP5YY5BR.js} +1 -1
  346. package/dist/bundle/chunks/worker.js +5 -0
  347. package/dist/bundle/chunks/{xan-UIL24CGT.js → xan-DL576EIT.js} +1 -1
  348. package/dist/bundle/chunks/xan-view-GJVN6IHX.js +2 -0
  349. package/dist/bundle/chunks/yes-OVJMX6NM.js +2 -0
  350. package/dist/bundle/chunks/yq-KYPU4LQP.js +2 -0
  351. package/dist/bundle/index.cjs +1079 -1059
  352. package/dist/bundle/index.js +345 -339
  353. package/dist/commands/mktemp/mktemp.d.ts +4 -0
  354. package/dist/commands/registry.d.ts +1 -1
  355. package/dist/commands/which/which.d.ts +10 -0
  356. package/dist/commands/yes/yes.d.ts +4 -0
  357. package/dist/custom-commands.d.ts +12 -0
  358. package/dist/fs/create-exclusive.d.ts +30 -0
  359. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +8 -1
  360. package/dist/fs/interface.d.ts +37 -0
  361. package/dist/fs/mountable-fs/mountable-fs.d.ts +18 -1
  362. package/dist/fs/overlay-fs/overlay-fs.d.ts +19 -1
  363. package/dist/fs/path-utils.d.ts +0 -4
  364. package/dist/fs/read-write-fs/read-write-fs.d.ts +22 -1
  365. package/dist/index.d.cts +1 -1
  366. package/dist/index.d.ts +1 -1
  367. package/dist/interpreter/expansion/array-prefix-suffix.d.ts +2 -1
  368. package/dist/interpreter/expansion/parameter-ops.d.ts +1 -0
  369. package/dist/interpreter/expansion/pattern-removal.d.ts +3 -0
  370. package/dist/interpreter/expansion/variable.d.ts +1 -1
  371. package/dist/interpreter/helpers/loop.d.ts +32 -0
  372. package/dist/limits.d.ts +0 -3
  373. package/dist/network/dns-pin.d.ts +1 -32
  374. package/dist/network/fetch.d.ts +1 -1
  375. package/dist/security/trusted-globals.d.ts +8 -0
  376. package/dist/types.d.ts +6 -0
  377. package/package.json +3 -4
  378. package/dist/bin/chunks/awk2-NTRVFXRA.js +0 -3
  379. package/dist/bin/chunks/chunk-3PCPQIUD.js +0 -3
  380. package/dist/bin/chunks/chunk-6JUPBMCR.js +0 -13
  381. package/dist/bin/chunks/chunk-BB5VTPMQ.js +0 -16
  382. package/dist/bin/chunks/chunk-CN4JKMTR.js +0 -8
  383. package/dist/bin/chunks/chunk-F2PYTUMR.js +0 -9
  384. package/dist/bin/chunks/chunk-HWI42GQO.js +0 -7
  385. package/dist/bin/chunks/chunk-HWK7KFGB.js +0 -3
  386. package/dist/bin/chunks/chunk-I57EACSL.js +0 -3
  387. package/dist/bin/chunks/chunk-ONF4KUYV.js +0 -13
  388. package/dist/bin/chunks/chunk-PRVPFKTC.js +0 -276
  389. package/dist/bin/chunks/chunk-RTN6X652.js +0 -11
  390. package/dist/bin/chunks/chunk-RVPTAYDS.js +0 -4
  391. package/dist/bin/chunks/chunk-U5JLGI56.js +0 -21
  392. package/dist/bin/chunks/dist-5MWO25Y4.js +0 -141
  393. package/dist/bin/chunks/find-MHC4QV6H.js +0 -3
  394. package/dist/bin/chunks/flag-coverage-LLAQBVIG.js +0 -3
  395. package/dist/bin/chunks/mkdir-YJ3SOVRP.js +0 -3
  396. package/dist/bin/chunks/rg-WHVR3YDT.js +0 -3
  397. package/dist/bin/chunks/rm-B4LVIG7A.js +0 -3
  398. package/dist/bin/chunks/sqlite3-CXQTZRPZ.js +0 -3
  399. package/dist/bin/chunks/timeout-RQOWSWYG.js +0 -3
  400. package/dist/bin/chunks/yq-CWBZMGUV.js +0 -3
  401. package/dist/bin/shell/chunks/awk2-NTRVFXRA.js +0 -3
  402. package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +0 -3
  403. package/dist/bin/shell/chunks/chunk-6JUPBMCR.js +0 -13
  404. package/dist/bin/shell/chunks/chunk-BB5VTPMQ.js +0 -16
  405. package/dist/bin/shell/chunks/chunk-CN4JKMTR.js +0 -8
  406. package/dist/bin/shell/chunks/chunk-F2PYTUMR.js +0 -9
  407. package/dist/bin/shell/chunks/chunk-HWI42GQO.js +0 -7
  408. package/dist/bin/shell/chunks/chunk-HWK7KFGB.js +0 -3
  409. package/dist/bin/shell/chunks/chunk-I57EACSL.js +0 -3
  410. package/dist/bin/shell/chunks/chunk-ONF4KUYV.js +0 -13
  411. package/dist/bin/shell/chunks/chunk-PRVPFKTC.js +0 -276
  412. package/dist/bin/shell/chunks/chunk-RTN6X652.js +0 -11
  413. package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +0 -4
  414. package/dist/bin/shell/chunks/chunk-U5JLGI56.js +0 -21
  415. package/dist/bin/shell/chunks/dist-5MWO25Y4.js +0 -141
  416. package/dist/bin/shell/chunks/find-MHC4QV6H.js +0 -3
  417. package/dist/bin/shell/chunks/flag-coverage-LLAQBVIG.js +0 -3
  418. package/dist/bin/shell/chunks/mkdir-YJ3SOVRP.js +0 -3
  419. package/dist/bin/shell/chunks/rg-WHVR3YDT.js +0 -3
  420. package/dist/bin/shell/chunks/rm-B4LVIG7A.js +0 -3
  421. package/dist/bin/shell/chunks/sqlite3-CXQTZRPZ.js +0 -3
  422. package/dist/bin/shell/chunks/timeout-RQOWSWYG.js +0 -3
  423. package/dist/bin/shell/chunks/yq-CWBZMGUV.js +0 -3
  424. package/dist/bundle/chunks/awk2-VS5QVYHU.js +0 -2
  425. package/dist/bundle/chunks/chunk-2SMD2AUA.js +0 -3
  426. package/dist/bundle/chunks/chunk-35MBA3VY.js +0 -12
  427. package/dist/bundle/chunks/chunk-3OBCZP7T.js +0 -12
  428. package/dist/bundle/chunks/chunk-4CC3OZPU.js +0 -2
  429. package/dist/bundle/chunks/chunk-A257L6QO.js +0 -7
  430. package/dist/bundle/chunks/chunk-ATGOUOX2.js +0 -15
  431. package/dist/bundle/chunks/chunk-BRJERIF4.js +0 -2
  432. package/dist/bundle/chunks/chunk-FTET43KM.js +0 -2
  433. package/dist/bundle/chunks/chunk-GRUZ4SBY.js +0 -275
  434. package/dist/bundle/chunks/chunk-LRFR25IP.js +0 -8
  435. package/dist/bundle/chunks/chunk-RWQWFXMH.js +0 -10
  436. package/dist/bundle/chunks/chunk-Y6JBSHCM.js +0 -20
  437. package/dist/bundle/chunks/chunk-ZBUZKIPX.js +0 -6
  438. package/dist/bundle/chunks/find-RLKBCGJR.js +0 -2
  439. package/dist/bundle/chunks/flag-coverage-YQGACUSN.js +0 -2
  440. package/dist/bundle/chunks/mkdir-Z6MMWH3D.js +0 -2
  441. package/dist/bundle/chunks/rg-JKB7DR66.js +0 -2
  442. package/dist/bundle/chunks/rm-IGPLE632.js +0 -2
  443. package/dist/bundle/chunks/sqlite3-DQNCWDG5.js +0 -2
  444. package/dist/bundle/chunks/timeout-37GM7IIL.js +0 -2
  445. package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +0 -2
  446. package/dist/bundle/chunks/yq-ZRNZKDLE.js +0 -2
@@ -1,11 +1,11 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{b as L}from"./chunk-WNH3HOQA.js";import{a as I,b as l}from"./chunk-KIGPB52X.js";import{d as A,e as m}from"./chunk-PS2RJNZZ.js";import{a as C}from"./chunk-L2UW7DWF.js";import{b as w}from"./chunk-ZBUZKIPX.js";import{a as _,b as f}from"./chunk-T5ZEIOJ3.js";import{a as F,b as D}from"./chunk-FOCWZZDE.js";var h={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,RENAME:14,COPY_FILE:15,WRITE_FILE_RANGE:17,READ_RESULT_RANGE:18,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300,INVOKE_TOOL:400},S={IDLE:0,REQUEST:1,CANCELLED:2},r={NONE:0,SUCCESS:1,ERROR:2},a={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10,NOT_EMPTY:11,LOOP:12,FILE_TOO_LARGE:13,NO_SPACE:14,BUSY:15,READ_ONLY:16,CROSS_DEVICE:17},O=Object.assign(Object.create(null),{ENOENT:a.NOT_FOUND,EISDIR:a.IS_DIRECTORY,ENOTDIR:a.NOT_DIRECTORY,ENOTEMPTY:a.NOT_EMPTY,EEXIST:a.EXISTS,EPERM:a.PERMISSION_DENIED,EACCES:a.PERMISSION_DENIED,EINVAL:a.INVALID_PATH,ELOOP:a.LOOP,EFBIG:a.FILE_TOO_LARGE,ENOSPC:a.NO_SPACE,EBUSY:a.BUSY,EROFS:a.READ_ONLY,EXDEV:a.CROSS_DEVICE}),P=Object.create(null);for(let[d,t]of Object.entries(O))P[t]=d;var o={OP_CODE:0,REQUEST:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,RESULT_STATE:32,PATH_BUFFER:36,DATA_BUFFER:4132},R={PATH_BUFFER:4096,DATA_BUFFER:8388608,TOTAL:8392740},g={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},u={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function M(){return new I(R.TOTAL)}var T=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return l.load(this.int32View,o.OP_CODE/4)}setOpCode(t){l.store(this.int32View,o.OP_CODE/4,t)}getRequest(){return l.load(this.int32View,o.REQUEST/4)}setRequest(t){l.store(this.int32View,o.REQUEST/4,t)}getResultState(){return l.load(this.int32View,o.RESULT_STATE/4)}setResultState(t){l.store(this.int32View,o.RESULT_STATE/4,t)}getPathLength(){return l.load(this.int32View,o.PATH_LENGTH/4)}setPathLength(t){l.store(this.int32View,o.PATH_LENGTH/4,t)}getDataLength(){return l.load(this.int32View,o.DATA_LENGTH/4)}setDataLength(t){l.store(this.int32View,o.DATA_LENGTH/4,t)}getResultLength(){return l.load(this.int32View,o.RESULT_LENGTH/4)}setResultLength(t){l.store(this.int32View,o.RESULT_LENGTH/4,t)}getErrorCode(){return l.load(this.int32View,o.ERROR_CODE/4)}setErrorCode(t){l.store(this.int32View,o.ERROR_CODE/4,t)}getFlags(){return l.load(this.int32View,o.FLAGS/4)}setFlags(t){l.store(this.int32View,o.FLAGS/4,t)}getMode(){return l.load(this.int32View,o.MODE/4)}setMode(t){l.store(this.int32View,o.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(o.PATH_BUFFER,o.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>R.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${R.PATH_BUFFER}`);this.uint8View.set(e,o.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setData(t){if(t.length>R.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${R.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setResult(t){if(t.length>R.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${R.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setResultLength(t.length)}setResultPrefix(t){if(t.length>2147483647)throw new Error(`Result too large: ${t.length} exceeds int32`);let e=Math.min(t.length,R.DATA_BUFFER);this.uint8View.set(t.subarray(0,e),o.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[o.DATA_BUFFER+u.IS_FILE]=t.isFile?1:0,this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(o.DATA_BUFFER+u.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(o.DATA_BUFFER+u.SIZE,e,!0),this.dataView.setFloat64(o.DATA_BUFFER+u.MTIME,t.mtime.getTime(),!0),this.setResultLength(u.TOTAL)}decodeStat(){return{isFile:this.uint8View[o.DATA_BUFFER+u.IS_FILE]===1,isDirectory:this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]===1,mode:this.dataView.getInt32(o.DATA_BUFFER+u.MODE,!0),size:this.dataView.getFloat64(o.DATA_BUFFER+u.SIZE,!0),mtime:new Date(this.dataView.getFloat64(o.DATA_BUFFER+u.MTIME,!0))}}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getRequest();if(s===S.REQUEST)return!0;if(s!==S.IDLE)return!1;let i=Date.now()-e;if(i>=t)return!1;let n=t-i,c=l.waitAsync(this.int32View,o.REQUEST/4,S.IDLE,n);if(c.async&&await c.value==="timed-out")return!1}}waitForResult(t){return l.wait(this.int32View,o.RESULT_STATE/4,r.NONE,t)}notifyRequest(){return l.notify(this.int32View,o.REQUEST/4)}notifyResult(){return l.notify(this.int32View,o.RESULT_STATE/4)}reset(){this.setOpCode(h.NOOP),this.setRequest(S.IDLE),this.setResultState(r.NONE),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(a.NONE),this.setFlags(g.NONE),this.setMode(0)}};function U(d){return d!==void 0&&Object.hasOwn(O,d)?O[d]:a.IO_ERROR}var N=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;invokeTool;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;lastResult=null;constructor(t,e,s,i,n=void 0,c=0,E=void 0,p=void 0){this.fs=e,this.cwd=s,this.commandName=i,this.secureFetch=n,this.maxOutputSize=c,this.exec=E,this.invokeTool=p,this.protocol=new T(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
2
+ import{b as L}from"./chunk-353VO5TF.js";import{d as w,e as A}from"./chunk-SXQJYLP7.js";import{a as I,b as l}from"./chunk-XZ34OGNM.js";import{a as C}from"./chunk-L2UW7DWF.js";import{b as F}from"./chunk-A6SU3BZX.js";import{a as _,b as f}from"./chunk-T5ZEIOJ3.js";import{a as m,b as D}from"./chunk-FOCWZZDE.js";var h={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,RENAME:14,COPY_FILE:15,WRITE_FILE_RANGE:17,READ_RESULT_RANGE:18,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300,INVOKE_TOOL:400},S={IDLE:0,REQUEST:1,CANCELLED:2},r={NONE:0,SUCCESS:1,ERROR:2},n={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10,NOT_EMPTY:11,LOOP:12,FILE_TOO_LARGE:13,NO_SPACE:14,BUSY:15,READ_ONLY:16,CROSS_DEVICE:17},O=Object.assign(Object.create(null),{ENOENT:n.NOT_FOUND,EISDIR:n.IS_DIRECTORY,ENOTDIR:n.NOT_DIRECTORY,ENOTEMPTY:n.NOT_EMPTY,EEXIST:n.EXISTS,EPERM:n.PERMISSION_DENIED,EACCES:n.PERMISSION_DENIED,EINVAL:n.INVALID_PATH,ELOOP:n.LOOP,EFBIG:n.FILE_TOO_LARGE,ENOSPC:n.NO_SPACE,EBUSY:n.BUSY,EROFS:n.READ_ONLY,EXDEV:n.CROSS_DEVICE}),P=Object.create(null);for(let[d,t]of Object.entries(O))P[t]=d;var o={OP_CODE:0,REQUEST:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,RESULT_STATE:32,PATH_BUFFER:36,DATA_BUFFER:4132},R={PATH_BUFFER:4096,DATA_BUFFER:8388608,TOTAL:8392740},g={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},u={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function M(){return new I(R.TOTAL)}var T=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return l.load(this.int32View,o.OP_CODE/4)}setOpCode(t){l.store(this.int32View,o.OP_CODE/4,t)}getRequest(){return l.load(this.int32View,o.REQUEST/4)}setRequest(t){l.store(this.int32View,o.REQUEST/4,t)}getResultState(){return l.load(this.int32View,o.RESULT_STATE/4)}setResultState(t){l.store(this.int32View,o.RESULT_STATE/4,t)}getPathLength(){return l.load(this.int32View,o.PATH_LENGTH/4)}setPathLength(t){l.store(this.int32View,o.PATH_LENGTH/4,t)}getDataLength(){return l.load(this.int32View,o.DATA_LENGTH/4)}setDataLength(t){l.store(this.int32View,o.DATA_LENGTH/4,t)}getResultLength(){return l.load(this.int32View,o.RESULT_LENGTH/4)}setResultLength(t){l.store(this.int32View,o.RESULT_LENGTH/4,t)}getErrorCode(){return l.load(this.int32View,o.ERROR_CODE/4)}setErrorCode(t){l.store(this.int32View,o.ERROR_CODE/4,t)}getFlags(){return l.load(this.int32View,o.FLAGS/4)}setFlags(t){l.store(this.int32View,o.FLAGS/4,t)}getMode(){return l.load(this.int32View,o.MODE/4)}setMode(t){l.store(this.int32View,o.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(o.PATH_BUFFER,o.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>R.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${R.PATH_BUFFER}`);this.uint8View.set(e,o.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setData(t){if(t.length>R.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${R.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setResult(t){if(t.length>R.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${R.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setResultLength(t.length)}setResultPrefix(t){if(t.length>2147483647)throw new Error(`Result too large: ${t.length} exceeds int32`);let e=Math.min(t.length,R.DATA_BUFFER);this.uint8View.set(t.subarray(0,e),o.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[o.DATA_BUFFER+u.IS_FILE]=t.isFile?1:0,this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(o.DATA_BUFFER+u.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(o.DATA_BUFFER+u.SIZE,e,!0),this.dataView.setFloat64(o.DATA_BUFFER+u.MTIME,t.mtime.getTime(),!0),this.setResultLength(u.TOTAL)}decodeStat(){return{isFile:this.uint8View[o.DATA_BUFFER+u.IS_FILE]===1,isDirectory:this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]===1,mode:this.dataView.getInt32(o.DATA_BUFFER+u.MODE,!0),size:this.dataView.getFloat64(o.DATA_BUFFER+u.SIZE,!0),mtime:new Date(this.dataView.getFloat64(o.DATA_BUFFER+u.MTIME,!0))}}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getRequest();if(s===S.REQUEST)return!0;if(s!==S.IDLE)return!1;let i=Date.now()-e;if(i>=t)return!1;let a=t-i,c=l.waitAsync(this.int32View,o.REQUEST/4,S.IDLE,a);if(c.async&&await c.value==="timed-out")return!1}}waitForResult(t){return l.wait(this.int32View,o.RESULT_STATE/4,r.NONE,t)}notifyRequest(){return l.notify(this.int32View,o.REQUEST/4)}notifyResult(){return l.notify(this.int32View,o.RESULT_STATE/4)}reset(){this.setOpCode(h.NOOP),this.setRequest(S.IDLE),this.setResultState(r.NONE),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(n.NONE),this.setFlags(g.NONE),this.setMode(0)}};function y(d){return d!==void 0&&Object.hasOwn(O,d)?O[d]:n.IO_ERROR}var N=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;invokeTool;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;lastResult=null;constructor(t,e,s,i,a=void 0,c=0,E=void 0,p=void 0){this.fs=e,this.cwd=s,this.commandName=i,this.secureFetch=a,this.maxOutputSize=c,this.exec=E,this.invokeTool=p,this.protocol=new T(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
3
3
  ${this.commandName}: execution timeout exceeded
4
- `,Promise.reject(new Error("Operation timed out"));let s=t();return e===Number.POSITIVE_INFINITY?s:new Promise((i,n)=>{let c=A(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
4
+ `,Promise.reject(new Error("Operation timed out"));let s=t();return e===Number.POSITIVE_INFINITY?s:new Promise((i,a)=>{let c=w(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
5
5
  ${this.commandName}: execution timeout exceeded
6
- `,n(new Error("Operation timed out"))},e);s.then(E=>{m(c),i(E)},E=>{m(c),n(E)})})}async run(t){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=t;this.running;){if(Date.now()-this.startTime>=t){this.output.stderr+=`
6
+ `,a(new Error("Operation timed out"))},e);(async()=>{try{i(await s)}catch(E){a(E)}finally{A(c)}})()})}async run(t){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=t;this.running;){if(Date.now()-this.startTime>=t){this.output.stderr+=`
7
7
  ${this.commandName}: execution timeout exceeded
8
8
  `,this.output.exitCode=124;break}let s=this.remainingMs();if(!await this.protocol.waitUntilReady(s)){if(!this.running)break;this.output.stderr+=`
9
9
  ${this.commandName}: execution timeout exceeded
10
- `,this.output.exitCode=124;break}if(!this.running)break;this.protocol.setRequest(S.IDLE);let n=this.protocol.getOpCode();await this.handleOperation(n),this.protocol.notifyResult()}return this.output}stop(){this.running=!1,this.lastResult=null,this.protocol.setRequest(S.CANCELLED),this.protocol.notifyRequest()}async handleOperation(t){try{switch(t){case h.READ_FILE:await this.handleReadFile();break;case h.WRITE_FILE:await this.handleWriteFile();break;case h.STAT:await this.handleStat();break;case h.LSTAT:await this.handleLstat();break;case h.READDIR:await this.handleReaddir();break;case h.MKDIR:await this.handleMkdir();break;case h.READ_RESULT_RANGE:this.handleReadResultRange();break;case h.WRITE_FILE_RANGE:await this.handleWriteFileRange();break;case h.RM:await this.handleRm();break;case h.EXISTS:await this.handleExists();break;case h.APPEND_FILE:await this.handleAppendFile();break;case h.SYMLINK:await this.handleSymlink();break;case h.READLINK:await this.handleReadlink();break;case h.CHMOD:await this.handleChmod();break;case h.REALPATH:await this.handleRealpath();break;case h.RENAME:await this.handleRename();break;case h.COPY_FILE:await this.handleCopyFile();break;case h.WRITE_STDOUT:this.handleWriteStdout();break;case h.WRITE_STDERR:this.handleWriteStderr();break;case h.EXIT:this.handleExit();break;case h.HTTP_REQUEST:await this.handleHttpRequest();break;case h.EXEC_COMMAND:await this.handleExecCommand();break;case h.INVOKE_TOOL:await this.handleInvokeTool();break;default:this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultState(r.ERROR)}}catch(e){this.setErrorFromException(e)}}publishResult(t){let e=typeof t=="string"?new TextEncoder().encode(t):t;this.lastResult=e,this.protocol.setResultPrefix(e),this.protocol.setResultState(r.SUCCESS)}handleReadResultRange(){let t=this.protocol.getFlags(),e=this.protocol.getMode(),s=this.lastResult;if(!s||t>=s.length){this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString(`No retained result for range read (offset=${t}, length=${e}, retained=${s?.length??"none"})`),this.protocol.setResultState(r.ERROR);return}this.protocol.setResult(s.subarray(t,t+e)),this.protocol.setResultState(r.SUCCESS)}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.publishResult(e)}catch(e){this.setErrorFromException(e)}}async handleWriteFileRange(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=this.protocol.getData();try{if(e===0)await this.fs.writeFile(t,s);else{let i=await this.fs.stat(t);if(i.size!==e)throw new _("EIO",`non-sequential range write to '${t}': offset ${e} != size ${i.size}`);await this.fs.appendFile(t,s)}this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.publishResult(JSON.stringify(e))}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&g.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&g.RECURSIVE)!==0,i=(e&g.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:i}),this.protocol.setResultState(r.SUCCESS)}catch(n){this.setErrorFromException(n)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleCopyFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(r.ERROR);return}this.protocol.setResultState(r.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(r.ERROR);return}this.protocol.setResultState(r.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setResultState(r.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
11
- `,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let i=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(i>0)if(this.output.stdout.length>=i)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-i);else{let n=i-this.output.stdout.length;this.output.stdout="",n>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-n)}this.output.stderr+=e}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(a.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let i=s?JSON.parse(s):{},n=this.remainingMs(),c=await this.raceDeadline(()=>t(e,{method:i.method,headers:i.headers,body:i.body,timeoutMs:n})),E=JSON.stringify({status:c.status,statusText:c.statusText,headers:c.headers,bodyBase64:L(c.body,"base64"),url:c.url});this.publishResult(E)}catch(i){let n=F(i instanceof Error?i.message:String(i));this.protocol.setErrorCode(a.NETWORK_ERROR),this.protocol.setResultFromString(n),this.protocol.setResultState(r.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString(),i=new AbortController;try{let n={cwd:this.cwd,signal:i.signal};if(s){let p=JSON.parse(s);p.stdin&&(n.stdin=p.stdin),p.args&&Array.isArray(p.args)&&(n.args=p.args.map(x=>String(x)),e=C([e]))}let c=await this.raceDeadline(()=>t(e,n)),E=JSON.stringify({stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode});this.publishResult(E)}catch(n){i.abort();let c=n instanceof Error?n.message:String(n);this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString(c),this.protocol.setResultState(r.ERROR)}}async handleInvokeTool(){let t=this.invokeTool;if(!t){this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString("Tool invocation not available in this context."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let i=await this.raceDeadline(()=>w.runTrustedAsync(()=>t(e,s)));this.publishResult(i)}catch(i){let n=D(i instanceof Error?i.message:String(i));this.protocol.setErrorCode(a.IO_ERROR),this.protocol.setResultFromString(n),this.protocol.setResultState(r.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=F(e);this.protocol.setErrorCode(U(f(t))),this.protocol.setResultFromString(s),this.protocol.setResultState(r.ERROR)}};export{M as a,N as b};
10
+ `,this.output.exitCode=124;break}if(!this.running)break;this.protocol.setRequest(S.IDLE);let a=this.protocol.getOpCode();await this.handleOperation(a),this.protocol.notifyResult()}return this.output}stop(){this.running=!1,this.lastResult=null,this.protocol.setRequest(S.CANCELLED),this.protocol.notifyRequest()}async handleOperation(t){try{switch(t){case h.READ_FILE:await this.handleReadFile();break;case h.WRITE_FILE:await this.handleWriteFile();break;case h.STAT:await this.handleStat();break;case h.LSTAT:await this.handleLstat();break;case h.READDIR:await this.handleReaddir();break;case h.MKDIR:await this.handleMkdir();break;case h.READ_RESULT_RANGE:this.handleReadResultRange();break;case h.WRITE_FILE_RANGE:await this.handleWriteFileRange();break;case h.RM:await this.handleRm();break;case h.EXISTS:await this.handleExists();break;case h.APPEND_FILE:await this.handleAppendFile();break;case h.SYMLINK:await this.handleSymlink();break;case h.READLINK:await this.handleReadlink();break;case h.CHMOD:await this.handleChmod();break;case h.REALPATH:await this.handleRealpath();break;case h.RENAME:await this.handleRename();break;case h.COPY_FILE:await this.handleCopyFile();break;case h.WRITE_STDOUT:this.handleWriteStdout();break;case h.WRITE_STDERR:this.handleWriteStderr();break;case h.EXIT:this.handleExit();break;case h.HTTP_REQUEST:await this.handleHttpRequest();break;case h.EXEC_COMMAND:await this.handleExecCommand();break;case h.INVOKE_TOOL:await this.handleInvokeTool();break;default:this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultState(r.ERROR)}}catch(e){this.setErrorFromException(e)}}publishResult(t){let e=typeof t=="string"?new TextEncoder().encode(t):t;this.lastResult=e,this.protocol.setResultPrefix(e),this.protocol.setResultState(r.SUCCESS)}handleReadResultRange(){let t=this.protocol.getFlags(),e=this.protocol.getMode(),s=this.lastResult;if(!s||t>=s.length){this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString(`No retained result for range read (offset=${t}, length=${e}, retained=${s?.length??"none"})`),this.protocol.setResultState(r.ERROR);return}this.protocol.setResult(s.subarray(t,t+e)),this.protocol.setResultState(r.SUCCESS)}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.publishResult(e)}catch(e){this.setErrorFromException(e)}}async handleWriteFileRange(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=this.protocol.getData();try{if(e===0)await this.fs.writeFile(t,s);else{let i=await this.fs.stat(t);if(i.size!==e)throw new _("EIO",`non-sequential range write to '${t}': offset ${e} != size ${i.size}`);await this.fs.appendFile(t,s)}this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.publishResult(JSON.stringify(e))}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&g.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&g.RECURSIVE)!==0,i=(e&g.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:i}),this.protocol.setResultState(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setResultState(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setResultState(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleCopyFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(t,e),this.protocol.setResultState(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(r.ERROR);return}this.protocol.setResultState(r.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setResultState(r.ERROR);return}this.protocol.setResultState(r.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setResultState(r.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
11
+ `,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let i=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(i>0)if(this.output.stdout.length>=i)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-i);else{let a=i-this.output.stdout.length;this.output.stdout="",a>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-a)}this.output.stderr+=e}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(n.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let i=s?JSON.parse(s):{},a=this.remainingMs(),c=await this.raceDeadline(()=>t(e,{method:i.method,headers:i.headers,body:i.body,timeoutMs:a})),E=JSON.stringify({status:c.status,statusText:c.statusText,headers:c.headers,bodyBase64:L(c.body,"base64"),url:c.url});this.publishResult(E)}catch(i){let a=m(i instanceof Error?i.message:String(i));this.protocol.setErrorCode(n.NETWORK_ERROR),this.protocol.setResultFromString(a),this.protocol.setResultState(r.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString(),i=new AbortController;try{let a={cwd:this.cwd,signal:i.signal};if(s){let p=JSON.parse(s);p.stdin&&(a.stdin=p.stdin),p.args&&Array.isArray(p.args)&&(a.args=p.args.map(x=>String(x)),e=C([e]))}let c=await this.raceDeadline(()=>t(e,a)),E=JSON.stringify({stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode});this.publishResult(E)}catch(a){i.abort();let c=a instanceof Error?a.message:String(a);this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString(c),this.protocol.setResultState(r.ERROR)}}async handleInvokeTool(){let t=this.invokeTool;if(!t){this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString("Tool invocation not available in this context."),this.protocol.setResultState(r.ERROR);return}let e=this.protocol.getPath(),s=this.protocol.getDataAsString();try{let i=await this.raceDeadline(()=>F.runTrustedAsync(()=>t(e,s)));this.publishResult(i)}catch(i){let a=D(i instanceof Error?i.message:String(i));this.protocol.setErrorCode(n.IO_ERROR),this.protocol.setResultFromString(a),this.protocol.setResultState(r.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=m(e);this.protocol.setErrorCode(y(f(t))),this.protocol.setResultFromString(s),this.protocol.setResultState(r.ERROR)}};export{M as a,N as b};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- var o=globalThis.SharedArrayBuffer,r=globalThis.Atomics,e=performance.now.bind(performance),a=globalThis.Headers,s=globalThis.Proxy;export{o as a,r as b,e as c,a as d,s as e};
2
+ var o=globalThis.SharedArrayBuffer,r=globalThis.Atomics,e=performance.now.bind(performance),t=globalThis.Headers,s=globalThis.Proxy,a=Promise.prototype.then;export{o as a,r as b,e as c,t as d,s as e,a as f};
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{e as F}from"./chunk-S6DNKKUL.js";import{l as d,m as h}from"./chunk-TVCZIH6M.js";import{a as x}from"./chunk-QIQMJJZ4.js";import{a as g,b as z}from"./chunk-QAYAQNCG.js";var $={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},b={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},R={name:"du",async execute(t,s){if(z(t))return g($);let a=x("du",t,b);if(!a.ok)return a.error;let l={allFiles:a.result.flags.allFiles,humanReadable:a.result.flags.humanReadable,summarize:a.result.flags.summarize,grandTotal:a.result.flags.grandTotal,maxDepth:a.result.flags.maxDepth??null},i=a.result.positional;i.length===0&&i.push(".");let n="",o="",e=0;for(let u of i){let f=s.fs.resolvePath(s.cwd,u);try{await s.fs.stat(f);let r=await w(s,f,u,l,0);n+=r.output,e+=r.totalSize,o+=r.stderr}catch(r){if(r instanceof d||r instanceof h)throw r;o+=`du: cannot access '${u}': No such file or directory
2
+ import{e as F}from"./chunk-CM4T4GB4.js";import{l as d,m as h}from"./chunk-TVCZIH6M.js";import{a as x}from"./chunk-QIQMJJZ4.js";import{a as g,b as z}from"./chunk-QAYAQNCG.js";var $={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},b={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},R={name:"du",async execute(t,s){if(z(t))return g($);let a=x("du",t,b);if(!a.ok)return a.error;let l={allFiles:a.result.flags.allFiles,humanReadable:a.result.flags.humanReadable,summarize:a.result.flags.summarize,grandTotal:a.result.flags.grandTotal,maxDepth:a.result.flags.maxDepth??null},i=a.result.positional;i.length===0&&i.push(".");let n="",o="",e=0;for(let u of i){let f=s.fs.resolvePath(s.cwd,u);try{await s.fs.stat(f);let r=await w(s,f,u,l,0);n+=r.output,e+=r.totalSize,o+=r.stderr}catch(r){if(r instanceof d||r instanceof h)throw r;o+=`du: cannot access '${u}': No such file or directory
3
3
  `}}return l.grandTotal&&i.length>0&&(n+=`${p(e,l.humanReadable)} total
4
4
  `),{stdout:n,stderr:o,exitCode:o?1:0}}};async function w(t,s,a,l,i){let n={output:"",totalSize:0,stderr:""},o=new Map;return await F({fs:t.fs,root:s,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"du",symlinks:"never",includeLeave:!0},e=>{let u=e.path.slice(s.length).replace(/^\//,""),f=u?a==="."?u:`${a}/${u}`:a,r=e.path==="/"?"/":e.path.slice(0,e.path.lastIndexOf("/"))||"/";if(e.phase==="enter"){if(e.stat.isDirectory){o.set(e.path,0);return}o.set(r,(o.get(r)??0)+e.stat.size),(l.allFiles||e.depth===i)&&!l.summarize&&(n.output+=`${p(e.stat.size,l.humanReadable)} ${f}
5
5
  `),e.depth===i&&(n.totalSize=e.stat.size);return}let m=o.get(e.path)??0;e.depth>i?o.set(r,(o.get(r)??0)+m):n.totalSize=m;let c=e.depth-i;(l.summarize&&c===0||!l.summarize&&(l.maxDepth===null||c<=l.maxDepth))&&(n.output+=`${p(m,l.humanReadable)} ${f}
@@ -0,0 +1,12 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a as E,b as k,c as _,d as Ie,e as S,g as C,h as ce}from"./chunk-UUIYAOD4.js";import{a as ue,c as xe}from"./chunk-DLL7UR66.js";import{a as Me}from"./chunk-654CJKE3.js";import{a as j}from"./chunk-O5BHWBYH.js";import{e as G}from"./chunk-ZUEPJPYA.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 je(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?.(),!E(u))continue;let f=_(p.target,u)?S(p.target[u]):null,i=S(p.source[u]);if(f&&i){let c=C(f);k(p.target,u,c),o.push({target:c,source:i,depth:p.depth+1})}else k(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))?xe(...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(!E(a))continue;let l=e[a],y=s(l,t[0],r);y.length>0&&k(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 Pe="%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 $e(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!==Pe)throw new Error(`strptime format is not supported: ${p}`);let u=$e(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=$e(e);if(!o)throw new Error(`date "${e}" does not match format "${Pe}"`);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 We=2e3;function Xe(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 Ge(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(Xe(r))]}return[null];case"@base64d":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"base64").toString("utf-8")];let r=Ge(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??We;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(!E(O))continue;let $=N?.[O];k(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 we=2e3;function R(e){return e.limits.maxArrayElements}function Ae(e,n){let t=Object.create(null);return k(t,"key",e),k(t,"value",n),t}function ee(e,n){let t=R(e);if(n>=t)throw new g(`query result element limit exceeded (${t})`,"array_elements")}function Ze(e,n){let t=n.limits.maxDepth??we;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 Ee(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":{if(Array.isArray(e)){if(e.length>R(r))throw new g(`query result element limit exceeded (${R(r)})`,"array_elements");return[e.map((p,u)=>Ae(u,p))]}let o=S(e);if(o){let p=Object.keys(o);if(p.length>R(r))throw new g(`query result element limit exceeded (${R(r)})`,"array_elements");return[p.map(u=>Ae(u,o[u]))]}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);E(c)&&k(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>R(r))throw new g(`query result element limit exceeded (${R(r)})`,"array_elements");let u=[];for(let i of p){let c=Ae(i,o[i]),h=s(c,t[0],r);if(u.length>R(r)-h.length)throw new g(`query result element limit exceeded (${R(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);E(l)&&k(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??we;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[Ie(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=e.trim()===""?Number.NaN: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??we,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>R(r)-h.length)throw new g(`query traversal queue limit exceeded (${R(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>R(r)-a.length)throw new g(`query traversal queue limit exceeded (${R(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>R(r))throw new g(`query stream item limit exceeded (${R(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(Ze(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(!E(A))continue;(b[A]===null||b[A]===void 0)&&k(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);E(y)&&k(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 Le(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 T(n,s+e.length),e}function _e(e,n,t){let r=[],s=[{value:e,path:[],isRoot:!0}];for(;s.length>0;){let o=s.pop();if(!o)break;if(T(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 ke(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=Le(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");Le(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=_e(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 _e(e,r,!0);default:return null}}function Se(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);E(h)&&k(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]);E(a)&&k(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]);E(h)&&k(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 Ue(e){return e.limits.maxArrayElements}function Be(e){return Math.min(e.limits.maxStringLength,e.limits.maxOutputSize)}function U(e,n){let t=Ue(e);if(!Number.isSafeInteger(n)||n<0||n>t)throw new g(`query result element limit exceeded (${t})`,"array_elements")}function ve(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 Oe(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>Be(r))throw new g(`query string size limit exceeded (${Be(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,ve(e,p,Ue(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 Ne(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(!E(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 k(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(!E(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(!E(s))return e;let o=C(e);return Object.hasOwn(o,s)&&k(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"}},et=1e4,qe=10*1024*1024,Je=2e3,tt=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 T(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){T(e);let o=t(s);q(e,r,o)}return r}function rt(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??et,maxDepth:e?.limits?.maxDepth??Je,maxStringLength:e?.limits?.maxStringLength??qe,maxOutputSize:e?.limits?.maxOutputSize??qe,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 nt(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:Ce(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 Ce(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=Ce(e,n.left);return t===null?null:Ce(t,n.right)}return n.type==="Identity"?e:null}function Fe(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:rt(t);if(r.defenseContextChecked||(Me(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),T(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=it(e,n,r);return D(r,0,s.length),s}finally{r.budget.callDepth--}}function it(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=Ke(a,o),m=Ke(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"&&E(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(!E(a)){for(let l of p)u.push(C(h));continue}for(let l of p){let y=C(h);k(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 ft(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 Ve(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(T(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(T(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[st(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??Je;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 Ke(e,n){return e<0?Math.max(0,n+e):Math.min(e,n)}function st(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(!E(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 k(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 k(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(!E(a))return l;let y=C(l),m=Object.hasOwn(y,a)?y[a]:void 0;return k(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(!E(a))return f;let l=C(f),y=Object.hasOwn(l,a)?l[a]:void 0;return k(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)T(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))E(y)&&k(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 ot(e,n,t){function r(o,p,u){switch(p.type){case"Identity":return u;case"Field":{if(!E(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 k(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(!E(i))return o;let c=C(o);return k(c,i,u),c}return o}default:return o}}function s(o,p){switch(p.type){case"Identity":return null;case"Field":{if(!E(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(!E(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(!E(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(!E(y.name))return l;if(l&&typeof l=="object"&&!Array.isArray(l)){let b=C(l);return k(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(!E(A))return l;let w=C(l);return k(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 ft(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),T(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 je(c,h,{maxDepth:s.limits.maxDepth,visit:()=>T(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 Ve(e,n,t,r){let s=tt.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=Oe(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=Ne(e,n);if(i!==null)return i;let c=Ee(e,n,t,r,d);if(c!==null)return c;let h=pe(e,n,t,r,d,Fe,Z,I,v,g);if(h!==null)return h;let a=ke(e,n,t,r,d,I,te,re,ot,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,Fe,I,g);if(y!==null)return y;let m=be(e,n,t,r,d,I,nt,Ve);if(m!==null)return m;let b=Se(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 ze=w.params[X],Te=t[X];if(Te){let L=d(e,Te,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(`${ze}/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(T(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++)T(t),o([...r,f]);else if(e&&typeof e=="object")for(let f of Object.keys(e))T(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(T(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 He=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(He.values());function Qe(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=He.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 De=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=Qe(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 hr(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=Qe(e);return new De(o,t).parse()}function br(e,n,t={}){let r=new G(n,"query JSON output",()=>new g(`output size limit exceeded (${n} bytes)`,t.limitKind??"output_size"));return Re(r,e,t,0),r.build()}function Re(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):Ye(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),Re(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),Ye(e,i),e.append(s?":":": "),Re(e,n[i],t,r+1)}!s&&u.length>0&&e.append(`
12
+ `).repeat(p,r),e.append("}")}function Ye(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,hr as c,br as d};
@@ -0,0 +1,20 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a as E}from"./chunk-6P2DITXT.js";import{a as ne,b as se}from"./chunk-URIKBXSE.js";import{b as I}from"./chunk-A3C4Z3Q3.js";import{l as A}from"./chunk-TVCZIH6M.js";import{d as z}from"./chunk-GN6CQ3J4.js";import{a as ce,c as te}from"./chunk-QAYAQNCG.js";var ye="(standard input)";function he(t){let e=t.limits.maxLoopIterations,i=t.limits.maxArrayElements;return Math.max(e,Math.min(i,e*10))}function F(t){if(++t.operations>t.maxOperations)throw new A(`grep: glob operation limit exceeded (${t.maxOperations})`,"glob_operations")}function U(t){if(t.results>=t.maxResults)throw new A(`grep: array element limit exceeded (${t.maxResults})`,"array_elements");t.results++}var xe="[^\\s\\S]";function we(t){return t.split(`
3
+ `)}function Fe(t){if(t==="")return[];let e=t.split(`
4
+ `);return e[e.length-1]===""&&e.pop(),e}function ve(t,e){return t.length===1?{pattern:t[0],mode:e}:e==="fixed"?{pattern:t.map(i=>`(?:${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`).join("|"),mode:"extended"}:e==="basic"?{pattern:t.join("\\|"),mode:e}:{pattern:t.map(i=>`(?:${i})`).join("|"),mode:e}}var Ce={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",description:["Search for PATTERN in each FILE.","With no FILE, or when FILE is -, read standard input."],options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching","-f FILE, --file=FILE obtain patterns from FILE, one per line"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},me={name:"grep",async execute(t,e){let i=!1,g=!1,f=!1,m=!1,c=!1,u=!1,l=!1,a=!1,h=!1,v=!1,$=!1,y=!1,x=!1,M=!1,_=!1,O=0,N=0,W=0,S=[],B=[],V=[],w=[],b=[],X=[],D=!0;for(let s=0;s<t.length;s++){let r=t[s];if(D&&r==="--"){D=!1;continue}if(D&&r==="--help")return ce(Ce);if(D&&r.startsWith("-")&&r!=="-"){if(r==="-e"&&s+1<t.length){w.push(t[++s]);continue}if(r.startsWith("--file=")){b.push(r.slice(7));continue}if(r.startsWith("--include=")){S.push(r.slice(10));continue}if(r.startsWith("--exclude=")){B.push(r.slice(10));continue}if(r.startsWith("--exclude-dir=")){V.push(r.slice(14));continue}if(r.startsWith("--max-count=")){O=parseInt(r.slice(12),10);continue}let C=r.match(/^-m(\d+)$/);if(C){O=parseInt(C[1],10);continue}if(r==="-m"&&s+1<t.length){O=parseInt(t[++s],10);continue}let o=r.match(/^-([ABC])(\d+)$/);if(o){let p=parseInt(o[2],10);o[1]==="A"?W=p:o[1]==="B"?N=p:o[1]==="C"&&(N=p,W=p);continue}if((r==="-A"||r==="-B"||r==="-C")&&s+1<t.length){let p=parseInt(t[++s],10);r==="-A"?W=p:r==="-B"?N=p:(N=p,W=p);continue}let d=r.startsWith("--")?[r]:r.slice(1).split("");for(let p=0;p<d.length;p++){let n=d[p];if(n==="f"||n==="--file"){let k=n==="f"?d.slice(p+1).join(""):"";if(k.length>0)b.push(k);else if(s+1<t.length)b.push(t[++s]);else return{stdout:"",stderr:n==="f"?`grep: option requires an argument -- 'f'
5
+ `:`grep: option '--file' requires an argument
6
+ `,exitCode:2};break}if(n==="i"||n==="--ignore-case")i=!0;else if(n==="n"||n==="--line-number")g=!0;else if(n==="v"||n==="--invert-match")f=!0;else if(n==="c"||n==="--count")m=!0;else if(n==="l"||n==="--files-with-matches")c=!0;else if(n==="L"||n==="--files-without-match")u=!0;else if(n==="r"||n==="R"||n==="--recursive")l=!0;else if(n==="w"||n==="--word-regexp")a=!0;else if(n==="x"||n==="--line-regexp")h=!0;else if(n==="E"||n==="--extended-regexp")v=!0;else if(n==="P"||n==="--perl-regexp")$=!0;else if(n==="F"||n==="--fixed-strings")y=!0;else if(n==="o"||n==="--only-matching")x=!0;else if(n==="h"||n==="--no-filename")M=!0;else if(n==="q"||n==="--quiet"||n==="--silent")_=!0;else{if(n.startsWith("--"))return te("grep",n);if(n.length===1)return te("grep",`-${n}`)}}}else X.push(r)}if(w.length===0&&b.length===0){let s=X.shift();if(s===void 0)return{stdout:"",stderr:`grep: missing pattern
7
+ `,exitCode:2};w.push(s)}w=w.flatMap(we);let Z=!1;for(let s of b){let r;if(s==="")return{stdout:"",stderr:`grep: : No such file or directory
8
+ `,exitCode:2};if(s==="-")r=Z?"":z(e.stdin),Z=!0;else try{let o=e.fs.resolvePath(e.cwd,s);if((await e.fs.stat(o)).isDirectory)return{stdout:"",stderr:`grep: ${s}: Is a directory
9
+ `,exitCode:2};r=await e.fs.readFile(o)}catch(o){return I(o),{stdout:"",stderr:`grep: ${s}: No such file or directory
10
+ `,exitCode:2}}let C=Fe(r);if(w.length+C.length>e.limits.maxArrayElements)throw new A(`grep: array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");w.push(...C)}if(w.length===0&&!f&&!u)return{stdout:"",stderr:"",exitCode:1};let J=X,G=y?"fixed":v?"extended":$?"perl":"basic";if(G==="perl"&&new Set(w).size>1)return{stdout:"",stderr:`grep: the -P option only supports a single pattern
11
+ `,exitCode:2};if(w.length>1&&G!=="fixed")for(let s of w)try{se(s,{mode:G})}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${s}
12
+ `,exitCode:2}}let re=w.length===0?{pattern:xe,mode:"extended"}:ve(w,G),K,Y,L;try{let s=se(re.pattern,{mode:re.mode,ignoreCase:i,wholeWord:a,lineRegexp:h});K=s.regex,Y=s.kResetGroup,L=s.preFilter}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${w.join(`
13
+ `)}
14
+ `,exitCode:2}}if(J.length===0&&e.stdin!==void 0){let s=Z?"":z(e.stdin),r=ne(s,K,{invertMatch:f,showLineNumbers:g,countOnly:m,filename:"",onlyMatching:x,beforeContext:N,afterContext:W,maxCount:O,kResetGroup:Y,preFilter:L,maxWork:he(e),maxMatches:e.limits.maxArrayElements,signal:e.signal});return _?{stdout:"",stderr:"",exitCode:r.matched?0:1}:{stdout:r.output,stderr:"",exitCode:r.matched?0:1}}if(J.length===0)return{stdout:"",stderr:`grep: no input files
15
+ `,exitCode:2};let H="",ie="",oe=!1,ae=!1,P=[],R={operations:0,results:0,maxOperations:e.limits.maxGlobOperations,maxResults:e.limits.maxArrayElements},ee=s=>{if(s.length>R.maxResults-P.length)throw new A(`grep: array element limit exceeded (${R.maxResults})`,"array_elements");P.push(...s)},le=!1,fe=!1;for(let s of J){if(s==="-"){if(P.length>=R.maxResults)throw new A(`grep: array element limit exceeded (${R.maxResults})`,"array_elements");P.push({path:ye,isFile:!0,isStdin:!0,stdinAtEof:le}),le=!0;continue}if(fe=!0,s.includes("*")||s.includes("?")||s.includes("[")){let r=await Ee(s,e,R);if(l)for(let C of r){let o=await j(C.path,e,S,B,V,C.isFile,R);ee(o)}else ee(r)}else if(l){let r=await j(s,e,S,B,V,void 0,R);ee(r)}else{if(P.length>=R.maxResults)throw new A(`grep: array element limit exceeded (${R.maxResults})`,"array_elements");P.push({path:s})}}let ue=(P.length>1||l&&fe)&&!M,pe=50;for(let s=0;s<P.length;s+=pe){let r=P.slice(s,s+pe),C=await Promise.all(r.map(async o=>{let d=o.path,p=d.split("/").pop()||d;if(B.length>0&&!l&&!o.isStdin&&B.some(n=>E(p,n,{stripQuotes:!0}))||S.length>0&&!l&&!o.isStdin&&!S.some(n=>E(p,n,{stripQuotes:!0})))return null;try{let n;if(o.isStdin)n=o.stdinAtEof||e.stdin===void 0?"":z(e.stdin);else{let q=e.fs.resolvePath(e.cwd,d),T=!1;if(o.isFile===void 0?T=(await e.fs.stat(q)).isDirectory:T=!o.isFile,T)return l?null:{error:`grep: ${d}: Is a directory
16
+ `,isDirectory:!0};n=await e.fs.readFile(q)}if(L&&!f){let q=L.ignoreCase?n.toLowerCase():n;if(!L.needles.some(T=>q.includes(T))){if(m){let T=ue?`${d}:0`:"0";return{file:d,result:{output:`${T}
17
+ `,matched:!1,matchCount:0}}}return{file:d,result:{output:"",matched:!1,matchCount:0}}}}let k=ne(n,K,{invertMatch:f,showLineNumbers:g,countOnly:m,filename:ue?d:"",onlyMatching:x,beforeContext:N,afterContext:W,maxCount:O,kResetGroup:Y,preFilter:L,maxWork:he(e),maxMatches:e.limits.maxArrayElements,signal:e.signal});return{file:d,result:k}}catch(n){return I(n),{error:`grep: ${d}: No such file or directory
18
+ `,isDirectory:!1}}}));for(let o of C){if(o===null)continue;if("error"in o&&o.error){ie+=o.error,o.isDirectory||(ae=!0);continue}if(!("file"in o)||!o.result)continue;let{file:d,result:p}=o;if(p.matched){if(oe=!0,_)return{stdout:"",stderr:"",exitCode:0};c?H+=`${d}
19
+ `:u||(H+=p.output)}else u?H+=`${d}
20
+ `:m&&!c&&(H+=p.output)}}let Q;return ae?Q=2:Q=oe?0:1,_?{stdout:"",stderr:"",exitCode:Q}:{stdout:H,stderr:ie,exitCode:Q}}},de=256;async function ge(t,e,i,g,f,m=0){if(m>=de)return;let c=i.fs.resolvePath(i.cwd,t);try{if(F(f),!(await i.fs.stat(c)).isDirectory){let a=t.split("/").pop()||"";if(e){let h=e.replace(/^\//,"");E(a,h,{stripQuotes:!0})&&(U(f),g.push(t))}return}F(f);let l=await i.fs.readdir(c);for(let a of l){let h=t==="."?a:`${t}/${a}`,v=i.fs.resolvePath(i.cwd,h);if(F(f),(await i.fs.stat(v)).isDirectory)await ge(h,e,i,g,f,m+1);else if(e){let y=e.replace(/^\//,"");E(a,y,{stripQuotes:!0})&&(U(f),g.push(h))}}}catch(u){I(u)}}async function Ee(t,e,i){let g=[],f=t.lastIndexOf("/"),m,c;if(f===-1?(m=e.cwd,c=t):(m=t.slice(0,f)||"/",c=t.slice(f+1)),t.includes("**")){let l=[],a=t.split("**"),h=a[0].replace(/\/$/,"")||".",v=a[1]||"";return await ge(h,v,e,l,i),l.map($=>({path:$}))}let u=e.fs.resolvePath(e.cwd,m);try{if(e.fs.readdirWithFileTypes){F(i);let l=await e.fs.readdirWithFileTypes(u);for(let a of l)if(F(i),E(a.name,c,{stripQuotes:!0})){let h=f===-1?a.name:`${m}/${a.name}`;U(i),g.push({path:h,isFile:a.isFile})}}else{F(i);let l=await e.fs.readdir(u);for(let a of l)if(F(i),E(a,c,{stripQuotes:!0})){let h=f===-1?a:`${m}/${a}`;U(i),g.push({path:h})}}}catch(l){I(l)}return g.sort((l,a)=>l.path.localeCompare(a.path))}async function j(t,e,i=[],g=[],f=[],m,c={operations:0,results:0,maxOperations:e.limits.maxGlobOperations,maxResults:e.limits.maxArrayElements},u=[],l=0){if(l>=de)return u;let a=e.fs.resolvePath(e.cwd,t);try{let h,v;if(m!==void 0)h=m,v=!m;else{F(c);let y=await e.fs.stat(a);h=y.isFile,v=y.isDirectory}if(h){let y=t.split("/").pop()||t;return g.length>0&&g.some(x=>E(y,x,{stripQuotes:!0}))||i.length>0&&!i.some(x=>E(y,x,{stripQuotes:!0}))||(U(c),u.push({path:t,isFile:!0})),u}if(!v)return u;let $=t.split("/").pop()||t;if(f.length>0&&f.some(y=>E($,y,{stripQuotes:!0})))return u;if(e.fs.readdirWithFileTypes){F(c);let y=await e.fs.readdirWithFileTypes(a);for(let x of y){if(F(c),x.name.startsWith("."))continue;let M=t==="."?x.name:`${t}/${x.name}`;await j(M,e,i,g,f,x.isFile,c,u,l+1)}}else{F(c);let y=await e.fs.readdir(a);for(let x of y){if(F(c),x.startsWith("."))continue;let M=t==="."?x:`${t}/${x}`;await j(M,e,i,g,f,void 0,c,u,l+1)}}}catch(h){I(h)}return u}var We={name:"fgrep",async execute(t,e){return me.execute(["-F",...t],e)}},Le={name:"egrep",async execute(t,e){return me.execute(["-E",...t],e)}},Ie={name:"grep",flags:[{flag:"-E",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-P",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-L",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"pattern"},{flag:"-f",type:"value",valueHint:"path"}],stdinType:"text",needsArgs:!0},Oe={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},Se={name:"egrep",flags:[],stdinType:"text",needsArgs:!0};export{me as a,We as b,Le as c,Ie as d,Oe as e,Se as f};
@@ -0,0 +1,5 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a as m}from"./chunk-QIQMJJZ4.js";import{a as p,b as d}from"./chunk-QAYAQNCG.js";var y={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"]},x={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},a=null;async function A(){return a||(a=(await import("./builtin-manifest-7MJJDZ2T.js")).SHELL_BUILTINS),a}var L={name:"which",async execute(n,o){if(d(n))return p(y);let t=m("which",n,x);if(!t.ok)return t.error;let g=t.result.flags.showAll,i=t.result.flags.silent,r=t.result.positional;if(r.length===0)return{stdout:"",stderr:"",exitCode:1};let w=await A(),b=(o.env.get("PATH")||"/usr/bin:/bin").split(":"),l="",h="",f=!0;for(let e of r){let s=!1;for(let u of b){if(!u)continue;let c=o.fs.resolvePath(u,e);if(await o.fs.exists(c)&&(s=!0,i||(l+=`${c}
3
+ `),!g))break}!s&&w.has(e)&&(s=!0,i||(l+=`${e}: shell builtin
4
+ `)),s||(i||(h+=`which: no ${e} in this sandboxed bash environment
5
+ `),f=!1)}return{stdout:l,stderr:h,exitCode:f?0:1}}},B={name:"which",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"boolean"}],needsArgs:!0};export{L as a,B as b};
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{l as o}from"./chunk-TVCZIH6M.js";import{a}from"./chunk-GN6CQ3J4.js";function r(s,t){if(!Number.isSafeInteger(s)||s<0)throw new o(`${t}: invalid bounded allocation count`,"array_elements")}function c(s){return new o(`${s}: invalid bounded allocation count`,"array_elements")}function f(s,t,e){r(s,e),r(t,e);let i=s+t;if(!Number.isSafeInteger(i))throw c(e);return i}function p(s,t,e){if(r(s,e),r(t,e),s!==0&&t>Math.floor(Number.MAX_SAFE_INTEGER/s))throw c(e);return s*t}function m(s,t,e,i){let n=new u(e,i);return n.repeat(s,t),n.build()}function b(s,t,e,i){let n=new u(e,i);for(let h=0;h<s.length;h++)h>0&&n.append(t),n.append(s[h]);return n.build()}var u=class{maxBytes;label;createLimitError;reservedBytes;chunks=[];usedBytes=0;constructor(t,e,i=void 0,n=0){this.maxBytes=t,this.label=e,this.createLimitError=i,this.reservedBytes=n,r(t,e),r(n,e),n>t&&this.fail()}fail(){throw this.createLimitError?.()??new o(`${this.label}: output size limit exceeded (${this.maxBytes} bytes)`,"output_size")}get byteLength(){return this.usedBytes}get remainingBytes(){return this.maxBytes-this.reservedBytes-this.usedBytes}reserve(t){r(t,this.label),t>this.remainingBytes&&this.fail()}append(t){let e=a(t);return this.reserve(e),t&&this.chunks.push(t),this.usedBytes+=e,this}repeat(t,e){r(e,this.label);let i=a(t);return i!==0&&e>Math.floor(this.remainingBytes/i)&&this.fail(),this.append(t.repeat(e))}reset(){this.chunks.length=0,this.usedBytes=0}build(){return this.chunks.join("")}};export{f as a,p as b,m as c,b as d,u as e};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b}from"./chunk-EZNS4GF7.js";import"./chunk-FTET43KM.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as column,b as flagsForFuzzing};
2
+ import{a,b}from"./chunk-67ODVGSB.js";import"./chunk-ZUEPJPYA.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as column,b as flagsForFuzzing};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b}from"./chunk-3OBCZP7T.js";import"./chunk-S6DNKKUL.js";import"./chunk-4CC3OZPU.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-T5ZEIOJ3.js";import"./chunk-FOCWZZDE.js";import"./chunk-QIQMJJZ4.js";import"./chunk-W5DWRFSU.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as cpCommand,b as flagsForFuzzing};
2
+ import{a,b}from"./chunk-VQEB6E2M.js";import"./chunk-CM4T4GB4.js";import"./chunk-BMBITA6Y.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-T5ZEIOJ3.js";import"./chunk-W5DWRFSU.js";import"./chunk-FOCWZZDE.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as cpCommand,b as flagsForFuzzing};
@@ -1,30 +1,30 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{b as W}from"./chunk-WNH3HOQA.js";import{d as w}from"./chunk-KIGPB52X.js";import{a as g}from"./chunk-W5DWRFSU.js";import{a as H,b as x,c as T}from"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";function b(s){return encodeURIComponent(s).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16)}`).replace(/%20/g,"+").replace(/%[0-9A-F]{2}/g,e=>e.toLowerCase())}function O(s){let e=s.indexOf("=");if(e>=0){let i=s.slice(0,e),r=s.slice(e+1),o=b(r);return i?`${i}=${o}`:o}return b(s)}function F(s){let e=s.indexOf("=");if(e<0)return null;let i=s.slice(0,e),r=s.slice(e+1),o,t,a=r.match(/;type=([^;]+)$/);a&&(t=a[1],r=r.slice(0,-a[0].length));let n=r.match(/;filename=([^;]+)/);return n&&(o=n[1],r=r.replace(n[0],"")),(r.startsWith("@")||r.startsWith("<"))&&(o=o??r.slice(1).split("/").pop()),{name:i,value:r,filename:o,contentType:t}}function $(s,e){let i=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let o of s){let t=o.value;if(t.startsWith("@")||t.startsWith("<")){let n=t.slice(1);t=e.get(n)??""}let a=`--${i}\r
2
+ import{a as k,b as E}from"./chunk-353VO5TF.js";import{d as w}from"./chunk-XZ34OGNM.js";import{a as x,d as W,f as F}from"./chunk-GN6CQ3J4.js";import{a as S}from"./chunk-W5DWRFSU.js";import{a as O,b as $,c as g}from"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";function b(s){return encodeURIComponent(s).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16)}`).replace(/%20/g,"+").replace(/%[0-9A-F]{2}/g,e=>e.toLowerCase())}function C(s){let e=s.indexOf("=");if(e>=0){let i=s.slice(0,e),r=s.slice(e+1),o=b(r);return i?`${i}=${o}`:o}return b(s)}function P(s){let e=s.indexOf("=");if(e<0)return null;let i=s.slice(0,e),r=s.slice(e+1),o,t,a=r.match(/;type=([^;]+)$/);a&&(t=a[1],r=r.slice(0,-a[0].length));let n=r.match(/;filename=([^;]+)/);return n&&(o=n[1],r=r.replace(n[0],"")),(r.startsWith("@")||r.startsWith("<"))&&(o=o??r.slice(1).split("/").pop()),{name:i,value:r,filename:o,contentType:t}}function A(s,e){let i=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let o of s){let t=o.value;if(t.startsWith("@")||t.startsWith("<")){let n=t.slice(1);t=e.get(n)??""}let a=`--${i}\r
3
3
  `;o.filename?(a+=`Content-Disposition: form-data; name="${o.name}"; filename="${o.filename}"\r
4
4
  `,o.contentType&&(a+=`Content-Type: ${o.contentType}\r
5
5
  `)):a+=`Content-Disposition: form-data; name="${o.name}"\r
6
6
  `,a+=`\r
7
7
  ${t}\r
8
8
  `,r.push(a)}return r.push(`--${i}--\r
9
- `),{body:r.join(""),boundary:i}}var S={name:"curl",summary:"transfer a URL",usage:"curl [OPTIONS] URL",options:["-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)","-H, --header HEADER Add header (can be used multiple times)","-d, --data DATA HTTP POST data (DATA=@file reads from file, strips newlines)","-G, --get Append data payloads to URL query string"," --data-raw DATA HTTP POST data (no @ interpretation)"," --data-binary DATA HTTP POST binary data (DATA=@file reads file verbatim)"," --data-urlencode DATA URL-encode and POST data (supports @file and name@file)","-F, --form NAME=VALUE Multipart form data","-u, --user USER:PASS HTTP authentication","-A, --user-agent STR Set User-Agent header","-e, --referer URL Set Referer header","-b, --cookie DATA Send cookies (name=value or @file)","-c, --cookie-jar FILE Save cookies to file","-T, --upload-file FILE Upload file (PUT)","-o, --output FILE Write output to file","-O, --remote-name Write to file named from URL","-D, --dump-header FILE Write response headers to FILE (`-` for stdout)","-I, --head Show headers only (HEAD request)","-i, --include Include response headers in output","-s, --silent Silent mode (no progress)","-S, --show-error Show errors even when silent","-f, --fail Fail silently on HTTP errors (no output)","-L, --location Follow redirects (default)"," --max-redirs NUM Maximum redirects (default: 20)","-m, --max-time SECS Maximum time for request"," --connect-timeout SECS Connection timeout","-w, --write-out FMT Output format after completion","-v, --verbose Verbose output"," --help Display this help and exit","","Note: Network access must be configured via BashEnv network option."," curl is not available by default for security reasons."]};function m(s,e,i){i.allowFile&&e.startsWith("@")?s.dataParts.push({file:{path:e.slice(1),mode:i.binary?"binary":"ascii"}}):s.dataParts.push({value:e}),i.binary&&(s.dataBinary=!0)}function k(s,e){if(e.startsWith("@")){s.dataParts.push({file:{path:e.slice(1),mode:"urlencode"}});return}let i=e.indexOf("@"),r=e.indexOf("=");if(i>0&&(r<0||i<r)){s.dataParts.push({file:{path:e.slice(i+1),mode:"urlencode",name:e.slice(0,i)}});return}s.dataParts.push({value:O(e)})}function C(s){let e={method:"GET",headers:new w,dataParts:[],dataBinary:!1,getMode:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1},i=!1,r=!1;for(let o=0;o<s.length;o++){let t=s[o];if(t==="-X"||t==="--request")e.method=s[++o]??"GET",r=!0;else if(t.startsWith("-X"))e.method=t.slice(2),r=!0;else if(t.startsWith("--request="))e.method=t.slice(10),r=!0;else if(t==="-H"||t==="--header"){let a=s[++o];if(a){let n=a.indexOf(":");if(n>0){let f=a.slice(0,n).trim(),l=a.slice(n+1).trim();e.headers.append(f,l)}}}else if(t.startsWith("--header=")){let a=t.slice(9),n=a.indexOf(":");if(n>0){let f=a.slice(0,n).trim(),l=a.slice(n+1).trim();e.headers.append(f,l)}}else if(t==="-G"||t==="--get")e.getMode=!0,r||(e.method="GET");else if(t==="-d"||t==="--data")m(e,s[++o]??"",{binary:!1,allowFile:!0}),i=!0;else if(t==="--data-raw")m(e,s[++o]??"",{binary:!1,allowFile:!1}),i=!0;else if(t.startsWith("-d"))m(e,t.slice(2),{binary:!1,allowFile:!0}),i=!0;else if(t.startsWith("--data="))m(e,t.slice(7),{binary:!1,allowFile:!0}),i=!0;else if(t.startsWith("--data-raw="))m(e,t.slice(11),{binary:!1,allowFile:!1}),i=!0;else if(t==="--data-binary")m(e,s[++o]??"",{binary:!0,allowFile:!0}),i=!0;else if(t.startsWith("--data-binary="))m(e,t.slice(14),{binary:!0,allowFile:!0}),i=!0;else if(t==="--data-urlencode")k(e,s[++o]??""),i=!0;else if(t.startsWith("--data-urlencode="))k(e,t.slice(17)),i=!0;else if(t==="-F"||t==="--form"){let a=s[++o]??"",n=F(a);n&&e.formFields.push(n),i=!0}else if(t.startsWith("--form=")){let a=t.slice(7),n=F(a);n&&e.formFields.push(n),i=!0}else if(t==="-u"||t==="--user")e.user=s[++o];else if(t.startsWith("-u"))e.user=t.slice(2);else if(t.startsWith("--user="))e.user=t.slice(7);else if(t==="-A"||t==="--user-agent")e.headers.set("User-Agent",s[++o]??"");else if(t.startsWith("-A"))e.headers.set("User-Agent",t.slice(2));else if(t.startsWith("--user-agent="))e.headers.set("User-Agent",t.slice(13));else if(t==="-e"||t==="--referer")e.headers.set("Referer",s[++o]??"");else if(t.startsWith("-e"))e.headers.set("Referer",t.slice(2));else if(t.startsWith("--referer="))e.headers.set("Referer",t.slice(10));else if(t==="-b"||t==="--cookie")e.headers.set("Cookie",s[++o]??"");else if(t.startsWith("-b"))e.headers.set("Cookie",t.slice(2));else if(t.startsWith("--cookie="))e.headers.set("Cookie",t.slice(9));else if(t==="-c"||t==="--cookie-jar")e.cookieJar=s[++o];else if(t.startsWith("--cookie-jar="))e.cookieJar=t.slice(13);else if(t==="-T"||t==="--upload-file")e.uploadFile=s[++o],e.method==="GET"&&(e.method="PUT");else if(t.startsWith("--upload-file="))e.uploadFile=t.slice(14),e.method==="GET"&&(e.method="PUT");else if(t==="-m"||t==="--max-time"){let a=parseFloat(s[++o]??"0");!Number.isNaN(a)&&a>0&&(e.timeoutMs=a*1e3)}else if(t.startsWith("--max-time=")){let a=parseFloat(t.slice(11));!Number.isNaN(a)&&a>0&&(e.timeoutMs=a*1e3)}else if(t==="--connect-timeout"){let a=parseFloat(s[++o]??"0");!Number.isNaN(a)&&a>0&&e.timeoutMs===void 0&&(e.timeoutMs=a*1e3)}else if(t.startsWith("--connect-timeout=")){let a=parseFloat(t.slice(18));!Number.isNaN(a)&&a>0&&e.timeoutMs===void 0&&(e.timeoutMs=a*1e3)}else if(t==="-o"||t==="--output")e.outputFile=s[++o];else if(t.startsWith("--output="))e.outputFile=t.slice(9);else if(t==="-D"||t==="--dump-header"){let a=s[++o];if(a===void 0)return{stdout:"",stderr:`curl: option ${t}: requires parameter
9
+ `),{body:r.join(""),boundary:i}}var D={name:"curl",summary:"transfer a URL",usage:"curl [OPTIONS] URL",options:["-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)","-H, --header HEADER Add header (can be used multiple times)","-d, --data DATA HTTP POST data (DATA=@file reads from file, strips newlines)","-G, --get Append data payloads to URL query string"," --data-raw DATA HTTP POST data (no @ interpretation)"," --data-binary DATA HTTP POST binary data (DATA=@file reads file verbatim)"," --data-urlencode DATA URL-encode and POST data (supports @file and name@file)","-F, --form NAME=VALUE Multipart form data","-u, --user USER:PASS HTTP authentication","-A, --user-agent STR Set User-Agent header","-e, --referer URL Set Referer header","-b, --cookie DATA Send cookies (name=value or @file)","-c, --cookie-jar FILE Save cookies to file","-T, --upload-file FILE Upload file (PUT)","-o, --output FILE Write output to file","-O, --remote-name Write to file named from URL","-D, --dump-header FILE Write response headers to FILE (`-` for stdout)","-I, --head Show headers only (HEAD request)","-i, --include Include response headers in output","-s, --silent Silent mode (no progress)","-S, --show-error Show errors even when silent","-f, --fail Fail silently on HTTP errors (no output)","-L, --location Follow redirects (default)"," --max-redirs NUM Maximum redirects (default: 20)","-m, --max-time SECS Maximum time for request"," --connect-timeout SECS Connection timeout","-w, --write-out FMT Output format after completion","-v, --verbose Verbose output"," --help Display this help and exit","","Note: Network access must be configured via BashEnv network option."," curl is not available by default for security reasons."]};function h(s,e,i){i.allowFile&&e.startsWith("@")?s.dataParts.push({file:{path:e.slice(1),mode:i.binary?"binary":"ascii"}}):s.dataParts.push({value:e}),i.binary&&(s.dataBinary=!0)}function R(s,e){if(e.startsWith("@")){s.dataParts.push({file:{path:e.slice(1),mode:"urlencode"}});return}let i=e.indexOf("@"),r=e.indexOf("=");if(i>0&&(r<0||i<r)){s.dataParts.push({file:{path:e.slice(i+1),mode:"urlencode",name:e.slice(0,i)}});return}s.dataParts.push({value:C(e)})}function M(s){let e={method:"GET",headers:new w,dataParts:[],dataBinary:!1,getMode:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1},i=!1,r=!1;for(let o=0;o<s.length;o++){let t=s[o];if(t==="-X"||t==="--request")e.method=s[++o]??"GET",r=!0;else if(t.startsWith("-X"))e.method=t.slice(2),r=!0;else if(t.startsWith("--request="))e.method=t.slice(10),r=!0;else if(t==="-H"||t==="--header"){let a=s[++o];if(a){let n=a.indexOf(":");if(n>0){let l=a.slice(0,n).trim(),d=a.slice(n+1).trim();e.headers.append(l,d)}}}else if(t.startsWith("--header=")){let a=t.slice(9),n=a.indexOf(":");if(n>0){let l=a.slice(0,n).trim(),d=a.slice(n+1).trim();e.headers.append(l,d)}}else if(t==="-G"||t==="--get")e.getMode=!0,r||(e.method="GET");else if(t==="-d"||t==="--data")h(e,s[++o]??"",{binary:!1,allowFile:!0}),i=!0;else if(t==="--data-raw")h(e,s[++o]??"",{binary:!1,allowFile:!1}),i=!0;else if(t.startsWith("-d"))h(e,t.slice(2),{binary:!1,allowFile:!0}),i=!0;else if(t.startsWith("--data="))h(e,t.slice(7),{binary:!1,allowFile:!0}),i=!0;else if(t.startsWith("--data-raw="))h(e,t.slice(11),{binary:!1,allowFile:!1}),i=!0;else if(t==="--data-binary")h(e,s[++o]??"",{binary:!0,allowFile:!0}),i=!0;else if(t.startsWith("--data-binary="))h(e,t.slice(14),{binary:!0,allowFile:!0}),i=!0;else if(t==="--data-urlencode")R(e,s[++o]??""),i=!0;else if(t.startsWith("--data-urlencode="))R(e,t.slice(17)),i=!0;else if(t==="-F"||t==="--form"){let a=s[++o]??"",n=P(a);n&&e.formFields.push(n),i=!0}else if(t.startsWith("--form=")){let a=t.slice(7),n=P(a);n&&e.formFields.push(n),i=!0}else if(t==="-u"||t==="--user")e.user=s[++o];else if(t.startsWith("-u"))e.user=t.slice(2);else if(t.startsWith("--user="))e.user=t.slice(7);else if(t==="-A"||t==="--user-agent")e.headers.set("User-Agent",s[++o]??"");else if(t.startsWith("-A"))e.headers.set("User-Agent",t.slice(2));else if(t.startsWith("--user-agent="))e.headers.set("User-Agent",t.slice(13));else if(t==="-e"||t==="--referer")e.headers.set("Referer",s[++o]??"");else if(t.startsWith("-e"))e.headers.set("Referer",t.slice(2));else if(t.startsWith("--referer="))e.headers.set("Referer",t.slice(10));else if(t==="-b"||t==="--cookie")e.headers.set("Cookie",s[++o]??"");else if(t.startsWith("-b"))e.headers.set("Cookie",t.slice(2));else if(t.startsWith("--cookie="))e.headers.set("Cookie",t.slice(9));else if(t==="-c"||t==="--cookie-jar")e.cookieJar=s[++o];else if(t.startsWith("--cookie-jar="))e.cookieJar=t.slice(13);else if(t==="-T"||t==="--upload-file")e.uploadFile=s[++o],e.method==="GET"&&(e.method="PUT");else if(t.startsWith("--upload-file="))e.uploadFile=t.slice(14),e.method==="GET"&&(e.method="PUT");else if(t==="-m"||t==="--max-time"){let a=parseFloat(s[++o]??"0");!Number.isNaN(a)&&a>0&&(e.timeoutMs=a*1e3)}else if(t.startsWith("--max-time=")){let a=parseFloat(t.slice(11));!Number.isNaN(a)&&a>0&&(e.timeoutMs=a*1e3)}else if(t==="--connect-timeout"){let a=parseFloat(s[++o]??"0");!Number.isNaN(a)&&a>0&&e.timeoutMs===void 0&&(e.timeoutMs=a*1e3)}else if(t.startsWith("--connect-timeout=")){let a=parseFloat(t.slice(18));!Number.isNaN(a)&&a>0&&e.timeoutMs===void 0&&(e.timeoutMs=a*1e3)}else if(t==="-o"||t==="--output")e.outputFile=s[++o];else if(t.startsWith("--output="))e.outputFile=t.slice(9);else if(t==="-D"||t==="--dump-header"){let a=s[++o];if(a===void 0)return{stdout:"",stderr:`curl: option ${t}: requires parameter
10
10
  `,exitCode:1};if(a==="")return{stdout:"",stderr:`curl: option ${t}: blank argument where content is expected
11
11
  `,exitCode:1};e.dumpHeader=a}else if(t.startsWith("--dump-header=")){let a=t.slice(14);if(a==="")return{stdout:"",stderr:`curl: option --dump-header: blank argument where content is expected
12
12
  `,exitCode:1};e.dumpHeader=a}else if(t.startsWith("-D")&&t.length>2)e.dumpHeader=t.slice(2);else if(t==="-O"||t==="--remote-name")e.useRemoteName=!0;else if(t==="-I"||t==="--head")e.headOnly=!0,e.method="HEAD",r=!0;else if(t==="-i"||t==="--include")e.includeHeaders=!0;else if(t==="-s"||t==="--silent")e.silent=!0;else if(t==="-S"||t==="--show-error")e.showError=!0;else if(t==="-f"||t==="--fail")e.failSilently=!0;else if(t==="-L"||t==="--location")e.followRedirects=!0;else if(t==="--max-redirs"){let a=s[++o];if(a===void 0||!/^\d+$/.test(a))return{stdout:"",stderr:`curl: option --max-redirs: expected a non-negative integer
13
13
  `,exitCode:2};let n=Number(a);if(!Number.isSafeInteger(n))return{stdout:"",stderr:`curl: option --max-redirs: value is out of range
14
14
  `,exitCode:2};e.maxRedirects=n}else if(t.startsWith("--max-redirs=")){let a=t.slice(13);if(!/^\d+$/.test(a)||!Number.isSafeInteger(Number(a)))return{stdout:"",stderr:`curl: option --max-redirs: expected a non-negative integer
15
- `,exitCode:2};e.maxRedirects=Number(a)}else if(t==="-w"||t==="--write-out")e.writeOut=s[++o];else if(t.startsWith("--write-out="))e.writeOut=t.slice(12);else if(t==="-v"||t==="--verbose")e.verbose=!0;else{if(t.startsWith("--")&&t!=="--")return T("curl",t);if(t.startsWith("-")&&t!=="-")for(let a of t.slice(1))switch(a){case"s":e.silent=!0;break;case"S":e.showError=!0;break;case"f":e.failSilently=!0;break;case"L":e.followRedirects=!0;break;case"I":e.headOnly=!0,e.method="HEAD",r=!0;break;case"i":e.includeHeaders=!0;break;case"O":e.useRemoteName=!0;break;case"v":e.verbose=!0;break;case"G":e.getMode=!0,r||(e.method="GET");break;default:return T("curl",`-${a}`)}else t.startsWith("-")||(e.url=t)}}return i&&!r&&!e.getMode&&(e.method="POST"),e}function R(s){return Object.entries(s).map(([e,i])=>`${e}: ${i}`).join(`\r
16
- `)}function h(s,e,i){return`HTTP/1.1 ${s} ${e}\r
17
- ${R(i)}\r
15
+ `,exitCode:2};e.maxRedirects=Number(a)}else if(t==="-w"||t==="--write-out")e.writeOut=s[++o];else if(t.startsWith("--write-out="))e.writeOut=t.slice(12);else if(t==="-v"||t==="--verbose")e.verbose=!0;else{if(t.startsWith("--")&&t!=="--")return g("curl",t);if(t.startsWith("-")&&t!=="-")for(let a of t.slice(1))switch(a){case"s":e.silent=!0;break;case"S":e.showError=!0;break;case"f":e.failSilently=!0;break;case"L":e.followRedirects=!0;break;case"I":e.headOnly=!0,e.method="HEAD",r=!0;break;case"i":e.includeHeaders=!0;break;case"O":e.useRemoteName=!0;break;case"v":e.verbose=!0;break;case"G":e.getMode=!0,r||(e.method="GET");break;default:return g("curl",`-${a}`)}else t.startsWith("-")||(e.url=t)}}return i&&!r&&!e.getMode&&(e.method="POST"),e}function N(s){return Object.entries(s).map(([e,i])=>`${e}: ${i}`).join(`\r
16
+ `)}function m(s,e,i){return`HTTP/1.1 ${s} ${e}\r
17
+ ${N(i)}\r
18
18
  \r
19
- `}function E(s){try{return new URL(s).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function P(s,e){let i=s;return i=i.replace(/%\{http_code\}/g,String(e.status)),i=i.replace(/%\{content_type\}/g,e.headers["content-type"]||""),i=i.replace(/%\{url_effective\}/g,e.url),i=i.replace(/%\{size_download\}/g,String(e.bodyLength)),i=i.replace(/\\n/g,`
20
- `),i}async function D(s,e){if(s.dataParts.length===0)return;let i=[];for(let r of s.dataParts)if(r.file){let o=e.fs.resolvePath(e.cwd,r.file.path),t=await e.fs.readFile(o);if(r.file.mode==="ascii")i.push(t.replace(/[\r\n]/g,""));else if(r.file.mode==="binary")i.push(t);else{let a=b(t);i.push(r.file.name?`${r.file.name}=${a}`:a)}}else i.push(r.value??"");return i.join("&")}async function M(s,e,i){if(s.uploadFile){let r=e.fs.resolvePath(e.cwd,s.uploadFile);return{body:await e.fs.readFile(r)}}if(s.formFields.length>0){let r=new Map;for(let a of s.formFields)if(a.value.startsWith("@")||a.value.startsWith("<")){let n=e.fs.resolvePath(e.cwd,a.value.slice(1));try{let f=await e.fs.readFile(n);r.set(a.value.slice(1),f)}catch{r.set(a.value.slice(1),"")}}let{body:o,boundary:t}=$(s.formFields,r);return{body:o,contentType:`multipart/form-data; boundary=${t}`}}return i!==void 0&&!s.getMode?{body:i,contentType:"application/x-www-form-urlencoded"}:{}}function N(s,e){if(!e)return s;let i=s.indexOf("#"),r=i===-1?s:s.slice(0,i),o=i===-1?"":s.slice(i),t=r.endsWith("?")||r.endsWith("&")?"":r.includes("?")?"&":"?";return`${r}${t}${e}${o}`}function L(s,e){let i=new w(s.headers);if(s.user){let r=Buffer.from(s.user).toString("base64");i.set("Authorization",`Basic ${r}`)}return e&&!i.has("Content-Type")&&i.set("Content-Type",e),i}async function U(s,e,i){if(!s.cookieJar)return;let r=e["set-cookie"];if(!r)return;let o=i.fs.resolvePath(i.cwd,s.cookieJar);await i.fs.writeFile(o,r)}function I(s){return W(s,"binary")}function B(s,e,i){let r="";if(s.verbose){r+=`> ${s.method} ${i}
19
+ `}function L(s){try{return new URL(s).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function v(s,e){let i=s;return i=i.replace(/%\{http_code\}/g,String(e.status)),i=i.replace(/%\{content_type\}/g,e.headers["content-type"]||""),i=i.replace(/%\{url_effective\}/g,e.url),i=i.replace(/%\{size_download\}/g,String(e.bodyLength)),i=i.replace(/\\n/g,`
20
+ `),i}var U=new TextEncoder,B=new TextDecoder("utf8",{ignoreBOM:!0});async function I(s,e){if(s.dataParts.length===0)return;let i=[],r=!1,o=!1;for(let l of s.dataParts)if(l.file){if(l.file.mode==="binary"){o=!0,l.file.path==="-"?(i.push(k(r?F:e.stdin,"binary")),r=!0):i.push(await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,l.file.path)));continue}let d=l.file.path==="-"?W(r?F:e.stdin):await e.fs.readFile(e.fs.resolvePath(e.cwd,l.file.path));if(l.file.path==="-"&&(r=!0),l.file.mode==="ascii")i.push(d.replace(/[\r\n]/g,""));else{let p=b(d);i.push(l.file.name?`${l.file.name}=${p}`:p)}}else i.push(l.value??"");if(!o)return i.join("&");let t=i.length-1;for(let l of i)t+=typeof l=="string"?x(l):l.byteLength;let a=new Uint8Array(t),n=0;for(let l=0;l<i.length;l+=1){l>0&&(a[n]=38,n+=1);let d=i[l];typeof d=="string"?n+=U.encodeInto(d,a.subarray(n)).written:(a.set(d,n),n+=d.byteLength)}return a}async function q(s,e,i){if(s.uploadFile){let r=e.fs.resolvePath(e.cwd,s.uploadFile);return{body:await e.fs.readFile(r)}}if(s.formFields.length>0){let r=new Map;for(let a of s.formFields)if(a.value.startsWith("@")||a.value.startsWith("<")){let n=e.fs.resolvePath(e.cwd,a.value.slice(1));try{let l=await e.fs.readFile(n);r.set(a.value.slice(1),l)}catch{r.set(a.value.slice(1),"")}}let{body:o,boundary:t}=A(s.formFields,r);return{body:o,contentType:`multipart/form-data; boundary=${t}`}}return i!==void 0&&!s.getMode?{body:i,contentType:"application/x-www-form-urlencoded"}:{}}function j(s,e){if(!e)return s;let i=s.indexOf("#"),r=i===-1?s:s.slice(0,i),o=i===-1?"":s.slice(i),t=r.endsWith("?")||r.endsWith("&")?"":r.includes("?")?"&":"?";return`${r}${t}${e}${o}`}function G(s,e){let i=new w(s.headers);if(s.user){let r=Buffer.from(s.user).toString("base64");i.set("Authorization",`Basic ${r}`)}return e&&!i.has("Content-Type")&&i.set("Content-Type",e),i}async function _(s,e,i){if(!s.cookieJar)return;let r=e["set-cookie"];if(!r)return;let o=i.fs.resolvePath(i.cwd,s.cookieJar);await i.fs.writeFile(o,r)}function J(s){return E(s,"binary")}function X(s,e,i){let r="";if(s.verbose){r+=`> ${s.method} ${i}
21
21
  `;for(let[o,t]of s.headers)r+=`> ${o}: ${t}
22
22
  `;r+=`>
23
23
  `,r+=`< HTTP/1.1 ${e.status} ${e.statusText}
24
24
  `;for(let[o,t]of Object.entries(e.headers))r+=`< ${o}: ${t}
25
25
  `;r+=`<
26
- `}return s.includeHeaders&&!s.verbose&&(r+=h(e.status,e.statusText,e.headers)),s.headOnly?s.includeHeaders||s.verbose||(r+=h(e.status,e.statusText,e.headers)):r+=I(e.body),s.writeOut&&(r+=P(s.writeOut,{status:e.status,headers:e.headers,url:e.url,bodyLength:e.body.byteLength})),r}var ie={name:"curl",async execute(s,e){if(x(s))return H(S);let i=C(s);if("exitCode"in i)return i;let r=i;if(!r.url)return{stdout:"",stderr:`curl: no URL specified
26
+ `}return s.includeHeaders&&!s.verbose&&(r+=m(e.status,e.statusText,e.headers)),s.headOnly?s.includeHeaders||s.verbose||(r+=m(e.status,e.statusText,e.headers)):r+=J(e.body),s.writeOut&&(r+=v(s.writeOut,{status:e.status,headers:e.headers,url:e.url,bodyLength:e.body.byteLength})),r}var ce={name:"curl",async execute(s,e){if($(s))return O(D);let i=M(s);if("exitCode"in i)return i;let r=i;if(!r.url)return{stdout:"",stderr:`curl: no URL specified
27
27
  `,exitCode:2};if(!e.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available
28
- `,exitCode:1};let o=r.url;o.match(/^https?:\/\//)||(o=`https://${o}`);try{let t=await D(r,e);r.getMode&&(o=N(o,t));let{body:a,contentType:n}=await M(r,e,t),f=L(r,n);if(r.dumpHeader!==void 0&&r.dumpHeader!=="-"){let d=e.fs.resolvePath(e.cwd,r.dumpHeader);await e.fs.writeFile(d,"")}let l=await e.fetch(o,{method:r.method,headers:f,body:a,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs,maxRedirects:r.maxRedirects,signal:e.signal});await U(r,l.headers,e);let A=h(l.status,l.statusText,l.headers),c="";if(l.redirectChain)for(let d of l.redirectChain)c+=h(d.status,d.statusText,d.headers);if(c+=A,r.dumpHeader!==void 0&&r.dumpHeader!=="-"){let d=e.fs.resolvePath(e.cwd,r.dumpHeader);await e.fs.writeFile(d,c)}if(r.failSilently&&l.status>=400){let d=r.showError||!r.silent?`curl: (22) The requested URL returned error: ${l.status}
29
- `:"",p=r.dumpHeader==="-"?c:"";return{stdout:p,stderr:d,exitCode:22,stdoutKind:p?"bytes":void 0}}let v=!!(r.outputFile||r.useRemoteName),u=v&&!r.verbose?"":B(r,l,o);if(v){let d=r.outputFile||E(o),p=e.fs.resolvePath(e.cwd,d);if(await e.fs.writeFile(p,r.headOnly?"":l.body),r.verbose?u=(r.dumpHeader==="-"?c:"")+u:r.dumpHeader==="-"?u=c:u="",r.writeOut){let y=P(r.writeOut,{status:l.status,headers:l.headers,url:l.url,bodyLength:l.body.byteLength});r.verbose?u+=y:r.dumpHeader==="-"?u=c+y:u=y}}else r.dumpHeader==="-"&&(u=c+u);return{stdout:u,stderr:"",exitCode:0,stdoutKind:"bytes"}}catch(t){let a=g(t),n=1;return a.includes("Network access denied")?n=7:a.includes("HTTP method")&&a.includes("not allowed")?n=3:a.includes("Redirect target not in allow-list")||a.includes("Too many redirects")?n=47:a.includes("aborted")&&(n=28),{stdout:"",stderr:!r.silent||r.showError?`curl: (${n}) ${a}
30
- `:"",exitCode:n}}}};export{ie as curlCommand};
28
+ `,exitCode:1};let o=r.url;o.match(/^https?:\/\//)||(o=`https://${o}`);try{let t=await I(r,e);r.getMode&&(o=j(o,t instanceof Uint8Array?B.decode(t):t));let{body:a,contentType:n}=await q(r,e,t),l=G(r,n);if(r.dumpHeader!==void 0&&r.dumpHeader!=="-"){let u=e.fs.resolvePath(e.cwd,r.dumpHeader);await e.fs.writeFile(u,"")}let d=await e.fetch(o,{method:r.method,headers:l,body:a,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs,maxRedirects:r.maxRedirects,signal:e.signal});await _(r,d.headers,e);let p=m(d.status,d.statusText,d.headers),c="";if(d.redirectChain)for(let u of d.redirectChain)c+=m(u.status,u.statusText,u.headers);if(c+=p,r.dumpHeader!==void 0&&r.dumpHeader!=="-"){let u=e.fs.resolvePath(e.cwd,r.dumpHeader);await e.fs.writeFile(u,c)}if(r.failSilently&&d.status>=400){let u=r.showError||!r.silent?`curl: (22) The requested URL returned error: ${d.status}
29
+ `:"",y=r.dumpHeader==="-"?c:"";return{stdout:y,stderr:u,exitCode:22,stdoutKind:y?"bytes":void 0}}let H=!!(r.outputFile||r.useRemoteName),f=H&&!r.verbose?"":X(r,d,o);if(H){let u=r.outputFile||L(o),y=e.fs.resolvePath(e.cwd,u);if(await e.fs.writeFile(y,r.headOnly?"":d.body),r.verbose?f=(r.dumpHeader==="-"?c:"")+f:r.dumpHeader==="-"?f=c:f="",r.writeOut){let T=v(r.writeOut,{status:d.status,headers:d.headers,url:d.url,bodyLength:d.body.byteLength});r.verbose?f+=T:r.dumpHeader==="-"?f=c+T:f=T}}else r.dumpHeader==="-"&&(f=c+f);return{stdout:f,stderr:"",exitCode:0,stdoutKind:"bytes"}}catch(t){let a=S(t),n=1;return a.includes("Network access denied")?n=7:a.includes("HTTP method")&&a.includes("not allowed")?n=3:a.includes("Redirect target not in allow-list")||a.includes("Too many redirects")?n=47:a.includes("aborted")&&(n=28),{stdout:"",stderr:!r.silent||r.showError?`curl: (${n}) ${a}
30
+ `:"",exitCode:n}}}};export{ce as curlCommand};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b}from"./chunk-QJ7OXJAZ.js";import"./chunk-YEYSCLSJ.js";import"./chunk-FTET43KM.js";import"./chunk-STHBFACM.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as cutCommand,b as flagsForFuzzing};
2
+ import{a,b}from"./chunk-BLG7RWH4.js";import"./chunk-YEYSCLSJ.js";import"./chunk-ZUEPJPYA.js";import"./chunk-STHBFACM.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as cutCommand,b as flagsForFuzzing};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b}from"./chunk-E2F4A3CM.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as diffCommand,b as flagsForFuzzing};
2
+ import{a,b}from"./chunk-2A4OZBCS.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as diffCommand,b as flagsForFuzzing};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b}from"./chunk-FSKXIFYT.js";import"./chunk-S6DNKKUL.js";import"./chunk-4CC3OZPU.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-T5ZEIOJ3.js";import"./chunk-FOCWZZDE.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as duCommand,b as flagsForFuzzing};
2
+ import{a,b}from"./chunk-Y6UHNLT5.js";import"./chunk-CM4T4GB4.js";import"./chunk-BMBITA6Y.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-T5ZEIOJ3.js";import"./chunk-FOCWZZDE.js";import"./chunk-QIQMJJZ4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as duCommand,b as flagsForFuzzing};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b}from"./chunk-LGIJSCWH.js";import"./chunk-4KZT23KR.js";import"./chunk-AYSZ5MAE.js";import"./chunk-ZBUZKIPX.js";import"./chunk-FTET43KM.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-FOCWZZDE.js";import"./chunk-NCUTH6QL.js";export{a as exprCommand,b as flagsForFuzzing};
2
+ import{a,b}from"./chunk-EQDVNHQS.js";import"./chunk-O5BHWBYH.js";import"./chunk-A3C4Z3Q3.js";import"./chunk-A6SU3BZX.js";import"./chunk-ZUEPJPYA.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-FOCWZZDE.js";import"./chunk-NCUTH6QL.js";export{a as exprCommand,b as flagsForFuzzing};