@jerryan/just-bash 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (958) hide show
  1. package/CHANGELOG.md +308 -0
  2. package/LICENSE +201 -0
  3. package/README.md +827 -0
  4. package/dist/AGENTS.md +383 -0
  5. package/dist/Bash.d.ts +317 -0
  6. package/dist/abort-signals.d.ts +10 -0
  7. package/dist/agent-sandbox.d.ts +104 -0
  8. package/dist/ast/types.d.ts +612 -0
  9. package/dist/banned-patterns-test.d.ts +1 -0
  10. package/dist/bin/chunks/alias-3R4G6HQY.js +3 -0
  11. package/dist/bin/chunks/awk2-KO7ZE3P7.js +3 -0
  12. package/dist/bin/chunks/base64-TQ5KOCNW.js +3 -0
  13. package/dist/bin/chunks/basename-C4CRGDXP.js +3 -0
  14. package/dist/bin/chunks/bash-CFCBBWVH.js +3 -0
  15. package/dist/bin/chunks/cat-BQ7FQTN5.js +3 -0
  16. package/dist/bin/chunks/chmod-WYYTXGVB.js +3 -0
  17. package/dist/bin/chunks/chunk-23OI2XDJ.js +20 -0
  18. package/dist/bin/chunks/chunk-2ETT4ELS.js +4 -0
  19. package/dist/bin/chunks/chunk-2UV6ZFHK.js +4 -0
  20. package/dist/bin/chunks/chunk-2YLY6FJA.js +10 -0
  21. package/dist/bin/chunks/chunk-3FQBUEB6.js +3 -0
  22. package/dist/bin/chunks/chunk-3MRB66F4.js +3 -0
  23. package/dist/bin/chunks/chunk-3PCPQIUD.js +3 -0
  24. package/dist/bin/chunks/chunk-42AMF6EE.js +3 -0
  25. package/dist/bin/chunks/chunk-43E7AR6A.js +3 -0
  26. package/dist/bin/chunks/chunk-45DUHCXR.js +7 -0
  27. package/dist/bin/chunks/chunk-472JZJ2D.js +22 -0
  28. package/dist/bin/chunks/chunk-47IFMQYS.js +3 -0
  29. package/dist/bin/chunks/chunk-4JF56A3P.js +15 -0
  30. package/dist/bin/chunks/chunk-5SKEZPTU.js +12 -0
  31. package/dist/bin/chunks/chunk-67XYNGRV.js +9 -0
  32. package/dist/bin/chunks/chunk-6ESRNSO7.js +7 -0
  33. package/dist/bin/chunks/chunk-6KHZX4HU.js +12 -0
  34. package/dist/bin/chunks/chunk-7FGDUBSN.js +14 -0
  35. package/dist/bin/chunks/chunk-7JZKVC3F.js +2 -0
  36. package/dist/bin/chunks/chunk-7PPAWLUI.js +12 -0
  37. package/dist/bin/chunks/chunk-7PUOS2OO.js +143 -0
  38. package/dist/bin/chunks/chunk-7VWOECJ3.js +101 -0
  39. package/dist/bin/chunks/chunk-7WBCA2BB.js +3 -0
  40. package/dist/bin/chunks/chunk-AGKL4LDL.js +4 -0
  41. package/dist/bin/chunks/chunk-AI7JUA46.js +13 -0
  42. package/dist/bin/chunks/chunk-AJF3OBTR.js +4 -0
  43. package/dist/bin/chunks/chunk-B2DRBHGQ.js +3 -0
  44. package/dist/bin/chunks/chunk-B2GCIQI2.js +16 -0
  45. package/dist/bin/chunks/chunk-B6WWC6K3.js +9 -0
  46. package/dist/bin/chunks/chunk-BIJXTWZ4.js +3 -0
  47. package/dist/bin/chunks/chunk-CC2AQ6B7.js +15 -0
  48. package/dist/bin/chunks/chunk-CL7IYCGG.js +20 -0
  49. package/dist/bin/chunks/chunk-CMTQFWZK.js +5 -0
  50. package/dist/bin/chunks/chunk-CPKBPQ2C.js +3 -0
  51. package/dist/bin/chunks/chunk-DJAX3ZRG.js +8 -0
  52. package/dist/bin/chunks/chunk-DN2YCFOR.js +3 -0
  53. package/dist/bin/chunks/chunk-DYIBFLS3.js +17 -0
  54. package/dist/bin/chunks/chunk-DZAFUADN.js +36 -0
  55. package/dist/bin/chunks/chunk-F3UDTTI7.js +13 -0
  56. package/dist/bin/chunks/chunk-FHMIEBRM.js +6 -0
  57. package/dist/bin/chunks/chunk-FONAGXRJ.js +17 -0
  58. package/dist/bin/chunks/chunk-FPWHWWXO.js +8 -0
  59. package/dist/bin/chunks/chunk-FUT3X2GJ.js +9 -0
  60. package/dist/bin/chunks/chunk-G4AUMZUY.js +4 -0
  61. package/dist/bin/chunks/chunk-GA5TPRMF.js +34 -0
  62. package/dist/bin/chunks/chunk-GOWX7VPU.js +7 -0
  63. package/dist/bin/chunks/chunk-GQKQEK5N.js +11 -0
  64. package/dist/bin/chunks/chunk-GR4ZHKXI.js +3 -0
  65. package/dist/bin/chunks/chunk-HDWHYM2T.js +18 -0
  66. package/dist/bin/chunks/chunk-HQ63MFHG.js +34 -0
  67. package/dist/bin/chunks/chunk-HW2VJKFH.js +4 -0
  68. package/dist/bin/chunks/chunk-HWI42GQO.js +7 -0
  69. package/dist/bin/chunks/chunk-HZGHQZSY.js +10 -0
  70. package/dist/bin/chunks/chunk-I4IRHQDW.js +3 -0
  71. package/dist/bin/chunks/chunk-I57EACSL.js +3 -0
  72. package/dist/bin/chunks/chunk-JELR4642.js +21 -0
  73. package/dist/bin/chunks/chunk-JQM3DKCH.js +12 -0
  74. package/dist/bin/chunks/chunk-K27FY3ES.js +3 -0
  75. package/dist/bin/chunks/chunk-KG2KXL4Y.js +3 -0
  76. package/dist/bin/chunks/chunk-KI54R2QB.js +3 -0
  77. package/dist/bin/chunks/chunk-KP2UH5CJ.js +22 -0
  78. package/dist/bin/chunks/chunk-KUMHQGUR.js +3 -0
  79. package/dist/bin/chunks/chunk-LE2XKKGQ.js +7 -0
  80. package/dist/bin/chunks/chunk-LJQIAFWS.js +5 -0
  81. package/dist/bin/chunks/chunk-LXFMIXGA.js +3 -0
  82. package/dist/bin/chunks/chunk-M7SIPZZZ.js +22 -0
  83. package/dist/bin/chunks/chunk-MF3GVFLC.js +11 -0
  84. package/dist/bin/chunks/chunk-MROECM42.js +3 -0
  85. package/dist/bin/chunks/chunk-MUFNRCMY.js +24 -0
  86. package/dist/bin/chunks/chunk-MVBK66TR.js +22 -0
  87. package/dist/bin/chunks/chunk-MYTNZ7MA.js +7 -0
  88. package/dist/bin/chunks/chunk-N26Y42L6.js +10 -0
  89. package/dist/bin/chunks/chunk-NE4R2FVV.js +5 -0
  90. package/dist/bin/chunks/chunk-NLU5LALY.js +37 -0
  91. package/dist/bin/chunks/chunk-NXUXZWS5.js +7 -0
  92. package/dist/bin/chunks/chunk-O2BCKSMK.js +3 -0
  93. package/dist/bin/chunks/chunk-OLEQNRKX.js +8 -0
  94. package/dist/bin/chunks/chunk-OUQKFRVR.js +6 -0
  95. package/dist/bin/chunks/chunk-OXLC2WWX.js +26 -0
  96. package/dist/bin/chunks/chunk-OYXHOZZ4.js +15 -0
  97. package/dist/bin/chunks/chunk-PBOVSFTJ.js +3 -0
  98. package/dist/bin/chunks/chunk-PPVF2N6C.js +3 -0
  99. package/dist/bin/chunks/chunk-PQ2INDRF.js +87 -0
  100. package/dist/bin/chunks/chunk-PXP4YYZA.js +13 -0
  101. package/dist/bin/chunks/chunk-PZQVSQX6.js +4 -0
  102. package/dist/bin/chunks/chunk-Q2GOPGDA.js +6 -0
  103. package/dist/bin/chunks/chunk-Q3LE3Y66.js +13 -0
  104. package/dist/bin/chunks/chunk-QES5OSUC.js +3 -0
  105. package/dist/bin/chunks/chunk-QFTZKD5O.js +13 -0
  106. package/dist/bin/chunks/chunk-QL33F2W6.js +8 -0
  107. package/dist/bin/chunks/chunk-QMPZXXEK.js +8 -0
  108. package/dist/bin/chunks/chunk-QYZN33JA.js +3 -0
  109. package/dist/bin/chunks/chunk-R2J5MJOM.js +20 -0
  110. package/dist/bin/chunks/chunk-RPUFEP5O.js +65 -0
  111. package/dist/bin/chunks/chunk-RVPTAYDS.js +4 -0
  112. package/dist/bin/chunks/chunk-SC5TEGMM.js +12 -0
  113. package/dist/bin/chunks/chunk-SDGPS6XI.js +10 -0
  114. package/dist/bin/chunks/chunk-TW2IJRUF.js +3 -0
  115. package/dist/bin/chunks/chunk-TYBXHT6W.js +10 -0
  116. package/dist/bin/chunks/chunk-V2XF3TTW.js +276 -0
  117. package/dist/bin/chunks/chunk-V4U26ZWL.js +16 -0
  118. package/dist/bin/chunks/chunk-VTAMGD42.js +3 -0
  119. package/dist/bin/chunks/chunk-WAJVRK5B.js +16 -0
  120. package/dist/bin/chunks/chunk-WEHA3JFD.js +3 -0
  121. package/dist/bin/chunks/chunk-WFHYGSLJ.js +6 -0
  122. package/dist/bin/chunks/chunk-WFVCEB5T.js +3 -0
  123. package/dist/bin/chunks/chunk-YERKK5B3.js +4 -0
  124. package/dist/bin/chunks/chunk-YIANER7Y.js +8 -0
  125. package/dist/bin/chunks/chunk-YJ5OCPSK.js +7 -0
  126. package/dist/bin/chunks/chunk-YOIFOOGX.js +9 -0
  127. package/dist/bin/chunks/chunk-YQEKKZTU.js +12 -0
  128. package/dist/bin/chunks/chunk-YUZRUF5F.js +10 -0
  129. package/dist/bin/chunks/chunk-ZMGLTHSU.js +15 -0
  130. package/dist/bin/chunks/clear-OE52K3TM.js +3 -0
  131. package/dist/bin/chunks/column-AJFK3TWF.js +3 -0
  132. package/dist/bin/chunks/comm-URDMZCXL.js +3 -0
  133. package/dist/bin/chunks/cp-OMVKM35F.js +3 -0
  134. package/dist/bin/chunks/curl-NHNZ46BU.js +31 -0
  135. package/dist/bin/chunks/cut-42X6363P.js +3 -0
  136. package/dist/bin/chunks/date-6MQGVWDY.js +3 -0
  137. package/dist/bin/chunks/diff-YXZZCUSQ.js +3 -0
  138. package/dist/bin/chunks/dirname-TPUFCYF6.js +3 -0
  139. package/dist/bin/chunks/dist-5MWO25Y4.js +141 -0
  140. package/dist/bin/chunks/du-LUFPVLNW.js +3 -0
  141. package/dist/bin/chunks/echo-NYDCCFWB.js +3 -0
  142. package/dist/bin/chunks/env-2TSVF4W7.js +3 -0
  143. package/dist/bin/chunks/expand-IQRKKT7D.js +3 -0
  144. package/dist/bin/chunks/expr-NNMDHOCN.js +3 -0
  145. package/dist/bin/chunks/file-4T64QNLS.js +3 -0
  146. package/dist/bin/chunks/find-AWH2KOY7.js +3 -0
  147. package/dist/bin/chunks/flag-coverage-J2ZHA465.js +3 -0
  148. package/dist/bin/chunks/fold-YEY7X54W.js +3 -0
  149. package/dist/bin/chunks/grep-CVU5V66H.js +3 -0
  150. package/dist/bin/chunks/gzip-FDPA6EKG.js +3 -0
  151. package/dist/bin/chunks/head-QKVY3SIO.js +3 -0
  152. package/dist/bin/chunks/help-HVIDHJ6M.js +3 -0
  153. package/dist/bin/chunks/history-3HAU45KT.js +3 -0
  154. package/dist/bin/chunks/hostname-2I76DUQL.js +3 -0
  155. package/dist/bin/chunks/html-to-markdown-XUMA42ZC.js +3 -0
  156. package/dist/bin/chunks/join-34DX7YK5.js +3 -0
  157. package/dist/bin/chunks/jq-V7OTAVU5.js +3 -0
  158. package/dist/bin/chunks/js-exec-DJQLXWCS.js +99 -0
  159. package/dist/bin/chunks/js-exec-worker.js +4809 -0
  160. package/dist/bin/chunks/ln-B35EKC2Q.js +3 -0
  161. package/dist/bin/chunks/ls-Q6ZZ6SQ2.js +3 -0
  162. package/dist/bin/chunks/md5sum-Z6KAYGDK.js +3 -0
  163. package/dist/bin/chunks/mkdir-74BP5NTG.js +3 -0
  164. package/dist/bin/chunks/mv-76LAHXFR.js +3 -0
  165. package/dist/bin/chunks/nl-4IZRRT7U.js +3 -0
  166. package/dist/bin/chunks/od-2GXD4D5K.js +3 -0
  167. package/dist/bin/chunks/paste-DWWA3JTW.js +3 -0
  168. package/dist/bin/chunks/printf-YXCSED2H.js +3 -0
  169. package/dist/bin/chunks/pwd-YKLNXWZI.js +3 -0
  170. package/dist/bin/chunks/python3-JCJHSX4Z.js +14 -0
  171. package/dist/bin/chunks/readlink-EHXJNW62.js +3 -0
  172. package/dist/bin/chunks/rev-CZTQCNOZ.js +3 -0
  173. package/dist/bin/chunks/rg-PXNKNIMY.js +3 -0
  174. package/dist/bin/chunks/rm-3PLW4O4B.js +3 -0
  175. package/dist/bin/chunks/rmdir-7ZIVFZJX.js +3 -0
  176. package/dist/bin/chunks/sed-4LVDFHIJ.js +3 -0
  177. package/dist/bin/chunks/seq-X2EAOGV5.js +3 -0
  178. package/dist/bin/chunks/sha1sum-CATBXX76.js +3 -0
  179. package/dist/bin/chunks/sha256sum-YGSNBVY3.js +3 -0
  180. package/dist/bin/chunks/sleep-DVFE2GSF.js +3 -0
  181. package/dist/bin/chunks/sort-HBOCBBJQ.js +3 -0
  182. package/dist/bin/chunks/split-ZNNNHKSP.js +3 -0
  183. package/dist/bin/chunks/sqlite3-KP42NNIY.js +3 -0
  184. package/dist/bin/chunks/sqlite3-worker.js +1928 -0
  185. package/dist/bin/chunks/stat-LROLDXHH.js +3 -0
  186. package/dist/bin/chunks/strings-CNUK76JL.js +3 -0
  187. package/dist/bin/chunks/tac-DG4BMYM5.js +3 -0
  188. package/dist/bin/chunks/tail-UOTUV25D.js +3 -0
  189. package/dist/bin/chunks/tar-7HGZIMZD.js +3 -0
  190. package/dist/bin/chunks/tee-L4HKV5PD.js +3 -0
  191. package/dist/bin/chunks/time-LF7BTSK5.js +3 -0
  192. package/dist/bin/chunks/timeout-YGFHQJKX.js +3 -0
  193. package/dist/bin/chunks/touch-TVQAUQOG.js +3 -0
  194. package/dist/bin/chunks/tr-PVFO6FRY.js +3 -0
  195. package/dist/bin/chunks/tree-ZGP6NPGS.js +3 -0
  196. package/dist/bin/chunks/true-KFTJGQLQ.js +3 -0
  197. package/dist/bin/chunks/unexpand-JPOQORZF.js +3 -0
  198. package/dist/bin/chunks/uniq-JMHDIJXT.js +3 -0
  199. package/dist/bin/chunks/wc-3KLVOCI2.js +3 -0
  200. package/dist/bin/chunks/which-4TPGVSBZ.js +3 -0
  201. package/dist/bin/chunks/whoami-B5HDVKW6.js +3 -0
  202. package/dist/bin/chunks/worker.js +3330 -0
  203. package/dist/bin/chunks/xan-WW53ETXT.js +3 -0
  204. package/dist/bin/chunks/xan-view-PD26QEFN.js +3 -0
  205. package/dist/bin/chunks/xargs-4AMMXFXL.js +3 -0
  206. package/dist/bin/chunks/yq-MYZOS2WN.js +3 -0
  207. package/dist/bin/just-bash.js +858 -0
  208. package/dist/bin/shell/chunks/alias-3R4G6HQY.js +3 -0
  209. package/dist/bin/shell/chunks/awk2-KO7ZE3P7.js +3 -0
  210. package/dist/bin/shell/chunks/base64-TQ5KOCNW.js +3 -0
  211. package/dist/bin/shell/chunks/basename-C4CRGDXP.js +3 -0
  212. package/dist/bin/shell/chunks/bash-CFCBBWVH.js +3 -0
  213. package/dist/bin/shell/chunks/cat-BQ7FQTN5.js +3 -0
  214. package/dist/bin/shell/chunks/chmod-WYYTXGVB.js +3 -0
  215. package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +20 -0
  216. package/dist/bin/shell/chunks/chunk-2ETT4ELS.js +4 -0
  217. package/dist/bin/shell/chunks/chunk-2UV6ZFHK.js +4 -0
  218. package/dist/bin/shell/chunks/chunk-2YLY6FJA.js +10 -0
  219. package/dist/bin/shell/chunks/chunk-3FQBUEB6.js +3 -0
  220. package/dist/bin/shell/chunks/chunk-3MRB66F4.js +3 -0
  221. package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +3 -0
  222. package/dist/bin/shell/chunks/chunk-42AMF6EE.js +3 -0
  223. package/dist/bin/shell/chunks/chunk-43E7AR6A.js +3 -0
  224. package/dist/bin/shell/chunks/chunk-45DUHCXR.js +7 -0
  225. package/dist/bin/shell/chunks/chunk-472JZJ2D.js +22 -0
  226. package/dist/bin/shell/chunks/chunk-47IFMQYS.js +3 -0
  227. package/dist/bin/shell/chunks/chunk-4JF56A3P.js +15 -0
  228. package/dist/bin/shell/chunks/chunk-5SKEZPTU.js +12 -0
  229. package/dist/bin/shell/chunks/chunk-67XYNGRV.js +9 -0
  230. package/dist/bin/shell/chunks/chunk-6ESRNSO7.js +7 -0
  231. package/dist/bin/shell/chunks/chunk-6KHZX4HU.js +12 -0
  232. package/dist/bin/shell/chunks/chunk-7FGDUBSN.js +14 -0
  233. package/dist/bin/shell/chunks/chunk-7JZKVC3F.js +2 -0
  234. package/dist/bin/shell/chunks/chunk-7PPAWLUI.js +12 -0
  235. package/dist/bin/shell/chunks/chunk-7PUOS2OO.js +143 -0
  236. package/dist/bin/shell/chunks/chunk-7VWOECJ3.js +101 -0
  237. package/dist/bin/shell/chunks/chunk-7WBCA2BB.js +3 -0
  238. package/dist/bin/shell/chunks/chunk-AGKL4LDL.js +4 -0
  239. package/dist/bin/shell/chunks/chunk-AI7JUA46.js +13 -0
  240. package/dist/bin/shell/chunks/chunk-AJF3OBTR.js +4 -0
  241. package/dist/bin/shell/chunks/chunk-B2DRBHGQ.js +3 -0
  242. package/dist/bin/shell/chunks/chunk-B2GCIQI2.js +16 -0
  243. package/dist/bin/shell/chunks/chunk-B6WWC6K3.js +9 -0
  244. package/dist/bin/shell/chunks/chunk-BIJXTWZ4.js +3 -0
  245. package/dist/bin/shell/chunks/chunk-CC2AQ6B7.js +15 -0
  246. package/dist/bin/shell/chunks/chunk-CL7IYCGG.js +20 -0
  247. package/dist/bin/shell/chunks/chunk-CMTQFWZK.js +5 -0
  248. package/dist/bin/shell/chunks/chunk-CPKBPQ2C.js +3 -0
  249. package/dist/bin/shell/chunks/chunk-DJAX3ZRG.js +8 -0
  250. package/dist/bin/shell/chunks/chunk-DN2YCFOR.js +3 -0
  251. package/dist/bin/shell/chunks/chunk-DYIBFLS3.js +17 -0
  252. package/dist/bin/shell/chunks/chunk-DZAFUADN.js +36 -0
  253. package/dist/bin/shell/chunks/chunk-F3UDTTI7.js +13 -0
  254. package/dist/bin/shell/chunks/chunk-FHMIEBRM.js +6 -0
  255. package/dist/bin/shell/chunks/chunk-FONAGXRJ.js +17 -0
  256. package/dist/bin/shell/chunks/chunk-FPWHWWXO.js +8 -0
  257. package/dist/bin/shell/chunks/chunk-FUT3X2GJ.js +9 -0
  258. package/dist/bin/shell/chunks/chunk-G4AUMZUY.js +4 -0
  259. package/dist/bin/shell/chunks/chunk-GA5TPRMF.js +34 -0
  260. package/dist/bin/shell/chunks/chunk-GOWX7VPU.js +7 -0
  261. package/dist/bin/shell/chunks/chunk-GQKQEK5N.js +11 -0
  262. package/dist/bin/shell/chunks/chunk-GR4ZHKXI.js +3 -0
  263. package/dist/bin/shell/chunks/chunk-HDWHYM2T.js +18 -0
  264. package/dist/bin/shell/chunks/chunk-HQ63MFHG.js +34 -0
  265. package/dist/bin/shell/chunks/chunk-HW2VJKFH.js +4 -0
  266. package/dist/bin/shell/chunks/chunk-HWI42GQO.js +7 -0
  267. package/dist/bin/shell/chunks/chunk-HZGHQZSY.js +10 -0
  268. package/dist/bin/shell/chunks/chunk-I4IRHQDW.js +3 -0
  269. package/dist/bin/shell/chunks/chunk-I57EACSL.js +3 -0
  270. package/dist/bin/shell/chunks/chunk-JELR4642.js +21 -0
  271. package/dist/bin/shell/chunks/chunk-JQM3DKCH.js +12 -0
  272. package/dist/bin/shell/chunks/chunk-K27FY3ES.js +3 -0
  273. package/dist/bin/shell/chunks/chunk-KG2KXL4Y.js +3 -0
  274. package/dist/bin/shell/chunks/chunk-KI54R2QB.js +3 -0
  275. package/dist/bin/shell/chunks/chunk-KP2UH5CJ.js +22 -0
  276. package/dist/bin/shell/chunks/chunk-KUMHQGUR.js +3 -0
  277. package/dist/bin/shell/chunks/chunk-LE2XKKGQ.js +7 -0
  278. package/dist/bin/shell/chunks/chunk-LJQIAFWS.js +5 -0
  279. package/dist/bin/shell/chunks/chunk-LXFMIXGA.js +3 -0
  280. package/dist/bin/shell/chunks/chunk-M7SIPZZZ.js +22 -0
  281. package/dist/bin/shell/chunks/chunk-MF3GVFLC.js +11 -0
  282. package/dist/bin/shell/chunks/chunk-MROECM42.js +3 -0
  283. package/dist/bin/shell/chunks/chunk-MUFNRCMY.js +24 -0
  284. package/dist/bin/shell/chunks/chunk-MVBK66TR.js +22 -0
  285. package/dist/bin/shell/chunks/chunk-MYTNZ7MA.js +7 -0
  286. package/dist/bin/shell/chunks/chunk-N26Y42L6.js +10 -0
  287. package/dist/bin/shell/chunks/chunk-NE4R2FVV.js +5 -0
  288. package/dist/bin/shell/chunks/chunk-NLU5LALY.js +37 -0
  289. package/dist/bin/shell/chunks/chunk-NXUXZWS5.js +7 -0
  290. package/dist/bin/shell/chunks/chunk-O2BCKSMK.js +3 -0
  291. package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +8 -0
  292. package/dist/bin/shell/chunks/chunk-OUQKFRVR.js +6 -0
  293. package/dist/bin/shell/chunks/chunk-OXLC2WWX.js +26 -0
  294. package/dist/bin/shell/chunks/chunk-OYXHOZZ4.js +15 -0
  295. package/dist/bin/shell/chunks/chunk-PBOVSFTJ.js +3 -0
  296. package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +3 -0
  297. package/dist/bin/shell/chunks/chunk-PQ2INDRF.js +87 -0
  298. package/dist/bin/shell/chunks/chunk-PXP4YYZA.js +13 -0
  299. package/dist/bin/shell/chunks/chunk-PZQVSQX6.js +4 -0
  300. package/dist/bin/shell/chunks/chunk-Q2GOPGDA.js +6 -0
  301. package/dist/bin/shell/chunks/chunk-Q3LE3Y66.js +13 -0
  302. package/dist/bin/shell/chunks/chunk-QES5OSUC.js +3 -0
  303. package/dist/bin/shell/chunks/chunk-QFTZKD5O.js +13 -0
  304. package/dist/bin/shell/chunks/chunk-QL33F2W6.js +8 -0
  305. package/dist/bin/shell/chunks/chunk-QMPZXXEK.js +8 -0
  306. package/dist/bin/shell/chunks/chunk-QYZN33JA.js +3 -0
  307. package/dist/bin/shell/chunks/chunk-R2J5MJOM.js +20 -0
  308. package/dist/bin/shell/chunks/chunk-RPUFEP5O.js +65 -0
  309. package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +4 -0
  310. package/dist/bin/shell/chunks/chunk-SC5TEGMM.js +12 -0
  311. package/dist/bin/shell/chunks/chunk-SDGPS6XI.js +10 -0
  312. package/dist/bin/shell/chunks/chunk-TW2IJRUF.js +3 -0
  313. package/dist/bin/shell/chunks/chunk-TYBXHT6W.js +10 -0
  314. package/dist/bin/shell/chunks/chunk-V2XF3TTW.js +276 -0
  315. package/dist/bin/shell/chunks/chunk-V4U26ZWL.js +16 -0
  316. package/dist/bin/shell/chunks/chunk-VTAMGD42.js +3 -0
  317. package/dist/bin/shell/chunks/chunk-WAJVRK5B.js +16 -0
  318. package/dist/bin/shell/chunks/chunk-WEHA3JFD.js +3 -0
  319. package/dist/bin/shell/chunks/chunk-WFHYGSLJ.js +6 -0
  320. package/dist/bin/shell/chunks/chunk-WFVCEB5T.js +3 -0
  321. package/dist/bin/shell/chunks/chunk-YERKK5B3.js +4 -0
  322. package/dist/bin/shell/chunks/chunk-YIANER7Y.js +8 -0
  323. package/dist/bin/shell/chunks/chunk-YJ5OCPSK.js +7 -0
  324. package/dist/bin/shell/chunks/chunk-YOIFOOGX.js +9 -0
  325. package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +12 -0
  326. package/dist/bin/shell/chunks/chunk-YUZRUF5F.js +10 -0
  327. package/dist/bin/shell/chunks/chunk-ZMGLTHSU.js +15 -0
  328. package/dist/bin/shell/chunks/clear-OE52K3TM.js +3 -0
  329. package/dist/bin/shell/chunks/column-AJFK3TWF.js +3 -0
  330. package/dist/bin/shell/chunks/comm-URDMZCXL.js +3 -0
  331. package/dist/bin/shell/chunks/cp-OMVKM35F.js +3 -0
  332. package/dist/bin/shell/chunks/curl-NHNZ46BU.js +31 -0
  333. package/dist/bin/shell/chunks/cut-42X6363P.js +3 -0
  334. package/dist/bin/shell/chunks/date-6MQGVWDY.js +3 -0
  335. package/dist/bin/shell/chunks/diff-YXZZCUSQ.js +3 -0
  336. package/dist/bin/shell/chunks/dirname-TPUFCYF6.js +3 -0
  337. package/dist/bin/shell/chunks/dist-5MWO25Y4.js +141 -0
  338. package/dist/bin/shell/chunks/du-LUFPVLNW.js +3 -0
  339. package/dist/bin/shell/chunks/echo-NYDCCFWB.js +3 -0
  340. package/dist/bin/shell/chunks/env-2TSVF4W7.js +3 -0
  341. package/dist/bin/shell/chunks/expand-IQRKKT7D.js +3 -0
  342. package/dist/bin/shell/chunks/expr-NNMDHOCN.js +3 -0
  343. package/dist/bin/shell/chunks/file-4T64QNLS.js +3 -0
  344. package/dist/bin/shell/chunks/find-AWH2KOY7.js +3 -0
  345. package/dist/bin/shell/chunks/flag-coverage-J2ZHA465.js +3 -0
  346. package/dist/bin/shell/chunks/fold-YEY7X54W.js +3 -0
  347. package/dist/bin/shell/chunks/grep-CVU5V66H.js +3 -0
  348. package/dist/bin/shell/chunks/gzip-FDPA6EKG.js +3 -0
  349. package/dist/bin/shell/chunks/head-QKVY3SIO.js +3 -0
  350. package/dist/bin/shell/chunks/help-HVIDHJ6M.js +3 -0
  351. package/dist/bin/shell/chunks/history-3HAU45KT.js +3 -0
  352. package/dist/bin/shell/chunks/hostname-2I76DUQL.js +3 -0
  353. package/dist/bin/shell/chunks/html-to-markdown-XUMA42ZC.js +3 -0
  354. package/dist/bin/shell/chunks/join-34DX7YK5.js +3 -0
  355. package/dist/bin/shell/chunks/jq-V7OTAVU5.js +3 -0
  356. package/dist/bin/shell/chunks/js-exec-DJQLXWCS.js +99 -0
  357. package/dist/bin/shell/chunks/ln-B35EKC2Q.js +3 -0
  358. package/dist/bin/shell/chunks/ls-Q6ZZ6SQ2.js +3 -0
  359. package/dist/bin/shell/chunks/md5sum-Z6KAYGDK.js +3 -0
  360. package/dist/bin/shell/chunks/mkdir-74BP5NTG.js +3 -0
  361. package/dist/bin/shell/chunks/mv-76LAHXFR.js +3 -0
  362. package/dist/bin/shell/chunks/nl-4IZRRT7U.js +3 -0
  363. package/dist/bin/shell/chunks/od-2GXD4D5K.js +3 -0
  364. package/dist/bin/shell/chunks/paste-DWWA3JTW.js +3 -0
  365. package/dist/bin/shell/chunks/printf-YXCSED2H.js +3 -0
  366. package/dist/bin/shell/chunks/pwd-YKLNXWZI.js +3 -0
  367. package/dist/bin/shell/chunks/python3-JCJHSX4Z.js +14 -0
  368. package/dist/bin/shell/chunks/readlink-EHXJNW62.js +3 -0
  369. package/dist/bin/shell/chunks/rev-CZTQCNOZ.js +3 -0
  370. package/dist/bin/shell/chunks/rg-PXNKNIMY.js +3 -0
  371. package/dist/bin/shell/chunks/rm-3PLW4O4B.js +3 -0
  372. package/dist/bin/shell/chunks/rmdir-7ZIVFZJX.js +3 -0
  373. package/dist/bin/shell/chunks/sed-4LVDFHIJ.js +3 -0
  374. package/dist/bin/shell/chunks/seq-X2EAOGV5.js +3 -0
  375. package/dist/bin/shell/chunks/sha1sum-CATBXX76.js +3 -0
  376. package/dist/bin/shell/chunks/sha256sum-YGSNBVY3.js +3 -0
  377. package/dist/bin/shell/chunks/sleep-DVFE2GSF.js +3 -0
  378. package/dist/bin/shell/chunks/sort-HBOCBBJQ.js +3 -0
  379. package/dist/bin/shell/chunks/split-ZNNNHKSP.js +3 -0
  380. package/dist/bin/shell/chunks/sqlite3-KP42NNIY.js +3 -0
  381. package/dist/bin/shell/chunks/stat-LROLDXHH.js +3 -0
  382. package/dist/bin/shell/chunks/strings-CNUK76JL.js +3 -0
  383. package/dist/bin/shell/chunks/tac-DG4BMYM5.js +3 -0
  384. package/dist/bin/shell/chunks/tail-UOTUV25D.js +3 -0
  385. package/dist/bin/shell/chunks/tar-7HGZIMZD.js +3 -0
  386. package/dist/bin/shell/chunks/tee-L4HKV5PD.js +3 -0
  387. package/dist/bin/shell/chunks/time-LF7BTSK5.js +3 -0
  388. package/dist/bin/shell/chunks/timeout-YGFHQJKX.js +3 -0
  389. package/dist/bin/shell/chunks/touch-TVQAUQOG.js +3 -0
  390. package/dist/bin/shell/chunks/tr-PVFO6FRY.js +3 -0
  391. package/dist/bin/shell/chunks/tree-ZGP6NPGS.js +3 -0
  392. package/dist/bin/shell/chunks/true-KFTJGQLQ.js +3 -0
  393. package/dist/bin/shell/chunks/unexpand-JPOQORZF.js +3 -0
  394. package/dist/bin/shell/chunks/uniq-JMHDIJXT.js +3 -0
  395. package/dist/bin/shell/chunks/wc-3KLVOCI2.js +3 -0
  396. package/dist/bin/shell/chunks/which-4TPGVSBZ.js +3 -0
  397. package/dist/bin/shell/chunks/whoami-B5HDVKW6.js +3 -0
  398. package/dist/bin/shell/chunks/xan-WW53ETXT.js +3 -0
  399. package/dist/bin/shell/chunks/xan-view-PD26QEFN.js +3 -0
  400. package/dist/bin/shell/chunks/xargs-4AMMXFXL.js +3 -0
  401. package/dist/bin/shell/chunks/yq-MYZOS2WN.js +3 -0
  402. package/dist/bin/shell/shell.js +834 -0
  403. package/dist/bounded-builder.d.ts +37 -0
  404. package/dist/browser.d.ts +23 -0
  405. package/dist/bundle/browser.js +1576 -0
  406. package/dist/bundle/chunks/alias-T5TO5GWK.js +2 -0
  407. package/dist/bundle/chunks/awk2-W6BNZEJN.js +2 -0
  408. package/dist/bundle/chunks/base64-MHVQ5XHI.js +2 -0
  409. package/dist/bundle/chunks/basename-SJZQ5W65.js +2 -0
  410. package/dist/bundle/chunks/bash-HIEWVHJ2.js +2 -0
  411. package/dist/bundle/chunks/cat-VZBWBIJB.js +2 -0
  412. package/dist/bundle/chunks/chmod-WM2JFFQC.js +2 -0
  413. package/dist/bundle/chunks/chunk-24NLAR7R.js +36 -0
  414. package/dist/bundle/chunks/chunk-26GP3ACY.js +12 -0
  415. package/dist/bundle/chunks/chunk-2KNTH3KH.js +9 -0
  416. package/dist/bundle/chunks/chunk-2SMD2AUA.js +3 -0
  417. package/dist/bundle/chunks/chunk-2TSZPVPI.js +21 -0
  418. package/dist/bundle/chunks/chunk-2VWG4LDT.js +11 -0
  419. package/dist/bundle/chunks/chunk-3WASQYTF.js +11 -0
  420. package/dist/bundle/chunks/chunk-44YCJWNC.js +6 -0
  421. package/dist/bundle/chunks/chunk-4EDQZIAN.js +5 -0
  422. package/dist/bundle/chunks/chunk-4MJ7VJG4.js +21 -0
  423. package/dist/bundle/chunks/chunk-4MZPEZTU.js +3 -0
  424. package/dist/bundle/chunks/chunk-57LGFT4S.js +3 -0
  425. package/dist/bundle/chunks/chunk-5I5U6IYI.js +142 -0
  426. package/dist/bundle/chunks/chunk-6DDRR56B.js +33 -0
  427. package/dist/bundle/chunks/chunk-6QF3PCMO.js +8 -0
  428. package/dist/bundle/chunks/chunk-6RK4AAB7.js +21 -0
  429. package/dist/bundle/chunks/chunk-6WGIZV3E.js +13 -0
  430. package/dist/bundle/chunks/chunk-73JQKNZT.js +33 -0
  431. package/dist/bundle/chunks/chunk-7AISL3XV.js +12 -0
  432. package/dist/bundle/chunks/chunk-7EUWTCWK.js +2 -0
  433. package/dist/bundle/chunks/chunk-7IJWBG4I.js +2 -0
  434. package/dist/bundle/chunks/chunk-7O2RDO2R.js +14 -0
  435. package/dist/bundle/chunks/chunk-A4R2GWRF.js +9 -0
  436. package/dist/bundle/chunks/chunk-AGH5UJJI.js +4 -0
  437. package/dist/bundle/chunks/chunk-ANCQ4SCV.js +2 -0
  438. package/dist/bundle/chunks/chunk-ASE6AYV3.js +17 -0
  439. package/dist/bundle/chunks/chunk-AYSZ5MAE.js +2 -0
  440. package/dist/bundle/chunks/chunk-BKUWXPEM.js +2 -0
  441. package/dist/bundle/chunks/chunk-BRJERIF4.js +2 -0
  442. package/dist/bundle/chunks/chunk-DAKEIWT3.js +21 -0
  443. package/dist/bundle/chunks/chunk-DLL7UR66.js +2 -0
  444. package/dist/bundle/chunks/chunk-DMWNBCXJ.js +10 -0
  445. package/dist/bundle/chunks/chunk-DVSA72LH.js +2 -0
  446. package/dist/bundle/chunks/chunk-EJFBIRMD.js +6 -0
  447. package/dist/bundle/chunks/chunk-EZNS4GF7.js +9 -0
  448. package/dist/bundle/chunks/chunk-F6XU52K3.js +35 -0
  449. package/dist/bundle/chunks/chunk-FHC24QSK.js +7 -0
  450. package/dist/bundle/chunks/chunk-FIMF2TLE.js +20 -0
  451. package/dist/bundle/chunks/chunk-FOCWZZDE.js +2 -0
  452. package/dist/bundle/chunks/chunk-FQUVK4Q5.js +11 -0
  453. package/dist/bundle/chunks/chunk-FSJ6TTCC.js +19 -0
  454. package/dist/bundle/chunks/chunk-FT6ODGOU.js +2 -0
  455. package/dist/bundle/chunks/chunk-FTET43KM.js +2 -0
  456. package/dist/bundle/chunks/chunk-FX4RBUYU.js +5 -0
  457. package/dist/bundle/chunks/chunk-FZRQOL3C.js +7 -0
  458. package/dist/bundle/chunks/chunk-FZZL53S2.js +275 -0
  459. package/dist/bundle/chunks/chunk-GN6CQ3J4.js +2 -0
  460. package/dist/bundle/chunks/chunk-HDRAUQK2.js +2 -0
  461. package/dist/bundle/chunks/chunk-HP7HWZ2S.js +15 -0
  462. package/dist/bundle/chunks/chunk-HRIJVWZS.js +14 -0
  463. package/dist/bundle/chunks/chunk-HXWB4Z5X.js +7 -0
  464. package/dist/bundle/chunks/chunk-ICLA3MUR.js +3 -0
  465. package/dist/bundle/chunks/chunk-IXFQXNL4.js +7 -0
  466. package/dist/bundle/chunks/chunk-KIGPB52X.js +2 -0
  467. package/dist/bundle/chunks/chunk-L2UW7DWF.js +2 -0
  468. package/dist/bundle/chunks/chunk-LI6PTSPD.js +9 -0
  469. package/dist/bundle/chunks/chunk-LPJEKUCB.js +8 -0
  470. package/dist/bundle/chunks/chunk-LSLPJOYM.js +3 -0
  471. package/dist/bundle/chunks/chunk-LVDUF74R.js +7 -0
  472. package/dist/bundle/chunks/chunk-MLIO3BK2.js +7 -0
  473. package/dist/bundle/chunks/chunk-MQKGGNPS.js +16 -0
  474. package/dist/bundle/chunks/chunk-N3A4JVFJ.js +2 -0
  475. package/dist/bundle/chunks/chunk-NBNI7G66.js +8 -0
  476. package/dist/bundle/chunks/chunk-NCUTH6QL.js +2 -0
  477. package/dist/bundle/chunks/chunk-OQ7C4FYO.js +2 -0
  478. package/dist/bundle/chunks/chunk-P57S6Z6R.js +6 -0
  479. package/dist/bundle/chunks/chunk-PCPW54JH.js +7 -0
  480. package/dist/bundle/chunks/chunk-PJM5C3HZ.js +25 -0
  481. package/dist/bundle/chunks/chunk-PPEXVPHR.js +19 -0
  482. package/dist/bundle/chunks/chunk-Q4JSJ3KQ.js +4 -0
  483. package/dist/bundle/chunks/chunk-QAYAQNCG.js +23 -0
  484. package/dist/bundle/chunks/chunk-QHDBQA5N.js +9 -0
  485. package/dist/bundle/chunks/chunk-QIQMJJZ4.js +4 -0
  486. package/dist/bundle/chunks/chunk-QJ7OXJAZ.js +6 -0
  487. package/dist/bundle/chunks/chunk-QJFYYEFV.js +11 -0
  488. package/dist/bundle/chunks/chunk-R2FBRMDU.js +14 -0
  489. package/dist/bundle/chunks/chunk-ROAWFE6V.js +5 -0
  490. package/dist/bundle/chunks/chunk-RPKJJFGZ.js +14 -0
  491. package/dist/bundle/chunks/chunk-S3ENGQML.js +15 -0
  492. package/dist/bundle/chunks/chunk-SBBYKIYU.js +3 -0
  493. package/dist/bundle/chunks/chunk-SGX4WOAM.js +2 -0
  494. package/dist/bundle/chunks/chunk-SHKOQWO4.js +3 -0
  495. package/dist/bundle/chunks/chunk-SIOONII3.js +2 -0
  496. package/dist/bundle/chunks/chunk-STHBFACM.js +1 -0
  497. package/dist/bundle/chunks/chunk-SX2HC7SO.js +2 -0
  498. package/dist/bundle/chunks/chunk-T6DNSPYO.js +100 -0
  499. package/dist/bundle/chunks/chunk-TBVD66LC.js +10 -0
  500. package/dist/bundle/chunks/chunk-TDD4NFYE.js +2 -0
  501. package/dist/bundle/chunks/chunk-TVCZIH6M.js +8 -0
  502. package/dist/bundle/chunks/chunk-U4K5ZDWK.js +9 -0
  503. package/dist/bundle/chunks/chunk-UC76ZOWM.js +15 -0
  504. package/dist/bundle/chunks/chunk-UIJUTQPH.js +3 -0
  505. package/dist/bundle/chunks/chunk-ULXTDFQC.js +2 -0
  506. package/dist/bundle/chunks/chunk-UTKGYVUZ.js +7 -0
  507. package/dist/bundle/chunks/chunk-UUIYAOD4.js +2 -0
  508. package/dist/bundle/chunks/chunk-VJ6UXG2R.js +64 -0
  509. package/dist/bundle/chunks/chunk-W2Z6LYL6.js +11 -0
  510. package/dist/bundle/chunks/chunk-W5DWRFSU.js +2 -0
  511. package/dist/bundle/chunks/chunk-WN54B5NQ.js +12 -0
  512. package/dist/bundle/chunks/chunk-WNH3HOQA.js +2 -0
  513. package/dist/bundle/chunks/chunk-WXPNKIIH.js +2 -0
  514. package/dist/bundle/chunks/chunk-WZQNMEQW.js +2 -0
  515. package/dist/bundle/chunks/chunk-XV2V56NQ.js +12 -0
  516. package/dist/bundle/chunks/chunk-XVSR5HHH.js +6 -0
  517. package/dist/bundle/chunks/chunk-XXBIOG4R.js +5 -0
  518. package/dist/bundle/chunks/chunk-Y62SXZKJ.js +12 -0
  519. package/dist/bundle/chunks/chunk-YEYSCLSJ.js +3 -0
  520. package/dist/bundle/chunks/chunk-YJKHREBZ.js +11 -0
  521. package/dist/bundle/chunks/chunk-YUSFCOM7.js +2 -0
  522. package/dist/bundle/chunks/chunk-ZBUZKIPX.js +6 -0
  523. package/dist/bundle/chunks/chunk-ZDPFA4L3.js +6 -0
  524. package/dist/bundle/chunks/chunk-ZT3WF5R7.js +16 -0
  525. package/dist/bundle/chunks/chunk-ZXFELXJH.js +6 -0
  526. package/dist/bundle/chunks/clear-KPIUNI6K.js +2 -0
  527. package/dist/bundle/chunks/column-QJI65SH2.js +2 -0
  528. package/dist/bundle/chunks/comm-DTWKU2MC.js +2 -0
  529. package/dist/bundle/chunks/cp-2KZIPZJS.js +2 -0
  530. package/dist/bundle/chunks/curl-K4WT7UPN.js +30 -0
  531. package/dist/bundle/chunks/cut-FMDNVWQN.js +2 -0
  532. package/dist/bundle/chunks/date-7OEDRA27.js +2 -0
  533. package/dist/bundle/chunks/diff-CSARC7WF.js +2 -0
  534. package/dist/bundle/chunks/dirname-Z2ZMOOW2.js +2 -0
  535. package/dist/bundle/chunks/du-7AZCLKR6.js +2 -0
  536. package/dist/bundle/chunks/echo-PLLZYM2L.js +2 -0
  537. package/dist/bundle/chunks/env-VUUMB47B.js +2 -0
  538. package/dist/bundle/chunks/expand-J3VOSOMK.js +2 -0
  539. package/dist/bundle/chunks/expr-XSBELPAC.js +2 -0
  540. package/dist/bundle/chunks/file-URNAD6FQ.js +2 -0
  541. package/dist/bundle/chunks/find-END3EAHV.js +2 -0
  542. package/dist/bundle/chunks/flag-coverage-DPSAPFXA.js +2 -0
  543. package/dist/bundle/chunks/fold-QJBPHRFJ.js +2 -0
  544. package/dist/bundle/chunks/grep-4AYF3A5J.js +2 -0
  545. package/dist/bundle/chunks/gzip-RQOBR22H.js +2 -0
  546. package/dist/bundle/chunks/head-6UIPFWVJ.js +2 -0
  547. package/dist/bundle/chunks/help-QDDMBDU7.js +2 -0
  548. package/dist/bundle/chunks/history-3N762S3K.js +2 -0
  549. package/dist/bundle/chunks/hostname-CESD3CQR.js +2 -0
  550. package/dist/bundle/chunks/html-to-markdown-PE6BPRPA.js +2 -0
  551. package/dist/bundle/chunks/join-C2B6NGXH.js +2 -0
  552. package/dist/bundle/chunks/jq-NY7PCVMH.js +2 -0
  553. package/dist/bundle/chunks/js-exec-XKF2B7C3.js +98 -0
  554. package/dist/bundle/chunks/js-exec-worker.js +4809 -0
  555. package/dist/bundle/chunks/ln-OPY2ZVGQ.js +2 -0
  556. package/dist/bundle/chunks/ls-ZPXGZX63.js +2 -0
  557. package/dist/bundle/chunks/md5sum-JEDX55KS.js +2 -0
  558. package/dist/bundle/chunks/mkdir-WDDKK2P3.js +2 -0
  559. package/dist/bundle/chunks/mv-ZF6UBVRB.js +2 -0
  560. package/dist/bundle/chunks/nl-IELOWYJG.js +2 -0
  561. package/dist/bundle/chunks/od-Z4AIL3P4.js +2 -0
  562. package/dist/bundle/chunks/paste-ZNHNSRBW.js +2 -0
  563. package/dist/bundle/chunks/printf-B2NSYQ3N.js +2 -0
  564. package/dist/bundle/chunks/pwd-76BPYV5F.js +2 -0
  565. package/dist/bundle/chunks/python3-F5S5TYGS.js +13 -0
  566. package/dist/bundle/chunks/readlink-U5OM5A3M.js +2 -0
  567. package/dist/bundle/chunks/rev-EPOS3MFH.js +2 -0
  568. package/dist/bundle/chunks/rg-NAMXBYKS.js +2 -0
  569. package/dist/bundle/chunks/rm-JQ4GDKDD.js +2 -0
  570. package/dist/bundle/chunks/rmdir-YJKPQVCK.js +2 -0
  571. package/dist/bundle/chunks/sed-LIRH26EA.js +2 -0
  572. package/dist/bundle/chunks/seq-B6KDLMYQ.js +2 -0
  573. package/dist/bundle/chunks/sha1sum-BLPZJ6MP.js +2 -0
  574. package/dist/bundle/chunks/sha256sum-VJZ4PHQ4.js +2 -0
  575. package/dist/bundle/chunks/sleep-PPRBTSVR.js +2 -0
  576. package/dist/bundle/chunks/sort-CB5GO7XH.js +2 -0
  577. package/dist/bundle/chunks/split-JICLAMP6.js +2 -0
  578. package/dist/bundle/chunks/sqlite3-4EZ4GXVD.js +2 -0
  579. package/dist/bundle/chunks/sqlite3-worker.js +1928 -0
  580. package/dist/bundle/chunks/stat-LXFZND2P.js +2 -0
  581. package/dist/bundle/chunks/strings-VLFTYX2Z.js +2 -0
  582. package/dist/bundle/chunks/tac-YXC4HBTR.js +2 -0
  583. package/dist/bundle/chunks/tail-UBGSN4JF.js +2 -0
  584. package/dist/bundle/chunks/tar-B72KU357.js +2 -0
  585. package/dist/bundle/chunks/tee-OOWSWHRQ.js +2 -0
  586. package/dist/bundle/chunks/time-NERE2JJ2.js +2 -0
  587. package/dist/bundle/chunks/timeout-C6WDYPLV.js +2 -0
  588. package/dist/bundle/chunks/touch-W4DF6Z4T.js +2 -0
  589. package/dist/bundle/chunks/tr-UI2LA3GA.js +2 -0
  590. package/dist/bundle/chunks/tree-7OOL2MH6.js +2 -0
  591. package/dist/bundle/chunks/true-QUBPEGGU.js +2 -0
  592. package/dist/bundle/chunks/unexpand-YD5BWFH4.js +2 -0
  593. package/dist/bundle/chunks/uniq-PAEPA27E.js +2 -0
  594. package/dist/bundle/chunks/wc-7WVM7GV4.js +2 -0
  595. package/dist/bundle/chunks/which-UWVKETYW.js +2 -0
  596. package/dist/bundle/chunks/whoami-KR6E7UIR.js +2 -0
  597. package/dist/bundle/chunks/worker.js +3330 -0
  598. package/dist/bundle/chunks/xan-UIGVJCMA.js +2 -0
  599. package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +2 -0
  600. package/dist/bundle/chunks/xargs-VQEXRD3C.js +2 -0
  601. package/dist/bundle/chunks/yq-FGNXZCGX.js +2 -0
  602. package/dist/bundle/index.cjs +2237 -0
  603. package/dist/bundle/index.js +809 -0
  604. package/dist/commands/alias/alias.d.ts +6 -0
  605. package/dist/commands/awk/ast.d.ts +202 -0
  606. package/dist/commands/awk/awk2.d.ts +9 -0
  607. package/dist/commands/awk/builtins.d.ts +17 -0
  608. package/dist/commands/awk/interpreter/context.d.ts +88 -0
  609. package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
  610. package/dist/commands/awk/interpreter/fields.d.ts +25 -0
  611. package/dist/commands/awk/interpreter/index.d.ts +8 -0
  612. package/dist/commands/awk/interpreter/interpreter.d.ts +54 -0
  613. package/dist/commands/awk/interpreter/statements.d.ts +11 -0
  614. package/dist/commands/awk/interpreter/type-coercion.d.ts +32 -0
  615. package/dist/commands/awk/interpreter/types.d.ts +13 -0
  616. package/dist/commands/awk/interpreter/variables.d.ts +35 -0
  617. package/dist/commands/awk/lexer.d.ts +101 -0
  618. package/dist/commands/awk/parser2-print.d.ts +38 -0
  619. package/dist/commands/awk/parser2.d.ts +96 -0
  620. package/dist/commands/base64/base64.d.ts +7 -0
  621. package/dist/commands/basename/basename.d.ts +4 -0
  622. package/dist/commands/bash/bash.d.ts +6 -0
  623. package/dist/commands/browser-excluded.d.ts +16 -0
  624. package/dist/commands/cat/cat.d.ts +4 -0
  625. package/dist/commands/chmod/chmod.d.ts +4 -0
  626. package/dist/commands/clear/clear.d.ts +4 -0
  627. package/dist/commands/column/column.d.ts +11 -0
  628. package/dist/commands/comm/comm.d.ts +12 -0
  629. package/dist/commands/compression/codec-budget.d.ts +35 -0
  630. package/dist/commands/cp/cp.d.ts +4 -0
  631. package/dist/commands/curl/curl.d.ts +8 -0
  632. package/dist/commands/curl/form.d.ts +23 -0
  633. package/dist/commands/curl/help.d.ts +9 -0
  634. package/dist/commands/curl/parse.d.ts +9 -0
  635. package/dist/commands/curl/response-formatting.d.ts +20 -0
  636. package/dist/commands/curl/types.d.ts +70 -0
  637. package/dist/commands/cut/cut.d.ts +4 -0
  638. package/dist/commands/date/date.d.ts +7 -0
  639. package/dist/commands/diff/diff.d.ts +7 -0
  640. package/dist/commands/dirname/dirname.d.ts +4 -0
  641. package/dist/commands/du/du.d.ts +4 -0
  642. package/dist/commands/duration.d.ts +5 -0
  643. package/dist/commands/echo/echo.d.ts +4 -0
  644. package/dist/commands/env/env.d.ts +6 -0
  645. package/dist/commands/expand/expand.d.ts +12 -0
  646. package/dist/commands/expand/unexpand.d.ts +12 -0
  647. package/dist/commands/expr/expr.d.ts +9 -0
  648. package/dist/commands/file/file.d.ts +9 -0
  649. package/dist/commands/find/find.d.ts +4 -0
  650. package/dist/commands/find/matcher.d.ts +53 -0
  651. package/dist/commands/find/parser.d.ts +2 -0
  652. package/dist/commands/find/types.d.ts +89 -0
  653. package/dist/commands/flag-coverage.d.ts +2 -0
  654. package/dist/commands/fold/fold.d.ts +12 -0
  655. package/dist/commands/format-mode.d.ts +4 -0
  656. package/dist/commands/fuzz-flags-types.d.ts +17 -0
  657. package/dist/commands/fuzz-flags.d.ts +8 -0
  658. package/dist/commands/grep/grep.d.ts +8 -0
  659. package/dist/commands/gzip/gzip.d.ts +13 -0
  660. package/dist/commands/head/head-tail-shared.d.ts +38 -0
  661. package/dist/commands/head/head.d.ts +4 -0
  662. package/dist/commands/help/help.d.ts +4 -0
  663. package/dist/commands/help.d.ts +16 -0
  664. package/dist/commands/history/history.d.ts +4 -0
  665. package/dist/commands/hostname/hostname.d.ts +11 -0
  666. package/dist/commands/html-to-markdown/html-to-markdown.d.ts +9 -0
  667. package/dist/commands/join/join.d.ts +12 -0
  668. package/dist/commands/jq/jq.d.ts +9 -0
  669. package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
  670. package/dist/commands/js-exec/js-exec-worker.d.ts +33 -0
  671. package/dist/commands/js-exec/js-exec.d.ts +13 -0
  672. package/dist/commands/js-exec/module-shims.d.ts +29 -0
  673. package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
  674. package/dist/commands/ln/ln.d.ts +4 -0
  675. package/dist/commands/ls/ls.d.ts +4 -0
  676. package/dist/commands/md5sum/checksum.d.ts +7 -0
  677. package/dist/commands/md5sum/md5sum.d.ts +4 -0
  678. package/dist/commands/md5sum/sha1sum.d.ts +4 -0
  679. package/dist/commands/md5sum/sha256sum.d.ts +4 -0
  680. package/dist/commands/mkdir/mkdir.d.ts +4 -0
  681. package/dist/commands/mv/mv.d.ts +4 -0
  682. package/dist/commands/nl/nl.d.ts +12 -0
  683. package/dist/commands/od/od.d.ts +12 -0
  684. package/dist/commands/paste/paste.d.ts +4 -0
  685. package/dist/commands/printf/escapes.d.ts +27 -0
  686. package/dist/commands/printf/printf.d.ts +4 -0
  687. package/dist/commands/printf/strftime.d.ts +14 -0
  688. package/dist/commands/pwd/pwd.d.ts +4 -0
  689. package/dist/commands/python3/python3.d.ts +16 -0
  690. package/dist/commands/python3/worker.d.ts +31 -0
  691. package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
  692. package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
  693. package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
  694. package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
  695. package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
  696. package/dist/commands/query-engine/builtins/index.d.ts +17 -0
  697. package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
  698. package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
  699. package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
  700. package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
  701. package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
  702. package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
  703. package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
  704. package/dist/commands/query-engine/evaluator.d.ts +62 -0
  705. package/dist/commands/query-engine/index.d.ts +8 -0
  706. package/dist/commands/query-engine/json-output.d.ts +11 -0
  707. package/dist/commands/query-engine/parser-types.d.ts +171 -0
  708. package/dist/commands/query-engine/parser.d.ts +14 -0
  709. package/dist/commands/query-engine/path-operations.d.ts +15 -0
  710. package/dist/commands/query-engine/safe-object.d.ts +84 -0
  711. package/dist/commands/query-engine/value-operations.d.ts +44 -0
  712. package/dist/commands/readlink/readlink.d.ts +4 -0
  713. package/dist/commands/registry.d.ts +56 -0
  714. package/dist/commands/rev/rev.d.ts +13 -0
  715. package/dist/commands/rg/file-types.d.ts +49 -0
  716. package/dist/commands/rg/gitignore.d.ts +98 -0
  717. package/dist/commands/rg/rg-options.d.ts +61 -0
  718. package/dist/commands/rg/rg-parser.d.ts +20 -0
  719. package/dist/commands/rg/rg-search.d.ts +15 -0
  720. package/dist/commands/rg/rg.d.ts +14 -0
  721. package/dist/commands/rm/rm.d.ts +4 -0
  722. package/dist/commands/rmdir/rmdir.d.ts +4 -0
  723. package/dist/commands/search-engine/index.d.ts +10 -0
  724. package/dist/commands/search-engine/matcher.d.ts +72 -0
  725. package/dist/commands/search-engine/regex.d.ts +46 -0
  726. package/dist/commands/sed/executor.d.ts +7 -0
  727. package/dist/commands/sed/lexer.d.ts +88 -0
  728. package/dist/commands/sed/parser.d.ts +21 -0
  729. package/dist/commands/sed/sed-regex.d.ts +23 -0
  730. package/dist/commands/sed/sed.d.ts +4 -0
  731. package/dist/commands/sed/types.d.ts +216 -0
  732. package/dist/commands/seq/seq.d.ts +16 -0
  733. package/dist/commands/sleep/sleep.d.ts +4 -0
  734. package/dist/commands/sort/comparator.d.ts +9 -0
  735. package/dist/commands/sort/parser.d.ts +11 -0
  736. package/dist/commands/sort/sort.d.ts +4 -0
  737. package/dist/commands/sort/types.d.ts +30 -0
  738. package/dist/commands/split/split.d.ts +12 -0
  739. package/dist/commands/sqlite3/formatters.d.ts +17 -0
  740. package/dist/commands/sqlite3/sqlite3.d.ts +24 -0
  741. package/dist/commands/sqlite3/worker.d.ts +50 -0
  742. package/dist/commands/sqlite3/worker.js +1928 -0
  743. package/dist/commands/stat/stat.d.ts +4 -0
  744. package/dist/commands/strings/strings.d.ts +12 -0
  745. package/dist/commands/tac/tac.d.ts +11 -0
  746. package/dist/commands/tail/tail.d.ts +4 -0
  747. package/dist/commands/tar/archive.d.ts +150 -0
  748. package/dist/commands/tar/bzip2-compress.d.ts +18 -0
  749. package/dist/commands/tar/tar-options.d.ts +37 -0
  750. package/dist/commands/tar/tar.d.ts +10 -0
  751. package/dist/commands/tee/tee.d.ts +4 -0
  752. package/dist/commands/time/time.d.ts +27 -0
  753. package/dist/commands/timeout/timeout.d.ts +4 -0
  754. package/dist/commands/touch/touch.d.ts +4 -0
  755. package/dist/commands/tr/tr.d.ts +4 -0
  756. package/dist/commands/tree/tree.d.ts +4 -0
  757. package/dist/commands/true/true.d.ts +6 -0
  758. package/dist/commands/uniq/uniq.d.ts +4 -0
  759. package/dist/commands/wc/wc.d.ts +4 -0
  760. package/dist/commands/which/which.d.ts +4 -0
  761. package/dist/commands/whoami/whoami.d.ts +11 -0
  762. package/dist/commands/worker-bridge/bridge-handler.d.ts +73 -0
  763. package/dist/commands/worker-bridge/protocol.d.ts +141 -0
  764. package/dist/commands/worker-bridge/sync-backend.d.ts +86 -0
  765. package/dist/commands/worker-request-controller.d.ts +36 -0
  766. package/dist/commands/xan/aggregation.d.ts +30 -0
  767. package/dist/commands/xan/bounded-output.d.ts +4 -0
  768. package/dist/commands/xan/column-selection.d.ts +20 -0
  769. package/dist/commands/xan/csv.d.ts +62 -0
  770. package/dist/commands/xan/moonblade-parser.d.ts +89 -0
  771. package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
  772. package/dist/commands/xan/moonblade-tokenizer.d.ts +32 -0
  773. package/dist/commands/xan/subcommands.d.ts +15 -0
  774. package/dist/commands/xan/xan-agg.d.ts +8 -0
  775. package/dist/commands/xan/xan-columns.d.ts +8 -0
  776. package/dist/commands/xan/xan-core.d.ts +10 -0
  777. package/dist/commands/xan/xan-data.d.ts +52 -0
  778. package/dist/commands/xan/xan-filter.d.ts +8 -0
  779. package/dist/commands/xan/xan-map.d.ts +11 -0
  780. package/dist/commands/xan/xan-reshape.d.ts +40 -0
  781. package/dist/commands/xan/xan-simple.d.ts +40 -0
  782. package/dist/commands/xan/xan-view.d.ts +12 -0
  783. package/dist/commands/xan/xan.d.ts +10 -0
  784. package/dist/commands/xargs/xargs.d.ts +4 -0
  785. package/dist/commands/yq/formats.d.ts +65 -0
  786. package/dist/commands/yq/yq.d.ts +13 -0
  787. package/dist/custom-commands.d.ts +65 -0
  788. package/dist/encoding.d.ts +131 -0
  789. package/dist/execution-output.d.ts +28 -0
  790. package/dist/execution-scope.d.ts +110 -0
  791. package/dist/fatal-execution-error.d.ts +27 -0
  792. package/dist/fs/encoding.d.ts +17 -0
  793. package/dist/fs/identity.d.ts +9 -0
  794. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +98 -0
  795. package/dist/fs/in-memory-fs/index.d.ts +1 -0
  796. package/dist/fs/init.d.ts +22 -0
  797. package/dist/fs/interface.d.ts +255 -0
  798. package/dist/fs/mountable-fs/index.d.ts +1 -0
  799. package/dist/fs/mountable-fs/mountable-fs.d.ts +118 -0
  800. package/dist/fs/overlay-fs/apply.d.ts +22 -0
  801. package/dist/fs/overlay-fs/index.d.ts +1 -0
  802. package/dist/fs/overlay-fs/overlay-fs.d.ts +360 -0
  803. package/dist/fs/overlay-fs/overlay-tree.d.ts +188 -0
  804. package/dist/fs/path-utils.d.ts +48 -0
  805. package/dist/fs/read-write-fs/index.d.ts +1 -0
  806. package/dist/fs/read-write-fs/read-write-fs.d.ts +150 -0
  807. package/dist/fs/real-fs-utils.d.ts +90 -0
  808. package/dist/fs/sanitize-error.d.ts +19 -0
  809. package/dist/fs/traversal.d.ts +98 -0
  810. package/dist/index.d.cts +30 -0
  811. package/dist/index.d.ts +30 -0
  812. package/dist/interpreter/alias-expansion.d.ts +27 -0
  813. package/dist/interpreter/arithmetic.d.ts +24 -0
  814. package/dist/interpreter/assignment-expansion.d.ts +24 -0
  815. package/dist/interpreter/builtin-dispatch.d.ts +46 -0
  816. package/dist/interpreter/builtins/break.d.ts +6 -0
  817. package/dist/interpreter/builtins/cd.d.ts +6 -0
  818. package/dist/interpreter/builtins/compgen.d.ts +26 -0
  819. package/dist/interpreter/builtins/complete.d.ts +17 -0
  820. package/dist/interpreter/builtins/compopt.d.ts +28 -0
  821. package/dist/interpreter/builtins/continue.d.ts +6 -0
  822. package/dist/interpreter/builtins/declare-array-parsing.d.ts +18 -0
  823. package/dist/interpreter/builtins/declare-print.d.ts +39 -0
  824. package/dist/interpreter/builtins/declare.d.ts +35 -0
  825. package/dist/interpreter/builtins/dirs.d.ts +29 -0
  826. package/dist/interpreter/builtins/eval.d.ts +15 -0
  827. package/dist/interpreter/builtins/exit.d.ts +5 -0
  828. package/dist/interpreter/builtins/export.d.ts +14 -0
  829. package/dist/interpreter/builtins/getopts.d.ts +18 -0
  830. package/dist/interpreter/builtins/hash.d.ts +19 -0
  831. package/dist/interpreter/builtins/help.d.ts +12 -0
  832. package/dist/interpreter/builtins/index.d.ts +44 -0
  833. package/dist/interpreter/builtins/let.d.ts +18 -0
  834. package/dist/interpreter/builtins/local.d.ts +6 -0
  835. package/dist/interpreter/builtins/mapfile.d.ts +17 -0
  836. package/dist/interpreter/builtins/read.d.ts +6 -0
  837. package/dist/interpreter/builtins/return.d.ts +6 -0
  838. package/dist/interpreter/builtins/set.d.ts +9 -0
  839. package/dist/interpreter/builtins/shift.d.ts +15 -0
  840. package/dist/interpreter/builtins/shopt.d.ts +7 -0
  841. package/dist/interpreter/builtins/source.d.ts +6 -0
  842. package/dist/interpreter/builtins/unset.d.ts +16 -0
  843. package/dist/interpreter/builtins/variable-assignment.d.ts +69 -0
  844. package/dist/interpreter/command-analysis.d.ts +30 -0
  845. package/dist/interpreter/command-resolution.d.ts +43 -0
  846. package/dist/interpreter/conditionals.d.ts +17 -0
  847. package/dist/interpreter/control-flow.d.ts +21 -0
  848. package/dist/interpreter/defense-aware-command-context.d.ts +6 -0
  849. package/dist/interpreter/errors.d.ts +161 -0
  850. package/dist/interpreter/expansion/analysis.d.ts +37 -0
  851. package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
  852. package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
  853. package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
  854. package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
  855. package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
  856. package/dist/interpreter/expansion/brace-range.d.ts +24 -0
  857. package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
  858. package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
  859. package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
  860. package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
  861. package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
  862. package/dist/interpreter/expansion/pattern-removal.d.ts +17 -0
  863. package/dist/interpreter/expansion/pattern-replacement.d.ts +4 -0
  864. package/dist/interpreter/expansion/pattern.d.ts +23 -0
  865. package/dist/interpreter/expansion/positional-params.d.ts +59 -0
  866. package/dist/interpreter/expansion/prompt.d.ts +39 -0
  867. package/dist/interpreter/expansion/quoting.d.ts +13 -0
  868. package/dist/interpreter/expansion/tilde.d.ts +14 -0
  869. package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
  870. package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
  871. package/dist/interpreter/expansion/variable.d.ts +36 -0
  872. package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
  873. package/dist/interpreter/expansion/word-split.d.ts +29 -0
  874. package/dist/interpreter/expansion.d.ts +53 -0
  875. package/dist/interpreter/fd-table.d.ts +130 -0
  876. package/dist/interpreter/functions.d.ts +14 -0
  877. package/dist/interpreter/helpers/array.d.ts +56 -0
  878. package/dist/interpreter/helpers/bounded-array.d.ts +2 -0
  879. package/dist/interpreter/helpers/condition.d.ts +19 -0
  880. package/dist/interpreter/helpers/errors.d.ts +8 -0
  881. package/dist/interpreter/helpers/file-tests.d.ts +33 -0
  882. package/dist/interpreter/helpers/ifs.d.ts +104 -0
  883. package/dist/interpreter/helpers/loop.d.ts +24 -0
  884. package/dist/interpreter/helpers/nameref.d.ts +65 -0
  885. package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
  886. package/dist/interpreter/helpers/quoting.d.ts +26 -0
  887. package/dist/interpreter/helpers/readonly.d.ts +45 -0
  888. package/dist/interpreter/helpers/regex.d.ts +8 -0
  889. package/dist/interpreter/helpers/result.d.ts +60 -0
  890. package/dist/interpreter/helpers/shell-constants.d.ts +41 -0
  891. package/dist/interpreter/helpers/shellopts.d.ts +28 -0
  892. package/dist/interpreter/helpers/string-compare.d.ts +24 -0
  893. package/dist/interpreter/helpers/string-tests.d.ts +13 -0
  894. package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
  895. package/dist/interpreter/helpers/word-matching.d.ts +16 -0
  896. package/dist/interpreter/helpers/word-parts.d.ts +22 -0
  897. package/dist/interpreter/helpers/xtrace.d.ts +18 -0
  898. package/dist/interpreter/index.d.ts +3 -0
  899. package/dist/interpreter/interpreter.d.ts +82 -0
  900. package/dist/interpreter/numeric-fd-redirects.d.ts +8 -0
  901. package/dist/interpreter/pipeline-execution.d.ts +16 -0
  902. package/dist/interpreter/process-substitution.d.ts +62 -0
  903. package/dist/interpreter/redirections.d.ts +50 -0
  904. package/dist/interpreter/simple-command-assignments.d.ts +36 -0
  905. package/dist/interpreter/state-transaction.d.ts +7 -0
  906. package/dist/interpreter/subshell-group.d.ts +40 -0
  907. package/dist/interpreter/type-command.d.ts +37 -0
  908. package/dist/interpreter/types.d.ts +402 -0
  909. package/dist/limits.d.ts +111 -0
  910. package/dist/network/allow-list/shared.d.ts +49 -0
  911. package/dist/network/allow-list.d.ts +59 -0
  912. package/dist/network/dns-pin.d.ts +42 -0
  913. package/dist/network/fetch.d.ts +27 -0
  914. package/dist/network/index.d.ts +7 -0
  915. package/dist/network/types.d.ts +182 -0
  916. package/dist/parser/arithmetic-parser.d.ts +23 -0
  917. package/dist/parser/arithmetic-primaries.d.ts +45 -0
  918. package/dist/parser/command-parser.d.ts +10 -0
  919. package/dist/parser/compound-parser.d.ts +28 -0
  920. package/dist/parser/conditional-parser.d.ts +8 -0
  921. package/dist/parser/expansion-parser.d.ts +18 -0
  922. package/dist/parser/lexer.d.ts +195 -0
  923. package/dist/parser/parser-substitution.d.ts +85 -0
  924. package/dist/parser/parser.d.ts +152 -0
  925. package/dist/parser/types.d.ts +40 -0
  926. package/dist/parser/word-parser.d.ts +35 -0
  927. package/dist/sandbox/Command.d.ts +35 -0
  928. package/dist/sandbox/Sandbox.d.ts +121 -0
  929. package/dist/sandbox/index.d.ts +2 -0
  930. package/dist/security/blocked-globals.d.ts +60 -0
  931. package/dist/security/defense-context.d.ts +13 -0
  932. package/dist/security/defense-in-depth-box.d.ts +354 -0
  933. package/dist/security/index.d.ts +33 -0
  934. package/dist/security/safe-timestamp.d.ts +1 -0
  935. package/dist/security/security-violation-logger.d.ts +99 -0
  936. package/dist/security/trusted-globals.d.ts +17 -0
  937. package/dist/security/types.d.ts +151 -0
  938. package/dist/security/violation-error-message.d.ts +3 -0
  939. package/dist/security/wasm-callback.d.ts +6 -0
  940. package/dist/security/worker-defense-in-depth.d.ts +228 -0
  941. package/dist/shell-metadata.d.ts +25 -0
  942. package/dist/source-limit.d.ts +2 -0
  943. package/dist/timers.d.ts +16 -0
  944. package/dist/transform/pipeline.d.ts +8 -0
  945. package/dist/transform/plugins/command-collector.d.ts +8 -0
  946. package/dist/transform/plugins/tee-plugin.d.ts +40 -0
  947. package/dist/transform/serialize.d.ts +4 -0
  948. package/dist/transform/types.d.ts +18 -0
  949. package/dist/types.d.ts +319 -0
  950. package/dist/utils/args.d.ts +55 -0
  951. package/dist/utils/constants.d.ts +15 -0
  952. package/dist/utils/file-reader.d.ts +76 -0
  953. package/dist/utils/glob.d.ts +25 -0
  954. package/dist/vitest-setup.d.ts +1 -0
  955. package/package.json +136 -0
  956. package/vendor/cpython-emscripten/python.cjs +2 -0
  957. package/vendor/cpython-emscripten/python.wasm +0 -0
  958. package/vendor/cpython-emscripten/python313.zip +0 -0
@@ -0,0 +1,1576 @@
1
+ var z3=Object.create;var vc=Object.defineProperty;var W3=Object.getOwnPropertyDescriptor;var j3=Object.getOwnPropertyNames;var H3=Object.getPrototypeOf,V3=Object.prototype.hasOwnProperty;var M=(e,t)=>()=>(e&&(t=e(e=0)),t);var ta=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ae=(e,t)=>{for(var n in t)vc(e,n,{get:t[n],enumerable:!0})},G3=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of j3(t))!V3.call(e,s)&&s!==n&&vc(e,s,{get:()=>t[s],enumerable:!(r=W3(t,s))||r.enumerable});return e};var Yp=(e,t,n)=>(n=e!=null?z3(H3(e)):{},G3(t||!e||!e.__esModule?vc(n,"default",{value:e,enumerable:!0}):n,e));var na={};ae(na,{AsyncLocalStorage:()=>kc,Module:()=>q3,lookup:()=>Z3});function Z3(){throw new Error("node:dns is not available in browser environments")}var kc,q3,Nc=M(()=>{"use strict";kc=void 0,q3=void 0});function Jp(){return Ic||Oc(),Ic}function Oc(){let e=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","NODE_ENV","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},...["on","once","addListener","prependListener","prependOnceListener"].map(n=>({prop:n,target:process,violationType:"process_exception_handler",strategy:"throw",reason:"process-global listeners can outlive the sandbox and lose its security context"})),{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let n=Object.getPrototypeOf(async()=>{}).constructor;n&&n!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let n=Object.getPrototypeOf(function*(){}).constructor;n&&n!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let n=Object.getPrototypeOf(async function*(){}).constructor;n&&n!==Function&&n!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}let t=e.filter(n=>{try{return n.target[n.prop]!==void 0}catch{return!1}});return Ic??=new Set(t.map(({violationType:n})=>n)),t}var Ic,eh=M(()=>{"use strict"});function th(){return Math.floor(K3+Q3())}var K3,Q3,nh=M(()=>{"use strict";K3=performance.timeOrigin,Q3=performance.now.bind(performance)});function sh(e){let t=e?.find(n=>rh.has(n));if(t)throw new RangeError(`defenseInDepth.excludeViolationTypes cannot disable the non-excludable "${t}" protection`)}function ih(e,t,n){let r=n&&!rh.has(t)?`
2
+
3
+ If this access is required by trusted host-runtime code, add "${t}" to defenseInDepth.excludeViolationTypes.`:"";return e+X3+r}var rh,X3,oh=M(()=>{"use strict";rh=new Set(["function_constructor","async_function_constructor","generator_function_constructor","async_generator_function_constructor"]);X3=`
4
+
5
+ This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`});function ah(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function J3(e,t,...n){return lt.run(e,()=>t(...n))}function lh(){return!Pr&&typeof Ki?.registerHooks=="function"}function ch(e){let t=typeof e=="boolean"?{enabled:e}:e??{};if(sh(t.excludeViolationTypes),t.enabled!==void 0&&t.enabled!==!0&&t.enabled!==!1&&t.enabled!=="auto")throw new RangeError('defenseInDepth.enabled must be true, false, or "auto"');let n={...e8,...t},r=n.enabled==="auto"?"auto":n.enabled?"enabled":"disabled",s={...n,enabled:r!=="disabled",requested:r};return s.excludeViolationTypes&&(s.excludeViolationTypes=[...new Set(s.excludeViolationTypes)].sort()),s}function t8(e,t){if(e.enabled!==t.enabled||e.auditMode!==t.auditMode||e.processLifetimeIntrinsicHardening!==t.processLifetimeIntrinsicHardening||e.onViolation!==t.onViolation)return!1;let n=e.excludeViolationTypes??[],r=t.excludeViolationTypes??[];return n.length===r.length&&n.every((s,i)=>s===r[i])}var Pr,Tc,Ki,uh,Ae,lt,Y3,e8,$t,vn=M(()=>{"use strict";Nc();Nc();eh();nh();oh();Pr=!0;Tc=null,Ki=null,uh=null;if(!Pr)try{Tc=void 0,Ki=na,uh=Ki.Module??Ki.default??null}catch{}Ae=class extends Error{violation;constructor(t,n){super(ih(t,n.type,n.type==="error_prepare_stack_trace"||Jp().has(n.type))),this.violation=n,this.name="SecurityViolationError"}},lt=!Pr&&Tc?new Tc:null,Y3=1e3;e8={enabled:!0,auditMode:!1,processLifetimeIntrinsicHardening:!1};$t=class e{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];temporaryIntrinsicDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){let n=ch(t);if(!e.instance)e.instance=new e(n);else{let r=e.instance.config;if(!t8(n,r))throw new Error("DefenseInDepthBox config conflict: all resolved defense options, including exclusions and the violation callback, must match across Bash instances. Call DefenseInDepthBox.resetInstance() between incompatible configurations.")}return e.instance}static resetInstance(){e.instance&&(e.instance.forceDeactivate(),e.instance=null),e.trustedExecutionDepth.clear()}static isInSandboxedContext(){return lt?lt?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(lt)return lt?.getStore()?.executionId}static enterTrustedScope(t){let n=e.trustedExecutionDepth.get(t)??0;e.trustedExecutionDepth.set(t,n+1)}static leaveTrustedScope(t){let n=e.trustedExecutionDepth.get(t);if(n){if(n===1){e.trustedExecutionDepth.delete(t);return}e.trustedExecutionDepth.set(t,n-1)}}static isTrustedScopeActive(t){return t?(e.trustedExecutionDepth.get(t)??0)>0:!1}static isTrustedContext(t){return!t||t.forceUntrusted?!1:t.trusted===!0||e.isTrustedScopeActive(t.executionId)}isExecutionIdActive(t){return this.activeExecutionIds.has(t)}getCachedContext(t){let n=this.contextCache.get(t);return n||(n={sandboxActive:!0,executionId:t},this.contextCache.set(t,n)),n}static bindCurrentContext(t){if(!lt)return t;let n=lt.getStore(),r=n?.sandboxActive===!0?n.executionId:void 0;if(!r)return t;let i=e.instance?.getCachedContext(r)??{sandboxActive:!0,executionId:r},o=n?.forceUntrusted?{...i,forceUntrusted:!0}:i;return((...a)=>{let l=e.instance;if(!(l&&!l.isExecutionIdActive(r)&&(l.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!l.config.auditMode)))return J3(o,t,...a)})}isEnabled(){return this.getStatus().state==="enabled"}getStatus(){let t=lh();return this.config.requested==="disabled"?{requested:"disabled",state:"disabled",level:"none",contextualDynamicImportProtection:t,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort"}:!lt||Pr?{requested:this.config.requested,state:"unsupported",level:"none",contextualDynamicImportProtection:!1,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:"context-aware ESM loader hooks (node:module.registerHooks) are unavailable"}:{requested:this.config.requested,state:"enabled",level:this.config.auditMode?"none":t?"full":"best-effort",contextualDynamicImportProtection:t,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:this.config.auditMode?"audit mode records violations but does not block them":t?void 0:"best-effort protection; context-aware ESM loader hooks are unavailable"}}updateConfig(t){if(this.refCount>0)throw new Error("DefenseInDepthBox configuration cannot change while protection is active");this.config=ch({...this.config,...t})}activate(){if(!Pr&&this.config.enabled&&!lt)throw new Error("DefenseInDepthBox: enabled protection requires node:async_hooks and node:module");if(Pr||!this.config.enabled){let r=ah(),s=!1;return{run:i=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):i(),deactivate:()=>{s=!0},executionId:r}}if(this.refCount++,this.refCount===1){try{this.applyPatches()}catch(r){throw this.restorePatches(),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0,r}this.activationTime=Date.now()}let t=ah(),n=!1;return{run:r=>n?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(t),lt.run({sandboxActive:!0,executionId:t},r)),deactivate:()=>{n||(n=!0,this.activeExecutionIds.delete(t),this.contextCache.delete(t),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:t}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(t,n){return t===globalThis?`globalThis.${n}`:t===process?`process.${n}`:t===Error?`Error.${n}`:t===Function.prototype?`Function.prototype.${n}`:t===Object.prototype?`Object.prototype.${n}`:`<object>.${n}`}static runTrusted(t){if(!lt)return t();let n=lt.getStore();if(!n)return t();let{executionId:r}=n;return lt.run({...n,trusted:!0,forceUntrusted:!1},()=>{e.enterTrustedScope(r);try{let s=t();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{e.leaveTrustedScope(r)}):(e.leaveTrustedScope(r),s)}catch(s){throw e.leaveTrustedScope(r),s}})}static async runTrustedAsync(t){if(!lt)return t();let n=lt.getStore();if(!n)return t();let{executionId:r}=n;return lt.run({...n,trusted:!0,forceUntrusted:!1},async()=>{e.enterTrustedScope(r);try{return await t()}finally{e.leaveTrustedScope(r)}})}static async runUntrustedAsync(t){if(!lt)return t();let n=lt.getStore();return n?lt.run({...n,trusted:!1,forceUntrusted:!0},t):t()}shouldBlock(){if(Pr||this.config.auditMode||!lt)return!1;let t=lt?.getStore();return!(t?.sandboxActive!==!0||e.isTrustedContext(t))}shouldAudit(){if(!this.config.auditMode||!lt)return!1;let t=lt.getStore();return t?.sandboxActive===!0&&!e.isTrustedContext(t)}recordViolation(t,n,r){let s={timestamp:th(),type:t,message:r,path:n,stack:new Error().stack,executionId:lt?.getStore()?.executionId};if(this.violations.length<Y3&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(i){console.debug("[DefenseInDepthBox] onViolation callback threw:",i instanceof Error?i.message:i)}return s}createBlockingProxy(t,n,r){let s=this;return new Proxy(t,{apply(i,o,a){if(s.shouldBlock()){let l=`${n} is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ae(l,c)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} called (audit mode)`),Reflect.apply(i,o,a)},construct(i,o,a){if(s.shouldBlock()){let l=`${n} constructor is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ae(l,c)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} constructor called (audit mode)`),Reflect.construct(i,o,a)}})}createBlockingObjectProxy(t,n,r,s){let i=this;return new Proxy(t,{get(o,a,l){if(i.shouldBlock()){if(s&&typeof a=="string"&&s.has(a))return Reflect.get(o,a,l);let c=`${n}.${String(a)}`,u=`${c} is blocked during script execution`,f=i.recordViolation(r,c,u);throw new Ae(u,f)}if(i.shouldAudit()){let c=`${n}.${String(a)}`;i.recordViolation(r,c,`${c} accessed (audit mode)`)}return Reflect.get(o,a,l)},set(o,a,l,c){if(i.shouldBlock()){let u=`${n}.${String(a)}`,f=`${u} modification is blocked during script execution`,d=i.recordViolation(r,u,f);throw new Ae(f,d)}return n==="process.env"&&a==="DEBUG"?Reflect.set(o,a,l):Reflect.set(o,a,l,c)},ownKeys(o){if(i.shouldBlock()){let a=`${n} enumeration is blocked during script execution`,l=i.recordViolation(r,n,a);throw new Ae(a,l)}return Reflect.ownKeys(o)},getOwnPropertyDescriptor(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} descriptor access is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ae(c,u)}return Reflect.getOwnPropertyDescriptor(o,a)},has(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} existence check is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ae(c,u)}return Reflect.has(o,a)},deleteProperty(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} deletion is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ae(c,u)}return Reflect.deleteProperty(o,a)},setPrototypeOf(o,a){if(i.shouldBlock()){let l=`${n} setPrototypeOf is blocked during script execution`,c=i.recordViolation(r,n,l);throw new Ae(l,c)}return Reflect.setPrototypeOf(o,a)},defineProperty(o,a,l){if(i.shouldBlock()){let c=`${n}.${String(a)}`,u=`${c} defineProperty is blocked during script execution`,f=i.recordViolation(r,c,u);throw new Ae(u,f)}return Reflect.defineProperty(o,a,l)}})}createReadonlyObjectProxy(t,n,r){let s=this,i=o=>{let a=`${n} ${o} is blocked during script execution`,l=s.recordViolation(r,n,a);throw new Ae(a,l)};return new Proxy(t,{set(o,a,l,c){return s.shouldBlock()&&i("modification"),Reflect.set(o,a,l,c)},defineProperty(o,a,l){return s.shouldBlock()&&i("defineProperty"),Reflect.defineProperty(o,a,l)},deleteProperty(o,a){return s.shouldBlock()&&i("deletion"),Reflect.deleteProperty(o,a)},setPrototypeOf(o,a){return s.shouldBlock()&&i("setPrototypeOf"),Reflect.setPrototypeOf(o,a)},preventExtensions(o){return s.shouldBlock()&&i("preventExtensions"),Reflect.preventExtensions(o)}})}applyPatches(){this.patchFailures=[];let t=Oc(),n=new Set(this.config.excludeViolationTypes??[]),r=new Set(["process_send","process_channel","process_stdout","process_stderr"]),s=[];for(let a of t)if(!n.has(a.violationType)&&!r.has(a.violationType)){if(a.strategy==="freeze"){s.push(a);continue}this.applyPatch(a)}this.protectConstructorChain(),n.has("error_prepare_stack_trace")||this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),lh()&&this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.protectProxyRevocable();let i=["Function.prototype.constructor","Module._load","Module._resolveFilename"],o=this.patchFailures.filter(a=>i.includes(a));if(o.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${o.join(", ")}`);this.config.processLifetimeIntrinsicHardening||this.protectReversibleIntrinsics(s);for(let a of s)this.applyPatch(a,this.config.processLifetimeIntrinsicHardening===!0);this.config.processLifetimeIntrinsicHardening&&this.lockWellKnownSymbols()}protectReversibleIntrinsics(t){let n=new Set,r=(o,a)=>{let l=Object.getOwnPropertyDescriptor(o,a);!l||!("value"in l)||l.writable!==!0||l.configurable!==!0||(this.temporaryIntrinsicDescriptors.push({target:o,prop:a,descriptor:l}),Object.defineProperty(o,a,{...l,writable:!1}))};for(let{target:o,prop:a}of t){let l=o[a];if(!(typeof l!="object"||l===null)){n.add(l);for(let c of Reflect.ownKeys(l))r(l,c)}}let s=[];for(let o of[Array,Map,Set,RegExp,Promise])s.push([o,Symbol.species]);for(let o of[Array.prototype,String.prototype,Map.prototype,Set.prototype])s.push([o,Symbol.iterator]);s.push([Symbol.prototype,Symbol.toPrimitive],[Date.prototype,Symbol.toPrimitive],[Function.prototype,Symbol.hasInstance],[Array.prototype,Symbol.unscopables]);for(let o of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])s.push([RegExp.prototype,o]);for(let o of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])s.push([o,Symbol.toStringTag]);for(let[o,a]of s)n.add(o),r(o,a);let i=(o,a,l)=>{let c=Object.getOwnPropertyDescriptor(o,a);if(!c||!("value"in c)||typeof c.value!="function"||c.configurable!==!0)return;let u=c.value,f=this,d=function(...p){let h=p[0];if(f.shouldBlock()&&typeof h=="object"&&h!==null&&n.has(h)){let m=`${l}.${a}`,g=`${m} is blocked for protected intrinsics during script execution`,b=f.recordViolation("prototype_mutation",m,g);throw new Ae(g,b)}return Reflect.apply(u,this,p)};this.temporaryIntrinsicDescriptors.push({target:o,prop:a,descriptor:c}),Object.defineProperty(o,a,{...c,value:d,writable:!1})};for(let o of["assign","defineProperties","defineProperty","freeze","preventExtensions","seal","setPrototypeOf"])i(Object,o,"Object");for(let o of["defineProperty","deleteProperty","preventExtensions","set","setPrototypeOf"])i(Reflect,o,"Reflect")}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(t){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(t){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(async function*(){}).constructor,n=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&t!==n&&this.patchPrototypeConstructor(t.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(t){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}}protectErrorPrepareStackTrace(){let t=this;try{let n=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:n});let r=n?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(t.shouldBlock()){let i="Error.prepareStackTrace modification is blocked during script execution",o=t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",i);throw new Ae(i,o)}t.shouldAudit()&&t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(n){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",n instanceof Error?n.message:n)}}protectPromiseThen(){let t=this;try{let i=function(...o){return lt.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var n=i;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(a,l){if(!lt)return Reflect.apply(s,this,[a,l]);let c=lt.getStore(),u=c?.sandboxActive===!0&&c.trusted!==!0?c.executionId:void 0;if(!u)return Reflect.apply(s,this,[a,l]);let f=t.getCachedContext(u),d=c?.forceUntrusted?{...f,forceUntrusted:!0}:f,p=(h,m)=>typeof h!="function"?h:i.bind({box:t,executionId:u,captured:d,cb:h,kind:m});return Reflect.apply(s,this,[p(a,"fulfilled"),p(l,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(t,n,r){let s=this;try{let i=Object.getOwnPropertyDescriptor(t,"constructor");this.originalDescriptors.push({target:t,prop:"constructor",descriptor:i});let o=i?.value;Object.defineProperty(t,"constructor",{get(){if(s.shouldBlock()){let a=`${n} access is blocked during script execution`,l=s.recordViolation(r,n,a);throw new Ae(a,l)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} accessed (audit mode)`),o},set(a){if(s.shouldBlock()){let l=`${n} modification is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ae(l,c)}Object.defineProperty(this,"constructor",{value:a,writable:!0,configurable:!0})},configurable:!0})}catch(i){this.patchFailures.push(n),console.debug(`[DefenseInDepthBox] Could not patch ${n}:`,i instanceof Error?i.message:i)}}protectProcessMainModule(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:n});let r=n?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(t.shouldBlock()){let s="process.mainModule access is blocked during script execution",i=t.recordViolation("process_main_module","process.mainModule",s);throw new Ae(s,i)}return t.shouldAudit()&&t.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.mainModule modification is blocked during script execution",o=t.recordViolation("process_main_module","process.mainModule",i);throw new Ae(i,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",n instanceof Error?n.message:n)}}protectProcessExecPath(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:n});let r=n?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(t.shouldBlock()){let s="process.execPath access is blocked during script execution",i=t.recordViolation("process_exec_path","process.execPath",s);throw new Ae(s,i)}return t.shouldAudit()&&t.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.execPath modification is blocked during script execution",o=t.recordViolation("process_exec_path","process.execPath",i);throw new Ae(i,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",n instanceof Error?n.message:n)}}lockWellKnownSymbols(){let t=(n,r)=>{try{let s=Object.getOwnPropertyDescriptor(n,r);if(s?.configurable){if("value"in s){Object.defineProperty(n,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(n,r,{...s,configurable:!1})}}catch{}};for(let n of[Array,Map,Set,RegExp,Promise])t(n,Symbol.species);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])t(n,Symbol.iterator);t(Symbol.prototype,Symbol.toPrimitive),t(Date.prototype,Symbol.toPrimitive);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])t(RegExp.prototype,n);t(Function.prototype,Symbol.hasInstance),t(Array.prototype,Symbol.unscopables);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])t(n,Symbol.toStringTag)}protectProxyRevocable(){let t=this;try{let n=Proxy.revocable;if(typeof n!="function")return;let r=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:r}),Object.defineProperty(Proxy,"revocable",{value:function(i,o){if(t.shouldBlock()){let a="Proxy.revocable is blocked during script execution",l=t.recordViolation("proxy","Proxy.revocable",a);throw new Ae(a,l)}return t.shouldAudit()&&t.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),n(i,o)},writable:!1,configurable:!0})}catch(n){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",n instanceof Error?n.message:n)}}protectDynamicImport(){if(!(Pr||e.importHooksRegistered))try{let t=Ki;if(!t)throw new Error("node:module is unavailable");let n=new Set;for(let i of t.builtinModules??[]){let o=i.startsWith("node:")?i.slice(5):i;n.add(o);let a=o.indexOf("/");a>0&&n.add(o.slice(0,a))}let r=i=>{if(i.startsWith("./")||i.startsWith("../")||i.startsWith("/")||i.startsWith("file:")||i.startsWith("data:")||i.startsWith("blob:")||i.startsWith("http:")||i.startsWith("https:"))return!1;let o=i.startsWith("node:")?i.slice(5):i;if(!o)return!1;if(typeof t.isBuiltin=="function"&&t.isBuiltin(o)||n.has(o))return!0;let a=o.indexOf("/");return a>0&&n.has(o.slice(0,a))},s=i=>{let o=lt?.getStore();return i.config.auditMode===!0&&o?.sandboxActive===!0&&!e.isTrustedContext(o)};if(typeof t.registerHooks=="function"){t.registerHooks({resolve(i,o,a){let l=e.instance;if(!l)return a(i,o);if((i.startsWith("data:")||i.startsWith("blob:"))&&l.shouldBlock()){let c=`import(${i.startsWith("data:")?"data:":"blob:"})`,u=`dynamic import of ${i.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`,f=l.recordViolation("dynamic_import_builtin",c,u);throw new Ae(u,f)}if(r(i)){let c=`import(${i})`,u=`dynamic import of Node.js builtin '${i}' is blocked during script execution`;if(l.shouldBlock()){let f=l.recordViolation("dynamic_import_builtin",c,u);throw new Ae(u,f)}s(l)&&l.recordViolation("dynamic_import_builtin",c,`dynamic import of Node.js builtin '${i}' called (audit mode)`)}return a(i,o)}}),e.importHooksRegistered=!0;return}throw new Error("context-aware ESM loader hooks (node:module.registerHooks) are unavailable")}catch(t){throw new Error(`DefenseInDepthBox: could not register dynamic-import hooks: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}protectModuleLoad(){this.protectModuleMethod("_load","module_load")}protectModuleResolveFilename(){this.protectModuleMethod("_resolveFilename","module_resolve_filename")}protectModuleMethod(t,n){if(Pr)return;let r=`Module.${t}`;try{let s=uh,i=s?.[t];if(!s||typeof i!="function")throw new Error("node:module Module class or method is unavailable");let o=Object.getOwnPropertyDescriptor(s,t);if(!o)throw new Error("method has no own property descriptor");if(o.configurable===!1&&o.writable===!1)throw new Error("method is non-configurable and non-writable");let a=this.createBlockingProxy(i,r,n);this.originalDescriptors.push({target:s,prop:t,descriptor:o}),Object.defineProperty(s,t,{...o,value:a});let l=Object.getOwnPropertyDescriptor(s,t);if(s[t]!==a||l?.value!==a)throw new Error("installed patch failed verification")}catch{this.patchFailures.push(r)}}applyPatch(t,n=!1){let{target:r,prop:s,violationType:i,strategy:o}=t;try{let a=r[s];if(a===void 0)return;let l=Object.getOwnPropertyDescriptor(r,s);if(this.originalDescriptors.push({target:r,prop:s,descriptor:l}),o==="freeze"){if(typeof a=="object"&&a!==null){n&&Object.freeze(a);let c=this.getPathForTarget(r,s),u=this.createReadonlyObjectProxy(a,c,i);Object.defineProperty(r,s,{...l,value:u})}}else{let c=this.getPathForTarget(r,s),u=typeof a=="function"?this.createBlockingProxy(a,c,i):this.createBlockingObjectProxy(a,c,i,t.allowedKeys);Object.defineProperty(r,s,{value:u,writable:!0,configurable:!0})}}catch(a){let l=this.getPathForTarget(r,s);this.patchFailures.push(l),console.debug(`[DefenseInDepthBox] Could not patch ${l}:`,a instanceof Error?a.message:a)}}restorePatches(){for(let t=this.temporaryIntrinsicDescriptors.length-1;t>=0;t--){let{target:n,prop:r,descriptor:s}=this.temporaryIntrinsicDescriptors[t];try{Object.defineProperty(n,r,s)}catch(i){console.debug(`[DefenseInDepthBox] Could not restore temporary intrinsic ${String(r)}:`,i instanceof Error?i.message:i)}}this.temporaryIntrinsicDescriptors=[];for(let t=this.originalDescriptors.length-1;t>=0;t--){let{target:n,prop:r,descriptor:s}=this.originalDescriptors[t];try{s?Object.defineProperty(n,r,s):delete n[r]}catch(i){let o=this.getPathForTarget(n,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,i instanceof Error?i.message:i)}}this.originalDescriptors=[]}}});function ph(e){return typeof e!="function"?e:$t.bindCurrentContext(e)}function Qi(e,t){if(t===Number.POSITIVE_INFINITY)return;let n=ph(e),r={cleared:!1,remainingMs:Math.max(0,t),timer:void 0},s=()=>{if(r.cleared)return;let i=Math.min(r.remainingMs,n8);r.timer=fh(()=>{r.cleared||(r.remainingMs-=i,r.remainingMs>0?s():n())},i)};return s(),r}function Xi(e){e&&(e.cleared=!0,e.timer!==void 0&&dh(e.timer))}var fh,dh,gT,yT,bs,Js,n8,xs=M(()=>{"use strict";vn();fh=globalThis.setTimeout.bind(globalThis),dh=globalThis.clearTimeout.bind(globalThis),gT=globalThis.setInterval.bind(globalThis),yT=globalThis.clearInterval.bind(globalThis);bs=((e,t,...n)=>fh(ph(e),t,...n)),Js=dh,n8=2147483647});function ei(...e){let t=[...new Set(e.filter(s=>s!==void 0))];if(t.length===0)return{signal:void 0,cleanup(){}};if(t.length===1)return{signal:t[0],cleanup(){}};let n=new AbortController,r=[];for(let s of t){if(s.aborted){n.abort(s.reason);break}let i=()=>n.abort(s.reason);s.addEventListener("abort",i,{once:!0}),r.push([s,i])}return{signal:n.signal,cleanup(){for(let[s,i]of r)s.removeEventListener("abort",i)}}}var ra=M(()=>{"use strict"});function $c(e,t,n){if(!Number.isSafeInteger(e)||e<0||!Number.isSafeInteger(t)||t<0||e>t)throw new RangeError(`${n}: byte conversion limit exceeded (${t} bytes)`)}function U(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<=127)t++;else if(r<=2047)t+=2;else if(r>=55296&&r<=56319&&n+1<e.length){let s=e.charCodeAt(n+1);s>=56320&&s<=57343?(t+=4,n++):t+=3}else t+=3}return t}function ue(e,t=Rc){let n=e;if(!n)return n;$c(n.length,t,"UTF-8 decode");let r=!1;for(let i=0;i<n.length;i++){let o=n.charCodeAt(i);if(o>255)return n;o>127&&(r=!0)}if(!r)return n;let s=new Uint8Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);try{return r8.decode(s)}catch{return n}}function Ln(e,t=Rc){if(!e)return e;$c(U(e),t,"UTF-8 encode");let n=s8.encode(e),r="";for(let s=0;s<n.length;s++)r+=String.fromCharCode(n[s]);return r}function i8(e,t=Rc){$c(e.byteLength,t,"byte-string conversion");let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return n}async function jt(e,t){return typeof e.readFileBytes=="function"?e.readFileBytes(t):i8(await e.readFileBuffer(t))}function hh(e){return e.stdoutKind?e.stdoutKind:e.stdoutEncoding==="binary"?"bytes":"text"}function Vr(e){return hh(e)==="bytes"?e.stdout:Ln(e.stdout)}function Pc(e){return hh(e)==="bytes"?ue(e.stdout):e.stdout}var r8,s8,Rc,sa,ce=M(()=>{"use strict";r8=new TextDecoder("utf-8",{fatal:!0}),s8=new TextEncoder,Rc=512*1024*1024;sa=""});function ia(e){return e instanceof Qt||e instanceof Xt||e instanceof Ut}var ut,Qt,Xt,Ut,Yt,Jt,ye,Ve,rn,mr,ti,C,Ge,kt,gr,hn,Z=M(()=>{"use strict";ce();ut=class extends Error{stdout;stderr;internalOutputAccounting={stdout:0,stderr:0};constructor(t,n="",r=""){super(t),this.stdout=n,this.stderr=r}prependOutput(t,n){this.stdout=t+this.stdout,this.stderr=n+this.stderr,this.internalOutputAccounting.stdout+=U(t),this.internalOutputAccounting.stderr+=U(n)}},Qt=class extends ut{levels;name="BreakError";constructor(t=1,n="",r=""){super("break",n,r),this.levels=t}},Xt=class extends ut{levels;name="ContinueError";constructor(t=1,n="",r=""){super("continue",n,r),this.levels=t}},Ut=class extends ut{exitCode;name="ReturnError";constructor(t=0,n="",r=""){super("return",n,r),this.exitCode=t}},Yt=class extends ut{exitCode;name="ErrexitError";constructor(t,n="",r=""){super(`errexit: command exited with status ${t}`,n,r),this.exitCode=t}},Jt=class extends ut{varName;name="NounsetError";constructor(t,n=""){super(`${t}: unbound variable`,n,`bash: ${t}: unbound variable
6
+ `),this.varName=t}},ye=class extends ut{exitCode;name="ExitError";constructor(t,n="",r=""){super("exit",n,r),this.exitCode=t}},Ve=class extends ut{name="ArithmeticError";fatal;constructor(t,n="",r="",s=!1){super(t,n,r),this.stderr=r||`bash: ${t}
7
+ `,this.fatal=s}},rn=class extends ut{name="BadSubstitutionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}: bad substitution
8
+ `}},mr=class extends ut{name="GlobError";constructor(t,n="",r=""){super(`no match: ${t}`,n,r),this.stderr=r||`bash: no match: ${t}
9
+ `}},ti=class extends ut{name="BraceExpansionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}
10
+ `}},C=class extends ut{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(t,n,r="",s=""){super(t,r,s),this.limitType=n,this.stderr=s||`bash: ${t}
11
+ `}},Ge=class extends ut{name="ExecutionAbortedError";constructor(t="",n=""){super("execution aborted",t,n)}},kt=class extends ut{commandName;name="UnresolvedCommandError";exitCode=127;constructor(t,n="",r=""){super(`unresolved command: ${t}`,n,r),this.commandName=t}},gr=class extends ut{name="SubshellExitError";constructor(t="",n=""){super("subshell exit",t,n)}};hn=class extends ut{exitCode;name="PosixFatalError";constructor(t,n="",r=""){super("posix fatal error",n,r),this.exitCode=t}}});function Fn(e,t,n){let r=n==="width"?Math.abs(e):e;if(!Number.isFinite(e)||!Number.isSafeInteger(e)||r<0||r>t)throw new C(`format ${n} limit exceeded (${t} bytes)`,"string_length")}function ni(e,t,n,r=Dc){Fn(t,r,"width"),n!==-1&&Fn(n,r,"precision");let s=e;n>=0&&s.length>n&&(s=s.slice(0,n));let i=Math.abs(t);if(i>s.length){if(U(s)+i-s.length>r)throw new C(`formatted value size limit exceeded (${r} bytes)`,"string_length");t<0?s=s.padEnd(i," "):s=s.padStart(i," ")}if(U(s)>r)throw new C(`formatted value size limit exceeded (${r} bytes)`,"string_length");return s}function mh(e,t,n=Dc){let r=t,s=0,i=-1,o=!1;for(r<e.length&&e[r]==="-"&&(o=!0,r++);r<e.length&&/\d/.test(e[r]);)s=s*10+parseInt(e[r],10),r++;if(r<e.length&&e[r]===".")for(r++,i=0;r<e.length&&/\d/.test(e[r]);)i=i*10+parseInt(e[r],10),r++;return o&&s>0&&(s=-s),Fn(s,n,"width"),i!==-1&&Fn(i,n,"precision"),[s,i,r-t]}function oa(e,t=Dc){if(U(e)>t)throw new C(`escaped string size limit exceeded (${t} bytes)`,"string_length");let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length)switch(e[r+1]){case"n":n+=`
12
+ `,r+=2;break;case"t":n+=" ",r+=2;break;case"r":n+="\r",r+=2;break;case"\\":n+="\\",r+=2;break;case"a":n+="\x07",r+=2;break;case"b":n+="\b",r+=2;break;case"f":n+="\f",r+=2;break;case"v":n+="\v",r+=2;break;case"e":case"E":n+="\x1B",r+=2;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let i="",o=r+1;for(;o<e.length&&o<r+4&&/[0-7]/.test(e[o]);)i+=e[o],o++;n+=String.fromCharCode(parseInt(i,8)),r=o;break}case"x":{let i=[],o=r;for(;o+3<e.length&&e[o]==="\\"&&e[o+1]==="x"&&/[0-9a-fA-F]{2}/.test(e.slice(o+2,o+4));)i.push(parseInt(e.slice(o+2,o+4),16)),o+=4;if(i.length>0){try{let a=new TextDecoder("utf-8",{fatal:!0});n+=a.decode(new Uint8Array(i))}catch{for(let a of i)n+=String.fromCharCode(a)}r=o}else n+=e[r],r++;break}case"u":{let i="",o=r+2;for(;o<e.length&&o<r+6&&/[0-9a-fA-F]/.test(e[o]);)i+=e[o],o++;i?(n+=String.fromCodePoint(parseInt(i,16)),r=o):(n+="\\u",r+=2);break}case"U":{let i="",o=r+2;for(;o<e.length&&o<r+10&&/[0-9a-fA-F]/.test(e[o]);)i+=e[o],o++;i?(n+=String.fromCodePoint(parseInt(i,16)),r=o):(n+="\\U",r+=2);break}default:n+=e[r],r++}else n+=e[r],r++;return n}var Dc,St=M(()=>{"use strict";ce();Z();ce();Dc=10*1024*1024});var gh={};ae(gh,{echoCommand:()=>a8,flagsForFuzzing:()=>l8});function o8(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"){if(n+1>=e.length){t+="\\";break}let r=e[n+1];switch(r){case"\\":t+="\\",n+=2;break;case"n":t+=`
13
+ `,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"a":t+="\x07",n+=2;break;case"b":t+="\b",n+=2;break;case"f":t+="\f",n+=2;break;case"v":t+="\v",n+=2;break;case"e":case"E":t+="\x1B",n+=2;break;case"c":return{output:t,stop:!0};case"0":{let s="",i=n+2;for(;i<e.length&&i<n+5&&/[0-7]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\0";else{let o=parseInt(s,8)%256;t+=String.fromCharCode(o)}n=i;break}case"x":{let s="",i=n+2;for(;i<e.length&&i<n+4&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\x",n+=2;else{let o=parseInt(s,16);t+=String.fromCharCode(o),n=i}break}case"u":{let s="",i=n+2;for(;i<e.length&&i<n+6&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\u",n+=2;else{let o=parseInt(s,16);t+=String.fromCodePoint(o),n=i}break}case"U":{let s="",i=n+2;for(;i<e.length&&i<n+10&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\U",n+=2;else{let o=parseInt(s,16);try{t+=String.fromCodePoint(o)}catch{t+=`\\U${s}`}n=i}break}default:t+=`\\${r}`,n+=2}}else t+=e[n],n++;return{output:t,stop:!1}}var a8,l8,yh=M(()=>{"use strict";a8={name:"echo",async execute(e,t){let n=!1,r=t.xpgEcho??!1,s=0;for(;s<e.length;){let o=e[s];if(o==="-n")n=!0,s++;else if(o==="-e")r=!0,s++;else if(o==="-E")r=!1,s++;else if(o==="-ne"||o==="-en")n=!0,r=!0,s++;else break}let i=e.slice(s).join(" ");if(r){let o=o8(i);if(i=o.output,o.stop)return{stdout:i,stderr:"",exitCode:0,internalStdinConsumed:0}}return n||(i+=`
14
+ `),{stdout:i,stderr:"",exitCode:0,internalStdinConsumed:0}}},l8={name:"echo",flags:[{flag:"-n",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-E",type:"boolean"}],stdinType:"none",needsArgs:!0}});function Lc(e){return e instanceof C||e instanceof Ge||e instanceof Ae||e instanceof kt}function he(e){if(Lc(e))throw e}var Nt=M(()=>{"use strict";Z();vn()});function G(e){let t=`${e.name} - ${e.summary}
15
+
16
+ `;if(t+=`Usage: ${e.usage}
17
+ `,e.description){if(t+=`
18
+ Description:
19
+ `,typeof e.description=="string")for(let n of e.description.split(`
20
+ `))t+=n?` ${n}
21
+ `:`
22
+ `;else if(e.description.length>0)for(let n of e.description)t+=n?` ${n}
23
+ `:`
24
+ `}if(e.options&&e.options.length>0){t+=`
25
+ Options:
26
+ `;for(let n of e.options)t+=` ${n}
27
+ `}if(e.examples&&e.examples.length>0){t+=`
28
+ Examples:
29
+ `;for(let n of e.examples)t+=` ${n}
30
+ `}if(e.notes&&e.notes.length>0){t+=`
31
+ Notes:
32
+ `;for(let n of e.notes)t+=` ${n}
33
+ `}return{stdout:t,stderr:"",exitCode:0}}function q(e){return e.includes("--help")}function re(e,t){return{stdout:"",stderr:t.startsWith("--")?`${e}: unrecognized option '${t}'
34
+ `:`${e}: invalid option -- '${t.replace(/^-/,"")}'
35
+ `,exitCode:1}}var de=M(()=>{"use strict"});function Le(e,t,n){let r=new Map,s=new Map;for(let[l,c]of Object.entries(n)){let u={name:l,type:c.type};c.short&&r.set(c.short,u),c.long&&s.set(c.long,u)}let i=Object.create(null);for(let[l,c]of Object.entries(n))c.default!==void 0?i[l]=c.default:c.type==="boolean"&&(i[l]=!1);let o=[],a=!1;for(let l=0;l<t.length;l++){let c=t[l];if(a||!c.startsWith("-")||c==="-"){o.push(c);continue}if(c==="--"){a=!0;continue}if(c.startsWith("--")){let u=c.indexOf("="),f,d;u!==-1?(f=c.slice(2,u),d=c.slice(u+1)):f=c.slice(2);let p=s.get(f);if(!p)return{ok:!1,error:re(e,c)};let{name:h,type:m}=p;if(m==="boolean")i[h]=!0;else{if(d===void 0){if(l+1>=t.length)return{ok:!1,error:{stdout:"",stderr:`${e}: option '--${f}' requires an argument
36
+ `,exitCode:1}};d=t[++l]}i[h]=m==="number"?parseInt(d,10):d}}else{let u=c.slice(1);for(let f=0;f<u.length;f++){let d=u[f],p=r.get(d);if(!p)return{ok:!1,error:re(e,`-${d}`)};let{name:h,type:m}=p;if(m==="boolean")i[h]=!0;else{let g;if(f+1<u.length)g=u.slice(f+1);else if(l+1<t.length)g=t[++l];else return{ok:!1,error:{stdout:"",stderr:`${e}: option requires an argument -- '${d}'
37
+ `,exitCode:1}};i[h]=m==="number"?parseInt(g,10):g;break}}}}return{ok:!0,result:{flags:i,positional:o}}}var It=M(()=>{"use strict";de()});var Yi=M(()=>{"use strict"});function aa(e,t,n){if(!Number.isSafeInteger(t)||t<0||t>e.limits.maxInputBytes)throw new C(`${n}: input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");e.executionScope?.consumeInput(t,n)}async function ri(e,t,n){let{cmdName:r,allowStdinMarker:s=!0,stopOnError:i=!1,batchSize:o=100}=n;if(t.length===0)return{files:[{filename:"",content:e.stdin}],stderr:"",exitCode:0};let a=[],l="",c=0;for(let u=0;u<t.length;u+=o){let f=t.slice(u,u+o),d=await Promise.all(f.map(async p=>{if(s&&p==="-")return{filename:"-",content:e.stdin,error:null};try{let h=e.fs.resolvePath(e.cwd,p),m=await jt(e.fs,h);return{filename:p,content:m,error:null}}catch{return{filename:p,content:sa,error:`${r}: ${p}: No such file or directory
38
+ `}}}));for(let p of d)if(p.error){if(l+=p.error,c=1,i)return{files:a,stderr:l,exitCode:c}}else a.push({filename:p.filename,content:p.content})}return{files:a,stderr:l,exitCode:c}}async function si(e,t,n){let r=await ri(e,t,{...n,stopOnError:!0});return r.exitCode!==0?{ok:!1,error:{stdout:"",stderr:r.stderr,exitCode:r.exitCode}}:{ok:!0,content:r.files.map(i=>i.content).join("")}}var Gr=M(()=>{"use strict";ce();Z();Yi()});var wh={};ae(wh,{catCommand:()=>f8,flagsForFuzzing:()=>m8});function d8(e){if(e>=32){if(e<127)return String.fromCharCode(e);if(e===127)return"^?";let t=e-128;return t>=32?t===127?"M-^?":`M-${String.fromCharCode(t)}`:`M-^${String.fromCharCode(t+64)}`}return`^${String.fromCharCode(e+64)}`}function p8(e,t,n){if(!t.showNonprinting&&!t.showTabs)return e;let r="",s=i=>{if(i.length>n-r.length)throw new C("cat: output size limit exceeded","output_size");r+=i};for(let i=0;i<e.length;i++){let o=e.charCodeAt(i);o===9?s(t.showTabs?"^I":" "):t.showNonprinting?s(d8(o)):s(e[i])}return r}function h8(e,t,n,r){let s=1;for(let u=0;u<e.length;u++)if(e.charCodeAt(u)===10&&s++,s>r)throw new C(`cat: array element limit exceeded (${r})`,"array_elements");let i=e.split(`
39
+ `),o="",a=1,l=!1,c=u=>{if(u.length>n-o.length)throw new C(`cat: output size limit exceeded (${n} bytes)`,"output_size");o+=u};for(let u=0;u<i.length;u++){let f=u===i.length-1,d=!f,p=i[u];if(f&&p==="")break;let h=p==="";if(t.squeeze&&h&&l)continue;l=h;let m="";(t.numberAll||t.numberNonblank&&!h)&&(m=`${String(a).padStart(6," ")} `,a++);let g=n-o.length-m.length;if(g<0)throw new C(`cat: output size limit exceeded (${n} bytes)`,"output_size");c(m+p8(p,t,g)),d&&c(t.showEnds?`$
40
+ `:`
41
+ `)}return o}var c8,u8,f8,m8,bh=M(()=>{"use strict";ce();Nt();Z();It();Gr();de();c8={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-A, --show-all equivalent to -vET","-b, --number-nonblank number nonempty output lines, overrides -n","-e equivalent to -vE","-E, --show-ends display $ at end of each line","-n, --number number all output lines","-s, --squeeze-blank suppress repeated empty output lines","-t equivalent to -vT","-T, --show-tabs display TAB characters as ^I","-u (ignored)","-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB"," --help display this help and exit"]},u8={number:{short:"n",long:"number",type:"boolean"},numberNonblank:{short:"b",long:"number-nonblank",type:"boolean"},showEnds:{short:"E",long:"show-ends",type:"boolean"},showTabs:{short:"T",long:"show-tabs",type:"boolean"},showNonprinting:{short:"v",long:"show-nonprinting",type:"boolean"},showAll:{short:"A",long:"show-all",type:"boolean"},squeeze:{short:"s",long:"squeeze-blank",type:"boolean"},vE:{short:"e",type:"boolean"},vT:{short:"t",type:"boolean"},ignored:{short:"u",type:"boolean"}},f8={name:"cat",async execute(e,t){if(q(e))return G(c8);let n=Le("cat",e,u8);if(!n.ok)return n.error;let r=n.result.flags,s=r.showEnds||r.showAll||r.vE,i=r.showTabs||r.showAll||r.vT,o=r.showNonprinting||r.showAll||r.vE||r.vT,a=r.squeeze,l=r.numberNonblank,c=r.number&&!l,u={numberAll:c,numberNonblank:l,showEnds:s,showTabs:i,showNonprinting:o,squeeze:a},f=n.result.positional,d=t.limits.maxStringLength,p=Math.min(d,t.limits.maxOutputSize),h=f.length===0?["-"]:f,m="",g=0,b=0,w,y=s||i||o||a||c||l,x="";for(let S of h)try{let E=S==="-"?t.stdin:await jt(t.fs,t.fs.resolvePath(t.cwd,S)),A=E,I=A.length,$=Math.min(y?d:p,t.limits.maxInputBytes);if(I>$-b)throw new C(`cat: ${y?"input":"output"} size limit exceeded (${$} bytes)`,y?"string_length":"output_size");S!=="-"&&aa(t,I,"cat"),b+=I,x+=A}catch(E){he(E),m+=`cat: ${S}: No such file or directory
42
+ `,g=1}return y?w=h8(x,u,p,t.limits.maxArrayElements):w=x,{stdout:w,stderr:m,exitCode:g,stdoutEncoding:"binary"}}};m8={name:"cat",flags:[{flag:"-n",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-t",type:"boolean"}],stdinType:"text",needsFiles:!0}});function mt(e){return e instanceof Error?e.message:String(e)}var kn=M(()=>{"use strict"});function Es(e,t,n,r={}){let s=new Date(t*1e3),i=g8(s,n),o="",a=0,l=0,c=0,u=new Map,f=d=>{let p=U(d);if(r.maxOutputBytes!==void 0&&p>r.maxOutputBytes-a)throw new C(`strftime: output size limit exceeded (${r.maxOutputBytes} bytes)`,"output_size");o+=d,a+=p};for(;l<e.length;){if(c++,r.maxOperations!==void 0&&c>r.maxOperations)throw new C(`strftime: iteration limit exceeded (${r.maxOperations})`,"iterations");if(e[l]==="%"&&l+1<e.length){let d=e[l+1],p;u.has(d)?p=u.get(d)??null:(p=y8(s,i,d,n),u.set(d,p)),p!==null?(f(p),l+=2):(f(e[l]),l++)}else f(e[l]),l++}return o}function g8(e,t){let n={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hour12:!1,timeZone:t};try{let s=new Intl.DateTimeFormat("en-US",n).formatToParts(e),i=c=>s.find(u=>u.type===c)?.value??"",o=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),a=i("weekday"),l=(c,u)=>{let f=Number.parseInt(c,10);return Number.isNaN(f)?u:f};return{year:l(i("year"),e.getFullYear()),month:l(i("month"),e.getMonth()+1),day:l(i("day"),e.getDate()),hour:l(i("hour"),e.getHours())%24,minute:l(i("minute"),e.getMinutes()),second:l(i("second"),e.getSeconds()),weekday:o.get(a)??e.getDay()}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),weekday:e.getDay()}}}function y8(e,t,n,r){let s=(l,c=2)=>String(l).padStart(c,"0"),i=Sh(t.year,t.month,t.day),o=xh(t.year,t.month,t.day,t.weekday,0),a=xh(t.year,t.month,t.day,t.weekday,1);switch(n){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][t.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][t.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.month-1]} ${String(t.day).padStart(2," ")} ${s(t.hour)}:${s(t.minute)}:${s(t.second)} ${t.year}`;case"C":return s(Math.floor(t.year/100));case"d":return s(t.day);case"D":return`${s(t.month)}/${s(t.day)}/${s(t.year%100)}`;case"e":return String(t.day).padStart(2," ");case"F":return`${t.year}-${s(t.month)}-${s(t.day)}`;case"g":return s(Eh(t.year,t.month,t.day)%100);case"G":return String(Eh(t.year,t.month,t.day));case"H":return s(t.hour);case"I":return s(t.hour%12||12);case"j":return String(i).padStart(3,"0");case"k":return String(t.hour).padStart(2," ");case"l":return String(t.hour%12||12).padStart(2," ");case"m":return s(t.month);case"M":return s(t.minute);case"n":return`
43
+ `;case"N":return"000000000";case"p":return t.hour<12?"AM":"PM";case"P":return t.hour<12?"am":"pm";case"r":return`${s(t.hour%12||12)}:${s(t.minute)}:${s(t.second)} ${t.hour<12?"AM":"PM"}`;case"R":return`${s(t.hour)}:${s(t.minute)}`;case"s":return String(Math.floor(e.getTime()/1e3));case"S":return s(t.second);case"t":return" ";case"T":return`${s(t.hour)}:${s(t.minute)}:${s(t.second)}`;case"u":return String(t.weekday===0?7:t.weekday);case"U":return s(o);case"V":return s(x8(t.year,t.month,t.day));case"w":return String(t.weekday);case"W":return s(a);case"x":return`${s(t.month)}/${s(t.day)}/${s(t.year%100)}`;case"X":return`${s(t.hour)}:${s(t.minute)}:${s(t.second)}`;case"y":return s(t.year%100);case"Y":return String(t.year);case"z":return w8(e,r);case"Z":return b8(e,r);case"%":return"%";default:return null}}function w8(e,t){if(!t){let o=-e.getTimezoneOffset(),a=o>=0?"+":"-",l=Math.floor(Math.abs(o)/60),c=Math.abs(o)%60;return`${a}${String(l).padStart(2,"0")}${String(c).padStart(2,"0")}`}try{let l=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).formatToParts(e).find(c=>c.type==="timeZoneName");if(l){let c=l.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(c)return`${c[1]}${c[2]}${c[3]}`;if(l.value==="GMT"||l.value==="UTC")return"+0000"}}catch{}let n=-e.getTimezoneOffset(),r=n>=0?"+":"-",s=Math.floor(Math.abs(n)/60),i=Math.abs(n)%60;return`${r}${String(s).padStart(2,"0")}${String(i).padStart(2,"0")}`}function b8(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(i=>i.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function Sh(e,t,n){let r=[31,28,31,30,31,30,31,31,30,31,30,31];(e%4===0&&e%100!==0||e%400===0)&&(r[1]=29);let i=n;for(let o=0;o<t-1;o++)i+=r[o];return i}function xh(e,t,n,r,s){let i=Sh(e,t,n),o=new Date(e,0,1).getDay(),a=1+(7+s-o)%7,l=i-a;return l<0?0:Math.floor(l/7)+1}function x8(e,t,n){let r=new Date(e,t-1,n,12,0,0);r.setDate(r.getDate()+3-(r.getDay()+6)%7);let s=new Date(r.getFullYear(),0,4);s.setDate(s.getDate()+3-(s.getDay()+6)%7);let i=r.getTime()-s.getTime();return 1+Math.round(i/(10080*60*1e3))}function Eh(e,t,n){let r=new Date(e,t-1,n,12,0,0);return r.setDate(r.getDate()+3-(r.getDay()+6)%7),r.getFullYear()}var Fc=M(()=>{"use strict";Z();St()});var Ch={};ae(Ch,{flagsForFuzzing:()=>D8,printfCommand:()=>A8});import{sprintf as ii}from"sprintf-js";function E8(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)===192){if(n+1<e.length&&(e[n+1]&192)===128&&r>=194){let s=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(s),n+=2;continue}t+=String.fromCharCode(r),n++;continue}if((r&240)===224){if(n+2<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128){if(r===224&&e[n+1]<160){t+=String.fromCharCode(r),n++;continue}let s=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(s>=55296&&s<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(s),n+=3;continue}t+=String.fromCharCode(r),n++;continue}if((r&248)===240&&r<=244){if(n+3<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128&&(e[n+3]&192)===128){if(r===240&&e[n+1]<144){t+=String.fromCharCode(r),n++;continue}let s=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(s>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(s),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function C8(e,t,n,r,s=10*1024*1024){let i="",o=0,a=0,l=!1,c="",u=0,f=d=>{let p=U(d);if(p>s-u)throw new C(`printf: output size limit exceeded (${s} bytes)`,"string_length");i+=d,u+=p};for(;o<e.length;)if(e[o]==="%"&&o+1<e.length){let d=o;if(o++,e[o]==="%"){f("%"),o++;continue}let p=e.slice(d).match(/^%(-?\d*)(?:\.(\d+))?\(([^)]*)\)T/);if(p){let I=p[1]?parseInt(p[1],10):0,$=p[2]?parseInt(p[2],10):-1;Fn(I,s,"width"),$!==-1&&Fn($,s,"precision");let N=p[3],R=p[0],O=t[n+a]||"";a++;let B;O===""||O==="-1"||O==="-2"?B=Math.floor(Date.now()/1e3):B=parseInt(O,10)||0;let L=Es(N,B,r,{maxOperations:s-u,maxOutputBytes:s-u});L=ni(L,I,$,s-u),f(L),o=d+R.length;continue}for(;o<e.length&&"+-0 #'".includes(e[o]);)o++;let h=!1;if(e[o]==="*")h=!0,o++;else for(;o<e.length&&/\d/.test(e[o]);)o++;let m=!1;if(e[o]===".")if(o++,e[o]==="*")m=!0,o++;else for(;o<e.length&&/\d/.test(e[o]);)o++;o<e.length&&"hlL".includes(e[o])&&o++;let g=e[o]||"";o++;let w=e.slice(d,o);if(h){let I=parseInt(t[n+a]||"0",10);Fn(I,s-u,"width"),a++,w=w.replace("*",String(I))}if(m){let I=parseInt(t[n+a]||"0",10);I>=0?Fn(I,s-u,"precision"):Number.isSafeInteger(I)||Fn(I,s-u,"precision"),a++,w=w.replace(".*",`.${I}`)}k8(w,s-u);let y=t[n+a]||"";a++;let{value:x,parseError:S,parseErrMsg:E,stopped:A}=v8(w,g,y,s-u);if(f(x),S&&(l=!0,E&&(c=E)),A)return{result:i,argsConsumed:a,error:l,errMsg:c,stopped:!0}}else f(e[o]),o++;return{result:i,argsConsumed:a,error:l,errMsg:c,stopped:!1}}function v8(e,t,n,r){let s=!1,i="";switch(t){case"d":case"i":{let o=la(n);return s=tr,s&&(i=`printf: ${n}: invalid number
44
+ `),{value:Ah(e,o),parseError:s,parseErrMsg:i}}case"o":{let o=la(n);return s=tr,s&&(i=`printf: ${n}: invalid number
45
+ `),{value:N8(e,o),parseError:s,parseErrMsg:i}}case"u":{let o=la(n);s=tr,s&&(i=`printf: ${n}: invalid number
46
+ `);let a=o<0?o>>>0:o;return{value:Ah(e.replace("u","d"),a),parseError:s,parseErrMsg:i}}case"x":case"X":{let o=la(n);return s=tr,s&&(i=`printf: ${n}: invalid number
47
+ `),{value:I8(e,o),parseError:s,parseErrMsg:i}}case"e":case"E":case"f":case"F":case"g":case"G":{let o=parseFloat(n)||0;return{value:$8(e,t,o),parseError:!1,parseErrMsg:""}}case"c":{if(n==="")return{value:"",parseError:!1,parseErrMsg:""};let l=new TextEncoder().encode(n)[0];return{value:String.fromCharCode(l),parseError:!1,parseErrMsg:""}}case"s":return{value:T8(e,n,r),parseError:!1,parseErrMsg:""};case"q":return{value:R8(e,n,r),parseError:!1,parseErrMsg:""};case"b":{let o=P8(n,r);return{value:o.value,parseError:!1,parseErrMsg:"",stopped:o.stopped}}default:try{return{value:ii(e,n),parseError:!1,parseErrMsg:""}}catch{return{value:"",parseError:!0,parseErrMsg:`printf: [sprintf] unexpected placeholder
48
+ `}}}}function k8(e,t){let n=e.match(/^%[-+0 #' ]*(\d*)(?:\.(\d*))?/);if(!n)return;let r=n[1]?Number(n[1]):0,s=n[2]!==void 0?Number(n[2]):-1;Fn(r,t,"width"),s!==-1&&Fn(s,t,"precision")}function la(e){tr=!1;let t=e.trimStart(),n=t!==t.trimEnd();if(e=t.trimEnd(),e.startsWith("'")&&e.length>=2||e.startsWith('"')&&e.length>=2)return e.charCodeAt(1);if(e.startsWith("\\'")&&e.length>=3||e.startsWith('\\"')&&e.length>=3)return e.charCodeAt(2);if(e.startsWith("+")&&(e=e.slice(1)),e.startsWith("0x")||e.startsWith("0X")){let r=parseInt(e,16);return Number.isNaN(r)?(tr=!0,0):(n&&(tr=!0),r)}if(e.startsWith("0")&&e.length>1&&/^-?0[0-7]+$/.test(e))return n&&(tr=!0),parseInt(e,8)||0;if(/^\d+#/.test(e)){tr=!0;let r=e.match(/^(\d+)#/);return r?parseInt(r[1],10):0}if(e!==""&&!/^-?\d+$/.test(e)){tr=!0;let r=parseInt(e,10);return Number.isNaN(r)?0:r}return n&&(tr=!0),parseInt(e,10)||0}function Ah(e,t){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[diu]$/);if(!n)return ii(e.replace(/\.\d*/,""),t);let r=n[1]||"",s=n[2]?parseInt(n[2],10):0,i=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,o=t<0,a=Math.abs(t),l=String(a);i>=0&&(l=l.padStart(i,"0"));let c="";o?c="-":r.includes("+")?c="+":r.includes(" ")&&(c=" ");let u=c+l;return s>u.length&&(r.includes("-")?u=u.padEnd(s," "):r.includes("0")&&i<0?u=c+l.padStart(s-c.length,"0"):u=u.padStart(s," ")),u}function N8(e,t){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?o$/);if(!n)return ii(e,t);let r=n[1]||"",s=n[2]?parseInt(n[2],10):0,i=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,o=Math.abs(t).toString(8);i>=0&&(o=o.padStart(i,"0")),r.includes("#")&&!o.startsWith("0")&&(o=`0${o}`);let a=o;return s>a.length&&(r.includes("-")?a=a.padEnd(s," "):r.includes("0")&&i<0?a=a.padStart(s,"0"):a=a.padStart(s," ")),a}function I8(e,t){let n=e.includes("X"),r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[xX]$/);if(!r)return ii(e,t);let s=r[1]||"",i=r[2]?parseInt(r[2],10):0,o=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,a=Math.abs(t).toString(16);n&&(a=a.toUpperCase()),o>=0&&(a=a.padStart(o,"0"));let l="";s.includes("#")&&t!==0&&(l=n?"0X":"0x");let c=l+a;return i>c.length&&(s.includes("-")?c=c.padEnd(i," "):s.includes("0")&&o<0?c=l+a.padStart(i-l.length,"0"):c=c.padStart(i," ")),c}function O8(e,t){if(e===""){if(t<2)throw new C(`printf: output size limit exceeded (${t} bytes)`,"string_length");return"''"}if(/^[a-zA-Z0-9_./-]+$/.test(e)){if(U(e)>t)throw new C(`printf: output size limit exceeded (${t} bytes)`,"string_length");return e}let n=/[\x00-\x1f\x7f-\xff]/.test(e),r=n?3:0;for(let i of e){let o=i.charCodeAt(0);if(n?i==="'"||i==="\\"||i===`
49
+ `||i===" "||i==="\r"||i==="\x07"||i==="\b"||i==="\f"||i==="\v"||i==="\x1B"||i==='"'?r+=2:o<32||o>=127&&o<=255?r+=4:r+=U(i):r+=U(i)+(" |&;<>()$`\\\"'*?[#~=%!{}".includes(i)?1:0),r>t)throw new C(`printf: output size limit exceeded (${t} bytes)`,"string_length")}if(n){let i="$'";for(let o of e){let a=o.charCodeAt(0);o==="'"?i+="\\'":o==="\\"?i+="\\\\":o===`
50
+ `?i+="\\n":o===" "?i+="\\t":o==="\r"?i+="\\r":o==="\x07"?i+="\\a":o==="\b"?i+="\\b":o==="\f"?i+="\\f":o==="\v"?i+="\\v":o==="\x1B"?i+="\\E":a<32||a>=127&&a<=255?i+=`\\${a.toString(8).padStart(3,"0")}`:o==='"'?i+='\\"':i+=o}return i+="'",i}let s="";for(let i of e)" |&;<>()$`\\\"'*?[#~=%!{}".includes(i)?s+=`\\${i}`:s+=i;return s}function T8(e,t,n){let r=e.match(/^%(-?)(\d*)(\.(\d*))?s$/);if(!r)return ii(e.replace(/0+(?=\d)/,""),t);let s=r[1]==="-",i=r[2]?parseInt(r[2],10):0,o=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,a=s?-i:i;return ni(t,a,o,n)}function R8(e,t,n){let r=O8(t,n),s=e.match(/^%(-?)(\d*)q$/);if(!s)return r;let i=s[1]==="-",o=s[2]?parseInt(s[2],10):0;return ni(r,i?-o:o,-1,n)}function $8(e,t,n){let r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[eEfFgG]$/);if(!r)return ii(e,n);let s=r[1]||"",i=r[2]?parseInt(r[2],10):0,o=r[3]!==void 0?r[4]?parseInt(r[4],10):0:6,a,l=t.toLowerCase();if(l==="e"?(a=n.toExponential(o),a=a.replace(/e([+-])(\d)$/,"e$10$2"),t==="E"&&(a=a.toUpperCase())):l==="f"?(a=n.toFixed(o),s.includes("#")&&o===0&&!a.includes(".")&&(a+=".")):l==="g"?(a=n.toPrecision(o||1),s.includes("#")||(a=a.replace(/\.?0+$/,""),a=a.replace(/\.?0+e/,"e")),a=a.replace(/e([+-])(\d)$/,"e$10$2"),t==="G"&&(a=a.toUpperCase())):a=n.toString(),n>=0&&(s.includes("+")?a=`+${a}`:s.includes(" ")&&(a=` ${a}`)),i>a.length)if(s.includes("-"))a=a.padEnd(i," ");else if(s.includes("0")){let c=a.match(/^[+ -]/)?.[0]||"",u=c?a.slice(1):a;a=c+u.padStart(i-c.length,"0")}else a=a.padStart(i," ");return a}function P8(e,t){if(U(e)>t)throw new C(`printf: output size limit exceeded (${t} bytes)`,"string_length");let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length)switch(e[r+1]){case"n":n+=`
51
+ `,r+=2;break;case"t":n+=" ",r+=2;break;case"r":n+="\r",r+=2;break;case"\\":n+="\\",r+=2;break;case"a":n+="\x07",r+=2;break;case"b":n+="\b",r+=2;break;case"f":n+="\f",r+=2;break;case"v":n+="\v",r+=2;break;case"c":return{value:n,stopped:!0};case"x":{let i=[],o=r;for(;o+1<e.length&&e[o]==="\\"&&e[o+1]==="x";){let a="",l=o+2;for(;l<e.length&&l<o+4&&/[0-9a-fA-F]/.test(e[l]);)a+=e[l],l++;if(a)i.push(parseInt(a,16)),o=l;else break}i.length>0?(n+=E8(i),r=o):(n+="\\x",r+=2);break}case"u":{let i="",o=r+2;for(;o<e.length&&o<r+6&&/[0-9a-fA-F]/.test(e[o]);)i+=e[o],o++;i?(n+=String.fromCodePoint(parseInt(i,16)),r=o):(n+="\\u",r+=2);break}case"0":{let i="",o=r+2;for(;o<e.length&&o<r+5&&/[0-7]/.test(e[o]);)i+=e[o],o++;i?n+=String.fromCharCode(parseInt(i,8)):n+="\0",r=o;break}case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let i="",o=r+1;for(;o<e.length&&o<r+4&&/[0-7]/.test(e[o]);)i+=e[o],o++;n+=String.fromCharCode(parseInt(i,8)),r=o;break}default:n+=e[r],r++}else n+=e[r],r++;return{value:n,stopped:!1}}var S8,A8,tr,D8,vh=M(()=>{"use strict";Z();kn();de();St();Fc();S8={name:"printf",summary:"format and print data",usage:"printf [-v var] FORMAT [ARGUMENT...]",options:[" -v var assign the output to shell variable VAR rather than display it"," --help display this help and exit"],notes:["FORMAT controls the output like in C printf.","Escape sequences: \\n (newline), \\t (tab), \\\\ (backslash)","Format specifiers: %s (string), %d (integer), %f (float), %x (hex), %o (octal), %% (literal %)","Width and precision: %10s (width 10), %.2f (2 decimal places), %010d (zero-padded)","Flags: %- (left-justify), %+ (show sign), %0 (zero-pad)"]},A8={name:"printf",async execute(e,t){if(q(e))return G(S8);if(e.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments]
52
+ `,exitCode:2,internalStdinConsumed:0};let n=null,r=0;for(;r<e.length;){let o=e[r];if(o==="--"){r++;break}if(o==="-v"){if(r+1>=e.length)return{stdout:"",stderr:`printf: -v: option requires an argument
53
+ `,exitCode:1,internalStdinConsumed:0};if(n=e[r+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\[[^\]\n]+\])?$/.test(n)||/[;\r\\]/.test(n)||n.includes(".."))return{stdout:"",stderr:`printf: \`${n}': not a valid identifier
54
+ `,exitCode:2,internalStdinConsumed:0};r+=2}else{if(o.startsWith("-")&&o!=="-")break;break}}if(r>=e.length)return{stdout:"",stderr:`printf: usage: printf format [arguments]
55
+ `,exitCode:1,internalStdinConsumed:0};let s=e[r],i=e.slice(r+1);try{let o=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),a=oa(s,o),l="",c=0,u=0,f=!1,d="",p=t.env.get("TZ");do{let{result:h,argsConsumed:m,error:g,errMsg:b,stopped:w}=C8(a,i,u,p,o-c),y=U(h);if(y>o-c)throw new C(`printf: output size limit exceeded (${o} bytes)`,"string_length");if(l+=h,c+=y,u+=m,g&&(f=!0,b&&(d=b)),w)break}while(u<i.length&&u>0);if(u===0&&i.length>0,n){let h=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(h){let m=h[1],g=h[3];if(g=g.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(b,w)=>t.env.get(w)??""),t.assignShellVariable)await t.assignShellVariable(m,l,g);else throw new Error("printf -v array assignment requires an interpreter assignment gateway")}else if(t.assignShellVariable)await t.assignShellVariable(n,l);else{if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n))throw new Error(`${n}: not a valid identifier`);t.env.set(n,l)}return{stdout:"",stderr:d,exitCode:f?1:0,internalStdinConsumed:0}}return{stdout:l,stderr:d,exitCode:f?1:0,internalStdinConsumed:0}}catch(o){if(o instanceof C||typeof o=="object"&&o!==null&&"name"in o&&o.name==="ExitError")throw o;return{stdout:"",stderr:`printf: ${mt(o)}
56
+ `,exitCode:1,internalStdinConsumed:0}}}};tr=!1;D8={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0}});function qr(e,t){if(!Number.isSafeInteger(e)||e<0)throw new C(`${t}: invalid bounded allocation count`,"array_elements")}function kh(e){return new C(`${e}: invalid bounded allocation count`,"array_elements")}function Ss(e,t,n){qr(e,n),qr(t,n);let r=e+t;if(!Number.isSafeInteger(r))throw kh(n);return r}function Nh(e,t,n){if(qr(e,n),qr(t,n),e!==0&&t>Math.floor(Number.MAX_SAFE_INTEGER/e))throw kh(n);return e*t}function yr(e,t,n,r){let s=new Te(n,r);for(let i=0;i<e.length;i++)i>0&&s.append(t),s.append(e[i]);return s.build()}var Te,At=M(()=>{"use strict";ce();Z();Te=class{maxBytes;label;createLimitError;reservedBytes;chunks=[];usedBytes=0;constructor(t,n,r=void 0,s=0){this.maxBytes=t,this.label=n,this.createLimitError=r,this.reservedBytes=s,qr(t,n),qr(s,n),s>t&&this.fail()}fail(){throw this.createLimitError?.()??new C(`${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){qr(t,this.label),t>this.remainingBytes&&this.fail()}append(t){let n=U(t);return this.reserve(n),t&&this.chunks.push(t),this.usedBytes+=n,this}repeat(t,n){qr(n,this.label);let r=U(t);return r!==0&&n>Math.floor(this.remainingBytes/r)&&this.fail(),this.append(t.repeat(n))}reset(){this.chunks.length=0,this.usedBytes=0}build(){return this.chunks.join("")}}});function Ne(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let n=t.split("/").filter(s=>s&&s!=="."),r=[];for(let s of n)s===".."?r.pop():r.push(s);return`/${r.join("/")}`||"/"}function Mn(e,t){let n=Ne(e),r=Ne(t);return r===n||n==="/"||r.startsWith(`${n}/`)}function xt(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function oi(e){let t=Ne(e);if(t==="/")return"/";let n=t.lastIndexOf("/");return n===0?"/":t.slice(0,n)}function ca(e,t){if(t.startsWith("/"))return Ne(t);let n=e==="/"?`/${t}`:`${e}/${t}`;return Ne(n)}function Nn(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function ua(e,t){if(t.startsWith("/"))return Ne(t);let n=oi(e);return Ne(Nn(n,t))}var ai=M(()=>{"use strict"});function L8(e,t,n){if(!e)return e;let r=e.replace(/\n\s+at\s.*/g,"");return n&&(r=r.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g,"<path>")),r=r.replace(t?/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g:/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),r=r.replace(/node:internal\/[^\s'",)}\]:]+/g,"<internal>"),r=r.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),n&&(r=r.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g,"<path>")),r}function Ye(e){return L8(e,!1,!1)}var _n=M(()=>{"use strict"});function Oh(e){if(e.identity!==void 0)return`identity:${e.identity}`;if(e.dev!==void 0&&e.ino!==void 0)return`inode:${String(e.dev)}:${String(e.ino)}`}function Ih(e){let t=e instanceof Error?e.message:String(e);return t.includes("ENOENT")||t.includes("no such file")}async function nr(e,t,n){let r=Ne(t),s;try{s=await e.stat(r)}catch(a){if(!Ih(a))return{existence:"unknown"}}if(s!==void 0){let a=Oh(s);try{return{existence:"existing",canonicalPath:Ne(await e.realpath(r)),stableIdentity:a}}catch{return a===void 0?{existence:"unknown"}:{existence:"existing",stableIdentity:a}}}let i=[],o=r;for(;;){n?.checkpoint();let a=oi(o);if(a===o)return{existence:"unknown"};i.unshift(o.slice(a==="/"?1:a.length+1)),o=a;try{let l=Ne(await e.realpath(o));return{existence:"missing",canonicalPath:i.reduce((c,u)=>Nn(c,u),l)}}catch(l){if(!Ih(l))return{existence:"missing"}}}}async function fa(e,t,n){let[r,s]=await Promise.all([nr(e,t),nr(e,n)]);return r.existence==="unknown"||s.existence==="unknown"?"unknown":r.existence==="missing"||s.existence==="missing"?r.existence!==s.existence?"different":r.canonicalPath!==void 0&&r.canonicalPath===s.canonicalPath?"same":"unknown":r.stableIdentity!==void 0&&s.stableIdentity!==void 0?r.stableIdentity===s.stableIdentity?"same":"different":r.canonicalPath!==void 0&&r.canonicalPath===s.canonicalPath?"same":"unknown"}async function da(e,t,n,r){let[s,i]=await Promise.all([nr(e,t,r),nr(e,n,r)]);return s.existence!=="existing"||s.canonicalPath===void 0||i.existence==="unknown"||i.canonicalPath===void 0?"unknown":Mn(s.canonicalPath,i.canonicalPath)?"inside":"outside"}async function wr(e,t){let n=e.budget??new Pt(e),r=[{kind:"enter",path:Ne(e.root),depth:0}],s=new Set;for(;r.length>0;){n.checkpoint(0);let i=r.pop();if(!i)break;if(i.kind==="leave"){e.includeLeave&&await t({path:i.path,depth:i.depth,stat:i.stat,isSymlink:i.isSymlink,phase:"leave"}),i.identity&&s.delete(i.identity);continue}n.visit(i.depth);let o=await e.fs.lstat(i.path),a=o.isSymbolicLink,l=a&&e.symlinks==="follow"?await e.fs.stat(i.path):o;if(await t({path:i.path,depth:i.depth,stat:l,isSymlink:a,phase:"enter"}),!l.isDirectory||a&&e.symlinks!=="follow")continue;let c=Oh(l)??await e.fs.realpath(i.path).then(Ne).catch(()=>{});if(c!==void 0){if(s.has(c))throw new Mc(e.site,i.path,"symbolic-link directory cycle detected");s.add(c)}r.push({kind:"leave",path:i.path,depth:i.depth,stat:l,isSymlink:a,identity:c});let u=await e.fs.readdir(i.path);n.checkpoint(),u.sort((f,d)=>f.localeCompare(d));for(let f=u.length-1;f>=0;f--)r.push({kind:"enter",path:Nn(i.path,u[f]),depth:i.depth+1})}}var Mc,Pt,Bn=M(()=>{"use strict";Z();ai();_n();Mc=class extends Error{operation;virtualPath;name="FileSystemPolicyError";constructor(t,n,r){super(`${t}: ${Ye(r)}`),this.operation=t,this.virtualPath=n}};Pt=class{options;entries=0;discoveredEntries=1;work=0;constructor(t){this.options=t}checkpoint(t=1){if(this.options.signal?.aborted)throw new Ge;if(this.options.executionScope?.throwIfAborted(this.options.site),!Number.isSafeInteger(t)||t<0||t>this.options.limits.maxTraversalWork-this.work)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal work"} limit exceeded (${this.options.limits.maxTraversalWork})`,"iterations");this.work+=t,this.options.executionScope?.consumeWork(t,`${this.options.site} filesystem traversal`)}visit(t){if(this.checkpoint(),t>this.options.limits.maxTraversalDepth)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} depth limit exceeded (${this.options.limits.maxTraversalDepth})`,"recursion");if(++this.entries>this.options.limits.maxTraversalEntries)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations")}discover(t){if(!Number.isSafeInteger(t)||t<0||t>this.options.limits.maxTraversalEntries-this.discoveredEntries)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations");this.checkpoint(t),this.discoveredEntries+=t}}});var $h={};ae($h,{flagsForFuzzing:()=>U8,lsCommand:()=>_8});function en(e,t,n){if(U(n)>e.limits.maxOutputSize-U(t))throw new C(`ls: output size limit exceeded (${e.limits.maxOutputSize} bytes)`,"output_size");return t+n}function Th(e,t){let n=new Te(e.limits.maxOutputSize,"ls");for(let r=0;r<t.length;r++)r>0&&n.append(`
57
+ `),n.append(t[r]);return t.length>0&&n.append(`
58
+ `),n.build()}function Bc(e){if(e<1024)return String(e);if(e<1024*1024){let n=e/1024;return n<10?`${n.toFixed(1)}K`:`${Math.round(n)}K`}if(e<1024*1024*1024){let n=e/1048576;return n<10?`${n.toFixed(1)}M`:`${Math.round(n)}M`}let t=e/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function Uc(e){let n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=String(e.getDate()).padStart(2," "),s=new Date,i=new Date(s.getTime()-4320*60*60*1e3);if(e>i){let a=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0");return`${n} ${r} ${a}:${l}`}let o=e.getFullYear();return`${n} ${r} ${o}`}function Ji(e){return e.isDirectory?"/":e.isSymbolicLink?"@":(e.mode&73)!==0?"*":""}function B8(e,t,n){if(!t&&!n)return"name";if(t!==n)return t?"size":"time";let r="name";for(let s of e){if(s==="--")break;if(!(!s.startsWith("-")||s.startsWith("--")))for(let i of s.slice(1))i==="S"?r="size":i==="t"&&(r="time")}return r}async function _c(e,t,n,r,s){return await zc(e,i=>t.fs.resolvePath(t.cwd,i),t,n,r,s)}async function zc(e,t,n,r,s,i){let o=[...e];if(r==="name")o.sort();else{i?.checkpoint(o.length);let a=new Map;for(let l of o)try{let c=await n.fs.lstat(t(l));a.set(l,r==="size"?c.size??0:(c.mtime??new Date(0)).getTime())}catch{a.set(l,0)}o.sort((l,c)=>{let u=(a.get(c)??0)-(a.get(l)??0);return u!==0?u:l<c?-1:l>c?1:0})}return s&&o.reverse(),o}async function Rh(e,t,n,r,s,i,o,a=!1,l=!1,c="name",u=!1,f=!1,d=new Pt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"}),p=0,h=new Set,m=!1){let g=n||r,b=t.fs.resolvePath(t.cwd,e);try{m||d.visit(p);let w=await t.fs.stat(b);if(!w.isDirectory){let $=u?Ji(await t.fs.lstat(b)):"";if(s){let N=w.size??0,R=l?Bc(N).padStart(5):String(N).padStart(5),O=w.mtime??new Date(0),B=Uc(O);return{stdout:`-rw-r--r-- 1 user user ${R} ${B} ${e}${$}
59
+ `,stderr:"",exitCode:0}}return{stdout:`${e}${$}
60
+ `,stderr:"",exitCode:0}}let y=w.identity??(w.dev!==void 0&&w.ino!==void 0?`${String(w.dev)}:${String(w.ino)}`:await t.fs.realpath(b).catch(()=>{}));if(y!==void 0&&h.has(y))return{stdout:"",stderr:`ls: ${e}: symbolic link cycle detected
61
+ `,exitCode:2};let x=new Set(h);y!==void 0&&x.add(y);let S=await t.fs.readdir(b);d.checkpoint(),g||(S=S.filter($=>!$.startsWith("."))),S=await zc(S,$=>b==="/"?`/${$}`:`${b}/${$}`,t,c,!1,d),n&&(S=[".","..",...S]),a&&S.reverse();let E="",A="",I=0;if((i||o)&&(E=en(t,E,`${e}:
62
+ `)),s){E=en(t,E,`total ${S.length}
63
+ `);let $=S.filter(B=>B==="."||B===".."),N=S.filter(B=>B!=="."&&B!=="..");for(let B of $)E=en(t,E,`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${B}
64
+ `);let R=[];for(let B=0;B<N.length;B+=100){let L=N.slice(B,B+100),T=await Promise.all(L.map(async W=>{let _=b==="/"?`/${W}`:`${b}/${W}`;try{let F=await t.fs.stat(_),z=F.isDirectory?"drwxr-xr-x":"-rw-r--r--",D=u?Ji(await t.fs.lstat(_)):"",X=F.size??0,V=l?Bc(X).padStart(5):String(X).padStart(5),Y=F.mtime??new Date(0),J=Uc(Y);return{name:W,line:`${z} 1 user user ${V} ${J} ${W}${D}
65
+ `}}catch{return{name:W,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${W}
66
+ `}}}));R.push(...T)}let O=new Map(N.map((B,L)=>[B,L]));R.sort((B,L)=>(O.get(B.name)??0)-(O.get(L.name)??0));for(let{line:B}of R)E=en(t,E,B)}else if(u){let $=[],N=S.filter(O=>O!=="."&&O!==".."),R=S.filter(O=>O==="."||O==="..");for(let O of R)$.push(`${O}/`);for(let O=0;O<N.length;O+=100){let B=N.slice(O,O+100),L=await Promise.all(B.map(async T=>{let W=b==="/"?`/${T}`:`${b}/${T}`;try{let _=await t.fs.lstat(W);return`${T}${Ji(_)}`}catch{return T}}));$.push(...L)}E=en(t,E,Th(t,$))}else E=en(t,E,Th(t,S));if(i){let $=S.filter(L=>L!=="."&&L!==".."),N=[];if(t.fs.readdirWithFileTypes)N=(await t.fs.readdirWithFileTypes(b)).filter(T=>T.isDirectory&&$.includes(T.name)).map(T=>({name:T.name,isDirectory:!0}));else for(let L=0;L<$.length;L+=100){let T=$.slice(L,L+100),W=await Promise.all(T.map(async _=>{let F=b==="/"?`/${_}`:`${b}/${_}`;try{let z=await t.fs.stat(F);return{name:_,isDirectory:z.isDirectory}}catch{return{name:_,isDirectory:!1}}}));N.push(...W.filter(_=>_.isDirectory))}let R=await zc(N.map(L=>L.name),L=>b==="/"?`/${L}`:`${b}/${L}`,t,c,a,d),O=new Map(R.map((L,T)=>[L,T]));N.sort((L,T)=>(O.get(L.name)??0)-(O.get(T.name)??0));let B=[];for(let L=0;L<N.length;L+=100){let T=N.slice(L,L+100),W=await Promise.all(T.map(async _=>{let F=e==="."?`./${_.name}`:`${e}/${_.name}`,z=await Rh(F,t,n,r,s,i,!1,a,l,c,u,!0,d,p+1,x);return{name:_.name,result:z}}));B.push(...W)}B.sort((L,T)=>(O.get(L.name)??0)-(O.get(T.name)??0));for(let{result:L}of B)E=en(t,E,`
67
+ `),E=en(t,E,L.stdout),A=en(t,A,L.stderr),L.exitCode!==0&&(I=L.exitCode)}return{stdout:E,stderr:A,exitCode:I}}catch(w){if(w instanceof C||w instanceof Ge)throw w;return{stdout:"",stderr:`ls: ${e}: No such file or directory
68
+ `,exitCode:2}}}var F8,M8,_8,U8,Ph=M(()=>{"use strict";At();ce();Bn();Z();It();Yi();de();F8={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},M8={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},_8={name:"ls",async execute(e,t){if(q(e))return G(F8);let n=Le("ls",e,M8);if(!n.ok)return n.error;let r=n.result.flags.showAll,s=n.result.flags.showAlmostAll,i=n.result.flags.longFormat,o=n.result.flags.humanReadable,a=n.result.flags.recursive,l=n.result.flags.reverse,c=n.result.flags.classifyFiles,u=n.result.flags.directoryOnly,f=B8(e,n.result.flags.sortBySize,n.result.flags.sortByTime);n.result.flags.onePerLine;let d=n.result.positional;d.length===0&&d.push(".");let p="",h="",m=0,g=new Pt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"});if(u){for(let S of await _c(d,t,f,l,g)){g.visit(0);let E=t.fs.resolvePath(t.cwd,S);try{let A=await t.fs.stat(E);if(i){let I=A.isDirectory?"drwxr-xr-x":"-rw-r--r--",$=c?Ji(await t.fs.lstat(E)):"",N=A.size??0,R=o?Bc(N).padStart(5):String(N).padStart(5),O=A.mtime??new Date(0),B=Uc(O);p=en(t,p,`${I} 1 user user ${R} ${B} ${S}${$}
69
+ `)}else{let I=c?Ji(await t.fs.lstat(E)):"";p=en(t,p,`${S}${I}
70
+ `)}}catch{h=en(t,h,`ls: cannot access '${S}': No such file or directory
71
+ `),m=2}}return{stdout:p,stderr:h,exitCode:m}}let b=[],w=[];for(let S of d){g.visit(0);try{((await t.fs.stat(t.fs.resolvePath(t.cwd,S))).isDirectory?w:b).push(S)}catch{h=en(t,h,`ls: ${S}: No such file or directory
72
+ `),m=2}}let y=async(S,E)=>{let A=await Rh(S,t,r,s,i,a,E,l,o,f,c,!1,g,0,new Set,!0);p=en(t,p,A.stdout),h=en(t,h,A.stderr),A.exitCode!==0&&(m=A.exitCode)};for(let S of await _c(b,t,f,l,g))await y(S,!1);let x=d.length>1;for(let S of await _c(w,t,f,l,g))p&&(p=en(t,p,`
73
+ `)),await y(S,x);return{stdout:p,stderr:h,exitCode:m}}};U8={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0}});var Dh={};ae(Dh,{flagsForFuzzing:()=>j8,mkdirCommand:()=>W8});var z8,W8,j8,Lh=M(()=>{"use strict";_n();kn();It();z8={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},W8={name:"mkdir",async execute(e,t){let n=Le("mkdir",e,z8);if(!n.ok)return n.error;let r=n.result.flags.recursive,s=n.result.flags.verbose,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:`mkdir: missing operand
74
+ `,exitCode:1};let o="",a="",l=0;for(let c of i)try{let u=t.fs.resolvePath(t.cwd,c);await t.fs.mkdir(u,{recursive:r}),s&&(o+=`mkdir: created directory '${c}'
75
+ `)}catch(u){let f=mt(u);f.includes("ENOENT")||f.includes("no such file")?a+=`mkdir: cannot create directory '${c}': No such file or directory
76
+ `:f.includes("EEXIST")||f.includes("already exists")?a+=`mkdir: cannot create directory '${c}': File exists
77
+ `:a+=`mkdir: cannot create directory '${c}': ${Ye(f)}
78
+ `,l=1}return{stdout:o,stderr:a,exitCode:l}}},j8={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var _h={};ae(_h,{flagsForFuzzing:()=>Z8,rmdirCommand:()=>G8});async function q8(e,t,n,r,s){let i="",o="",l=e.fs.resolvePath(e.cwd,t),c=await Fh(e,l,t,r);if(i+=c.stdout,o+=c.stderr,c.exitCode!==0)return{stdout:i,stderr:o,exitCode:c.exitCode};if(n){let u=l,f=t;for(;;){s.visit(0);let d=Mh(u),p=Mh(f);if(d===u||d==="/"||d==="."||p==="."||p==="")break;let h=await Fh(e,d,p,r);if(i+=h.stdout,h.exitCode!==0)break;u=d,f=p}}return{stdout:i,stderr:o,exitCode:0}}async function Fh(e,t,n,r){try{if(!await e.fs.exists(t))return{stdout:"",stderr:`rmdir: failed to remove '${n}': No such file or directory
79
+ `,exitCode:1};if(!(await e.fs.stat(t)).isDirectory)return{stdout:"",stderr:`rmdir: failed to remove '${n}': Not a directory
80
+ `,exitCode:1};if((await e.fs.readdir(t)).length>0)return{stdout:"",stderr:`rmdir: failed to remove '${n}': Directory not empty
81
+ `,exitCode:1};await e.fs.rm(t,{recursive:!1,force:!1});let a="";return r&&(a=`rmdir: removing directory, '${n}'
82
+ `),{stdout:a,stderr:"",exitCode:0}}catch(s){let i=mt(s);return{stdout:"",stderr:`rmdir: failed to remove '${n}': ${i}
83
+ `,exitCode:1}}}function Mh(e){let t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n===-1?".":n===0?"/":t.substring(0,n)}var H8,V8,G8,Z8,Bh=M(()=>{"use strict";Bn();kn();It();H8=`Usage: rmdir [-pv] DIRECTORY...
84
+ Remove empty directories.
85
+
86
+ Options:
87
+ -p, --parents Remove DIRECTORY and its ancestors
88
+ -v, --verbose Output a diagnostic for every directory processed`,V8={parents:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},help:{long:"help",type:"boolean"}},G8={name:"rmdir",async execute(e,t){let n=Le("rmdir",e,V8);if(!n.ok)return n.error;if(n.result.flags.help)return{stdout:`${H8}
89
+ `,stderr:"",exitCode:0};let r=n.result.flags.parents,s=n.result.flags.verbose,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:`rmdir: missing operand
90
+ `,exitCode:1};let o="",a="",l=0,c=new Pt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"rmdir",label:"parent traversal"});for(let u of i){let f=await q8(t,u,r,s,c);o+=f.stdout,a+=f.stderr,f.exitCode!==0&&(l=f.exitCode)}return{stdout:o,stderr:a,exitCode:l}}};Z8={name:"rmdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var Uh={};ae(Uh,{flagsForFuzzing:()=>X8,touchCommand:()=>Q8});function K8(e){let t=e.replace(/\//g,"-"),n=new Date(t);if(!Number.isNaN(n.getTime()))return n;let r=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(r){let[,i,o,a]=r;if(n=new Date(Number.parseInt(i,10),Number.parseInt(o,10)-1,Number.parseInt(a,10)),!Number.isNaN(n.getTime()))return n}let s=t.match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/);if(s){let[,i,o,a,l,c,u]=s;if(n=new Date(Number.parseInt(i,10),Number.parseInt(o,10)-1,Number.parseInt(a,10),Number.parseInt(l,10),Number.parseInt(c,10),Number.parseInt(u,10)),!Number.isNaN(n.getTime()))return n}return null}var Q8,X8,zh=M(()=>{"use strict";kn();de();Q8={name:"touch",async execute(e,t){let n=[],r=null,s=!1;for(let l=0;l<e.length;l++){let c=e[l];if(c==="--"){n.push(...e.slice(l+1));break}else if(c==="-d"||c==="--date"){if(l+1>=e.length)return{stdout:"",stderr:`touch: option requires an argument -- 'd'
91
+ `,exitCode:1};r=e[++l]}else if(c.startsWith("--date="))r=c.slice(7);else if(c==="-c"||c==="--no-create")s=!0;else if(c==="-a"||c==="-m"||c==="-r"||c==="-t")(c==="-r"||c==="-t")&&l++;else{if(c.startsWith("--"))return re("touch",c);if(c.startsWith("-")&&c.length>1){let u=!1;for(let f of c.slice(1))if(f==="c")s=!0;else if(!(f==="a"||f==="m"))if(f==="d"){if(l+1>=e.length)return{stdout:"",stderr:`touch: option requires an argument -- 'd'
92
+ `,exitCode:1};r=e[++l],u=!0;break}else if(f==="r"||f==="t"){l++,u=!0;break}else return re("touch",`-${f}`);if(u)continue}else n.push(c)}}if(n.length===0)return{stdout:"",stderr:`touch: missing file operand
93
+ `,exitCode:1};let i=null;if(r!==null&&(i=K8(r),i===null))return{stdout:"",stderr:`touch: invalid date format '${r}'
94
+ `,exitCode:1};let o="",a=0;for(let l of n)try{let c=t.fs.resolvePath(t.cwd,l);if(!await t.fs.exists(c)){if(s)continue;await t.fs.writeFile(c,"")}let f=i??new Date;await t.fs.utimes(c,f,f)}catch(c){o+=`touch: cannot touch '${l}': ${mt(c)}
95
+ `,a=1}return{stdout:"",stderr:o,exitCode:a}}},X8={name:"touch",flags:[{flag:"-c",type:"boolean"},{flag:"-a",type:"boolean"},{flag:"-m",type:"boolean"},{flag:"-d",type:"value",valueHint:"string"}],needsArgs:!0}});var Wh={};ae(Wh,{flagsForFuzzing:()=>eb,rmCommand:()=>J8});var Y8,J8,eb,jh=M(()=>{"use strict";_n();kn();It();Y8={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},J8={name:"rm",async execute(e,t){let n=Le("rm",e,Y8);if(!n.ok)return n.error;let r=n.result.flags.recursive||n.result.flags.recursiveUpper,s=n.result.flags.force,i=n.result.flags.verbose,o=n.result.positional;if(o.length===0)return s?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
96
+ `,exitCode:1};let a="",l="",c=0;for(let u of o)try{let f=t.fs.resolvePath(t.cwd,u);if((await t.fs.stat(f)).isDirectory&&!r){l+=`rm: cannot remove '${u}': Is a directory
97
+ `,c=1;continue}await t.fs.rm(f,{recursive:r,force:s}),i&&(a+=`removed '${u}'
98
+ `)}catch(f){if(!s){let d=mt(f);d.includes("ENOENT")||d.includes("no such file")?l+=`rm: cannot remove '${u}': No such file or directory
99
+ `:d.includes("ENOTEMPTY")||d.includes("not empty")?l+=`rm: cannot remove '${u}': Directory not empty
100
+ `:l+=`rm: cannot remove '${u}': ${Ye(d)}
101
+ `,c=1}}return{stdout:a,stderr:l,exitCode:c}}},eb={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var Hh={};ae(Hh,{cpCommand:()=>rb,flagsForFuzzing:()=>sb});var tb,nb,rb,sb,Vh=M(()=>{"use strict";ai();Bn();Z();kn();It();de();tb={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},nb={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},rb={name:"cp",async execute(e,t){if(q(e))return G(tb);let n=Le("cp",e,nb);if(!n.ok)return n.error;let r=n.result.flags.recursive||n.result.flags.recursiveUpper,s=n.result.flags.noClobber,i=n.result.flags.preserve,o=n.result.flags.verbose,a=n.result.positional;if(a.length<2)return{stdout:"",stderr:`cp: missing destination file operand
102
+ `,exitCode:1};let l=a.pop()??"",c=a,u=t.fs.resolvePath(t.cwd,l),f="",d="",p=0,h=new Pt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"cp"}),m=!1;try{m=(await t.fs.stat(u)).isDirectory}catch{}if(c.length>1&&!m)return{stdout:"",stderr:`cp: target '${l}' is not a directory
103
+ `,exitCode:1};for(let g of c)try{let b=t.fs.resolvePath(t.cwd,g),w=await t.fs.stat(b),y=u;if(m){let S=g.split("/").pop()||g;y=u==="/"?`/${S}`:`${u}/${S}`}if(w.isDirectory&&!r){d+=`cp: -r not specified; omitting directory '${g}'
104
+ `,p=1;continue}if(w.isDirectory){let S=await da(t.fs,b,y,h);if(Mn(b,y)||S==="inside"){d+=`cp: cannot copy '${g}' into itself, '${y}'
105
+ `,p=1;continue}if(S==="unknown"){d+=`cp: cannot safely determine whether '${y}' is inside '${g}'
106
+ `,p=1;continue}}if(s)try{await t.fs.stat(y);continue}catch{}let x=await fa(t.fs,b,y);if(x==="same"){d+=`cp: '${g}' and '${y}' are the same file
107
+ `,p=1;continue}if(x==="unknown"){d+=`cp: cannot safely determine whether '${g}' and '${y}' are the same file
108
+ `,p=1;continue}w.isDirectory&&await wr({fs:t.fs,root:b,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"cp",symlinks:"never",budget:h},()=>{}),await t.fs.cp(b,y,{recursive:r}),o&&(f+=`'${g}' -> '${y}'
109
+ `)}catch(b){if(b instanceof C||b instanceof Ge)throw b;let w=mt(b);w.includes("ENOENT")||w.includes("no such file")?d+=`cp: cannot stat '${g}': No such file or directory
110
+ `:d+=`cp: cannot copy '${g}': ${w}
111
+ `,p=1}return{stdout:f,stderr:d,exitCode:p}}},sb={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var Gh={};ae(Gh,{flagsForFuzzing:()=>lb,mvCommand:()=>ab});var ib,ob,ab,lb,qh=M(()=>{"use strict";ai();Bn();Z();kn();It();de();ib={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},ob={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},ab={name:"mv",async execute(e,t){if(q(e))return G(ib);let n=Le("mv",e,ob);if(!n.ok)return n.error;let r=n.result.flags.force,s=n.result.flags.noClobber,i=n.result.flags.verbose,o=n.result.positional;if(s&&(r=!1),o.length<2)return{stdout:"",stderr:`mv: missing destination file operand
112
+ `,exitCode:1};let a=o.pop()??"",l=o,c=t.fs.resolvePath(t.cwd,a),u="",f="",d=0,p=new Pt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"mv"}),h=!1;try{h=(await t.fs.stat(c)).isDirectory}catch{}if(l.length>1&&!h)return{stdout:"",stderr:`mv: target '${a}' is not a directory
113
+ `,exitCode:1};for(let m of l)try{let g=t.fs.resolvePath(t.cwd,m),b=await t.fs.stat(g),w=c;if(h){let x=m.split("/").pop()||m;w=c==="/"?`/${x}`:`${c}/${x}`}if(b.isDirectory){let x=await da(t.fs,g,w,p);if(Mn(g,w)||x==="inside"){f+=`mv: cannot move '${m}' into itself, '${w}'
114
+ `,d=1;continue}if(x==="unknown"){f+=`mv: cannot safely determine whether '${w}' is inside '${m}'
115
+ `,d=1;continue}}if(s)try{await t.fs.stat(w);continue}catch{}let y=await fa(t.fs,g,w);if(y==="same")continue;if(y==="unknown"){f+=`mv: cannot safely determine whether '${m}' and '${w}' are the same file
116
+ `,d=1;continue}if(b.isDirectory&&await wr({fs:t.fs,root:g,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"mv",symlinks:"never",budget:p},()=>{}),await t.fs.mv(g,w),i){let x=h?`${a}/${m.split("/").pop()||m}`:a;u+=`renamed '${m}' -> '${x}'
117
+ `}}catch(g){if(g instanceof C||g instanceof Ge)throw g;let b=mt(g);b.includes("ENOENT")||b.includes("no such file")?f+=`mv: cannot stat '${m}': No such file or directory
118
+ `:f+=`mv: cannot move '${m}': ${b}
119
+ `,d=1}return{stdout:u,stderr:f,exitCode:d}}},lb={name:"mv",flags:[{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var Zh={};ae(Zh,{flagsForFuzzing:()=>fb,lnCommand:()=>ub});var cb,ub,fb,Kh=M(()=>{"use strict";_n();de();cb={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},ub={name:"ln",async execute(e,t){if(q(e))return G(cb);let n=!1,r=!1,s=!1,i=0;for(;i<e.length&&e[i].startsWith("-");){let f=e[i];if(f==="-s"||f==="--symbolic")n=!0,i++;else if(f==="-f"||f==="--force")r=!0,i++;else if(f==="-v"||f==="--verbose")s=!0,i++;else if(f==="-n"||f==="--no-dereference")i++;else if(/^-[sfvn]+$/.test(f))f.includes("s")&&(n=!0),f.includes("f")&&(r=!0),f.includes("v")&&(s=!0),i++;else if(f==="--"){i++;break}else return re("ln",f)}let o=e.slice(i);if(o.length<2)return{stdout:"",stderr:`ln: missing file operand
120
+ `,exitCode:1};if(o.length>2)return{stdout:"",stderr:`ln: extra operand '${o[2]}'
121
+ `,exitCode:1};let a=o[0],l=o[1],c=t.fs.resolvePath(t.cwd,l);if(await t.fs.exists(c))if(r)try{await t.fs.rm(c,{force:!0})}catch{return{stdout:"",stderr:`ln: cannot remove '${l}': Permission denied
122
+ `,exitCode:1}}else return{stdout:"",stderr:`ln: failed to create ${n?"symbolic ":""}link '${l}': File exists
123
+ `,exitCode:1};try{if(n)await t.fs.symlink(a,c);else{let f=t.fs.resolvePath(t.cwd,a);if(!await t.fs.exists(f))return{stdout:"",stderr:`ln: failed to access '${a}': No such file or directory
124
+ `,exitCode:1};await t.fs.link(f,c)}}catch(f){let d=f;return d.message.includes("EPERM")?{stdout:"",stderr:n?`ln: failed to create symbolic link '${l}': Operation not permitted
125
+ `:`ln: '${a}': hard link not allowed for directory
126
+ `,exitCode:1}:{stdout:"",stderr:`ln: ${Ye(d.message)}
127
+ `,exitCode:1}}let u="";return s&&(u=`'${l}' -> '${a}'
128
+ `),{stdout:u,stderr:"",exitCode:0}}},fb={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var Qh={};ae(Qh,{chmodCommand:()=>pb,flagsForFuzzing:()=>mb});async function hb(e,t,n,r,s,i){let o=new Pt({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"chmod"});await wr({fs:e.fs,root:t,symlinks:"never",budget:o,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"chmod"},async a=>{if(a.depth===0||a.phase!=="enter")return;let l=n!==void 0?n:r!==void 0?Wc(r,a.stat.mode):420;await e.fs.chmod(a.path,l),s&&i.append(`mode of '${a.path}' changed to ${l.toString(8).padStart(4,"0")}
129
+ `)})}function Wc(e,t=420){if(/^[0-7]+$/.test(e))return parseInt(e,8);let n=t&4095,r=e.split(",");for(let s of r){let i=s.match(/^([ugoa]*)([+\-=])([rwxXst]*)$/);if(!i)throw new Error(`Invalid mode: ${e}`);let o=i[1]||"a",a=i[2],l=i[3];(o==="a"||o==="")&&(o="ugo");let c=0;l.includes("r")&&(c|=4),l.includes("w")&&(c|=2),(l.includes("x")||l.includes("X"))&&(c|=1);let u=0;l.includes("s")&&(o.includes("u")&&(u|=2048),o.includes("g")&&(u|=1024)),l.includes("t")&&(u|=512);for(let f of o){let d=0;f==="u"?d=6:f==="g"?d=3:f==="o"&&(d=0);let p=c<<d;a==="+"?n|=p:a==="-"?n&=~p:a==="="&&(n&=~(7<<d),f==="u"&&(n&=-2049),f==="g"&&(n&=-1025),f==="o"&&(n&=-513),n|=p)}a==="+"?n|=u:a==="-"?n&=~u:a==="="&&(l.includes("s")&&(o.includes("u")&&(n|=u&2048),o.includes("g")&&(n|=u&1024)),l.includes("t")&&(n|=u&512))}return n}var db,pb,mb,Xh=M(()=>{"use strict";At();Nt();Bn();de();db={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},pb={name:"chmod",async execute(e,t){if(q(e))return G(db);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
130
+ `,exitCode:1};let n=!1,r=!1,s=0;for(;s<e.length&&e[s].startsWith("-");){let d=e[s];if(d==="-R"||d==="--recursive")n=!0,s++;else if(d==="-v"||d==="--verbose")r=!0,s++;else if(d==="--"){s++;break}else{if(/^[+-]?[rwxugo]+/.test(d)||/^\d+$/.test(d))break;if(/^-[Rv]+$/.test(d)){d.includes("R")&&(n=!0),d.includes("v")&&(r=!0),s++;continue}return re("chmod",d)}}if(e.length-s<2)return{stdout:"",stderr:`chmod: missing operand
131
+ `,exitCode:1};let i=e[s],o=e.slice(s+1),a=/^[0-7]+$/.test(i),l;if(a)l=parseInt(i,8);else try{Wc(i,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${i}'
132
+ `,exitCode:1}}let c=new Te(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"chmod"),u="",f=!1;for(let d of o){let p=t.fs.resolvePath(t.cwd,d);try{let h;if(a&&l!==void 0)h=l;else{let m=await t.fs.stat(p);h=Wc(i,m.mode)}await t.fs.chmod(p,h),r&&c.append(`mode of '${d}' changed to ${h.toString(8).padStart(4,"0")}
133
+ `),n&&(await t.fs.stat(p)).isDirectory&&await hb(t,p,a?l:void 0,a?void 0:i,r,c)}catch(h){he(h),u+=`chmod: cannot access '${d}': No such file or directory
134
+ `,f=!0}}return{stdout:c.build(),stderr:u,exitCode:f?1:0}}};mb={name:"chmod",flags:[{flag:"-R",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var Yh={};ae(Yh,{flagsForFuzzing:()=>yb,pwdCommand:()=>gb});var gb,yb,Jh=M(()=>{"use strict";gb={name:"pwd",async execute(e,t){let n=!1;for(let s of e)if(s==="-P")n=!0;else if(s==="-L")n=!1;else{if(s==="--")break;s.startsWith("-")}let r=t.cwd;if(n)try{r=await t.fs.realpath(t.cwd)}catch{}return{stdout:`${r}
135
+ `,stderr:"",exitCode:0}}},yb={name:"pwd",flags:[{flag:"-P",type:"boolean"},{flag:"-L",type:"boolean"}]}});var e1={};ae(e1,{flagsForFuzzing:()=>xb,readlinkCommand:()=>bb});var wb,bb,xb,t1=M(()=>{"use strict";Bn();Z();de();wb={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},bb={name:"readlink",async execute(e,t){if(q(e))return G(wb);let n=!1,r=0;for(;r<e.length&&e[r].startsWith("-");){let l=e[r];if(l==="-f"||l==="--canonicalize")n=!0,r++;else if(l==="--"){r++;break}else return re("readlink",l)}let s=e.slice(r);if(s.length===0)return{stdout:"",stderr:`readlink: missing operand
136
+ `,exitCode:1};let i="",o=!1,a=new Pt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"readlink",label:"symlink traversal"});for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{if(n){let u=c,f=new Set;for(;a.visit(f.size),!f.has(u);){f.add(u);try{let d=await t.fs.readlink(u);if(d.startsWith("/"))u=d;else{let p=u.substring(0,u.lastIndexOf("/"))||"/";u=t.fs.resolvePath(p,d)}}catch{break}}i+=`${u}
137
+ `}else{let u=await t.fs.readlink(c);i+=`${u}
138
+ `}}catch(u){if(u instanceof C||u instanceof Ge)throw u;n?i+=`${c}
139
+ `:o=!0}}return{stdout:i,stderr:"",exitCode:o?1:0}}},xb={name:"readlink",flags:[{flag:"-f",type:"boolean"},{flag:"-e",type:"boolean"}],needsArgs:!0}});function pa(e,t){let n=10,r=null,s=!1,i=!1,o=!1,a=[];for(let l=0;l<e.length;l++){let c=e[l];if(c==="-n"&&l+1<e.length){let u=e[++l];t==="tail"&&u.startsWith("+")?(o=!0,n=parseInt(u.slice(1),10)):n=parseInt(u,10)}else if(t==="tail"&&c.startsWith("-n+"))o=!0,n=parseInt(c.slice(3),10);else if(c.startsWith("-n"))n=parseInt(c.slice(2),10);else if(c==="-c"&&l+1<e.length)r=parseInt(e[++l],10);else if(c.startsWith("-c"))r=parseInt(c.slice(2),10);else if(c.startsWith("--bytes="))r=parseInt(c.slice(8),10);else if(c.startsWith("--lines="))n=parseInt(c.slice(8),10);else if(c==="-q"||c==="--quiet"||c==="--silent")s=!0;else if(c==="-v"||c==="--verbose")i=!0;else if(c.match(/^-\d+$/))n=parseInt(c.slice(1),10);else{if(c.startsWith("--"))return{ok:!1,error:re(t,c)};if(c.startsWith("-")&&c!=="-")return{ok:!1,error:re(t,c)};a.push(c)}}return r!==null&&(Number.isNaN(r)||r<0)?{ok:!1,error:{stdout:"",stderr:`${t}: invalid number of bytes
140
+ `,exitCode:1}}:Number.isNaN(n)||n<0?{ok:!1,error:{stdout:"",stderr:`${t}: invalid number of lines
141
+ `,exitCode:1}}:{ok:!0,options:{lines:n,bytes:r,quiet:s,verbose:i,files:a,fromLine:o}}}async function ha(e,t,n,r){let{quiet:s,verbose:i,files:o}=t;if(o.length>e.limits.maxArrayElements)throw new C(`${n}: file operand limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(o.length===0)return{stdout:r(e.stdin),stderr:"",exitCode:0,stdoutEncoding:"binary"};let a=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),l=new Te(a,n),c=new Te(a,n),u=0,f=0,d=i||!s&&o.length>1,p=0;for(let h=0;h<o.length;h++){let m=o[h];try{let g=e.fs.resolvePath(e.cwd,m);if((await e.fs.stat(g)).size>e.limits.maxInputBytes-f)throw new C(`${n}: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");let w=await jt(e.fs,g);if(w.length>e.limits.maxInputBytes-f)throw new C(`${n}: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");f+=w.length,e.executionScope?.consumeInput(w.length,n),d&&(p>0&&l.append(`
142
+ `),l.append(Ln(`==> ${m} <==
143
+ `))),l.append(r(w)),p++}catch(g){he(g),c.append(`${n}: ${m}: No such file or directory
144
+ `),u=1}}return{stdout:l.build(),stderr:c.build(),exitCode:u,stdoutEncoding:"binary"}}function n1(e,t,n){if(n!==null)return e.slice(0,n);if(t===0)return"";let r=0,s=0,i=e.length;for(;r<i&&s<t;){let o=e.indexOf(`
145
+ `,r);if(o===-1)return e;s++,r=o+1}return r>0?e.slice(0,r):""}function r1(e,t,n,r){if(n!==null)return n===0?"":e.slice(-n);let s=e.length;if(s===0)return"";if(r){let a=0,l=1;for(;a<s&&l<t;){let c=e.indexOf(`
146
+ `,a);if(c===-1)return"";l++,a=c+1}return e.slice(a)}if(t===0)return"";let i=s-1;e[i]===`
147
+ `&&i--;let o=0;for(;i>=0&&o<t;){if(e[i]===`
148
+ `&&(o++,o===t)){i++;break}i--}return i<0&&(i=0),e.slice(i)}var jc=M(()=>{"use strict";At();ce();Nt();Z();de()});var s1={};ae(s1,{flagsForFuzzing:()=>Ab,headCommand:()=>Sb});var Eb,Sb,Ab,i1=M(()=>{"use strict";de();jc();Eb={name:"head",summary:"output the first part of files",usage:"head [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the first NUM bytes","-n, --lines=NUM print the first NUM lines (default 10)","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},Sb={name:"head",async execute(e,t){if(q(e))return G(Eb);let n=pa(e,"head");if(!n.ok)return n.error;let{lines:r,bytes:s}=n.options;return ha(t,n.options,"head",i=>n1(i,r,s))}},Ab={name:"head",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0}});var o1={};ae(o1,{flagsForFuzzing:()=>kb,tailCommand:()=>vb});var Cb,vb,kb,a1=M(()=>{"use strict";jc();de();Cb={name:"tail",summary:"output the last part of files",usage:"tail [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the last NUM bytes","-n, --lines=NUM print the last NUM lines (default 10)","-n +NUM print starting from line NUM","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},vb={name:"tail",async execute(e,t){if(q(e))return G(Cb);let n=pa(e,"tail");if(!n.ok)return n.error;let{lines:r,bytes:s,fromLine:i}=n.options;return ha(t,n.options,"tail",o=>r1(o,r,s,i??!1))}},kb={name:"tail",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0}});var c1={};ae(c1,{flagsForFuzzing:()=>Tb,wcCommand:()=>Ob});function l1(e,t){let n=e,r=n.length,s=t?Array.from(ue(e)).length:r,i=0,o=0,a=!1;for(let l=0;l<r;l++){let c=n[l];c===`
149
+ `?(i++,a&&(o++,a=!1)):c===" "||c===" "||c==="\r"?a&&(o++,a=!1):a=!0}return a&&o++,{lines:i,words:o,third:s}}function Hc(e,t,n,r,s,i){let o=[];t&&o.push(String(e.lines).padStart(i)),n&&o.push(String(e.words).padStart(i)),r&&o.push(String(e.third).padStart(i));let a=o.join(" ");return s&&(a+=` ${s}`),a}var Nb,Ib,Ob,Tb,u1=M(()=>{"use strict";ce();It();Gr();de();Nb={name:"wc",summary:"print newline, word, and byte counts for each file",usage:"wc [OPTION]... [FILE]...",options:["-c, --bytes print the byte counts","-m, --chars print the character counts","-l, --lines print the newline counts","-w, --words print the word counts"," --help display this help and exit"]},Ib={lines:{short:"l",long:"lines",type:"boolean"},words:{short:"w",long:"words",type:"boolean"},bytes:{short:"c",long:"bytes",type:"boolean"},chars:{short:"m",long:"chars",type:"boolean"}},Ob={name:"wc",async execute(e,t){if(q(e))return G(Nb);let n=Le("wc",e,Ib);if(!n.ok)return n.error;let{lines:r,words:s}=n.result.flags,i=n.result.flags.bytes,o=n.result.flags.chars,a=n.result.positional;!r&&!s&&!i&&!o&&(r=s=i=!0);let l=i||o,c=await ri(t,a,{cmdName:"wc",stopOnError:!1});if(a.length===0){let y=l1(c.files[0].content,o);return{stdout:`${Hc(y,r,s,l,"",0)}
150
+ `,stderr:"",exitCode:0}}let u=[],f=0,d=0,p=0;for(let{filename:y,content:x}of c.files){let S=l1(x,o);f+=S.lines,d+=S.words,p+=S.third,u.push({filename:y,stats:S})}let h=a.length>1?f:Math.max(...u.map(y=>y.stats.lines)),m=a.length>1?d:Math.max(...u.map(y=>y.stats.words)),g=a.length>1?p:Math.max(...u.map(y=>y.stats.third)),b=a.length>1?3:0;r&&(b=Math.max(b,String(h).length)),s&&(b=Math.max(b,String(m).length)),l&&(b=Math.max(b,String(g).length));let w="";for(let{filename:y,stats:x}of u)w+=`${Hc(x,r,s,l,y,b)}
151
+ `;return a.length>1&&(w+=`${Hc({lines:f,words:d,third:p},r,s,l,"total",b)}
152
+ `),{stdout:w,stderr:c.stderr,exitCode:c.exitCode}}};Tb={name:"wc",flags:[{flag:"-l",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-m",type:"boolean"}],stdinType:"text",needsFiles:!0}});function eo(e,t){let n=t?"d":"-",r=[e&256?"r":"-",e&128?"w":"-",e&64?"x":"-",e&32?"r":"-",e&16?"w":"-",e&8?"x":"-",e&4?"r":"-",e&2?"w":"-",e&1?"x":"-"];return n+r.join("")}var Vc=M(()=>{"use strict"});var f1={};ae(f1,{flagsForFuzzing:()=>Db,statCommand:()=>Pb});var Rb,$b,Pb,Db,d1=M(()=>{"use strict";ce();Nt();Z();It();Vc();de();Rb={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},$b={format:{short:"c",type:"string"}},Pb={name:"stat",async execute(e,t){if(q(e))return G(Rb);let n=Le("stat",e,$b);if(!n.ok)return n.error;let r=n.result.flags.format??null,s=n.result.positional;if(s.length===0)return{stdout:"",stderr:`stat: missing operand
153
+ `,exitCode:1};let i="",o="",a=!1,l=0,c=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),u=f=>{let d=U(f);if(d>c-l)throw new C(`stat: output size limit exceeded (${c} bytes)`,"output_size");i+=f,l+=d};for(let f of s){let d=t.fs.resolvePath(t.cwd,f);try{let p=await t.fs.stat(d);if(r){let h=p.mode.toString(8),m=eo(p.mode,p.isDirectory),g=new Map([["%n",f],["%N",`'${f}'`],["%s",String(p.size)],["%F",p.isDirectory?"directory":"regular file"],["%a",h],["%A",m],["%u","1000"],["%U","user"],["%g","1000"],["%G","group"]]),b=r.replace(/%[nNsFaAuUgG]/g,w=>g.get(w)??w);u(`${b}
154
+ `)}else{let h=p.mode.toString(8).padStart(4,"0"),m=eo(p.mode,p.isDirectory);u(` File: ${f}
155
+ Size: ${p.size} Blocks: ${Math.ceil(p.size/512)}
156
+ Access: (${h}/${m})
157
+ Modify: ${p.mtime.toISOString()}
158
+ `)}}catch(p){he(p),o+=`stat: cannot stat '${f}': No such file or directory
159
+ `,a=!0}}return{stdout:i,stderr:o,exitCode:a?1:0}}},Db={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var te,j,P,Un,Ce,We,$1,Zr,ma,Gc,ci,xr,qc,Zc,gt,ui,it,Kc,rr,Qc,Xc,ke,Yc,ga,to,Lb,Fb,Jc,eu,H,tu,li,nu,ru,ze,p1,h1,m1,g1,y1,w1,b1,x1,E1,S1,A1,C1,v1,k1,N1,I1,O1,T1,R1,br,no,su,iu,ou,au,lu,Kr,P1=M(()=>{te=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},j=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[`
160
+ `,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]);static toUpperCase(t){let n=String.fromCodePoint(t).toUpperCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toLowerCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}static toLowerCase(t){let n=String.fromCodePoint(t).toLowerCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toUpperCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}},P=class{SIZE=3;constructor(t){this.data=t}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.data[t*this.SIZE+2]}get(t){let n=t*this.SIZE;return[this.data[n],this.data[n+1],this.data[n+2]]}get length(){return this.data.length/this.SIZE}},Un=class e{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=new P(new Uint32Array([0,31,1,127,159,1,173,888,715,889,896,7,897,899,1,907,909,2,930,1328,398,1367,1368,1,1419,1420,1,1424,1480,56,1481,1487,1,1515,1518,1,1525,1541,1,1564,1757,193,1806,1807,1,1867,1868,1,1970,1983,1,2043,2044,1,2094,2095,1,2111,2140,29,2141,2143,2,2155,2159,1,2191,2198,1,2274,2436,162,2445,2446,1,2449,2450,1,2473,2481,8,2483,2485,1,2490,2491,1,2501,2502,1,2505,2506,1,2511,2518,1,2520,2523,1,2526,2532,6,2533,2559,26,2560,2564,4,2571,2574,1,2577,2578,1,2601,2609,8,2612,2618,3,2619,2621,2,2627,2630,1,2633,2634,1,2638,2640,1,2642,2648,1,2653,2655,2,2656,2661,1,2679,2688,1,2692,2702,10,2706,2729,23,2737,2740,3,2746,2747,1,2758,2766,4,2767,2769,2,2770,2783,1,2788,2789,1,2802,2808,1,2816,2820,4,2829,2830,1,2833,2834,1,2857,2865,8,2868,2874,6,2875,2885,10,2886,2889,3,2890,2894,4,2895,2900,1,2904,2907,1,2910,2916,6,2917,2936,19,2937,2945,1,2948,2955,7,2956,2957,1,2961,2966,5,2967,2968,1,2971,2973,2,2976,2978,1,2981,2983,1,2987,2989,1,3002,3005,1,3011,3013,1,3017,3022,5,3023,3025,2,3026,3030,1,3032,3045,1,3067,3071,1,3085,3089,4,3113,3130,17,3131,3141,10,3145,3150,5,3151,3156,1,3159,3163,4,3164,3166,2,3167,3172,5,3173,3184,11,3185,3190,1,3213,3217,4,3241,3252,11,3258,3259,1,3269,3273,4,3278,3284,1,3287,3292,1,3295,3300,5,3301,3312,11,3316,3327,1,3341,3345,4,3397,3401,4,3408,3411,1,3428,3429,1,3456,3460,4,3479,3481,1,3506,3516,10,3518,3519,1,3527,3529,1,3531,3534,1,3541,3543,2,3552,3557,1,3568,3569,1,3573,3584,1,3643,3646,1,3676,3712,1,3715,3717,2,3723,3748,25,3750,3774,24,3775,3781,6,3783,3791,8,3802,3803,1,3808,3839,1,3912,3949,37,3950,3952,1,3992,4029,37,4045,4059,14,4060,4095,1,4294,4296,2,4297,4300,1,4302,4303,1,4681,4686,5,4687,4695,8,4697,4702,5,4703,4745,42,4750,4751,1,4785,4790,5,4791,4799,8,4801,4806,5,4807,4823,16,4881,4886,5,4887,4955,68,4956,4989,33,4990,4991,1,5018,5023,1,5110,5111,1,5118,5119,1,5789,5791,1,5881,5887,1,5910,5918,1,5943,5951,1,5972,5983,1,5997,6001,4,6004,6015,1,6110,6111,1,6122,6127,1,6138,6143,1,6158,6170,12,6171,6175,1,6265,6271,1,6315,6319,1,6390,6399,1,6431,6444,13,6445,6447,1,6460,6463,1,6465,6467,1,6510,6511,1,6517,6527,1,6572,6575,1,6602,6607,1,6619,6621,1,6684,6685,1,6751,6781,30,6782,6794,12,6795,6799,1,6810,6815,1,6830,6831,1,6863,6911,1,6989,7156,167,7157,7163,1,7224,7226,1,7242,7244,1,7307,7311,1,7355,7356,1,7368,7375,1,7419,7423,1,7958,7959,1,7966,7967,1,8006,8007,1,8014,8015,1,8024,8030,2,8062,8063,1,8117,8133,16,8148,8149,1,8156,8176,20,8177,8181,4,8191,8203,12,8204,8207,1,8234,8238,1,8288,8303,1,8306,8307,1,8335,8349,14,8350,8351,1,8385,8399,1,8433,8447,1,8588,8591,1,9258,9279,1,9291,9311,1,11124,11125,1,11158,11508,350,11509,11512,1,11558,11560,2,11561,11564,1,11566,11567,1,11624,11630,1,11633,11646,1,11671,11679,1,11687,11743,8,11870,11903,1,11930,12020,90,12021,12031,1,12246,12271,1,12352,12439,87,12440,12544,104,12545,12548,1,12592,12687,95,12774,12782,1,12831,42125,29294,42126,42127,1,42183,42191,1,42540,42559,1,42744,42751,1,42958,42959,1,42962,42964,2,42973,42993,1,43053,43055,1,43066,43071,1,43128,43135,1,43206,43213,1,43226,43231,1,43348,43358,1,43389,43391,1,43470,43482,12,43483,43485,1,43519,43575,56,43576,43583,1,43598,43599,1,43610,43611,1,43715,43738,1,43767,43776,1,43783,43784,1,43791,43792,1,43799,43807,1,43815,43823,8,43884,43887,1,44014,44015,1,44026,44031,1,55204,55215,1,55239,55242,1,55292,63743,1,64110,64111,1,64218,64255,1,64263,64274,1,64280,64284,1,64311,64317,6,64319,64325,3,64451,64466,1,64912,64913,1,64968,64974,1,64976,65007,1,65050,65055,1,65107,65127,20,65132,65135,1,65141,65277,136,65278,65280,1,65471,65473,1,65480,65481,1,65488,65489,1,65496,65497,1,65501,65503,1,65511,65519,8,65520,65531,1,65534,65535,1,65548,65575,27,65595,65598,3,65614,65615,1,65630,65663,1,65787,65791,1,65795,65798,1,65844,65846,1,65935,65949,14,65950,65951,1,65953,65999,1,66046,66175,1,66205,66207,1,66257,66271,1,66300,66303,1,66340,66348,1,66379,66383,1,66427,66431,1,66462,66500,38,66501,66503,1,66518,66559,1,66718,66719,1,66730,66735,1,66772,66775,1,66812,66815,1,66856,66863,1,66916,66926,1,66939,66955,16,66963,66966,3,66978,66994,16,67002,67005,3,67006,67007,1,67060,67071,1,67383,67391,1,67414,67423,1,67432,67455,1,67462,67505,43,67515,67583,1,67590,67591,1,67593,67638,45,67641,67643,1,67645,67646,1,67670,67743,73,67744,67750,1,67760,67807,1,67827,67830,3,67831,67834,1,67868,67870,1,67898,67902,1,67904,67967,1,68024,68027,1,68048,68049,1,68100,68103,3,68104,68107,1,68116,68120,4,68150,68151,1,68155,68158,1,68169,68175,1,68185,68191,1,68256,68287,1,68327,68330,1,68343,68351,1,68406,68408,1,68438,68439,1,68467,68471,1,68498,68504,1,68509,68520,1,68528,68607,1,68681,68735,1,68787,68799,1,68851,68857,1,68904,68911,1,68922,68927,1,68966,68968,1,68998,69005,1,69008,69215,1,69247,69290,43,69294,69295,1,69298,69313,1,69317,69371,1,69416,69423,1,69466,69487,1,69514,69551,1,69580,69599,1,69623,69631,1,69710,69713,1,69750,69758,1,69821,69827,6,69828,69839,1,69865,69871,1,69882,69887,1,69941,69960,19,69961,69967,1,70007,70015,1,70112,70133,21,70134,70143,1,70162,70210,48,70211,70271,1,70279,70281,2,70286,70302,16,70314,70319,1,70379,70383,1,70394,70399,1,70404,70413,9,70414,70417,3,70418,70441,23,70449,70452,3,70458,70469,11,70470,70473,3,70474,70478,4,70479,70481,2,70482,70486,1,70488,70492,1,70500,70501,1,70509,70511,1,70517,70527,1,70538,70540,2,70541,70543,2,70582,70593,11,70595,70596,1,70598,70603,5,70614,70617,3,70618,70624,1,70627,70655,1,70748,70754,6,70755,70783,1,70856,70863,1,70874,71039,1,71094,71095,1,71134,71167,1,71237,71247,1,71258,71263,1,71277,71295,1,71354,71359,1,71370,71375,1,71396,71423,1,71451,71452,1,71468,71471,1,71495,71679,1,71740,71839,1,71923,71934,1,71943,71944,1,71946,71947,1,71956,71959,3,71990,71993,3,71994,72007,13,72008,72015,1,72026,72095,1,72104,72105,1,72152,72153,1,72165,72191,1,72264,72271,1,72355,72367,1,72441,72447,1,72458,72639,1,72674,72687,1,72698,72703,1,72713,72759,46,72774,72783,1,72813,72815,1,72848,72849,1,72872,72887,15,72888,72959,1,72967,72970,3,73015,73017,1,73019,73022,3,73032,73039,1,73050,73055,1,73062,73065,3,73103,73106,3,73113,73119,1,73130,73439,1,73465,73471,1,73489,73531,42,73532,73533,1,73563,73647,1,73649,73663,1,73714,73726,1,74650,74751,1,74863,74869,6,74870,74879,1,75076,77711,1,77811,77823,1,78896,78911,1,78934,78943,1,82939,82943,1,83527,90367,1,90426,92159,1,92729,92735,1,92767,92778,11,92779,92781,1,92863,92874,11,92875,92879,1,92910,92911,1,92918,92927,1,92998,93007,1,93018,93026,8,93048,93052,1,93072,93503,1,93562,93759,1,93851,93951,1,94027,94030,1,94088,94094,1,94112,94175,1,94181,94191,1,94194,94207,1,100344,100351,1,101590,101630,1,101641,110575,1,110580,110588,8,110591,110883,292,110884,110897,1,110899,110927,1,110931,110932,1,110934,110947,1,110952,110959,1,111356,113663,1,113771,113775,1,113789,113791,1,113801,113807,1,113818,113819,1,113824,117759,1,118010,118015,1,118452,118527,1,118574,118575,1,118599,118607,1,118724,118783,1,119030,119039,1,119079,119080,1,119155,119162,1,119275,119295,1,119366,119487,1,119508,119519,1,119540,119551,1,119639,119647,1,119673,119807,1,119893,119965,72,119968,119969,1,119971,119972,1,119975,119976,1,119981,119994,13,119996,120004,8,120070,120075,5,120076,120085,9,120093,120122,29,120127,120133,6,120135,120137,1,120145,120486,341,120487,120780,293,120781,121484,703,121485,121498,1,121504,121520,16,121521,122623,1,122655,122660,1,122667,122879,1,122887,122905,18,122906,122914,8,122917,122923,6,122924,122927,1,122990,123022,1,123024,123135,1,123181,123183,1,123198,123199,1,123210,123213,1,123216,123535,1,123567,123583,1,123642,123646,1,123648,124111,1,124154,124367,1,124411,124414,1,124416,124895,1,124903,124908,5,124911,124927,16,125125,125126,1,125143,125183,1,125260,125263,1,125274,125277,1,125280,126064,1,126133,126208,1,126270,126463,1,126468,126496,28,126499,126501,2,126502,126504,2,126515,126520,5,126522,126524,2,126525,126529,1,126531,126534,1,126536,126540,2,126544,126547,3,126549,126550,1,126552,126560,2,126563,126565,2,126566,126571,5,126579,126589,5,126591,126602,11,126620,126624,1,126628,126634,6,126652,126703,1,126706,126975,1,127020,127023,1,127124,127135,1,127151,127152,1,127168,127184,16,127222,127231,1,127406,127461,1,127491,127503,1,127548,127551,1,127561,127567,1,127570,127583,1,127590,127743,1,128728,128731,1,128749,128751,1,128765,128767,1,128887,128890,1,128986,128991,1,129004,129007,1,129009,129023,1,129036,129039,1,129096,129103,1,129114,129119,1,129160,129167,1,129198,129199,1,129212,129215,1,129218,129279,1,129620,129631,1,129646,129647,1,129661,129663,1,129674,129678,1,129735,129741,1,129757,129758,1,129770,129775,1,129785,129791,1,129939,130042,103,130043,131071,1,173792,173823,1,177978,177983,1,178206,178207,1,183970,183983,1,191457,191471,1,192094,194559,1,195102,196607,1,201547,201551,1,205744,917759,1,918e3,1114111,1]));static Cc=new P(new Uint32Array([0,31,1,127,159,1]));static Cf=new P(new Uint32Array([173,1536,1363,1537,1541,1,1564,1757,193,1807,2192,385,2193,2274,81,6158,8203,2045,8204,8207,1,8234,8238,1,8288,8292,1,8294,8303,1,65279,65529,250,65530,65531,1,69821,69837,16,78896,78911,1,113824,113827,1,119155,119162,1,917505,917536,31,917537,917631,1]));static Co=new P(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new P(new Uint32Array([55296,57343,1]));static L=new P(new Uint32Array([65,90,1,97,122,1,170,181,11,186,192,6,193,214,1,216,246,1,248,705,1,710,721,1,736,740,1,748,750,2,880,884,1,886,887,1,890,893,1,895,902,7,904,906,1,908,910,2,911,929,1,931,1013,1,1015,1153,1,1162,1327,1,1329,1366,1,1369,1376,7,1377,1416,1,1488,1514,1,1519,1522,1,1568,1610,1,1646,1647,1,1649,1747,1,1749,1765,16,1766,1774,8,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2036,2037,1,2042,2048,6,2049,2069,1,2074,2084,10,2088,2112,24,2113,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2249,1,2308,2361,1,2365,2384,19,2392,2401,1,2417,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3654,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3782,3804,22,3805,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4256,18,4257,4293,1,4295,4301,6,4304,4346,1,4348,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5024,5109,1,5112,5117,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6103,6108,5,6176,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6823,6917,94,6918,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7293,1,7296,7306,1,7312,7354,1,7357,7359,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,7424,6,7425,7615,1,7680,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8124,1,8126,8130,4,8131,8132,1,8134,8140,1,8144,8147,1,8150,8155,1,8160,8172,1,8178,8180,1,8182,8188,1,8305,8319,14,8336,8348,1,8450,8455,5,8458,8467,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8495,8505,1,8508,8511,1,8517,8521,1,8526,8579,53,8580,11264,2684,11265,11492,1,11499,11502,1,11506,11507,1,11520,11557,1,11559,11565,6,11568,11623,1,11631,11648,17,11649,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11823,12293,470,12294,12337,43,12338,12341,1,12347,12348,1,12353,12438,1,12445,12447,1,12449,12538,1,12540,12543,1,12549,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,42124,1,42192,42237,1,42240,42508,1,42512,42527,1,42538,42539,1,42560,42606,1,42623,42653,1,42656,42725,1,42775,42783,1,42786,42888,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43471,43488,17,43489,43492,1,43494,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43741,1,43744,43754,1,43762,43764,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43866,1,43868,43881,1,43888,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65313,65338,1,65345,65370,1,65382,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66560,66717,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68736,68786,1,68800,68850,1,68864,68899,1,68938,68965,1,68975,68997,1,69248,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71840,71903,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,92992,92995,1,93027,93047,1,93053,93071,1,93504,93548,1,93760,93823,1,93952,94026,1,94032,94099,67,94100,94111,1,94176,94177,1,94179,94208,29,94209,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120512,1,120514,120538,1,120540,120570,1,120572,120596,1,120598,120628,1,120630,120654,1,120656,120686,1,120688,120712,1,120714,120744,1,120746,120770,1,120772,120779,1,122624,122654,1,122661,122666,1,122928,122989,1,123136,123180,1,123191,123197,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124139,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125184,125251,1,125259,126464,1205,126465,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static foldL=new P(new Uint32Array([837,837,1]));static Ll=new P(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,311,2,312,328,2,329,375,2,378,382,2,383,384,1,387,389,2,392,396,4,397,402,5,405,409,4,410,411,1,414,417,3,419,421,2,424,426,2,427,429,2,432,436,4,438,441,3,442,445,3,446,447,1,454,460,3,462,476,2,477,495,2,496,499,3,501,505,4,507,563,2,564,569,1,572,575,3,576,578,2,583,591,2,592,659,1,661,687,1,881,883,2,887,891,4,892,893,1,912,940,28,941,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1020,1072,52,1073,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1376,1416,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7424,118,7425,7467,1,7531,7543,1,7545,7578,1,7681,7829,2,7830,7837,1,7839,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8016,8023,1,8032,8039,1,8048,8061,1,8064,8071,1,8080,8087,1,8096,8103,1,8112,8116,1,8118,8119,1,8126,8130,4,8131,8132,1,8134,8135,1,8144,8147,1,8150,8151,1,8160,8167,1,8178,8180,1,8182,8183,1,8458,8462,4,8463,8467,4,8495,8505,5,8508,8509,1,8518,8521,1,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11377,11379,2,11380,11382,2,11383,11387,1,11393,11491,2,11492,11500,8,11502,11507,5,11520,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42800,42801,1,42803,42865,2,42866,42872,1,42874,42876,2,42879,42887,2,42892,42894,2,42897,42899,2,42900,42901,1,42903,42921,2,42927,42933,6,42935,42947,2,42952,42954,2,42957,42961,4,42963,42971,2,42998,43002,4,43824,43866,1,43872,43880,1,43888,43967,1,64256,64262,1,64275,64279,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,119834,119859,1,119886,119892,1,119894,119911,1,119938,119963,1,119990,119993,1,119995,119997,2,119998,120003,1,120005,120015,1,120042,120067,1,120094,120119,1,120146,120171,1,120198,120223,1,120250,120275,1,120302,120327,1,120354,120379,1,120406,120431,1,120458,120485,1,120514,120538,1,120540,120545,1,120572,120596,1,120598,120603,1,120630,120654,1,120656,120661,1,120688,120712,1,120714,120719,1,120746,120770,1,120772,120777,1,120779,122624,1845,122625,122633,1,122635,122654,1,122661,122666,1,125218,125251,1]));static foldLl=new P(new Uint32Array([65,90,1,192,214,1,216,222,1,256,302,2,306,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,453,1,455,456,1,458,459,1,461,475,2,478,494,2,497,498,1,500,502,2,503,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,837,880,43,882,886,4,895,902,7,904,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,984,9,986,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8072,8079,1,8088,8095,1,8104,8111,1,8120,8124,1,8136,8140,1,8152,8155,1,8168,8172,1,8184,8188,1,8486,8490,4,8491,8498,7,8579,11264,2685,11265,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,125184,125217,1]));static Lm=new P(new Uint32Array([688,705,1,710,721,1,736,740,1,748,750,2,884,890,6,1369,1600,231,1765,1766,1,2036,2037,1,2042,2074,32,2084,2088,4,2249,2417,168,3654,3782,128,4348,6103,1755,6211,6823,612,7288,7293,1,7468,7530,1,7544,7579,35,7580,7615,1,8305,8319,14,8336,8348,1,11388,11389,1,11631,11823,192,12293,12337,44,12338,12341,1,12347,12445,98,12446,12540,94,12541,12542,1,40981,42232,1251,42233,42237,1,42508,42623,115,42652,42653,1,42775,42783,1,42864,42888,24,42994,42996,1,43e3,43001,1,43471,43494,23,43632,43741,109,43763,43764,1,43868,43871,1,43881,65392,21511,65438,65439,1,67456,67461,1,67463,67504,1,67506,67514,1,68942,68975,33,92992,92995,1,93504,93506,1,93547,93548,1,94099,94111,1,94176,94177,1,94179,110576,16397,110577,110579,1,110581,110587,1,110589,110590,1,122928,122989,1,123191,123197,1,124139,125259,1120]));static Lo=new P(new Uint32Array([170,186,16,443,448,5,449,451,1,660,1488,828,1489,1514,1,1519,1522,1,1568,1599,1,1601,1610,1,1646,1647,1,1649,1747,1,1749,1774,25,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2048,2069,1,2112,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2248,1,2308,2361,1,2365,2384,19,2392,2401,1,2418,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3653,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3804,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4352,114,4353,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6108,6176,68,6177,6210,1,6212,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6917,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7287,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,8501,1083,8502,8504,1,11568,11623,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,12294,12348,54,12353,12438,1,12447,12449,2,12450,12538,1,12543,12549,6,12550,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,40980,1,40982,42124,1,42192,42231,1,42240,42507,1,42512,42527,1,42538,42539,1,42606,42656,50,42657,42725,1,42895,42999,104,43003,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43488,43492,1,43495,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43631,1,43633,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43740,1,43744,43754,1,43762,43777,15,43778,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43968,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65382,65391,1,65393,65437,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66640,66717,1,66816,66855,1,66864,66915,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68864,68899,1,68938,68941,1,68943,69248,305,69249,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,93027,93047,1,93053,93071,1,93507,93546,1,93952,94026,1,94032,94208,176,94209,100343,1,100352,101589,1,101631,101640,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,122634,123136,502,123137,123180,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124138,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Lt=new P(new Uint32Array([453,459,3,498,8072,7574,8073,8079,1,8088,8095,1,8104,8111,1,8124,8140,16,8188,8188,1]));static foldLt=new P(new Uint32Array([452,454,2,455,457,2,458,460,2,497,499,2,8064,8071,1,8080,8087,1,8096,8103,1,8115,8131,16,8179,8179,1]));static Lu=new P(new Uint32Array([65,90,1,192,214,1,216,222,1,256,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,461,3,463,475,2,478,494,2,497,500,3,502,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,880,882,2,886,895,9,902,904,2,905,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,978,3,979,980,1,984,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8120,8123,1,8136,8139,1,8152,8155,1,8168,8172,1,8184,8187,1,8450,8455,5,8459,8461,1,8464,8466,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8496,8499,1,8510,8511,1,8517,8579,62,11264,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,119808,119833,1,119860,119885,1,119912,119937,1,119964,119966,2,119967,119973,3,119974,119977,3,119978,119980,1,119982,119989,1,120016,120041,1,120068,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120120,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120172,120197,1,120224,120249,1,120276,120301,1,120328,120353,1,120380,120405,1,120432,120457,1,120488,120512,1,120546,120570,1,120604,120628,1,120662,120686,1,120720,120744,1,120778,125184,4406,125185,125217,1]));static Upper=this.Lu;static foldLu=new P(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,303,2,307,311,2,314,328,2,331,375,2,378,382,2,383,384,1,387,389,2,392,396,4,402,405,3,409,411,1,414,417,3,419,421,2,424,429,5,432,436,4,438,441,3,445,447,2,453,454,1,456,457,1,459,460,1,462,476,2,477,495,2,498,499,1,501,505,4,507,543,2,547,563,2,572,575,3,576,578,2,583,591,2,592,596,1,598,599,1,601,603,2,604,608,4,609,611,2,612,614,1,616,620,1,623,625,2,626,629,3,637,640,3,642,643,1,647,652,1,658,669,11,670,837,167,881,883,2,887,891,4,892,893,1,940,943,1,945,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1072,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1377,1414,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7545,239,7549,7566,17,7681,7829,2,7835,7841,6,7843,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8017,8023,2,8032,8039,1,8048,8061,1,8112,8113,1,8126,8144,18,8145,8160,15,8161,8165,4,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11379,11382,3,11393,11491,2,11500,11502,2,11507,11520,13,11521,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42803,42863,2,42874,42876,2,42879,42887,2,42892,42897,5,42899,42900,1,42903,42921,2,42933,42947,2,42952,42954,2,42957,42961,4,42967,42971,2,42998,43859,861,43888,43967,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,125218,125251,1]));static M=new P(new Uint32Array([768,879,1,1155,1161,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2307,1,2362,2364,1,2366,2383,1,2385,2391,1,2402,2403,1,2433,2435,1,2492,2494,2,2495,2500,1,2503,2504,1,2507,2509,1,2519,2530,11,2531,2558,27,2561,2563,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2672,31,2673,2677,4,2689,2691,1,2748,2750,2,2751,2757,1,2759,2761,1,2763,2765,1,2786,2787,1,2810,2815,1,2817,2819,1,2876,2878,2,2879,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2914,2915,1,2946,3006,60,3007,3010,1,3014,3016,1,3018,3021,1,3031,3072,41,3073,3076,1,3132,3134,2,3135,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3203,1,3260,3262,2,3263,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3298,3299,1,3315,3328,13,3329,3331,1,3387,3388,1,3390,3396,1,3398,3400,1,3402,3405,1,3415,3426,11,3427,3457,30,3458,3459,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3570,3571,1,3633,3636,3,3637,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3902,3903,1,3953,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4139,101,4140,4158,1,4182,4185,1,4190,4192,1,4194,4196,1,4199,4205,1,4209,4212,1,4226,4237,1,4239,4250,11,4251,4253,1,4957,4959,1,5906,5909,1,5938,5940,1,5970,5971,1,6002,6003,1,6068,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6443,1,6448,6459,1,6679,6683,1,6741,6750,1,6752,6780,1,6783,6832,49,6833,6862,1,6912,6916,1,6964,6980,1,7019,7027,1,7040,7042,1,7073,7085,1,7142,7155,1,7204,7223,1,7376,7378,1,7380,7400,1,7405,7412,7,7415,7417,1,7616,7679,1,8400,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12335,1,12441,12442,1,42607,42610,1,42612,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43043,24,43044,43047,1,43052,43136,84,43137,43188,51,43189,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43347,1,43392,43395,1,43443,43456,1,43493,43561,68,43562,43574,1,43587,43596,9,43597,43643,46,43644,43645,1,43696,43698,2,43699,43700,1,43703,43704,1,43710,43711,1,43713,43755,42,43756,43759,1,43765,43766,1,44003,44010,1,44012,44013,1,64286,65024,738,65025,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69632,69634,1,69688,69702,1,69744,69747,3,69748,69759,11,69760,69762,1,69808,69818,1,69826,69888,62,69889,69890,1,69927,69940,1,69957,69958,1,70003,70016,13,70017,70018,1,70067,70080,1,70089,70092,1,70094,70095,1,70188,70199,1,70206,70209,3,70367,70378,1,70400,70403,1,70459,70460,1,70462,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70502,3,70503,70508,1,70512,70516,1,70584,70592,1,70594,70597,3,70599,70602,1,70604,70608,1,70610,70625,15,70626,70709,83,70710,70726,1,70750,70832,82,70833,70851,1,71087,71093,1,71096,71104,1,71132,71133,1,71216,71232,1,71339,71351,1,71453,71467,1,71724,71738,1,71984,71989,1,71991,71992,1,71995,71998,1,72e3,72002,2,72003,72145,142,72146,72151,1,72154,72160,1,72164,72193,29,72194,72202,1,72243,72249,1,72251,72254,1,72263,72273,10,72274,72283,1,72330,72345,1,72751,72758,1,72760,72767,1,72850,72871,1,72873,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73098,67,73099,73102,1,73104,73105,1,73107,73111,1,73459,73462,1,73472,73473,1,73475,73524,49,73525,73530,1,73534,73538,1,73562,78912,5350,78919,78933,1,90398,90415,1,92912,92916,1,92976,92982,1,94031,94033,2,94034,94087,1,94095,94098,1,94180,94192,12,94193,113821,19628,113822,118528,4706,118529,118573,1,118576,118598,1,119141,119145,1,119149,119154,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldM=new P(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new P(new Uint32Array([2307,2363,56,2366,2368,1,2377,2380,1,2382,2383,1,2434,2435,1,2494,2496,1,2503,2504,1,2507,2508,1,2519,2563,44,2622,2624,1,2691,2750,59,2751,2752,1,2761,2763,2,2764,2818,54,2819,2878,59,2880,2887,7,2888,2891,3,2892,2903,11,3006,3007,1,3009,3010,1,3014,3016,1,3018,3020,1,3031,3073,42,3074,3075,1,3137,3140,1,3202,3203,1,3262,3264,2,3265,3268,1,3271,3272,1,3274,3275,1,3285,3286,1,3315,3330,15,3331,3390,59,3391,3392,1,3398,3400,1,3402,3404,1,3415,3458,43,3459,3535,76,3536,3537,1,3544,3551,1,3570,3571,1,3902,3903,1,3967,4139,172,4140,4145,5,4152,4155,3,4156,4182,26,4183,4194,11,4195,4196,1,4199,4205,1,4227,4228,1,4231,4236,1,4239,4250,11,4251,4252,1,5909,5940,31,6070,6078,8,6079,6085,1,6087,6088,1,6435,6438,1,6441,6443,1,6448,6449,1,6451,6456,1,6681,6682,1,6741,6743,2,6753,6755,2,6756,6765,9,6766,6770,1,6916,6965,49,6971,6973,2,6974,6977,1,6979,6980,1,7042,7073,31,7078,7079,1,7082,7143,61,7146,7148,1,7150,7154,4,7155,7204,49,7205,7211,1,7220,7221,1,7393,7415,22,12334,12335,1,43043,43044,1,43047,43136,89,43137,43188,51,43189,43203,1,43346,43347,1,43395,43444,49,43445,43450,5,43451,43454,3,43455,43456,1,43567,43568,1,43571,43572,1,43597,43643,46,43645,43755,110,43758,43759,1,43765,44003,238,44004,44006,2,44007,44009,2,44010,44012,2,69632,69634,2,69762,69808,46,69809,69810,1,69815,69816,1,69932,69957,25,69958,70018,60,70067,70069,1,70079,70080,1,70094,70188,94,70189,70190,1,70194,70195,1,70197,70368,171,70369,70370,1,70402,70403,1,70462,70463,1,70465,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70584,85,70585,70586,1,70594,70597,3,70599,70602,1,70604,70605,1,70607,70709,102,70710,70711,1,70720,70721,1,70725,70832,107,70833,70834,1,70841,70843,2,70844,70846,1,70849,71087,238,71088,71089,1,71096,71099,1,71102,71216,114,71217,71218,1,71227,71228,1,71230,71340,110,71342,71343,1,71350,71454,104,71456,71457,1,71462,71724,262,71725,71726,1,71736,71984,248,71985,71989,1,71991,71992,1,71997,72e3,3,72002,72145,143,72146,72147,1,72156,72159,1,72164,72249,85,72279,72280,1,72343,72751,408,72766,72873,107,72881,72884,3,73098,73102,1,73107,73108,1,73110,73461,351,73462,73475,13,73524,73525,1,73534,73535,1,73537,90410,16873,90411,90412,1,94033,94087,1,94192,94193,1,119141,119142,1,119149,119154,1]));static Me=new P(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new P(new Uint32Array([768,879,1,1155,1159,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2306,1,2362,2364,2,2369,2376,1,2381,2385,4,2386,2391,1,2402,2403,1,2433,2492,59,2497,2500,1,2509,2530,21,2531,2558,27,2561,2562,1,2620,2625,5,2626,2631,5,2632,2635,3,2636,2637,1,2641,2672,31,2673,2677,4,2689,2690,1,2748,2753,5,2754,2757,1,2759,2760,1,2765,2786,21,2787,2810,23,2811,2815,1,2817,2876,59,2879,2881,2,2882,2884,1,2893,2901,8,2902,2914,12,2915,2946,31,3008,3021,13,3072,3076,4,3132,3134,2,3135,3136,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3260,59,3263,3270,7,3276,3277,1,3298,3299,1,3328,3329,1,3387,3388,1,3393,3396,1,3405,3426,21,3427,3457,30,3530,3538,8,3539,3540,1,3542,3633,91,3636,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3953,3966,1,3968,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4141,103,4142,4144,1,4146,4151,1,4153,4154,1,4157,4158,1,4184,4185,1,4190,4192,1,4209,4212,1,4226,4229,3,4230,4237,7,4253,4957,704,4958,4959,1,5906,5908,1,5938,5939,1,5970,5971,1,6002,6003,1,6068,6069,1,6071,6077,1,6086,6089,3,6090,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6434,1,6439,6440,1,6450,6457,7,6458,6459,1,6679,6680,1,6683,6742,59,6744,6750,1,6752,6754,2,6757,6764,1,6771,6780,1,6783,6832,49,6833,6845,1,6847,6862,1,6912,6915,1,6964,6966,2,6967,6970,1,6972,6978,6,7019,7027,1,7040,7041,1,7074,7077,1,7080,7081,1,7083,7085,1,7142,7144,2,7145,7149,4,7151,7153,1,7212,7219,1,7222,7223,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8400,8412,1,8417,8421,4,8422,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12333,1,12441,12442,1,42607,42612,5,42613,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43045,26,43046,43052,6,43204,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43345,1,43392,43394,1,43443,43446,3,43447,43449,1,43452,43453,1,43493,43561,68,43562,43566,1,43569,43570,1,43573,43574,1,43587,43596,9,43644,43696,52,43698,43700,1,43703,43704,1,43710,43711,1,43713,43756,43,43757,43766,9,44005,44008,3,44013,64286,20273,65024,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69633,69688,55,69689,69702,1,69744,69747,3,69748,69759,11,69760,69761,1,69811,69814,1,69817,69818,1,69826,69888,62,69889,69890,1,69927,69931,1,69933,69940,1,70003,70016,13,70017,70070,53,70071,70078,1,70089,70092,1,70095,70191,96,70192,70193,1,70196,70198,2,70199,70206,7,70209,70367,158,70371,70378,1,70400,70401,1,70459,70460,1,70464,70502,38,70503,70508,1,70512,70516,1,70587,70592,1,70606,70610,2,70625,70626,1,70712,70719,1,70722,70724,1,70726,70750,24,70835,70840,1,70842,70847,5,70848,70850,2,70851,71090,239,71091,71093,1,71100,71101,1,71103,71104,1,71132,71133,1,71219,71226,1,71229,71231,2,71232,71339,107,71341,71344,3,71345,71349,1,71351,71453,102,71455,71458,3,71459,71461,1,71463,71467,1,71727,71735,1,71737,71738,1,71995,71996,1,71998,72003,5,72148,72151,1,72154,72155,1,72160,72193,33,72194,72202,1,72243,72248,1,72251,72254,1,72263,72273,10,72274,72278,1,72281,72283,1,72330,72342,1,72344,72345,1,72752,72758,1,72760,72765,1,72767,72850,83,72851,72871,1,72874,72880,1,72882,72883,1,72885,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73104,73,73105,73109,4,73111,73459,348,73460,73472,12,73473,73526,53,73527,73530,1,73536,73538,2,73562,78912,5350,78919,78933,1,90398,90409,1,90413,90415,1,92912,92916,1,92976,92982,1,94031,94095,64,94096,94098,1,94180,113821,19641,113822,118528,4706,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldMn=new P(new Uint32Array([921,953,32,8126,8126,1]));static N=new P(new Uint32Array([48,57,1,178,179,1,185,188,3,189,190,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2548,2553,1,2662,2671,1,2790,2799,1,2918,2927,1,2930,2935,1,3046,3058,1,3174,3183,1,3192,3198,1,3302,3311,1,3416,3422,1,3430,3448,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3891,1,4160,4169,1,4240,4249,1,4969,4988,1,5870,5872,1,6112,6121,1,6128,6137,1,6160,6169,1,6470,6479,1,6608,6618,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,8304,8308,4,8309,8313,1,8320,8329,1,8528,8578,1,8581,8585,1,9312,9371,1,9450,9471,1,10102,10131,1,11517,12295,778,12321,12329,1,12344,12346,1,12690,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,42528,42537,1,42726,42735,1,43056,43061,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,65799,65843,1,65856,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,66369,66378,9,66513,66517,1,66720,66729,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,68912,68921,1,68928,68937,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70113,70132,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71483,1,71904,71922,1,72016,72025,1,72688,72697,1,72784,72812,1,73040,73049,1,73120,73129,1,73552,73561,1,73664,73684,1,74752,74862,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93019,93025,1,93552,93561,1,93824,93846,1,118e3,118009,1,119488,119507,1,119520,119539,1,119648,119672,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125127,125135,1,125264,125273,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1,130032,130041,1]));static Nd=new P(new Uint32Array([48,57,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2662,2671,1,2790,2799,1,2918,2927,1,3046,3055,1,3174,3183,1,3302,3311,1,3430,3439,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3881,1,4160,4169,1,4240,4249,1,6112,6121,1,6160,6169,1,6470,6479,1,6608,6617,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,42528,42537,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,66720,66729,1,68912,68921,1,68928,68937,1,69734,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71481,1,71904,71913,1,72016,72025,1,72688,72697,1,72784,72793,1,73040,73049,1,73120,73129,1,73552,73561,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93552,93561,1,118e3,118009,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125264,125273,1,130032,130041,1]));static Nl=new P(new Uint32Array([5870,5872,1,8544,8578,1,8581,8584,1,12295,12321,26,12322,12329,1,12344,12346,1,42726,42735,1,65856,65908,1,66369,66378,9,66513,66517,1,74752,74862,1]));static No=new P(new Uint32Array([178,179,1,185,188,3,189,190,1,2548,2553,1,2930,2935,1,3056,3058,1,3192,3198,1,3416,3422,1,3440,3448,1,3882,3891,1,4969,4988,1,6128,6137,1,6618,8304,1686,8308,8313,1,8320,8329,1,8528,8543,1,8585,9312,727,9313,9371,1,9450,9471,1,10102,10131,1,11517,12690,1173,12691,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,43056,43061,1,65799,65843,1,65909,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69733,1,70113,70132,1,71482,71483,1,71914,71922,1,72794,72812,1,73664,73684,1,93019,93025,1,93824,93846,1,119488,119507,1,119520,119539,1,119648,119672,1,125127,125135,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1]));static P=new P(new Uint32Array([33,35,1,37,42,1,44,47,1,58,59,1,63,64,1,91,93,1,95,123,28,125,161,36,167,171,4,182,183,1,187,191,4,894,903,9,1370,1375,1,1417,1418,1,1470,1472,2,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3898,38,3899,3901,1,3973,4048,75,4049,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5120,5742,622,5787,5788,1,5867,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8208,829,8209,8231,1,8240,8259,1,8261,8273,1,8275,8286,1,8317,8318,1,8333,8334,1,8968,8971,1,9001,9002,1,10088,10101,1,10181,10182,1,10214,10223,1,10627,10648,1,10712,10715,1,10748,10749,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11822,1,11824,11855,1,11858,11869,1,12289,12291,1,12296,12305,1,12308,12319,1,12336,12349,13,12448,12539,91,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,64830,20819,64831,65040,209,65041,65049,1,65072,65106,1,65108,65121,1,65123,65128,5,65130,65131,1,65281,65283,1,65285,65290,1,65292,65295,1,65306,65307,1,65311,65312,1,65339,65341,1,65343,65371,28,65373,65375,2,65376,65381,1,65792,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,68974,69293,319,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Pc=new P(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new P(new Uint32Array([45,1418,1373,1470,5120,3650,6150,8208,2058,8209,8213,1,11799,11802,3,11834,11835,1,11840,11869,29,12316,12336,20,12448,65073,52625,65074,65112,38,65123,65293,170,68974,69293,319]));static Pe=new P(new Uint32Array([41,93,52,125,3899,3774,3901,5788,1887,8262,8318,56,8334,8969,635,8971,9002,31,10089,10101,2,10182,10215,33,10217,10223,2,10628,10648,2,10713,10715,2,10749,11811,1062,11813,11817,2,11862,11868,2,12297,12305,2,12309,12315,2,12318,12319,1,64830,65048,218,65078,65092,2,65096,65114,18,65116,65118,2,65289,65341,52,65373,65379,3]));static Pf=new P(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new P(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new P(new Uint32Array([33,35,1,37,39,1,42,46,2,47,58,11,59,63,4,64,92,28,161,167,6,182,183,1,191,894,703,903,1370,467,1371,1375,1,1417,1472,55,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3973,113,4048,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5742,5867,125,5868,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6149,1,6151,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8214,835,8215,8224,9,8225,8231,1,8240,8248,1,8251,8254,1,8257,8259,1,8263,8273,1,8275,8277,2,8278,8286,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11782,5,11783,11784,1,11787,11790,3,11791,11798,1,11800,11801,1,11803,11806,3,11807,11818,11,11819,11822,1,11824,11833,1,11836,11839,1,11841,11843,2,11844,11855,1,11858,11860,1,12289,12291,1,12349,12539,190,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,65040,21029,65041,65046,1,65049,65072,23,65093,65094,1,65097,65100,1,65104,65106,1,65108,65111,1,65119,65121,1,65128,65130,2,65131,65281,150,65282,65283,1,65285,65287,1,65290,65294,2,65295,65306,11,65307,65311,4,65312,65340,28,65377,65380,3,65381,65792,411,65793,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Ps=new P(new Uint32Array([40,91,51,123,3898,3775,3900,5787,1887,8218,8222,4,8261,8317,56,8333,8968,635,8970,9001,31,10088,10100,2,10181,10214,33,10216,10222,2,10627,10647,2,10712,10714,2,10748,11810,1062,11812,11816,2,11842,11861,19,11863,11867,2,12296,12304,2,12308,12314,2,12317,64831,52514,65047,65077,30,65079,65091,2,65095,65113,18,65115,65117,2,65288,65339,51,65371,65375,4,65378,65378,1]));static S=new P(new Uint32Array([36,43,7,60,62,1,94,96,2,124,126,2,162,166,1,168,169,1,172,174,2,175,177,1,180,184,4,215,247,32,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,1014,113,1154,1421,267,1422,1423,1,1542,1544,1,1547,1550,3,1551,1758,207,1769,1789,20,1790,2038,248,2046,2047,1,2184,2546,362,2547,2554,7,2555,2801,246,2928,3059,131,3060,3066,1,3199,3407,208,3449,3647,198,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6107,366,6464,6622,158,6623,6655,1,7009,7018,1,7028,7036,1,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,8260,8274,14,8314,8316,1,8330,8332,1,8352,8384,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8472,1,8478,8483,1,8485,8489,2,8494,8506,12,8507,8512,5,8513,8516,1,8522,8525,1,8527,8586,59,8587,8592,5,8593,8967,1,8972,9e3,1,9003,9257,1,9280,9290,1,9372,9449,1,9472,10087,1,10132,10180,1,10183,10213,1,10224,10626,1,10649,10711,1,10716,10747,1,10750,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12443,12444,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,42752,42774,1,42784,42785,1,42889,42890,1,43048,43051,1,43062,43065,1,43639,43641,1,43867,43882,15,43883,64297,20414,64434,64450,1,64832,64847,1,64975,65020,45,65021,65023,1,65122,65124,2,65125,65126,1,65129,65284,155,65291,65308,17,65309,65310,1,65342,65344,2,65372,65374,2,65504,65510,1,65512,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,69006,710,69007,71487,2480,73685,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,123647,432,126124,126128,4,126254,126704,450,126705,126976,271,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Sc=new P(new Uint32Array([36,162,126,163,165,1,1423,1547,124,2046,2047,1,2546,2547,1,2555,2801,246,3065,3647,582,6107,8352,2245,8353,8384,1,43064,65020,21956,65129,65284,155,65504,65505,1,65509,65510,1,73693,73696,1,123647,126128,2481]));static Sk=new P(new Uint32Array([94,96,2,168,175,7,180,184,4,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,2184,1283,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,12443,12444,1,42752,42774,1,42784,42785,1,42889,42890,1,43867,43882,15,43883,64434,20551,64435,64450,1,65342,65344,2,65507,127995,62488,127996,127999,1]));static Sm=new P(new Uint32Array([43,60,17,61,62,1,124,126,2,172,177,5,215,247,32,1014,1542,528,1543,1544,1,8260,8274,14,8314,8316,1,8330,8332,1,8472,8512,40,8513,8516,1,8523,8592,69,8593,8596,1,8602,8603,1,8608,8614,3,8622,8654,32,8655,8658,3,8660,8692,32,8693,8959,1,8992,8993,1,9084,9115,31,9116,9139,1,9180,9185,1,9655,9665,10,9720,9727,1,9839,10176,337,10177,10180,1,10183,10213,1,10224,10239,1,10496,10626,1,10649,10711,1,10716,10747,1,10750,11007,1,11056,11076,1,11079,11084,1,64297,65122,825,65124,65126,1,65291,65308,17,65309,65310,1,65372,65374,2,65506,65513,7,65514,65516,1,69006,69007,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,126704,126705,1]));static So=new P(new Uint32Array([166,169,3,174,176,2,1154,1421,267,1422,1550,128,1551,1758,207,1769,1789,20,1790,2038,248,2554,2928,374,3059,3064,1,3066,3199,133,3407,3449,42,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6464,723,6622,6655,1,7009,7018,1,7028,7036,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8478,7,8479,8483,1,8485,8489,2,8494,8506,12,8507,8522,15,8524,8525,1,8527,8586,59,8587,8597,10,8598,8601,1,8604,8607,1,8609,8610,1,8612,8613,1,8615,8621,1,8623,8653,1,8656,8657,1,8659,8661,2,8662,8691,1,8960,8967,1,8972,8991,1,8994,9e3,1,9003,9083,1,9085,9114,1,9140,9179,1,9186,9257,1,9280,9290,1,9372,9449,1,9472,9654,1,9656,9664,1,9666,9719,1,9728,9838,1,9840,10087,1,10132,10175,1,10240,10495,1,11008,11055,1,11077,11078,1,11085,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,43048,43051,1,43062,43063,1,43065,43639,574,43640,43641,1,64832,64847,1,64975,65021,46,65022,65023,1,65508,65512,4,65517,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,71487,3191,73685,73692,1,73697,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,126124,2909,126254,126976,722,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,127994,1,128e3,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Z=new P(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new P(new Uint32Array([8232,8232,1]));static Zp=new P(new Uint32Array([8233,8233,1]));static Zs=new P(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new P(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new P(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new P(new Uint32Array([82944,83526,1]));static Arabic=new P(new Uint32Array([1536,1540,1,1542,1547,1,1549,1562,1,1564,1566,1,1568,1599,1,1601,1610,1,1622,1647,1,1649,1756,1,1758,1791,1,1872,1919,1,2160,2190,1,2192,2193,1,2199,2273,1,2275,2303,1,64336,64450,1,64467,64829,1,64832,64911,1,64914,64967,1,64975,65008,33,65009,65023,1,65136,65140,1,65142,65276,1,69216,69246,1,69314,69316,1,69372,69375,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1]));static Armenian=new P(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new P(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new P(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new P(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new P(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new P(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new P(new Uint32Array([2432,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1]));static Bhaiksuki=new P(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new P(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new P(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new P(new Uint32Array([10240,10495,1]));static Buginese=new P(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new P(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new P(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new P(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new P(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new P(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new P(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new P(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new P(new Uint32Array([69552,69579,1]));static Common=new P(new Uint32Array([0,64,1,91,96,1,123,169,1,171,185,1,187,191,1,215,247,32,697,735,1,741,745,1,748,767,1,884,894,10,901,903,2,1541,1548,7,1563,1567,4,1600,1757,157,2274,2404,130,2405,3647,1242,4053,4056,1,4347,5867,1520,5868,5869,1,5941,5942,1,6146,6147,1,6149,7379,1230,7393,7401,8,7402,7404,1,7406,7411,1,7413,7415,1,7418,8192,774,8193,8203,1,8206,8292,1,8294,8304,1,8308,8318,1,8320,8334,1,8352,8384,1,8448,8485,1,8487,8489,1,8492,8497,1,8499,8525,1,8527,8543,1,8585,8587,1,8592,9257,1,9280,9290,1,9312,10239,1,10496,11123,1,11126,11157,1,11159,11263,1,11776,11869,1,12272,12292,1,12294,12296,2,12297,12320,1,12336,12343,1,12348,12351,1,12443,12444,1,12448,12539,91,12540,12688,148,12689,12703,1,12736,12773,1,12783,12832,49,12833,12895,1,12927,13007,1,13055,13144,89,13145,13311,1,19904,19967,1,42752,42785,1,42888,42890,1,43056,43065,1,43310,43471,161,43867,43882,15,43883,64830,20947,64831,65040,209,65041,65049,1,65072,65106,1,65108,65126,1,65128,65131,1,65279,65281,2,65282,65312,1,65339,65344,1,65371,65381,1,65392,65438,46,65439,65504,65,65505,65510,1,65512,65518,1,65529,65533,1,65792,65794,1,65799,65843,1,65847,65855,1,65936,65948,1,66e3,66044,1,66273,66299,1,113824,113827,1,117760,118009,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119142,1,119146,119162,1,119171,119172,1,119180,119209,1,119214,119274,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,120831,1,126065,126132,1,126209,126269,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127487,1,127489,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,917505,917536,31,917537,917631,1]));static foldCommon=new P(new Uint32Array([924,956,32]));static Coptic=new P(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new P(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new P(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new P(new Uint32Array([77712,77810,1]));static Cyrillic=new P(new Uint32Array([1024,1156,1,1159,1327,1,7296,7306,1,7467,7544,77,11744,11775,1,42560,42655,1,65070,65071,1,122928,122989,1,123023,123023,1]));static Deseret=new P(new Uint32Array([66560,66639,1]));static Devanagari=new P(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new P(new Uint32Array([71936,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1]));static Dogra=new P(new Uint32Array([71680,71739,1]));static Duployan=new P(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new P(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new P(new Uint32Array([66816,66855,1]));static Elymaic=new P(new Uint32Array([69600,69622,1]));static Ethiopic=new P(new Uint32Array([4608,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,124896,124902,1,124904,124907,1,124909,124910,1,124912,124926,1]));static Garay=new P(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new P(new Uint32Array([4256,4293,1,4295,4301,6,4304,4346,1,4348,4351,1,7312,7354,1,7357,7359,1,11520,11557,1,11559,11565,6]));static Glagolitic=new P(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new P(new Uint32Array([66352,66378,1]));static Grantha=new P(new Uint32Array([70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70460,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1]));static Greek=new P(new Uint32Array([880,883,1,885,887,1,890,893,1,895,900,5,902,904,2,905,906,1,908,910,2,911,929,1,931,993,1,1008,1023,1,7462,7466,1,7517,7521,1,7526,7530,1,7615,7936,321,7937,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8486,43877,35391,65856,65934,1,65952,119296,53344,119297,119365,1]));static foldGreek=new P(new Uint32Array([181,837,656]));static Gujarati=new P(new Uint32Array([2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1]));static Gunjala_Gondi=new P(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new P(new Uint32Array([2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1]));static Gurung_Khema=new P(new Uint32Array([90368,90425,1]));static Han=new P(new Uint32Array([11904,11929,1,11931,12019,1,12032,12245,1,12293,12295,2,12321,12329,1,12344,12347,1,13312,19903,1,19968,40959,1,63744,64109,1,64112,64217,1,94178,94179,1,94192,94193,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Hangul=new P(new Uint32Array([4352,4607,1,12334,12335,1,12593,12686,1,12800,12830,1,12896,12926,1,43360,43388,1,44032,55203,1,55216,55238,1,55243,55291,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1]));static Hanifi_Rohingya=new P(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new P(new Uint32Array([5920,5940,1]));static Hatran=new P(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new P(new Uint32Array([1425,1479,1,1488,1514,1,1519,1524,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64335,1]));static Hiragana=new P(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new P(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new P(new Uint32Array([768,879,1,1157,1158,1,1611,1621,1,1648,2385,737,2386,2388,1,6832,6862,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8204,8205,1,8400,8432,1,12330,12333,1,12441,12442,1,65024,65039,1,65056,65069,1,66045,66272,227,70459,118528,48069,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,917760,917999,1]));static foldInherited=new P(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new P(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new P(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new P(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new P(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new P(new Uint32Array([3200,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1]));static Katakana=new P(new Uint32Array([12449,12538,1,12541,12543,1,12784,12799,1,13008,13054,1,13056,13143,1,65382,65391,1,65393,65437,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110880,288,110881,110882,1,110933,110948,15,110949,110951,1]));static Kawi=new P(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new P(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new P(new Uint32Array([68096,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1]));static Khitan_Small_Script=new P(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new P(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new P(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new P(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new P(new Uint32Array([93504,93561,1]));static Lao=new P(new Uint32Array([3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1]));static Latin=new P(new Uint32Array([65,90,1,97,122,1,170,186,16,192,214,1,216,246,1,248,696,1,736,740,1,7424,7461,1,7468,7516,1,7522,7525,1,7531,7543,1,7545,7614,1,7680,7935,1,8305,8319,14,8336,8348,1,8490,8491,1,8498,8526,28,8544,8584,1,11360,11391,1,42786,42887,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43007,1,43824,43866,1,43868,43876,1,43878,43881,1,64256,64262,1,65313,65338,1,65345,65370,1,67456,67461,1,67463,67504,1,67506,67514,1,122624,122654,1,122661,122666,1]));static Lepcha=new P(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new P(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new P(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new P(new Uint32Array([65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1]));static Lisu=new P(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new P(new Uint32Array([66176,66204,1]));static Lydian=new P(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new P(new Uint32Array([69968,70006,1]));static Makasar=new P(new Uint32Array([73440,73464,1]));static Malayalam=new P(new Uint32Array([3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1]));static Mandaic=new P(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new P(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new P(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new P(new Uint32Array([72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1]));static Medefaidrin=new P(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new P(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new P(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new P(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new P(new Uint32Array([67968,67999,1]));static Miao=new P(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new P(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new P(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new P(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new P(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new P(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new P(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new P(new Uint32Array([124112,124153,1]));static Nandinagari=new P(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new P(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new P(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new P(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new P(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new P(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new P(new Uint32Array([5760,5788,1]));static Ol_Chiki=new P(new Uint32Array([7248,7295,1]));static Ol_Onal=new P(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new P(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new P(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new P(new Uint32Array([68224,68255,1]));static Old_Permic=new P(new Uint32Array([66384,66426,1]));static Old_Persian=new P(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new P(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new P(new Uint32Array([68192,68223,1]));static Old_Turkic=new P(new Uint32Array([68608,68680,1]));static Old_Uyghur=new P(new Uint32Array([69488,69513,1]));static Oriya=new P(new Uint32Array([2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1]));static Osage=new P(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new P(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new P(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new P(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new P(new Uint32Array([72384,72440,1]));static Phags_Pa=new P(new Uint32Array([43072,43127,1]));static Phoenician=new P(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new P(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new P(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new P(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new P(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new P(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new P(new Uint32Array([70016,70111,1]));static Shavian=new P(new Uint32Array([66640,66687,1]));static Siddham=new P(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new P(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new P(new Uint32Array([3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,70113,70132,1]));static Sogdian=new P(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new P(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new P(new Uint32Array([72272,72354,1]));static Sundanese=new P(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new P(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new P(new Uint32Array([43008,43052,1]));static Syriac=new P(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new P(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new P(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new P(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new P(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new P(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new P(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new P(new Uint32Array([2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,73664,73713,1,73727,73727,1]));static Tangsa=new P(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new P(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new P(new Uint32Array([3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3199,1]));static Thaana=new P(new Uint32Array([1920,1969,1]));static Thai=new P(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new P(new Uint32Array([3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4052,1,4057,4058,1]));static Tifinagh=new P(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new P(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new P(new Uint32Array([67008,67059,1]));static Toto=new P(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new P(new Uint32Array([70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1]));static Ugaritic=new P(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new P(new Uint32Array([42240,42539,1]));static Vithkuqi=new P(new Uint32Array([66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1]));static Wancho=new P(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new P(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new P(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new P(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new P(new Uint32Array([72192,72263,1]));static CATEGORIES=new Map([["C",e.C],["Cc",e.Cc],["Cf",e.Cf],["Co",e.Co],["Cs",e.Cs],["L",e.L],["Ll",e.Ll],["Lm",e.Lm],["Lo",e.Lo],["Lt",e.Lt],["Lu",e.Lu],["M",e.M],["Mc",e.Mc],["Me",e.Me],["Mn",e.Mn],["N",e.N],["Nd",e.Nd],["Nl",e.Nl],["No",e.No],["P",e.P],["Pc",e.Pc],["Pd",e.Pd],["Pe",e.Pe],["Pf",e.Pf],["Pi",e.Pi],["Po",e.Po],["Ps",e.Ps],["S",e.S],["Sc",e.Sc],["Sk",e.Sk],["Sm",e.Sm],["So",e.So],["Z",e.Z],["Zl",e.Zl],["Zp",e.Zp],["Zs",e.Zs]]);static SCRIPTS=new Map([["Adlam",e.Adlam],["Ahom",e.Ahom],["Anatolian_Hieroglyphs",e.Anatolian_Hieroglyphs],["Arabic",e.Arabic],["Armenian",e.Armenian],["Avestan",e.Avestan],["Balinese",e.Balinese],["Bamum",e.Bamum],["Bassa_Vah",e.Bassa_Vah],["Batak",e.Batak],["Bengali",e.Bengali],["Bhaiksuki",e.Bhaiksuki],["Bopomofo",e.Bopomofo],["Brahmi",e.Brahmi],["Braille",e.Braille],["Buginese",e.Buginese],["Buhid",e.Buhid],["Canadian_Aboriginal",e.Canadian_Aboriginal],["Carian",e.Carian],["Caucasian_Albanian",e.Caucasian_Albanian],["Chakma",e.Chakma],["Cham",e.Cham],["Cherokee",e.Cherokee],["Chorasmian",e.Chorasmian],["Common",e.Common],["Coptic",e.Coptic],["Cuneiform",e.Cuneiform],["Cypriot",e.Cypriot],["Cypro_Minoan",e.Cypro_Minoan],["Cyrillic",e.Cyrillic],["Deseret",e.Deseret],["Devanagari",e.Devanagari],["Dives_Akuru",e.Dives_Akuru],["Dogra",e.Dogra],["Duployan",e.Duployan],["Egyptian_Hieroglyphs",e.Egyptian_Hieroglyphs],["Elbasan",e.Elbasan],["Elymaic",e.Elymaic],["Ethiopic",e.Ethiopic],["Garay",e.Garay],["Georgian",e.Georgian],["Glagolitic",e.Glagolitic],["Gothic",e.Gothic],["Grantha",e.Grantha],["Greek",e.Greek],["Gujarati",e.Gujarati],["Gunjala_Gondi",e.Gunjala_Gondi],["Gurmukhi",e.Gurmukhi],["Gurung_Khema",e.Gurung_Khema],["Han",e.Han],["Hangul",e.Hangul],["Hanifi_Rohingya",e.Hanifi_Rohingya],["Hanunoo",e.Hanunoo],["Hatran",e.Hatran],["Hebrew",e.Hebrew],["Hiragana",e.Hiragana],["Imperial_Aramaic",e.Imperial_Aramaic],["Inherited",e.Inherited],["Inscriptional_Pahlavi",e.Inscriptional_Pahlavi],["Inscriptional_Parthian",e.Inscriptional_Parthian],["Javanese",e.Javanese],["Kaithi",e.Kaithi],["Kannada",e.Kannada],["Katakana",e.Katakana],["Kawi",e.Kawi],["Kayah_Li",e.Kayah_Li],["Kharoshthi",e.Kharoshthi],["Khitan_Small_Script",e.Khitan_Small_Script],["Khmer",e.Khmer],["Khojki",e.Khojki],["Khudawadi",e.Khudawadi],["Kirat_Rai",e.Kirat_Rai],["Lao",e.Lao],["Latin",e.Latin],["Lepcha",e.Lepcha],["Limbu",e.Limbu],["Linear_A",e.Linear_A],["Linear_B",e.Linear_B],["Lisu",e.Lisu],["Lycian",e.Lycian],["Lydian",e.Lydian],["Mahajani",e.Mahajani],["Makasar",e.Makasar],["Malayalam",e.Malayalam],["Mandaic",e.Mandaic],["Manichaean",e.Manichaean],["Marchen",e.Marchen],["Masaram_Gondi",e.Masaram_Gondi],["Medefaidrin",e.Medefaidrin],["Meetei_Mayek",e.Meetei_Mayek],["Mende_Kikakui",e.Mende_Kikakui],["Meroitic_Cursive",e.Meroitic_Cursive],["Meroitic_Hieroglyphs",e.Meroitic_Hieroglyphs],["Miao",e.Miao],["Modi",e.Modi],["Mongolian",e.Mongolian],["Mro",e.Mro],["Multani",e.Multani],["Myanmar",e.Myanmar],["Nabataean",e.Nabataean],["Nag_Mundari",e.Nag_Mundari],["Nandinagari",e.Nandinagari],["New_Tai_Lue",e.New_Tai_Lue],["Newa",e.Newa],["Nko",e.Nko],["Nushu",e.Nushu],["Nyiakeng_Puachue_Hmong",e.Nyiakeng_Puachue_Hmong],["Ogham",e.Ogham],["Ol_Chiki",e.Ol_Chiki],["Ol_Onal",e.Ol_Onal],["Old_Hungarian",e.Old_Hungarian],["Old_Italic",e.Old_Italic],["Old_North_Arabian",e.Old_North_Arabian],["Old_Permic",e.Old_Permic],["Old_Persian",e.Old_Persian],["Old_Sogdian",e.Old_Sogdian],["Old_South_Arabian",e.Old_South_Arabian],["Old_Turkic",e.Old_Turkic],["Old_Uyghur",e.Old_Uyghur],["Oriya",e.Oriya],["Osage",e.Osage],["Osmanya",e.Osmanya],["Pahawh_Hmong",e.Pahawh_Hmong],["Palmyrene",e.Palmyrene],["Pau_Cin_Hau",e.Pau_Cin_Hau],["Phags_Pa",e.Phags_Pa],["Phoenician",e.Phoenician],["Psalter_Pahlavi",e.Psalter_Pahlavi],["Rejang",e.Rejang],["Runic",e.Runic],["Samaritan",e.Samaritan],["Saurashtra",e.Saurashtra],["Sharada",e.Sharada],["Shavian",e.Shavian],["Siddham",e.Siddham],["SignWriting",e.SignWriting],["Sinhala",e.Sinhala],["Sogdian",e.Sogdian],["Sora_Sompeng",e.Sora_Sompeng],["Soyombo",e.Soyombo],["Sundanese",e.Sundanese],["Sunuwar",e.Sunuwar],["Syloti_Nagri",e.Syloti_Nagri],["Syriac",e.Syriac],["Tagalog",e.Tagalog],["Tagbanwa",e.Tagbanwa],["Tai_Le",e.Tai_Le],["Tai_Tham",e.Tai_Tham],["Tai_Viet",e.Tai_Viet],["Takri",e.Takri],["Tamil",e.Tamil],["Tangsa",e.Tangsa],["Tangut",e.Tangut],["Telugu",e.Telugu],["Thaana",e.Thaana],["Thai",e.Thai],["Tibetan",e.Tibetan],["Tifinagh",e.Tifinagh],["Tirhuta",e.Tirhuta],["Todhri",e.Todhri],["Toto",e.Toto],["Tulu_Tigalari",e.Tulu_Tigalari],["Ugaritic",e.Ugaritic],["Vai",e.Vai],["Vithkuqi",e.Vithkuqi],["Wancho",e.Wancho],["Warang_Citi",e.Warang_Citi],["Yezidi",e.Yezidi],["Yi",e.Yi],["Zanabazar_Square",e.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([["L",e.foldL],["Ll",e.foldLl],["Lt",e.foldLt],["Lu",e.foldLu],["M",e.foldM],["Mn",e.foldMn]]);static FOLD_SCRIPT=new Map([["Common",e.foldCommon],["Greek",e.foldGreek],["Inherited",e.foldInherited]]);static Print=new P(new Uint32Array([33,126,1,161,172,1,174,887,1,890,895,1,900,906,1,908,910,2,911,929,1,931,1327,1,1329,1366,1,1369,1418,1,1421,1423,1,1425,1479,1,1488,1514,1,1519,1524,1,1542,1563,1,1565,1756,1,1758,1805,1,1808,1866,1,1869,1969,1,1984,2042,1,2045,2093,1,2096,2110,1,2112,2139,1,2142,2144,2,2145,2154,1,2160,2190,1,2199,2273,1,2275,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1,2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1,2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1,2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1,2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1,3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1,3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,3585,3642,1,3647,3675,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1,3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4058,1,4096,4293,1,4295,4301,6,4304,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,5024,5109,1,5112,5117,1,5120,5759,1,5761,5788,1,5792,5880,1,5888,5909,1,5919,5942,1,5952,5971,1,5984,5996,1,5998,6e3,1,6002,6003,1,6016,6109,1,6112,6121,1,6128,6137,1,6144,6157,1,6159,6169,1,6176,6264,1,6272,6314,1,6320,6389,1,6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6608,6618,1,6622,6683,1,6686,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1,6832,6862,1,6912,6988,1,6990,7155,1,7164,7223,1,7227,7241,1,7245,7306,1,7312,7354,1,7357,7367,1,7376,7418,1,7424,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8208,8231,1,8240,8286,1,8304,8305,1,8308,8334,1,8336,8348,1,8352,8384,1,8400,8432,1,8448,8587,1,8592,9257,1,9280,9290,1,9312,11123,1,11126,11157,1,11159,11507,1,11513,11557,1,11559,11565,6,11568,11623,1,11631,11632,1,11647,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11744,11869,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12289,12351,1,12353,12438,1,12441,12543,1,12549,12591,1,12593,12686,1,12688,12773,1,12783,12830,1,12832,42124,1,42128,42182,1,42192,42539,1,42560,42743,1,42752,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43052,1,43056,43065,1,43072,43127,1,43136,43205,1,43214,43225,1,43232,43347,1,43359,43388,1,43392,43469,1,43471,43481,1,43486,43518,1,43520,43574,1,43584,43597,1,43600,43609,1,43612,43714,1,43739,43766,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43883,1,43888,44013,1,44016,44025,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64450,1,64467,64911,1,64914,64967,1,64975,65008,33,65009,65049,1,65056,65106,1,65108,65126,1,65128,65131,1,65136,65140,1,65142,65276,1,65281,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65504,65510,1,65512,65518,1,65532,65533,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,65792,65794,1,65799,65843,1,65847,65934,1,65936,65948,1,65952,66e3,48,66001,66045,1,66176,66204,1,66208,66256,1,66272,66299,1,66304,66339,1,66349,66378,1,66384,66426,1,66432,66461,1,66463,66499,1,66504,66517,1,66560,66717,1,66720,66729,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66927,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67671,67742,1,67751,67759,1,67808,67826,1,67828,67829,1,67835,67867,1,67871,67897,1,67903,67968,65,67969,68023,1,68028,68047,1,68050,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1,68192,68255,1,68288,68326,1,68331,68342,1,68352,68405,1,68409,68437,1,68440,68466,1,68472,68497,1,68505,68508,1,68521,68527,1,68608,68680,1,68736,68786,1,68800,68850,1,68858,68903,1,68912,68921,1,68928,68965,1,68969,68997,1,69006,69007,1,69216,69246,1,69248,69289,1,69291,69293,1,69296,69297,1,69314,69316,1,69372,69415,1,69424,69465,1,69488,69513,1,69552,69579,1,69600,69622,1,69632,69709,1,69714,69749,1,69759,69820,1,69822,69826,1,69840,69864,1,69872,69881,1,69888,69940,1,69942,69959,1,69968,70006,1,70016,70111,1,70113,70132,1,70144,70161,1,70163,70209,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1,70320,70378,1,70384,70393,1,70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70459,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1,70656,70747,1,70749,70753,1,70784,70855,1,70864,70873,1,71040,71093,1,71096,71133,1,71168,71236,1,71248,71257,1,71264,71276,1,71296,71353,1,71360,71369,1,71376,71395,1,71424,71450,1,71453,71467,1,71472,71494,1,71680,71739,1,71840,71922,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1,72096,72103,1,72106,72151,1,72154,72164,1,72192,72263,1,72272,72354,1,72368,72440,1,72448,72457,1,72640,72673,1,72688,72697,1,72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1,72816,72847,1,72850,72871,1,72873,72886,1,72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1,73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1,73440,73464,1,73472,73488,1,73490,73530,1,73534,73562,1,73648,73664,16,73665,73713,1,73727,74649,1,74752,74862,1,74864,74868,1,74880,75075,1,77712,77810,1,77824,78895,1,78912,78933,1,78944,82938,1,82944,83526,1,90368,90425,1,92160,92728,1,92736,92766,1,92768,92777,1,92782,92862,1,92864,92873,1,92880,92909,1,92912,92917,1,92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1,93504,93561,1,93760,93850,1,93952,94026,1,94031,94087,1,94095,94111,1,94176,94180,1,94192,94193,1,94208,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1,117760,118009,1,118016,118451,1,118528,118573,1,118576,118598,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119154,1,119163,119274,1,119296,119365,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,121483,1,121499,121503,1,121505,121519,1,122624,122654,1,122661,122666,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,122928,122989,1,123023,123136,113,123137,123180,1,123184,123197,1,123200,123209,1,123214,123215,1,123536,123566,1,123584,123641,1,123647,124112,465,124113,124153,1,124368,124410,1,124415,124896,481,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125127,125142,1,125184,125259,1,125264,125273,1,125278,125279,1,126065,126132,1,126209,126269,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1,917760,917999,1]))},Ce=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(t,n){let r=0,s=t.length;for(;r<s;){let i=r+Math.floor((s-r)/2),o=t.getLo(i),a=t.getHi(i);if(o<=n&&n<=a){let l=t.getStride(i);return(n-o)%l===0}n<o?s=i:r=i+1}return!1}static is(t,n){if(n<=this.MAX_LATIN1){for(let r=0;r<t.length;r++){let s=t.getHi(r);if(n>s)continue;let i=t.getLo(r);if(n<i)return!1;let o=t.getStride(r);return(n-i)%o===0}return!1}return t.length>0&&n>=t.getLo(0)&&this.is32(t,n)}static isUpper(t){if(t<=this.MAX_LATIN1){let n=String.fromCodePoint(t);return n.toUpperCase()===n&&n.toLowerCase()!==n}return this.is(Un.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t<this.MAX_ASCII||t>=161&&t!==173:this.is(Un.Print,t)}static simpleFold(t){if(Un.CASE_ORBIT.has(t))return Un.CASE_ORBIT.get(t);let n=j.toLowerCase(t);return n!==t?n:j.toUpperCase(t)}static equalsIgnoreCase(t,n){if(t<0||n<0||t===n)return!0;if(t<=this.MAX_ASCII&&n<=this.MAX_ASCII)return j.CODES.get("A")<=t&&t<=j.CODES.get("Z")&&(t|=32),j.CODES.get("A")<=n&&n<=j.CODES.get("Z")&&(n|=32),t===n;for(let r=this.simpleFold(t);r!==t;r=this.simpleFold(r))if(r===n)return!0;return!1}},We=class{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(t){return j.CODES.get("0")<=t&&t<=j.CODES.get("9")||j.CODES.get("a")<=t&&t<=j.CODES.get("z")||j.CODES.get("A")<=t&&t<=j.CODES.get("Z")}static unhex(t){return j.CODES.get("0")<=t&&t<=j.CODES.get("9")?t-j.CODES.get("0"):j.CODES.get("a")<=t&&t<=j.CODES.get("f")?t-j.CODES.get("a")+10:j.CODES.get("A")<=t&&t<=j.CODES.get("F")?t-j.CODES.get("A")+10:-1}static escapeRune(t){let n="";if(Ce.isPrint(t))this.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(n+="\\"),n+=String.fromCodePoint(t);else switch(t){case j.CODES.get('"'):n+='\\"';break;case j.CODES.get("\\"):n+="\\\\";break;case j.CODES.get(" "):n+="\\t";break;case j.CODES.get(`
161
+ `):n+="\\n";break;case j.CODES.get("\r"):n+="\\r";break;case j.CODES.get("\b"):n+="\\b";break;case j.CODES.get("\f"):n+="\\f";break;default:{let r=t.toString(16);t<256?(n+="\\x",r.length===1&&(n+="0"),n+=r):n+=`\\x{${r}}`;break}}return n}static stringToRunes(t){return String(t).split("").map(n=>n.codePointAt(0))}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return j.CODES.get("a")<=t&&t<=j.CODES.get("z")||j.CODES.get("A")<=t&&t<=j.CODES.get("Z")||j.CODES.get("0")<=t&&t<=j.CODES.get("9")||t===j.CODES.get("_")}static emptyOpContext(t,n){let r=0;return t<0&&(r|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),t===j.CODES.get(`
162
+ `)&&(r|=this.EMPTY_BEGIN_LINE),n<0&&(r|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),n===j.CODES.get(`
163
+ `)&&(r|=this.EMPTY_END_LINE),this.isWordRune(t)!==this.isWordRune(n)?r|=this.EMPTY_WORD_BOUNDARY:r|=this.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(t){return t.split("").map(n=>this.METACHARACTERS.indexOf(n)>=0?`\\${n}`:n).join("")}static charCount(t){return t>Ce.MAX_BMP?2:1}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(t));{let n=[],r=0;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=i&63|128):(i&64512)===55296&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++s)&1023),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=i&63|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=i&63|128)}return n}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(t));{let n=[],r=0,s=0;for(;r<t.length;){let i=t[r++];if(i<128)n[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=t[r++];n[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=t[r++],a=t[r++],l=t[r++],c=((i&7)<<18|(o&63)<<12|(a&63)<<6|l&63)-65536;n[s++]=String.fromCharCode(55296+(c>>10)),n[s++]=String.fromCharCode(56320+(c&1023))}else{let o=t[r++],a=t[r++];n[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return n.join("")}}},$1=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)},Zr=class e{static Encoding=$1(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},ma=class extends Zr{constructor(t=null){super(),this.bytes=t}getEncoding(){return Zr.Encoding.UTF_8}asCharSequence(){return We.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},Gc=class extends Zr{constructor(t=null){super(),this.charSequence=t}getEncoding(){return Zr.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(t=>t.codePointAt(0))}length(){return this.charSequence.length}},ci=class{static utf16(t){return new Gc(t)}static utf8(t){return Array.isArray(t)?new ma(t):new ma(We.stringToUtf8ByteArray(t))}},xr=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},qc=class extends xr{constructor(t,n=0,r=t.length){super(),this.bytes=t,this.start=n,this.end=r}step(t){if(t+=this.start,t>=this.end)return xr.EOF();let n=this.bytes[t++]&255;return(n&128)===0?n<<3|1:(n&224)===192?(n=n&31,t>=this.end?xr.EOF():(n=n<<6|this.bytes[t++]&63,n<<3|2)):(n&240)===224?(n=n&15,t+1>=this.end?xr.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|3)):(n=n&7,t+2>=this.end?xr.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|4))}index(t,n){n+=this.start;let r=this.indexOf(this.bytes,t.prefixUTF8,n);return r<0?r:r-n}context(t){t+=this.start;let n=-1;if(t>this.start&&t<=this.end){let s=t-1;if(n=this.bytes[s--],n>=128){let i=t-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),n=this.step(s)>>3}}let r=t<this.end?this.step(t)>>3:-1;return We.emptyOpContext(n,r)}indexOf(t,n,r=0){let s=n.length;if(s===0)return-1;let i=t.length;for(let o=r;o<=i-s;o++)for(let a=0;a<s&&t[o+a]===n[a];a++)if(a===s-1)return o;return-1}},Zc=class extends xr{constructor(t,n=0,r=t.length){super(),this.charSequence=t,this.start=n,this.end=r}step(t){if(t+=this.start,t<this.end){let n=this.charSequence.codePointAt(t);return n<<3|We.charCount(n)}else return xr.EOF()}index(t,n){n+=this.start;let r=this.charSequence.indexOf(t.prefix,n);return r<0?r:r-n}context(t){t+=this.start;let n=t>0&&t<=this.charSequence.length?this.charSequence.codePointAt(t-1):-1,r=t<this.charSequence.length?this.charSequence.codePointAt(t):-1;return We.emptyOpContext(n,r)}},gt=class{static fromUTF8(t,n=0,r=t.length){return new qc(t,n,r)}static fromUTF16(t,n=0,r=t.length){return new Zc(t,n,r)}},ui=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},it=class extends ui{constructor(t,n=null){let r=`error parsing regexp: ${t}`;n&&(r+=`: \`${n}\``),super(r),this.name="RE2JSSyntaxException",this.message=r,this.error=t,this.input=n}getDescription(){return this.error}getPattern(){return this.input}},Kc=class extends ui{constructor(t){super(t),this.name="RE2JSCompileException"}},rr=class extends ui{constructor(t){super(t),this.name="RE2JSGroupException"}},Qc=class extends ui{constructor(t){super(t),this.name="RE2JSFlagsException"}},Xc=class{static quoteReplacement(t){return t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(n=>{let r=n.codePointAt(0);return r===j.CODES.get("\\")||r===j.CODES.get("$")?`\\${n}`:n}).join("")}constructor(t,n){if(t===null)throw new Error("pattern is null");this.patternInput=t;let r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),n instanceof Zr?this.resetMatcherInput(n):Array.isArray(n)?this.resetMatcherInput(ci.utf8(n)):this.resetMatcherInput(ci.utf16(n))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(t){if(t===null)throw new Error("input is null");return this.matcherInput=t,this.reset(),this}start(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new rr(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new rr(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){let s=this.namedGroups[t];if(!Number.isFinite(s))throw new rr(`group '${t}' not found`);t=s}let n=this.start(t),r=this.end(t);return n<0&&r<0?null:this.substring(n,r)}groupCount(){return this.patternGroupCount}loadGroup(t){if(t<0||t>this.patternGroupCount)throw new rr(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new rr("perhaps no match attempted");if(t===0||this.hasGroups)return;let n=this.groups[1]+1;n>this.matcherInputLength&&(n=this.matcherInputLength);let r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],n,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new rr("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,te.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,te.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new rr(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}return t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1]&&t++),this.genMatch(t,te.UNANCHORED)}genMatch(t,n){let r=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,n,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=n,!0):!1}substring(t,n){return this.matcherInput.isUTF8Encoding()?We.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,n)):this.matcherInput.asCharSequence().substring(t,n).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,n=!1){let r="",s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=n?this.appendReplacementInternalPerl(t):this.appendReplacementInternal(t),r}appendReplacementInternal(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++){if(t.codePointAt(i)===j.CODES.get("\\")){r<i&&(n+=t.substring(r,i)),i++,r=i;continue}if(t.codePointAt(i)===j.CODES.get("$")){let o=t.codePointAt(i+1);if(j.CODES.get("0")<=o&&o<=j.CODES.get("9")){let a=o-j.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<j.CODES.get("0")||o>j.CODES.get("9")||a*10+o-j.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-j.CODES.get("0");if(a>this.patternGroupCount)throw new rr(`n > number of groups: ${a}`);let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===j.CODES.get("{")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==j.CODES.get("}")&&t.codePointAt(a)!==j.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==j.CODES.get("}"))throw new rr("named capture group is missing trailing '}'");let l=t.substring(i+1,a);n+=this.group(l),r=a+1}}}return r<s&&(n+=t.substring(r,s)),n}appendReplacementInternalPerl(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++)if(t.codePointAt(i)===j.CODES.get("$")){let o=t.codePointAt(i+1);if(j.CODES.get("$")===o){r<i&&(n+=t.substring(r,i)),n+="$",i++,r=i+1;continue}else if(j.CODES.get("&")===o){r<i&&(n+=t.substring(r,i));let a=this.group(0);a!==null?n+=a:n+="$&",i++,r=i+1;continue}else if(j.CODES.get("1")<=o&&o<=j.CODES.get("9")){let a=o-j.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<j.CODES.get("0")||o>j.CODES.get("9")||a*10+o-j.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-j.CODES.get("0");if(a>this.patternGroupCount){n+=`$${a}`,r=i,i--;continue}let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===j.CODES.get("<")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==j.CODES.get(">")&&t.codePointAt(a)!==j.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==j.CODES.get(">")){n+=t.substring(i-1,a+1),r=a+1;continue}let l=t.substring(i+1,a);Object.prototype.hasOwnProperty.call(this.namedGroups,l)?n+=this.group(l):n+=`$<${l}>`,r=a+1}}return r<s&&(n+=t.substring(r,s)),n}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,n=!1){return this.replace(t,!0,n)}replaceFirst(t,n=!1){return this.replace(t,!1,n)}replace(t,n=!0,r=!1){let s="";for(this.reset();this.find()&&(s+=this.appendReplacement(t,r),!!n););return s+=this.appendTail(),s}},ke=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(t){let n='"';for(let r of t)n+=We.escapeRune(r);return n+='"',n}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=[]}matchRune(t){if(this.runes.length===1){let s=this.runes[0];return(this.arg&te.FOLD_CASE)!==0?Ce.equalsIgnoreCase(s,t):t===s}for(let s=0;s<this.runes.length&&s<=8;s+=2){if(t<this.runes[s])return!1;if(t<=this.runes[s+1])return!0}let n=0,r=this.runes.length/2|0;for(;n<r;){let s=n+((r-n)/2|0);if(this.runes[2*s]<=t){if(t<=this.runes[2*s+1])return!0;n=s+1}else r=s}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return"match";case e.FAIL:return"fail";case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?"rune <null>":["rune ",e.escapeRunes(this.runes),(this.arg&te.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},Yc=class{constructor(){this.inst=null,this.cap=[]}},ga=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(t){let n=this.sparse[t];return n<this.size&&this.densePcs[n]===t}isEmpty(){return this.size===0}add(t){let n=this.size++;return this.sparse[t]=n,this.denseThreads[n]=null,this.densePcs[n]=t,n}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let t="{";for(let n=0;n<this.size;n++)n!==0&&(t+=", "),t+=this.densePcs[n];return t+="}",t}},to=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new ga(n.prog.numInst()),n.q1=new ga(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(t){this.ncap=t,t>this.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}}initNewCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}this.matchcap=Array(t).fill(0)}submatches(){return this.ncap===0?We.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(t){let n;return this.poolSize>0?(this.poolSize--,n=this.pool[this.poolSize]):n=new Yc,n.inst=t,n}freeQueue(t,n=0){let r=t.size-n,s=this.poolSize+r;this.pool.length<s&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,s)));for(let i=n;i<t.size;i++){let o=t.denseThreads[i];o!==null&&(this.pool[this.poolSize]=o,this.poolSize++)}t.clear()}freeThread(t){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=t,this.poolSize++}match(t,n,r){let s=this.re2.cond;if(s===We.EMPTY_ALL||(r===te.ANCHOR_START||r===te.ANCHOR_BOTH)&&n!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,o=this.q1,a=t.step(n),l=a>>3,c=a&7,u=-1,f=0;a!==xr.EOF()&&(a=t.step(n+c),u=a>>3,f=a&7);let d;for(n===0?d=We.emptyOpContext(-1,l):d=t.context(n);;){if(i.isEmpty()){if((s&We.EMPTY_BEGIN_TEXT)!==0&&n!==0||this.matched)break;if(this.re2.prefix.length!==0&&u!==this.re2.prefixRune&&t.canCheckPrefix()){let m=t.index(this.re2,n);if(m<0)break;n+=m,a=t.step(n),l=a>>3,c=a&7,a=t.step(n+c),u=a>>3,f=a&7}}!this.matched&&(n===0||r===te.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=n),this.add(i,this.prog.start,n,this.matchcap,d,null));let p=n+c;if(d=t.context(p),this.step(i,o,n,p,l,d,r,n===t.endPos()),c===0||this.ncap===0&&this.matched)break;n+=c,l=u,c=f,l!==-1&&(a=t.step(n+c),u=a>>3,f=a&7);let h=i;i=o,o=h}return this.freeQueue(o),this.matched}step(t,n,r,s,i,o,a,l){let c=this.re2.longest;for(let u=0;u<t.size;u++){let f=t.denseThreads[u];if(f===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<f.cap[0]){this.freeThread(f);continue}let d=f.inst,p=!1;switch(d.op){case ke.MATCH:if(a===te.ANCHOR_BOTH&&!l)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<r)&&(f.cap[1]=r,this.matchcap=f.cap.slice(0,this.ncap)),c||this.freeQueue(t,u+1),this.matched=!0;break;case ke.RUNE:p=d.matchRune(i);break;case ke.RUNE1:p=i===d.runes[0];break;case ke.RUNE_ANY:p=!0;break;case ke.RUNE_ANY_NOT_NL:p=i!==j.CODES.get(`
164
+ `);break;default:throw new Error("bad inst")}p&&(f=this.add(n,d.out,s,f.cap,o,f)),f!==null&&(this.freeThread(f),t.denseThreads[u]=null)}t.clear()}add(t,n,r,s,i,o){if(n===0||t.contains(n))return o;let a=t.add(n),l=this.prog.inst[n];switch(l.op){case ke.FAIL:break;case ke.ALT:case ke.ALT_MATCH:o=this.add(t,l.out,r,s,i,o),o=this.add(t,l.arg,r,s,i,o);break;case ke.EMPTY_WIDTH:(l.arg&~i)===0&&(o=this.add(t,l.out,r,s,i,o));break;case ke.NOP:o=this.add(t,l.out,r,s,i,o);break;case ke.CAPTURE:if(l.arg<this.ncap){let c=s[l.arg];s[l.arg]=r,this.add(t,l.out,r,s,i,null),s[l.arg]=c}else o=this.add(t,l.out,r,s,i,o);break;case ke.MATCH:case ke.RUNE:case ke.RUNE1:case ke.RUNE_ANY:case ke.RUNE_ANY_NOT_NL:o===null?o=this.alloc(l):o.inst=l,this.ncap>0&&o.cap!==s&&(o.cap=s.slice(0,this.ncap)),t.denseThreads[a]=o,o=null;break;default:throw new Error("unhandled")}return o}},Lb=e=>{let t=-2128831035;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return t},Fb=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Jc=class{constructor(t,n){this.nfaStates=t,this.isMatch=n,this.nextAscii=new Array(Ce.MAX_ASCII+1).fill(null),this.nextMap=new Map}},eu=class{constructor(t){this.prog=t,this.stateCache=new Map,this.stateCount=0,this.startState=null,this.stateLimit=1e4}computeClosure(t){let n=new Set,r=[...t],s=!1;for(;r.length>0;){let o=r.pop();if(n.has(o))continue;n.add(o);let a=this.prog.getInst(o);switch(a.op){case ke.MATCH:s=!0;break;case ke.ALT:case ke.ALT_MATCH:r.push(a.out),r.push(a.arg);break;case ke.NOP:case ke.CAPTURE:r.push(a.out);break;case ke.EMPTY_WIDTH:return null}}return{pcs:Int32Array.from(n).sort(),isMatch:s}}getState(t){let n=this.computeClosure(t);if(!n)return null;let r=n.pcs,s=Lb(r),i=this.stateCache.get(s);if(i)for(let a=0;a<i.length;a++){let l=i[a];if(Fb(l.nfaStates,r))return l}else i=[],this.stateCache.set(s,i);if(this.stateCount>=this.stateLimit)return this.stateCache.clear(),this.stateCount=0,this.startState=null,null;let o=new Jc(r,n.isMatch);return i.push(o),this.stateCount++,o}step(t,n,r){if(r===te.UNANCHORED&&n<=Ce.MAX_ASCII){let o=t.nextAscii[n];if(o!==null)return o}else{let o=n+(r===te.UNANCHORED?0:Ce.MAX_RUNE+1);if(t.nextMap.has(o))return t.nextMap.get(o)}let s=[];for(let o=0;o<t.nfaStates.length;o++){let a=t.nfaStates[o],l=this.prog.getInst(a);ke.isRuneOp(l.op)&&l.matchRune(n)&&s.push(l.out)}r===te.UNANCHORED&&s.push(this.prog.start);let i=this.getState(s);if(r===te.UNANCHORED&&n<=Ce.MAX_ASCII)t.nextAscii[n]=i;else{let o=n+(r===te.UNANCHORED?0:Ce.MAX_RUNE+1);t.nextMap.set(o,i)}return i}match(t,n,r){if((r===te.ANCHOR_START||r===te.ANCHOR_BOTH)&&n!==0)return!1;if(!this.startState&&(this.startState=this.getState([this.prog.start]),!this.startState))return null;let s=t.endPos(),i=this.startState;if(i.isMatch)if(r===te.ANCHOR_BOTH){if(n===s)return!0}else return!0;let o=n;for(;o<s;){let a=t.step(o),l=a>>3,c=a&7;if(c===0)break;if(i=this.step(i,l,r),i===null)return null;if(i.isMatch)if(r===te.ANCHOR_BOTH){if(o+c===s)return!0}else return!0;if(i.nfaStates.length===0&&r!==te.UNANCHORED)return!1;o+=c}return!1}},H=class e{static Op=$1(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===j.CODES.get("-")?"\\":""}static fromRegexp(t){let n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t="";switch(this.op){case e.Op.NO_MATCH:t+="[^\\x00-\\x{10FFFF}]";break;case e.Op.EMPTY_MATCH:t+="(?:)";break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{let n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+="*";break;case e.Op.PLUS:t+="+";break;case e.Op.QUEST:t+="?";break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=",",this.max>=0&&(t+=this.max)),t+="}";break}(this.flags&te.NON_GREEDY)!==0&&(t+="?");break}case e.Op.CONCAT:{for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break}case e.Op.ALTERNATE:{let n="";for(let r of this.subs)t+=n,n="|",t+=r.appendTo();break}case e.Op.LITERAL:(this.flags&te.FOLD_CASE)!==0&&(t+="(?i:");for(let n of this.runes)t+=We.escapeRune(n);(this.flags&te.FOLD_CASE)!==0&&(t+=")");break;case e.Op.ANY_CHAR_NOT_NL:t+="(?-s:.)";break;case e.Op.ANY_CHAR:t+="(?s:.)";break;case e.Op.CAPTURE:this.name===null||this.name.length===0?t+="(":t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=")";break;case e.Op.BEGIN_TEXT:t+="\\A";break;case e.Op.END_TEXT:(this.flags&te.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";break;case e.Op.BEGIN_LINE:t+="^";break;case e.Op.END_LINE:t+="$";break;case e.Op.WORD_BOUNDARY:t+="\\b";break;case e.Op.NO_WORD_BOUNDARY:t+="\\B";break;case e.Op.CHAR_CLASS:if(this.runes.length%2!==0){t+="[invalid char class]";break}if(t+="[",this.runes.length===0)t+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===Ce.MAX_RUNE){t+="^";for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,s=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=We.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=We.escapeRune(s))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],s=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=We.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=We.escapeRune(s))}t+="]";break;default:t+=this.op;break}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let n of this.subs){let r=n.maxCap();t<r&&(t=r)}return t}equals(t){if(!(t!==null&&t instanceof e)||this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:{if((this.flags&te.WAS_DOLLAR)!==(t.flags&te.WAS_DOLLAR))return!1;break}case e.Op.LITERAL:case e.Op.CHAR_CLASS:{if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let n=0;n<this.runes.length;n++)if(this.runes[n]!==t.runes[n])return!1;break}case e.Op.ALTERNATE:case e.Op.CONCAT:{if(this.subs.length!==t.subs.length)return!1;for(let n=0;n<this.subs.length;++n)if(!this.subs[n].equals(t.subs[n]))return!1;break}case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:{if((this.flags&te.NON_GREEDY)!==(t.flags&te.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.REPEAT:{if((this.flags&te.NON_GREEDY)!==(t.flags&te.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.CAPTURE:{if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break}}return!0}},tu=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(t){return this.inst[t]}numInst(){return this.inst.length}addInst(t){this.inst.push(new ke(t))}skipNop(t){let n=this.inst[t];for(;n.op===ke.NOP||n.op===ke.CAPTURE;)n=this.inst[t],t=n.out;return n}prefix(){let t="",n=this.skipNop(this.start);if(!ke.isRuneOp(n.op)||n.runes.length!==1)return[n.op===ke.MATCH,t];for(;ke.isRuneOp(n.op)&&n.runes.length===1&&(n.arg&te.FOLD_CASE)===0;)t+=String.fromCodePoint(n.runes[0]),n=this.skipNop(n.out);return[n.op===ke.MATCH,t]}startCond(){let t=0,n=this.start;e:for(;;){let r=this.inst[n];switch(r.op){case ke.EMPTY_WIDTH:t|=r.arg;break;case ke.FAIL:return-1;case ke.CAPTURE:case ke.NOP:break;default:break e}n=r.out}return t}next(t){let n=this.inst[t>>1];return(t&1)===0?n.out:n.arg}patch(t,n){for(;t!==0;){let r=this.inst[t>>1];(t&1)===0?(t=r.out,r.out=n):(t=r.arg,r.arg=n)}}append(t,n){if(t===0)return n;if(n===0)return t;let r=t;for(;;){let i=this.next(r);if(i===0)break;r=i}let s=this.inst[r>>1];return(r&1)===0?s.out=n:s.arg=n,t}toString(){let t="";for(let n=0;n<this.inst.length;n++){let r=t.length;t+=n,n===this.start&&(t+="*"),t+=" ".substring(t.length-r),t+=this.inst[n],t+=`
165
+ `}return t}},li=class{constructor(t=0,n=0,r=!1){this.i=t,this.out=n,this.nullable=r}},nu=class e{static ANY_RUNE_NOT_NL(){return[0,j.CODES.get(`
166
+ `)-1,j.CODES.get(`
167
+ `)+1,Ce.MAX_RUNE]}static ANY_RUNE(){return[0,Ce.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(ke.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new tu,this.newInst(ke.FAIL)}newInst(t){return this.prog.addInst(t),new li(this.prog.numInst()-1,0,!0)}nop(){let t=this.newInst(ke.NOP);return t.out=t.i<<1,t}fail(){return new li}cap(t){let n=this.newInst(ke.CAPTURE);return n.out=n.i<<1,this.prog.getInst(n.i).arg=t,this.prog.numCap<t+1&&(this.prog.numCap=t+1),n}cat(t,n){return t.i===0||n.i===0?this.fail():(this.prog.patch(t.out,n.i),new li(t.i,n.out,t.nullable&&n.nullable))}alt(t,n){if(t.i===0)return n;if(n.i===0)return t;let r=this.newInst(ke.ALT),s=this.prog.getInst(r.i);return s.out=t.i,s.arg=n.i,r.out=this.prog.append(t.out,n.out),r.nullable=t.nullable||n.nullable,r}loop(t,n){let r=this.newInst(ke.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=r.i<<1):(s.out=t.i,r.out=r.i<<1|1),this.prog.patch(t.out,r.i),r}quest(t,n){let r=this.newInst(ke.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=r.i<<1):(s.out=t.i,r.out=r.i<<1|1),r.out=this.prog.append(r.out,t.out),r}star(t,n){return t.nullable?this.quest(this.plus(t,n),n):this.loop(t,n)}plus(t,n){return new li(t.i,this.loop(t,n).out,t.nullable)}empty(t){let n=this.newInst(ke.EMPTY_WIDTH);return this.prog.getInst(n.i).arg=t,n.out=n.i<<1,n}rune(t,n){let r=this.newInst(ke.RUNE);r.nullable=!1;let s=this.prog.getInst(r.i);return s.runes=t,n&=te.FOLD_CASE,(t.length!==1||Ce.simpleFold(t[0])===t[0])&&(n&=-2),s.arg=n,r.out=r.i<<1,(n&te.FOLD_CASE)===0&&t.length===1||t.length===2&&t[0]===t[1]?s.op=ke.RUNE1:t.length===2&&t[0]===0&&t[1]===Ce.MAX_RUNE?s.op=ke.RUNE_ANY:t.length===4&&t[0]===0&&t[1]===j.CODES.get(`
168
+ `)-1&&t[2]===j.CODES.get(`
169
+ `)+1&&t[3]===Ce.MAX_RUNE&&(s.op=ke.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case H.Op.NO_MATCH:return this.fail();case H.Op.EMPTY_MATCH:return this.nop();case H.Op.LITERAL:if(t.runes.length===0)return this.nop();{let n=null;for(let r of t.runes){let s=this.rune([r],t.flags);n=n===null?s:this.cat(n,s)}return n}case H.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case H.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case H.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case H.Op.BEGIN_LINE:return this.empty(We.EMPTY_BEGIN_LINE);case H.Op.END_LINE:return this.empty(We.EMPTY_END_LINE);case H.Op.BEGIN_TEXT:return this.empty(We.EMPTY_BEGIN_TEXT);case H.Op.END_TEXT:return this.empty(We.EMPTY_END_TEXT);case H.Op.WORD_BOUNDARY:return this.empty(We.EMPTY_WORD_BOUNDARY);case H.Op.NO_WORD_BOUNDARY:return this.empty(We.EMPTY_NO_WORD_BOUNDARY);case H.Op.CAPTURE:{let n=this.cap(t.cap<<1),r=this.compile(t.subs[0]),s=this.cap(t.cap<<1|1);return this.cat(this.cat(n,r),s)}case H.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.CONCAT:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.cat(n,s)}return n}}case H.Op.ALTERNATE:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.alt(n,s)}return n}}default:throw new Kc("regexp: unhandled case in compile")}}},ru=class e{static simplify(t){if(t===null)return null;switch(t.op){case H.Op.CAPTURE:case H.Op.CONCAT:case H.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let s=t.subs[r],i=e.simplify(s);n===t&&i!==s&&(n=H.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case H.Op.STAR:case H.Op.PLUS:case H.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case H.Op.REPEAT:{if(t.min===0&&t.max===0)return new H(H.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(H.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(H.Op.PLUS,t.flags,n,null);let s=new H(H.Op.CONCAT),i=[];for(let o=0;o<t.min-1;o++)i.push(n);return i.push(e.simplify1(H.Op.PLUS,t.flags,n,null)),s.subs=i.slice(0),s}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let s=0;s<t.min;s++)r.push(n)}if(t.max>t.min){let s=e.simplify1(H.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let o=new H(H.Op.CONCAT);o.subs=[n,s],s=e.simplify1(H.Op.QUEST,t.flags,o,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new H(H.Op.CONCAT);return s.subs=r.slice(0),s}return new H(H.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===H.Op.EMPTY_MATCH||t===r.op&&(n&te.NON_GREEDY)===(r.flags&te.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&te.NON_GREEDY)===(n&te.NON_GREEDY)&&r===s.subs[0]||(s=new H(t),s.flags=n,s.subs=[r]),s)}},ze=class{constructor(t,n){this.sign=t,this.cls=n}},p1=[48,57],h1=[9,10,12,13,32,32],m1=[48,57,65,90,95,95,97,122],g1=new Map([["\\d",new ze(1,p1)],["\\D",new ze(-1,p1)],["\\s",new ze(1,h1)],["\\S",new ze(-1,h1)],["\\w",new ze(1,m1)],["\\W",new ze(-1,m1)]]),y1=[48,57,65,90,97,122],w1=[65,90,97,122],b1=[0,127],x1=[9,9,32,32],E1=[0,31,127,127],S1=[48,57],A1=[33,126],C1=[97,122],v1=[32,126],k1=[33,47,58,64,91,96,123,126],N1=[9,13,32,32],I1=[65,90],O1=[48,57,65,90,95,95,97,122],T1=[48,57,65,70,97,102],R1=new Map([["[:alnum:]",new ze(1,y1)],["[:^alnum:]",new ze(-1,y1)],["[:alpha:]",new ze(1,w1)],["[:^alpha:]",new ze(-1,w1)],["[:ascii:]",new ze(1,b1)],["[:^ascii:]",new ze(-1,b1)],["[:blank:]",new ze(1,x1)],["[:^blank:]",new ze(-1,x1)],["[:cntrl:]",new ze(1,E1)],["[:^cntrl:]",new ze(-1,E1)],["[:digit:]",new ze(1,S1)],["[:^digit:]",new ze(-1,S1)],["[:graph:]",new ze(1,A1)],["[:^graph:]",new ze(-1,A1)],["[:lower:]",new ze(1,C1)],["[:^lower:]",new ze(-1,C1)],["[:print:]",new ze(1,v1)],["[:^print:]",new ze(-1,v1)],["[:punct:]",new ze(1,k1)],["[:^punct:]",new ze(-1,k1)],["[:space:]",new ze(1,N1)],["[:^space:]",new ze(-1,N1)],["[:upper:]",new ze(1,I1)],["[:^upper:]",new ze(-1,I1)],["[:word:]",new ze(1,O1)],["[:^word:]",new ze(-1,O1)],["[:xdigit:]",new ze(1,T1)],["[:^xdigit:]",new ze(-1,T1)]]),br=class e{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");let i=t[s],o=t[s+1];i===o?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${o.toString(16)}`}return r+="]",r}static cmp(t,n,r,s){let i=t[n]-r;return i!==0?i:s-t[n+1]}static qsortIntPair(t,n,r){let s=((n+r)/2|0)&-2,i=t[s],o=t[s+1],a=n,l=r;for(;a<=l;){for(;a<r&&e.cmp(t,a,i,o)<0;)a+=2;for(;l>n&&e.cmp(t,l,i,o)>0;)l-=2;if(a<=l){if(a!==l){let c=t[a];t[a]=t[l],t[l]=c,c=t[a+1],t[a+1]=t[l+1],t[l+1]=c}a+=2,l-=2}}n<l&&e.qsortIntPair(t,n,l),a<r&&e.qsortIntPair(t,a,r)}constructor(t=We.emptyInts()){this.r=t,this.len=t.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let n=2;n<this.len;n+=2){let r=this.r[n],s=this.r[n+1];if(r<=this.r[t-1]+1){s>this.r[t-1]&&(this.r[t-1]=s);continue}this.r[t]=r,this.r[t+1]=s,t+=2}return this.len=t,this}appendLiteral(t,n){return(n&te.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,n){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){let s=this.r[this.len-r],i=this.r[this.len-r+1];if(t<=i+1&&s<=n+1)return t<s&&(this.r[this.len-r]=t),n>i&&(this.r[this.len-r+1]=n),this}}return this.r[this.len++]=t,this.r[this.len++]=n,this}appendFoldedRange(t,n){if(t<=Ce.MIN_FOLD&&n>=Ce.MAX_FOLD)return this.appendRange(t,n);if(n<Ce.MIN_FOLD||t>Ce.MAX_FOLD)return this.appendRange(t,n);t<Ce.MIN_FOLD&&(this.appendRange(t,Ce.MIN_FOLD-1),t=Ce.MIN_FOLD),n>Ce.MAX_FOLD&&(this.appendRange(Ce.MAX_FOLD+1,n),n=Ce.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=Ce.simpleFold(r);s!==r;s=Ce.simpleFold(s))this.appendRange(s,s)}return this}appendClass(t){for(let n=0;n<t.length;n+=2)this.appendRange(t[n],t[n+1]);return this}appendFoldedClass(t){for(let n=0;n<t.length;n+=2)this.appendFoldedRange(t[n],t[n+1]);return this}appendNegatedClass(t){let n=0;for(let r=0;r<t.length;r+=2){let s=t[r],i=t[r+1];n<=s-1&&this.appendRange(n,s-1),n=i+1}return n<=Ce.MAX_RUNE&&this.appendRange(n,Ce.MAX_RUNE),this}appendTable(t){for(let n=0;n<t.length;++n){let r=t.getLo(n),s=t.getHi(n),i=t.getStride(n);if(i===1){this.appendRange(r,s);continue}for(let o=r;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){let s=t.getLo(r),i=t.getHi(r),o=t.getStride(r);if(o===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let a=s;a<=i;a+=o)n<=a-1&&this.appendRange(n,a-1),n=a+1}return n<=Ce.MAX_RUNE&&this.appendRange(n,Ce.MAX_RUNE),this}appendTableWithSign(t,n){return n<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,n=0;for(let r=0;r<this.len;r+=2){let s=this.r[r],i=this.r[r+1];t<=s-1&&(this.r[n]=t,this.r[n+1]=s-1,n+=2),t=i+1}return this.len=n,t<=Ce.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=Ce.MAX_RUNE),this}appendClassWithSign(t,n){return n<0?this.appendNegatedClass(t):this.appendClass(t)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},no=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},su=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){let t=this.str.codePointAt(this.position);return this.position+=We.charCount(t),t}lookingAt(t){return this.rest().startsWith(t)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},iu=class e{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static MAX_HEIGHT=1e3;static MAX_SIZE=3355443;static MAX_RUNES=33554432;static ANY_TABLE=new P(new Uint32Array([0,Ce.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?no.of(e.ANY_TABLE,e.ANY_TABLE):Un.CATEGORIES.has(t)?no.of(Un.CATEGORIES.get(t),Un.FOLD_CATEGORIES.get(t)):Un.SCRIPTS.has(t)?no.of(Un.SCRIPTS.get(t),Un.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<Ce.MIN_FOLD||t>Ce.MAX_FOLD)return t;let n=t,r=t;for(t=Ce.simpleFold(t);t!==r;t=Ce.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===H.Op.EMPTY_MATCH)return null;if(t.op===H.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===H.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new H(H.Op.LITERAL);return r.flags=n,r.runes=We.stringToRunes(t),r}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let s;if(!t.lookingAt(","))s=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))s=-1;else if((s=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new it(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&Ce.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.codePointAt(n);if(r!==j.CODES.get("_")&&!We.isalnum(r))return!1}return!0}static parseInt(t){let n=t.pos();for(;t.more()&&t.peek()>=j.CODES.get("0")&&t.peek()<=j.CODES.get("9");)t.skip(1);let r=t.from(n);return r.length===0||r.length>1&&r.codePointAt(0)===j.CODES.get("0")?-1:r.length>8?-2:parseFloat(r,10)}static isCharClass(t){return t.op===H.Op.LITERAL&&t.runes.length===1||t.op===H.Op.CHAR_CLASS||t.op===H.Op.ANY_CHAR_NOT_NL||t.op===H.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case H.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case H.Op.CHAR_CLASS:for(let r=0;r<t.runes.length;r+=2)if(t.runes[r]<=n&&n<=t.runes[r+1])return!0;return!1;case H.Op.ANY_CHAR_NOT_NL:return n!==j.CODES.get(`
170
+ `);case H.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case H.Op.ANY_CHAR:break;case H.Op.ANY_CHAR_NOT_NL:e.matchRune(n,j.CODES.get(`
171
+ `))&&(t.op=H.Op.ANY_CHAR);break;case H.Op.CHAR_CLASS:n.op===H.Op.LITERAL?t.runes=new br(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new br(t.runes).appendClass(n.runes).toArray();break;case H.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=H.Op.CHAR_CLASS,t.runes=new br().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toArray();break}}static parseEscape(t){let n=t.pos();if(t.skip(1),!t.more())throw new it(e.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case j.CODES.get("1"):case j.CODES.get("2"):case j.CODES.get("3"):case j.CODES.get("4"):case j.CODES.get("5"):case j.CODES.get("6"):case j.CODES.get("7"):if(!t.more()||t.peek()<j.CODES.get("0")||t.peek()>j.CODES.get("7"))break;case j.CODES.get("0"):{let s=r-j.CODES.get("0");for(let i=1;i<3&&!(!t.more()||t.peek()<j.CODES.get("0")||t.peek()>j.CODES.get("7"));i++)s=s*8+t.peek()-j.CODES.get("0"),t.skip(1);return s}case j.CODES.get("x"):{if(!t.more())break;if(r=t.pop(),r===j.CODES.get("{")){let o=0,a=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===j.CODES.get("}"))break;let l=We.unhex(r);if(l<0||(a=a*16+l,a>Ce.MAX_RUNE))break e;o++}if(o===0)break e;return a}let s=We.unhex(r);if(!t.more())break;r=t.pop();let i=We.unhex(r);if(s<0||i<0)break;return s*16+i}case j.CODES.get("a"):return j.CODES.get("\x07");case j.CODES.get("f"):return j.CODES.get("\f");case j.CODES.get("n"):return j.CODES.get(`
172
+ `);case j.CODES.get("r"):return j.CODES.get("\r");case j.CODES.get("t"):return j.CODES.get(" ");case j.CODES.get("v"):return j.CODES.get("\v");default:if(r<=Ce.MAX_ASCII&&!We.isalnum(r))return r;break}throw new it(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new it(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt("\\")?e.parseEscape(t):t.pop()}static concatRunes(t,n){return[...t,...n]}constructor(t,n=0){this.wholeRegexp=t,this.flags=n,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null}newRegexp(t){let n=this.free;return n!==null&&n.subs!==null&&n.subs.length>0?(this.free=n.subs[0],n.reinit(),n.op=t):(n=new H(t),this.numRegexp+=1),n}reuse(t){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,t)&&delete this.height[t],t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>e.MAX_RUNES)throw new it(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===H.Op.REPEAT){let n=t.max;n===-1&&(n=t.min),n<=0&&(n=1),n>e.MAX_SIZE/this.repeats?this.repeats=e.MAX_SIZE:this.repeats*=n}if(this.numRegexp<e.MAX_SIZE/this.repeats)return;this.size={};for(let n of this.stack)this.checkSize(n)}if(this.calcSize(t,!0)>e.MAX_SIZE)throw new it(e.ERR_LARGE)}calcSize(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.size,t))return this.size[t];let r=0;switch(t.op){case H.Op.LITERAL:{r=t.runes.length;break}case H.Op.CAPTURE:case H.Op.STAR:{r=2+this.calcSize(t.subs[0]);break}case H.Op.PLUS:case H.Op.QUEST:{r=1+this.calcSize(t.subs[0]);break}case H.Op.CONCAT:{for(let s of t.subs)r=r+this.calcSize(s);break}case H.Op.ALTERNATE:{for(let s of t.subs)r=r+this.calcSize(s);t.subs.length>1&&(r=r+t.subs.length-1);break}case H.Op.REPEAT:{let s=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?r=2+s:r=1+t.min*s;break}r=t.max*s+(t.max-t.min);break}}return r=Math.max(1,r),this.size[t]=r,r}checkHeight(t){if(!(this.numRegexp<e.MAX_HEIGHT)){if(this.height===null){this.height={};for(let n of this.stack)this.checkHeight(n)}if(this.calcHeight(t,!0)>e.MAX_HEIGHT)throw new it(e.ERR_NESTING_DEPTH)}}calcHeight(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.height,t))return this.height[t];let r=1;for(let s of t.subs){let i=this.calcHeight(s);r<1+i&&(r=1+i)}return this.height[t]=r,r}pop(){return this.stack.pop()}popToPseudo(){let t=this.stack.length,n=t;for(;n>0&&!H.isPseudoOp(this.stack[n-1].op);)n--;let r=this.stack.slice(n,t);return this.stack=this.stack.slice(0,n),r}push(t){if(this.numRunes+=t.runes.length,t.op===H.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&-2))return null;t.op=H.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===H.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&Ce.simpleFold(t.runes[0])===t.runes[2]&&Ce.simpleFold(t.runes[2])===t.runes[0]||t.op===H.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&Ce.simpleFold(t.runes[0])===t.runes[1]&&Ce.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|te.FOLD_CASE))return null;t.op=H.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|te.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let s=this.stack[r-1],i=this.stack[r-2];return s.op!==H.Op.LITERAL||i.op!==H.Op.LITERAL||(s.flags&te.FOLD_CASE)!==(i.flags&te.FOLD_CASE)?!1:(i.runes=e.concatRunes(i.runes,s.runes),t>=0?(s.runes=[t],s.flags=n,!0):(this.pop(),this.reuse(s),!1))}newLiteral(t,n){let r=this.newRegexp(H.Op.LITERAL);return r.flags=n,(n&te.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){let n=this.newRegexp(t);return n.flags=this.flags,this.push(n)}repeat(t,n,r,s,i,o){let a=this.flags;if((a&te.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=te.NON_GREEDY),o!==-1))throw new it(e.ERR_INVALID_REPEAT_OP,i.from(o));let l=this.stack.length;if(l===0)throw new it(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let c=this.stack[l-1];if(H.isPseudoOp(c.op))throw new it(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=a,u.subs=[c],this.stack[l-1]=u,this.checkLimits(u),t===H.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new it(e.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===H.Op.REPEAT){let r=t.max;if(r===0)return!0;if(r<0&&(r=t.min),r>n)return!1;r>0&&(n=Math.trunc(n/r))}for(let r of t.subs)if(!this.repeatIsValid(r,n))return!1;return!0}concat(){this.maybeConcat(-1,0);let t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(H.Op.EMPTY_MATCH)):this.push(this.collapse(t,H.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(H.Op.NO_MATCH)):this.push(this.collapse(t,H.Op.ALTERNATE))}cleanAlt(t){t.op===H.Op.CHAR_CLASS&&(t.runes=new br(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===Ce.MAX_RUNE?(t.runes=[],t.op=H.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===j.CODES.get(`
173
+ `)-1&&t.runes[2]===j.CODES.get(`
174
+ `)+1&&t.runes[3]===Ce.MAX_RUNE&&(t.runes=[],t.op=H.Op.ANY_CHAR_NOT_NL))}collapse(t,n){if(t.length===1)return t[0];let r=0;for(let a of t)r+=a.op===n?a.subs.length:1;let s=new Array(r).fill(null),i=0;for(let a of t)a.op===n?(s.splice(i,a.subs.length,...a.subs),i+=a.subs.length,this.reuse(a)):s[i++]=a;let o=this.newRegexp(n);if(o.subs=s,n===H.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){let a=o;o=o.subs[0],this.reuse(a)}return o}factor(t){if(t.length<2)return t;let n=0,r=t.length,s=0,i=null,o=0,a=0,l=0;for(let u=0;u<=r;u++){let f=null,d=0,p=0;if(u<r){let h=t[n+u];if(h.op===H.Op.CONCAT&&h.subs.length>0&&(h=h.subs[0]),h.op===H.Op.LITERAL&&(f=h.runes,d=h.runes.length,p=h.flags&te.FOLD_CASE),p===a){let m=0;for(;m<o&&m<d&&i[m]===f[m];)m++;if(m>0){o=m;continue}}}if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let h=this.newRegexp(H.Op.LITERAL);h.flags=a,h.runes=i.slice(0,o);for(let b=l;b<u;b++)t[n+b]=this.removeLeadingString(t[n+b],o),this.checkLimits(t[n+b]);let m=this.collapse(t.slice(n+l,n+u),H.Op.ALTERNATE),g=this.newRegexp(H.Op.CONCAT);g.subs=[h,m],t[s++]=g}l=u,i=f,o=d,a=p}r=s,n=0,l=0,s=0;let c=null;for(let u=0;u<=r;u++){let f=null;if(!(u<r&&(f=e.leadingRegexp(t[n+u]),c!==null&&c.equals(f)&&(e.isCharClass(c)||c.op===H.Op.REPEAT&&c.min===c.max&&e.isCharClass(c.subs[0]))))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let d=c;for(let m=l;m<u;m++){let g=m!==l;t[n+m]=this.removeLeadingRegexp(t[n+m],g),this.checkLimits(t[n+m])}let p=this.collapse(t.slice(n+l,n+u),H.Op.ALTERNATE),h=this.newRegexp(H.Op.CONCAT);h.subs=[d,p],t[s++]=h}l=u,c=f}}r=s,n=0,l=0,s=0;for(let u=0;u<=r;u++)if(!(u<r&&e.isCharClass(t[n+u]))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let f=l;for(let p=l+1;p<u;p++){let h=t[n+f],m=t[n+p];(h.op<m.op||h.op===m.op&&(h.runes!==null?h.runes.length:0)<(m.runes!==null?m.runes.length:0))&&(f=p)}let d=t[n+l];t[n+l]=t[n+f],t[n+f]=d;for(let p=l+1;p<u;p++)e.mergeCharClass(t[n+l],t[n+p]),this.reuse(t[n+p]);this.cleanAlt(t[n+l]),t[s++]=t[n+l]}u<r&&(t[s++]=t[n+u]),l=u+1}r=s,n=0,l=0,s=0;for(let u=0;u<r;++u)u+1<r&&t[n+u].op===H.Op.EMPTY_MATCH&&t[n+u+1].op===H.Op.EMPTY_MATCH||(t[s++]=t[n+u]);return r=s,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===H.Op.CONCAT&&t.subs.length>0){let r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===H.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=H.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let s=t;t=t.subs[1],this.reuse(s);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===H.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=H.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===H.Op.CONCAT&&t.subs.length>0){switch(n&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=H.Op.EMPTY_MATCH,t.subs=H.emptySubs();break}case 1:{let r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(H.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&te.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,s=new su(this.wholeRegexp);for(;s.more();){let o=-1;e:switch(s.peek()){case j.CODES.get("("):if((this.flags&te.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(H.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case j.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case j.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case j.CODES.get("^"):(this.flags&te.ONE_LINE)!==0?this.op(H.Op.BEGIN_TEXT):this.op(H.Op.BEGIN_LINE),s.skip(1);break;case j.CODES.get("$"):(this.flags&te.ONE_LINE)!==0?this.op(H.Op.END_TEXT).flags|=te.WAS_DOLLAR:this.op(H.Op.END_LINE),s.skip(1);break;case j.CODES.get("."):(this.flags&te.DOT_NL)!==0?this.op(H.Op.ANY_CHAR):this.op(H.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case j.CODES.get("["):this.parseClass(s);break;case j.CODES.get("*"):case j.CODES.get("+"):case j.CODES.get("?"):{o=s.pos();let a=null;switch(s.pop()){case j.CODES.get("*"):a=H.Op.STAR;break;case j.CODES.get("+"):a=H.Op.PLUS;break;case j.CODES.get("?"):a=H.Op.QUEST;break}this.repeat(a,n,r,o,s,t);break}case j.CODES.get("{"):{o=s.pos();let a=e.parseRepeat(s);if(a<0){s.rewindTo(o),this.literal(s.pop());break}n=a>>16,r=(a&Ce.MAX_BMP)<<16>>16,this.repeat(H.Op.REPEAT,n,r,o,s,t);break}case j.CODES.get("\\"):{let a=s.pos();if(s.skip(1),(this.flags&te.PERL_X)!==0&&s.more())switch(s.pop()){case j.CODES.get("A"):this.op(H.Op.BEGIN_TEXT);break e;case j.CODES.get("b"):this.op(H.Op.WORD_BOUNDARY);break e;case j.CODES.get("B"):this.op(H.Op.NO_WORD_BOUNDARY);break e;case j.CODES.get("C"):throw new it(e.ERR_INVALID_ESCAPE,"\\C");case j.CODES.get("Q"):{let f=s.rest(),d=f.indexOf("\\E");d>=0&&(f=f.substring(0,d)),s.skipString(f),s.skipString("\\E");let p=0;for(;p<f.length;){let h=f.codePointAt(p);this.literal(h),p+=We.charCount(h)}break e}case j.CODES.get("z"):this.op(H.Op.END_TEXT);break e;default:s.rewindTo(a);break}let l=this.newRegexp(H.Op.CHAR_CLASS);if(l.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){let u=new br;if(this.parseUnicodeClass(s,u)){l.runes=u.toArray(),this.push(l);break e}}let c=new br;if(this.parsePerlClassEscape(s,c)){l.runes=c.toArray(),this.push(l);break e}s.rewindTo(a),this.reuse(l),this.literal(e.parseEscape(s));break}default:this.literal(s.pop());break}t=o}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new it(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith("(?P<")||r.startsWith("(?<")){let a=r.charAt(2)==="P"?4:3,l=r.indexOf(">");if(l<0)throw new it(e.ERR_INVALID_NAMED_CAPTURE,r);let c=r.substring(a,l);if(t.skipString(c),t.skip(a+1),!e.isValidCaptureName(c))throw new it(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));let u=this.op(H.Op.LEFT_PAREN);if(u.cap=++this.numCap,this.namedGroups[c])throw new it(e.ERR_DUPLICATE_NAMED_CAPTURE,c);this.namedGroups[c]=this.numCap,u.name=c;return}t.skip(2);let s=this.flags,i=1,o=!1;e:for(;t.more();){let a=t.pop();switch(a){case j.CODES.get("i"):s|=te.FOLD_CASE,o=!0;break;case j.CODES.get("m"):s&=-17,o=!0;break;case j.CODES.get("s"):s|=te.DOT_NL,o=!0;break;case j.CODES.get("U"):s|=te.NON_GREEDY,o=!0;break;case j.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case j.CODES.get(":"):case j.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===j.CODES.get(":")&&this.op(H.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new it(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(H.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===H.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let s=r;r=n,n=s,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let n=this.stack[t-1],r=this.stack[t-2];if(r.op===H.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=n,this.stack[t-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new it(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let n=this.pop(),r=this.pop();if(r.op!==H.Op.LEFT_PAREN)throw new it(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(n):(r.op=H.Op.CAPTURE,r.subs=[n],this.push(r))}parsePerlClassEscape(t,n){let r=t.pos();if((this.flags&te.PERL_X)===0||!t.more()||t.pop()!==j.CODES.get("\\")||!t.more())return!1;t.pop();let s=t.from(r),i=g1.has(s)?g1.get(s):null;return i===null?!1:(n.appendGroup(i,(this.flags&te.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),s=r.indexOf(":]");if(s<0)return!1;let i=r.substring(0,s+2);t.skipString(i);let o=R1.has(i)?R1.get(i):null;if(o===null)throw new it(e.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,(this.flags&te.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&te.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let s=1,i=t.pop();if(i===j.CODES.get("P")&&(s=-1),!t.more())throw t.rewindTo(r),new it(e.ERR_INVALID_CHAR_RANGE,t.rest());i=t.pop();let o;if(i!==j.CODES.get("{"))o=We.runeToString(i);else{let u=t.rest(),f=u.indexOf("}");if(f<0)throw t.rewindTo(r),new it(e.ERR_INVALID_CHAR_RANGE,t.rest());o=u.substring(0,f),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===j.CODES.get("^")&&(s=0-s,o=o.substring(1));let a=e.unicodeTable(o);if(a===null)throw new it(e.ERR_INVALID_CHAR_RANGE,t.from(r));let l=a.first,c=a.second;if((this.flags&te.FOLD_CASE)===0||c===null)n.appendTableWithSign(l,s);else{let u=new br().appendTable(l).appendTable(c).cleanClass().toArray();n.appendClassWithSign(u,s)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(H.Op.CHAR_CLASS);r.flags=this.flags;let s=new br,i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),(this.flags&te.CLASS_NL)===0&&s.appendRange(j.CODES.get(`
175
+ `),j.CODES.get(`
176
+ `)));let o=!0;for(;!t.more()||t.peek()!==j.CODES.get("]")||o;){if(t.more()&&t.lookingAt("-")&&(this.flags&te.PERL_X)===0&&!o){let u=t.rest();if(u==="-"||!u.startsWith("-]"))throw t.rewindTo(n),new it(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let a=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,s))continue;t.rewindTo(a)}if(this.parseUnicodeClass(t,s)||this.parsePerlClassEscape(t,s))continue;t.rewindTo(a);let l=e.parseClassChar(t,n),c=l;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(c=e.parseClassChar(t,n),c<l)throw new it(e.ERR_INVALID_CHAR_RANGE,t.from(a))}(this.flags&te.FOLD_CASE)===0?s.appendRange(l,c):s.appendFoldedRange(l,c)}t.skip(1),s.cleanClass(),i<0&&s.negateClass(),r.runes=s.toArray(),this.push(r)}},ou=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}compareAndSet(t,n){return this.value===t?(this.value=n,!0):!1}},au=class e{static initTest(t){let n=e.compile(t),r=new e(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return e.compileImpl(t,te.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,te.POSIX,!0)}static compileImpl(t,n,r){let s=iu.parse(t,n),i=s.maxCap();s=ru.simplify(s);let o=nu.compileRegexp(s),a=new e(t,o,i,r),[l,c]=o.prefix();return a.prefixComplete=l,a.prefix=c,a.prefixUTF8=We.stringToUtf8ByteArray(a.prefix),a.prefix.length>0&&(a.prefixRune=a.prefix.codePointAt(0)),a.namedGroups=s.namedGroups,a}static match(t,n){return e.compile(t).match(n)}constructor(t,n,r=0,s=0){this.expr=t,this.prog=n,this.numSubexp=r,this.longest=s,this.cond=n.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new ou,this.dfa=new eu(n)}executeEngine(t,n,r,s){if(s>0)return this.doExecuteNFA(t,n,r,s);let i=this.dfa.match(t,n,r);return i!==null?i?[]:null:this.doExecuteNFA(t,n,r,s)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,n){let r=this.pooled.get();do r=this.pooled.get(),!n&&r&&(t=to.fromMachine(t),n=!0),t.next!==r&&(t.next=r);while(!this.pooled.compareAndSet(r,t))}toString(){return this.expr}doExecuteNFA(t,n,r,s){let i=this.get(),o=!1;i?i.next!==null&&(i=to.fromMachine(i),o=!0):(i=to.fromRE2(this),o=!0),i.init(s);let a=i.match(t,n,r)?i.submatches():null;return this.put(i,o),a}match(t){return this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,0)!==null}matchWithGroup(t,n,r,s,i){return t instanceof Zr||(t=ci.utf16(t)),this.matchMachineInput(t,n,r,s,i)}matchMachineInput(t,n,r,s,i){if(n>r)return[!1,null];let o=t.isUTF16Encoding()?gt.fromUTF16(t.asCharSequence(),0,r):gt.fromUTF8(t.asBytes(),0,r),a=this.executeEngine(o,n,s,2*i);return a===null?[!1,null]:[!0,a]}matchUTF8(t){return this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,0)!==null}replaceAll(t,n){return this.replaceAllFunc(t,()=>n,2*t.length+1)}replaceFirst(t,n){return this.replaceAllFunc(t,()=>n,1)}replaceAllFunc(t,n,r){let s=0,i=0,o="",a=gt.fromUTF16(t),l=0;for(;i<=t.length;){let c=this.executeEngine(a,i,te.UNANCHORED,2);if(c===null||c.length===0)break;o+=t.substring(s,c[0]),(c[1]>s||c[0]===0)&&(o+=n(t.substring(c[0],c[1])),l++),s=c[1];let u=a.step(i)&7;if(i+u>c[1]?i+=u:i+1>c[1]?i++:i=c[1],l>=r)break}return o+=t.substring(s),o}pad(t){if(t===null)return null;let n=(1+this.numSubexp)*2;if(t.length<n){let r=new Array(n).fill(-1);for(let s=0;s<t.length;s++)r[s]=t[s];t=r}return t}allMatches(t,n,r=s=>s){let s=[],i=t.endPos();n<0&&(n=i+1);let o=0,a=0,l=-1;for(;a<n&&o<=i;){let c=this.executeEngine(t,o,te.UNANCHORED,this.prog.numCap);if(c===null||c.length===0)break;let u=!0;if(c[1]===o){c[0]===l&&(u=!1);let f=t.step(o);f<0?o=i+1:o+=f&7}else o=c[1];l=c[1],u&&(s.push(r(this.pad(c))),a++)}return s}findUTF8(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){let n=this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,2)}findUTF8Submatch(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.slice(n[2*s],n[2*s+1]));return r}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,this.prog.numCap))}findSubmatch(t){let n=this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.substring(n[2*s],n[2*s+1]));return r}findSubmatchIndex(t){return this.pad(this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>t.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAll(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>t.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.slice(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){let r=this.allMatches(gt.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.substring(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(t,n){let r=this.allMatches(gt.fromUTF16(t),n);return r.length===0?null:r}},lu=class e{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){let n=t.charCodeAt(0);return n<128?1:n<2048?2:n<65536?3:4}static translate(t){if(typeof t!="string")return t;let n="",r=!1,s=t.length;s===0&&(n="(?:)",r=!0);let i=0;for(;i<s;){let o=t[i];if(o==="\\"){if(i+1<s)switch(o=t[i+1],o){case"\\":{n+="\\\\",i+=2;continue}case"c":{if(i+2<s){let l=t[i+2];if(e.isUpperCaseAlpha(l)){n+="\\x",n+=(l.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(l.charCodeAt(0)-64&15).toString(16).toUpperCase(),i+=3,r=!0;continue}}n+="\\c",i+=2;continue}case"u":{if(i+2<s){let l=t[i+2];if(e.isHexadecimal(l)){n+="\\x{"+l,i+=3;for(let c=0;c<3&&i<s&&(l=t[i],!!e.isHexadecimal(l));++i,++c)n+=l;n+="}",r=!0;continue}else if(l==="{"){n+="\\x",i+=2,r=!0;continue}}n+="\\u",i+=2;continue}default:{n+="\\";let l=e.getUtf8CharSize(o);n+=t.substring(i+1,i+1+l),i+=l+1;continue}}}else if(o==="/"){n+="\\/",i+=1,r=!0;continue}else if(o==="("&&i+2<s&&t[i+1]==="?"&&t[i+2]==="<"&&(i+3>=s||t[i+3]!=="="&&t[i+3]!=="!")){n+="(?P<",i+=3,r=!0;continue}let a=e.getUtf8CharSize(o);n+=t.substring(i,i+a),i+=a}return r?n:t}},Kr=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(t){return We.quoteMeta(t)}static translateRegExp(t){return lu.translate(t)}static compile(t,n=0){let r=t;if((n&e.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&e.DOTALL)!==0&&(r=`(?s)${r}`),(n&e.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(e.MULTILINE|e.DOTALL|e.CASE_INSENSITIVE|e.DISABLE_UNICODE_GROUPS|e.LONGEST_MATCH))!==0)throw new Qc("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=te.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);let i=new e(t,n);return i.re2Input=au.compileImpl(r,s,(n&e.LONGEST_MATCH)!==0),i}static matches(t,n){return e.compile(t).testExact(n)}static initTest(t,n,r){if(t==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");let s=new e(t,n);return s.re2Input=r,s}constructor(t,n){this.patternInput=t,this.flagsInput=n}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return Array.isArray(t)&&(t=ci.utf8(t)),new Xc(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let n=Array.isArray(t)?gt.fromUTF8(t):gt.fromUTF16(t);return this.re2Input.executeEngine(n,0,te.ANCHOR_BOTH,0)!==null}split(t,n=0){let r=this.matcher(t),s=[],i=0,o=0;for(;r.find();){if(o===0&&r.end()===0){o=r.end();continue}if(n>0&&s.length===n-1)break;if(o===r.start()){if(n===0){i+=1,o=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.start())),o=r.end()}if(n===0&&o!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.inputLength()))}return(n!==0||s.length===0)&&s.push(r.substring(o,r.inputLength())),s}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}}});function Bb(e){let t=0;return e.includes("i")&&(t|=Kr.CASE_INSENSITIVE),e.includes("m")&&(t|=Kr.MULTILINE),e.includes("s")&&(t|=Kr.DOTALL),t}function Ub(e){return Kr.translateRegExp(e)}function ie(e,t="",n={}){return new ya(e,t,n)}var Mb,_b,ya,Dr,D1=M(()=>{"use strict";P1();At();Z();Mb=1e6,_b=64*1024*1024;ya=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;_matcher=null;_matcherInput=null;maxResults;maxOutputBytes;signal;assertResultCount(t){if(this.signal?.aborted)throw new Error("regular expression aborted");if(t>this.maxResults)throw new C(`regular expression result limit exceeded (${this.maxResults})`,"array_elements")}expandReplacement(t,n){let r=new Te(this.maxOutputBytes,"regular expression replacement"),s=this._re2.groupCount(),i=this._re2.namedGroups();for(let o=0;o<n.length;o++){let a=n[o];if(a==="\\"&&o+1<n.length){r.append(n[++o]);continue}if(a!=="$"||o+1>=n.length){r.append(a);continue}if(n[o+1]==="{"){let l=n.indexOf("}",o+2);if(l!==-1){let c=n.slice(o+2,l),u=i?.[c];if(u!==void 0){r.append(t.group(u)??""),o=l;continue}}}if(/\d/.test(n[o+1])){let l=o+1,c=0;for(;l<n.length&&/\d/.test(n[l]);){let u=c*10+Number(n[l]);if(u>s)break;c=u,l++}r.append(t.group(c)??""),o=l-1;continue}r.append(a)}return r.build()}acquireMatcher(t){return this._matcher===null?(this._matcher=this._re2.matcher(t),this._matcherInput=t,this._matcher):(this._matcherInput!==t&&(this._matcher.matcherInput.charSequence=t,this._matcherInput=t),this._matcher.reset(),this._matcher)}constructor(t,n="",r={}){if(this._pattern=t,this._flags=n,this._global=n.includes("g"),this._ignoreCase=n.includes("i"),this._multiline=n.includes("m"),this.maxResults=r.maxResults??Mb,this.maxOutputBytes=r.maxOutputBytes??_b,this.signal=r.signal,!Number.isSafeInteger(this.maxResults)||this.maxResults<0||!Number.isSafeInteger(this.maxOutputBytes)||this.maxOutputBytes<0)throw new Error("invalid regular expression limits");try{let s=Ub(t),i=Bb(n);this._re2=Kr.compile(s,i)}catch(s){if(s instanceof it){let i=s.message||"",o="";throw i.includes("(?=")||i.includes("(?!")||i.includes("(?<")||i.includes("(?<!")||t.includes("(?=")||t.includes("(?!")||t.includes("(?<=")||t.includes("(?<!")?o=" Lookahead (?=, ?!) and lookbehind (?<=, ?<!) assertions are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support these features.":(i.includes("backreference")||/\\[1-9]/.test(t))&&(o=" Backreferences (\\1, \\2, etc.) are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support backreferences."),new SyntaxError(`Invalid regular expression: /${t}/: ${i}${o}`)}throw s}}test(t){return this._global&&(this._lastIndex=0),this.acquireMatcher(t).find()}exec(t){let n=this.acquireMatcher(t),r=this._global?this._lastIndex:0;if(!n.find(r))return this._global&&(this._lastIndex=0),null;let s=this._re2.groupCount(),i=[];i.push(n.group(0)??"");for(let l=1;l<=s;l++){let c=n.group(l);i.push(c)}let o=i;o.index=n.start(0),o.input=t;let a=this._re2.namedGroups();if(a&&Object.keys(a).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(a)){let f=n.group(u);f!==null&&(l[c]=f)}o.groups=l}return this._global&&(this._lastIndex=n.end(0),n.start(0)===n.end(0)&&this._lastIndex++),o}match(t){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(t);let n=[],r=this.acquireMatcher(t),s=0;for(;r.find(s);){let i=r.group(0)??"";if(this.assertResultCount(n.length+1),n.push(i),s=r.end(0),r.start(0)===r.end(0)&&s++,s>t.length)break}return n.length>0?n:null}replace(t,n){if(this._global&&(this._lastIndex=0),typeof n=="string"){let u=this._re2.matcher(t),f=new Te(this.maxOutputBytes,"regular expression replacement"),d=0,p=0,h=0;for(;u.find(p);){this.assertResultCount(++h);let m=u.start(0),g=u.end(0);if(f.append(t.slice(d,m)),f.append(this.expandReplacement(u,n)),d=g,p=g>m?g:g+1,!this._global||p>t.length)break}return f.append(t.slice(d)),f.build()}let r=new Te(this.maxOutputBytes,"regular expression replacement"),s=this._re2.matcher(t),i=0,o=0,a=0,l=this._re2.groupCount(),c=this._re2.namedGroups();for(;s.find(o);){this.assertResultCount(++a),r.append(t.slice(i,s.start(0)));let u=[],f=s.group(0)??"";for(let h=1;h<=l;h++)u.push(s.group(h));if(u.push(s.start(0)),u.push(t),c&&Object.keys(c).length>0){let h=Object.create(null);for(let[m,g]of Object.entries(c))h[m]=s.group(g)??"";u.push(h)}let d=s.start(0),p=s.end(0);if(r.append(n(f,...u)),i=p,o=i,d===p&&o++,!this._global||o>t.length)break}return r.append(t.slice(i)),r.build()}split(t,n){if(n===0)return[];let r=n===void 0||n<0?this.maxResults:Math.min(n,this.maxResults),s=[],i=this._re2.matcher(t),o=0,a=0;for(;s.length<r&&i.find(a);)this.assertResultCount(s.length+1),s.push(t.slice(o,i.start(0))),o=i.end(0),a=i.end(0)>i.start(0)?i.end(0):i.end(0)+1;return s.length<r&&s.push(t.slice(o)),s}search(t){let n=this.acquireMatcher(t);return n.find()?n.start(0):-1}*matchAll(t){if(!this._global)throw new Error("matchAll requires global flag");this._lastIndex=0;let n=this._re2.matcher(t),r=this._re2.groupCount(),s=this._re2.namedGroups(),i=0,o=0;for(;n.find(i);){this.assertResultCount(++o);let a=[];a.push(n.group(0)??"");for(let c=1;c<=r;c++)a.push(n.group(c));let l=a;if(l.index=n.start(0),l.input=t,s&&Object.keys(s).length>0){let c=Object.create(null);for(let[u,f]of Object.entries(s)){let d=n.group(f);d!==null&&(c[u]=d)}l.groups=c}if(yield l,i=n.end(0),n.start(0)===n.end(0)&&i++,i>t.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=new RegExp("",this._flags),Object.defineProperty(this._nativeRegex,"source",{value:this._pattern,writable:!1})}return this._nativeRegex}get source(){return this._pattern}get flags(){return this._flags}get global(){return this._global}get ignoreCase(){return this._ignoreCase}get multiline(){return this._multiline}get lastIndex(){return this._lastIndex}set lastIndex(t){this._lastIndex=t}};Dr=class{_regex;constructor(t){this._regex=t}test(t){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(t)}exec(t){return this._regex.exec(t)}match(t){return this._regex.global&&(this._regex.lastIndex=0),t.match(this._regex)}replace(t,n){return this._regex.global&&(this._regex.lastIndex=0),t.replace(this._regex,n)}split(t,n){return t.split(this._regex,n)}search(t){return t.search(this._regex)}*matchAll(t){if(!this._regex.global)throw new Error("matchAll requires global flag");this._regex.lastIndex=0;let n=this._regex.exec(t);for(;n!==null;)yield n,n[0].length===0&&this._regex.lastIndex++,n=this._regex.exec(t)}get native(){return this._regex}get source(){return this._regex.source}get flags(){return this._regex.flags}get global(){return this._regex.global}get ignoreCase(){return this._regex.ignoreCase}get multiline(){return this._regex.multiline}get lastIndex(){return this._regex.lastIndex}set lastIndex(t){this._regex.lastIndex=t}}});var pt=M(()=>{"use strict";D1()});function sn(e,t,n){let r=typeof n=="boolean"?{ignoreCase:n}:n??{},s=t;r.stripQuotes&&(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1));let i=r.ignoreCase?`i:${s}`:s,o=ro.get(i);if(!o){if(o=Wb(s,r.ignoreCase),ro.size>=zb){let a=ro.keys().next().value;a!==void 0&&ro.delete(a)}ro.set(i,o)}return o.test(e)}function Wb(e,t){let n="^";for(let r=0;r<e.length;r++){let s=e[r];if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=r+1;for(;i<e.length&&e[i]!=="]";)i++;n+=e.slice(r,i+1),r=i}else s==="."||s==="+"||s==="^"||s==="$"||s==="{"||s==="}"||s==="("||s===")"||s==="|"||s==="\\"?n+=`\\${s}`:n+=s}return n+="$",ie(n,t?"i":"")}var zb,ro,cu=M(()=>{"use strict";pt();zb=2048,ro=new Map});function so(e,t){let n=e.ignoreCase?t.toLowerCase():t,r=e.needles;for(let s=0;s<r.length;s++)if(n.indexOf(r[s])!==-1)return!0;return!1}function L1(e,t){return e.replace(/\$(&|\d+|<([^>]+)>)/g,(n,r,s)=>{if(r==="&")return t[0];if(s!==void 0)return t.groups?.[s]??"";let i=parseInt(r,10);return t[i]??""})}function As(e,t,n={}){let{invertMatch:r=!1,showLineNumbers:s=!1,countOnly:i=!1,countMatches:o=!1,filename:a="",onlyMatching:l=!1,beforeContext:c=0,afterContext:u=0,maxCount:f=0,contextSeparator:d="--",showColumn:p=!1,vimgrep:h=!1,showByteOffset:m=!1,replace:g=null,passthru:b=!1,multiline:w=!1,kResetGroup:y,preFilter:x,maxWork:S,maxMatches:E,signal:A}=n;if(w)return jb(e,t,{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:d,showColumn:p,showByteOffset:m,replace:g,kResetGroup:y,preFilter:x,maxWork:S,maxMatches:E,signal:A});let I=0,$=(D=1)=>{if(A?.aborted)throw new Ge;if(I+=D,S!==void 0&&I>S)throw new C(`search: matching work limit exceeded (${S})`,"iterations")},N=(D,X)=>{if(E!==void 0&&D.length>=E)throw new C(`search: result limit exceeded (${E})`,"array_elements");D.push(X)},R=1;for(let D=0;D<e.length;D++)if((D&1023)===0&&$(),e.charCodeAt(D)===10&&(R++,E!==void 0&&R>E))throw new C(`search: line limit exceeded (${E})`,"array_elements");let O=e.split(`
177
+ `),B=O.length,L=B>0&&O[B-1]===""?B-1:B;if(i||o){let D=0,X=(o||l)&&!r;for(let Y=0;Y<L;Y++){$();let J=O[Y];if(!(x&&!r&&!so(x,J)))if(t.lastIndex=0,X)for(let ge=t.exec(J);ge!==null;ge=t.exec(J))$(),D++,ge[0].length===0&&t.lastIndex++;else t.test(J)!==r&&D++}return{output:`${a?`${a}:${D}`:String(D)}
178
+ `,matched:D>0,matchCount:D}}if(c===0&&u===0&&!b){let D=[],X=!1,V=0,Y=0;for(let J=0;J<L&&($(),!(f>0&&V>=f));J++){let ge=O[J],Oe=null;if(x&&!so(x,ge)||(t.lastIndex=0,Oe=t.exec(ge)),Oe!==null!==r)if(X=!0,V++,l)for(let pe=Oe;pe!==null;pe=t.exec(ge)){$();let De=y!==void 0?pe[y]??"":pe[0],tt=g!==null?L1(g,pe):De,se=a?`${a}:`:"";m&&(se+=`${Y+pe.index}:`),s&&(se+=`${J+1}:`),p&&(se+=`${pe.index+1}:`),N(D,se+tt),pe[0].length===0&&t.lastIndex++}else if(h)for(let pe=Oe;pe!==null;pe=t.exec(ge)){$();let De=a?`${a}:`:"";m&&(De+=`${Y+pe.index}:`),s&&(De+=`${J+1}:`),p&&(De+=`${pe.index+1}:`),N(D,De+ge),pe[0].length===0&&t.lastIndex++}else{let pe=Oe?Oe.index+1:1,De=ge;g!==null&&(t.lastIndex=0,De=t.replace(ge,(...se)=>{if(se[0].length===0)return"";let Ue=se,Se=se[se.length-1];return typeof Se=="object"&&Se!==null?(Ue.groups=Se,Ue.input=se[se.length-2],Ue.index=se[se.length-3]):(Ue.input=se[se.length-1],Ue.index=se[se.length-2]),L1(g,Ue)}));let tt=a?`${a}:`:"";m&&(tt+=`${Y+(Oe?Oe.index:0)}:`),s&&(tt+=`${J+1}:`),p&&(tt+=`${pe}:`),N(D,tt+De)}Y+=ge.length+1}return{output:D.length>0?`${D.join(`
179
+ `)}
180
+ `:"",matched:X,matchCount:V}}if(b){let D=[],X=!1,V=0;for(let Y=0;Y<L;Y++){$();let J=O[Y],ge;x&&!so(x,J)?ge=!1:(t.lastIndex=0,ge=t.test(J));let Oe=ge!==r;Oe&&(X=!0,V++);let Ee=Oe?":":"-",pe=a?`${a}${Ee}`:"";s&&(pe+=`${Y+1}${Ee}`),N(D,pe+J)}return{output:D.length>0?`${D.join(`
181
+ `)}
182
+ `:"",matched:X,matchCount:V}}let T=[],W=0,_=new Set,F=-1,z=[];for(let D=0;D<L&&($(),!(f>0&&W>=f));D++){let X=O[D],V;if(x&&!so(x,X)?V=!1:(t.lastIndex=0,V=t.test(X)),V!==r){if(E!==void 0&&z.length>=E)throw new C(`search: match limit exceeded (${E})`,"array_elements");z.push(D),W++}}for(let D of z){$();let X=Math.max(0,D-c);F>=0&&X>F+1&&N(T,d);for(let Y=X;Y<D;Y++)if($(),!_.has(Y)){_.add(Y),F=Y;let J=O[Y];s&&(J=`${Y+1}-${J}`),a&&(J=`${a}-${J}`),N(T,J)}if(!_.has(D)){_.add(D),F=D;let Y=O[D];if(l){t.lastIndex=0;for(let J=t.exec(Y);J!==null;J=t.exec(Y)){$();let ge=y!==void 0?J[y]??"":J[0],Oe=g!==null?g:ge,Ee=a?`${a}:`:"";s&&(Ee+=`${D+1}:`),p&&(Ee+=`${J.index+1}:`),N(T,Ee+Oe),J[0].length===0&&t.lastIndex++}}else{let J=Y;s&&(J=`${D+1}:${J}`),a&&(J=`${a}:${J}`),N(T,J)}}let V=Math.min(L-1,D+u);for(let Y=D+1;Y<=V;Y++)if($(),!_.has(Y)){_.add(Y),F=Y;let J=O[Y];s&&(J=`${Y+1}-${J}`),a&&(J=`${a}-${J}`),N(T,J)}}return{output:T.length>0?`${T.join(`
183
+ `)}
184
+ `:"",matched:W>0,matchCount:W}}function jb(e,t,n){let{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:d,showColumn:p,showByteOffset:h,replace:m,kResetGroup:g,preFilter:b,maxWork:w,maxMatches:y,signal:x}=n,S=0,E=(_=1)=>{if(x?.aborted)throw new Ge;if(S+=_,w!==void 0&&S>w)throw new C(`search: matching work limit exceeded (${w})`,"iterations")};if(b&&!r&&!so(b,e))return i||o?{output:`${a?`${a}:0`:"0"}
185
+ `,matched:!1,matchCount:0}:{output:"",matched:!1,matchCount:0};let A=[0];for(let _=0;_<e.length;_++)if((_&1023)===0&&E(),e[_]===`
186
+ `){if(y!==void 0&&A.length>=y)throw new C(`search: line index limit exceeded (${y})`,"array_elements");A.push(_+1)}let I=e.split(`
187
+ `),$=I.length,N=$>0&&I[$-1]===""?$-1:$,R=_=>{let F=0,z=A.length;for(;F<z;){let D=F+Math.floor((z-F)/2);A[D]<=_?F=D+1:z=D}return Math.max(0,F-1)},O=_=>{let F=R(_);return _-A[F]+1};if(i||o){let _=0,F=0,z=-1;t.lastIndex=0;for(let V=t.exec(e);V!==null&&(E(),!(f>0&&_>=f));V=t.exec(e)){if(_++,!o){let Y=R(V.index),J=R(V.index+Math.max(0,V[0].length-1)),ge=Math.max(Y,z+1);ge<=J&&(F+=J-ge+1,z=J)}V[0].length===0&&t.lastIndex++}let D=o?r?0:_:r?N-F:F;return{output:`${a?`${a}:${D}`:String(D)}
188
+ `,matched:D>0,matchCount:D}}let B=[];t.lastIndex=0;for(let _=t.exec(e);_!==null&&(E(),!(f>0&&B.length>=f));_=t.exec(e)){if(y!==void 0&&B.length>=y)throw new C(`search: match limit exceeded (${y})`,"array_elements");let F=R(_.index),z=R(_.index+Math.max(0,_[0].length-1)),D=g!==void 0?_[g]??"":_[0];B.push({startLine:F,endLine:z,byteOffset:_.index,column:O(_.index),matchText:D}),_[0].length===0&&t.lastIndex++}if(r){let _=new Set;for(let z of B)for(let D=z.startLine;D<=z.endLine;D++)E(),_.add(D);let F=[];for(let z=0;z<N;z++)if(E(),!_.has(z)){let D=I[z];s&&(D=`${z+1}:${D}`),a&&(D=`${a}:${D}`),F.push(D)}return{output:F.length>0?`${F.join(`
189
+ `)}
190
+ `:"",matched:F.length>0,matchCount:F.length}}if(B.length===0)return{output:"",matched:!1,matchCount:0};let L=new Set,T=-1,W=[];for(let _ of B){E();let F=Math.max(0,_.startLine-c),z=Math.min(N-1,_.endLine+u);T>=0&&F>T+1&&W.push(d);for(let D=F;D<_.startLine;D++)if(E(),!L.has(D)){L.add(D),T=D;let X=I[D];s&&(X=`${D+1}-${X}`),a&&(X=`${a}-${X}`),W.push(X)}if(l){let D=m!==null?m:_.matchText,X=a?`${a}:`:"";h&&(X+=`${_.byteOffset}:`),s&&(X+=`${_.startLine+1}:`),p&&(X+=`${_.column}:`),W.push(X+D);for(let V=_.startLine;V<=_.endLine;V++)E(),L.add(V),T=V}else for(let D=_.startLine;D<=_.endLine&&D<N;D++)if(E(),!L.has(D)){L.add(D),T=D;let X=I[D];m!==null&&D===_.startLine&&(t.lastIndex=0,X=t.replace(X,m));let V=a?`${a}:`:"";h&&D===_.startLine&&(V+=`${_.byteOffset}:`),s&&(V+=`${D+1}:`),p&&D===_.startLine&&(V+=`${_.column}:`),W.push(V+X)}for(let D=_.endLine+1;D<=z;D++)if(E(),!L.has(D)){L.add(D),T=D;let X=I[D];s&&(X=`${D+1}-${X}`),a&&(X=`${a}-${X}`),W.push(X)}}return{output:W.length>0?`${W.join(`
191
+ `)}
192
+ `:"",matched:!0,matchCount:B.length}}var F1=M(()=>{"use strict";Z()});function M1(e){let t="",n=0;for(;n<e.length;){if(e.slice(n,n+7)==="[[:<:]]"){t+="\\b",n+=7;continue}if(e.slice(n,n+7)==="[[:>:]]"){t+="\\b",n+=7;continue}if(e[n]==="["){let r="[";for(n++,n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++),n<e.length&&e[n]==="]"&&(r+="\\]",n++);n<e.length&&e[n]!=="]";){if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),o=Hb.get(i);if(o){r+=o,n=s+2;continue}}}if(e[n]==="\\"&&n+1<e.length){r+=e[n]+e[n+1],n+=2;continue}r+=e[n],n++}n<e.length&&e[n]==="]"&&(r+="]",n++),t+=r;continue}if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}return t}function fi(e,t){let n,r;switch(t.mode){case"fixed":n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(n=M1(e),n=n.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),t.mode==="perl"){n=Zb(n),n=Kb(n),n=Qb(n);let a=ex(n);n=a.pattern,r=a.kResetGroup}break}default:n=M1(e),n=rx(n);break}t.wholeWord&&(n=`\\b(?:${n})\\b`),t.lineRegexp&&(n=`^(?:${n})$`);let s=/\\u\{[0-9A-Fa-f]+\}/.test(n),i="g"+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.multilineDotall?"s":"")+(s?"u":""),o=Vb(n,t.ignoreCase??!1);return{regex:ie(n,i),kResetGroup:r,preFilter:o??void 0}}function Vb(e,t){let n=e;if(n.startsWith("\\b(?:")&&n.endsWith(")\\b")?n=n.slice(5,n.length-3):n.startsWith("\\b")&&n.endsWith("\\b")&&n.length>=4&&(n=n.slice(2,n.length-2)),n.length===0)return null;let r=Gb(n);if(r===null)return null;let s=[];for(let i of r){let o=qb(i);if(o===null||o.length===0)return null;s.push(o)}return s.length===0?null:{needles:t?s.map(i=>i.toLowerCase()):s,ignoreCase:t}}function Gb(e){let t=[],n=0,r=!1,s=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="\\"){i++;continue}if(r){o==="]"&&(r=!1);continue}if(o==="[")r=!0;else if(o==="(")n++;else if(o===")"){if(n--,n<0)return null}else o==="|"&&n===0&&(t.push(e.slice(s,i)),s=i+1)}return n!==0||r?null:(t.push(e.slice(s)),t)}function qb(e){let t=e;if(t.startsWith("^")&&(t=t.slice(1)),t.endsWith("$")){let r=0;for(let s=t.length-2;s>=0&&t[s]==="\\";s--)r++;r%2===0&&(t=t.slice(0,-1))}if(t.length===0)return null;let n="";for(let r=0;r<t.length;r++){let s=t[r];if(s==="\\"){let i=t[r+1];if(i===void 0||/[dDwWsSbBAZzGQE0-9ckpPNXRxuU]/.test(i))return null;i==="n"?n+=`
193
+ `:i==="t"?n+=" ":i==="r"?n+="\r":i==="f"?n+="\f":i==="v"?n+="\v":n+=i,r++;continue}if(/[.*+?^${}()|[\]]/.test(s))return null;n+=s}return n}function Zb(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="Q"){n+=2;let r="";for(;n<e.length;){if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="E"){n+=2;break}r+=e[n],n++}t+=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else t+=e[n],n++;return t}function Kb(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function Qb(e){let t="",n=0;for(;n<e.length;){if(e[n]==="("&&n+1<e.length&&e[n+1]==="?"){let r=e.slice(n).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(r){let s=r[1]||"",i=r[2]||"",o=r[3];if(o===":"){let a=n+r[0].length-1,l=Xb(e,n);if(l!==-1){let c=e.slice(a+1,l),u=Yb(c,s,i);t+=`(?:${u})`,n=l+1;continue}}else if(o===")"||o===""){n+=r[0].length;continue}}}t+=e[n],n++}return t}function Xb(e,t){let n=0,r=t;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e[r]==="["){for(r++;r<e.length&&e[r]!=="]";)e[r]==="\\"&&r++,r++;r++;continue}if(e[r]==="(")n++;else if(e[r]===")"&&(n--,n===0))return r;r++}return-1}function Yb(e,t,n){let r=e;return t.includes("i")&&(r=Jb(r)),r}function Jb(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r==="\\"){n+1<e.length?(t+=r+e[n+1],n+=2):(t+=r,n++);continue}if(r==="["){t+=r,n++,n<e.length&&e[n]==="^"&&(t+=e[n],n++);let s=[];for(;n<e.length&&e[n]!=="]";)if(e[n]==="\\")s.push(e[n]),n++,n<e.length&&(s.push(e[n]),n++);else if(e[n]==="-"&&s.length>0&&n+1<e.length&&e[n+1]!=="]"){let i=s[s.length-1],o=e[n+1];s.push("-"),s.push(o),/[a-z]/.test(i)&&/[a-z]/.test(o)?(s.push(i.toUpperCase()),s.push("-"),s.push(o.toUpperCase())):/[A-Z]/.test(i)&&/[A-Z]/.test(o)&&(s.push(i.toLowerCase()),s.push("-"),s.push(o.toLowerCase())),n+=2}else{let i=e[n];if(s.push(i),/[a-zA-Z]/.test(i)){let o=i===i.toLowerCase()?i.toUpperCase():i.toLowerCase();s.includes(o)||s.push(o)}n++}t+=s.join(""),n<e.length&&(t+=e[n],n++);continue}if(/[a-zA-Z]/.test(r)){let s=r.toLowerCase(),i=r.toUpperCase();t+=`[${i}${s}]`}else t+=r;n++}return t}function ex(e){let t=tx(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),s=nx(n);return{pattern:`(?:${n})(${r})`,kResetGroup:s+1}}function tx(e){let t=0;for(;t<e.length-1;)if(e[t]==="\\"){if(e[t+1]==="K"){let n=0,r=t-1;for(;r>=0&&e[r]==="\\";)n++,r--;if(n%2===0)return t}t+=2}else t++;return-1}function nx(e){let t=0,n=0;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n]==="["){for(n++;n<e.length&&e[n]!=="]";)e[n]==="\\"&&n++,n++;n++;continue}if(e[n]==="(")if(n+1<e.length&&e[n+1]==="?"){if(n+2<e.length){let r=e[n+2];if(r===":"||r==="="||r==="!"){n++;continue}if(r==="<"&&n+3<e.length){let s=e[n+3];if(s==="="||s==="!"){n++;continue}t++,n++;continue}}}else t++;n++}return t}function wa(e){let t=e.replace(/\$\{0\}|\$0(?![0-9])/g,"$$&");return t=t.replace(/\$\{([^0-9}][^}]*)\}/g,"$$<$1>"),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),t}function rx(e){let t="",n=0,r=!0,s=0;for(;n<e.length;){let i=e[n];if(i==="["){for(t+=i,n++,n<e.length&&(e[n]==="^"||e[n]==="!")&&(t+=e[n],n++),n<e.length&&e[n]==="]"&&(t+=e[n],n++);n<e.length&&e[n]!=="]";)e[n]==="\\"&&n+1<e.length?(t+=e[n]+e[n+1],n+=2):(t+=e[n],n++);n<e.length&&e[n]==="]"&&(t+=e[n],n++),r=!1;continue}if(i==="\\"&&n+1<e.length){let o=e[n+1];if(o==="|"){t+="|",n+=2,r=!0;continue}if(o==="("){t+="(",n+=2,s++,r=!0;continue}if(o===")"){t+=")",n+=2,s=Math.max(0,s-1),r=!1;continue}if(o==="{"){let l=e.slice(n).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(l){let c=l[1],u=l[2]!==void 0,f=l[3]||"";u?t+=`{${c},${f}}`:t+=`{${c}}`,n+=l[0].length,r=!1;continue}t+="\\{",n+=2,r=!1;continue}if(o==="}"){t+="\\}",n+=2,r=!1;continue}t+=i+o,n+=2,r=!1;continue}if(i==="*"&&r){t+="\\*",n++;continue}if(i==="^"){if(r){t+="^",n++;continue}t+="\\^",n++;continue}if(i==="$"){let o=n===e.length-1,a=n+2<e.length&&e[n+1]==="\\"&&e[n+2]===")";o||a?t+="$":t+="\\$",n++,r=!1;continue}i==="+"||i==="?"||i==="|"||i==="("||i===")"||i==="{"||i==="}"?t+=`\\${i}`:t+=i,n++,r=!1}return t}var Hb,_1=M(()=>{"use strict";pt();Hb=new Map([["alpha","a-zA-Z"],["digit","0-9"],["alnum","a-zA-Z0-9"],["lower","a-z"],["upper","A-Z"],["xdigit","0-9A-Fa-f"],["space"," \\t\\n\\r\\f\\v"],["blank"," \\t"],["punct","!-/:-@\\[-`{-~"],["graph","!-~"],["print"," -~"],["cntrl","\\x00-\\x1F\\x7F"],["ascii","\\x00-\\x7F"],["word","a-zA-Z0-9_"]])});var uu=M(()=>{"use strict";F1();_1()});var xa={};ae(xa,{egrepCommand:()=>dx,egrepFlagsForFuzzing:()=>mx,fgrepCommand:()=>fx,fgrepFlagsForFuzzing:()=>hx,flagsForFuzzing:()=>px,grepCommand:()=>fu});function B1(e){let t=e.limits.maxLoopIterations,n=e.limits.maxArrayElements;return Math.max(t,Math.min(n,t*10))}function zn(e){if(++e.operations>e.maxOperations)throw new C(`grep: glob operation limit exceeded (${e.maxOperations})`,"glob_operations")}function io(e){if(e.results>=e.maxResults)throw new C(`grep: array element limit exceeded (${e.maxResults})`,"array_elements");e.results++}function ox(e){return e.split(`
194
+ `)}function ax(e){if(e==="")return[];let t=e.split(`
195
+ `);return t[t.length-1]===""&&t.pop(),t}function lx(e,t){return e.length===1?{pattern:e[0],mode:t}:t==="fixed"?{pattern:e.map(n=>`(?:${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`).join("|"),mode:"extended"}:t==="basic"?{pattern:e.join("\\|"),mode:t}:{pattern:e.map(n=>`(?:${n})`).join("|"),mode:t}}async function z1(e,t,n,r,s,i=0){if(i>=U1)return;let o=n.fs.resolvePath(n.cwd,e);try{if(zn(s),!(await n.fs.stat(o)).isDirectory){let c=e.split("/").pop()||"";if(t){let u=t.replace(/^\//,"");sn(c,u,{stripQuotes:!0})&&(io(s),r.push(e))}return}zn(s);let l=await n.fs.readdir(o);for(let c of l){let u=e==="."?c:`${e}/${c}`,f=n.fs.resolvePath(n.cwd,u);if(zn(s),(await n.fs.stat(f)).isDirectory)await z1(u,t,n,r,s,i+1);else if(t){let p=t.replace(/^\//,"");sn(c,p,{stripQuotes:!0})&&(io(s),r.push(u))}}}catch(a){he(a)}}async function ux(e,t,n){let r=[],s=e.lastIndexOf("/"),i,o;if(s===-1?(i=t.cwd,o=e):(i=e.slice(0,s)||"/",o=e.slice(s+1)),e.includes("**")){let l=[],c=e.split("**"),u=c[0].replace(/\/$/,"")||".",f=c[1]||"";return await z1(u,f,t,l,n),l.map(d=>({path:d}))}let a=t.fs.resolvePath(t.cwd,i);try{if(t.fs.readdirWithFileTypes){zn(n);let l=await t.fs.readdirWithFileTypes(a);for(let c of l)if(zn(n),sn(c.name,o,{stripQuotes:!0})){let u=s===-1?c.name:`${i}/${c.name}`;io(n),r.push({path:u,isFile:c.isFile})}}else{zn(n);let l=await t.fs.readdir(a);for(let c of l)if(zn(n),sn(c,o,{stripQuotes:!0})){let u=s===-1?c:`${i}/${c}`;io(n),r.push({path:u})}}}catch(l){he(l)}return r.sort((l,c)=>l.path.localeCompare(c.path))}async function ba(e,t,n=[],r=[],s=[],i,o={operations:0,results:0,maxOperations:t.limits.maxGlobOperations,maxResults:t.limits.maxArrayElements},a=[],l=0){if(l>=U1)return a;let c=t.fs.resolvePath(t.cwd,e);try{let u,f;if(i!==void 0)u=i,f=!i;else{zn(o);let p=await t.fs.stat(c);u=p.isFile,f=p.isDirectory}if(u){let p=e.split("/").pop()||e;return r.length>0&&r.some(h=>sn(p,h,{stripQuotes:!0}))||n.length>0&&!n.some(h=>sn(p,h,{stripQuotes:!0}))||(io(o),a.push({path:e,isFile:!0})),a}if(!f)return a;let d=e.split("/").pop()||e;if(s.length>0&&s.some(p=>sn(d,p,{stripQuotes:!0})))return a;if(t.fs.readdirWithFileTypes){zn(o);let p=await t.fs.readdirWithFileTypes(c);for(let h of p){if(zn(o),h.name.startsWith("."))continue;let m=e==="."?h.name:`${e}/${h.name}`;await ba(m,t,n,r,s,h.isFile,o,a,l+1)}}else{zn(o);let p=await t.fs.readdir(c);for(let h of p){if(zn(o),h.startsWith("."))continue;let m=e==="."?h:`${e}/${h}`;await ba(m,t,n,r,s,void 0,o,a,l+1)}}}catch(u){he(u)}return a}var sx,ix,cx,fu,U1,fx,dx,px,hx,mx,Ea=M(()=>{"use strict";ce();Nt();Z();cu();de();uu();sx="(standard input)";ix="[^\\s\\S]";cx={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"]},fu={name:"grep",async execute(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,d=!1,p=!1,h=!1,m=!1,g=!1,b=0,w=0,y=0,x=[],S=[],E=[],A=null,I=[],$=[],N=!0;for(let se=0;se<e.length;se++){let fe=e[se];if(N&&fe==="--"){N=!1;continue}if(N&&fe==="--help")return G(cx);if(N&&fe.startsWith("-")&&fe!=="-"){if(fe==="-e"&&se+1<e.length){A=e[++se];continue}if(fe.startsWith("--file=")){I.push(fe.slice(7));continue}if(fe.startsWith("--include=")){x.push(fe.slice(10));continue}if(fe.startsWith("--exclude=")){S.push(fe.slice(10));continue}if(fe.startsWith("--exclude-dir=")){E.push(fe.slice(14));continue}if(fe.startsWith("--max-count=")){b=parseInt(fe.slice(12),10);continue}let Ue=fe.match(/^-m(\d+)$/);if(Ue){b=parseInt(Ue[1],10);continue}if(fe==="-m"&&se+1<e.length){b=parseInt(e[++se],10);continue}let Se=fe.match(/^-([ABC])(\d+)$/);if(Se){let at=parseInt(Se[2],10);Se[1]==="A"?y=at:Se[1]==="B"?w=at:Se[1]==="C"&&(w=at,y=at);continue}if((fe==="-A"||fe==="-B"||fe==="-C")&&se+1<e.length){let at=parseInt(e[++se],10);fe==="-A"?y=at:fe==="-B"?w=at:(w=at,y=at);continue}let Ke=fe.startsWith("--")?[fe]:fe.slice(1).split("");for(let at=0;at<Ke.length;at++){let me=Ke[at];if(me==="f"||me==="--file"){let $r=me==="f"?Ke.slice(at+1).join(""):"";if($r.length>0)I.push($r);else if(se+1<e.length)I.push(e[++se]);else return{stdout:"",stderr:me==="f"?`grep: option requires an argument -- 'f'
196
+ `:`grep: option '--file' requires an argument
197
+ `,exitCode:2};break}if(me==="i"||me==="--ignore-case")n=!0;else if(me==="n"||me==="--line-number")r=!0;else if(me==="v"||me==="--invert-match")s=!0;else if(me==="c"||me==="--count")i=!0;else if(me==="l"||me==="--files-with-matches")o=!0;else if(me==="L"||me==="--files-without-match")a=!0;else if(me==="r"||me==="R"||me==="--recursive")l=!0;else if(me==="w"||me==="--word-regexp")c=!0;else if(me==="x"||me==="--line-regexp")u=!0;else if(me==="E"||me==="--extended-regexp")f=!0;else if(me==="P"||me==="--perl-regexp")d=!0;else if(me==="F"||me==="--fixed-strings")p=!0;else if(me==="o"||me==="--only-matching")h=!0;else if(me==="h"||me==="--no-filename")m=!0;else if(me==="q"||me==="--quiet"||me==="--silent")g=!0;else{if(me.startsWith("--"))return re("grep",me);if(me.length===1)return re("grep",`-${me}`)}}}else $.push(fe)}if(A===null&&I.length===0&&(A=$.shift()??null,A===null))return{stdout:"",stderr:`grep: missing pattern
198
+ `,exitCode:2};let R=$,O=A===null?[]:ox(A),B=!1;for(let se of I){let fe;if(se==="")return{stdout:"",stderr:`grep: : No such file or directory
199
+ `,exitCode:2};if(se==="-")fe=B?"":ue(t.stdin),B=!0;else try{let Se=t.fs.resolvePath(t.cwd,se);if((await t.fs.stat(Se)).isDirectory)return{stdout:"",stderr:`grep: ${se}: Is a directory
200
+ `,exitCode:2};fe=await t.fs.readFile(Se)}catch(Se){return he(Se),{stdout:"",stderr:`grep: ${se}: No such file or directory
201
+ `,exitCode:2}}let Ue=ax(fe);if(O.length+Ue.length>t.limits.maxArrayElements)throw new C(`grep: array element limit exceeded (${t.limits.maxArrayElements})`,"array_elements");O.push(...Ue)}if(O.length===0&&!s&&!a)return{stdout:"",stderr:"",exitCode:1};let L=p?"fixed":f?"extended":d?"perl":"basic";if(L==="perl"&&new Set(O).size>1)return{stdout:"",stderr:`grep: the -P option only supports a single pattern
202
+ `,exitCode:2};if(O.length>1&&L!=="fixed")for(let se of O)try{fi(se,{mode:L})}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${se}
203
+ `,exitCode:2}}let T=O.length===0?{pattern:ix,mode:"extended"}:lx(O,L),W,_,F;try{let se=fi(T.pattern,{mode:T.mode,ignoreCase:n,wholeWord:c,lineRegexp:u});W=se.regex,_=se.kResetGroup,F=se.preFilter}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${O.join(`
204
+ `)}
205
+ `,exitCode:2}}if(R.length===0&&t.stdin!==void 0){let se=B?"":ue(t.stdin),fe=As(se,W,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:"",onlyMatching:h,beforeContext:w,afterContext:y,maxCount:b,kResetGroup:_,preFilter:F,maxWork:B1(t),maxMatches:t.limits.maxArrayElements,signal:t.signal});return g?{stdout:"",stderr:"",exitCode:fe.matched?0:1}:{stdout:fe.output,stderr:"",exitCode:fe.matched?0:1}}if(R.length===0)return{stdout:"",stderr:`grep: no input files
206
+ `,exitCode:2};let z="",D="",X=!1,V=!1,Y=[],J={operations:0,results:0,maxOperations:t.limits.maxGlobOperations,maxResults:t.limits.maxArrayElements},ge=se=>{if(se.length>J.maxResults-Y.length)throw new C(`grep: array element limit exceeded (${J.maxResults})`,"array_elements");Y.push(...se)},Oe=!1,Ee=!1;for(let se of R){if(se==="-"){if(Y.length>=J.maxResults)throw new C(`grep: array element limit exceeded (${J.maxResults})`,"array_elements");Y.push({path:sx,isFile:!0,isStdin:!0,stdinAtEof:Oe}),Oe=!0;continue}if(Ee=!0,se.includes("*")||se.includes("?")||se.includes("[")){let fe=await ux(se,t,J);if(l)for(let Ue of fe){let Se=await ba(Ue.path,t,x,S,E,Ue.isFile,J);ge(Se)}else ge(fe)}else if(l){let fe=await ba(se,t,x,S,E,void 0,J);ge(fe)}else{if(Y.length>=J.maxResults)throw new C(`grep: array element limit exceeded (${J.maxResults})`,"array_elements");Y.push({path:se})}}let pe=(Y.length>1||l&&Ee)&&!m,De=50;for(let se=0;se<Y.length;se+=De){let fe=Y.slice(se,se+De),Ue=await Promise.all(fe.map(async Se=>{let Ke=Se.path,at=Ke.split("/").pop()||Ke;if(S.length>0&&!l&&!Se.isStdin&&S.some(me=>sn(at,me,{stripQuotes:!0}))||x.length>0&&!l&&!Se.isStdin&&!x.some(me=>sn(at,me,{stripQuotes:!0})))return null;try{let me;if(Se.isStdin)me=Se.stdinAtEof||t.stdin===void 0?"":ue(t.stdin);else{let er=t.fs.resolvePath(t.cwd,Ke),nn=!1;if(Se.isFile===void 0?nn=(await t.fs.stat(er)).isDirectory:nn=!Se.isFile,nn)return l?null:{error:`grep: ${Ke}: Is a directory
207
+ `};me=await t.fs.readFile(er)}if(F&&!s){let er=F.ignoreCase?me.toLowerCase():me;if(!F.needles.some(nn=>er.includes(nn))){if(i){let nn=pe?`${Ke}:0`:"0";return{file:Ke,result:{output:`${nn}
208
+ `,matched:!1,matchCount:0}}}return{file:Ke,result:{output:"",matched:!1,matchCount:0}}}}let $r=As(me,W,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:pe?Ke:"",onlyMatching:h,beforeContext:w,afterContext:y,maxCount:b,kResetGroup:_,preFilter:F,maxWork:B1(t),maxMatches:t.limits.maxArrayElements,signal:t.signal});return{file:Ke,result:$r}}catch(me){return he(me),{error:`grep: ${Ke}: No such file or directory
209
+ `}}}));for(let Se of Ue){if(Se===null)continue;if("error"in Se&&Se.error){D+=Se.error,Se.error.includes("Is a directory")||(V=!0);continue}if(!("file"in Se)||!Se.result)continue;let{file:Ke,result:at}=Se;if(at.matched){if(X=!0,g)return{stdout:"",stderr:"",exitCode:0};o?z+=`${Ke}
210
+ `:a||(z+=at.output)}else a?z+=`${Ke}
211
+ `:i&&!o&&(z+=at.output)}}let tt;return V?tt=2:tt=X?0:1,g?{stdout:"",stderr:"",exitCode:tt}:{stdout:z,stderr:D,exitCode:tt}}},U1=256;fx={name:"fgrep",async execute(e,t){return fu.execute(["-F",...e],t)}},dx={name:"egrep",async execute(e,t){return fu.execute(["-E",...e],t)}},px={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},hx={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},mx={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function j1(e,t){if(Array.isArray(e))throw new TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${t}: expected null-prototype object, got prototypal object`)}function qe(e){return!W1.has(e)}function Ze(e,t,n){j1(e,"safeSet"),qe(t)&&(e[t]=n)}function Cs(e,t){return j1(e,"safeHasOwn"),Object.hasOwn(e,t)}function di(e,t={}){let n=t.maxDepth??2e3,r=t.maxElements??1e6,s=new WeakMap,i=t.elementBudget??{used:0};if(!Number.isSafeInteger(i.used)||i.used<0||i.used>r)throw new C(`query input element limit exceeded (${r})`,"array_elements");let o=()=>{if(++i.used>r)throw new C(`query input element limit exceeded (${r})`,"array_elements")},a=(u,f,d)=>{if(u===null||typeof u!="object"||u instanceof Date)return u;let p=s.get(u);if(p!==void 0)return p;if(f>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let h=Array.isArray(u)?[]:Object.create(null);return s.set(u,h),d.push({source:u,target:h,depth:f}),h},l=[],c=a(e,0,l);for(;l.length>0;){let u=l.pop();if(!u)break;let{source:f,target:d,depth:p}=u;if(Array.isArray(f)&&Array.isArray(d)){if(f.length>r-i.used)throw new C(`query input element limit exceeded (${r})`,"array_elements");d.length=f.length;for(let b=f.length-1;b>=0;b--)o(),d[b]=a(f[b],p+1,l);continue}let h=f,m=d,g=Object.keys(h);if(g.length>r-i.used)throw new C(`query input element limit exceeded (${r})`,"array_elements");for(let b=0;b<g.length;b++){o();let w=g[b];m[w]=a(h[w],p+1,l)}}return c}function Je(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function H1(e){return Object.assign(Object.create(null),e)}function Dt(e){return Object.assign(Object.create(null),e)}function du(...e){return Object.assign(Object.create(null),...e)}var W1,_$,sr=M(()=>{"use strict";Z();W1=new Set(["__proto__","constructor","prototype"]),_$=new Set([...W1,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function G1(){let e=[];for(let[t,n]of Object.entries(V1).sort()){let r=[];for(let s of n.extensions)r.push(`*${s}`);for(let s of n.globs)r.push(s);e.push(`${t}: ${r.join(", ")}`)}return`${e.join(`
212
+ `)}
213
+ `}var V1,oo,pu=M(()=>{"use strict";pt();sr();V1=H1({js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}}),oo=class{types;constructor(){this.types=new Map(Object.entries(V1).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let r=t.slice(0,n),s=t.slice(n+1);if(s.startsWith("include:")){let i=s.slice(8),o=this.types.get(i);if(o){let a=this.types.get(r)||{extensions:[],globs:[]};a.extensions.push(...o.extensions),a.globs.push(...o.globs),this.types.set(r,a)}}else{let i=this.types.get(r)||{extensions:[],globs:[]};if(s.startsWith("*.")&&!s.slice(2).includes("*")){let o=s.slice(1);i.extensions.includes(o)||i.extensions.push(o)}else i.globs.includes(s)||i.globs.push(s);this.types.set(r,i)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let r=t.toLowerCase();for(let s of n){if(s==="all"){if(this.matchesAnyType(t))return!0;continue}let i=this.types.get(s);if(i){for(let o of i.extensions)if(r.endsWith(o))return!0;for(let o of i.globs)if(o.includes("*")){let a=o.replace(/\./g,"\\.").replace(/\*/g,".*");if(ie(`^${a}$`,"i").test(t))return!0}else if(r===o.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let r of this.types.values()){for(let s of r.extensions)if(n.endsWith(s))return!0;for(let s of r.globs)if(s.includes("*")){let i=s.replace(/\./g,"\\.").replace(/\*/g,".*");if(ie(`^${i}$`,"i").test(t))return!0}else if(n===s.toLowerCase())return!0}return!1}}});function q1(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:512*1024*1024,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var Z1=M(()=>{"use strict"});function gx(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function yx(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
214
+ `,exitCode:1}}function wx(e,t){return!/^\d+$/.test(t)||!Number.isSafeInteger(Number(t))?{stdout:"",stderr:`rg: invalid --${e} value: ${t}
215
+ `,exitCode:1}:null}function K1(e){return null}function Ex(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function Sx(e,t,n){let r=e[t];for(let s of Q1){if(r.startsWith(`--${s.long}=`)){let i=r.slice(`--${s.long}=`.length),o=Sa(n,s,i);return o?{newIndex:t,error:o}:{newIndex:t}}if(s.short&&r.startsWith(`-${s.short}`)&&r.length>2){let i=r.slice(2),o=Sa(n,s,i);return o?{newIndex:t,error:o}:{newIndex:t}}if(s.short&&r===`-${s.short}`||r===`--${s.long}`){if(t+1>=e.length)return null;let i=e[t+1],o=Sa(n,s,i);return o?{newIndex:t+1,error:o}:{newIndex:t+1}}}return null}function Ax(e){return Q1.find(t=>t.short===e)}function Sa(e,t,n){if(t.validate){let s=t.validate(n);if(s)return s}if(t.ignored||!t.target)return;let r=t.parse?t.parse(n):n;t.multi?e[t.target].push(r):e[t.target]=r}function Cx(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let r=e[t+1];if(r==="path"||r==="none")return{value:r,newIndex:t+1}}if(n.startsWith("--sort=")){let r=n.slice(7);if(r==="path"||r==="none")return{value:r,newIndex:t}}return null}function vx(e,t){let n=e[t],r=n.match(/^-([ABC])(\d+)$/);return r?{flag:r[1],value:parseInt(r[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function kx(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function X1(e){let t=q1(),n=null,r=[],s=-1,i=-1,o=-1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(c.startsWith("-")&&c!=="-"){let u=vx(e,l);if(u){let{flag:g,value:b,newIndex:w}=u;g==="A"?s=Math.max(s,b):g==="B"?i=Math.max(i,b):o=b,l=w;continue}let f=kx(c);if(f!==null){t.maxCount=f;continue}let d=Sx(e,l,t);if(d){if(d.error)return{success:!1,error:d.error};l=d.newIndex;continue}let p=Cx(e,l);if(p){t.sort=p.value,l=p.newIndex;continue}let h=c.startsWith("--")?[c]:c.slice(1).split(""),m=!1;for(let g of h){if(xx.has(g)){t.lineNumber=!0,a=!0;continue}if(g==="u"||g==="--unrestricted"){Ex(t);continue}if(g==="P"||g==="--pcre2")return{success:!1,error:{stdout:"",stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
216
+ `,exitCode:1}};if(g.length===1){let w=Ax(g);if(w){if(l+1>=e.length)return{success:!1,error:re("rg",`-${g}`)};let y=Sa(t,w,e[l+1]);if(y)return{success:!1,error:y};l++,m=!0;continue}}let b=bx.get(g);if(b){b(t);continue}if(g.startsWith("--"))return{success:!1,error:re("rg",g)};if(g.length===1)return{success:!1,error:re("rg",`-${g}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=c:r.push(c)}return(s>=0||o>=0)&&(t.afterContext=Math.max(s>=0?s:0,o>=0?o:0)),(i>=0||o>=0)&&(t.beforeContext=Math.max(i>=0?i:0,o>=0?o:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(a=!0),{success:!0,options:t,paths:r,explicitLineNumbers:a}}var Q1,bx,xx,Y1=M(()=>{"use strict";de();Z1();Q1=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:K1},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:K1},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:e=>Number(e),validate:e=>wx("max-depth",e)},{long:"max-filesize",target:"maxFilesize",parse:gx,validate:yx},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",ignored:!0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],bx=new Map([["i",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["--ignore-case",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["s",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["--case-sensitive",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["S",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["--smart-case",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["F",e=>{e.fixedStrings=!0}],["--fixed-strings",e=>{e.fixedStrings=!0}],["w",e=>{e.wordRegexp=!0}],["--word-regexp",e=>{e.wordRegexp=!0}],["x",e=>{e.lineRegexp=!0}],["--line-regexp",e=>{e.lineRegexp=!0}],["v",e=>{e.invertMatch=!0}],["--invert-match",e=>{e.invertMatch=!0}],["U",e=>{e.multiline=!0}],["--multiline",e=>{e.multiline=!0}],["--multiline-dotall",e=>{e.multilineDotall=!0,e.multiline=!0}],["c",e=>{e.count=!0}],["--count",e=>{e.count=!0}],["--count-matches",e=>{e.countMatches=!0}],["l",e=>{e.filesWithMatches=!0}],["--files",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!0}],["o",e=>{e.onlyMatching=!0}],["--only-matching",e=>{e.onlyMatching=!0}],["q",e=>{e.quiet=!0}],["--quiet",e=>{e.quiet=!0}],["N",e=>{e.lineNumber=!1}],["--no-line-number",e=>{e.lineNumber=!1}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["I",e=>{e.noFilename=!0}],["--no-filename",e=>{e.noFilename=!0}],["0",e=>{e.nullSeparator=!0}],["--null",e=>{e.nullSeparator=!0}],["b",e=>{e.byteOffset=!0}],["--byte-offset",e=>{e.byteOffset=!0}],["--column",e=>{e.column=!0,e.lineNumber=!0}],["--no-column",e=>{e.column=!1}],["--vimgrep",e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],["--json",e=>{e.json=!0}],["--hidden",e=>{e.hidden=!0}],["--no-ignore",e=>{e.noIgnore=!0}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!0}],["L",e=>{e.followSymlinks=!0}],["--follow",e=>{e.followSymlinks=!0}],["z",e=>{e.searchZip=!0}],["--search-zip",e=>{e.searchZip=!0}],["a",e=>{e.searchBinary=!0}],["--text",e=>{e.searchBinary=!0}],["--heading",e=>{e.heading=!0}],["--passthru",e=>{e.passthru=!0}],["--include-zero",e=>{e.includeZero=!0}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),xx=new Set(["n","--line-number"])});function Nx(e){return`'${e.replace(/'/g,"'\\''")}'`}function In(e){return e.map(Nx).join(" ")}var vs=M(()=>{"use strict"});async function hu(e,t,n=!1,r=!1,s=[]){let i=new lo(e,t,n,r);await i.load(t);for(let o of s)try{let a=e.resolvePath(t,o),l=await e.readFile(a);i.addPatternsFromContent(l,t)}catch{}return i}var ao,lo,J1=M(()=>{"use strict";pt();ao=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
217
+ `);for(let r of n){let s=r.replace(/\s+$/,"");if(!s||s.startsWith("#"))continue;let i=!1;s.startsWith("!")&&(i=!0,s=s.slice(1));let o=!1;s.endsWith("/")&&(o=!0,s=s.slice(0,-1));let a=!1;s.startsWith("/")?(a=!0,s=s.slice(1)):s.includes("/")&&!s.startsWith("**/")&&(a=!0);let l=this.patternToRegex(s,a);this.patterns.push({pattern:r,regex:l,negated:i,directoryOnly:o,rooted:a})}}patternToRegex(t,n){let r="";n?r="^":r="(?:^|/)";let s=0;for(;s<t.length;){let i=t[s];if(i==="*")t[s+1]==="*"?t[s+2]==="/"?(r+="(?:.*/)?",s+=3):(s+2>=t.length,r+=".*",s+=2):(r+="[^/]*",s++);else if(i==="?")r+="[^/]",s++;else if(i==="["){let o=s+1;for(o<t.length&&t[o]==="!"&&o++,o<t.length&&t[o]==="]"&&o++;o<t.length&&t[o]!=="]";)o++;if(o<t.length){let a=t.slice(s,o+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),r+=a,s=o+1}else r+="\\[",s++}else i==="/"?(r+="/",s++):(r+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s++)}return r+="(?:/.*)?$",ie(r)}matches(t,n){let r=t.replace(/^\.\//,"");r=r.replace(/^\//,"");let s=!1;for(let i of this.patterns)i.directoryOnly&&!n||i.regex.test(r)&&(s=!i.negated);return s}isWhitelisted(t,n){let r=t.replace(/^\.\//,"");r=r.replace(/^\//,"");for(let s of this.patterns)if(!(s.directoryOnly&&!n)&&s.negated&&s.regex.test(r))return!0;return!1}getBasePath(){return this.basePath}},lo=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,r=!1,s=!1){this.fs=t,this.skipDotIgnore=r,this.skipVcsIgnore=s}async load(t){let n=[],r=t;for(;;){n.unshift(r);let i=this.fs.resolvePath(r,"..");if(i===r)break;r=i}let s=[];this.skipVcsIgnore||s.push(".gitignore"),this.skipDotIgnore||s.push(".rgignore",".ignore");for(let i of n){this.loadedDirs.add(i);for(let o of s){let a=this.fs.resolvePath(i,o);try{let l=await this.fs.readFile(a),c=new ao(i);c.parse(l),this.parsers.push(c)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let r of n){let s=this.fs.resolvePath(t,r);try{let i=await this.fs.readFile(s),o=new ao(t);o.parse(i),this.parsers.push(o)}catch{}}}addPatternsFromContent(t,n){let r=new ao(n);r.parse(t),this.parsers.push(r)}matches(t,n){for(let r of this.parsers){let s=r.getBasePath();if(!t.startsWith(s))continue;let i=t.slice(s.length).replace(/^\//,"");if(r.matches(i,n))return!0}return!1}isWhitelisted(t,n){for(let r of this.parsers){let s=r.getBasePath();if(!t.startsWith(s))continue;let i=t.slice(s.length).replace(/^\//,"");if(r.isWhitelisted(i,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}}});import{gunzipSync as Ix}from"node:zlib";function Ox(e){return e.length>=2&&e[0]===31&&e[1]===139}function Tx(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r==="["&&!t?t=!0:r==="]"&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}function em(e,t){if(!Number.isSafeInteger(t)||t<0||t>e.limits.maxStringLength||t>Math.floor(e.limits.maxLiveBytes/3))throw new C(t>e.limits.maxStringLength?`rg: pattern file exceeds string limit (${e.limits.maxStringLength} bytes)`:`rg: live byte limit exceeded (${e.limits.maxLiveBytes} bytes)`,"string_length");return e.executionScope?.reserveBytes("rg pattern files",t*3,"rg")??{release:()=>{}}}function Rx(e,t,n){let r=0;for(let s=0;s<=t.length;s++)if(!(s<t.length&&t.charCodeAt(s)!==10)){if(s>r){if(e.length>=n.limits.maxArrayElements)throw new C(`rg: pattern limit exceeded (${n.limits.maxArrayElements})`,"iterations");n.executionScope?.consumeWork(1,"rg pattern insertion"),e.push(t.slice(r,s))}r=s+1}}function tm(e,t,n){if(t>e.limits.maxInputBytes-n)throw new C(`rg: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");return e.executionScope?.consumeInput(t,"rg pattern files"),n+t}async function nm(e){let{ctx:t,options:n,paths:r,explicitLineNumbers:s}=e;for(let y of n.globs){let x=y.startsWith("!")?y.slice(1):y,S=Tx(x);if(S)return{stdout:"",stderr:`${S}
218
+ `,exitCode:1}}if(n.files){let y=[...n.patterns,...r];return Dx(t,y,n)}if(n.patterns.length>t.limits.maxArrayElements)throw new C(`rg: pattern limit exceeded (${t.limits.maxArrayElements})`,"iterations");let i=n.patterns.slice(),o=[],a=0,l,c;try{for(let x of n.patternFiles)try{let S,E;if(x==="-")S=t.stdin,E=t.stdin.length,a=tm(t,E,a);else{let I=t.fs.resolvePath(t.cwd,x);E=(await t.fs.stat(I)).size,a=tm(t,E,a);let N=em(t,E);o.push(N),S=await jt(t.fs,I);let R=S.length;if(R>E)throw new C("rg: pattern file grew while being read","string_length");E=R}x==="-"&&o.push(em(t,E));let A=ue(S,t.limits.maxStringLength);t.executionScope?.consumeWork(A.length,"rg pattern file parsing"),Rx(i,A,t)}catch(S){return he(S),{stdout:"",stderr:`rg: ${x}: No such file or directory
219
+ `,exitCode:2}}if(i.length===0)return n.patternFiles.length>0?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`rg: no pattern given
220
+ `,exitCode:2};let y=$x(n,i);try{let x=Px(i,n,y);l=x.regex,c=x.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${i.join(", ")}
221
+ `,exitCode:2}}}finally{for(let y of o)y.release()}let u=n.patternFiles.includes("-"),f=ue(t.stdin);if(r.length===0&&f.length>0&&!u){let x=As(f,l,{invertMatch:n.invertMatch,showLineNumbers:n.lineNumber,countOnly:n.count,countMatches:n.countMatches,filename:"",onlyMatching:n.onlyMatching,beforeContext:n.beforeContext,afterContext:n.afterContext,maxCount:n.maxCount,contextSeparator:n.contextSeparator,showColumn:n.column,vimgrep:n.vimgrep,showByteOffset:n.byteOffset,replace:n.replace!==null?wa(n.replace):null,passthru:n.passthru,multiline:n.multiline,kResetGroup:c,maxWork:t.limits.maxLoopIterations,maxMatches:t.limits.maxArrayElements,signal:t.signal});return n.quiet?{stdout:"",stderr:"",exitCode:x.matched?0:1}:n.filesWithMatches?{stdout:x.matched?`(standard input)
222
+ `:"",stderr:"",exitCode:x.matched?0:1}:n.filesWithoutMatch?{stdout:x.matched?"":`(standard input)
223
+ `,stderr:"",exitCode:x.matched?1:0}:{stdout:x.output,stderr:"",exitCode:x.matched?0:1}}let d=r.length===0?["."]:r,p=null;n.noIgnore||(p=await hu(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let h=new oo;for(let y of n.typeClear)h.clearType(y);for(let y of n.typeAdd)h.addType(y);let{files:m,singleExplicitFile:g}=await rm(t,d,n,p,h);if(m.length===0)return{stdout:"",stderr:"",exitCode:1};let b=!n.noFilename&&(n.withFilename||!g||m.length>1),w=n.lineNumber;return s||(g&&m.length===1&&(w=!1),n.onlyMatching&&(w=!1)),_x(t,m,l,n,b,w,c)}function $x(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function Px(e,t,n){let r;return e.length===1?r=e[0]:r=e.map(s=>t.fixedStrings?s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${s})`).join("|"),fi(r,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function rm(e,t,n,r,s){let i=[],o=new Pt({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"rg"}),a=0,l=0;for(let u of t){o.checkpoint();let f=e.fs.resolvePath(e.cwd,u);try{let d=await e.fs.stat(f);if(d.isFile){if(a++,n.maxFilesize>0&&d.size>n.maxFilesize)continue;if(im(u,n,r,f,s)){if(i.length>=e.limits.maxArrayElements)throw new C(`rg: file collection limit exceeded (${e.limits.maxArrayElements})`,"array_elements");i.push(u)}}else d.isDirectory&&(l++,await sm(e,u,f,0,n,r,s,i,o,new Set))}catch(d){he(d)}}return{files:n.sort==="path"?i.sort():i,singleExplicitFile:a===1&&l===0}}async function sm(e,t,n,r,s,i,o,a,l,c){if(r>=s.maxDepth)return;l.visit(r);let u;if(s.followSymlinks)try{let f=await e.fs.stat(n);if(u=f.identity!==void 0?`identity:${f.identity}`:f.dev!==void 0&&f.ino!==void 0?`inode:${String(f.dev)}:${String(f.ino)}`:`path:${await e.fs.realpath(n)}`,c.has(u))return;c.add(u)}catch(f){he(f);return}i&&await i.loadForDirectory(n);try{let f=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(d=>({name:d,isFile:void 0}));for(let d of f){l.checkpoint();let p=d.name;if(!s.noIgnore&&lo.isCommonIgnored(p))continue;let h=p.startsWith("."),m=t==="."?p:t==="./"?`./${p}`:t.endsWith("/")?`${t}${p}`:`${t}/${p}`,g=e.fs.resolvePath(n,p),b,w,y=!1;if(d.isFile!==void 0&&"isDirectory"in d){let E=d;if(y=E.isSymbolicLink===!0,y&&!s.followSymlinks)continue;if(y&&s.followSymlinks)try{let A=await e.fs.stat(g);b=A.isFile,w=A.isDirectory}catch{continue}else b=E.isFile,w=E.isDirectory}else try{let E=e.fs.lstat?await e.fs.lstat(g):await e.fs.stat(g);if(y=E.isSymbolicLink===!0,y&&!s.followSymlinks)continue;let A=y&&s.followSymlinks?await e.fs.stat(g):E;b=A.isFile,w=A.isDirectory}catch{continue}if(!i?.matches(g,w)&&!(h&&!s.hidden&&!i?.isWhitelisted(g,w))){if(w)await sm(e,m,g,r+1,s,i,o,a,l,c);else if(b){if(l.visit(r+1),s.maxFilesize>0)try{if((await e.fs.stat(g)).size>s.maxFilesize)continue}catch{continue}if(im(m,s,i,g,o)){if(a.length>=e.limits.maxArrayElements)throw new C(`rg: file collection limit exceeded (${e.limits.maxArrayElements})`,"array_elements");a.push(m)}}}}}catch(f){he(f)}finally{u!==void 0&&c.delete(u)}}function im(e,t,n,r,s){let i=e.split("/").pop()||e;if(n?.matches(r,!1)||t.types.length>0&&!s.matchesType(i,t.types)||t.typesNot.length>0&&s.matchesType(i,t.typesNot))return!1;if(t.globs.length>0){let o=t.globCaseInsensitive,a=t.globs.filter(c=>!c.startsWith("!")),l=t.globs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(a.length>0){let c=!1;for(let u of a)if(ir(i,u,o)||ir(e,u,o)){c=!0;break}if(!c)return!1}for(let c of l)if(c.startsWith("/")){let u=c.slice(1);if(ir(e,u,o))return!1}else if(ir(i,c,o)||ir(e,c,o))return!1}if(t.iglobs.length>0){let o=t.iglobs.filter(l=>!l.startsWith("!")),a=t.iglobs.filter(l=>l.startsWith("!")).map(l=>l.slice(1));if(o.length>0){let l=!1;for(let c of o)if(ir(i,c,!0)||ir(e,c,!0)){l=!0;break}if(!l)return!1}for(let l of a)if(l.startsWith("/")){let c=l.slice(1);if(ir(e,c,!0))return!1}else if(ir(i,l,!0)||ir(e,l,!0))return!1}return!0}function ir(e,t,n=!1){let r="^";for(let s=0;s<t.length;s++){let i=t[s];if(i==="*")t[s+1]==="*"?(r+=".*",s++):r+="[^/]*";else if(i==="?")r+="[^/]";else if(i==="["){let o=s+1;for(o<t.length&&t[o]==="!"&&o++,o<t.length&&t[o]==="]"&&o++;o<t.length&&t[o]!=="]";)o++;if(o<t.length){let a=t.slice(s,o+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),r+=a,s=o}else r+="\\["}else r+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return r+="$",ie(r,n?"i":"").test(e)}async function Dx(e,t,n){let r=null;n.noIgnore||(r=await hu(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let s=new oo;for(let u of n.typeClear)s.clearType(u);for(let u of n.typeAdd)s.addType(u);let i=t.length===0?["."]:t,{files:o}=await rm(e,i,n,r,s);if(o.length===0)return{stdout:"",stderr:"",exitCode:1};if(n.quiet)return{stdout:"",stderr:"",exitCode:0};let a=n.nullSeparator?"\0":`
224
+ `,l=new Te(Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),"rg");for(let u of o)l.append(u).append(a);return{stdout:l.build(),stderr:"",exitCode:0}}function Lx(e,t){if(t.length===0)return!0;for(let n of t)if(ir(e,n,!1))return!0;return!1}async function Fx(e,t,n,r){let s;try{if(r.preprocessor&&e.exec){let u=n.split("/").pop()||n;if(Lx(u,r.preprocessorGlobs)){let f=await e.exec(In([r.preprocessor]),{cwd:e.cwd,signal:e.signal,args:[t]});if(f.exitCode===0&&f.stdout){s=e.executionScope?.reserveBytes("rg preprocessor text",f.stdout.length,"rg preprocessor");let d=ue(f.stdout);e.executionScope?.consumeInput(U(d),"rg preprocessor");let p=d.slice(0,8192);return{content:d,isBinary:p.includes("\0"),lease:s}}}}if(r.searchZip&&n.endsWith(".gz")){let u=await e.fs.stat(t),f=e.executionScope?.reserveBytes("rg compressed input",u.size,"rg"),d=await e.fs.readFileBuffer(t);if(d.byteLength>u.size)throw f?.release(),new C("rg: file grew while being read","string_length");if(e.executionScope?.consumeInput(d.byteLength,"rg"),Ox(d)){let p;try{let h=Math.min(e.limits.maxStringLength,e.limits.maxOutputSize,Math.floor((e.executionScope?.remainingLiveBytes??e.limits.maxLiveBytes)/2));p=e.executionScope?.reserveBytes("rg decompressed text",h*2,"rg");let m=Ix(d,{maxOutputLength:h}),g=new TextDecoder().decode(m),b=g.slice(0,8192);return{content:g,isBinary:b.includes("\0"),lease:Mx(f,p)}}catch(h){return p?.release(),f?.release(),he(h),null}}f?.release()}let i=await e.fs.stat(t);s=e.executionScope?.reserveBytes("rg file text",i.size*2,"rg");let o=await jt(e.fs,t),a=o.length;if(a>i.size)throw new C("rg: file grew while being read","string_length");e.executionScope?.consumeInput(a,"rg");let l=ue(o,e.limits.maxStringLength),c=l.slice(0,8192);return{content:l,isBinary:c.includes("\0"),lease:s}}catch(i){return s?.release(),he(i),null}}function Mx(...e){let t=e.filter(n=>n!==void 0);if(t.length!==0)return{release:()=>{for(let n of t)n.release()}}}async function _x(e,t,n,r,s,i,o){let a="",l=!1,c=[],u=0,f=0,d=0,p=r.searchZip?2:50;e:for(let g=0;g<t.length;g+=p){let b=t.slice(g,g+p),w=await Promise.all(b.map(async y=>{let x=e.fs.resolvePath(e.cwd,y),S=await Fx(e,x,y,r);if(!S)return null;let{content:E,isBinary:A,lease:I}=S;if(d+=E.length,A&&!r.searchBinary)return I?.release(),null;let $=s&&!r.heading?y:"";try{let N=As(E,n,{invertMatch:r.invertMatch,showLineNumbers:i,countOnly:r.count,countMatches:r.countMatches,filename:$,onlyMatching:r.onlyMatching,beforeContext:r.beforeContext,afterContext:r.afterContext,maxCount:r.maxCount,contextSeparator:r.contextSeparator,showColumn:r.column,vimgrep:r.vimgrep,showByteOffset:r.byteOffset,replace:r.replace!==null?wa(r.replace):null,passthru:r.passthru,multiline:r.multiline,kResetGroup:o,maxWork:e.limits.maxLoopIterations,maxMatches:e.limits.maxArrayElements,signal:e.signal});return r.json&&N.matched?{file:y,result:N,content:E,isBinary:!1,lease:I}:(I?.release(),{file:y,result:N})}catch(N){throw I?.release(),N}}));for(let y of w){if(!y)continue;let{file:x,result:S}=y;if(S.matched){if(l=!0,f++,u+=S.matchCount,r.quiet&&!r.json)break e;if(r.json&&!r.quiet){let E=y.content||"";c.push(JSON.stringify({type:"begin",data:{path:{text:x}}}));let A=E.split(`
225
+ `);n.lastIndex=0;let I=0;for(let $=0;$<A.length;$++){let N=A[$];n.lastIndex=0;let R=[];for(let O=n.exec(N);O!==null;O=n.exec(N)){let B={match:{text:O[0]},start:O.index,end:O.index+O[0].length};r.replace!==null&&(B.replacement={text:r.replace}),R.push(B),O[0].length===0&&n.lastIndex++}if(R.length>0){let O={type:"match",data:{path:{text:x},lines:{text:`${N}
226
+ `},line_number:$+1,absolute_offset:I,submatches:R}};c.push(JSON.stringify(O))}I+=N.length+1}c.push(JSON.stringify({type:"end",data:{path:{text:x},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:E.length,bytes_printed:0,matched_lines:S.matchCount,matches:S.matchCount}}}))}else if(r.filesWithMatches){let E=r.nullSeparator?"\0":`
227
+ `;a+=`${x}${E}`}else r.filesWithoutMatch||(r.heading&&!r.noFilename&&(a+=`${x}
228
+ `),a+=S.output)}else if(r.filesWithoutMatch){let E=r.nullSeparator?"\0":`
229
+ `;a+=`${x}${E}`}else r.includeZero&&(r.count||r.countMatches)&&(a+=S.output);y.lease?.release()}}r.json&&(c.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:f,bytes_searched:d,bytes_printed:0,matched_lines:u,matches:u}}})),a=`${c.join(`
230
+ `)}
231
+ `);let h=r.quiet&&!r.json?"":a;if(r.stats&&!r.json){let g=["",`${u} matches`,`${u} matched lines`,`${f} files contained matches`,`${t.length} files searched`,`${d} bytes searched`].join(`
232
+ `);h+=`${g}
233
+ `}let m;return r.filesWithoutMatch?m=a.length>0?0:1:m=l?0:1,{stdout:h,stderr:"",exitCode:m}}var om=M(()=>{"use strict";At();ce();Nt();Bn();vs();Z();pt();uu();pu();J1()});var am={};ae(am,{flagsForFuzzing:()=>zx,rgCommand:()=>Ux});var Bx,Ux,zx,lm=M(()=>{"use strict";de();pu();Y1();om();Bx={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern.
234
+ Unlike grep, rg is recursive by default and respects .gitignore files.
235
+
236
+ EXAMPLES:
237
+ rg foo Search for 'foo' in current directory
238
+ rg foo src/ Search in src/ directory
239
+ rg -i foo Case-insensitive search
240
+ rg -w foo Match whole words only
241
+ rg -t js foo Search only JavaScript files
242
+ rg -g '*.ts' foo Search files matching glob
243
+ rg --hidden foo Include hidden files
244
+ rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},Ux={name:"rg",async execute(e,t){if(q(e))return G(Bx);if(e.includes("--type-list"))return{stdout:G1(),stderr:"",exitCode:0};let n=X1(e);return n.success?nm({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},zx={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",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:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0}});function Ct(e,t,n){if(!e||$t.isInSandboxedContext())return;let r=`${t} ${n} attempted outside defense context`;throw new Ae(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:$t.getCurrentExecutionId()})}async function on(e,t,n,r){Ct(e,t,`${n} (pre-await)`);let s=await r();return Ct(e,t,`${n} (post-await)`),s}var Er=M(()=>{"use strict";vn()});function yu(e){let t="",n=0,r=!1;for(;n<e.length;){if(e[n]==="["&&!r){if(e[n+1]==="["&&e[n+2]===":"){let s=e.indexOf(":]]",n+3);if(s!==-1){let i=e.slice(n+3,s),o=gu.get(i);if(o){t+=`[${o}]`,n=s+3;continue}}}if(e[n+1]==="^"&&e[n+2]==="["&&e[n+3]===":"){let s=e.indexOf(":]]",n+4);if(s!==-1){let i=e.slice(n+4,s),o=gu.get(i);if(o){t+=`[^${o}]`,n=s+3;continue}}}t+="[",n++,r=!0,n<e.length&&e[n]==="^"&&(t+="^",n++),n<e.length&&e[n]==="]"&&(t+="\\]",n++);continue}if(r){if(e[n]==="]"){t+="]",n++,r=!1;continue}if(e[n]==="["&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),o=gu.get(i);if(o){t+=o,n=s+2;continue}}}if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++;continue}if(e[n]==="\\"&&n+1<e.length){let s=e[n+1];if(s==="+"||s==="?"||s==="|"){t+=s,n+=2;continue}if(s==="("||s===")"){t+=s,n+=2;continue}if(s==="{"||s==="}"){t+=s,n+=2;continue}if(s==="t"){t+=" ",n+=2;continue}if(s==="n"){t+=`
245
+ `,n+=2;continue}if(s==="r"){t+="\r",n+=2;continue}t+=e[n]+s,n+=2;continue}if(e[n]==="+"||e[n]==="?"||e[n]==="|"||e[n]==="("||e[n]===")"){t+=`\\${e[n]}`,n++;continue}if(e[n]==="^"&&!(t===""||t.endsWith("("))){t+="\\^",n++;continue}if(e[n]==="$"){let s=n===e.length-1,i=n+2<e.length&&e[n+1]==="\\"&&e[n+2]===")";if(!s&&!i){t+="\\$",n++;continue}}t+=e[n],n++}return t}function wu(e){let t="",n=!1;for(let r=0;r<e.length;r++)e[r]==="["&&!n?(n=!0,t+="[",r++,r<e.length&&e[r]==="^"&&(t+="^",r++),r<e.length&&e[r]==="]"&&(t+="]",r++),r--):e[r]==="]"&&n?(n=!1,t+="]"):!n&&e[r]==="{"&&e[r+1]===","?(t+="{0,",r++):t+=e[r];return t}function cm(e){let t="";for(let n=0;n<e.length;n++){let r=e[n],s=r.charCodeAt(0);r==="\\"?t+="\\\\":r===" "?t+="\\t":r===`
246
+ `?t+=`$
247
+ `:r==="\r"?t+="\\r":r==="\x07"?t+="\\a":r==="\b"?t+="\\b":r==="\f"?t+="\\f":r==="\v"?t+="\\v":s<32||s>=127?t+=`\\${s.toString(8).padStart(3,"0")}`:t+=r}return`${t}$`}var gu,um=M(()=>{"use strict";gu=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]])});function dm(e,t,n){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:e,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:t,pendingFileReads:[],pendingFileWrites:[],rangeStates:n||new Map,linesConsumedInCycle:0}}function jx(e){return typeof e=="object"&&"first"in e&&"step"in e}function Hx(e){return typeof e=="object"&&"offset"in e}function pi(e,t,n,r,s){if(e==="$")return t===n;if(typeof e=="number")return t===e;if(jx(e)){let{first:i,step:o}=e;return o===0?t===i:(t-i)%o===0&&t>=i}if(typeof e=="object"&&"pattern"in e)try{let i=e.pattern;i===""&&s?.lastPattern?i=s.lastPattern:i!==""&&s&&(s.lastPattern=i);let o=wu(yu(i));return ie(o).test(r)}catch{return!1}return!1}function bu(e){let t=n=>n===void 0?"undefined":n==="$"?"$":typeof n=="number"?String(n):"pattern"in n?`/${n.pattern}/`:"first"in n?`${n.first}~${n.step}`:"unknown";return`${t(e.start)},${t(e.end)}`}function Vx(e,t,n,r,s,i){if(!e||!e.start&&!e.end)return!0;let o=e.start,a=e.end;if(o!==void 0&&a===void 0)return pi(o,t,n,r,i);if(o!==void 0&&a!==void 0){let l=typeof o=="object"&&"pattern"in o,c=typeof a=="object"&&"pattern"in a,u=Hx(a);if(u&&s){let d=bu(e),p=s.get(d);if(p||(p={active:!1},s.set(d,p)),p.active){let h=p.startLine||t;return t>=h+a.offset&&(p.active=!1,s.set(d,p)),!0}else return pi(o,t,n,r,i)?(p.active=!0,p.startLine=t,s.set(d,p),a.offset===0&&(p.active=!1,s.set(d,p)),!0):!1}if(!l&&!c&&!u){let d=typeof o=="number"?o:o==="$"?n:1,p=typeof a=="number"?a:n;if(d<=p)return t>=d&&t<=p;if(s){let h=bu(e),m=s.get(h);return m||(m={active:!1},s.set(h,m)),!m.completed&&t>=d?(m.completed=!0,s.set(h,m),!0):!1}return!1}if(s){let d=bu(e),p=s.get(d);if(p||(p={active:!1},s.set(d,p)),p.active)return pi(a,t,n,r,i)&&(p.active=!1,typeof o=="number"&&(p.completed=!0),s.set(d,p)),!0;{if(p.completed)return!1;let h=!1;return typeof o=="number"?h=t>=o:h=pi(o,t,n,r,i),h?(p.active=!0,p.startLine=t,s.set(d,p),pi(a,t,n,r,i)&&(p.active=!1,typeof o=="number"&&(p.completed=!0),s.set(d,p)),!0):!1}}return pi(o,t,n,r,i)}return!0}function ks(e,t,n,r,s,i){let o=Vx(e,t,n,r,s,i);return e?.negated?!o:o}function Gx(e,t,n,r){let s="",i=0,o=!1;for(;i<=e.length;){t.lastIndex=i;let a=t.exec(e);if(!a){s+=e.slice(i);break}if(a.index!==i){s+=e.slice(i,a.index),i=a.index,o=!1;continue}let l=a[0],c=a.slice(1);if(o&&l.length===0){if(i<e.length)s+=e[i],i++;else break;o=!1;continue}if(s+=r(l,c),o=!1,l.length===0)if(i<e.length)s+=e[i],i++;else break;else i+=l.length,o=!0}return s}function xu(e,t,n){let r="",s=0;for(;s<e.length;){if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];if(i==="&"){r+="&",s+=2;continue}if(i==="n"){r+=`
248
+ `,s+=2;continue}if(i==="t"){r+=" ",s+=2;continue}if(i==="r"){r+="\r",s+=2;continue}let o=parseInt(i,10);if(o===0){r+=t,s+=2;continue}if(o>=1&&o<=9){r+=n[o-1]||"",s+=2;continue}r+=i,s+=2;continue}if(e[s]==="&"){r+=t,s++;continue}r+=e[s],s++}return r}function fm(e,t,n){if(t>0&&e.length>t)throw new C(`sed: ${n} size limit exceeded (${t} bytes)`,"string_length")}function qx(e,t,n){let{lineNumber:r,totalLines:s,patternSpace:i}=t;if(e.type==="label"){t.coverage?.hit(`sed:cmd:${e.type}`);return}if(ks(e.address,r,s,i,t.rangeStates,t))switch(t.coverage?.hit(`sed:cmd:${e.type}`),e.type){case"substitute":{let o=e,a="";o.global&&(a+="g"),o.ignoreCase&&(a+="i");let l=o.pattern;l===""&&t.lastPattern?l=t.lastPattern:l!==""&&(t.lastPattern=l);let c=wu(o.extendedRegex?l:yu(l));try{let u=ie(c,a),f=u.test(t.patternSpace);if(u.lastIndex=0,f){if(t.substitutionMade=!0,o.nthOccurrence&&o.nthOccurrence>0&&!o.global){let d=0,p=o.nthOccurrence,h=ie(c,`g${o.ignoreCase?"i":""}`);t.patternSpace=h.replace(t.patternSpace,(m,...g)=>{if(d++,d===p){let b=g.slice(0,-2);return xu(o.replacement,m,b)}return m})}else if(o.global){let d=ie(c,`g${o.ignoreCase?"i":""}`);t.patternSpace=Gx(t.patternSpace,d,o.replacement,(p,h)=>xu(o.replacement,p,h))}else t.patternSpace=u.replace(t.patternSpace,(d,...p)=>{let h=p.slice(0,-2);return xu(o.replacement,d,h)});o.printOnMatch&&t.lineNumberOutput.push(t.patternSpace)}}catch{}break}case"print":t.lineNumberOutput.push(t.patternSpace);break;case"printFirstLine":{let o=t.patternSpace.indexOf(`
249
+ `);o!==-1?t.lineNumberOutput.push(t.patternSpace.slice(0,o)):t.lineNumberOutput.push(t.patternSpace);break}case"delete":t.deleted=!0;break;case"deleteFirstLine":{let o=t.patternSpace.indexOf(`
250
+ `);o!==-1?(t.patternSpace=t.patternSpace.slice(o+1),t.restartCycle=!0,t.inDRestartedCycle=!0):t.deleted=!0;break}case"zap":t.patternSpace="";break;case"append":t.appendBuffer.push(e.text);break;case"insert":t.appendBuffer.unshift(`__INSERT__${e.text}`);break;case"change":t.deleted=!0,t.changedText=e.text;break;case"hold":t.holdSpace=t.patternSpace;break;case"holdAppend":t.holdSpace?t.holdSpace+=`
251
+ ${t.patternSpace}`:t.holdSpace=t.patternSpace,fm(t.holdSpace,n?.maxStringLength??0,"hold space");break;case"get":t.patternSpace=t.holdSpace;break;case"getAppend":t.patternSpace+=`
252
+ ${t.holdSpace}`,fm(t.patternSpace,n?.maxStringLength??0,"pattern space");break;case"exchange":{let o=t.patternSpace;t.patternSpace=t.holdSpace,t.holdSpace=o;break}case"next":t.printed=!0;break;case"quit":t.quit=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case"quitSilent":t.quit=!0,t.quitSilent=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case"list":{let o=cm(t.patternSpace);t.lineNumberOutput.push(o);break}case"printFilename":t.currentFilename&&t.lineNumberOutput.push(t.currentFilename);break;case"version":{let o=[4,8,0];if(e.minVersion){let a=e.minVersion.split("."),l=[],c=!1;for(let u of a){let f=parseInt(u,10);if(Number.isNaN(f)||f<0){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: invalid version string: ${e.minVersion}`,c=!0;break}l.push(f)}if(!c){for(;l.length<3;)l.push(0);for(let u=0;u<3;u++){if(l[u]>o[u]){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: this is not GNU sed version ${e.minVersion}`;break}if(l[u]<o[u])break}}}break}case"readFile":t.pendingFileReads.push({filename:e.filename,wholeFile:!0});break;case"readFileLine":t.pendingFileReads.push({filename:e.filename,wholeFile:!1});break;case"writeFile":t.pendingFileWrites.push({filename:e.filename,content:`${t.patternSpace}
253
+ `});break;case"writeFirstLine":{let o=t.patternSpace.indexOf(`
254
+ `),a=o!==-1?t.patternSpace.slice(0,o):t.patternSpace;t.pendingFileWrites.push({filename:e.filename,content:`${a}
255
+ `});break}case"execute":t.errorMessage="sed: e command (shell execution) is not supported in sandboxed environment",t.quit=!0;break;case"transliterate":t.patternSpace=Zx(t.patternSpace,e);break;case"lineNumber":t.lineNumberOutput.push(String(t.lineNumber));break;case"branch":break;case"branchOnSubst":break;case"branchOnNoSubst":break;case"group":break}}function Zx(e,t){let n="";for(let r of e){let s=t.source.indexOf(r);s!==-1?n+=t.dest[s]:n+=r}return n}function Eu(e,t,n,r){let s=new Map;for(let l=0;l<e.length;l++){let c=e[l];c.type==="label"&&s.set(c.name,l)}let i=r?.maxIterations??Wx,o=0,a=0;for(;a<e.length;){if(o++,o>i)throw new C(`sed: command execution exceeded maximum iterations (${i})`,"iterations");if(t.deleted||t.quit||t.quitSilent||t.restartCycle)break;let l=e[a];if(l.type==="next"){if(ks(l.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit("sed:cmd:next"),t.nCommandOutput.push(t.patternSpace),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length){t.linesConsumedInCycle++;let c=n.lines[n.currentLineIndex+t.linesConsumedInCycle];t.patternSpace=c,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1,t.substitutionMade=!1}else{t.quit=!0,t.deleted=!0;break}a++;continue}if(l.type==="nextAppend"){if(ks(l.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit("sed:cmd:nextAppend"),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length){t.linesConsumedInCycle++;let c=n.lines[n.currentLineIndex+t.linesConsumedInCycle];t.patternSpace+=`
256
+ ${c}`,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1}else{t.quit=!0;break}a++;continue}if(l.type==="branch"){let c=l;if(ks(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)){if(t.coverage?.hit("sed:cmd:branch"),c.label){let u=s.get(c.label);if(u!==void 0){a=u;continue}t.branchRequest=c.label;break}break}a++;continue}if(l.type==="branchOnSubst"){let c=l;if(ks(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit("sed:cmd:branchOnSubst"),t.substitutionMade)){if(t.substitutionMade=!1,c.label){let u=s.get(c.label);if(u!==void 0){a=u;continue}t.branchRequest=c.label;break}break}a++;continue}if(l.type==="branchOnNoSubst"){let c=l;if(ks(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit("sed:cmd:branchOnNoSubst"),!t.substitutionMade)){if(c.label){let u=s.get(c.label);if(u!==void 0){a=u;continue}t.branchRequest=c.label;break}break}a++;continue}if(l.type==="group"){let c=l;if(ks(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit("sed:cmd:group"),Eu(c.commands,t,n,r),t.branchRequest)){let u=s.get(t.branchRequest);if(u!==void 0){t.branchRequest=void 0,a=u;continue}break}a++;continue}qx(l,t,r),a++}return t.linesConsumedInCycle}var Wx,pm=M(()=>{"use strict";Z();pt();um();Wx=1e4});var le,Aa,hm=M(()=>{"use strict";Z();(function(e){e.NUMBER="NUMBER",e.DOLLAR="DOLLAR",e.PATTERN="PATTERN",e.STEP="STEP",e.RELATIVE_OFFSET="RELATIVE_OFFSET",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.COMMA="COMMA",e.NEGATION="NEGATION",e.COMMAND="COMMAND",e.SUBSTITUTE="SUBSTITUTE",e.TRANSLITERATE="TRANSLITERATE",e.LABEL_DEF="LABEL_DEF",e.BRANCH="BRANCH",e.BRANCH_ON_SUBST="BRANCH_ON_SUBST",e.BRANCH_ON_NO_SUBST="BRANCH_ON_NO_SUBST",e.TEXT_CMD="TEXT_CMD",e.FILE_READ="FILE_READ",e.FILE_READ_LINE="FILE_READ_LINE",e.FILE_WRITE="FILE_WRITE",e.FILE_WRITE_LINE="FILE_WRITE_LINE",e.EXECUTE="EXECUTE",e.VERSION="VERSION",e.EOF="EOF",e.ERROR="ERROR"})(le||(le={}));Aa=class{maxInputLength;maxTokens;input;pos=0;line=1;column=1;constructor(t,n=1024*1024,r=1e5){this.maxInputLength=n,this.maxTokens=r,this.input=t}tokenize(){if(this.input.length>this.maxInputLength)throw new C(`sed: script size limit exceeded (${this.maxInputLength} bytes)`,"string_length");let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();if(n){if(t.length>=this.maxTokens-1)throw new C(`sed: token limit exceeded (${this.maxTokens})`,"array_elements");t.push(n)}}return t.push(this.makeToken(le.EOF,"")),t}makeToken(t,n,r){return{type:t,value:n,line:this.line,column:this.column,...r}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
257
+ `?(this.line++,this.column=1):this.column++,t}readEscapedString(t){let n="";for(;this.pos<this.input.length&&this.peek()!==t;)if(this.peek()==="\\"){this.advance();let r=this.advance();r==="n"?n+=`
258
+ `:r==="t"?n+=" ":n+=r}else{if(this.peek()===`
259
+ `)return null;n+=this.advance()}return n}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
260
+ `;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,r=this.peek();return r===`
261
+ `?(this.advance(),{type:le.NEWLINE,value:`
262
+ `,line:t,column:n}):r===";"?(this.advance(),{type:le.SEMICOLON,value:";",line:t,column:n}):r==="{"?(this.advance(),{type:le.LBRACE,value:"{",line:t,column:n}):r==="}"?(this.advance(),{type:le.RBRACE,value:"}",line:t,column:n}):r===","?(this.advance(),{type:le.COMMA,value:",",line:t,column:n}):r==="!"?(this.advance(),{type:le.NEGATION,value:"!",line:t,column:n}):r==="$"?(this.advance(),{type:le.DOLLAR,value:"$",line:t,column:n}):this.isDigit(r)?this.readNumber():r==="+"&&this.isDigit(this.input[this.pos+1]||"")?this.readRelativeOffset():r==="/"?this.readPattern():r===":"?this.readLabelDef():this.readCommand()}readNumber(){let t=this.line,n=this.column,r="";for(;this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="~"){this.advance();let s="";for(;this.isDigit(this.peek());)s+=this.advance();let i=parseInt(r,10),o=parseInt(s,10)||0;return{type:le.STEP,value:`${i}~${o}`,first:i,step:o,line:t,column:n}}return{type:le.NUMBER,value:parseInt(r,10),line:t,column:n}}readRelativeOffset(){let t=this.line,n=this.column;this.advance();let r="";for(;this.isDigit(this.peek());)r+=this.advance();let s=parseInt(r,10)||0;return{type:le.RELATIVE_OFFSET,value:`+${s}`,offset:s,line:t,column:n}}readPattern(){let t=this.line,n=this.column;this.advance();let r="",s=!1;for(;this.pos<this.input.length;){let i=this.peek();if(i==="/"&&!s)break;if(i==="\\")r+=this.advance(),this.pos<this.input.length&&this.peek()!==`
263
+ `&&(r+=this.advance());else{if(i===`
264
+ `)break;i==="["&&!s?(s=!0,r+=this.advance(),this.peek()==="^"&&(r+=this.advance()),this.peek()==="]"&&(r+=this.advance())):i==="]"&&s?(s=!1,r+=this.advance()):r+=this.advance()}}return this.peek()==="/"&&this.advance(),{type:le.PATTERN,value:r,pattern:r,line:t,column:n}}readLabelDef(){let t=this.line,n=this.column;for(this.advance();this.peek()===" "||this.peek()===" ";)this.advance();let r="";for(;this.pos<this.input.length;){let s=this.peek();if(s===" "||s===" "||s===`
265
+ `||s===";"||s==="}"||s==="{")break;r+=this.advance()}return{type:le.LABEL_DEF,value:r,label:r,line:t,column:n}}readCommand(){let t=this.line,n=this.column,r=this.advance();switch(r){case"s":return this.readSubstitute(t,n);case"y":return this.readTransliterate(t,n);case"a":case"i":case"c":return this.readTextCommand(r,t,n);case"b":return this.readBranch(le.BRANCH,"b",t,n);case"t":return this.readBranch(le.BRANCH_ON_SUBST,"t",t,n);case"T":return this.readBranch(le.BRANCH_ON_NO_SUBST,"T",t,n);case"r":return this.readFileCommand(le.FILE_READ,"r",t,n);case"R":return this.readFileCommand(le.FILE_READ_LINE,"R",t,n);case"w":return this.readFileCommand(le.FILE_WRITE,"w",t,n);case"W":return this.readFileCommand(le.FILE_WRITE_LINE,"W",t,n);case"e":return this.readExecute(t,n);case"p":case"P":case"d":case"D":case"h":case"H":case"g":case"G":case"x":case"n":case"N":case"q":case"Q":case"z":case"=":case"l":case"F":return{type:le.COMMAND,value:r,line:t,column:n};case"v":return this.readVersion(t,n);default:return{type:le.ERROR,value:r,line:t,column:n}}}readSubstitute(t,n){let r=this.advance();if(!r||r===`
266
+ `)return{type:le.ERROR,value:"s",line:t,column:n};let s="",i=!1;for(;this.pos<this.input.length;){let l=this.peek();if(l===r&&!i)break;if(l==="\\")this.advance(),this.pos<this.input.length&&this.peek()!==`
267
+ `?this.peek()===r&&!i?s+=this.advance():(s+="\\",s+=this.advance()):s+="\\";else{if(l===`
268
+ `)break;l==="["&&!i?(i=!0,s+=this.advance(),this.peek()==="^"&&(s+=this.advance()),this.peek()==="]"&&(s+=this.advance())):l==="]"&&i?(i=!1,s+=this.advance()):s+=this.advance()}}if(this.peek()!==r)return{type:le.ERROR,value:"unterminated substitution pattern",line:t,column:n};this.advance();let o="";for(;this.pos<this.input.length&&this.peek()!==r;)if(this.peek()==="\\")if(this.advance(),this.pos<this.input.length){let l=this.peek();l==="\\"?(this.advance(),this.pos<this.input.length&&this.peek()===`
269
+ `?(o+=`
270
+ `,this.advance()):o+="\\"):l===`
271
+ `?(o+=`
272
+ `,this.advance()):o+=`\\${this.advance()}`}else o+="\\";else{if(this.peek()===`
273
+ `)break;o+=this.advance()}this.peek()===r&&this.advance();let a="";for(;this.pos<this.input.length;){let l=this.peek();if(l==="g"||l==="i"||l==="p"||l==="I"||this.isDigit(l))a+=this.advance();else break}return{type:le.SUBSTITUTE,value:`s${r}${s}${r}${o}${r}${a}`,pattern:s,replacement:o,flags:a,line:t,column:n}}readTransliterate(t,n){let r=this.advance();if(!r||r===`
274
+ `)return{type:le.ERROR,value:"y",line:t,column:n};let s=this.readEscapedString(r);if(s===null||this.peek()!==r)return{type:le.ERROR,value:"unterminated transliteration source",line:t,column:n};this.advance();let i=this.readEscapedString(r);if(i===null||this.peek()!==r)return{type:le.ERROR,value:"unterminated transliteration dest",line:t,column:n};this.advance();let o=this.peek();for(;o===" "||o===" ";)this.advance(),o=this.peek();return o!==""&&o!==";"&&o!==`
275
+ `&&o!=="}"?{type:le.ERROR,value:"extra text at the end of a transform command",line:t,column:n}:{type:le.TRANSLITERATE,value:`y${r}${s}${r}${i}${r}`,source:s,dest:i,line:t,column:n}}readTextCommand(t,n,r){let s=!1;this.peek()==="\\"&&this.pos+1<this.input.length&&(this.input[this.pos+1]===`
276
+ `||this.input[this.pos+1]===" "||this.input[this.pos+1]===" ")&&(s=!0,this.advance()),(this.peek()===" "||this.peek()===" ")&&this.advance(),this.peek()==="\\"&&this.pos+1<this.input.length&&(this.input[this.pos+1]===" "||this.input[this.pos+1]===" ")&&this.advance(),s&&this.peek()===`
277
+ `&&this.advance();let i="";for(;this.pos<this.input.length;){let o=this.peek();if(o===`
278
+ `){if(i.endsWith("\\")){i=`${i.slice(0,-1)}
279
+ `,this.advance();continue}break}if(o==="\\"&&this.pos+1<this.input.length){let a=this.input[this.pos+1];if(a==="n"){i+=`
280
+ `,this.advance(),this.advance();continue}if(a==="t"){i+=" ",this.advance(),this.advance();continue}if(a==="r"){i+="\r",this.advance(),this.advance();continue}}i+=this.advance()}return{type:le.TEXT_CMD,value:t,text:i,line:n,column:r}}readBranch(t,n,r,s){for(;this.peek()===" "||this.peek()===" ";)this.advance();let i="";for(;this.pos<this.input.length;){let o=this.peek();if(o===" "||o===" "||o===`
281
+ `||o===";"||o==="}"||o==="{")break;i+=this.advance()}return{type:t,value:n,label:i||void 0,line:r,column:s}}readVersion(t,n){for(;this.peek()===" "||this.peek()===" ";)this.advance();let r="";for(;this.pos<this.input.length;){let s=this.peek();if(s===" "||s===" "||s===`
282
+ `||s===";"||s==="}"||s==="{")break;r+=this.advance()}return{type:le.VERSION,value:"v",label:r||void 0,line:t,column:n}}readFileCommand(t,n,r,s){for(;this.peek()===" "||this.peek()===" ";)this.advance();let i="";for(;this.pos<this.input.length;){let o=this.peek();if(o===`
283
+ `||o===";")break;i+=this.advance()}return{type:t,value:n,filename:i.trim(),line:r,column:s}}readExecute(t,n){for(;this.peek()===" "||this.peek()===" ";)this.advance();let r="";for(;this.pos<this.input.length;){let s=this.peek();if(s===`
284
+ `||s===";")break;r+=this.advance()}return{type:le.EXECUTE,value:"e",command:r.trim()||void 0,line:t,column:n}}isDigit(t){return t>="0"&&t<="9"}}});function mm(e,t=!1,n){if(n){if(e.length>n.maxArrayElements)throw new C(`sed: script count limit exceeded (${n.maxArrayElements})`,"array_elements");let c=Math.max(0,e.length-1);for(let u of e)if(c+=U(u),c>n.maxStringLength)throw new C(`sed: script size limit exceeded (${n.maxStringLength} bytes)`,"string_length")}let r=!1,s=!1,i=[];for(let c=0;c<e.length;c++){let u=e[c];if(i.length===0&&c===0){let f=u.match(/^#([nr]+)\s*(?:\n|$)/i);if(f){let d=f[1].toLowerCase();d.includes("n")&&(r=!0),d.includes("r")&&(s=!0),u=u.slice(f[0].length)}}if(i.length>0&&i[i.length-1].endsWith("\\")){let f=i[i.length-1];i[i.length-1]=`${f}
285
+ ${u}`}else i.push(u)}let o=i.join(`
286
+ `),l=new Su([o],t||s,n).parse();if(!l.error&&l.commands.length>0){let c=Kx(l.commands);if(c)return{commands:[],error:c,silentMode:r,extendedRegexMode:s}}return{...l,silentMode:r,extendedRegexMode:s}}function Kx(e){let t=new Set;gm(e,t);let n=ym(e,t);if(n)return`undefined label '${n}'`}function gm(e,t){for(let n of e)n.type==="label"?t.add(n.name):n.type==="group"&&gm(n.commands,t)}function ym(e,t){for(let n of e){if((n.type==="branch"||n.type==="branchOnSubst"||n.type==="branchOnNoSubst")&&n.label&&!t.has(n.label))return n.label;if(n.type==="group"){let r=ym(n.commands,t);if(r)return r}}}var Su,wm=M(()=>{"use strict";Z();St();hm();Su=class{scripts;limits;tokens=[];pos=0;extendedRegex=!1;constructor(t,n=!1,r){this.scripts=t,this.limits=r,this.extendedRegex=n}parse(){let t=[];for(let n of this.scripts){let r=new Aa(n,this.limits?.maxStringLength,this.limits?.maxArrayElements);for(this.tokens=r.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(le.NEWLINE)||this.check(le.SEMICOLON)){this.advance();continue}let s=this.pos,i=this.parseCommand();if(i.error)return{commands:[],error:i.error};if(i.command&&t.push(i.command),this.pos===s&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}}return{commands:t}}parseCommand(){let t=this.parseAddressRange();if(t?.error)return{command:null,error:t.error};let n=t?.address;for(this.check(le.NEGATION)&&(this.advance(),n&&(n.negated=!0));this.check(le.NEWLINE)||this.check(le.SEMICOLON);)this.advance();if(this.isAtEnd())return n&&(n.start!==void 0||n.end!==void 0)?{command:null,error:"command expected"}:{command:null};let r=this.peek();switch(r.type){case le.COMMAND:return this.parseSimpleCommand(r,n);case le.SUBSTITUTE:return this.parseSubstituteFromToken(r,n);case le.TRANSLITERATE:return this.parseTransliterateFromToken(r,n);case le.LABEL_DEF:return this.advance(),{command:{type:"label",name:r.label||""}};case le.BRANCH:return this.advance(),{command:{type:"branch",address:n,label:r.label}};case le.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:n,label:r.label}};case le.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:n,label:r.label}};case le.TEXT_CMD:return this.advance(),this.parseTextCommand(r,n);case le.FILE_READ:return this.advance(),{command:{type:"readFile",address:n,filename:r.filename||""}};case le.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:n,filename:r.filename||""}};case le.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:n,filename:r.filename||""}};case le.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:n,filename:r.filename||""}};case le.EXECUTE:return this.advance(),{command:{type:"execute",address:n,command:r.command}};case le.VERSION:return this.advance(),{command:{type:"version",address:n,minVersion:r.label}};case le.LBRACE:return this.parseGroup(n);case le.RBRACE:return{command:null};case le.ERROR:return{command:null,error:`invalid command: ${r.value}`};default:return n&&(n.start!==void 0||n.end!==void 0)?{command:null,error:"command expected"}:{command:null}}}parseSimpleCommand(t,n){this.advance();let r=t.value;switch(r){case"p":return{command:{type:"print",address:n}};case"P":return{command:{type:"printFirstLine",address:n}};case"d":return{command:{type:"delete",address:n}};case"D":return{command:{type:"deleteFirstLine",address:n}};case"h":return{command:{type:"hold",address:n}};case"H":return{command:{type:"holdAppend",address:n}};case"g":return{command:{type:"get",address:n}};case"G":return{command:{type:"getAppend",address:n}};case"x":return{command:{type:"exchange",address:n}};case"n":return{command:{type:"next",address:n}};case"N":return{command:{type:"nextAppend",address:n}};case"q":return{command:{type:"quit",address:n}};case"Q":return{command:{type:"quitSilent",address:n}};case"z":return{command:{type:"zap",address:n}};case"=":return{command:{type:"lineNumber",address:n}};case"l":return{command:{type:"list",address:n}};case"F":return{command:{type:"printFilename",address:n}};default:return{command:null,error:`unknown command: ${r}`}}}parseSubstituteFromToken(t,n){this.advance();let r=t.flags||"",s,i=r.match(/(\d+)/);return i&&(s=parseInt(i[1],10)),{command:{type:"substitute",address:n,pattern:t.pattern||"",replacement:t.replacement||"",global:r.includes("g"),ignoreCase:r.includes("i")||r.includes("I"),printOnMatch:r.includes("p"),nthOccurrence:s,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(t,n){this.advance();let r=t.source||"",s=t.dest||"";return r.length!==s.length?{command:null,error:"transliteration sets must have same length"}:{command:{type:"transliterate",address:n,source:r,dest:s}}}parseTextCommand(t,n){let r=t.value,s=t.text||"";switch(r){case"a":return{command:{type:"append",address:n,text:s}};case"i":return{command:{type:"insert",address:n,text:s}};case"c":return{command:{type:"change",address:n,text:s}};default:return{command:null,error:`unknown text command: ${r}`}}}parseGroup(t){this.advance();let n=[];for(;!this.isAtEnd()&&!this.check(le.RBRACE);){if(this.check(le.NEWLINE)||this.check(le.SEMICOLON)){this.advance();continue}let r=this.pos,s=this.parseCommand();if(s.error)return{command:null,error:s.error};if(s.command&&n.push(s.command),this.pos===r&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(le.RBRACE)?(this.advance(),{command:{type:"group",address:t,commands:n}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){if(this.check(le.COMMA))return{error:"expected context address"};let t=this.parseAddress();if(t===void 0)return;let n;if(this.check(le.RELATIVE_OFFSET))n={offset:this.advance().offset||0};else if(this.check(le.COMMA)&&(this.advance(),n=this.parseAddress(),n===void 0))return{error:"expected context address"};return{address:{start:t,end:n}}}parseAddress(){let t=this.peek();switch(t.type){case le.NUMBER:return this.advance(),t.value;case le.DOLLAR:return this.advance(),"$";case le.PATTERN:return this.advance(),{pattern:t.pattern||t.value};case le.STEP:return this.advance(),{first:t.first||0,step:t.step||0};case le.RELATIVE_OFFSET:return this.advance(),{offset:t.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:le.EOF,value:"",line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(t){return this.peek().type===t}isAtEnd(){return this.peek().type===le.EOF}}});var bm={};ae(bm,{flagsForFuzzing:()=>Yx,sedCommand:()=>Xx});async function Au(e,t,n,r={}){let{limits:s,filename:i,fs:o,cwd:a,coverage:l,requireDefenseContext:c}=r;Ct(c,"sed","processing entry");let u=(N,R)=>on(c,"sed",N,R),f=e.endsWith(`
287
+ `),d=e.split(`
288
+ `);d.length>0&&d[d.length-1]===""&&d.pop();let p=d.length,h="",m,g=!1,b=s?.maxStringLength??0,w=N=>{if(h+=N,b>0&&h.length>b)throw new C(`sed: output size limit exceeded (${b} bytes)`,"string_length")},y="",x,S=new Map,E=new Map,A=new Map,I=new Map,$=s?{maxIterations:s.maxSedIterations,maxStringLength:b}:void 0;for(let N=0;N<d.length;N++){let R={...dm(p,i,S),patternSpace:d[N],holdSpace:y,lastPattern:x,lineNumber:N+1,totalLines:p,substitutionMade:!1,coverage:l},O={lines:d,currentLineIndex:N},B=0,L=1e4;R.linesConsumedInCycle=0;do{if(B++,B>L)break;if(R.restartCycle=!1,R.pendingFileReads=[],R.pendingFileWrites=[],Eu(t,R,O,$),o&&a){for(let D of R.pendingFileReads){let X=o.resolvePath(a,D.filename);try{if(D.wholeFile){let V=await u("read command file",()=>o.readFile(X));R.appendBuffer.push(V.replace(/\n$/,""))}else{if(!E.has(X)){let J=await u("read command file line cache",()=>o.readFile(X));E.set(X,J.split(`
289
+ `)),A.set(X,0)}let V=E.get(X),Y=A.get(X);V&&Y!==void 0&&Y<V.length&&(R.appendBuffer.push(V[Y]),A.set(X,Y+1))}}catch(V){if(V instanceof Ae)throw V}}for(let D of R.pendingFileWrites){let X=o.resolvePath(a,D.filename),V=I.get(X)||"";I.set(X,V+D.content)}}}while(R.restartCycle&&!R.deleted&&!R.quit&&!R.quitSilent);if(N+=R.linesConsumedInCycle,y=R.holdSpace,x=R.lastPattern,!n)for(let D of R.nCommandOutput)w(`${D}
290
+ `);let T=R.lineNumberOutput.length>0;for(let D of R.lineNumberOutput)w(`${D}
291
+ `);let W=[],_=[];for(let D of R.appendBuffer)D.startsWith("__INSERT__")?W.push(D.slice(10)):_.push(D);for(let D of W)w(`${D}
292
+ `);let F=!1;!R.deleted&&!R.quitSilent?n?R.printed&&(w(`${R.patternSpace}
293
+ `),F=!0):(w(`${R.patternSpace}
294
+ `),F=!0):R.changedText!==void 0&&(w(`${R.changedText}
295
+ `),F=!0);for(let D of _)w(`${D}
296
+ `);if(g=(T||F)&&_.length===0,R.quit||R.quitSilent){if(R.exitCode!==void 0&&(m=R.exitCode),R.errorMessage)return{output:"",exitCode:m||1,errorMessage:R.errorMessage};break}}if(o&&a)for(let[N,R]of I)try{await u("flush pending file writes",()=>o.writeFile(N,R))}catch(O){if(O instanceof Ae)throw O}return!f&&g&&h.endsWith(`
297
+ `)&&(h=h.slice(0,-1)),{output:h,exitCode:m}}var Qx,Xx,Yx,xm=M(()=>{"use strict";ce();_n();Z();Er();vn();de();pm();wm();Qx={name:"sed",summary:"stream editor for filtering and transforming text",usage:"sed [OPTION]... {script} [input-file]...",options:["-n, --quiet, --silent suppress automatic printing of pattern space","-e script add the script to commands to be executed","-f script-file read script from file","-i, --in-place edit files in place","-E, -r, --regexp-extended use extended regular expressions"," --help display this help and exit"],description:`Commands:
298
+ s/regexp/replacement/[flags] substitute
299
+ d delete pattern space
300
+ p print pattern space
301
+ a\\ text append text after line
302
+ i\\ text insert text before line
303
+ c\\ text change (replace) line with text
304
+ h copy pattern space to hold space
305
+ H append pattern space to hold space
306
+ g copy hold space to pattern space
307
+ G append hold space to pattern space
308
+ x exchange pattern and hold spaces
309
+ n read next line into pattern space
310
+ N append next line to pattern space
311
+ y/source/dest/ transliterate characters
312
+ = print line number
313
+ l list pattern space (escape special chars)
314
+ b [label] branch to label
315
+ t [label] branch on substitution
316
+ T [label] branch if no substitution
317
+ :label define label
318
+ q quit
319
+ Q quit without printing
320
+
321
+ Addresses:
322
+ N line number
323
+ $ last line
324
+ /regexp/ lines matching regexp
325
+ N,M range from line N to M
326
+ first~step every step-th line starting at first`};Xx={name:"sed",async execute(e,t){Ct(t.requireDefenseContext,"sed","execution entry");let n=(m,g)=>on(t.requireDefenseContext,"sed",m,g);if(q(e))return G(Qx);let r=[],s=[],i=!1,o=!1,a=!1,l=[];for(let m=0;m<e.length;m++){let g=e[m];if(g==="-n"||g==="--quiet"||g==="--silent")i=!0;else if(g==="-i"||g==="--in-place")o=!0;else if(g.startsWith("-i"))o=!0;else if(g==="-E"||g==="-r"||g==="--regexp-extended")a=!0;else if(g==="-e")m+1<e.length&&r.push(e[++m]);else if(g==="-f")m+1<e.length&&s.push(e[++m]);else{if(g.startsWith("--"))return re("sed",g);if(g==="-")l.push(g);else if(g.startsWith("-")&&g.length>1){for(let b of g.slice(1))if(b!=="n"&&b!=="e"&&b!=="f"&&b!=="i"&&b!=="E"&&b!=="r")return re("sed",`-${b}`);g.includes("n")&&(i=!0),g.includes("i")&&(o=!0),(g.includes("E")||g.includes("r"))&&(a=!0),g.includes("e")&&!g.includes("n")&&!g.includes("i")&&m+1<e.length&&r.push(e[++m]),g.includes("f")&&!g.includes("e")&&m+1<e.length&&s.push(e[++m])}else!g.startsWith("-")&&r.length===0&&s.length===0?r.push(g):g.startsWith("-")||l.push(g)}}for(let m of s){let g=t.fs.resolvePath(t.cwd,m);try{let b=await n("script file read",()=>t.fs.readFile(g));for(let w of b.split(`
327
+ `)){let y=w.trim();y&&!y.startsWith("#")&&r.push(y)}}catch(b){if(b instanceof Ae)throw b;return{stdout:"",stderr:`sed: couldn't open file ${m}: No such file or directory
328
+ `,exitCode:1}}}if(r.length===0)return{stdout:"",stderr:`sed: no script specified
329
+ `,exitCode:1};let{commands:c,error:u,silentMode:f}=mm(r,a,t.limits);if(u)return{stdout:"",stderr:`sed: ${u}
330
+ `,exitCode:1};let d=!!(i||f);if(o){if(l.length===0)return{stdout:"",stderr:`sed: -i requires at least one file argument
331
+ `,exitCode:1};for(let m of l){if(m==="-")continue;let g=t.fs.resolvePath(t.cwd,m);try{let b=await n("in-place input read",()=>t.fs.readFile(g)),w=await n("in-place processing",()=>Au(b,c,d,{limits:t.limits,filename:m,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));if(w.errorMessage)return{stdout:"",stderr:`${w.errorMessage}
332
+ `,exitCode:w.exitCode??1};await n("in-place output write",()=>t.fs.writeFile(g,w.output))}catch(b){if(b instanceof Ae)throw b;return b instanceof C?{stdout:"",stderr:`sed: ${Ye(b.message)}
333
+ `,exitCode:C.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory
334
+ `,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let p="";if(l.length===0){p=ue(t.stdin);try{let m=await n("stdin processing",()=>Au(p,c,d,{limits:t.limits,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage}
335
+ `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof Ae)throw m;if(m instanceof C)return{stdout:"",stderr:`sed: ${Ye(m.message)}
336
+ `,exitCode:C.EXIT_CODE};throw m}}let h=!1;for(let m of l){let g;if(m==="-")h?g="":(g=ue(t.stdin),h=!0);else{let b=t.fs.resolvePath(t.cwd,m);try{g=await n("input file read",()=>t.fs.readFile(b))}catch(w){if(w instanceof Ae)throw w;return w instanceof C?{stdout:"",stderr:`sed: ${Ye(w.message)}
337
+ `,exitCode:C.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory
338
+ `,exitCode:1}}}p.length>0&&g.length>0&&!p.endsWith(`
339
+ `)&&(p+=`
340
+ `),p+=g}try{let m=await n("final processing",()=>Au(p,c,d,{limits:t.limits,filename:l.length===1?l[0]:void 0,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage}
341
+ `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof Ae)throw m;if(m instanceof C)return{stdout:"",stderr:`sed: ${Ye(m.message)}
342
+ `,exitCode:C.EXIT_CODE};throw m}}},Yx={name:"sed",flags:[{flag:"-n",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-E",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0}});function Ht(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function mn(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function Ns(...e){return Object.assign(Object.create(null),...e)}var Lr=M(()=>{"use strict"});function Cu(e={}){let{fieldSep:t=t9,maxIterations:n=Jx,maxRecursionDepth:r=e9,maxOutputSize:s=0,maxArrayElements:i=1e5,fs:o,cwd:a,exec:l,coverage:c,requireDefenseContext:u}=e;return{FS:" ",OFS:" ",ORS:`
343
+ `,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,getlineCommandStreams:new Map,getlineFileStreams:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:s,maxArrayElements:i,arrayElementCount:0,recordsProcessed:0,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:o,cwd:a,exec:l,coverage:c,requireDefenseContext:u}}var Jx,e9,t9,Em=M(()=>{"use strict";pt();Jx=1e4,e9=100,t9=new Dr(/\s+/)});function Sm(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}var Am=M(()=>{"use strict"});function Wn(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Vt(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function ku(e){return new Te(e,"awk string",()=>new C(`string size limit exceeded (${e} bytes)`,"string_length"))}function Fr(e){return e.maxOutputSize>0?e.maxOutputSize:vm}function Ca(e,t,n,r,s){let i=ku(s),o=0,a=0,l=0;for(let c of t.matchAll(e)){let u=c.index??0;a++,i.append(e.slice(o,u)),n(a)?(i.append(r(c)),l++):i.append(c[0]),o=u+c[0].length}return i.append(e.slice(o)),{value:i.build(),replacements:l}}async function va(e,t){if(e.type==="regex")return e.pattern;let n=Vt(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function km(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(Wn(await t.evalExpr(e.index)))}`:"$0":"$0"}function Nm(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return Vt(t.vars[e]??"")}function Im(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let r=parseInt(e.slice(1),10)-1;for(;n.fields.length<=r;)n.fields.push("");n.fields[r]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function n9(e,t,n){return e.length===0?t.line.length:Vt(await n.evalExpr(e[0])).length}async function r9(e,t,n){if(e.length<2)return"";let r=Vt(await n.evalExpr(e[0])),s=Math.floor(Wn(await n.evalExpr(e[1])))-1;if(e.length>=3){let i=Math.floor(Wn(await n.evalExpr(e[2])));return r.substr(Math.max(0,s),i)}return r.substr(Math.max(0,s))}async function s9(e,t,n){if(e.length<2)return 0;let r=Vt(await n.evalExpr(e[0])),s=Vt(await n.evalExpr(e[1])),i=r.indexOf(s);return i===-1?0:i+1}async function i9(e,t,n){if(e.length<2)return 0;let r=Vt(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let i=s.name,o=t.FS;if(e.length>=3){let u=e[2];if(u.type==="regex")o=ie(u.pattern);else{let f=Vt(await n.evalExpr(u));o=f===" "?ie("\\s+"):f}}else t.FS===" "&&(o=ie("\\s+"));let a=Object.keys(t.arrays[i]??{}).length,l=t.maxArrayElements-t.arrayElementCount+a,c=typeof o=="string"?r.split(o,l+1):o.split(r,l+1);if(c.length>l)throw new C(`array element limit exceeded (${t.maxArrayElements})`,"array_elements");t.arrays[i]=Object.create(null);for(let u=0;u<c.length;u++)t.arrays[i][String(u+1)]=c[u];return t.arrayElementCount+=c.length-a,c.length}async function o9(e,t,n){if(e.length<2)return 0;let r=await va(e[0],n),s=Vt(await n.evalExpr(e[1])),i=await km(e[2],n),o=Nm(i,t);try{let a=ie(r,"g"),l=Ca(o,a,c=>c===1,c=>Om(s,c[0],Fr(t)),Fr(t));return Im(i,l.value,t),l.replacements}catch(a){return he(a),0}}async function a9(e,t,n){if(e.length<2)return 0;let r=await va(e[0],n),s=Vt(await n.evalExpr(e[1])),i=await km(e[2],n),o=Nm(i,t);try{let a=ie(r,"g"),l=Ca(o,a,()=>!0,c=>Om(s,c[0],Fr(t)),Fr(t));return Im(i,l.value,t),l.replacements}catch(a){return he(a),0}}function Om(e,t,n){let r=ku(n),s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];i==="&"?(r.append("&"),s+=2):i==="\\"?(r.append("\\"),s+=2):(r.append(e[s+1]),s+=2)}else e[s]==="&"?(r.append(t),s++):(r.append(e[s]),s++);return r.build()}async function l9(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=Vt(await n.evalExpr(e[0])),s=await va(e[1],n);try{let o=ie(s).exec(r);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function c9(e,t,n){if(e.length<3)return"";let r=await va(e[0],n),s=Vt(await n.evalExpr(e[1])),i=Vt(await n.evalExpr(e[2])),o=e.length>=4?Vt(await n.evalExpr(e[3])):t.line;try{let a=i.toLowerCase()==="g",l=a?0:parseInt(i,10)||1;if(a){let c=ie(r,"g");return Ca(o,c,()=>!0,u=>Cm(s,u[0],u.slice(1),Fr(t)),Fr(t)).value}else{let c=ie(r,"g");return Ca(o,c,u=>u===l,u=>Cm(s,u[0],u.slice(1),Fr(t)),Fr(t)).value}}catch(a){return he(a),o}}function Cm(e,t,n,r){let s=ku(r),i=0;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length){let o=e[i+1];if(o==="&")s.append("&"),i+=2;else if(o==="0")s.append(t),i+=2;else if(o>="1"&&o<="9"){let a=parseInt(o,10)-1;s.append(n[a]||""),i+=2}else o==="n"?(s.append(`
344
+ `),i+=2):o==="t"?(s.append(" "),i+=2):(s.append(o),i+=2)}else e[i]==="&"?(s.append(t),i++):(s.append(e[i]),i++);return s.build()}async function u9(e,t,n){return e.length===0?"":Vt(await n.evalExpr(e[0])).toLowerCase()}async function f9(e,t,n){return e.length===0?"":Vt(await n.evalExpr(e[0])).toUpperCase()}async function d9(e,t,n){if(e.length===0)return"";let r=Vt(await n.evalExpr(e[0])),s=[];for(let i=1;i<e.length;i++)s.push(await n.evalExpr(e[i]));return ka(r,s,Fr(t))}async function p9(e,t,n){return e.length===0?0:Math.floor(Wn(await n.evalExpr(e[0])))}async function h9(e,t,n){return e.length===0?0:Math.sqrt(Wn(await n.evalExpr(e[0])))}async function m9(e,t,n){return e.length===0?0:Math.sin(Wn(await n.evalExpr(e[0])))}async function g9(e,t,n){return e.length===0?0:Math.cos(Wn(await n.evalExpr(e[0])))}async function y9(e,t,n){let r=e.length>0?Wn(await n.evalExpr(e[0])):0,s=e.length>1?Wn(await n.evalExpr(e[1])):0;return Math.atan2(r,s)}async function w9(e,t,n){return e.length===0?0:Math.log(Wn(await n.evalExpr(e[0])))}async function b9(e,t,n){return e.length===0?1:Math.exp(Wn(await n.evalExpr(e[0])))}function x9(e,t,n){return t.random?t.random():Math.random()}async function E9(e,t,n){let r=e.length>0?Wn(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function S9(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function vu(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}function ka(e,t,n=vm){let r=0,s="",i=0,o=0,a=Math.min(A9,n),l=c=>{let u=U(c);if(u>n-i)throw new C(`formatted string size limit exceeded (${n} bytes)`,"string_length");s+=c,i+=u};for(;o<e.length;)if(e[o]==="%"&&o+1<e.length){let c=o+1,u="",f="",d="",p,h=c;for(;c<e.length&&/\d/.test(e[c]);)c++;c>h&&e[c]==="$"?(p=parseInt(e.substring(h,c),10)-1,c++):c=h;let m=()=>{if(c<e.length){if(c+1<e.length&&(e[c]==="h"&&e[c+1]==="h"||e[c]==="l"&&e[c+1]==="l")){c+=2;return}/[lzjh]/.test(e[c])&&c++}};for(;c<e.length&&/[-+ #0]/.test(e[c]);)u+=e[c++];if(e[c]==="*"){let y=t[r++],x=y!==void 0?Math.floor(Number(y)):0;if(!Number.isFinite(x)||!Number.isSafeInteger(x))throw new C(`printf width limit exceeded (${a} bytes)`,"string_length");x<0?(u+="-",f=String(-x)):f=String(x),c++}else for(;c<e.length&&/\d/.test(e[c]);)f+=e[c++];if(f&&parseInt(f,10)>a)throw new C(`printf width limit exceeded (${a} bytes)`,"string_length");if(e[c]==="."){if(c++,e[c]==="*"){let y=t[r++],x=y!==void 0?Math.floor(Number(y)):0;if(!Number.isFinite(x)||!Number.isSafeInteger(x))throw new C(`printf precision limit exceeded (${a} bytes)`,"string_length");d=x<0?"":String(x),c++}else for(;c<e.length&&/\d/.test(e[c]);)d+=e[c++];if(d&&parseInt(d,10)>a)throw new C(`printf precision limit exceeded (${a} bytes)`,"string_length")}m();let g=e[c],w=t[p!==void 0?p:r];switch(g){case"s":{let y=w!==void 0?String(w):"";if(d&&(y=y.substring(0,parseInt(d,10))),f){let x=parseInt(f,10);u.includes("-")?y=y.padEnd(x):y=y.padStart(x)}l(y),p===void 0&&r++;break}case"d":case"i":{let y=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(y)&&(y=0);let x=y<0,S=Math.abs(y).toString();if(d){let I=parseInt(d,10);S=S.padStart(I,"0")}let E="";x?E="-":u.includes("+")?E="+":u.includes(" ")&&(E=" ");let A=E+S;if(f){let I=parseInt(f,10);u.includes("-")?A=A.padEnd(I):u.includes("0")&&!d?A=E+S.padStart(I-E.length,"0"):A=A.padStart(I)}l(A),p===void 0&&r++;break}case"f":{let y=w!==void 0?Number(w):0;Number.isNaN(y)&&(y=0);let x=d?parseInt(d,10):6;if(x>100)throw new C("printf floating-point precision limit exceeded (100 digits)","string_length");let S=y.toFixed(x);if(f){let E=parseInt(f,10);u.includes("-")?S=S.padEnd(E):S=S.padStart(E)}l(S),p===void 0&&r++;break}case"e":case"E":{let y=w!==void 0?Number(w):0;Number.isNaN(y)&&(y=0);let x=d?parseInt(d,10):6;if(x>100)throw new C("printf floating-point precision limit exceeded (100 digits)","string_length");let S=y.toExponential(x);if(g==="E"&&(S=S.toUpperCase()),f){let E=parseInt(f,10);u.includes("-")?S=S.padEnd(E):S=S.padStart(E)}l(S),p===void 0&&r++;break}case"g":case"G":{let y=w!==void 0?Number(w):0;Number.isNaN(y)&&(y=0);let x=d?parseInt(d,10):6;if(x>100)throw new C("printf floating-point precision limit exceeded (100 digits)","string_length");let S=y!==0?Math.floor(Math.log10(Math.abs(y))):0,E;if(y===0?E="0":S<-4||S>=x?(E=y.toExponential(x-1),g==="G"&&(E=E.toUpperCase())):E=y.toPrecision(x),E.includes(".")&&(E=E.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),E.includes("e")&&(E=E.replace(/\.?0+e/,"e")),f){let A=parseInt(f,10);u.includes("-")?E=E.padEnd(A):E=E.padStart(A)}l(E),p===void 0&&r++;break}case"x":case"X":{let y=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(y)&&(y=0);let x=Math.abs(y).toString(16);if(g==="X"&&(x=x.toUpperCase()),d){let A=parseInt(d,10);x=x.padStart(A,"0")}let S=y<0?"-":"",E=S+x;if(f){let A=parseInt(f,10);u.includes("-")?E=E.padEnd(A):u.includes("0")&&!d?E=S+x.padStart(A-S.length,"0"):E=E.padStart(A)}l(E),p===void 0&&r++;break}case"o":{let y=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(y)&&(y=0);let x=Math.abs(y).toString(8);if(d){let A=parseInt(d,10);x=x.padStart(A,"0")}let S=y<0?"-":"",E=S+x;if(f){let A=parseInt(f,10);u.includes("-")?E=E.padEnd(A):u.includes("0")&&!d?E=S+x.padStart(A-S.length,"0"):E=E.padStart(A)}l(E),p===void 0&&r++;break}case"c":{l(typeof w=="number"?String.fromCharCode(w):String(w??"").charAt(0)||""),p===void 0&&r++;break}case"%":l("%");break;default:l(e.substring(o,c+1))}o=c+1}else if(e[o]==="\\"&&o+1<e.length){let c=e[o+1];switch(c){case"n":l(`
345
+ `);break;case"t":l(" ");break;case"r":l("\r");break;case"\\":l("\\");break;default:l(c)}o+=2}else l(e[o++]);return s}var vm,A9,Tm,Nu=M(()=>{"use strict";At();ce();Nt();Z();pt();vm=10*1024*1024;A9=1e4;Tm=new Map([["length",n9],["substr",r9],["index",s9],["split",i9],["sub",o9],["gsub",a9],["match",l9],["gensub",c9],["tolower",u9],["toupper",f9],["sprintf",d9],["int",p9],["sqrt",h9],["sin",m9],["cos",g9],["atan2",y9],["log",w9],["exp",b9],["rand",x9],["srand",E9],["system",S9("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",vu("systime")],["mktime",vu("mktime")],["strftime",vu("strftime")]])});function an(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function wt(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function et(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function Iu(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function co(e,t){try{return ie(e).test(t)}catch{return!1}}var hi=M(()=>{"use strict";pt()});function Rm(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function Na(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Ou(e,t,n){if(t===0)e.line=et(n),e.fields=Rm(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=et(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function mi(e,t){e.line=t,e.fields=Rm(e,t),e.NF=e.fields.length}function $m(e,t){if(e.FS=t,t===" ")e.fieldSep=new Dr(/\s+/);else try{e.fieldSep=ie(t)}catch{e.fieldSep=ie(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}var Ia=M(()=>{"use strict";pt();hi()});function Oa(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function gi(e,t,n){switch(t){case"FS":$m(e,et(n));return;case"OFS":e.OFS=et(n);return;case"ORS":e.ORS=et(n);return;case"OFMT":e.OFMT=et(n);return;case"NR":e.NR=Math.floor(wt(n));return;case"NF":{let r=Math.floor(wt(n));if(r<e.NF)e.fields=e.fields.slice(0,r),e.line=e.fields.join(e.OFS);else if(r>e.NF){for(;e.fields.length<r;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=r;return}case"FNR":e.FNR=Math.floor(wt(n));return;case"FILENAME":e.FILENAME=et(n);return;case"RSTART":e.RSTART=Math.floor(wt(n));return;case"RLENGTH":e.RLENGTH=Math.floor(wt(n));return;case"SUBSEP":e.SUBSEP=et(n);return}e.vars[t]=n}function uo(e,t){let n=t,r=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!r.has(n);)r.add(n),n=s,s=e.arrayAliases.get(n);return n}function Ta(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=uo(e,t);return e.arrays[r]?.[n]??""}function Tu(e,t,n,r){let s=uo(e,t);if(e.arrays[s]||(e.arrays[s]=Object.create(null)),!(n in e.arrays[s])){if(e.arrayElementCount>=e.maxArrayElements)throw new C(`array element limit exceeded (${e.maxArrayElements})`,"array_elements");e.arrayElementCount++}e.arrays[s][n]=r}function Pm(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=uo(e,t);return e.arrays[r]?.[n]!==void 0}function Dm(e,t,n){let r=uo(e,t);e.arrays[r]&&(n in e.arrays[r]&&e.arrayElementCount--,delete e.arrays[r][n])}function Lm(e,t){let n=uo(e,t);e.arrayElementCount-=Object.keys(e.arrays[n]??{}).length,delete e.arrays[n]}var Ru=M(()=>{"use strict";Z();Ia();hi()});function Mm(e){Fm=e}function gn(e,t){Ct(e.requireDefenseContext,"awk",t)}function Qe(e,t,n){return on(e.requireDefenseContext,"awk",t,n)}async function ve(e,t){switch(gn(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return co(t.pattern,e.line)?1:0;case"field":return C9(e,t);case"variable":return Oa(e,t.name);case"array_access":return v9(e,t);case"binary":return k9(e,t);case"unary":return O9(e,t);case"ternary":return an(await Qe(e,"ternary condition evaluation",()=>ve(e,t.condition)))?await Qe(e,"ternary consequent evaluation",()=>ve(e,t.consequent)):await Qe(e,"ternary alternate evaluation",()=>ve(e,t.alternate));case"call":return T9(e,t.name,t.args);case"assignment":return $9(e,t);case"pre_increment":return P9(e,t.operand);case"pre_decrement":return D9(e,t.operand);case"post_increment":return L9(e,t.operand);case"post_decrement":return F9(e,t.operand);case"in":return M9(e,t.key,t.array);case"getline":return _9(e,t.variable,t.file,t.command);case"tuple":return z9(e,t.elements);default:return""}}async function C9(e,t){gn(e,"field reference evaluation");let n=Math.floor(wt(await Qe(e,"field index evaluation",()=>ve(e,t.index))));return Na(e,n)}async function v9(e,t){gn(e,"array access evaluation");let n=et(await Qe(e,"array key evaluation",()=>ve(e,t.key)));return Ta(e,t.array,n)}async function k9(e,t){gn(e,"binary expression evaluation");let n=t.operator;if(n==="||")return an(await Qe(e,"logical-or left evaluation",()=>ve(e,t.left)))||an(await Qe(e,"logical-or right evaluation",()=>ve(e,t.right)))?1:0;if(n==="&&")return an(await Qe(e,"logical-and left evaluation",()=>ve(e,t.left)))&&an(await Qe(e,"logical-and right evaluation",()=>ve(e,t.right)))?1:0;if(n==="~"){let a=await Qe(e,"regex left evaluation",()=>ve(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:et(await Qe(e,"regex right evaluation",()=>ve(e,t.right)));try{return ie(l).test(et(a))?1:0}catch{return 0}}if(n==="!~"){let a=await Qe(e,"negated-regex left evaluation",()=>ve(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:et(await Qe(e,"negated-regex right evaluation",()=>ve(e,t.right)));try{return ie(l).test(et(a))?0:1}catch{return 1}}let r=await Qe(e,"binary left evaluation",()=>ve(e,t.left)),s=await Qe(e,"binary right evaluation",()=>ve(e,t.right));if(n===" "){let a=et(r)+et(s);if(e.maxOutputSize>0&&a.length>e.maxOutputSize)throw new C(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return a}if(N9(n))return I9(r,s,n);let i=wt(r),o=wt(s);return Sm(i,o,n)}function N9(e){return["<","<=",">",">=","==","!="].includes(e)}function I9(e,t,n){let r=Iu(e),s=Iu(t);if(r&&s){let a=wt(e),l=wt(t);switch(n){case"<":return a<l?1:0;case"<=":return a<=l?1:0;case">":return a>l?1:0;case">=":return a>=l?1:0;case"==":return a===l?1:0;case"!=":return a!==l?1:0}}let i=et(e),o=et(t);switch(n){case"<":return i<o?1:0;case"<=":return i<=o?1:0;case">":return i>o?1:0;case">=":return i>=o?1:0;case"==":return i===o?1:0;case"!=":return i!==o?1:0}return 0}async function O9(e,t){gn(e,"unary expression evaluation");let n=await Qe(e,"unary operand evaluation",()=>ve(e,t.operand));switch(t.operator){case"!":return an(n)?0:1;case"-":return-wt(n);case"+":return+wt(n);default:return n}}async function T9(e,t,n){gn(e,"function call evaluation");let r=Tm.get(t);if(r)return r(n,e,{evalExpr:i=>ve(e,i)});let s=e.functions.get(t);return s?R9(e,s,n):""}async function R9(e,t,n){if(gn(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new C(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let r=Object.create(null);for(let a of t.params)r[a]=e.vars[a];let s=[];for(let a=0;a<t.params.length;a++){let l=t.params[a];if(a<n.length){let c=n[a];c.type==="variable"&&(e.arrayAliases.set(l,c.name),s.push(l));let u=await Qe(e,"user function argument evaluation",()=>ve(e,c));e.vars[l]=u}else e.vars[l]=""}e.hasReturn=!1,e.returnValue=void 0;let i=Fm;i&&await Qe(e,"user function body execution",()=>i(e,t.body.statements));let o=e.returnValue??"";for(let a of t.params)r[a]!==void 0?e.vars[a]=r[a]:delete e.vars[a];for(let a of s)e.arrayAliases.delete(a);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function $9(e,t){gn(e,"assignment evaluation");let n=await Qe(e,"assignment value evaluation",()=>ve(e,t.value)),r=t.target,s=t.operator,i;if(s==="=")i=n;else{let o;if(r.type==="field"){let c=Math.floor(wt(await Qe(e,"assignment field index",()=>ve(e,r.index))));o=Na(e,c)}else if(r.type==="variable")o=Oa(e,r.name);else{let c=et(await Qe(e,"assignment array key",()=>ve(e,r.key)));o=Ta(e,r.array,c)}let a=wt(o),l=wt(n);switch(s){case"+=":i=a+l;break;case"-=":i=a-l;break;case"*=":i=a*l;break;case"/=":i=l!==0?a/l:0;break;case"%=":i=l!==0?a%l:0;break;case"^=":i=a**l;break;default:i=n}}if(r.type==="field"){let o=Math.floor(wt(await Qe(e,"assignment target field index",()=>ve(e,r.index))));Ou(e,o,i)}else if(r.type==="variable")gi(e,r.name,i);else{let o=et(await Qe(e,"assignment target array key",()=>ve(e,r.key)));Tu(e,r.array,o,i)}return i}async function Ra(e,t,n,r){gn(e,"inc/dec evaluation");let s;if(t.type==="field"){let i=Math.floor(wt(await Qe(e,"inc/dec field index",()=>ve(e,t.index))));s=wt(Na(e,i)),Ou(e,i,s+n)}else if(t.type==="variable")s=wt(Oa(e,t.name)),gi(e,t.name,s+n);else{let i=et(await Qe(e,"inc/dec array key",()=>ve(e,t.key)));s=wt(Ta(e,t.array,i)),Tu(e,t.array,i,s+n)}return r?s+n:s}async function P9(e,t){return Ra(e,t,1,!0)}async function D9(e,t){return Ra(e,t,-1,!0)}async function L9(e,t){return Ra(e,t,1,!1)}async function F9(e,t){return Ra(e,t,-1,!1)}async function M9(e,t,n){gn(e,"in-expression evaluation");let r;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let i of t.elements)s.push(et(await Qe(e,"tuple key element evaluation",()=>ve(e,i))));r=s.join(e.SUBSEP)}else r=et(await Qe(e,"in-expression key evaluation",()=>ve(e,t)));return Pm(e,n,r)?1:0}async function _9(e,t,n,r){if(gn(e,"getline evaluation"),r)return B9(e,t,r);if(n)return U9(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let i=e.lines[s];return t?gi(e,t,i):mi(e,i),e.NR++,e.lineIndex=s,1}async function B9(e,t,n){let r=e.exec;if(!r)return-1;gn(e,"getline command source");let s=et(await Qe(e,"getline command expression",()=>ve(e,n))),i=e.getlineCommandStreams.get(s);if(!i)try{let l=await Qe(e,"getline command exec",()=>r(s)),u=ue(l.stdout).split(`
346
+ `);u.length>0&&u[u.length-1]===""&&u.pop(),i={lines:u,index:-1},e.getlineCommandStreams.set(s,i)}catch(l){if(l instanceof Ae)throw l;return-1}let o=i.index+1;if(o>=i.lines.length)return 0;let a=i.lines[o];return i.index=o,t?gi(e,t,a):mi(e,a),1}async function U9(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;gn(e,"getline file source");let s=et(await Qe(e,"getline filename evaluation",()=>ve(e,n)));if(s==="/dev/null")return 0;let i=r.resolvePath(e.cwd,s),o=e.getlineFileStreams.get(i);if(!o)try{let u=(await Qe(e,"getline file read",()=>r.readFile(i))).split(`
347
+ `);u.length>0&&u[u.length-1]===""&&u.pop(),o={lines:u,index:-1},e.getlineFileStreams.set(i,o)}catch(c){if(c instanceof Ae)throw c;return-1}let a=o.index+1;if(a>=o.lines.length)return 0;let l=o.lines[a];return o.index=a,t?gi(e,t,l):mi(e,l),1}async function z9(e,t){if(gn(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await Qe(e,"tuple intermediate element",()=>ve(e,t[n]));return Qe(e,"tuple final element",()=>ve(e,t[t.length-1]))}var Fm,$u=M(()=>{"use strict";ce();Z();pt();Er();vn();Am();Nu();Ia();hi();Ru();Fm=null});function Pu(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new C(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function or(e,t){Ct(e.requireDefenseContext,"awk",t)}function He(e,t,n){return on(e.requireDefenseContext,"awk",t,n)}async function yi(e,t){or(e,"block execution");for(let n of t)if(await He(e,"statement execution",()=>Is(e,n)),W9(e))break}function W9(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Is(e,t){switch(or(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await He(e,"nested block statement",()=>yi(e,t.statements));break;case"expr_stmt":await He(e,"expression statement",()=>ve(e,t.expression));break;case"print":await He(e,"print statement",()=>j9(e,t.args,t.output));break;case"printf":await He(e,"printf statement",()=>H9(e,t.format,t.args,t.output));break;case"if":await He(e,"if statement",()=>V9(e,t));break;case"while":await He(e,"while statement",()=>G9(e,t));break;case"do_while":await He(e,"do-while statement",()=>q9(e,t));break;case"for":await He(e,"for statement",()=>Z9(e,t));break;case"for_in":await He(e,"for-in statement",()=>K9(e,t));break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0;{let n=t.code;e.exitCode=n?Math.floor(wt(await He(e,"exit code expression",()=>ve(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await He(e,"return expression",()=>ve(e,n)):""}break;case"delete":await He(e,"delete statement",()=>Q9(e,t.target));break}}async function j9(e,t,n){or(e,"print execution");let r=[];for(let i of t){let o=await He(e,"print argument evaluation",()=>ve(e,i));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?r.push(String(o)):r.push(ka(e.OFMT,[o],e.maxOutputSize||void 0)):r.push(et(o))}let s=r.join(e.OFS)+e.ORS;n?await He(e,"print redirection write",()=>_m(e,n.redirect,n.file,s)):(e.output+=s,Pu(e))}async function H9(e,t,n,r){or(e,"printf execution");let s=et(await He(e,"printf format evaluation",()=>ve(e,t))),i=[];for(let l of n)i.push(await He(e,"printf argument evaluation",()=>ve(e,l)));let o=e.maxOutputSize>0?Math.max(0,e.maxOutputSize-U(e.output)):void 0,a=ka(s,i,o);r?await He(e,"printf redirection write",()=>_m(e,r.redirect,r.file,a)):(e.output+=a,Pu(e))}async function _m(e,t,n,r){or(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=r,Pu(e);return}let i=et(await He(e,"redirection filename evaluation",()=>ve(e,n))),o=s.resolvePath(e.cwd,i);t===">"?e.openedFiles.has(o)?await He(e,"redirection append write",()=>s.appendFile(o,r)):(await He(e,"redirection overwrite write",()=>s.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await He(e,"redirection append mode write",()=>s.appendFile(o,r)))}async function V9(e,t){if(or(e,"if execution"),an(await He(e,"if condition evaluation",()=>ve(e,t.condition))))await He(e,"if consequent execution",()=>Is(e,t.consequent));else if(t.alternate){let n=t.alternate;await He(e,"if alternate execution",()=>Is(e,n))}}async function G9(e,t){or(e,"while execution");let n=0;for(;an(await He(e,"while condition evaluation",()=>ve(e,t.condition)));){if(n++,n>e.maxIterations)throw new C(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await He(e,"while body execution",()=>Is(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function q9(e,t){or(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new C(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await He(e,"do-while body execution",()=>Is(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(an(await He(e,"do-while condition evaluation",()=>ve(e,t.condition))))}async function Z9(e,t){or(e,"for execution");let n=t.init,r=t.condition,s=t.update;n&&await He(e,"for init evaluation",()=>ve(e,n));let i=0;for(;!r||an(await He(e,"for condition evaluation",()=>ve(e,r)));){if(i++,i>e.maxIterations)throw new C(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await He(e,"for body execution",()=>Is(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await He(e,"for update evaluation",()=>ve(e,s))}}async function K9(e,t){or(e,"for-in execution");let n=e.arrays[t.array];if(n)for(let r of Object.keys(n)){if(e.vars[t.variable]=r,e.loopContinue=!1,await He(e,"for-in body execution",()=>Is(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Q9(e,t){if(or(e,"delete execution"),t.type==="array_access"){let n=et(await He(e,"delete key evaluation",()=>ve(e,t.key)));Dm(e,t.array,n)}else t.type==="variable"&&Lm(e,t.name)}var Bm=M(()=>{"use strict";Z();Er();St();Nu();$u();hi();Ru();Mm(yi)});var fo,Um=M(()=>{"use strict";Z();Er();$u();Ia();Bm();hi();fo=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){Ct(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return on(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>yi(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){if(this.ctx.recordsProcessed++,this.ctx.recordsProcessed>this.ctx.maxIterations)throw new C(`record limit exceeded (${this.ctx.maxIterations})`,"iterations");mi(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let r=this.program.rules[n];r.pattern?.type==="begin"||r.pattern?.type==="end"||await this.withDefenseContext("rule match",()=>this.matchesRule(r,n))&&await this.withDefenseContext("rule block execution",()=>yi(this.ctx,r.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await this.withDefenseContext("END block execution",()=>yi(this.ctx,t.action.statements)),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){this.assertDefenseContext("rule matching");let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return co(r.pattern,this.ctx.line);case"expr_pattern":return an(await this.withDefenseContext("expression pattern evaluation",()=>ve(this.ctx,r.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(r.start)),i=await this.withDefenseContext("range end pattern",()=>this.matchPattern(r.end));return this.rangeStates[n]?(i&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,i&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return co(t.pattern,this.ctx.line);case"expr_pattern":return an(await this.withDefenseContext("nested expression pattern",()=>ve(this.ctx,t.expression)));default:return!1}}}});var zm=M(()=>{"use strict";Em();Um()});function Y9(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var k,X9,J9,$a,Wm=M(()=>{"use strict";Z();(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(k||(k={}));X9=new Map([["BEGIN",k.BEGIN],["END",k.END],["if",k.IF],["else",k.ELSE],["while",k.WHILE],["do",k.DO],["for",k.FOR],["in",k.IN],["break",k.BREAK],["continue",k.CONTINUE],["next",k.NEXT],["nextfile",k.NEXTFILE],["exit",k.EXIT],["return",k.RETURN],["delete",k.DELETE],["function",k.FUNCTION],["print",k.PRINT],["printf",k.PRINTF],["getline",k.GETLINE]]);J9=new Set([k.COMMA,k.LBRACE,k.AND,k.OR,k.QUESTION,k.COLON,k.DO,k.ELSE,k.IF,k.WHILE]),$a=class{maxTokens;input;pos=0;line=1;column=1;lastTokenType=null;constructor(t,n=1e5){this.maxTokens=n,this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();if(n){if(t.length>=this.maxTokens)throw new C(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");t.push(n),this.lastTokenType=n.type}}if(t.length>=this.maxTokens)throw new C(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");return t.push(this.makeToken(k.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
348
+ `?(this.line++,this.column=1):this.column++,t}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="\\")if(this.peek(1)===`
349
+ `)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
350
+ `;)this.advance();else break}}nextToken(){for(this.skipWhitespace();this.peek()===`
351
+ `&&this.lastTokenType!==null&&J9.has(this.lastTokenType);)this.advance(),this.skipWhitespace();if(this.pos>=this.input.length)return null;let t=this.line,n=this.column,r=this.peek();return r===`
352
+ `?(this.advance(),{type:k.NEWLINE,value:`
353
+ `,line:t,column:n}):r==='"'?this.readString():r==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(r)||r==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(r)||r==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,k.NEWLINE,k.SEMICOLON,k.LBRACE,k.RBRACE,k.LPAREN,k.LBRACKET,k.COMMA,k.ASSIGN,k.PLUS_ASSIGN,k.MINUS_ASSIGN,k.STAR_ASSIGN,k.SLASH_ASSIGN,k.PERCENT_ASSIGN,k.CARET_ASSIGN,k.AND,k.OR,k.NOT,k.MATCH,k.NOT_MATCH,k.QUESTION,k.COLON,k.LT,k.GT,k.LE,k.GE,k.EQ,k.NE,k.PLUS,k.MINUS,k.STAR,k.PERCENT,k.CARET,k.PRINT,k.PRINTF,k.IF,k.WHILE,k.DO,k.FOR,k.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let r="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let s=this.advance();switch(s){case"n":r+=`
354
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"f":r+="\f";break;case"b":r+="\b";break;case"v":r+="\v";break;case"a":r+="\x07";break;case"\\":r+="\\";break;case'"':r+='"';break;case"/":r+="/";break;case"x":{let i="";for(;i.length<2&&/[0-9a-fA-F]/.test(this.peek());)i+=this.advance();i.length>0?r+=String.fromCharCode(parseInt(i,16)):r+="x";break}default:if(/[0-7]/.test(s)){let i=s;for(;i.length<3&&/[0-7]/.test(this.peek());)i+=this.advance();r+=String.fromCharCode(parseInt(i,8))}else r+=s}}else r+=this.advance();return this.peek()==='"'&&this.advance(),{type:k.STRING,value:r,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let r="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")r+=this.advance(),this.pos<this.input.length&&(r+=this.advance());else{if(this.peek()===`
355
+ `)break;r+=this.advance()}return this.peek()==="/"&&this.advance(),r=Y9(r),{type:k.REGEX,value:r,line:t,column:n}}readNumber(){let t=this.line,n=this.column,r="";for(;this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(r+=this.advance();this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(r+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(r+=this.advance());this.isDigit(this.peek());)r+=this.advance();return{type:k.NUMBER,value:parseFloat(r),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,r="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)r+=this.advance();let s=X9.get(r);return s!==void 0?{type:s,value:r,line:t,column:n}:{type:k.IDENT,value:r,line:t,column:n}}readOperator(){let t=this.line,n=this.column,r=this.advance(),s=this.peek();switch(r){case"+":return s==="+"?(this.advance(),{type:k.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:k.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:k.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:k.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:k.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:k.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:k.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:k.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:k.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:k.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:k.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:k.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:k.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:k.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:k.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:k.EQ,value:"==",line:t,column:n}):{type:k.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:k.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:k.NOT_MATCH,value:"!~",line:t,column:n}):{type:k.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:k.LE,value:"<=",line:t,column:n}):{type:k.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:k.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:k.APPEND,value:">>",line:t,column:n}):{type:k.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:k.AND,value:"&&",line:t,column:n}):{type:k.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:k.OR,value:"||",line:t,column:n}):{type:k.PIPE,value:"|",line:t,column:n};case"~":return{type:k.MATCH,value:"~",line:t,column:n};case"?":return{type:k.QUESTION,value:"?",line:t,column:n};case":":return{type:k.COLON,value:":",line:t,column:n};case",":return{type:k.COMMA,value:",",line:t,column:n};case";":return{type:k.SEMICOLON,value:";",line:t,column:n};case"(":return{type:k.LPAREN,value:"(",line:t,column:n};case")":return{type:k.RPAREN,value:")",line:t,column:n};case"{":return{type:k.LBRACE,value:"{",line:t,column:n};case"}":return{type:k.RBRACE,value:"}",line:t,column:n};case"[":return{type:k.LBRACKET,value:"[",line:t,column:n};case"]":return{type:k.RBRACKET,value:"]",line:t,column:n};case"$":return{type:k.DOLLAR,value:"$",line:t,column:n};default:return{type:k.IDENT,value:r,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}}});function qm(e){e.expect(oe.PRINT);let t=[];if(e.check(oe.NEWLINE)||e.check(oe.SEMICOLON)||e.check(oe.RBRACE)||e.check(oe.PIPE)||e.check(oe.GT)||e.check(oe.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(e.assertArrayLength(t.length),t.push(Pa(e));e.check(oe.COMMA);)e.advance(),e.assertArrayLength(t.length),t.push(Pa(e));let n;return e.check(oe.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(oe.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function Pa(e){return eE(e)?Du(e,!0):Du(e,!1)}function Du(e,t){let n=t?e.parseTernary():tE(e);if(e.match(oe.ASSIGN,oe.PLUS_ASSIGN,oe.MINUS_ASSIGN,oe.STAR_ASSIGN,oe.SLASH_ASSIGN,oe.PERCENT_ASSIGN,oe.CARET_ASSIGN)){let r=e.advance(),s=e.withDepth(()=>Du(e,t));if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(r.value)??"=",target:n,value:s}}return n}function eE(e){let t=0,n=e.pos;for(;n<e.tokens.length;){e.useOperation();let r=e.tokens[n];if(r.type===oe.LPAREN&&t++,r.type===oe.RPAREN&&t--,r.type===oe.QUESTION&&t===0)return!0;if(r.type===oe.NEWLINE||r.type===oe.SEMICOLON||r.type===oe.RBRACE||r.type===oe.COMMA||r.type===oe.PIPE)return!1;n++}return!1}function tE(e){let t=jm(e);for(;e.check(oe.OR);){e.advance();let n=jm(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function jm(e){let t=Hm(e);for(;e.check(oe.AND);){e.advance();let n=Hm(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function Hm(e){let t=nE(e);if(e.check(oe.IN)){e.advance();let n=String(e.expect(oe.IDENT).value);return{type:"in",key:t,array:n}}return t}function nE(e){let t=Vm(e);for(;rE(e)&&!sE(e);){let n=Vm(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function Vm(e){let t=Gm(e);for(;e.match(oe.MATCH,oe.NOT_MATCH);){let n=e.advance().type===oe.MATCH?"~":"!~",r=Gm(e);t={type:"binary",operator:n,left:t,right:r}}return t}function Gm(e){let t=e.parseAddSub();for(;e.match(oe.LT,oe.LE,oe.GE,oe.EQ,oe.NE);){let n=e.advance(),r=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}function rE(e){return e.match(oe.NUMBER,oe.STRING,oe.IDENT,oe.DOLLAR,oe.LPAREN,oe.NOT,oe.MINUS,oe.PLUS,oe.INCREMENT,oe.DECREMENT)}function sE(e){return e.match(oe.AND,oe.OR,oe.QUESTION,oe.ASSIGN,oe.PLUS_ASSIGN,oe.MINUS_ASSIGN,oe.STAR_ASSIGN,oe.SLASH_ASSIGN,oe.PERCENT_ASSIGN,oe.CARET_ASSIGN,oe.COMMA,oe.SEMICOLON,oe.NEWLINE,oe.RBRACE,oe.RPAREN,oe.RBRACKET,oe.COLON,oe.PIPE,oe.APPEND,oe.GT,oe.IN)}function Zm(e){e.expect(oe.PRINTF);let t=e.check(oe.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():Pa(e),r=[];for(;e.check(oe.COMMA);)e.advance(),t&&e.skipNewlines(),e.assertArrayLength(r.length),r.push(t?e.parseExpression():Pa(e));t&&(e.skipNewlines(),e.expect(oe.RPAREN));let s;return e.check(oe.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(oe.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:r,output:s}}var oe,Km=M(()=>{"use strict";oe={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"}});var Da,Qm=M(()=>{"use strict";Z();Wm();Km();Da=class{tokens=[];pos=0;depth=0;operations=0;limits;constructor(t={}){this.limits={maxSourceLength:t.maxSourceLength??10*1024*1024,maxTokens:t.maxTokens??1e5,maxDepth:t.maxDepth??100,maxOperations:t.maxOperations??1e5}}parse(t){if(t.length>this.limits.maxSourceLength)throw new C(`awk: source length limit exceeded (${this.limits.maxSourceLength})`,"string_length");let n=new $a(t,this.limits.maxTokens);this.tokens=n.tokenize(),this.pos=0,this.depth=0,this.operations=0;let r=0;for(let s of this.tokens)if(this.useOperation(),s.type===k.LPAREN||s.type===k.LBRACKET||s.type===k.LBRACE){if(r++,r>this.limits.maxDepth)throw new C(`awk: parser depth limit exceeded (${this.limits.maxDepth})`,"recursion")}else(s.type===k.RPAREN||s.type===k.RBRACKET||s.type===k.RBRACE)&&(r=Math.max(0,r-1));return this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:k.EOF,value:"",line:0,column:0}}advance(){this.useOperation();let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}useOperation(t=1){if(t>this.limits.maxOperations-this.operations)throw new C(`awk: parser operation limit exceeded (${this.limits.maxOperations})`,"iterations");this.operations+=t}withDepth(t){if(this.depth>=this.limits.maxDepth)throw new C(`awk: parser depth limit exceeded (${this.limits.maxDepth})`,"recursion");this.depth++;try{return t()}finally{this.depth--}}assertArrayLength(t){if(t>=this.limits.maxTokens)throw new C(`awk: AST array limit exceeded (${this.limits.maxTokens})`,"array_elements")}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let r=this.current();throw new Error(n||`Expected ${t}, got ${r.type} at line ${r.line}:${r.column}`)}return this.advance()}skipNewlines(){for(;this.check(k.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(k.NEWLINE)||this.check(k.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(k.EOF)&&(this.skipNewlines(),!this.check(k.EOF));)this.check(k.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(k.FUNCTION);let t=this.expect(k.IDENT).value;this.expect(k.LPAREN);let n=[];if(!this.check(k.RPAREN))for(n.push(this.expect(k.IDENT).value);this.check(k.COMMA);)this.advance(),n.push(this.expect(k.IDENT).value);this.expect(k.RPAREN),this.skipNewlines();let r=this.parseBlock();return{name:t,params:n,body:r}}parseRule(){let t;if(this.check(k.BEGIN))this.advance(),t={type:"begin"};else if(this.check(k.END))this.advance(),t={type:"end"};else if(this.check(k.LBRACE))t=void 0;else if(this.check(k.REGEX)){let r=this.advance();if(this.check(k.AND)||this.check(k.OR)){let s={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:r.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(s)}}else{let s={type:"regex_pattern",pattern:r.value};if(this.check(k.COMMA)){this.advance();let i;this.check(k.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:i}}else t=s}}else{let s={type:"expr_pattern",expression:this.parseExpression()};if(this.check(k.COMMA)){this.advance();let i;this.check(k.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:i}}else t=s}this.skipNewlines();let n;return this.check(k.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(k.LBRACE),this.skipNewlines();let t=[];for(;!this.check(k.RBRACE)&&!this.check(k.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(k.RBRACE),{type:"block",statements:t}}parseStatement(){return this.withDepth(()=>this.parseStatementAtDepth())}parseStatementAtDepth(){if(this.check(k.SEMICOLON)||this.check(k.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(k.LBRACE))return this.parseBlock();if(this.check(k.IF))return this.parseIf();if(this.check(k.WHILE))return this.parseWhile();if(this.check(k.DO))return this.parseDoWhile();if(this.check(k.FOR))return this.parseFor();if(this.check(k.BREAK))return this.advance(),{type:"break"};if(this.check(k.CONTINUE))return this.advance(),{type:"continue"};if(this.check(k.NEXT))return this.advance(),{type:"next"};if(this.check(k.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(k.EXIT)){this.advance();let n;return!this.check(k.NEWLINE)&&!this.check(k.SEMICOLON)&&!this.check(k.RBRACE)&&!this.check(k.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(k.RETURN)){this.advance();let n;return!this.check(k.NEWLINE)&&!this.check(k.SEMICOLON)&&!this.check(k.RBRACE)&&!this.check(k.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(k.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(k.PRINT)?qm(this):this.check(k.PRINTF)?Zm(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(k.IF),this.expect(k.LPAREN);let t=this.parseExpression();this.expect(k.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let r;return this.check(k.ELSE)&&(this.advance(),this.skipNewlines(),r=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:r}}parseWhile(){this.expect(k.WHILE),this.expect(k.LPAREN);let t=this.parseExpression();this.expect(k.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(k.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(k.WHILE),this.expect(k.LPAREN);let n=this.parseExpression();return this.expect(k.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(k.FOR),this.expect(k.LPAREN),this.check(k.IDENT)){let i=this.advance();if(this.check(k.IN)){this.advance();let o=this.expect(k.IDENT).value;this.expect(k.RPAREN),this.skipNewlines();let a=this.parseStatement();return{type:"for_in",variable:i.value,array:o,body:a}}this.pos--}let t;this.check(k.SEMICOLON)||(t=this.parseExpression()),this.expect(k.SEMICOLON);let n;this.check(k.SEMICOLON)||(n=this.parseExpression()),this.expect(k.SEMICOLON);let r;this.check(k.RPAREN)||(r=this.parseExpression()),this.expect(k.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:r,body:s}}parseExpression(){return this.withDepth(()=>this.parseAssignment())}parseAssignment(){let t=this.parseTernary();if(this.match(k.ASSIGN,k.PLUS_ASSIGN,k.MINUS_ASSIGN,k.STAR_ASSIGN,k.SLASH_ASSIGN,k.PERCENT_ASSIGN,k.CARET_ASSIGN)){let n=this.advance(),r=this.parseExpression();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");let s=new Set(["=","+=","-=","*=","/=","%=","^="]),i=n.value;if(!s.has(i))throw new Error(`Unknown assignment operator: ${i}`);return{type:"assignment",operator:i,target:t,value:r}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(k.QUESTION)){this.advance();let n=this.parseExpression();this.expect(k.COLON);let r=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:r}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(k.PIPE)){if(this.advance(),!this.check(k.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(k.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(k.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(k.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(k.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(k.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(k.IN)){this.advance();let n=this.expect(k.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(k.MATCH,k.NOT_MATCH);){let n=this.advance().type===k.MATCH?"~":"!~",r=this.parseComparison();t={type:"binary",operator:n,left:t,right:r}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(k.LT,k.LE,k.GT,k.GE,k.EQ,k.NE);){let n=this.advance(),r=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}canStartExpression(){return this.match(k.NUMBER,k.STRING,k.IDENT,k.DOLLAR,k.LPAREN,k.NOT,k.MINUS,k.PLUS,k.INCREMENT,k.DECREMENT)}isConcatTerminator(){return this.match(k.AND,k.OR,k.QUESTION,k.ASSIGN,k.PLUS_ASSIGN,k.MINUS_ASSIGN,k.STAR_ASSIGN,k.SLASH_ASSIGN,k.PERCENT_ASSIGN,k.CARET_ASSIGN,k.COMMA,k.SEMICOLON,k.NEWLINE,k.RBRACE,k.RPAREN,k.RBRACKET,k.COLON,k.PIPE,k.APPEND,k.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(k.PLUS,k.MINUS);){let n=this.advance().value,r=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:r}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(k.STAR,k.SLASH,k.PERCENT);){let n=this.advance(),r=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:r}}return t}parseUnary(){if(this.check(k.INCREMENT)){this.advance();let t=this.withDepth(()=>this.parseUnary());return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(k.DECREMENT)){this.advance();let t=this.withDepth(()=>this.parseUnary());return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(k.NOT,k.MINUS,k.PLUS)){let t=this.advance().value,n=this.withDepth(()=>this.parseUnary());return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(k.CARET)){this.advance();let n=this.withDepth(()=>this.parsePower());t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(k.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(k.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(k.INCREMENT)){this.advance();let t=this.withDepth(()=>this.parseFieldIndex());return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(k.DECREMENT)){this.advance();let t=this.withDepth(()=>this.parseFieldIndex());return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(k.NOT,k.MINUS,k.PLUS)){let t=this.advance().value,n=this.withDepth(()=>this.parseFieldIndex());return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(k.CARET)){this.advance();let n=this.withDepth(()=>this.parseFieldIndexPower());t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(k.NUMBER))return{type:"number",value:this.advance().value};if(this.check(k.STRING))return{type:"string",value:this.advance().value};if(this.check(k.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(k.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(k.RPAREN),t}if(this.check(k.IDENT)){let t=this.advance().value;if(this.check(k.LPAREN)){this.advance();let n=[];if(!this.check(k.RPAREN))for(n.push(this.parseExpression());this.check(k.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(k.RPAREN),{type:"call",name:t,args:n}}if(this.check(k.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(k.COMMA)){let r=[n];for(;this.check(k.COMMA);)this.advance(),r.push(this.parseExpression());this.expect(k.RBRACKET);let s=r.reduce((i,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:s}}return this.expect(k.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(k.NUMBER))return{type:"number",value:this.advance().value};if(this.check(k.STRING))return{type:"string",value:this.advance().value};if(this.check(k.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(k.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(k.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(k.COMMA)){let n=[t];for(;this.check(k.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(k.RPAREN),{type:"tuple",elements:n}}return this.expect(k.RPAREN),t}if(this.check(k.GETLINE)){this.advance();let t,n;return this.check(k.IDENT)&&(t=this.advance().value),this.check(k.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(k.IDENT)){let t=this.advance().value;if(this.check(k.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(k.RPAREN))for(n.push(this.parseExpression());this.check(k.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(k.RPAREN),{type:"call",name:t,args:n}}if(this.check(k.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(k.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(k.RBRACKET);let r;if(n.length===1)r=n[0];else{r=n[0];for(let s=1;s<n.length;s++)r={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:r,right:{type:"variable",name:"SUBSEP"}},right:n[s]}}return{type:"array_access",array:t,key:r}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}}});var Jm={};ae(Jm,{awkCommand2:()=>oE,flagsForFuzzing:()=>aE});function Lu(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
356
+ `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function Xm(e){if(e===" ")return ie("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return ie(e)}catch{return ie(Ym(e))}return ie(Ym(e))}function Ym(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var iE,oE,aE,e0=M(()=>{"use strict";ce();Nt();Lr();Z();pt();Er();vn();de();St();zm();Qm();iE={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},oE={name:"awk",async execute(e,t){Ct(t.requireDefenseContext,"awk","execution entry");let n=(b,w)=>on(t.requireDefenseContext,"awk",b,w);if(q(e))return G(iE);let r=new Dr(/\s+/),s=" ",i=Object.create(null),o=0;for(let b=0;b<e.length;b++){let w=e[b];if(w==="-F"&&b+1<e.length)s=Lu(e[++b]),r=Xm(s),o=b+1;else if(w.startsWith("-F"))s=Lu(w.slice(2)),r=Xm(s),o=b+1;else if(w==="-v"&&b+1<e.length){let y=e[++b],x=y.indexOf("=");if(x>0){let S=y.slice(0,x),E=Lu(y.slice(x+1));i[S]=E}o=b+1}else{if(w.startsWith("--"))return re("awk",w);if(w.startsWith("-")&&w.length>1){let y=w[1];if(y!=="F"&&y!=="v")return re("awk",`-${y}`);o=b+1}else if(!w.startsWith("-")){o=b;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program
357
+ `,exitCode:1};let a=e[o],l=e.slice(o+1),c=new Da({maxSourceLength:t.limits.maxStringLength,maxTokens:t.limits.maxAwkParserTokens,maxDepth:t.limits.maxAwkParserDepth,maxOperations:t.limits.maxAwkParserOperations}),u;try{u=c.parse(a)}catch(b){return he(b),{stdout:"",stderr:`awk: ${b instanceof Error?b.message:String(b)}
358
+ `,exitCode:1}}let f={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(b,w)=>{try{let y=await n("appendFile read",()=>t.fs.readFile(b));await n("appendFile write",()=>t.fs.writeFile(b,y+w))}catch(y){if(y instanceof Ae)throw y;await n("appendFile create",()=>t.fs.writeFile(b,w))}},resolvePath:t.fs.resolvePath.bind(t.fs)},d=t.exec,p=Cu({fieldSep:r,maxIterations:t.limits.maxAwkIterations,maxOutputSize:Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),maxArrayElements:t.limits.maxArrayElements,fs:f,cwd:t.cwd,exec:d?b=>n("command pipe exec",()=>d(b,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});p.FS=s,p.vars=Object.assign(Object.create(null),i),p.ARGC=l.length+1,p.ARGV=Object.create(null),p.ARGV[0]="awk";for(let b=0;b<l.length;b++)p.ARGV[String(b+1)]=l[b];p.ENVIRON=Ht(t.env);let h=new fo(p);h.execute(u);let m=u.rules.some(b=>b.pattern?.type!=="begin"&&b.pattern?.type!=="end"),g=u.rules.some(b=>b.pattern?.type==="end");try{if(await n("BEGIN execution",()=>h.executeBegin()),p.shouldExit)return await n("END execution after BEGIN exit",()=>h.executeEnd()),{stdout:h.getOutput(),stderr:"",exitCode:h.getExitCode()};if(!m&&!g)return{stdout:h.getOutput(),stderr:"",exitCode:h.getExitCode()};let b=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),w=t.limits.maxArrayElements,y=0,x=async(S,E)=>{let A=U(E);if(A>b-y)throw new C(`aggregate input size limit exceeded (${b} bytes)`,"string_length");y+=A;let I=E.length>0?1:0;for(let N=0;N<E.length;N++)if(E.charCodeAt(N)===10&&I++,I>w+1)throw new C(`record array limit exceeded (${w})`,"array_elements");let $=E.split(`
359
+ `);if($.length>0&&$[$.length-1]===""&&$.pop(),$.length>w)throw new C(`record array limit exceeded (${w})`,"array_elements");for(p.FILENAME=S,p.FNR=0,p.lines=$,p.lineIndex=-1,p.shouldNextFile=!1;p.lineIndex<$.length-1;){p.lineIndex++;let N=p.lineIndex;if(await n("line execution",()=>h.executeLine($[N])),p.shouldExit||p.shouldNextFile)break}};if(l.length>0)for(let S of l){let E;try{let A=t.fs.resolvePath(t.cwd,S);if((await n("input file stat",()=>t.fs.stat(A))).size>b-y)throw new C(`aggregate input size limit exceeded (${b} bytes)`,"string_length");E=await n("input file read",()=>t.fs.readFile(A))}catch(A){if(A instanceof Ae||A instanceof C)throw A;return{stdout:"",stderr:`awk: ${S}: No such file or directory
360
+ `,exitCode:1}}if(await n("input processing",()=>x(S,E)),p.shouldExit)break}else await n("stdin processing",()=>x("",ue(t.stdin)));return await n("END execution",()=>h.executeEnd()),{stdout:h.getOutput(),stderr:"",exitCode:h.getExitCode()}}catch(b){if(b instanceof Ae)throw b;let w=b instanceof Error?b.message:String(b),y=b instanceof C?C.EXIT_CODE:2;return{stdout:h.getOutput(),stderr:`awk: ${w}
361
+ `,exitCode:y}}}};aE={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0}});function t0(e){let t=e.trim(),n=t.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!n){let o=parseFloat(t);return Number.isNaN(o)?0:o}let r=parseFloat(n[1]),s=(n[2]||"").toLowerCase(),i=lE.get(s)??1;return r*i}function n0(e){let t=e.trim().toLowerCase().slice(0,3);return cE.get(t)??0}function uE(e,t){let n=e.split(/(\d+)/),r=t.split(/(\d+)/),s=Math.max(n.length,r.length);for(let i=0;i<s;i++){let o=n[i]||"",a=r[i]||"",l=/^\d+$/.test(o)?parseInt(o,10):null,c=/^\d+$/.test(a)?parseInt(a,10):null;if(l!==null&&c!==null){if(l!==c)return l-c}else if(o!==a)return o.localeCompare(a)}return 0}function r0(e){return e.replace(/[^a-zA-Z0-9\s]/g,"")}function Fu(e,t,n){let r=n!==null?n:/\s+/,s=e.split(r),i=t.startField-1;if(i>=s.length)return"";if(t.endField===void 0){let l=s[i]||"";return t.startChar!==void 0&&(l=l.slice(t.startChar-1)),t.ignoreLeading&&(l=l.trimStart()),l}let o=Math.min(t.endField-1,s.length-1),a="";for(let l=i;l<=o&&l<s.length;l++){let c=s[l]||"";if(l===i&&t.startChar!==void 0&&(c=c.slice(t.startChar-1)),l===o&&t.endChar!==void 0){let u=l===i&&t.startChar!==void 0?t.endChar-t.startChar+1:t.endChar;c=c.slice(0,u)}l>i&&(a+=n||" "),a+=c}return t.ignoreLeading&&(a=a.trimStart()),a}function s0(e,t,n){let r=e,s=t;if(n.dictionaryOrder&&(r=r0(r),s=r0(s)),n.ignoreCase&&(r=r.toLowerCase(),s=s.toLowerCase()),n.monthSort){let i=n0(r),o=n0(s);return i-o}if(n.humanNumeric){let i=t0(r),o=t0(s);return i-o}if(n.versionSort)return uE(r,s);if(n.numeric){let i=parseFloat(r)||0,o=parseFloat(s)||0;return i-o}return r.localeCompare(s)}function i0(e){let{keys:t,fieldDelimiter:n,numeric:r,ignoreCase:s,reverse:i,humanNumeric:o,versionSort:a,dictionaryOrder:l,monthSort:c,ignoreLeadingBlanks:u,stable:f}=e;return(d,p)=>{let h=d,m=p;if(u&&(h=h.trimStart(),m=m.trimStart()),t.length===0){let b=s0(h,m,{numeric:r,ignoreCase:s,humanNumeric:o,versionSort:a,dictionaryOrder:l,monthSort:c});if(b!==0)return i?-b:b;if(!f){let w=d.localeCompare(p);return i?-w:w}return 0}for(let g of t){let b=Fu(h,g,n),w=Fu(m,g,n);g.ignoreLeading&&(b=b.trimStart(),w=w.trimStart());let y={numeric:g.numeric??r,ignoreCase:g.ignoreCase??s,humanNumeric:g.humanNumeric??o,versionSort:g.versionSort??a,dictionaryOrder:g.dictionaryOrder??l,monthSort:g.monthSort??c},x=g.reverse??i,S=s0(b,w,y);if(S!==0)return x?-S:S}if(!f){let g=d.localeCompare(p);return i?-g:g}return 0}}function o0(e,t){if(t.keys.length===0){if(t.ignoreCase){let s=new Set;return e.filter(i=>{let o=i.toLowerCase();return s.has(o)?!1:(s.add(o),!0)})}return[...new Set(e)]}let n=t.keys[0],r=new Set;return e.filter(s=>{let i=Fu(s,n,t.fieldDelimiter);return(n.ignoreCase??t.ignoreCase)&&(i=i.toLowerCase()),r.has(i)?!1:(r.add(i),!0)})}var lE,cE,a0=M(()=>{"use strict";lE=new Map([["",1],["k",1024],["m",1048576],["g",1073741824],["t",1099511627776],["p",0x4000000000000],["e",1152921504606847e3]]),cE=new Map([["jan",1],["feb",2],["mar",3],["apr",4],["may",5],["jun",6],["jul",7],["aug",8],["sep",9],["oct",10],["nov",11],["dec",12]])});function La(e){let t={startField:1},n="",r=e,s=r.match(/([bdfhMnrV]+)$/);s&&(n=s[1],r=r.slice(0,-n.length)),n.includes("n")&&(t.numeric=!0),n.includes("r")&&(t.reverse=!0),n.includes("f")&&(t.ignoreCase=!0),n.includes("b")&&(t.ignoreLeading=!0),n.includes("h")&&(t.humanNumeric=!0),n.includes("V")&&(t.versionSort=!0),n.includes("d")&&(t.dictionaryOrder=!0),n.includes("M")&&(t.monthSort=!0);let i=r.split(",");if(i.length===0||i[0]==="")return null;let o=i[0].split("."),a=parseInt(o[0],10);if(Number.isNaN(a)||a<1)return null;if(t.startField=a,o.length>1&&o[1]){let l=parseInt(o[1],10);!Number.isNaN(l)&&l>=1&&(t.startChar=l)}if(i.length>1&&i[1]){let l=i[1],c=l.match(/([bdfhMnrV]+)$/);if(c){let f=c[1];f.includes("n")&&(t.numeric=!0),f.includes("r")&&(t.reverse=!0),f.includes("f")&&(t.ignoreCase=!0),f.includes("b")&&(t.ignoreLeading=!0),f.includes("h")&&(t.humanNumeric=!0),f.includes("V")&&(t.versionSort=!0),f.includes("d")&&(t.dictionaryOrder=!0),f.includes("M")&&(t.monthSort=!0),l=l.slice(0,-f.length)}let u=l.split(".");if(u[0]){let f=parseInt(u[0],10);if(!Number.isNaN(f)&&f>=1&&(t.endField=f),u.length>1&&u[1]){let d=parseInt(u[1],10);!Number.isNaN(d)&&d>=1&&(t.endChar=d)}}}return t}var l0=M(()=>{"use strict"});var c0={};ae(c0,{flagsForFuzzing:()=>pE,sortCommand:()=>dE});var fE,dE,pE,u0=M(()=>{"use strict";ce();Gr();de();a0();l0();fE={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-b, --ignore-leading-blanks ignore leading blanks","-d, --dictionary-order consider only blanks and alphanumeric characters","-f, --ignore-case fold lower case to upper case characters","-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)","-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-V, --version-sort natural sort of (version) numbers within text","-c, --check check for sorted input; do not sort","-o, --output=FILE write result to FILE instead of stdout","-s, --stable stabilize sort by disabling last-resort comparison","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]]
362
+ F is a field number (1-indexed)
363
+ C is a character position within the field (1-indexed)
364
+ OPTS can be: b d f h M n r V (per-key modifiers)
365
+
366
+ Examples:
367
+ -k1 sort by first field
368
+ -k2,2 sort by second field only
369
+ -k1.3 sort by first field starting at 3rd character
370
+ -k1,2n sort by fields 1-2 numerically
371
+ -k2 -k1 sort by field 2, then by field 1`},dE={name:"sort",async execute(e,t){if(q(e))return G(fE);let n={reverse:!1,numeric:!1,unique:!1,ignoreCase:!1,humanNumeric:!1,versionSort:!1,dictionaryOrder:!1,monthSort:!1,ignoreLeadingBlanks:!1,stable:!1,checkOnly:!1,outputFile:null,keys:[],fieldDelimiter:null},r=[];for(let c=0;c<e.length;c++){let u=e[c];if(u==="-r"||u==="--reverse")n.reverse=!0;else if(u==="-n"||u==="--numeric-sort")n.numeric=!0;else if(u==="-u"||u==="--unique")n.unique=!0;else if(u==="-f"||u==="--ignore-case")n.ignoreCase=!0;else if(u==="-h"||u==="--human-numeric-sort")n.humanNumeric=!0;else if(u==="-V"||u==="--version-sort")n.versionSort=!0;else if(u==="-d"||u==="--dictionary-order")n.dictionaryOrder=!0;else if(u==="-M"||u==="--month-sort")n.monthSort=!0;else if(u==="-b"||u==="--ignore-leading-blanks")n.ignoreLeadingBlanks=!0;else if(u==="-s"||u==="--stable")n.stable=!0;else if(u==="-c"||u==="--check")n.checkOnly=!0;else if(u==="-o"||u==="--output")n.outputFile=e[++c]||null;else if(u.startsWith("-o"))n.outputFile=u.slice(2)||null;else if(u.startsWith("--output="))n.outputFile=u.slice(9)||null;else if(u==="-t"||u==="--field-separator")n.fieldDelimiter=e[++c]||null;else if(u.startsWith("-t"))n.fieldDelimiter=u.slice(2)||null;else if(u.startsWith("--field-separator="))n.fieldDelimiter=u.slice(18)||null;else if(u==="-k"||u==="--key"){let f=e[++c];if(f){let d=La(f);d&&n.keys.push(d)}}else if(u.startsWith("-k")){let f=La(u.slice(2));f&&n.keys.push(f)}else if(u.startsWith("--key=")){let f=La(u.slice(6));f&&n.keys.push(f)}else{if(u.startsWith("--"))return re("sort",u);if(u.startsWith("-")&&!u.startsWith("--")){let f=!1;for(let d of u.slice(1))if(d==="r")n.reverse=!0;else if(d==="n")n.numeric=!0;else if(d==="u")n.unique=!0;else if(d==="f")n.ignoreCase=!0;else if(d==="h")n.humanNumeric=!0;else if(d==="V")n.versionSort=!0;else if(d==="d")n.dictionaryOrder=!0;else if(d==="M")n.monthSort=!0;else if(d==="b")n.ignoreLeadingBlanks=!0;else if(d==="s")n.stable=!0;else if(d==="c")n.checkOnly=!0;else{f=!0;break}if(f)return re("sort",u)}else r.push(u)}}let s=await si(t,r,{cmdName:"sort"});if(!s.ok)return s.error;let o=ue(s.content).split(`
372
+ `);o.length>0&&o[o.length-1]===""&&o.pop();let a=i0(n);if(n.checkOnly){let c=r.length>0?r[0]:"-";for(let u=1;u<o.length;u++)if(a(o[u-1],o[u])>0)return{stdout:"",stderr:`sort: ${c}:${u+1}: disorder: ${o[u]}
373
+ `,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}o.sort(a),n.unique&&(o=o0(o,n));let l=o.length>0?`${o.join(`
374
+ `)}
375
+ `:"";if(n.outputFile){let c=t.fs.resolvePath(t.cwd,n.outputFile);return await t.fs.writeFile(c,l),{stdout:"",stderr:"",exitCode:0}}return{stdout:l,stderr:"",exitCode:0}}},pE={name:"sort",flags:[{flag:"-r",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-V",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-M",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-k",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"path"}],stdinType:"text",needsFiles:!0}});var f0={};ae(f0,{flagsForFuzzing:()=>yE,uniqCommand:()=>gE});var hE,mE,gE,yE,d0=M(()=>{"use strict";ce();It();Gr();de();hE={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},mE={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},gE={name:"uniq",async execute(e,t){if(q(e))return G(hE);let n=Le("uniq",e,mE);if(!n.ok)return n.error;let{count:r,duplicatesOnly:s,uniqueOnly:i,ignoreCase:o}=n.result.flags,a=n.result.positional,l=await si(t,a,{cmdName:"uniq"});if(!l.ok)return l.error;let u=(o?ue(l.content):l.content).split(`
376
+ `);if(u.length>0&&u[u.length-1]===""&&u.pop(),u.length===0)return{stdout:"",stderr:"",exitCode:0};let f=[],d=u[0],p=1,h=(b,w)=>o?b.toLowerCase()===w.toLowerCase():b===w;for(let b=1;b<u.length;b++)h(u[b],d)?p++:(f.push({line:d,count:p}),d=u[b],p=1);f.push({line:d,count:p});let m=f;s?m=f.filter(b=>b.count>1):i&&(m=f.filter(b=>b.count===1));let g="";for(let{line:b,count:w}of m)r?g+=`${String(w).padStart(4)} ${b}
377
+ `:g+=`${b}
378
+ `;return o?{stdout:g,stderr:"",exitCode:0}:{stdout:g,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},yE={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}});var p0={};ae(p0,{commCommand:()=>bE,flagsForFuzzing:()=>xE});var wE,bE,xE,h0=M(()=>{"use strict";ce();de();wE={name:"comm",summary:"compare two sorted files line by line",usage:"comm [OPTION]... FILE1 FILE2",options:["-1 suppress column 1 (lines unique to FILE1)","-2 suppress column 2 (lines unique to FILE2)","-3 suppress column 3 (lines that appear in both files)"," --help display this help and exit"]},bE={name:"comm",async execute(e,t){if(q(e))return G(wE);let n=!1,r=!1,s=!1,i=[];for(let g of e)if(g==="-1")n=!0;else if(g==="-2")r=!0;else if(g==="-3")s=!0;else if(g==="-12"||g==="-21")n=!0,r=!0;else if(g==="-13"||g==="-31")n=!0,s=!0;else if(g==="-23"||g==="-32")r=!0,s=!0;else if(g==="-123"||g==="-132"||g==="-213"||g==="-231"||g==="-312"||g==="-321")n=!0,r=!0,s=!0;else{if(g.startsWith("-")&&g!=="-")return re("comm",g);i.push(g)}if(i.length!==2)return{stdout:"",stderr:`comm: missing operand
379
+ Try 'comm --help' for more information.
380
+ `,exitCode:1};let o=async g=>{if(g==="-")return ue(t.stdin);try{let b=t.fs.resolvePath(t.cwd,g);return await t.fs.readFile(b)}catch{return null}},a=await o(i[0]);if(a===null)return{stdout:"",stderr:`comm: ${i[0]}: No such file or directory
381
+ `,exitCode:1};let l=await o(i[1]);if(l===null)return{stdout:"",stderr:`comm: ${i[1]}: No such file or directory
382
+ `,exitCode:1};let c=a.split(`
383
+ `),u=l.split(`
384
+ `);c.length>0&&c[c.length-1]===""&&c.pop(),u.length>0&&u[u.length-1]===""&&u.pop();let f=0,d=0,p="",h=n?"":" ",m=(n?"":" ")+(r?"":" ");for(;f<c.length||d<u.length;)f>=c.length?(r||(p+=`${h}${u[d]}
385
+ `),d++):d>=u.length?(n||(p+=`${c[f]}
386
+ `),f++):c[f]<u[d]?(n||(p+=`${c[f]}
387
+ `),f++):c[f]>u[d]?(r||(p+=`${h}${u[d]}
388
+ `),d++):(s||(p+=`${m}${c[f]}
389
+ `),f++,d++);return{stdout:p,stderr:"",exitCode:0}}},xE={name:"comm",flags:[{flag:"-1",type:"boolean"},{flag:"-2",type:"boolean"},{flag:"-3",type:"boolean"}],needsArgs:!0,minArgs:2}});var m0={};ae(m0,{cutCommand:()=>CE,flagsForFuzzing:()=>vE});function SE(e,t){let n=[],r=e.split(",");if(r.length>t)throw new C(`cut: range count limit exceeded (${t})`,"array_elements");for(let s of r)if(s.includes("-")){let[i,o]=s.split("-"),a=i?Number(i):1,l=o?Number(o):null;if(!Number.isSafeInteger(a)||a<1||l!==null&&(!Number.isSafeInteger(l)||l<a))throw new C("cut: invalid range","array_elements");n.push({start:a,end:l})}else{let i=Number(s);if(!Number.isSafeInteger(i)||i<1)throw new C("cut: invalid range","array_elements");n.push({start:i,end:i})}return n}function AE(e,t){let n=[],r=new Set;for(let s of t){let i=s.start-1,o=s.end===null?e.length:s.end;for(let a=i;a<o&&a<e.length;a++)a>=0&&!r.has(a)&&(r.add(a),n.push(e[a]))}return n}var EE,CE,vE,g0=M(()=>{"use strict";At();ce();Z();Gr();de();EE={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};CE={name:"cut",async execute(e,t){if(q(e))return G(EE);let n=" ",r=null,s=null,i=!1,o=[];for(let h=0;h<e.length;h++){let m=e[h];if(m==="-d")n=e[++h]||" ";else if(m.startsWith("-d"))n=m.slice(2);else if(m==="-f")r=e[++h];else if(m.startsWith("-f"))r=m.slice(2);else if(m==="-c")s=e[++h];else if(m.startsWith("-c"))s=m.slice(2);else if(m==="-s"||m==="--only-delimited")i=!0;else{if(m.startsWith("--"))return re("cut",m);if(m.startsWith("-")){let g=!1;for(let b of m.slice(1))if(b==="s")i=!0;else if(!"dfc".includes(b)){g=!0;break}if(g)return re("cut",m)}else o.push(m)}}if(!r&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
390
+ `,exitCode:1};let a=await si(t,o,{cmdName:"cut"});if(!a.ok)return a.error;let c=(s?ue(a.content):a.content).split(`
391
+ `);c.length>0&&c[c.length-1]===""&&c.pop();let u=SE(r||s||"1",t.limits.maxArrayElements),f=new Te(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"cut"),d=0,p=h=>{if(!Number.isSafeInteger(h)||h<0||h>t.limits.maxLoopIterations-d)throw new C(`cut: range expansion limit exceeded (${t.limits.maxLoopIterations})`,"iterations");d+=h,t.executionScope?.consumeWork(h,"cut range expansion")};for(let h of c)if(s){let m=Array.from(h),g=[];for(let b of u){let w=b.start-1,y=b.end===null?m.length:b.end;p(Math.max(0,Math.min(y,m.length)-w));for(let x=w;x<y&&x<m.length;x++)x>=0&&g.push(m[x])}f.append(`${g.join("")}
392
+ `)}else{if(i&&!h.includes(n))continue;let m=h.split(n);for(let b of u){let w=b.start-1,y=b.end===null?m.length:b.end;p(Math.max(0,Math.min(y,m.length)-w))}let g=AE(m,u);f.append(`${g.join(n)}
393
+ `)}return s?{stdout:f.build(),stderr:"",exitCode:0}:{stdout:f.build(),stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},vE={name:"cut",flags:[{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-f",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"string"},{flag:"-s",type:"boolean"}],stdinType:"text",needsFiles:!0}});var w0={};ae(w0,{flagsForFuzzing:()=>OE,pasteCommand:()=>IE});function y0(e,t){if(e.length===0)return"";if(e.length===1)return e[0];if(t.length===0)return e.join("");let n=e[0];for(let r=1;r<e.length;r++){let s=(r-1)%t.length;n+=t[s]+e[r]}return n}var kE,NE,IE,OE,b0=M(()=>{"use strict";At();ce();Nt();Z();It();de();kE={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},NE={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},IE={name:"paste",async execute(e,t){if(q(e))return G(kE);let n=Le("paste",e,NE);if(!n.ok)return n.error;let r=n.result.flags.delimiter,s=n.result.flags.serial,i=n.result.positional;if(i.length>t.limits.maxArrayElements)throw new C(`paste: file operand limit exceeded (${t.limits.maxArrayElements})`,"array_elements");if(U(r)>t.limits.maxStringLength)throw new C(`paste: delimiter size limit exceeded (${t.limits.maxStringLength} bytes)`,"string_length");if(i.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ...
394
+ `,exitCode:1};let o=ue(t.stdin),a=o?o.split(`
395
+ `):[""];a.length>0&&a[a.length-1]===""&&a.pop();let l=i.filter(m=>m==="-").length,c=[],u=0,f=U(o),d=m=>{if(m.length>t.limits.maxArrayElements-u)throw new C(`paste: line limit exceeded (${t.limits.maxArrayElements})`,"array_elements");u+=m.length,t.executionScope?.consumeWork(m.length,"paste lines")},p=0;for(let m of i)if(m==="-"){let g=[];for(let b=p;b<a.length;b+=l)g.push(a[b]);d(g),c.push(g),p++}else{let g=t.fs.resolvePath(t.cwd,m);try{let b=await t.fs.readFile(g),w=U(b);if(w>t.limits.maxInputBytes-f)throw new C(`paste: aggregate input size limit exceeded (${t.limits.maxInputBytes} bytes)`,"string_length");f+=w,t.executionScope?.consumeInput(w,"paste");let y=b.split(`
396
+ `);y.length>0&&y[y.length-1]===""&&y.pop(),d(y),c.push(y)}catch(b){return he(b),{stdout:"",stderr:`paste: ${m}: No such file or directory
397
+ `,exitCode:1}}}let h=new Te(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"paste");if(s)for(let m of c)m&&h.append(`${y0(m,r)}
398
+ `);else{let m=0;for(let g of c)m=Math.max(m,g?.length??0);for(let g=0;g<m;g++){let b=[];for(let w of c)b.push(w?.[g]??"");h.append(`${y0(b,r)}
399
+ `)}}return{stdout:h.build(),stderr:"",exitCode:0}}};OE={name:"paste",flags:[{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-s",type:"boolean"}],stdinType:"text",needsFiles:!0}});var E0={};ae(E0,{flagsForFuzzing:()=>DE,trCommand:()=>PE});function x0(e,t,n,r){let s="",i=0,o=l=>{if(l.length>t-s.length)throw new C(`tr: expanded SET exceeds string length limit (${t})`,"string_length");s+=l},a=(l=1)=>{if(l>n-r.iterations)throw new C(`tr: SET expansion iteration limit exceeded (${n})`,"iterations");r.iterations+=l};for(;i<e.length;){if(a(),e[i]==="["&&e[i+1]===":"){let l=!1;for(let[c,u]of RE)if(e.slice(i).startsWith(c)){o(u),i+=c.length,l=!0;break}if(l)continue}if(e[i]==="\\"&&i+1<e.length){let l=e[i+1];o(l==="n"?`
400
+ `:l==="t"?" ":l==="r"?"\r":l),i+=2;continue}if(i+2<e.length&&e[i+1]==="-"){let l=e.charCodeAt(i),c=e.charCodeAt(i+2),u=c>=l?c-l+1:0;if(a(u),u>t-s.length)throw new C(`tr: expanded SET exceeds string length limit (${t})`,"string_length");for(let f=l;f<=c;f++)s+=String.fromCharCode(f);i+=3;continue}o(e[i]),i++}return s}var TE,RE,$E,PE,DE,S0=M(()=>{"use strict";ce();Nt();_n();Z();It();de();TE={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
401
+ a-z character range
402
+ [:alnum:] all letters and digits
403
+ [:alpha:] all letters
404
+ [:digit:] all digits
405
+ [:lower:] all lowercase letters
406
+ [:upper:] all uppercase letters
407
+ [:space:] all whitespace
408
+ [:blank:] horizontal whitespace
409
+ [:punct:] all punctuation
410
+ [:print:] all printable characters
411
+ [:graph:] all printable characters except space
412
+ [:cntrl:] all control characters
413
+ [:xdigit:] all hexadecimal digits
414
+ \\n, \\t, \\r escape sequences`},RE=new Map([["[:alnum:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],["[:alpha:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"],["[:blank:]"," "],["[:cntrl:]",Array.from({length:32},(e,t)=>String.fromCharCode(t)).join("").concat("\x7F")],["[:digit:]","0123456789"],["[:graph:]",Array.from({length:94},(e,t)=>String.fromCharCode(33+t)).join("")],["[:lower:]","abcdefghijklmnopqrstuvwxyz"],["[:print:]",Array.from({length:95},(e,t)=>String.fromCharCode(32+t)).join("")],["[:punct:]","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"],["[:space:]",`
415
+ \r\f\v`],["[:upper:]","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["[:xdigit:]","0123456789ABCDEFabcdef"]]);$E={complement:{short:"c",long:"complement",type:"boolean"},complementUpper:{short:"C",type:"boolean"},delete:{short:"d",long:"delete",type:"boolean"},squeeze:{short:"s",long:"squeeze-repeats",type:"boolean"}},PE={name:"tr",async execute(e,t){if(q(e))return G(TE);let n=Le("tr",e,$E);if(!n.ok)return n.error;let r=n.result.flags.complement||n.result.flags.complementUpper,s=n.result.flags.delete,i=n.result.flags.squeeze,o=n.result.positional;if(o.length<1)return{stdout:"",stderr:`tr: missing operand
416
+ `,exitCode:1};if(!s&&!i&&o.length<2)return{stdout:"",stderr:`tr: missing operand after SET1
417
+ `,exitCode:1};let a,l,c=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),u=t.limits.maxLoopIterations,f=t.limits.maxArrayElements,d=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength);try{let x={iterations:0};a=x0(o[0],c,u,x),l=o.length>1?x0(o[1],c,u,x):""}catch(x){return he(x),{stdout:"",stderr:`${Ye(x.message)}
418
+ `,exitCode:1}}if(t.stdin.length>c)throw new C(`tr: input size limit exceeded (${c} bytes)`,"string_length");let p=ue(t.stdin);if(a.length>f||l.length>f)throw new C(`tr: array element limit exceeded (${f})`,"array_elements");let h=new Set(a),m=new Set(l),g=x=>{let S=h.has(x);return r?!S:S},b="",w=0,y=x=>{let S=U(x);if(S>d-w)throw new C(`tr: output size limit exceeded (${d} bytes)`,"output_size");b+=x,w+=S};if(s)for(let x of p)g(x)||y(x);else if(i&&o.length===1){let x="";for(let S of p)g(S)&&S===x||(y(S),x=S)}else{let x="",S=E=>{i&&m.has(E)&&E===x||(y(E),x=E)};if(r){let E=l.length>0?l[l.length-1]:"";for(let A of p)h.has(A)?S(A):S(E)}else{let E=new Map;for(let A=0;A<a.length;A++){let I=A<l.length?l[A]:l[l.length-1];E.set(a[A],I)}for(let A of p)S(E.get(A)??A)}}return{stdout:b,stderr:"",exitCode:0}}},DE={name:"tr",flags:[{flag:"-c",type:"boolean"},{flag:"-C",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-s",type:"boolean"}],stdinType:"text",needsArgs:!0}});var A0={};ae(A0,{flagsForFuzzing:()=>_E,rev:()=>ME});function FE(e){return Array.from(e).reverse().join("")}var LE,ME,_E,C0=M(()=>{"use strict";ce();de();LE={name:"rev",summary:"reverse lines characterwise",usage:"rev [file ...]",description:"Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.",examples:["echo 'hello' | rev # Output: olleh","rev file.txt # Reverse each line in file"]};ME={name:"rev",execute:async(e,t)=>{if(q(e))return G(LE);let n=[];for(let i of e)if(i==="--"){let o=e.indexOf(i);n.push(...e.slice(o+1));break}else{if(i.startsWith("-")&&i!=="-")return re("rev",i);n.push(i)}let r="",s=i=>{let o=i.split(`
419
+ `),a=i.endsWith(`
420
+ `)&&o[o.length-1]==="";return a&&o.pop(),o.map(FE).join(`
421
+ `)+(a?`
422
+ `:"")};if(n.length===0){let i=ue(t.stdin)??"";r=s(i)}else for(let i of n)if(i==="-"){let o=ue(t.stdin)??"";r+=s(o)}else{let o=t.fs.resolvePath(t.cwd,i),a=await t.fs.readFile(o);if(a===null)return{exitCode:1,stdout:r,stderr:`rev: ${i}: No such file or directory
423
+ `};r+=s(a)}return{exitCode:0,stdout:r,stderr:""}}},_E={name:"rev",flags:[],stdinType:"text",needsFiles:!0}});var k0={};ae(k0,{flagsForFuzzing:()=>jE,nl:()=>WE});function UE(e,t,n){let r=String(e);switch(t){case"ln":return r.padEnd(n);case"rn":return r.padStart(n);case"rz":return r.padStart(n,"0");default:return t}}function zE(e,t){switch(t){case"a":return!0;case"t":return e.trim().length>0;case"n":return!1;default:return t}}function v0(e,t,n,r){if(e==="")return{output:"",nextNumber:n};let s=e.split(`
424
+ `),i=[],o=0,a=n,l=e.endsWith(`
425
+ `)&&s[s.length-1]==="";l&&s.pop();for(let c of s){let u=i.length>0?1:0,f=U(t.separator)+U(c);if(zE(c,t.bodyStyle)){let d=Math.max(String(a).length,t.width)+f+u;if(d>r-o)throw new C(`nl: output size limit exceeded (${r} bytes)`,"output_size");let h=`${UE(a,t.numberFormat,t.width)}${t.separator}${c}`;i.push(h),o+=d,a+=t.increment}else{let d=t.width+f+u;if(d>r-o)throw new C(`nl: output size limit exceeded (${r} bytes)`,"output_size");let h=`${" ".repeat(t.width)}${t.separator}${c}`;i.push(h),o+=d}}if(l&&o+1>r)throw new C(`nl: output size limit exceeded (${r} bytes)`,"output_size");return{output:i.join(`
426
+ `)+(l?`
427
+ `:""),nextNumber:a}}var BE,WE,jE,N0=M(()=>{"use strict";ce();Z();de();BE={name:"nl",summary:"number lines of files",usage:"nl [OPTION]... [FILE]...",description:"Write each FILE to standard output, with line numbers added. If no FILE is specified, standard input is read.",options:["-b STYLE Body numbering style: a (all), t (non-empty), n (none)","-n FORMAT Number format: ln (left), rn (right), rz (right zeros)","-w WIDTH Number width (default: 6)","-s SEP Separator after number (default: TAB)","-v START Starting line number (default: 1)","-i INCR Line number increment (default: 1)"],examples:["nl file.txt # Number non-empty lines","nl -ba file.txt # Number all lines","nl -n rz -w 3 file.txt # Right-justified with zeros","nl -s ': ' file.txt # Use ': ' as separator"]};WE={name:"nl",execute:async(e,t)=>{if(q(e))return G(BE);let n={bodyStyle:"t",numberFormat:"rn",width:6,separator:" ",startNumber:1,increment:1},r=[],s=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),i=s,o=0;for(;o<e.length;){let c=e[o];if(c==="-b"&&o+1<e.length){let u=e[o+1];if(u!=="a"&&u!=="t"&&u!=="n")return{exitCode:1,stdout:"",stderr:`nl: invalid body numbering style: '${u}'
428
+ `};n.bodyStyle=u,o+=2}else if(c.startsWith("-b")){let u=c.slice(2);if(u!=="a"&&u!=="t"&&u!=="n")return{exitCode:1,stdout:"",stderr:`nl: invalid body numbering style: '${u}'
429
+ `};n.bodyStyle=u,o++}else if(c==="-n"&&o+1<e.length){let u=e[o+1];if(u!=="ln"&&u!=="rn"&&u!=="rz")return{exitCode:1,stdout:"",stderr:`nl: invalid line numbering format: '${u}'
430
+ `};n.numberFormat=u,o+=2}else if(c.startsWith("-n")){let u=c.slice(2);if(u!=="ln"&&u!=="rn"&&u!=="rz")return{exitCode:1,stdout:"",stderr:`nl: invalid line numbering format: '${u}'
431
+ `};n.numberFormat=u,o++}else if(c==="-w"&&o+1<e.length){let u=/^\d+$/.test(e[o+1])?Number(e[o+1]):NaN;if(!Number.isSafeInteger(u)||u<1||u>s)return{exitCode:1,stdout:"",stderr:`nl: invalid line number field width: '${e[o+1]}'
432
+ `};n.width=u,o+=2}else if(c.startsWith("-w")){let u=/^\d+$/.test(c.slice(2))?Number(c.slice(2)):NaN;if(!Number.isSafeInteger(u)||u<1||u>s)return{exitCode:1,stdout:"",stderr:`nl: invalid line number field width: '${c.slice(2)}'
433
+ `};n.width=u,o++}else if(c==="-s"&&o+1<e.length)n.separator=e[o+1],o+=2;else if(c.startsWith("-s"))n.separator=c.slice(2),o++;else if(c==="-v"&&o+1<e.length){let u=parseInt(e[o+1],10);if(Number.isNaN(u))return{exitCode:1,stdout:"",stderr:`nl: invalid starting line number: '${e[o+1]}'
434
+ `};n.startNumber=u,o+=2}else if(c.startsWith("-v")){let u=parseInt(c.slice(2),10);if(Number.isNaN(u))return{exitCode:1,stdout:"",stderr:`nl: invalid starting line number: '${c.slice(2)}'
435
+ `};n.startNumber=u,o++}else if(c==="-i"&&o+1<e.length){let u=parseInt(e[o+1],10);if(Number.isNaN(u))return{exitCode:1,stdout:"",stderr:`nl: invalid line number increment: '${e[o+1]}'
436
+ `};n.increment=u,o+=2}else if(c.startsWith("-i")){let u=parseInt(c.slice(2),10);if(Number.isNaN(u))return{exitCode:1,stdout:"",stderr:`nl: invalid line number increment: '${c.slice(2)}'
437
+ `};n.increment=u,o++}else if(c==="--"){r.push(...e.slice(o+1));break}else{if(c.startsWith("-")&&c!=="-")return re("nl",c);r.push(c),o++}}let a="",l=n.startNumber;if(r.length===0){let c=ue(t.stdin)??"";a=v0(c,n,l,i).output}else for(let c of r){let u=t.fs.resolvePath(t.cwd,c),f=await t.fs.readFile(u);if(f===null)return{exitCode:1,stdout:a,stderr:`nl: ${c}: No such file or directory
438
+ `};let d=v0(f,n,l,i-U(a));a+=d.output,l=d.nextNumber}return{exitCode:0,stdout:a,stderr:""}}},jE={name:"nl",flags:[{flag:"-b",type:"value",valueHint:"string"},{flag:"-n",type:"value",valueHint:"string"},{flag:"-w",type:"value",valueHint:"number"},{flag:"-s",type:"value",valueHint:"string"},{flag:"-v",type:"value",valueHint:"number"},{flag:"-i",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var O0={};ae(O0,{flagsForFuzzing:()=>ZE,fold:()=>qE});function VE(e,t,n){return n?U(e):e===" "?8-t%8:e==="\b"?-1:1}function GE(e,t){if(e.length===0)return e;let{width:n,breakAtSpaces:r,countBytes:s}=t,i=[],o="",a=0,l=-1,c=0;for(let u of e){let f=VE(u,a,s);a+f>n&&o.length>0?r&&l>=0?(i.push(o.slice(0,l+1)),o=o.slice(l+1)+u,a=a-c-1+f,l=-1,c=0):(i.push(o),o=u,a=f,l=-1,c=0):(o+=u,a+=f,(u===" "||u===" ")&&(l=o.length-1,c=a-f))}return o.length>0&&i.push(o),i.join(`
439
+ `)}function I0(e,t){if(e==="")return"";let n=e.split(`
440
+ `),r=e.endsWith(`
441
+ `)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>GE(i,t)).join(`
442
+ `)+(r?`
443
+ `:"")}var HE,qE,ZE,T0=M(()=>{"use strict";ce();de();HE={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]};qE={name:"fold",execute:async(e,t)=>{if(q(e))return G(HE);let n={width:80,breakAtSpaces:!1,countBytes:!1},r=[],s=0;for(;s<e.length;){let o=e[s];if(o==="-w"&&s+1<e.length){let a=parseInt(e[s+1],10);if(Number.isNaN(a)||a<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e[s+1]}'
444
+ `};n.width=a,s+=2}else if(o.startsWith("-w")&&o.length>2){let a=parseInt(o.slice(2),10);if(Number.isNaN(a)||a<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${o.slice(2)}'
445
+ `};n.width=a,s++}else if(o==="-s")n.breakAtSpaces=!0,s++;else if(o==="-b")n.countBytes=!0,s++;else if(o==="-bs"||o==="-sb")n.breakAtSpaces=!0,n.countBytes=!0,s++;else if(o.match(/^-[sb]+w\d+$/)){o.includes("s")&&(n.breakAtSpaces=!0),o.includes("b")&&(n.countBytes=!0);let a=o.replace(/^-[sb]+w/,""),l=parseInt(a,10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${a}'
446
+ `};n.width=l,s++}else if(o.match(/^-[sb]+w$/)&&s+1<e.length){o.includes("s")&&(n.breakAtSpaces=!0),o.includes("b")&&(n.countBytes=!0);let a=parseInt(e[s+1],10);if(Number.isNaN(a)||a<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e[s+1]}'
447
+ `};n.width=a,s+=2}else if(o==="--"){r.push(...e.slice(s+1));break}else if(o.startsWith("-")&&o!=="-"){let a=o.slice(1),l=!1;for(let c of a)if(c==="s")n.breakAtSpaces=!0;else if(c==="b")n.countBytes=!0;else{l=!0;break}if(l)return re("fold",o);s++}else r.push(o),s++}let i="";if(r.length===0){let o=ue(t.stdin)??"";i=I0(o,n)}else for(let o of r){let a=t.fs.resolvePath(t.cwd,o),l=await t.fs.readFile(a);if(l===null)return{exitCode:1,stdout:i,stderr:`fold: ${o}: No such file or directory
448
+ `};i+=I0(l,n)}return{exitCode:0,stdout:i,stderr:""}}},ZE={name:"fold",flags:[{flag:"-w",type:"value",valueHint:"number"},{flag:"-s",type:"boolean"},{flag:"-b",type:"boolean"}],stdinType:"text",needsFiles:!0}});var $0={};ae($0,{expand:()=>YE,flagsForFuzzing:()=>JE});function Fa(e,t,n){let r=e.split(",").map(i=>i.trim());if(r.length>n)return null;let s=[];for(let i of r){let o=/^\d+$/.test(i)?Number(i):NaN;if(!Number.isSafeInteger(o)||o<1||o>t)return null;s.push(o)}for(let i=1;i<s.length;i++)if(s[i]<=s[i-1])return null;return s}function QE(e,t){if(t.length===1){let n=t[0];return n-e%n}for(let n of t)if(n>e)return n-e;if(t.length>=2){let n=t[t.length-1]-t[t.length-2],r=t[t.length-1],s=Math.floor((e-r)/n)+1;return r+s*n-e}return 1}function XE(e,t,n){let{tabStops:r,leadingOnly:s}=t,i="",o=0,a=!0,l=0;for(let c of e)if(c===" ")if(s&&!a){if(l+1>n)throw new C(`expand: output size limit exceeded (${n} bytes)`,"output_size");i+=c,l++,o++}else{let u=QE(o,r);if(u>n-l)throw new C(`expand: output size limit exceeded (${n} bytes)`,"output_size");i+=" ".repeat(u),l+=u,o+=u}else{c!==" "&&c!==" "&&(a=!1);let u=U(c);if(u>n-l)throw new C(`expand: output size limit exceeded (${n} bytes)`,"output_size");i+=c,l+=u,o++}return i}function R0(e,t,n){if(e==="")return"";let r=e.split(`
449
+ `),s=e.endsWith(`
450
+ `)&&r[r.length-1]==="";s&&r.pop();let i=[],o=0;for(let a of r){let l=i.length>0?1:0,c=XE(a,t,n-o-l);o+=l+U(c),i.push(c)}if(s&&o+1>n)throw new C(`expand: output size limit exceeded (${n} bytes)`,"output_size");return i.join(`
451
+ `)+(s?`
452
+ `:"")}var KE,YE,JE,P0=M(()=>{"use strict";ce();Z();de();St();KE={name:"expand",summary:"convert tabs to spaces",usage:"expand [OPTION]... [FILE]...",description:"Convert TABs in each FILE to spaces, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-i Only convert leading tabs on each line"],examples:["expand file.txt # Convert all tabs to 8 spaces","expand -t 4 file.txt # Use 4-space tabs","expand -t 4,8,12 file.txt # Custom tab stops"]};YE={name:"expand",execute:async(e,t)=>{if(q(e))return G(KE);let n={tabStops:[8],leadingOnly:!1},r=[],s=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),i=t.limits.maxArrayElements,o=0;for(;o<e.length;){let l=e[o];if(l==="-t"&&o+1<e.length){let c=Fa(e[o+1],s,i);if(!c)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${e[o+1]}'
453
+ `};n.tabStops=c,o+=2}else if(l.startsWith("-t")&&l.length>2){let c=Fa(l.slice(2),s,i);if(!c)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${l.slice(2)}'
454
+ `};n.tabStops=c,o++}else if(l==="--tabs"&&o+1<e.length){let c=Fa(e[o+1],s,i);if(!c)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${e[o+1]}'
455
+ `};n.tabStops=c,o+=2}else if(l.startsWith("--tabs=")){let c=Fa(l.slice(7),s,i);if(!c)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${l.slice(7)}'
456
+ `};n.tabStops=c,o++}else if(l==="-i"||l==="--initial")n.leadingOnly=!0,o++;else if(l==="--"){r.push(...e.slice(o+1));break}else{if(l.startsWith("-")&&l!=="-")return re("expand",l);r.push(l),o++}}let a="";if(r.length===0){let l=ue(t.stdin)??"";a=R0(l,n,s)}else for(let l of r){let c=t.fs.resolvePath(t.cwd,l),u=await t.fs.readFile(c);if(u===null)return{exitCode:1,stdout:a,stderr:`expand: ${l}: No such file or directory
457
+ `};a+=R0(u,n,s-U(a))}return{exitCode:0,stdout:a,stderr:""}}},JE={name:"expand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}});var F0={};ae(F0,{flagsForFuzzing:()=>r5,unexpand:()=>n5});function Ma(e){let t=e.split(",").map(r=>r.trim()),n=[];for(let r of t){let s=parseInt(r,10);if(Number.isNaN(s)||s<1)return null;n.push(s)}for(let r=1;r<n.length;r++)if(n[r]<=n[r-1])return null;return n}function D0(e,t){if(t.length===1){let n=t[0];return e+(n-e%n)}for(let n of t)if(n>e)return n;if(t.length>=2){let n=t[t.length-1]-t[t.length-2],r=t[t.length-1],s=Math.floor((e-r)/n)+1;return r+s*n}return-1}function t5(e,t){let{tabStops:n,allBlanks:r}=t,s="",i=0,o="",a=0,l=!0,c=()=>{if(o.length===0)return;let u=a+o.length;if(!r&&!l){s+=o,o="";return}let f=a,d="";for(;f<u;){let h=D0(f,n);if(h<=u&&h>f)d+=" ",f=h;else break}let p=u-f;p>0&&(d+=" ".repeat(p)),s+=d,o=""};for(let u of e)u===" "?(o.length===0&&(a=i),o+=u,i++):u===" "?(c(),s+=u,i=D0(i,n)):(c(),s+=u,i++,l=!1);return c(),s}function L0(e,t){if(e==="")return"";let n=e.split(`
458
+ `),r=e.endsWith(`
459
+ `)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>t5(i,t)).join(`
460
+ `)+(r?`
461
+ `:"")}var e5,n5,r5,M0=M(()=>{"use strict";ce();de();e5={name:"unexpand",summary:"convert spaces to tabs",usage:"unexpand [OPTION]... [FILE]...",description:"Convert blanks in each FILE to TABs, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-a Convert all sequences of blanks (not just leading)"],examples:["unexpand file.txt # Convert leading spaces to tabs","unexpand -a file.txt # Convert all space sequences","unexpand -t 4 file.txt # Use 4-space tabs"]};n5={name:"unexpand",execute:async(e,t)=>{if(q(e))return G(e5);let n={tabStops:[8],allBlanks:!1},r=[],s=0;for(;s<e.length;){let o=e[s];if(o==="-t"&&s+1<e.length){let a=Ma(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${e[s+1]}'
462
+ `};n.tabStops=a,s+=2}else if(o.startsWith("-t")&&o.length>2){let a=Ma(o.slice(2));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${o.slice(2)}'
463
+ `};n.tabStops=a,s++}else if(o==="--tabs"&&s+1<e.length){let a=Ma(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${e[s+1]}'
464
+ `};n.tabStops=a,s+=2}else if(o.startsWith("--tabs=")){let a=Ma(o.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${o.slice(7)}'
465
+ `};n.tabStops=a,s++}else if(o==="-a"||o==="--all")n.allBlanks=!0,s++;else if(o==="--"){r.push(...e.slice(s+1));break}else{if(o.startsWith("-")&&o!=="-")return re("unexpand",o);r.push(o),s++}}let i="";if(r.length===0){let o=ue(t.stdin)??"";i=L0(o,n)}else for(let o of r){let a=t.fs.resolvePath(t.cwd,o),l=await t.fs.readFile(a);if(l===null)return{exitCode:1,stdout:i,stderr:`unexpand: ${o}: No such file or directory
466
+ `};i+=L0(l,n)}return{exitCode:0,stdout:i,stderr:""}}},r5={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0}});var U0={};ae(U0,{flagsForFuzzing:()=>a5,strings:()=>o5});function i5(e){return e>=32&&e<=126||e===9}function _0(e,t){if(t===null)return"";switch(t){case"o":return`${e.toString(8).padStart(7," ")} `;case"x":return`${e.toString(16).padStart(7," ")} `;case"d":return`${e.toString(10).padStart(7," ")} `;default:return t}}function B0(e,t,n,r=!1,s){let i=[],o=0,a=0,l=typeof e=="string"&&!r?new TextEncoder().encode(e):e;if(l.length>n.maxStringLength-n.inputBytes)throw new C(`strings: aggregate input size limit exceeded (${n.maxStringLength} bytes)`,"string_length");n.inputBytes+=l.length;let c=new TextDecoder,u=(d,p)=>typeof l=="string"?l.slice(d,p):c.decode(l.subarray(d,p)),f=d=>{if(++n.iterations>n.maxIterations)throw new C(`strings: iteration limit exceeded (${n.maxIterations})`,"iterations");if(n.resultCount>=n.maxArrayElements)throw new C(`strings: array element limit exceeded (${n.maxArrayElements})`,"array_elements");let p=d.length+1;if(p>n.maxOutputSize-n.outputBytes)throw new C(`strings: output size limit exceeded (${n.maxOutputSize} bytes)`,"output_size");i.push(d),n.resultCount++,n.outputBytes+=p};for(let d=0;d<l.length;d++){if((d&4095)===0&&s?.aborted)throw new Ge;let p=typeof l=="string"?l.charCodeAt(d)&255:l[d];if(i5(p)){if(o===0&&(a=d),o>=n.maxStringLength)throw new C(`strings: string length limit exceeded (${n.maxStringLength} bytes)`,"string_length");o++}else{if(o>=t.minLength){let h=_0(a,t.offsetFormat);f(`${h}${u(a,d)}`)}o=0}}if(o>=t.minLength){let d=_0(a,t.offsetFormat);f(`${d}${u(a,l.length)}`)}return i}var s5,o5,a5,z0=M(()=>{"use strict";Z();de();s5={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};o5={name:"strings",execute:async(e,t)=>{if(q(e))return G(s5);let n={minLength:4,offsetFormat:null},r=[],s=0;for(;s<e.length;){let l=e[s];if(l==="-n"&&s+1<e.length){let c=Number.parseInt(e[s+1],10);if(Number.isNaN(c)||c<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e[s+1]}'
467
+ `};n.minLength=c,s+=2}else if(l.match(/^-n\d+$/)){let c=Number.parseInt(l.slice(2),10);if(Number.isNaN(c)||c<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${l.slice(2)}'
468
+ `};n.minLength=c,s++}else if(l.match(/^-\d+$/)){let c=Number.parseInt(l.slice(1),10);if(Number.isNaN(c)||c<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${l.slice(1)}'
469
+ `};n.minLength=c,s++}else if(l==="-t"&&s+1<e.length){let c=e[s+1];if(c!=="o"&&c!=="x"&&c!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${c}'
470
+ `};n.offsetFormat=c,s+=2}else if(l.startsWith("-t")&&l.length===3){let c=l[2];if(c!=="o"&&c!=="x"&&c!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${c}'
471
+ `};n.offsetFormat=c,s++}else if(l==="-a"||l==="--all"||l==="-")l==="-"&&r.push(l),s++;else if(l==="-e"&&s+1<e.length){let c=e[s+1];if(c!=="s"&&c!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${c}'
472
+ `};s+=2}else if(l.startsWith("-e")&&l.length===3){let c=l[2];if(c!=="s"&&c!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${c}'
473
+ `};s++}else if(l==="--"){r.push(...e.slice(s+1));break}else{if(l.startsWith("-")&&l!=="-")return re("strings",l);r.push(l),s++}}let i="",o={maxArrayElements:t.limits.maxArrayElements,maxIterations:t.limits.maxLoopIterations,maxStringLength:Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),maxOutputSize:Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),iterations:0,inputBytes:0,resultCount:0,outputBytes:0},a=()=>t.stdin;if(r.length===0){let l=B0(a(),n,o,!0,t.signal);i=l.length>0?`${l.join(`
474
+ `)}
475
+ `:""}else for(let l of r){let c;if(l==="-")c=a();else{let f=t.fs.resolvePath(t.cwd,l);try{c=await t.fs.readFileBuffer(f)}catch{return{exitCode:1,stdout:i,stderr:`strings: ${l}: No such file or directory
476
+ `}}}let u=B0(c,n,o,typeof c=="string",t.signal);u.length>0&&(i+=`${u.join(`
477
+ `)}
478
+ `)}return{exitCode:0,stdout:i,stderr:""}}},a5={name:"strings",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-a",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsFiles:!0}});var H0={};ae(H0,{flagsForFuzzing:()=>w5,split:()=>y5});function u5(e){return Uint8Array.from(e,t=>t.charCodeAt(0))}function W0(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=(t[2]||"").toUpperCase(),i=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(r);return i===void 0||n>Math.floor(Number.MAX_SAFE_INTEGER/i)?null:n*i}function wi(e){if(!/^[0-9]+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}function f5(e,t,n){if(t)return e.toString().padStart(n,"0");let r="abcdefghijklmnopqrstuvwxyz",s=new Array(n),i=e;for(let o=n-1;o>=0;o--)s[o]=r[i%26],i=Math.floor(i/26);return s.join("")}function d5(e,t){let n=[],r=0,s=0;for(let i=0;i<e.length;i++)e[i]===10&&(s++,s===t&&(n.push(e.subarray(r,i+1)),r=i+1,s=0));return r<e.length&&n.push(e.subarray(r)),n}function p5(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.subarray(r,r+t));return n}function h5(e,t){let n=[],r=Math.ceil(e.length/t);for(let s=0;s<t;s++){let i=s*r,o=Math.min(i+r,e.length);i<o&&n.push(e.subarray(i,o))}return n}function m5(e,t){let n=e?10**t:26**t;return Number.isSafeInteger(n)?n:Number.MAX_SAFE_INTEGER}function g5(e){if(e.existence!=="unknown")return e.existence==="existing"?e.stableIdentity:e.canonicalPath===void 0?void 0:`missing:${e.canonicalPath}`}function Mu(e,t){return e.existence!==t.existence||e.existence==="unknown"||t.existence==="unknown"?!1:e.existence==="missing"&&t.existence==="missing"?e.canonicalPath===t.canonicalPath:e.existence==="existing"&&t.existence==="existing"?e.stableIdentity!==void 0&&e.stableIdentity===t.stableIdentity:!1}async function j0(e,t,n){let r=t.lastIndexOf("/"),s=r<=0?"/":t.slice(0,r),i=t.slice(r+1);for(let o=0;o<100;o++){let a=c5++,l=e.fs.resolvePath(s,`.${i}.just-bash-split-${n}-${a}`),c=await nr(e.fs,l);if(c.existence==="missing")return l;if(c.existence==="unknown")break}throw new Error("unable to allocate transaction path")}var l5,_a,c5,y5,w5,V0=M(()=>{"use strict";ce();Nt();Bn();Z();de();l5={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},_a=1e5,c5=0;y5={name:"split",execute:async(e,t)=>{if(q(e))return G(l5);let n={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},r=[],s=0;for(;s<e.length;){let u=e[s];if(u==="-l"&&s+1<e.length){let f=wi(e[s+1]);if(f===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[s+1]}'
479
+ `};n.mode="lines",n.lines=f,s+=2}else if(u.match(/^-l\d+$/)){let f=wi(u.slice(2));if(f===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${u.slice(2)}'
480
+ `};n.mode="lines",n.lines=f,s++}else if(u==="-b"&&s+1<e.length){let f=W0(e[s+1]);if(f===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${e[s+1]}'
481
+ `};n.mode="bytes",n.bytes=f,s+=2}else if(u.match(/^-b.+$/)){let f=W0(u.slice(2));if(f===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${u.slice(2)}'
482
+ `};n.mode="bytes",n.bytes=f,s++}else if(u==="-n"&&s+1<e.length){let f=wi(e[s+1]);if(f===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${e[s+1]}'
483
+ `};n.mode="chunks",n.chunks=f,s+=2}else if(u.match(/^-n\d+$/)){let f=wi(u.slice(2));if(f===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${u.slice(2)}'
484
+ `};n.mode="chunks",n.chunks=f,s++}else if(u==="-a"&&s+1<e.length){let f=wi(e[s+1]);if(f===null||f>Math.min(t.limits.maxStringLength,t.limits.maxArrayElements))return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${e[s+1]}'
485
+ `};n.suffixLength=f,s+=2}else if(u.match(/^-a\d+$/)){let f=wi(u.slice(2));if(f===null||f>Math.min(t.limits.maxStringLength,t.limits.maxArrayElements))return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${u.slice(2)}'
486
+ `};n.suffixLength=f,s++}else if(u==="-d"||u==="--numeric-suffixes")n.useNumericSuffix=!0,s++;else if(u.startsWith("--additional-suffix="))n.additionalSuffix=u.slice(20),s++;else if(u==="--additional-suffix"&&s+1<e.length)n.additionalSuffix=e[s+1],s+=2;else if(u==="--"){r.push(...e.slice(s+1));break}else{if(u.startsWith("-")&&u!=="-")return re("split",u);r.push(u),s++}}let i="-",o="x";if(r.length>=1&&(i=r[0]),r.length>=2&&(o=r[1]),r.length>2)return{exitCode:1,stdout:"",stderr:`split: extra operand '${r[2]}'
487
+ `};if(U(o)>t.limits.maxStringLength||U(n.additionalSuffix)>t.limits.maxStringLength||n.suffixLength>t.limits.maxStringLength-Math.min(t.limits.maxStringLength,U(o))-Math.min(t.limits.maxStringLength,U(n.additionalSuffix)))return{exitCode:1,stdout:"",stderr:`split: output filename exceeds configured string limit
488
+ `};let a,l=null,c;if(i==="-"){let u=t.stdin.length;c=t.executionScope?.reserveBytes("split transaction",u*2,"split"),a=u5(t.stdin)}else{l=t.fs.resolvePath(t.cwd,i);try{let u=await t.fs.stat(l);if(c=t.executionScope?.reserveBytes("split transaction",u.size*2,"split"),a=await t.fs.readFileBuffer(l),a.byteLength>u.size)throw new C("split: input grew while being read","string_length");t.executionScope?.consumeInput(a.byteLength,"split")}catch(u){return c?.release(),he(u),{exitCode:1,stdout:"",stderr:`split: ${i}: No such file or directory
489
+ `}}}try{if(a.length===0)return{exitCode:0,stdout:"",stderr:""};if(n.mode==="chunks"&&n.chunks>_a)return{exitCode:1,stdout:"",stderr:`split: too many output files (${n.chunks}), limit is ${_a}
490
+ `};let u;switch(n.mode){case"lines":u=d5(a,n.lines);break;case"bytes":u=p5(a,n.bytes);break;case"chunks":u=h5(a,n.chunks);break;default:return n.mode}if(u.length>_a)return{exitCode:1,stdout:"",stderr:`split: too many output files (${u.length}), limit is ${_a}
491
+ `};let f=m5(n.useNumericSuffix,n.suffixLength);if(u.length>f)return{exitCode:1,stdout:"",stderr:`split: output file suffixes exhausted at ${f} files
492
+ `};t.executionScope?.consumeWork(u.length*n.suffixLength,"split suffix generation");let d=[],p=new Set,h=l?await nr(t.fs,l):null;if(h?.existence==="unknown")return{exitCode:1,stdout:"",stderr:`split: cannot safely identify input file
493
+ `};for(let m=0;m<u.length;m++){let g=f5(m,n.useNumericSuffix,n.suffixLength),b=`${o}${g}${n.additionalSuffix}`,w=t.fs.resolvePath(t.cwd,b),y=await nr(t.fs,w),x=g5(y);if(y.existence==="unknown"||x===void 0)return{exitCode:1,stdout:"",stderr:`split: cannot safely identify output file '${b}'
494
+ `};if(x!==void 0&&p.has(x))return{exitCode:1,stdout:"",stderr:`split: duplicate output file '${b}'
495
+ `};if(h!==null&&(h.existence==="existing"&&y.existence==="existing"&&h.stableIdentity!==void 0&&h.stableIdentity===y.stableIdentity||h.canonicalPath!==void 0&&h.canonicalPath===y.canonicalPath))return{exitCode:1,stdout:"",stderr:`split: output file '${b}' would overwrite input
496
+ `};x!==void 0&&p.add(x),d.push({path:w,displayName:b,content:u[m],initialIdentity:y,stagePath:"",committed:!1})}try{for(let m of d)m.stagePath=await j0(t,m.path,"stage"),await t.fs.writeFile(m.stagePath,m.content);if(l!==null&&h!==null&&!Mu(h,await nr(t.fs,l)))throw new Error("input identity changed during split");for(let m of d){let g=await nr(t.fs,m.path);if(!Mu(m.initialIdentity,g))throw new Error("output identity changed during split");if(h?.existence==="existing"&&g.existence==="existing"&&h.stableIdentity===g.stableIdentity)throw new Error("output aliases input")}for(let m of d){if(!Mu(m.initialIdentity,await nr(t.fs,m.path)))throw new Error("output identity changed during split");m.initialIdentity.existence==="existing"&&(m.backupPath=await j0(t,m.path,"backup"),await t.fs.mv(m.path,m.backupPath)),await t.fs.mv(m.stagePath,m.path),m.committed=!0}for(let m of d)m.backupPath&&(await t.fs.rm(m.backupPath,{force:!0,recursive:!0}).catch(()=>{}),m.backupPath=void 0)}catch{for(let m of[...d].reverse())m.committed&&await t.fs.rm(m.path,{force:!0,recursive:!0}).catch(()=>{}),m.backupPath&&await t.fs.mv(m.backupPath,m.path).catch(()=>{}),m.stagePath&&await t.fs.rm(m.stagePath,{force:!0,recursive:!0}).catch(()=>{});return{exitCode:1,stdout:"",stderr:`split: failed to write output
497
+ `}}return{exitCode:0,stdout:"",stderr:""}}finally{c?.release()}}},w5={name:"split",flags:[{flag:"-l",type:"value",valueHint:"number"},{flag:"-b",type:"value",valueHint:"string"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-d",type:"boolean"},{flag:"-a",type:"value",valueHint:"number"}],needsFiles:!0}});var q0={};ae(q0,{column:()=>C5,flagsForFuzzing:()=>v5});function G0(e,t,n,r){return t?n?e.split(t,r):e.split(t,r).filter(s=>s.length>0):n?e.split(/[ \t]/,r):e.split(/[ \t]+/,r).filter(s=>s.length>0)}function E5(e){let t=[];for(let n of e)for(let r=0;r<n.length;r++){let s=n[r].length;(t[r]===void 0||s>t[r])&&(t[r]=s)}return t}function S5(e,t,n){if(e.length===0)return"";let r=E5(e),s=new Te(n,"column",void 0,1);for(let i=0;i<e.length;i++){let o=e[i];i>0&&s.append(`
498
+ `);for(let a=0;a<o.length;a++)a>0&&s.append(t),s.append(o[a]),a<o.length-1&&s.repeat(" ",r[a]-o[a].length)}return s.build()}function A5(e,t,n,r){if(e.length===0)return"";let s=0;for(let u of e)s=Math.max(s,u.length);let i=n.length,o=s+i,a=Math.max(1,Math.floor((t+i)/o)),l=Math.ceil(e.length/a),c=new Te(r,"column",void 0,1);for(let u=0;u<l;u++){u>0&&c.append(`
499
+ `);let f=!1;for(let d=0;d<a;d++){let p=d*l+u;p<e.length&&(d===a-1||(d+1)*l+u>=e.length?(f&&c.append(n),c.append(e[p])):(f&&c.append(n),c.append(e[p]),c.repeat(" ",s-e[p].length)),f=!0)}}return c.build()}var b5,x5,C5,v5,Z0=M(()=>{"use strict";At();ce();Z();It();de();b5={name:"column",summary:"columnate lists",usage:"column [OPTION]... [FILE]...",description:"Format input into multiple columns. By default, fills rows first. Use -t to create a table based on whitespace-delimited input.",options:["-t Create a table (determine columns from input)","-s SEP Input field delimiter (default: whitespace)","-o SEP Output field delimiter (default: two spaces)","-c WIDTH Output width for fill mode (default: 80)","-n Don't merge multiple adjacent delimiters"],examples:["ls | column # Fill columns with ls output","cat data | column -t # Format as table","column -t -s ',' file # Format CSV as table","column -c 40 file # Fill 40-char wide columns"]},x5={table:{short:"t",long:"table",type:"boolean"},separator:{short:"s",type:"string"},outputSep:{short:"o",type:"string"},width:{short:"c",type:"number",default:80},noMerge:{short:"n",type:"boolean"}};C5={name:"column",execute:async(e,t)=>{if(q(e))return G(b5);let n=Le("column",e,x5);if(!n.ok)return n.error;let{table:r,separator:s,outputSep:i,width:o,noMerge:a}=n.result.flags,l=n.result.positional,c=i??" ",u=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),f=t.limits.maxArrayElements,d=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize);if(!Number.isFinite(o)||!Number.isSafeInteger(o)||o<=0||o>10*1024*1024)return{exitCode:1,stdout:"",stderr:`column: invalid width: ${o}
500
+ `};let p;if(l.length===0)p=ue(t.stdin)??"";else{let w=[],y=0;for(let x of l)if(x==="-"){let S=ue(t.stdin)??"";if(y+=U(S),y>u)throw new C(`column: input size limit exceeded (${u} bytes)`,"string_length");w.push(S)}else{let S=t.fs.resolvePath(t.cwd,x),E=await t.fs.readFile(S);if(E===null)return{exitCode:1,stdout:"",stderr:`column: ${x}: No such file or directory
501
+ `};if(y+=U(E),y>u)throw new C(`column: input size limit exceeded (${u} bytes)`,"string_length");w.push(E)}p=w.join("")}if(U(p)>u)throw new C(`column: input size limit exceeded (${u} bytes)`,"string_length");if(p===""||p.trim()==="")return{exitCode:0,stdout:"",stderr:""};let h=p.split(`
502
+ `,f+1);if(h.length>f)throw new C(`column: field limit exceeded (${f})`,"array_elements");p.endsWith(`
503
+ `)&&h[h.length-1]===""&&h.pop();let g=h.filter(w=>w.trim().length>0),b;if(r){let w=[],y=0;for(let x of g){let S=f-y,E=G0(x,s,a,S+1);if(y+=E.length,y>f)throw new C(`column: field limit exceeded (${f})`,"array_elements");w.push(E)}b=S5(w,c,d)}else{let w=[];for(let y of g){let x=f-w.length,S=G0(y,s,a,x+1);if(S.length>x)throw new C(`column: field limit exceeded (${f})`,"array_elements");for(let E of S)w.push(E)}b=A5(w,o,c,d)}return b.length>0&&(b+=`
504
+ `),{exitCode:0,stdout:b,stderr:""}}},v5={name:"column",flags:[{flag:"-t",type:"boolean"},{flag:"-s",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-n",type:"boolean"}],stdinType:"text",needsFiles:!0}});var K0={};ae(K0,{flagsForFuzzing:()=>R5,join:()=>T5});function N5(e,t){return t?e.split(t):e.split(/[ \t]+/).filter(n=>n.length>0)}function I5(e,t,n,r){let s=N5(e,t),i=s[n-1]??"";return r&&(i=i.toLowerCase()),{fields:s,joinKey:i,original:e}}function _u(e,t,n){let r=n.separator??" ";if(n.outputFormat){let o=[];for(let{file:a,field:l}of n.outputFormat){let c=a===1?e:t;c&&l===0?o.push(c.joinKey):c&&c.fields[l-1]!==void 0?o.push(c.fields[l-1]):o.push(n.emptyString)}return o.join(r)}let s=[],i=e?.joinKey??t?.joinKey??"";if(s.push(i),e)for(let o=0;o<e.fields.length;o++)o!==n.field1-1&&s.push(e.fields[o]);if(t)for(let o=0;o<t.fields.length;o++)o!==n.field2-1&&s.push(t.fields[o]);return s.join(r)}function O5(e){let t=e.split(","),n=[];for(let r of t){let s=r.trim().match(/^(\d+)\.(\d+)$/);if(!s)return null;let i=Number.parseInt(s[1],10),o=Number.parseInt(s[2],10);if(i!==1&&i!==2)return null;n.push({file:i,field:o})}return n}var k5,T5,R5,Q0=M(()=>{"use strict";ce();Z();de();St();k5={name:"join",summary:"join lines of two files on a common field",usage:"join [OPTION]... FILE1 FILE2",description:"For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks.",options:["-1 FIELD Join on this FIELD of file 1 (default: 1)","-2 FIELD Join on this FIELD of file 2 (default: 1)","-t CHAR Use CHAR as input and output field separator","-a FILENUM Also print unpairable lines from file FILENUM (1 or 2)","-v FILENUM Like -a but only output unpairable lines","-e STRING Replace missing fields with STRING","-o FORMAT Output format (comma-separated list of FILENUM.FIELD)","-i Ignore case when comparing fields"],examples:["join file1 file2 # Join on first field","join -1 2 -2 1 file1 file2 # Join file1 col 2 with file2 col 1","join -t ',' file1.csv file2.csv # Join CSV files","join -a 1 file1 file2 # Left outer join"]};T5={name:"join",execute:async(e,t)=>{if(q(e))return G(k5);let n={field1:1,field2:1,separator:null,printUnpairable:new Set,onlyUnpairable:new Set,emptyString:"",outputFormat:null,ignoreCase:!1},r=[],s=0;for(;s<e.length;){let E=e[s];if(E==="-1"&&s+1<e.length){let A=Number.parseInt(e[s+1],10);if(Number.isNaN(A)||A<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${e[s+1]}'
505
+ `};n.field1=A,s+=2}else if(E==="-2"&&s+1<e.length){let A=Number.parseInt(e[s+1],10);if(Number.isNaN(A)||A<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${e[s+1]}'
506
+ `};n.field2=A,s+=2}else if((E==="-t"||E==="--field-separator")&&s+1<e.length)n.separator=e[s+1],s+=2;else if(E.startsWith("-t")&&E.length>2)n.separator=E.slice(2),s++;else if(E==="-a"&&s+1<e.length){let A=Number.parseInt(e[s+1],10);if(A!==1&&A!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${e[s+1]}'
507
+ `};n.printUnpairable.add(A),s+=2}else if(E.match(/^-a[12]$/))n.printUnpairable.add(Number.parseInt(E[2],10)),s++;else if(E==="-v"&&s+1<e.length){let A=Number.parseInt(e[s+1],10);if(A!==1&&A!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${e[s+1]}'
508
+ `};n.onlyUnpairable.add(A),s+=2}else if(E.match(/^-v[12]$/))n.onlyUnpairable.add(Number.parseInt(E[2],10)),s++;else if(E==="-e"&&s+1<e.length)n.emptyString=e[s+1],s+=2;else if(E==="-o"&&s+1<e.length){let A=O5(e[s+1]);if(!A)return{exitCode:1,stdout:"",stderr:`join: invalid field spec: '${e[s+1]}'
509
+ `};n.outputFormat=A,s+=2}else if(E==="-i"||E==="--ignore-case")n.ignoreCase=!0,s++;else if(E==="--"){r.push(...e.slice(s+1));break}else{if(E.startsWith("-")&&E!=="-")return re("join",E);r.push(E),s++}}if(r.length!==2)return{exitCode:1,stdout:"",stderr:r.length<2?`join: missing file operand
510
+ `:`join: extra operand
511
+ `};let i=[];for(let E of r)if(E==="-")i.push(ue(t.stdin)??"");else{let A=t.fs.resolvePath(t.cwd,E),I=await t.fs.readFile(A);if(I===null)return{exitCode:1,stdout:"",stderr:`join: ${E}: No such file or directory
512
+ `};i.push(I)}let o=t.limits.maxArrayElements,a=t.limits.maxLoopIterations,l=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),c=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength);if(i.reduce((E,A)=>E+U(A),0)>l)throw new C(`join: aggregate input size limit exceeded (${l} bytes)`,"string_length");let f=0,d=0,p=()=>{if(++d>a)throw new C(`join: iteration limit exceeded (${a})`,"iterations")},h=(E,A)=>{let I=E.length>0?1:0;for(let N=0;N<E.length;N++)E.charCodeAt(N)===10&&N+1<E.length&&I++;if(I>o-f)throw new C(`join: array element limit exceeded (${o})`,"array_elements");f+=I;let $=E.split(`
513
+ `);return E.endsWith(`
514
+ `)&&$[$.length-1]===""&&$.pop(),$.filter(N=>N.length>0).map(N=>I5(N,n.separator,A,n.ignoreCase))},m=h(i[0],n.field1),g=h(i[1],n.field2),b=new Map;for(let E of g){let A=b.get(E.joinKey);A?A.push(E):b.set(E.joinKey,[E])}let w=[],y=0,x=E=>{if(p(),w.length>=o)throw new C(`join: array element limit exceeded (${o})`,"array_elements");let A=U(E)+1;if(A>c-y)throw new C(`join: output size limit exceeded (${c} bytes)`,"output_size");w.push(E),y+=A},S=new Set;for(let E of m){let A=b.get(E.joinKey);if(A&&A.length>0){if(S.add(E.joinKey),n.onlyUnpairable.size===0)for(let I of A)x(_u(E,I,n))}else(n.printUnpairable.has(1)||n.onlyUnpairable.has(1))&&x(_u(E,null,n))}if(n.printUnpairable.has(2)||n.onlyUnpairable.has(2))for(let E of g)S.has(E.joinKey)||x(_u(null,E,n));return{exitCode:0,stdout:Ln(w.length>0?`${w.join(`
515
+ `)}
516
+ `:""),stderr:"",stdoutEncoding:"binary"}}},R5={name:"join",flags:[{flag:"-1",type:"value",valueHint:"number"},{flag:"-2",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-a",type:"value",valueHint:"number"},{flag:"-v",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"string"},{flag:"-o",type:"value",valueHint:"format"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}});var X0={};ae(X0,{flagsForFuzzing:()=>L5,teeCommand:()=>D5});var $5,P5,D5,L5,Y0=M(()=>{"use strict";ce();It();de();$5={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},P5={append:{short:"a",long:"append",type:"boolean"}},D5={name:"tee",async execute(e,t){if(q(e))return G($5);let n=Le("tee",e,P5);if(!n.ok)return n.error;let{append:r}=n.result.flags,s=n.result.positional,i=t.stdin,o="",a=0;for(let l of s)try{let c=t.fs.resolvePath(t.cwd,l);r?await t.fs.appendFile(c,i,"binary"):await t.fs.writeFile(c,i,"binary")}catch{o+=`tee: ${l}: No such file or directory
517
+ `,a=1}return{stdout:i,stderr:o,exitCode:a,stdoutEncoding:"binary"}}},L5={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0}});var yn,bi=M(()=>{"use strict";ce();Z();yn=class{scope;site;stdoutChunks=[];stderrChunks=[];stdoutBytes=0;stderrBytes=0;attachedErrors=new WeakSet;constructor(t,n){this.scope=t,this.site=n}append(t,n,r=0,s="text"){let i;try{i=this.scope.appendOutput(t,n,this.site,r,s)}catch(o){throw this.prependTo(o),o}n&&(t==="stdout"?this.stdoutChunks:this.stderrChunks).push(n),t==="stdout"?this.stdoutBytes+=i:this.stderrBytes+=i}prependTo(t){t instanceof ut&&(this.attachedErrors.has(t)||(this.attachedErrors.add(t),t.prependOutput(this.stdout,this.stderr)))}appendResult(t,n=t.stdout){let r=t.stdoutKind==="bytes"||t.stdoutEncoding==="binary"?"bytes":"text",s=r==="bytes"?n.length:U(n);this.append("stdout",n,Math.min(t.internalOutputAccounting?.stdout??0,s),r),this.append("stderr",t.stderr,t.internalOutputAccounting?.stderr??0)}build(t,n){return{stdout:this.stdoutChunks.join(""),stderr:this.stderrChunks.join(""),exitCode:t,...n,internalOutputAccounting:{stdout:this.stdoutBytes,stderr:this.stderrBytes}}}get stdout(){return this.stdoutChunks.join("")}get stderr(){return this.stderrChunks.join("")}}});function jn(e,t){switch(e.type){case"name":{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let s=r[1],i=t.name;if(e.ignoreCase){if(!i.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!i.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:sn(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,r=t.relativePath,s=n.split("/");for(let o=0;o<s.length-1;o++){let a=s[o];if(a&&a!=="."&&a!==".."&&!a.includes("*")&&!a.includes("?")&&!a.includes("[")){let l=`/${a}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(l.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(l))return{matches:!1,pruned:!1,printed:!1}}}let i=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(i){let o=i[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(o.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(o))return{matches:!1,pruned:!1,printed:!1}}return{matches:sn(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:ie(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let r=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=r>e.days:e.comparison==="less"?s=r<e.days:s=Math.floor(r)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let r;return e.comparison==="more"?r=t.size>n:e.comparison==="less"?r=t.size<n:e.unit==="b"?r=Math.ceil(t.size/512)===e.value:r=t.size===n,{matches:r,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,r=e.mode&511,s;return e.matchType==="exact"?s=n===r:e.matchType==="all"?s=(n&r)===r:s=(n&r)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"action":return{matches:!0,pruned:!1,printed:!1,actions:[e.action]};case"not":{let n=jn(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1,actions:n.actions}}case"and":{let n=jn(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1,actions:n.actions};let r=jn(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed,actions:[...n.actions??[],...r.actions??[]]}}case"or":{let n=jn(e.left,t);if(n.matches)return n;let r=jn(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed,actions:[...n.actions??[],...r.actions??[]]}}}}function po(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!1;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return po(e.expr);case"and":case"or":return po(e.left)||po(e.right)}}function ho(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return ho(e.expr);case"and":case"or":return ho(e.left)||ho(e.right);default:return!1}}function J0(e){let t=[],n=r=>{r&&(r.type==="newer"?t.push(r.refPath):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right)))};return n(e),t}function mo(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return mo(e.expr);case"and":case"or":return mo(e.left)&&mo(e.right)}}function Os(e,t,n,r,s){switch(e.type){case"name":{let i=e.pattern,o=i.match(/^\*(\.[a-zA-Z0-9]+)$/);if(o){let a=o[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:sn(t,i,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let i=e.pattern,o=i.split("/");for(let l=0;l<o.length-1;l++){let c=o[l];if(c&&c!=="."&&c!==".."&&!c.includes("*")&&!c.includes("?")&&!c.includes("[")){let u=`/${c}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(u.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(u))return{matches:!1,pruned:!1,printed:!1}}}let a=i.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let l=a[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(l.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(l))return{matches:!1,pruned:!1,printed:!1}}return{matches:sn(n,i,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let i=e.ignoreCase?"i":"";return{matches:ie(e.pattern,i).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:r,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"action":return{matches:!0,pruned:!1,printed:!1,actions:[e.action]};case"not":{let i=Os(e.expr,t,n,r,s);return{matches:!i.matches,pruned:i.pruned,printed:!1,actions:i.actions}}case"and":{let i=Os(e.left,t,n,r,s);if(!i.matches)return{matches:!1,pruned:i.pruned,printed:!1,actions:i.actions};let o=Os(e.right,t,n,r,s);return{matches:o.matches,pruned:i.pruned||o.pruned,printed:i.printed||o.printed,actions:[...i.actions??[],...o.actions??[]]}}case"or":{let i=Os(e.left,t,n,r,s);if(i.matches)return i;let o=Os(e.right,t,n,r,s);return{matches:o.matches,pruned:i.pruned||o.pruned,printed:o.printed,actions:[...i.actions??[],...o.actions??[]]}}default:return{matches:!1,pruned:!1,printed:!1}}}function go(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return go(e.expr);case"and":case"or":return go(e.left)||go(e.right);default:return!1}}function Qr(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return Qr(e.expr);case"and":case"or":return Qr(e.left)&&Qr(e.right)}}function eg(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!Qr(e))return Bu(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:jn(e,n).pruned}}function Bu(e,t){switch(e.type){case"or":{if(Qr(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(jn(e.left,n).pruned)return{shouldPrune:!0}}return Bu(e.right,t)}case"and":{if(Qr(e.left)&&Qr(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:jn(e,n).pruned}}if(Qr(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return jn(e.left,n).matches?Bu(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}var tg=M(()=>{"use strict";pt();cu()});function ng(e,t){let n=[],r=t,s=a=>({expr:null,pathIndex:r,error:`find: missing argument to \`${a}'
518
+ `}),i=(a,l)=>({expr:null,pathIndex:r,error:`find: invalid argument \`${l}' to \`${a}'
519
+ `});for(;r<e.length;){let a=e[r];if(a==="("||a==="\\("){n.push({type:"lparen"}),r++;continue}if(a===")"||a==="\\)"){n.push({type:"rparen"}),r++;continue}if(a==="-name"){if(r+1>=e.length)return s(a);n.push({type:"expr",expr:{type:"name",pattern:e[++r]}})}else if(a==="-iname"){if(r+1>=e.length)return s(a);n.push({type:"expr",expr:{type:"name",pattern:e[++r],ignoreCase:!0}})}else if(a==="-path"){if(r+1>=e.length)return s(a);n.push({type:"expr",expr:{type:"path",pattern:e[++r]}})}else if(a==="-ipath"){if(r+1>=e.length)return s(a);n.push({type:"expr",expr:{type:"path",pattern:e[++r],ignoreCase:!0}})}else if(a==="-regex"){if(r+1>=e.length)return s(a);n.push({type:"expr",expr:{type:"regex",pattern:e[++r]}})}else if(a==="-iregex"){if(r+1>=e.length)return s(a);n.push({type:"expr",expr:{type:"regex",pattern:e[++r],ignoreCase:!0}})}else if(a==="-type"){if(r+1>=e.length)return s(a);let l=e[++r];if(l==="f"||l==="d")n.push({type:"expr",expr:{type:"type",fileType:l}});else return{expr:null,pathIndex:r,error:`find: Unknown argument to -type: ${l}
520
+ `}}else if(a==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(a==="-mtime"){if(r+1>=e.length)return s(a);let l=e[++r],c="exact",u=l;if(l.startsWith("+")?(c="more",u=l.slice(1)):l.startsWith("-")&&(c="less",u=l.slice(1)),!/^\d+$/.test(u))return i(a,l);let f=Number(u);if(!Number.isSafeInteger(f))return i(a,l);n.push({type:"expr",expr:{type:"mtime",days:f,comparison:c}})}else if(a==="-newer"){if(r+1>=e.length)return s(a);let l=e[++r];n.push({type:"expr",expr:{type:"newer",refPath:l}})}else if(a==="-size"){if(r+1>=e.length)return s(a);let l=e[++r],c="exact",u=l;l.startsWith("+")?(c="more",u=l.slice(1)):l.startsWith("-")&&(c="less",u=l.slice(1));let f=u.match(/^(\d+)([ckMGb])?$/);if(!f)return i(a,l);let d=Number(f[1]);if(!Number.isSafeInteger(d))return i(a,l);let p=f[2]||"b",h=p==="G"?1024**3:p==="M"?1024**2:p==="k"?1024:p==="b"?512:1;if(!Number.isSafeInteger(d*h))return i(a,l);n.push({type:"expr",expr:{type:"size",value:d,unit:p,comparison:c}})}else if(a==="-perm"){if(r+1>=e.length)return s(a);let l=e[++r],c="exact",u=l;if(l.startsWith("-")?(c="all",u=l.slice(1)):l.startsWith("/")&&(c="any",u=l.slice(1)),!/^[0-7]{1,4}$/.test(u))return i(a,l);let f=Number.parseInt(u,8);n.push({type:"expr",expr:{type:"perm",mode:f,matchType:c}})}else if(a==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(a==="-not"||a==="!")n.push({type:"not"});else if(a==="-o"||a==="-or")n.push({type:"op",op:"or"});else if(a==="-a"||a==="-and")n.push({type:"op",op:"and"});else if(a==="-maxdepth"||a==="-mindepth"){if(r+1>=e.length)return s(a);r++}else if(a!=="-depth")if(a==="-exec"){let l=[];for(r++;r<e.length&&e[r]!==";"&&e[r]!=="+";)l.push(e[r]),r++;if(r>=e.length)return{expr:null,pathIndex:r,error:"find: missing argument to `-exec'\n"};if(l.length===0)return s("-exec");let c=e[r]==="+";if(c&&(l.at(-1)!=="{}"||l.filter(u=>u==="{}").length!==1))return i("-exec","+");n.push({type:"expr",expr:{type:"action",action:{type:"exec",command:l,batchMode:c}}})}else if(a==="-print")n.push({type:"expr",expr:{type:"action",action:{type:"print"}}});else if(a==="-print0")n.push({type:"expr",expr:{type:"action",action:{type:"print0"}}});else if(a==="-printf"){if(r+1>=e.length)return s(a);let l=e[++r];n.push({type:"expr",expr:{type:"action",action:{type:"printf",format:l}}})}else if(a==="-delete")n.push({type:"expr",expr:{type:"action",action:{type:"delete"}}});else return a.startsWith("-")?{expr:null,pathIndex:r,error:`find: unknown predicate '${a}'
521
+ `}:{expr:null,pathIndex:r,error:`find: paths must precede expression: \`${a}'
522
+ `};r++}if(n.length===0)return{expr:null,pathIndex:r};let o=F5(n);return o.error?{expr:null,pathIndex:r,error:o.error}:{expr:o.expr,pathIndex:r}}function F5(e){let t=0,n;function r(){let l=s();if(!l)return null;for(;t<e.length;){let c=e[t];if(c.type==="op"&&c.op==="or"){t++;let u=s();if(!u)return n="find: expected an expression after `-o'\n",null;l={type:"or",left:l,right:u}}else break}return l}function s(){let l=i();if(!l)return null;for(;t<e.length;){let c=e[t];if(c.type==="op"&&c.op==="and"){t++;let u=i();if(!u)return n="find: expected an expression after `-a'\n",null;l={type:"and",left:l,right:u}}else if(c.type==="expr"||c.type==="not"||c.type==="lparen"){let u=i();if(!u)return l;l={type:"and",left:l,right:u}}else break}return l}function i(){if(t<e.length&&e[t].type==="not"){t++;let l=i();return l?{type:"not",expr:l}:(n="find: expected an expression after `!'\n",null)}return o()}function o(){if(t>=e.length)return null;let l=e[t];if(l.type==="lparen"){t++;let c=r();return!c||t>=e.length||e[t].type!=="rparen"?(n="find: missing closing `)'\n",null):(t++,c)}return l.type==="expr"?(t++,l.expr):(l.type==="rparen",null)}let a=r();return!n&&t<e.length&&(n=e[t].type==="rparen"?"find: unexpected `)'\n":`find: invalid expression
523
+ `),!n&&a&&Ba(a)&&(n="find: refusing to evaluate `-delete' under negation\n"),{expr:n?null:a,error:n}}function Ba(e,t=!1){return e.type==="action"?t&&e.action.type==="delete":e.type==="not"?Ba(e.expr,!t):e.type==="and"||e.type==="or"?Ba(e.left,t)||Ba(e.right,t):!1}var rg=M(()=>{"use strict"});var ig={};ae(ig,{findCommand:()=>U5,flagsForFuzzing:()=>H5});function M5(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function _5(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}function Ua(e){return e?e.type==="action"?[e.action]:e.type==="not"?Ua(e.expr):e.type==="and"||e.type==="or"?[...Ua(e.left),...Ua(e.right)]:[]:[]}function z5(e,t){let n=oa(e),r="",s=0;for(;s<n.length;)if(n[s]==="%"&&s+1<n.length){if(s++,n[s]==="%"){r+="%",s++;continue}let[i,o,a]=mh(n,s);if(s+=a,s>=n.length){r+="%";break}let l=n[s],c;switch(l){case"f":c=t.name,s++;break;case"h":{let u=t.path.lastIndexOf("/");c=u>0?t.path.slice(0,u):".",s++;break}case"p":c=t.path,s++;break;case"P":{let u=t.startingPoint;t.path===u?c="":t.path.startsWith(`${u}/`)?c=t.path.slice(u.length+1):u==="."&&t.path.startsWith("./")?c=t.path.slice(2):c=t.path,s++;break}case"s":c=String(t.size),s++;break;case"d":c=String(t.depth),s++;break;case"m":c=(t.mode&511).toString(8),s++;break;case"M":c=eo(t.mode,t.isDirectory),s++;break;case"t":{let u=new Date(t.mtime);c=W5(u),s++;break}case"T":{if(s+1<n.length){let u=n[s+1],f=new Date(t.mtime);c=j5(f,u),s+=2}else c="%T",s++;break}default:r+=`%${i!==0||o!==-1?`${i}.${o}`:""}${l}`,s++;continue}r+=ni(c,i,o)}else r+=n[s],s++;return r}function W5(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=t[e.getDay()],s=n[e.getMonth()],i=String(e.getDate()).padStart(2," "),o=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0"),c=e.getFullYear();return`${r} ${s} ${i} ${o}:${a}:${l} ${c}`}function j5(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var sg,B5,U5,H5,og=M(()=>{"use strict";ce();bi();Bn();vs();Z();Vc();de();St();tg();rg();sg=500;B5={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},U5={name:"find",async execute(e,t){if(q(e))return G(B5);let n=[],r=null,s=null,i=!1,o=e.length;for(let L=0;L<e.length;L++){let T=e[L];if(T.startsWith("-")||T==="("||T==="\\("||T===")"||T==="\\)"||T==="!"){o=L;break}n.push(T)}n.length===0&&n.push(".");for(let L=o;L<e.length;L++){let T=e[L];if(T==="-exec")for(L++;L<e.length&&e[L]!==";"&&e[L]!=="+";)L++;else if(T==="-maxdepth"||T==="-mindepth"){let W=e[L+1];if(W===void 0||!/^\d+$/.test(W))return{stdout:"",stderr:W===void 0?`find: missing argument to \`${T}'
524
+ `:`find: invalid argument \`${W}' to \`${T}'
525
+ `,exitCode:1};let _=Number(W);if(!Number.isSafeInteger(_))return{stdout:"",stderr:`find: invalid argument \`${W}' to \`${T}'
526
+ `,exitCode:1};T==="-maxdepth"?r=_:s=_,L++}else T==="-depth"&&(i=!0)}let{expr:a,error:l}=ng(e,o);if(l)return{stdout:"",stderr:l,exitCode:1};let c=Ua(a),u=c.length>0;c.some(L=>L.type==="delete")&&(i=!0);let f=[],d=0,p=t.executionScope?new yn(t.executionScope,"find"):void 0,h=[],m=[],g=0,b=new Pt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"find"}),w=L=>{if(p)p.append("stdout",L);else{let T=U(L);if(T>t.limits.maxOutputSize-g)throw new C(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");L&&h.push(L),g+=T}},y=L=>{if(p)p.append("stderr",L);else{let T=U(L);if(T>t.limits.maxOutputSize-g)throw new C(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");L&&m.push(L),g+=T}},x=J0(a),S=new Map;for(let L of x){let T=t.fs.resolvePath(t.cwd,L);try{let W=await t.fs.stat(T);S.set(L,W.mtime?.getTime()??Date.now())}catch{}}let E=c.some(L=>{if(L.type!=="printf")return!1;let T=L.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(T)}),A=po(a)||E,I=ho(a),$=go(a),N=mo(a),R=typeof t.fs.readdirWithFileTypes=="function";for(let L of n){let z=function(V){if(!(s===null||V.depth>=s))return[];let J=!0,ge=[];if(a!==null){let pe=Date.now(),De;if(N)De=Os(a,V.name,V.relativePath,V.isFile,V.isDirectory);else{let tt={name:V.name,relativePath:V.relativePath,isFile:V.isFile,isDirectory:V.isDirectory,isEmpty:V.isEmpty,mtime:V.stat?.mtime?.getTime()??Date.now(),size:V.stat?.size??0,mode:V.stat?.mode??420,newerRefTimes:S};De=jn(a,tt)}J=De.matches,ge=De.actions??[],W.evalCalls++,W.evalTime+=Date.now()-pe}if(!u&&J&&(ge=[{type:"print"}]),ge.length===0)return[];let Oe={path:V.relativePath,name:V.name,size:V.stat?.size??0,mtime:V.stat?.mtime?.getTime()??Date.now(),mode:V.stat?.mode??420,isDirectory:V.isDirectory,depth:V.depth,startingPoint:L};b.checkpoint(ge.length);let Ee=[];for(let pe of ge)Ee.push({action:pe,path:V.relativePath,printfData:Oe});return Ee};var B=z;L.length>1&&L.endsWith("/")&&(L=L.slice(0,-1));let T=t.fs.resolvePath(t.cwd,L);try{await t.fs.stat(T)}catch{y(`find: ${L}: No such file or directory
527
+ `),d=1;continue}let W=M5(),_=Date.now();async function F(V){let{path:Y,depth:J,typeInfo:ge}=V;if(b.visit(J),W.nodeCount++,J>(r??t.limits.maxTraversalDepth))return null;let Oe,Ee,pe;if(ge&&!A)Oe=ge.isFile,Ee=ge.isDirectory;else{try{let nn=Date.now();pe=await t.fs.lstat(Y),W.statCalls++,W.statTime+=Date.now()-nn}catch{return null}if(!pe)return null;Oe=pe.isFile,Ee=pe.isDirectory}let De;Y===T?De=L.split("/").pop()||L:De=Y.split("/").pop()||"";let tt=Y===T?L:L==="."?`./${Y.slice(T==="/"?T.length:T.length+1)}`:L+Y.slice(T.length),se=[],fe=null,Ue=null,Se=!1;Ee&&$&&!i&&(Se=eg(a,{name:De,relativePath:tt,isFile:Oe,isDirectory:Ee}).shouldPrune,Se&&W.earlyPrunes++);let at=!(J>=(r??t.limits.maxTraversalDepth))&&!Se;if(Ee&&((at||I)&&!Se)){let nn=Date.now();if(R&&t.fs.readdirWithFileTypes){fe=await t.fs.readdirWithFileTypes(Y),b.checkpoint(),b.discover(fe.length),Ue=[];for(let pn of fe)Ue.push(pn.name);if(W.readdirCalls++,W.readdirTime+=Date.now()-nn,at)for(let pn=0;pn<fe.length;pn++){let Hr=fe[pn];se.push({path:Y==="/"?`/${Hr.name}`:`${Y}/${Hr.name}`,depth:J+1,typeInfo:{isFile:Hr.isFile,isDirectory:Hr.isDirectory},resultIndex:pn})}}else if(Ue=await t.fs.readdir(Y),b.checkpoint(),b.discover(Ue.length),W.readdirCalls++,W.readdirTime+=Date.now()-nn,at)for(let pn=0;pn<Ue.length;pn++){let Hr=Ue[pn];se.push({path:Y==="/"?`/${Hr}`:`${Y}/${Hr}`,depth:J+1,resultIndex:pn})}}let $r=Oe?(pe?.size??0)===0:Ue!==null&&Ue.length===0,er=Se;if(!i&&a!==null&&!Se&&$){let nn=Date.now(),pn={name:De,relativePath:tt,isFile:Oe,isDirectory:Ee,isEmpty:$r,mtime:pe?.mtime?.getTime()??Date.now(),size:pe?.size??0,mode:pe?.mode??420,newerRefTimes:S};er=jn(a,pn).pruned,W.evalCalls++,W.evalTime+=Date.now()-nn}return{relativePath:tt,name:De,isFile:Oe,isDirectory:Ee,isEmpty:$r,stat:pe,depth:J,children:er?[]:se,pruned:er}}async function D(){let V={effects:[]};if(i){let Y=[],J=[{item:{path:T,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],ge=new Map,Oe=0;for(;Oe<J.length;){let Ee=Date.now(),pe=Math.min(J.length,Oe+sg),De=J.slice(Oe,pe);Oe=pe;let tt=await Promise.all(De.map(se=>F(se.item)));W.batchCount++,W.batchTime+=Date.now()-Ee;for(let se=0;se<De.length;se++){let fe=tt[se],Ue=De[se];if(!fe)continue;let Se=Y.length;if(Ue.parentIndex>=0){let Ke=ge.get(Ue.parentIndex)||[];Ke.push(Se),ge.set(Ue.parentIndex,Ke)}Y.push({node:fe,parentIndex:Ue.parentIndex,childIndices:[]});for(let Ke=0;Ke<fe.children.length;Ke++)J.push({item:fe.children[Ke],parentIndex:Se,childOrderInParent:Ke})}}for(let[Ee,pe]of ge)Ee>=0&&Ee<Y.length&&(Y[Ee].childIndices=pe);if(Y.length>0){let Ee=[{index:0,visited:!1}];for(;Ee.length>0;){b.checkpoint();let pe=Ee.pop();if(!pe)break;let De=Y[pe.index];if(De){if(pe.visited){for(let tt of z(De.node))V.effects.push(tt);continue}Ee.push({index:pe.index,visited:!0});for(let tt=De.childIndices.length-1;tt>=0;tt--)Ee.push({index:De.childIndices[tt],visited:!1})}}}}else{let Y=new Map,J=0,ge=[{item:{path:T,depth:0,resultIndex:0},orderIndex:J++}],Oe=new Map,Ee=0;for(;Ee<ge.length;){let De=Date.now(),tt=Math.min(ge.length,Ee+sg),se=ge.slice(Ee,tt);Ee=tt;let fe=await Promise.all(se.map(async({item:Ue,orderIndex:Se})=>{let Ke=await F(Ue);return Ke?{node:Ke,orderIndex:Se}:null}));W.batchCount++,W.batchTime+=Date.now()-De;for(let Ue of fe){if(!Ue)continue;let{node:Se,orderIndex:Ke}=Ue,at=z(Se);if(at.length>0&&Y.set(Ke,at),Se.children.length>0){let me=[];for(let $r of Se.children){let er=J++;me.push(er),ge.push({item:$r,orderIndex:er})}Oe.set(Ke,me)}}}let pe=[0];for(;pe.length>0;){b.checkpoint();let De=pe.pop();if(De===void 0)break;let tt=Y.get(De);if(tt)for(let fe of tt)V.effects.push(fe);let se=Oe.get(De);if(se)for(let fe=se.length-1;fe>=0;fe--)pe.push(se[fe])}}return V}let X=await D();for(let V of X.effects)f.push(V);if(t.trace){let V=Date.now()-_;_5(t.trace,W,V),t.trace({category:"find",name:"searchPath",durationMs:V,details:{path:L,resultsFound:X.effects.length}})}}let O=new Map;for(let L of f){let{action:T,path:W}=L;switch(T.type){case"print":w(`${W}
528
+ `);break;case"print0":w(`${W}\0`);break;case"printf":w(z5(T.format,L.printfData));break;case"delete":{let _=t.fs.resolvePath(t.cwd,W);try{await t.fs.rm(_,{recursive:!1})}catch(F){let z=F instanceof Error?F.message:String(F);y(`find: cannot delete '${W}': ${z}
529
+ `),d=1}break}case"exec":{if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
530
+ `,exitCode:1};if(T.batchMode){let z=O.get(T)??[];z.push(W),O.set(T,z);break}let _=T.command.map(z=>z==="{}"?W:z),F=await t.exec(In([_[0]]),{cwd:t.cwd,signal:t.signal,args:_.slice(1)});p?p.appendResult(F):(w(F.stdout),y(F.stderr)),F.exitCode!==0&&(d=F.exitCode);break}}}for(let[L,T]of O){if(L.type!=="exec"||!t.exec||T.length===0)continue;let W=[];for(let F of L.command)F==="{}"?W.push(...T):W.push(F);let _=await t.exec(In([W[0]]),{cwd:t.cwd,signal:t.signal,args:W.slice(1)});p?p.appendResult(_):(w(_.stdout),y(_.stderr)),_.exitCode!==0&&(d=_.exitCode)}return p?.build(d)??{stdout:h.join(""),stderr:m.join(""),exitCode:d}}};H5={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0}});var ag={};ae(ag,{basenameCommand:()=>G5,flagsForFuzzing:()=>q5});var V5,G5,q5,lg=M(()=>{"use strict";de();V5={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX]
531
+ basename OPTION... NAME...`,options:["-a, --multiple support multiple arguments","-s, --suffix=SUFFIX remove a trailing SUFFIX"," --help display this help and exit"]},G5={name:"basename",async execute(e,t){if(q(e))return G(V5);let n=!1,r="",s=[];for(let o=0;o<e.length;o++){let a=e[o];a==="-a"||a==="--multiple"?n=!0:a==="-s"&&o+1<e.length?(r=e[++o],n=!0):a.startsWith("--suffix=")?(r=a.slice(9),n=!0):a.startsWith("-")||s.push(a)}if(s.length===0)return{stdout:"",stderr:`basename: missing operand
532
+ `,exitCode:1};!n&&s.length>=2&&(r=s.pop()??"");let i=[];for(let o of s){let a=o.replace(/\/+$/,""),l=a.split("/").pop()||a;r&&l.endsWith(r)&&(l=l.slice(0,-r.length)),i.push(l)}return{stdout:`${i.join(`
533
+ `)}
534
+ `,stderr:"",exitCode:0}}},q5={name:"basename",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"value",valueHint:"string"}],needsArgs:!0}});var cg={};ae(cg,{dirnameCommand:()=>K5,flagsForFuzzing:()=>Q5});var Z5,K5,Q5,ug=M(()=>{"use strict";de();Z5={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},K5={name:"dirname",async execute(e,t){if(q(e))return G(Z5);let n=e.filter(s=>!s.startsWith("-"));if(n.length===0)return{stdout:"",stderr:`dirname: missing operand
535
+ `,exitCode:1};let r=[];for(let s of n){let i=s.replace(/\/+$/,""),o=i.lastIndexOf("/");o===-1?r.push("."):o===0?r.push("/"):r.push(i.slice(0,o))}return{stdout:`${r.join(`
536
+ `)}
537
+ `,stderr:"",exitCode:0}}},Q5={name:"dirname",flags:[],needsArgs:!0}});var dg={};ae(dg,{flagsForFuzzing:()=>tS,treeCommand:()=>J5});async function eS(e,t,n,r,s){let i={output:"",stderr:"",dirCount:0,fileCount:0},o=e.fs.resolvePath(e.cwd,t);try{if(!(await e.fs.stat(o)).isDirectory)return i.output=`${t}
538
+ `,i.fileCount=1,i}catch{return i.stderr=`tree: ${t}: No such file or directory
539
+ `,i}if(i.output=`${t}
540
+ `,n.maxDepth!==null&&s>=n.maxDepth)return i;try{let a=[];if(e.fs.readdirWithFileTypes)a=(await e.fs.readdirWithFileTypes(o)).map(u=>({name:u.name,isDirectory:u.isDirectory}));else{let c=await e.fs.readdir(o);for(let u=0;u<c.length;u+=100){let f=c.slice(u,u+100),d=await Promise.all(f.map(async p=>{let h=o==="/"?`/${p}`:`${o}/${p}`;try{let m=await e.fs.stat(h);return{name:p,isDirectory:m.isDirectory}}catch{return null}}));a.push(...d.filter(p=>p!==null))}}let l=a.filter(c=>!(!n.showHidden&&c.name.startsWith(".")||n.directoriesOnly&&!c.isDirectory));l.sort((c,u)=>c.name.localeCompare(u.name));for(let c=0;c<l.length;c++){let u=l[c],f=o==="/"?`/${u.name}`:`${o}/${u.name}`,d=c===l.length-1,p=d?"`-- ":"|-- ",h=r+(d?" ":"| ");if(u.isDirectory){i.dirCount++;let m=n.fullPath?f:u.name;if(i.output+=`${r+p+m}
541
+ `,n.maxDepth===null||s+1<n.maxDepth){let g=await fg(e,f,n,h,s+1);i.output+=g.output,i.dirCount+=g.dirCount,i.fileCount+=g.fileCount}}else{i.fileCount++;let m=n.fullPath?f:u.name;i.output+=`${r+p+m}
542
+ `}}}catch{i.stderr=`tree: ${t}: Permission denied
543
+ `}return i}async function fg(e,t,n,r,s){let i={output:"",stderr:"",dirCount:0,fileCount:0};if(n.maxDepth!==null&&s>=n.maxDepth)return i;try{let o=[];if(e.fs.readdirWithFileTypes)o=(await e.fs.readdirWithFileTypes(t)).map(c=>({name:c.name,isDirectory:c.isDirectory}));else{let l=await e.fs.readdir(t);for(let c=0;c<l.length;c+=100){let u=l.slice(c,c+100),f=await Promise.all(u.map(async d=>{let p=t==="/"?`/${d}`:`${t}/${d}`;try{let h=await e.fs.stat(p);return{name:d,isDirectory:h.isDirectory}}catch{return null}}));o.push(...f.filter(d=>d!==null))}}let a=o.filter(l=>!(!n.showHidden&&l.name.startsWith(".")||n.directoriesOnly&&!l.isDirectory));a.sort((l,c)=>l.name.localeCompare(c.name));for(let l=0;l<a.length;l++){let c=a[l],u=t==="/"?`/${c.name}`:`${t}/${c.name}`,f=l===a.length-1,d=f?"`-- ":"|-- ",p=r+(f?" ":"| ");if(c.isDirectory){i.dirCount++;let h=n.fullPath?u:c.name;i.output+=`${r+d+h}
544
+ `;let m=await fg(e,u,n,p,s+1);i.output+=m.output,i.dirCount+=m.dirCount,i.fileCount+=m.fileCount}else{i.fileCount++;let h=n.fullPath?u:c.name;i.output+=`${r+d+h}
545
+ `}}}catch{}return i}var X5,Y5,J5,tS,pg=M(()=>{"use strict";It();Yi();de();X5={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},Y5={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},J5={name:"tree",async execute(e,t){if(q(e))return G(X5);let n=Le("tree",e,Y5);if(!n.ok)return n.error;let r={showHidden:n.result.flags.showHidden,directoriesOnly:n.result.flags.directoriesOnly,maxDepth:n.result.flags.maxDepth??null,fullPath:n.result.flags.fullPath},s=n.result.positional;s.length===0&&s.push(".");let i="",o="",a=0,l=0;for(let c of s){let u=await eS(t,c,r,"",0);i+=u.output,o+=u.stderr,a+=u.dirCount,l+=u.fileCount}return i+=`
546
+ ${a} director${a===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"s"}`),i+=`
547
+ `,{stdout:i,stderr:o,exitCode:o?1:0}}};tS={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0}});var hg={};ae(hg,{duCommand:()=>sS,flagsForFuzzing:()=>oS});async function iS(e,t,n,r,s){let i={output:"",totalSize:0,stderr:""},o=new Map;return await wr({fs:e.fs,root:t,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"du",symlinks:"never",includeLeave:!0},a=>{let l=a.path.slice(t.length).replace(/^\//,""),c=l?n==="."?l:`${n}/${l}`:n,u=a.path==="/"?"/":a.path.slice(0,a.path.lastIndexOf("/"))||"/";if(a.phase==="enter"){if(a.stat.isDirectory){o.set(a.path,0);return}o.set(u,(o.get(u)??0)+a.stat.size),(r.allFiles||a.depth===s)&&!r.summarize&&(i.output+=`${Uu(a.stat.size,r.humanReadable)} ${c}
548
+ `),a.depth===s&&(i.totalSize=a.stat.size);return}let f=o.get(a.path)??0;a.depth>s?o.set(u,(o.get(u)??0)+f):i.totalSize=f;let d=a.depth-s;(r.summarize&&d===0||!r.summarize&&(r.maxDepth===null||d<=r.maxDepth))&&(i.output+=`${Uu(f,r.humanReadable)} ${c}
549
+ `)}),i}function Uu(e,t){return t?e<1024?`${e}`:e<1024*1024?`${(e/1024).toFixed(1)}K`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)}M`:`${(e/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(e/1024)||1)}var nS,rS,sS,oS,mg=M(()=>{"use strict";Bn();Z();It();de();nS={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"]},rS={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"}},sS={name:"du",async execute(e,t){if(q(e))return G(nS);let n=Le("du",e,rS);if(!n.ok)return n.error;let r={allFiles:n.result.flags.allFiles,humanReadable:n.result.flags.humanReadable,summarize:n.result.flags.summarize,grandTotal:n.result.flags.grandTotal,maxDepth:n.result.flags.maxDepth??null},s=n.result.positional;s.length===0&&s.push(".");let i="",o="",a=0;for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{await t.fs.stat(c);let u=await iS(t,c,l,r,0);i+=u.output,a+=u.totalSize,o+=u.stderr}catch(u){if(u instanceof C||u instanceof Ge)throw u;o+=`du: cannot access '${l}': No such file or directory
550
+ `}}return r.grandTotal&&s.length>0&&(i+=`${Uu(a,r.humanReadable)} total
551
+ `),{stdout:i,stderr:o,exitCode:o?1:0}}};oS={name:"du",flags:[{flag:"-a",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"--max-depth",type:"value",valueHint:"number"}],needsFiles:!0}});var zu={};ae(zu,{envCommand:()=>lS,flagsForFuzzing:()=>fS,printenvCommand:()=>uS,printenvFlagsForFuzzing:()=>dS});var aS,lS,cS,uS,fS,dS,Wu=M(()=>{"use strict";ce();Lr();de();aS={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},lS={name:"env",async execute(e,t){if(q(e))return G(aS);let n=!1,r=[],s=new Map,i=-1;for(let l=0;l<e.length;l++){let c=e[l];if(c==="-i"||c==="--ignore-environment")n=!0;else if(c==="-u"&&l+1<e.length)r.push(e[++l]);else if(c.startsWith("-u"))r.push(c.slice(2));else if(c.startsWith("--unset="))r.push(c.slice(8));else{if(c.startsWith("--")&&c!=="--")return re("env",c);if(c.startsWith("-")&&c!=="-"){for(let u of c.slice(1))if(u!=="i"&&u!=="u")return re("env",`-${u}`);c.includes("i")&&(n=!0)}else if(c.includes("=")&&i===-1){let u=c.indexOf("="),f=c.slice(0,u),d=c.slice(u+1);s.set(f,d)}else{i=l;break}}}let o;if(n)o=new Map(s);else{o=new Map(t.env);for(let l of r)o.delete(l);for(let[l,c]of s)o.set(l,c)}if(i===-1){let l=[];for(let[c,u]of o)l.push(`${c}=${u}`);return{stdout:l.join(`
552
+ `)+(l.length>0?`
553
+ `:""),stderr:"",exitCode:0}}if(!t.exec)return{stdout:"",stderr:`env: command execution not supported in this context
554
+ `,exitCode:1};let a=e.slice(i);return t.exec("command",{cwd:t.cwd,env:Ht(o),replaceEnv:!0,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:a})}},cS={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},uS={name:"printenv",async execute(e,t){if(q(e))return G(cS);let n=e.filter(i=>!i.startsWith("-"));if(n.length===0){let i=[];for(let[o,a]of t.env)i.push(`${o}=${a}`);return{stdout:i.join(`
555
+ `)+(i.length>0?`
556
+ `:""),stderr:"",exitCode:0}}let r=[],s=0;for(let i of n){let o=t.env.get(i);o!==void 0?r.push(o):s=1}return{stdout:r.join(`
557
+ `)+(r.length>0?`
558
+ `:""),stderr:"",exitCode:s}}},fS={name:"env",flags:[{flag:"-i",type:"boolean"},{flag:"-u",type:"value",valueHint:"string"}]},dS={name:"printenv",flags:[]}});var ju={};ae(ju,{aliasCommand:()=>hS,flagsForFuzzing:()=>gS,unaliasCommand:()=>mS,unaliasFlagsForFuzzing:()=>yS});var pS,xi,hS,mS,gS,yS,Hu=M(()=>{"use strict";de();pS={name:"alias",summary:"define or display aliases",usage:"alias [name[=value] ...]",options:[" --help display this help and exit"]},xi="BASH_ALIAS_",hS={name:"alias",async execute(e,t){if(q(e))return G(pS);if(e.length===0){let r="";for(let[s,i]of t.env)if(s.startsWith(xi)){let o=s.slice(xi.length);r+=`alias ${o}='${i}'
559
+ `}return{stdout:r,stderr:"",exitCode:0}}let n=e[0]==="--"?e.slice(1):e;for(let r of n){let s=r.indexOf("=");if(s===-1){let i=xi+r;return t.env.get(i)?{stdout:`alias ${r}='${t.env.get(i)}'
560
+ `,stderr:"",exitCode:0}:{stdout:"",stderr:`alias: ${r}: not found
561
+ `,exitCode:1}}else{let i=r.slice(0,s),o=r.slice(s+1);(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"'))&&(o=o.slice(1,-1)),t.env.set(xi+i,o)}}return{stdout:"",stderr:"",exitCode:0}}},mS={name:"unalias",async execute(e,t){if(q(e))return G({name:"unalias",summary:"remove alias definitions",usage:"unalias name [name ...]",options:["-a remove all aliases"," --help display this help and exit"]});if(e.length===0)return{stdout:"",stderr:`unalias: usage: unalias [-a] name [name ...]
562
+ `,exitCode:1};if(e[0]==="-a"){for(let i of t.env.keys())i.startsWith(xi)&&t.env.delete(i);return{stdout:"",stderr:"",exitCode:0}}let n=e[0]==="--"?e.slice(1):e,r=!1,s="";for(let i of n){let o=xi+i;t.env.get(o)?t.env.delete(o):(s+=`unalias: ${i}: not found
563
+ `,r=!0)}return{stdout:"",stderr:s,exitCode:r?1:0}}},gS={name:"alias",flags:[]},yS={name:"unalias",flags:[{flag:"-a",type:"boolean"}]}});var yg={};ae(yg,{flagsForFuzzing:()=>xS,historyCommand:()=>bS});var wS,gg,bS,xS,wg=M(()=>{"use strict";de();wS={name:"history",summary:"display command history",usage:"history [n]",options:["-c clear the history list"," --help display this help and exit"]},gg="BASH_HISTORY",bS={name:"history",async execute(e,t){if(q(e))return G(wS);let n=t.env.get(gg)||"[]",r;try{r=JSON.parse(n)}catch{r=[]}if(e[0]==="-c")return t.env.set(gg,"[]"),{stdout:"",stderr:"",exitCode:0};let s=r.length;e[0]&&/^\d+$/.test(e[0])&&(s=Math.min(parseInt(e[0],10),r.length));let i=r.length-s,o="";for(let a=i;a<r.length;a++){let l=(a+1).toString().padStart(5," ");o+=`${l} ${r[a]}
564
+ `}return{stdout:o,stderr:"",exitCode:0}}},xS={name:"history",flags:[{flag:"-c",type:"boolean"}]}});var xg={};ae(xg,{flagsForFuzzing:()=>CS,xargsCommand:()=>AS});function bg(e,t,n){if(t.length===0)throw new Error("xargs: delimiter must not be empty");let r=[],s=0;for(;s<=e.length;){let i=e.indexOf(t,s),o=e.slice(s,i===-1?e.length:i);if(o.length>0){if(r.length>=n)throw new C(`xargs: array element limit exceeded (${n})`,"array_elements");r.push(o)}if(i===-1)break;s=i+t.length}return r}function SS(e,t){let n=[],r=-1;for(let s=0;s<=e.length;s++){let i=s===e.length||/\s/.test(e[s]);if(!i&&r===-1&&(r=s),i&&r!==-1){if(n.length>=t)throw new C(`xargs: array element limit exceeded (${t})`,"array_elements");n.push(e.slice(r,s)),r=-1}}return n}var ES,AS,CS,Eg=M(()=>{"use strict";ce();bi();vs();Z();de();St();ES={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]};AS={name:"xargs",async execute(e,t){if(q(e))return G(ES);let n=null,r=null,s=null,i=null,o=!1,a=!1,l=!1,c=0;for(let O=0;O<e.length;O++){let B=e[O];if(B==="-I"&&O+1<e.length)n=e[++O],c=O+1;else if(B==="-d"&&O+1<e.length)r=e[++O].replace(/\\n/g,`
565
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\0/g,"\0").replace(/\\\\/g,"\\"),c=O+1;else if(B==="-n"&&O+1<e.length){let L=e[++O],T=Number(L);if(!/^\d+$/.test(L)||!Number.isSafeInteger(T)||T<1)return{stdout:"",stderr:`xargs: invalid number for -n: '${L}'
566
+ `,exitCode:1};s=T,c=O+1}else if(B==="-P"&&O+1<e.length){let L=e[++O],T=Number(L);if(!/^\d+$/.test(L)||!Number.isSafeInteger(T))return{stdout:"",stderr:`xargs: invalid number for -P: '${L}'
567
+ `,exitCode:1};i=T,c=O+1}else if(B==="-0"||B==="--null")o=!0,c=O+1;else if(B==="-t"||B==="--verbose")a=!0,c=O+1;else if(B==="-r"||B==="--no-run-if-empty")l=!0,c=O+1;else{if(B.startsWith("--"))return re("xargs",B);if(B.startsWith("-")&&B.length>1){for(let L of B.slice(1))if(!"0tr".includes(L))return re("xargs",`-${L}`);B.includes("0")&&(o=!0),B.includes("t")&&(a=!0),B.includes("r")&&(l=!0),c=O+1}else if(!B.startsWith("-")){c=O;break}}}let u=e.slice(c);u.length===0&&u.push("echo");let f=ue(t.stdin),d=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),p=t.limits.maxArrayElements,h=t.limits.maxLoopIterations,m=t.limits.maxOutputSize;if(U(f)>d)throw new C(`xargs: input size limit exceeded (${d} bytes)`,"string_length");if(i!==null&&i>p)throw new C(`xargs: array element limit exceeded (${p})`,"array_elements");let g;if(o)g=bg(f,"\0",p);else if(r!==null){let O=f.replace(/\n$/,"");try{g=bg(O,r,p)}catch(B){if(B instanceof C)throw B;return{stdout:"",stderr:`xargs: delimiter must not be empty
568
+ `,exitCode:1}}}else g=SS(f,p);if(g.length===0)return l?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let b=[],w=[],y=0,x=0,S=0,E=t.executionScope?new yn(t.executionScope,"xargs"):void 0,A=O=>{if(E){E.appendResult(O);return}let B=U(O.stdout)+U(O.stderr);if(B>m-x)throw new C(`xargs: output size limit exceeded (${m} bytes)`,"output_size");O.stdout&&b.push(O.stdout),O.stderr&&w.push(O.stderr),x+=B},I=O=>{if(E){E.append("stderr",O);return}let B=U(O);if(B>m-x)throw new C(`xargs: output size limit exceeded (${m} bytes)`,"output_size");O&&w.push(O),x+=B},$=O=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(O)?`"${O.replace(/([\\"`$])/g,"\\$1")}"`:O,N=async O=>{if(++S>h)throw new C(`xargs: iteration limit exceeded (${h})`,"iterations");if(O.length>p)throw new C(`xargs: array element limit exceeded (${p})`,"array_elements");for(let L of O)if(U(L)>d)throw new C(`xargs: string length limit exceeded (${d} bytes)`,"string_length");if(a){let L=O.map($).join(" ");I(`${L}
569
+ `)}return t.exec?t.exec(In([O[0]]),{cwd:t.cwd,signal:t.signal,args:O.slice(1)}):{stdout:`${O.map($).join(" ")}
570
+ `,stderr:"",exitCode:0}},R=async O=>{if(i!==null&&i>1)for(let B=0;B<O.length;B+=i){let L=O.slice(B,B+i),T=await Promise.all(L.map(N));for(let W of T)A(W),W.exitCode!==0&&(y=W.exitCode)}else for(let B of O){let L=await N(B);A(L),L.exitCode!==0&&(y=L.exitCode)}};if(n!==null){if(g.length>h)throw new C(`xargs: iteration limit exceeded (${h})`,"iterations");if(n.length===0)return{stdout:"",stderr:`xargs: replacement string must not be empty
571
+ `,exitCode:1};if(u.length>0&&g.length>Math.floor(p/u.length))throw new C(`xargs: array element limit exceeded (${p})`,"array_elements");let O=(L,T)=>{let W=0,_=0;for(;_=L.indexOf(n,_),_!==-1;)W++,_+=n.length;if(U(L)+W*(U(T)-U(n))>d)throw new C(`xargs: string length limit exceeded (${d} bytes)`,"string_length");return L.replaceAll(n,T)},B=g.map(L=>u.map(T=>O(T,L)));await R(B)}else if(s!==null){let O=[],B=Math.ceil(g.length/s);if(B>Math.min(p,h))throw new C(`xargs: iteration limit exceeded (${h})`,"iterations");if(g.length+B*u.length>p)throw new C(`xargs: array element limit exceeded (${p})`,"array_elements");for(let T=0;T<g.length;T+=s){let W=g.slice(T,T+s);O.push([...u,...W])}await R(O)}else{let O=[...u,...g],B=await N(O);A(B),y=B.exitCode}return E?.build(y)??{stdout:b.join(""),stderr:w.join(""),exitCode:y}}},CS={name:"xargs",flags:[{flag:"-I",type:"value",valueHint:"string"},{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-0",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-r",type:"boolean"}],stdinType:"text"}});var Vu={};ae(Vu,{falseCommand:()=>kS,falseFlagsForFuzzing:()=>IS,flagsForFuzzing:()=>NS,trueCommand:()=>vS});var vS,kS,NS,IS,Gu=M(()=>{"use strict";vS={name:"true",async execute(){return{stdout:"",stderr:"",exitCode:0}}},kS={name:"false",async execute(){return{stdout:"",stderr:"",exitCode:1}}},NS={name:"true",flags:[]},IS={name:"false",flags:[]}});var Sg={};ae(Sg,{clearCommand:()=>TS,flagsForFuzzing:()=>RS});var OS,TS,RS,Ag=M(()=>{"use strict";de();OS={name:"clear",summary:"clear the terminal screen",usage:"clear [OPTIONS]",options:[" --help display this help and exit"]},TS={name:"clear",async execute(e,t){return q(e)?G(OS):{stdout:"\x1B[2J\x1B[H",stderr:"",exitCode:0}}},RS={name:"clear",flags:[]}});var qu={};ae(qu,{bashCommand:()=>$S,flagsForFuzzing:()=>DS,shCommand:()=>PS,shFlagsForFuzzing:()=>LS});async function Ei(e,t,n,r){if(!r.exec)return{stdout:"",stderr:`bash: internal error: exec function not available
572
+ `,exitCode:1};let s=Ns(r.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((l,c)=>{s[String(c+1)]=l});let i=e;if(i.startsWith("#!")){let l=i.indexOf(`
573
+ `);l!==-1&&(i=i.slice(l+1))}let o=r.execWithInheritedStdin;return o?await o(i,{env:s,cwd:r.cwd,signal:r.signal}):await r.exec(i,{env:s,cwd:r.cwd,stdin:r.stdin,stdinKind:"bytes",signal:r.signal})}var Cg,$S,PS,DS,LS,Zu=M(()=>{"use strict";ce();Lr();de();Cg={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},$S={name:"bash",async execute(e,t){if(q(e))return G(Cg);if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"bash",o=e.slice(3);return Ei(s,i,o,t)}if(e.length===0){let s=ue(t.stdin);return s.trim()?Ei(s,"bash",[],t):{stdout:"",stderr:"",exitCode:0}}let n=e[0],r=e.slice(1);try{let s=t.fs.resolvePath(t.cwd,n),i=await t.fs.readFile(s);return Ei(i,n,r,t)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
574
+ `,exitCode:127}}}},PS={name:"sh",async execute(e,t){if(q(e))return G({...Cg,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"sh",o=e.slice(3);return Ei(s,i,o,t)}if(e.length===0){let s=ue(t.stdin);return s.trim()?Ei(s,"sh",[],t):{stdout:"",stderr:"",exitCode:0}}let n=e[0],r=e.slice(1);try{let s=t.fs.resolvePath(t.cwd,n),i=await t.fs.readFile(s);return Ei(i,n,r,t)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
575
+ `,exitCode:127}}}};DS={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},LS={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function yo(e,t,n=1){let r=e.limits.maxArrayElements;if(n<0||t>r-n)throw new C(`query result element limit exceeded (${r})`,"array_elements")}function Ku(e,t,n,r,s,i,o,a,l,c){switch(t){case"sort":return Array.isArray(e)?[[...e].sort(o)]:[null];case"sort_by":return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((f,d)=>{let p=s(f,n[0],r)[0],h=s(d,n[0],r)[0];return o(p,h)})];case"bsearch":{if(!Array.isArray(e)){let f=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${f} (${JSON.stringify(e)}) cannot be searched from`)}return n.length===0?[null]:s(e,n[0],r).map(f=>{let d=0,p=e.length;for(;d<p;){let h=d+p>>>1;o(e[h],f)<0?d=h+1:p=h}return d<e.length&&o(e[d],f)===0?d:-d-1})}case"unique_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let d of e){let p=s(d,n[0],r)[0],h=JSON.stringify(p);u.has(h)||u.set(h,{item:d,key:p})}let f=[...u.values()];return f.sort((d,p)=>o(d.key,p.key)),[f.map(d=>d.item)]}case"group_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let f of e){let d=JSON.stringify(s(f,n[0],r)[0]);u.has(d)||u.set(d,[]),u.get(d)?.push(f)}return[[...u.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(u,f)>0?u:f)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let d=s(u,n[0],r)[0],p=s(f,n[0],r)[0];return o(d,p)>0?u:f})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(u,f)<0?u:f)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let d=s(u,n[0],r)[0],p=s(f,n[0],r)[0];return o(d,p)<0?u:f})];case"add":{let u=f=>{let d=f.filter(p=>p!==null);return d.length===0?null:d.every(p=>typeof p=="number")?d.reduce((p,h)=>p+h,0):d.every(p=>typeof p=="string")?d.join(""):d.every(p=>Array.isArray(p))?d.flat():d.every(p=>p&&typeof p=="object"&&!Array.isArray(p))?Ns(...d):null};if(n.length>=1){let f=s(e,n[0],r);return[u(f)]}return Array.isArray(e)?[u(e)]:[null]}case"any":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(s(f,n[1],r).some(a))return[!0]}catch(u){if(u instanceof c)throw u}return[!1]}return n.length===1?Array.isArray(e)?[e.some(u=>a(s(u,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(a)]:[!1]}case"all":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(!s(f,n[1],r).some(a))return[!1]}catch(u){if(u instanceof c)throw u}return[!0]}return n.length===1?Array.isArray(e)?[e.every(u=>a(s(u,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(a)]:[!0]}case"select":return n.length===0?[e]:s(e,n[0],r).some(a)?[e]:[];case"map":{if(n.length===0||!Array.isArray(e))return[null];yo(r,0,e.length);let u=[];for(let f of e){let d=s(f,n[0],r);yo(r,u.length,d.length);for(let p of d)u.push(p)}return[u]}case"map_values":{if(n.length===0)return[null];if(Array.isArray(e)){yo(r,0,e.length);let u=[];for(let f of e){let d=s(f,n[0],r);yo(r,u.length,d.length);for(let p of d)u.push(p)}return[u]}if(e&&typeof e=="object"){let u=Object.create(null),f=Object.keys(e);yo(r,0,f.length);for(let d of f){if(!qe(d))continue;let p=e[d],h=s(p,n[0],r);h.length>0&&Ze(u,d,h[0])}return[u]}return[null]}case"has":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(e)&&typeof f=="number"?[f>=0&&f<e.length]:e&&typeof e=="object"&&typeof f=="string"?[Object.hasOwn(e,f)]:[!1]}case"in":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(f)&&typeof e=="number"?[e>=0&&e<f.length]:f&&typeof f=="object"&&typeof e=="string"?[Object.hasOwn(f,e)]:[!1]}case"contains":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(e,u[0])]}case"inside":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(u[0],e)]}default:return null}}var vg=M(()=>{"use strict";Lr();Z();sr()});function Qu(e,t,n,r,s,i,o,a){switch(t){case"first":if(n.length>0)try{let l=i(e,n[0],r);return l.length>0?[l[0]]:[]}catch(l){if(l instanceof a)throw l;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(n.length>0){let l=s(e,n[0],r);return l.length>0?[l[l.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(n.length<1)return[null];let l=s(e,n[0],r);if(n.length>1){for(let u of l)if(u<0)throw new Error("nth doesn't support negative indices");let c;try{c=i(e,n[1],r)}catch(u){if(u instanceof a)throw u;c=[]}return l.flatMap(u=>{let f=u;return f<c.length?[c[f]]:[]})}return Array.isArray(e)?l.flatMap(c=>{let u=c;if(u<0)throw new Error("nth doesn't support negative indices");return u<e.length?[e[u]]:[null]}):[null]}case"range":{if(n.length===0)return[];let l=r.limits.maxArrayElements,c=(h,m)=>{if(h.length>=l)throw new a(`query result element limit exceeded (${l})`,"array_elements");h.push(m)},u=s(e,n[0],r);if(n.length===1){let h=[];for(let m of u){let g=m;for(let b=0;b<g;b++)c(h,b)}return h}let f=s(e,n[1],r);if(n.length===2){let h=[];for(let m of u)for(let g of f){let b=m,w=g;for(let y=b;y<w;y++)c(h,y)}return h}let d=s(e,n[2],r),p=[];for(let h of u)for(let m of f)for(let g of d){let b=h,w=m,y=g;if(y!==0)if(y>0)for(let x=b;x<w;x+=y)c(p,x);else for(let x=b;x>w;x+=y)c(p,x)}return p}case"limit":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("limit doesn't support negative count");if(u===0)return[];let f;try{f=i(e,n[1],r)}catch(d){if(d instanceof a)throw d;f=[]}return f.slice(0,u)});case"isempty":{if(n.length<1)return[!0];try{return[i(e,n[0],r).length===0]}catch(l){if(l instanceof a)throw l;return[!0]}}case"isvalid":{if(n.length<1)return[!0];try{return[s(e,n[0],r).length>0]}catch(l){if(l instanceof a)throw l;return[!1]}}case"skip":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("skip doesn't support negative count");return s(e,n[1],r).slice(u)});case"until":{if(n.length<2)return[e];let l=e,c=r.limits.maxIterations;for(let u=0;u<c;u++){if(s(l,n[0],r).some(o))return[l];let d=s(l,n[1],r);if(d.length===0)return[l];l=d[0]}throw new a(`jq until: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(n.length<2)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u&&s(c,n[0],r).some(o);f++){l.push(c);let p=s(c,n[1],r);if(p.length===0)break;c=p[0]}if(l.length>=u)throw new a(`jq while: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}case"repeat":{if(n.length===0)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u;f++){l.push(c);let d=s(c,n[0],r);if(d.length===0)break;c=d[0]}if(l.length>=u)throw new a(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var kg=M(()=>{"use strict"});function Xu(e,t){if(!Number.isFinite(e)||Math.abs(e)>864e10)throw new Error(`${t} timestamp is outside the supported range`);return new Date(e*1e3)}function Ig(e){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(!t)return null;let[,n,r,s,i,o,a]=t.map(Number),l=Date.UTC(n,r-1,s,i,o,a);if(!Number.isFinite(l))return null;let c=new Date(l);return c.getUTCFullYear()!==n||c.getUTCMonth()!==r-1||c.getUTCDate()!==s||c.getUTCHours()!==i||c.getUTCMinutes()!==o||c.getUTCSeconds()!==a?null:c}function Yu(e,t,n,r,s){switch(t){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let i=Xu(e,"gmtime"),o=i.getUTCFullYear(),a=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),d=i.getUTCDay(),p=Date.UTC(o,0,1),h=Math.floor((i.getTime()-p)/(1440*60*1e3));return[[o,a,l,c,u,f,d,h]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[i,o,a,l=0,c=0,u=0]=e;if(typeof i!="number"||typeof o!="number")throw new Error("mktime requires parsed datetime inputs");let f=Date.UTC(i,o,a??1,l??0,c??0,u??0);return[Math.floor(f/1e3)]}case"strftime":{if(n.length===0)return[null];let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strftime/1 requires a string format");let a;if(typeof e=="number")a=Xu(e,"strftime");else if(Array.isArray(e)){let[d,p,h,m=0,g=0,b=0]=e;if(typeof d!="number"||typeof p!="number")throw new Error("strftime/1 requires parsed datetime inputs");a=new Date(Date.UTC(d,p,h??1,m??0,g??0,b??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],u=(d,p=2)=>String(d).padStart(p,"0");return[o.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,u(a.getUTCMonth()+1)).replace(/%d/g,u(a.getUTCDate())).replace(/%H/g,u(a.getUTCHours())).replace(/%M/g,u(a.getUTCMinutes())).replace(/%S/g,u(a.getUTCSeconds())).replace(/%A/g,l[a.getUTCDay()]).replace(/%B/g,c[a.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(n.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strptime/1 requires a string format");if(o!==Ng)throw new Error(`strptime format is not supported: ${o}`);let a=Ig(e);if(a){let l=a.getUTCFullYear(),c=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCHours(),d=a.getUTCMinutes(),p=a.getUTCSeconds(),h=a.getUTCDay(),m=Date.UTC(l,0,1),g=Math.floor((a.getTime()-m)/(1440*60*1e3));return[[l,c,u,f,d,p,h,g]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let i=Ig(e);if(!i)throw new Error(`date "${e}" does not match format "${Ng}"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[Xu(e,"todate").toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var Ng,Og=M(()=>{"use strict";Ng="%Y-%m-%dT%H:%M:%SZ"});function Hn(e){return e!==!1&&e!==null}function Si(e,t){return JSON.stringify(e)===JSON.stringify(t)}function wo(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function Tg(e,t,n={}){let r=n.maxDepth??2e3,s=Dt(e),i=[{target:s,source:t,depth:0}];for(;i.length>0;){let o=i.pop();if(!o)break;if(o.depth>r)throw new C(`query depth limit exceeded (${r})`,"recursion");for(let a of Object.keys(o.source)){if(n.visit?.(),!qe(a))continue;let l=Cs(o.target,a)?Je(o.target[a]):null,c=Je(o.source[a]);if(l&&c){let u=Dt(l);Ze(o.target,a,u),i.push({target:u,source:c,depth:o.depth+1})}else Ze(o.target,a,o.source[a])}}return s}function Mr(e,t=3e3){if(e===null||typeof e!="object")return 0;if(t<=1)return t;let n=(c,u)=>({value:c,keys:Array.isArray(c)?void 0:Object.keys(c),nextChild:0,pathDepth:u,maxChildDepth:0}),r=c=>c.keys!==void 0?c.keys.length:c.value.length,s=c=>{if(c.keys){let u=c.keys[c.nextChild++];return c.value[u]}return c.value[c.nextChild++]},i=new WeakMap,o=new WeakMap,a=e,l=[n(a,1)];for(i.set(a,"visiting");l.length>0;){let c=l[l.length-1];if(c.nextChild<r(c)){let d=s(c);if(d===null||typeof d!="object")continue;let p=i.get(d);if(p==="visiting")return t;if(p==="done"){let g=o.get(d)??0;if(c.pathDepth+g>=t)return t;c.maxChildDepth=Math.max(c.maxChildDepth,g);continue}let h=c.pathDepth+1;if(h>=t)return t;let m=d;i.set(d,"visiting"),l.push(n(m,h));continue}let u=c.maxChildDepth+1;o.set(c.value,u),i.set(c.value,"done"),l.pop();let f=l.at(-1);if(f)f.maxChildDepth=Math.max(f.maxChildDepth,u);else return u}return 0}function za(e,t){let n=a=>a===null?0:typeof a=="boolean"?1:typeof a=="number"?2:typeof a=="string"?3:Array.isArray(a)?4:typeof a=="object"?5:6,r=n(e),s=n(t);if(r!==s)return r-s;if(typeof e=="number"&&typeof t=="number")return e-t;if(typeof e=="string"&&typeof t=="string")return e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return(e?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let a=0;a<Math.min(e.length,t.length);a++){let l=za(e[a],t[a]);if(l!==0)return l}return e.length-t.length}let i=Je(e),o=Je(t);if(i&&o){let a=Object.keys(i).sort(),l=Object.keys(o).sort();for(let c=0;c<Math.min(a.length,l.length);c++){let u=a[c].localeCompare(l[c]);if(u!==0)return u}if(a.length!==l.length)return a.length-l.length;for(let c of a){let u=za(i[c],o[c]);if(u!==0)return u}}return 0}function Wa(e,t){if(Si(e,t))return!0;if(typeof e=="string"&&typeof t=="string")return e.includes(t);if(Array.isArray(e)&&Array.isArray(t))return t.every(s=>e.some(i=>Wa(i,s)));let n=Je(e),r=Je(t);return n&&r?Object.keys(r).every(s=>Cs(n,s)&&Wa(n[s],r[s])):!1}var bo=M(()=>{"use strict";Z();sr()});function MS(e){let t=[];for(let r=0;r<e.length;r+=32768){let s=Math.min(r+32768,e.length),i="";for(let o=r;o<s;o++)i+=String.fromCharCode(e[o]);t.push(i)}return t.join("")}function _S(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function Ju(e,t,n){switch(t){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(MS(r))]}return[null];case"@base64d":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"base64").toString("utf-8")];let r=_S(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 i=String(s);return i.includes(",")||i.includes('"')||i.includes(`
576
+ `)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).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=n??FS;return Mr(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}}var FS,Rg=M(()=>{"use strict";bo();FS=2e3});function ef(e,t,n,r,s,i){switch(t){case"index":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){if(a===""&&e==="")return null;let l=e.indexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let c=0;c<=e.length-a.length;c++){let u=!0;for(let f=0;f<a.length;f++)if(!i(e[c+f],a[f])){u=!1;break}if(u)return c}return null}let l=e.findIndex(c=>i(c,a));return l>=0?l:null}return null});case"rindex":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){let l=e.lastIndexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let l=e.length-a.length;l>=0;l--){let c=!0;for(let u=0;u<a.length;u++)if(!i(e[l+u],a[u])){c=!1;break}if(c)return l}return null}for(let l=e.length-1;l>=0;l--)if(i(e[l],a))return l;return null}return null});case"indices":return n.length===0?[[]]:s(e,n[0],r).map(a=>{let l=[];if(typeof e=="string"&&typeof a=="string"){let c=e.indexOf(a);for(;c!==-1;)l.push(c),c=e.indexOf(a,c+1)}else if(Array.isArray(e))if(Array.isArray(a)){let c=a.length;if(c===0)for(let u=0;u<=e.length;u++)l.push(u);else for(let u=0;u<=e.length-c;u++){let f=!0;for(let d=0;d<c;d++)if(!i(e[u+d],a[d])){f=!1;break}f&&l.push(u)}}else for(let c=0;c<e.length;c++)i(e[c],a)&&l.push(c);return l});default:return null}}var $g=M(()=>{"use strict"});function tf(e,t,n,r,s){switch(t){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(n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[a**l]}case"atan2":{if(n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[Math.atan2(a,l)]}case"hypot":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.hypot(e,i)]}case"fma":{if(typeof e!="number"||n.length<2)return[null];let i=s(e,n[0],r)[0],o=s(e,n[1],r)[0];return[e*i+o]}case"copysign":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.sign(i)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e-Math.round(e/i)*i]}case"fdim":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(0,e-i)]}case"fmax":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(e,i)]}case"fmin":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.min(e,i)]}case"ldexp":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}case"scalbn":case"scalbln":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}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 i=Math.floor(Math.log2(Math.abs(e)));return[e/2**i]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let i=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**i,i]]}return[null];case"modf":if(typeof e=="number"){let i=Math.trunc(e);return[[e-i,i]]}return[null];default:return null}}var Pg=M(()=>{"use strict"});function Ai(e){let t=e.limits.maxIterations;return{maxDepth:e.limits.maxDepth,maxResults:e.limits.maxArrayElements,maxIterations:t}}function Ci(e){throw new C(e,"array_elements")}function nf(e,t){let n=1;for(let r of e){if(!Number.isSafeInteger(r)||r<0)throw new Error("combinations requires finite array lengths");r!==0&&n>Math.floor(t/r)&&Ci(`query combination limit exceeded (${t})`),n*=r}return n}function rf(e,t,n,r,s,i,o,a){switch(t){case"recurse":{let l=[],c=Ai(r),u=n.length>=2?n[1]:null,f=[{value:e,depth:0}],d=0;for(;f.length>0;){let p=f.pop();if(!p)break;if(++d>c.maxIterations)throw new C(`query iteration limit exceeded (${c.maxIterations})`,"iterations");if(p.depth>c.maxDepth)throw new C(`query depth limit exceeded (${c.maxDepth})`,"recursion");if(u&&!s(p.value,u,r).some(i))continue;l.length>=c.maxResults&&Ci(`query result element limit exceeded (${c.maxResults})`),l.push(p.value);let h=[];n.length===0?Array.isArray(p.value)?h=p.value:p.value&&typeof p.value=="object"&&(h=Object.keys(p.value).map(m=>p.value[m])):h=s(p.value,n[0],r).filter(m=>m!=null),f.length>c.maxResults-h.length&&Ci(`query traversal queue limit exceeded (${c.maxResults})`);for(let m=h.length-1;m>=0;m--)f.push({value:h[m],depth:p.depth+1})}return l}case"recurse_down":return a(e,"recurse",n,r);case"walk":{if(n.length===0)return[e];let l=Ai(r),c=new WeakSet,u=new WeakMap,f=[{value:e,depth:0,expanded:!1}],d=e,p=0;for(;f.length>0;){let h=f.pop();if(!h)break;if(++p>l.maxIterations)throw new C(`query iteration limit exceeded (${l.maxIterations})`,"iterations");if(h.depth>l.maxDepth)throw new C(`query depth limit exceeded (${l.maxDepth})`,"recursion");let m=h.value!==null&&typeof h.value=="object"?h.value:null;if(!h.expanded&&m){if(c.has(m))continue;c.add(m),f.push({...h,expanded:!0});let w=Je(h.value),y=Array.isArray(h.value)?h.value:Object.keys(w??{}).map(x=>w?.[x]);f.length>l.maxResults-y.length&&Ci(`query traversal queue limit exceeded (${l.maxResults})`);for(let x=y.length-1;x>=0;x--)f.push({value:y[x],depth:h.depth+1,expanded:!1});continue}let g=h.value;if(Array.isArray(h.value))g=h.value.map(w=>w!==null&&typeof w=="object"?u.get(w)??w:w);else if(m){let w=Object.create(null),y=Je(h.value);for(let x of Object.keys(y??{})){if(!qe(x))continue;let S=y?.[x];Ze(w,x,S!==null&&typeof S=="object"?u.get(S)??S:S)}g=w}let b=s(g,n[0],r)[0];m&&u.set(m,b),h.depth===0&&(d=b)}return[d]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let l=Ai(r),c=0;for(let f of e)Array.isArray(f)&&(c=Math.max(c,f.length));nf([e.length,c],l.maxResults);let u=[];for(let f=0;f<c;f++)u.push(e.map(d=>Array.isArray(d)?d[f]:null));return[u]}case"combinations":{if(n.length>0){let h=s(e,n[0],r)[0];if(!Array.isArray(e))return[];if(!Number.isFinite(h)||!Number.isSafeInteger(h)||h<0)throw new Error("combinations length must be a finite non-negative integer");let m=Ai(r);if(h>m.maxDepth||h>m.maxResults)throw new C(`query depth limit exceeded (${m.maxDepth})`,"recursion");if(h===0)return m.maxResults<1&&Ci("query combination limit exceeded (0)"),[[]];let g=nf(Array.from({length:h},()=>e.length),m.maxResults);if(g===0)return[];let b=[],w=new Array(h).fill(0);for(let y=0;y<g;y++){b.push(w.map(x=>e[x]));for(let x=h-1;x>=0&&(w[x]++,!(w[x]<e.length));x--)w[x]=0}return b}if(!Array.isArray(e))return[];if(e.length===0)return Ai(r).maxResults<1&&Ci("query combination limit exceeded (0)"),[[]];for(let p of e)if(!Array.isArray(p))return[];let l=Ai(r),c=e;if(c.length>l.maxDepth)throw new C(`query depth limit exceeded (${l.maxDepth})`,"recursion");let u=nf(c.map(p=>p.length),l.maxResults);if(u===0)return[];let f=[],d=new Array(c.length).fill(0);for(let p=0;p<u;p++){f.push(d.map((h,m)=>c[m][h]));for(let h=c.length-1;h>=0&&(d[h]++,!(d[h]<c[h].length));h--)d[h]=0}return f}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let l=r.currentPath;if(l.length===0)return[];let c=n.length>0?s(e,n[0],r)[0]:1;if(c>=0){if(c>l.length)return[];let u=l.slice(0,l.length-c);return[o(r.root,u)]}else{let u=-c-1;if(u>=l.length)return[e];let f=l.slice(0,u);return[o(r.root,f)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let l=r.currentPath,c=[];for(let u=l.length-1;u>=0;u--)c.push(o(r.root,l.slice(0,u)));return[c]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var Dg=M(()=>{"use strict";Z();sr()});function On(e){return e.limits.maxArrayElements}function ja(e,t){let n=On(e);if(t>=n)throw new C(`query result element limit exceeded (${n})`,"array_elements")}function BS(e,t){let n=t.limits.maxDepth??sf;if(e.length>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let r=t.limits.maxArrayElements;for(let s of e)if(typeof s=="number"){if(!Number.isSafeInteger(s)||s<0||s>=r)throw new C(`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 of(e,t,n,r,s){switch(t){case"keys":return Array.isArray(e)?[e.map((i,o)=>o)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((i,o)=>o)]: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[U(e)];let i=e===null?"null":Array.isArray(e)?"array":typeof e,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) only strings have UTF-8 byte length`)}case"to_entries":{let i=Je(e);if(i){let o=Object.keys(i);if(o.length>On(r))throw new C(`query result element limit exceeded (${On(r)})`,"array_elements");return[o.map(a=>{let l=Object.create(null);return Ze(l,"key",a),Ze(l,"value",i[a]),l})]}return[null]}case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let o of e){let a=Je(o);if(a){let l=a.key??a.Key??a.name??a.Name??a.k,c=a.value??a.Value??a.v;if(l!==void 0){let u=String(l);qe(u)&&Ze(i,u,c)}}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];let i=Je(e);if(i){let o=Object.keys(i);if(o.length>On(r))throw new C(`query result element limit exceeded (${On(r)})`,"array_elements");let a=[];for(let c of o){let u=Object.create(null);Ze(u,"key",c),Ze(u,"value",i[c]);let f=s(u,n[0],r);if(a.length>On(r)-f.length)throw new C(`query result element limit exceeded (${On(r)})`,"array_elements");for(let d of f)a.push(d)}let l=Object.create(null);for(let c of a){let u=Je(c);if(u){let f=u.key??u.name??u.k,d=u.value??u.v;if(f!==void 0){let p=String(f);qe(p)&&Ze(l,p,d)}}}return[l]}return[null]}case"reverse":return Array.isArray(e)?[[...e].reverse()]:typeof e=="string"?[e.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(e)?(n.length>0?s(e,n[0],r):[Number.POSITIVE_INFINITY]).map(o=>{let a=o;if(a<0)throw new Error("flatten depth must not be negative");return e.flat(a)}):[null];case"unique":if(Array.isArray(e)){let i=new Set,o=[];for(let a of e){let l=JSON.stringify(a);i.has(l)||(i.add(l),o.push(a))}return[o]}return[null];case"tojson":case"tojsonstream":{let i=r.limits.maxDepth??sf;return Mr(e,i+1)>i?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let i=e.trim().toLowerCase();if(i==="nan")return[Number.NaN];if(i==="inf"||i==="infinity")return[Number.POSITIVE_INFINITY];if(i==="-inf"||i==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[di(JSON.parse(e),{maxDepth:r.limits.maxDepth,maxElements:r.limits.maxArrayElements})]}catch(o){throw o instanceof C?o: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 i=Number(e);if(Number.isNaN(i))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[i]}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 i=e===null?"null":Array.isArray(e)?"array":typeof e,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) cannot be parsed as a boolean`)}case"tostream":{let i=[],o=r.limits.maxDepth??sf,a=[{value:e,path:[]}],l=new WeakSet,c=0;for(;a.length>0;){let u=a.pop();if(!u)break;if(++c>r.limits.maxIterations)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");if(u.path.length>o)throw new C(`query depth limit exceeded (${o})`,"recursion");let f=u.value;if(f===null||typeof f!="object")ja(r,i.length),i.push([u.path,f]);else if(Array.isArray(f)){if(l.has(f))throw new C("cyclic value cannot be converted to a stream","recursion");if(l.add(f),f.length===0)ja(r,i.length),i.push([u.path,[]]);else{if(a.length>On(r)-f.length)throw new C(`query traversal queue limit exceeded (${On(r)})`,"array_elements");for(let d=f.length-1;d>=0;d--)a.push({value:f[d],path:[...u.path,d]})}}else{if(l.has(f))throw new C("cyclic value cannot be converted to a stream","recursion");l.add(f);let d=Object.keys(f);if(d.length===0)ja(r,i.length),i.push([u.path,Object.create(null)]);else{if(a.length>On(r)-d.length)throw new C(`query traversal queue limit exceeded (${On(r)})`,"array_elements");for(let p=d.length-1;p>=0;p--){let h=d[p];a.push({value:f[h],path:[...u.path,h]})}}}}return ja(r,i.length),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r);if(i.length>On(r))throw new C(`query stream item limit exceeded (${On(r)})`,"array_elements");let o=null,a=0;for(let l of i){if(!Array.isArray(l)||l.length===1&&Array.isArray(l[0])&&l[0].length===0||l.length!==2)continue;let[c,u]=l;if(!Array.isArray(c))continue;if(BS(c,r),c.length===0){o=u;continue}o===null&&(o=typeof c[0]=="number"?[]:Object.create(null));let f=o;for(let p=0;p<c.length-1;p++){let h=c[p],m=c[p+1];if(Array.isArray(f)&&typeof h=="number"){let g=h+1-f.length;if(g>r.limits.maxIterations-a)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(a+=Math.max(0,g);f.length<=h;)f.push(null);f[h]===null&&(f[h]=typeof m=="number"?[]:Object.create(null)),f=f[h]}else{let g=Je(f);if(g){let b=String(h);if(!qe(b))continue;(g[b]===null||g[b]===void 0)&&Ze(g,b,typeof m=="number"?[]:Object.create(null)),f=g[b]}}}let d=c[c.length-1];if(Array.isArray(f)&&typeof d=="number"){let p=d+1-f.length;if(p>r.limits.maxIterations-a)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(a+=Math.max(0,p);f.length<=d;)f.push(null);f[d]=u}else{let p=Je(f);if(p){let h=String(d);qe(h)&&Ze(p,h,u)}}}return[o]}case"truncate_stream":{let i=typeof e=="number"?Math.floor(e):0;if(n.length===0)return[];let o=[],a=s(e,n[0],r);for(let l of a)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let c=l[0];c.length>i&&o.push([c.slice(i)]);continue}if(l.length===2&&Array.isArray(l[0])){let c=l[0],u=l[1];c.length>i&&o.push([c.slice(i),u])}}return o}default:return null}}var sf,Lg=M(()=>{"use strict";ce();Z();sr();bo();sf=2e3});function Fg(e,t){if(!Array.isArray(e))throw new Error("path must be an array");let n=t.limits.maxDepth;if(e.length>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let r=t.limits.maxArrayElements,s=0;for(let i of e)if(typeof i=="number"){if(!Number.isSafeInteger(i)||i<0||i>=r)throw new C(`query array index limit exceeded (${r})`,"array_elements");let o=i+1;if(s>r-o)throw new C(`query cumulative array allocation limit exceeded (${r})`,"array_elements");s+=o}else if(typeof i!="string")throw new Error("path components must be strings or integers");return wn(t,s+e.length),e}function Mg(e,t,n){let r=[],s=[{value:e,path:[],isRoot:!0}];for(;s.length>0;){let i=s.pop();if(!i)break;if(wn(t),i.path.length>t.limits.maxDepth)throw new C(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");if(!(i.value!==null&&typeof i.value=="object")){(n||!i.isRoot)&&(Lt(t,r.length),r.push(i.path));continue}!n&&!i.isRoot&&(Lt(t,r.length),r.push(i.path));let a=Array.isArray(i.value)?i.value.map((l,c)=>[c,l]):Object.keys(i.value).map(l=>[l,i.value[l]]);Lt(t,r.length,s.length+a.length);for(let l=a.length-1;l>=0;l--){let[c,u]=a[l],f=[...i.path,c];s.push({value:u,path:f,isRoot:!1})}}return r}function af(e,t,n,r,s,i,o,a,l,c){switch(t){case"getpath":{if(n.length===0)return[null];let u=s(e,n[0],r),f=[];for(let d of u){let p=d,h=e;for(let m of p){if(h==null){h=null;break}if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof m=="string"){let g=Je(h);if(!g||!Object.hasOwn(g,m)){h=null;break}h=g[m]}else{h=null;break}}f.push(h)}return f}case"setpath":{if(n.length<2)return[null];let u=s(e,n[0],r),f=Fg(u[0],r),p=s(e,n[1],r)[0];return[o(e,f,p)]}case"delpaths":{if(n.length===0)return[e];let f=s(e,n[0],r)[0],d=e;for(let p of f.sort((h,m)=>m.length-h.length))d=a(d,p);return[d]}case"path":{if(n.length===0)return[[]];let u=[];return c(e,n[0],r,[],u),u}case"del":return n.length===0?[e]:[l(e,n[0],r)];case"pick":{if(n.length===0)return[null];let u=[];for(let d of n)c(e,d,r,[],u);let f=null;for(let d of u){for(let h of d)if(typeof h=="number"&&h<0)throw new Error("Out of bounds negative array index");Fg(d,r);let p=e;for(let h of d){if(p==null)break;if(Array.isArray(p)&&typeof h=="number")p=p[h];else if(typeof h=="string"){let m=Je(p);if(!m||!Object.hasOwn(m,h)){p=null;break}p=m[h]}else{p=null;break}}f=o(f,d,p)}return[f]}case"paths":{let u=Mg(e,r,!1);return n.length>0?u.filter(f=>{let d=e;for(let h of f)if(Array.isArray(d)&&typeof h=="number")d=d[h];else if(typeof h=="string"){let m=Je(d);if(!m||!Object.hasOwn(m,h))return!1;d=m[h]}else return!1;return s(d,n[0],r).some(i)}):u}case"leaf_paths":return Mg(e,r,!0);default:return null}}var _g=M(()=>{"use strict";Z();lf();sr()});function cf(e,t,n,r,s,i){switch(t){case"IN":{if(n.length===0)return[!1];if(n.length===1){let c=s(e,n[0],r);for(let u of c)if(i(e,u))return[!0];return[!1]}let o=s(e,n[0],r),a=s(e,n[1],r),l=new Set(a.map(c=>JSON.stringify(c)));for(let c of o)if(l.has(JSON.stringify(c)))return[!0];return[!1]}case"INDEX":{if(n.length===0)return[Object.create(null)];if(n.length===1){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=String(u);qe(f)&&Ze(c,f,u)}return[c]}if(n.length===2){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=s(u,n[1],r);if(f.length>0){let d=String(f[0]);qe(d)&&Ze(c,d,u)}}return[c]}let o=s(e,n[0],r),a=Object.create(null);for(let l of o){let c=s(l,n[1],r),u=s(l,n[2],r);if(c.length>0&&u.length>0){let f=String(c[0]);qe(f)&&Ze(a,f,u[0])}}return[a]}case"JOIN":{if(n.length<2)return[null];let o=Je(s(e,n[0],r)[0]);if(!o)return[null];if(!Array.isArray(e))return[null];let a=[];for(let l of e){let c=s(l,n[1],r),u=c.length>0?String(c[0]):"",f=Cs(o,u)?o[u]:null;a.push([l,f])}return[a]}default:return null}}var Bg=M(()=>{"use strict";sr()});function zg(e){return e.limits.maxArrayElements}function Ug(e){return Math.min(e.limits.maxStringLength,e.limits.maxOutputSize)}function Ts(e,t){let n=zg(e);if(!Number.isSafeInteger(t)||t<0||t>n)throw new C(`query result element limit exceeded (${n})`,"array_elements")}function US(e,t,n){if(e==="")return t===""?0:1;if(t==="")return e.length;let r=1,s=0;for(;;){let i=e.indexOf(t,s);if(i<0||(r++,r>n))return r;s=i+t.length}}function uf(e,t,n,r,s){switch(t){case"join":{if(!Array.isArray(e))return[null];let i=n.length>0?s(e,n[0],r):[""];for(let o of e)if(Array.isArray(o)||o!==null&&typeof o=="object")throw new Error("cannot join: contains arrays or objects");return Ts(r,i.length),i.map(o=>{let a=String(o),l=0;for(let c=0;c<e.length;c++){let u=e[c]===null?"":typeof e[c]=="string"?e[c]:String(e[c]);if(l+=U(u),c>0&&(l+=U(a)),l>Ug(r))throw new C(`query string size limit exceeded (${Ug(r)} bytes)`,"string_length")}return e.map(c=>c===null?"":typeof c=="string"?c:String(c)).join(a)})}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);return Ts(r,US(e,o,zg(r))),[e.split(o)]}case"splits":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"g",l=ie(o,a.includes("g")?a:`${a}g`),c=1;for(let f of l.matchAll(e))c+=Math.max(1,f.length),Ts(r,c);let u=l.split(e);return Ts(r,u.length),u}catch(a){if(a instanceof C)throw a;return[]}}case"scan":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",l=ie(o,a.includes("g")?a:`${a}g`),c=[];for(let u of l.matchAll(e))Ts(r,c.length+1),u.length>1?(Ts(r,u.length-1),c.push(u.slice(1))):c.push(u[0]);return c}catch(a){if(a instanceof C)throw a;return[]}}case"test":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[ie(o,a).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=ie(o,`${a}d`).exec(e);if(!c)return[];let u=c.indices;return[{offset:c.index,length:c[0].length,string:c[0],captures:c.slice(1).map((f,d)=>({offset:u?.[d+1]?.[0]??null,length:f?.length??0,string:f??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=ie(o,a).match(e);return!c||!c.groups?[Object.create(null)]:[c.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"";return[ie(a,c).replace(e,l)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"g",u=c.includes("g")?c:`${c}g`;return[ie(a,u).replace(e,l)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,i=>String.fromCharCode(i.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return[e.startsWith(o)?e.slice(o.length):e]}case"rtrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return o===""?[e]:[e.endsWith(o)?e.slice(0,-o.length):e]}case"trimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);if(o==="")return[e];let a=e;return a.startsWith(o)&&(a=a.slice(o.length)),a.endsWith(o)&&(a=a.slice(0,-o.length)),[a]}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"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.startsWith(String(i[0]))]}case"endswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.endsWith(String(i[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":if(typeof e=="string"){let i=0;for(let o of e)i++,Ts(r,i);return[Array.from(e).map(o=>o.codePointAt(0))]}return[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(a=>{if(typeof a=="string")throw new Error(`string (${JSON.stringify(a)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof a!="number"||Number.isNaN(a))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let l=Math.trunc(a);return l<0||l>1114111||l>=55296&&l<=57343?String.fromCodePoint(65533):String.fromCodePoint(l)}).join("")];default:return null}}var Wg=M(()=>{"use strict";Z();pt();St()});function ff(e,t){switch(t){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}}var jg=M(()=>{"use strict"});var Hg=M(()=>{"use strict";vg();kg();Og();Rg();$g();Pg();Dg();Lg();_g();Bg();Wg();jg()});function Ha(e,t,n){if(t.length===0)return n;let[r,...s]=t;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 c=Array.isArray(e)?[...e]:[];for(;c.length<=r;)c.push(null);return c[r]=Ha(c[r],s,n),c}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!qe(r))return e??Object.create(null);let i=Je(e),o=i?Dt(i):Object.create(null),a=Object.hasOwn(o,r)?o[r]:void 0;return Ze(o,r,Ha(a,s,n)),o}function Va(e,t){if(t.length===0)return null;if(t.length===1){let s=t[0];if(Array.isArray(e)&&typeof s=="number"){let i=[...e];return i.splice(s,1),i}if(e&&typeof e=="object"&&!Array.isArray(e)){let i=String(s);if(!qe(i))return e;let o=Dt(e);return delete o[i],o}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n=="number"){let s=[...e];return s[n]=Va(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!qe(s))return e;let i=Dt(e);return Object.hasOwn(i,s)&&Ze(i,s,Va(i[s],r)),i}return e}var Vg=M(()=>{"use strict";sr()});function $s(e,t){return new C(e,t)}function wn(e,t=1){if(!Number.isSafeInteger(t)||t<0||e.budget.operations>e.limits.maxIterations-t)throw $s(`query evaluation: too many iterations (${e.limits.maxIterations})`,"iterations");e.budget.operations+=t}function Lt(e,t,n=1){let r=e.limits.maxArrayElements;if(!Number.isSafeInteger(t)||!Number.isSafeInteger(n)||t<0||n<0||t>r-n)throw $s(`query result element limit exceeded (${r})`,"array_elements")}function Rs(e,t,n){Lt(e,t.length,n.length);for(let r of n)t.push(r)}function Vn(e,t,n){let r=[];for(let s of t){wn(e);let i=n(s);Rs(e,r,i)}return r}function jS(e){let t=new Map;if(e?.namedArgs)for(let[n,r]of e.namedArgs)t.set(`$${n}`,r);return{vars:t,limits:{maxIterations:e?.limits?.maxIterations??zS,maxDepth:e?.limits?.maxDepth??Kg,maxStringLength:e?.limits?.maxStringLength??Gg,maxOutputSize:e?.limits?.maxOutputSize??Gg,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 Za(e,t,n){let r=new Map(e.vars);return r.set(t,n),{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 xo(e,t,n){switch(t.type){case"var":return Za(e,t.name,n);case"array":{if(!Array.isArray(n))return null;let r=e;for(let s=0;s<t.elements.length;s++){let i=t.elements[s],o=s<n.length?n[s]:null,a=xo(r,i,o);if(a===null)return null;r=a}return r}case"object":{let r=Je(n);if(!r)return null;let s=e;for(let i of t.fields){let o;if(typeof i.key=="string")o=i.key;else{let c=ne(n,i.key,e);if(c.length===0)return null;o=String(c[0])}let a=Cs(r,o)?r[o]:null;i.keyVar&&(s=Za(s,i.keyVar,a));let l=xo(s,i.pattern,a);if(l===null)return null;s=l}return s}}}function HS(e,t){let n=e;for(let r of t)if(n&&typeof n=="object")if(Array.isArray(n))if(typeof r=="number")n=n[r];else return;else{let s=Je(n);if(s&&typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function Xr(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?Xr(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?Xr(e.base):[];if(t===null)return null;let n=e.index.value;return typeof n=="number"||typeof n=="string"?[...t,n]:null}if(e.type==="Pipe"){let t=Xr(e.left);return t===null?null:df(t,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 df(e,t){if(t.type==="Call"){if(t.name==="parent"){let n=1;if(t.args.length>0&&t.args[0].type==="Literal"){let r=t.args[0].value;typeof r=="number"&&(n=r)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let r=-n-1;return e.slice(0,Math.min(r,e.length))}}if(t.name==="root")return[]}if(t.type==="Field"){let n=Xr(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=Xr(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=df(e,t.left);return n===null?null:df(n,t.right)}return t.type==="Identity"?e:null}function qg(e,t,n){if(t.type==="Comma"){let r=[];try{let s=ne(e,t.left,n);Rs(n,r,s)}catch(s){if(s instanceof C)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{let s=ne(e,t.right,n);Rs(n,r,s)}catch(s){if(s instanceof C)throw s;return r}return r}return ne(e,t,n)}function ne(e,t,n){let r=n&&"vars"in n?n:jS(n);if(r.defenseContextChecked||(Ct(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),wn(r),r.budget.callDepth++,r.budget.callDepth>r.limits.maxDepth)throw r.budget.callDepth--,$s(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");try{let s=VS(e,t,r);return Lt(r,0,s.length),s}finally{r.budget.callDepth--}}function VS(e,t,n){switch(n.coverage?.hit(`jq:node:${t.type}`),t.type){case"Identity":return[e];case"Field":{let r=t.base?ne(e,t.base,n):[e];return Vn(n,r,s=>{let i=Je(s);if(i){if(!Object.hasOwn(i,t.name))return[null];let a=i[t.name];return[a===void 0?null:a]}if(s===null)return[null];let o=Array.isArray(s)?"array":typeof s;throw new Error(`Cannot index ${o} with string "${t.name}"`)})}case"Index":{let r=t.base?ne(e,t.base,n):[e];return Vn(n,r,s=>{let i=ne(s,t.index,n);return Vn(n,i,o=>{if(typeof o=="number"&&Array.isArray(s)){if(Number.isNaN(o))return[null];let a=Math.trunc(o),l=a<0?s.length+a:a;return l>=0&&l<s.length?[s[l]]:[null]}if(typeof o=="string"){let a=Je(s);return!a||!Object.hasOwn(a,o)?[null]:[a[o]]}return[null]})})}case"Slice":{let r=t.base?ne(e,t.base,n):[e];return Vn(n,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 i=s.length,o=t.start?ne(e,t.start,n):[0],a=t.end?ne(e,t.end,n):[i];return Lt(n,0,o.length*a.length),Vn(n,o,l=>a.map(c=>{let u=l,f=c,d=Number.isNaN(u)?0:Number.isInteger(u)?u:Math.floor(u),p=Number.isNaN(f)?i:Number.isInteger(f)?f:Math.ceil(f),h=Zg(d,i),m=Zg(p,i);return Array.isArray(s),s.slice(h,m)}))})}case"Iterate":{let r=t.base?ne(e,t.base,n):[e];return Vn(n,r,s=>Array.isArray(s)?s:s&&typeof s=="object"?Object.values(s):[])}case"Pipe":{let r=ne(e,t.left,n),s=Xr(t.left),i=[];for(let o of r)try{if(s!==null){let a={...n,currentPath:[...n.currentPath??[],...s]},l=ne(o,t.right,a);Rs(n,i,l)}else{let a=ne(o,t.right,n);Rs(n,i,a)}}catch(a){throw a instanceof vi?a.withPrependedResults(i):a}return i}case"Comma":{let r=ne(e,t.left,n),s=ne(e,t.right,n);return Lt(n,r.length,s.length),[...r,...s]}case"Literal":return[t.value];case"Array":return t.elements?[ne(e,t.elements,n)]:[[]];case"Object":{let r=[Object.create(null)];for(let s of t.entries){let i=typeof s.key=="string"?[s.key]:ne(e,s.key,n),o=ne(e,s.value,n),a=[],l=i.filter(f=>typeof f=="string"&&qe(f)).length,c=l+(i.length-l),u=r.length*c*o.length;Lt(n,0,u);for(let f of r)for(let d of i){if(typeof d!="string"){let p=d===null?"null":Array.isArray(d)?"array":typeof d;throw new Error(`Cannot use ${p} (${JSON.stringify(d)}) as object key`)}if(!qe(d)){for(let p of o)a.push(Dt(f));continue}for(let p of o){let h=Dt(f);Ze(h,d,p),a.push(h)}}r.length=0,Rs(n,r,a)}return r}case"Paren":return ne(e,t.expr,n);case"BinaryOp":return ZS(e,t.op,t.left,t.right,n);case"UnaryOp":return ne(e,t.operand,n).map(s=>{if(t.op==="-"){if(typeof s=="number")return-s;if(typeof s=="string"){let i=o=>o.length>5?`"${o.slice(0,3)}...`:JSON.stringify(o);throw new Error(`string (${i(s)}) cannot be negated`)}return null}return t.op==="not"?!Hn(s):null});case"Cond":{let r=ne(e,t.cond,n);return Vn(n,r,s=>{if(Hn(s))return ne(e,t.then,n);for(let i of t.elifs)if(ne(e,i.cond,n).some(Hn))return ne(e,i.then,n);return t.else?ne(e,t.else,n):[e]})}case"Try":try{return ne(e,t.body,n)}catch(r){if(r instanceof C)throw r;if(t.catch){let s=r instanceof qa?r.value:r instanceof Error?r.message:String(r);return ne(s,t.catch,n)}return[]}case"Call":return Qg(e,t.name,t.args,n);case"VarBind":{let r=ne(e,t.value,n);return Vn(n,r,s=>{let i=null,o=[];if(t.pattern?o.push(t.pattern):t.name&&o.push({type:"var",name:t.name}),t.alternatives)for(let a of t.alternatives)o.push(a);for(let a of o)if(i=xo(n,a,s),i!==null)break;return i===null?[]:ne(e,t.body,i)})}case"VarRef":{if(t.name==="$ENV")return[n.env?Ht(n.env):Object.create(null)];if(t.name==="$ARGS"){let s=Object.create(null);if(n.namedArgs)for(let[o,a]of n.namedArgs)Object.defineProperty(s,o,{value:a,enumerable:!0,writable:!0,configurable:!0});let i=Object.create(null);return i.positional=n.positionalArgs?[...n.positionalArgs]:[],i.named=s,[i]}let r=n.vars.get(t.name);return r!==void 0?[r]:[null]}case"Recurse":{let r=[],s=new WeakSet,i=[{val:e,depth:0}];for(;i.length>0;){let o=i.pop();if(!o)break;let{val:a,depth:l}=o;if(wn(n),l>n.limits.maxDepth)throw $s(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");if(a&&typeof a=="object"){if(s.has(a))continue;s.add(a)}if(Lt(n,r.length),r.push(a),Array.isArray(a))for(let c=a.length-1;c>=0;c--)i.push({val:a[c],depth:l+1});else if(a&&typeof a=="object"){let c=Object.keys(a);for(let u=c.length-1;u>=0;u--)i.push({val:a[c[u]],depth:l+1})}}return r}case"Optional":try{return ne(e,t.expr,n)}catch(r){if(r instanceof C)throw r;return[]}case"StringInterp":{let r=new Te(n.limits.maxStringLength,"query string interpolation",()=>new C(`string size limit exceeded (${n.limits.maxStringLength} bytes)`,"string_length"));for(let s of t.parts){if(typeof s=="string"){r.append(s);continue}let i=ne(e,s,n);for(let o of i){if(wn(n),Mr(o,n.limits.maxDepth+1)>n.limits.maxDepth)throw $s(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");r.append(typeof o=="string"?o:JSON.stringify(o))}}return[r.build()]}case"UpdateOp":return[GS(e,t.path,t.op,t.value,n)];case"Reduce":{let r=ne(e,t.expr,n),s=ne(e,t.init,n)[0],i=n.limits.maxDepth??Kg;for(let o of r){let a;if(t.pattern){if(a=xo(n,t.pattern,o),a===null)continue}else a=Za(n,t.varName,o);if(s=ne(s,t.update,a)[0],Mr(s,i+1)>i)return[null]}return[s]}case"Foreach":{let r=ne(e,t.expr,n),s=ne(e,t.init,n)[0],i=[];for(let o of r)try{let a;if(t.pattern){if(a=xo(n,t.pattern,o),a===null)continue}else a=Za(n,t.varName,o);if(s=ne(s,t.update,a)[0],t.extract){let l=ne(s,t.extract,a);Rs(n,i,l)}else Lt(n,i.length),i.push(s)}catch(a){throw a instanceof vi?a.withPrependedResults(i):a}return i}case"Label":try{return ne(e,t.body,{...n,labels:new Set([...n.labels??[],t.name])})}catch(r){if(r instanceof vi&&r.label===t.name)return r.partialResults;throw r}case"Break":throw new vi(t.name);case"Def":{let r=new Map(n.funcs??[]),s=`${t.name}/${t.params.length}`;r.set(s,{params:t.params,body:t.funcBody,closure:new Map(n.funcs??[])});let i={...n,funcs:r};return ne(e,t.body,i)}default:{let r=t;throw new Error(`Unknown AST node type: ${r.type}`)}}}function Zg(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function GS(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return ne(l,r,s)[0]??null;case"+=":return typeof l=="number"&&typeof c=="number"||typeof l=="string"&&typeof c=="string"?l+c:Array.isArray(l)&&Array.isArray(c)?(Lt(s,l.length,c.length),[...l,...c]):l&&c&&typeof l=="object"&&typeof c=="object"?du(l,c):c;case"-=":return typeof l=="number"&&typeof c=="number"?l-c:l;case"*=":return typeof l=="number"&&typeof c=="number"?l*c:l;case"/=":return typeof l=="number"&&typeof c=="number"?l/c:l;case"%=":return typeof l=="number"&&typeof c=="number"?l%c:l;case"//=":return l===null||l===!1?c:l;default:return c}}function o(l,c,u){switch(c.type){case"Identity":return u(l);case"Field":{if(!qe(c.name))return l;if(c.base)return o(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let d=Dt(f),p=Object.hasOwn(d,c.name)?d[c.name]:void 0;return Ze(d,c.name,u(p)),d}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=Dt(l),d=Object.hasOwn(f,c.name)?f[c.name]:void 0;return Ze(f,c.name,u(d)),f}return l}case"Index":{let d=ne(e,c.index,s)[0];if(typeof d=="number"&&Number.isNaN(d))throw new Error("Cannot set array element at NaN index");if(typeof d=="number"&&!Number.isFinite(d))throw new Error("array index must be finite");if(typeof d=="number"&&!Number.isInteger(d)&&(d=Math.trunc(d)),c.base)return o(l,c.base,p=>{if(typeof d=="number"&&Array.isArray(p)){let h=[...p],m=d<0?h.length+d:d;if(m>=0){Lt(s,0,m+1),h.length<=m&&(h.length=m+1);for(let g=p.length;g<m;g++)h[g]=null;h[m]=u(h[m])}return h}if(typeof d=="string"&&p&&typeof p=="object"&&!Array.isArray(p)){if(!qe(d))return p;let h=Dt(p),m=Object.hasOwn(h,d)?h[d]:void 0;return Ze(h,d,u(m)),h}return p});if(typeof d=="number"){if(!Number.isSafeInteger(d)||d>536870911)throw new Error("Array index too large");if(d<0&&(!l||!Array.isArray(l)))throw new Error("Out of bounds negative array index");if(Array.isArray(l)){let h=[...l],m=d<0?h.length+d:d;if(m>=0){Lt(s,0,m+1),h.length<=m&&(h.length=m+1);for(let g=l.length;g<m;g++)h[g]=null;h[m]=u(h[m])}return h}if(l==null){Lt(s,0,d+1);let h=new Array(d+1).fill(null);return h[d]=u(null),h}return l}if(typeof d=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!qe(d))return l;let p=Dt(l),h=Object.hasOwn(p,d)?p[d]:void 0;return Ze(p,d,u(h)),p}return l}case"Iterate":{let f=d=>{if(Array.isArray(d)){Lt(s,0,d.length);let p=[];for(let h of d)wn(s),p.push(u(h));return p}if(d&&typeof d=="object"){let p=Object.create(null);for(let[h,m]of Object.entries(d))qe(h)&&Ze(p,h,u(m));return p}return d};return c.base?o(l,c.base,f):f(l)}case"Pipe":{let f=o(l,c.left,d=>d);return o(f,c.right,u)}default:return u(l)}}return o(e,t,l=>{if(n==="|=")return i(l,l);let c=ne(e,r,s);return i(l,c[0]??null)})}function qS(e,t,n){function r(i,o,a){switch(o.type){case"Identity":return a;case"Field":{if(!qe(o.name))return i;if(o.base){let l=ne(i,o.base,n)[0],c=r(l,{type:"Field",name:o.name},a);return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){let l=Dt(i);return Ze(l,o.name,a),l}return i}case"Index":{if(o.base){let u=ne(i,o.base,n)[0],f=r(u,{type:"Index",index:o.index},a);return r(i,o.base,f)}let c=ne(e,o.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&(u[f]=a),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!qe(c))return i;let u=Dt(i);return Ze(u,c,a),u}return i}default:return i}}function s(i,o){switch(o.type){case"Identity":return null;case"Field":{if(!qe(o.name))return i;if(o.base){let l=ne(i,o.base,n)[0];if(l==null)return i;let c=s(l,{type:"Field",name:o.name});return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!qe(o.name))return i;let l=Dt(i);return delete l[o.name],l}return i}case"Index":{if(o.base){let u=ne(i,o.base,n)[0];if(u==null)return i;let f=s(u,{type:"Index",index:o.index});return r(i,o.base,f)}let c=ne(e,o.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&u.splice(f,1),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!qe(c))return i;let u=Dt(i);return delete u[c],u}return i}case"Iterate":return Array.isArray(i)?[]:i&&typeof i=="object"?Object.create(null):i;case"Pipe":{let u=function(p,h,m){switch(h.type){case"Identity":return m;case"Field":{if(!qe(h.name))return p;if(p&&typeof p=="object"&&!Array.isArray(p)){let g=Dt(p);return Ze(g,h.name,m),g}return p}case"Index":{let b=ne(e,h.index,n)[0];if(typeof b=="number"&&Array.isArray(p)){let w=[...p],y=b<0?w.length+b:b;return y>=0&&y<w.length&&(w[y]=m),w}if(typeof b=="string"&&p&&typeof p=="object"&&!Array.isArray(p)){if(!qe(b))return p;let w=Dt(p);return Ze(w,b,m),w}return p}case"Pipe":{let g=ne(p,h.left,n)[0],b=u(g,h.right,m);return u(p,h.left,b)}default:return p}};var a=u;let l=o.left,c=o.right,f=ne(i,l,n)[0];if(f==null)return i;let d=s(f,c);return u(i,l,d)}default:return i}}return s(e,t)}function ZS(e,t,n,r,s){if(t==="and"){let l=ne(e,n,s);return Vn(s,l,c=>{if(!Hn(c))return[!1];let u=ne(e,r,s);return Vn(s,u,f=>[Hn(f)])})}if(t==="or"){let l=ne(e,n,s);return Vn(s,l,c=>{if(Hn(c))return[!0];let u=ne(e,r,s);return Vn(s,u,f=>[Hn(f)])})}if(t==="//"){let c=ne(e,n,s).filter(u=>u!=null&&u!==!1);return c.length>0?c:ne(e,r,s)}let i=ne(e,n,s),o=ne(e,r,s),a=i.length*o.length;return Lt(s,0,a),wn(s,a),i.flatMap(l=>o.map(c=>{switch(t){case"+":if(l===null)return c;if(c===null)return l;if(typeof l=="number"&&typeof c=="number")return l+c;if(typeof l=="string"&&typeof c=="string"){let u=s.limits.maxStringLength;if(U(l)+U(c)>u)throw new C(`string size limit exceeded (${u} bytes)`,"string_length");return l+c}return Array.isArray(l)&&Array.isArray(c)?(Lt(s,l.length,c.length),[...l,...c]):l&&c&&typeof l=="object"&&typeof c=="object"&&!Array.isArray(l)&&!Array.isArray(c)?du(l,c):null;case"-":if(typeof l=="number"&&typeof c=="number")return l-c;if(Array.isArray(l)&&Array.isArray(c)){let u=new Set(c.map(f=>JSON.stringify(f)));return l.filter(f=>!u.has(JSON.stringify(f)))}if(typeof l=="string"&&typeof c=="string"){let u=f=>f.length>10?`"${f.slice(0,10)}...`:JSON.stringify(f);throw new Error(`string (${u(l)}) and string (${u(c)}) cannot be subtracted`)}return null;case"*":if(typeof l=="number"&&typeof c=="number")return l*c;if(typeof l=="string"&&typeof c=="number"){if(!Number.isFinite(c))throw new Error(`invalid string repetition count: ${c}`);let u=Math.trunc(c);if(u<0)return null;let f=U(l),d=s.limits.maxStringLength;if(f>0&&u>Math.floor(d/f))throw new C(`string size limit exceeded (${d} bytes)`,"string_length");return l.repeat(u)}{let u=Je(l),f=Je(c);if(u&&f)return Tg(u,f,{maxDepth:s.limits.maxDepth,visit:()=>wn(s)})}return null;case"/":if(typeof l=="number"&&typeof c=="number"){if(c===0)throw new Error(`number (${l}) and number (${c}) cannot be divided because the divisor is zero`);return l/c}return typeof l=="string"&&typeof c=="string"?l.split(c):null;case"%":if(typeof l=="number"&&typeof c=="number"){if(c===0)throw new Error(`number (${l}) and number (${c}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(l)&&!Number.isNaN(l)?!Number.isFinite(c)&&!Number.isNaN(c)&&l<0&&c>0?-1:0:l%c}return null;case"==":return Si(l,c);case"!=":return!Si(l,c);case"<":return wo(l,c)<0;case"<=":return wo(l,c)<=0;case">":return wo(l,c)>0;case">=":return wo(l,c)>=0;default:return null}}))}function Qg(e,t,n,r){let s=WS.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=tf(e,t,n,r,ne);if(i!==null)return i;let o=uf(e,t,n,r,ne);if(o!==null)return o;let a=Yu(e,t,n,r,ne);if(a!==null)return a;let l=Ju(e,t,r.limits.maxDepth);if(l!==null)return l;let c=ff(e,t);if(c!==null)return c;let u=of(e,t,n,r,ne);if(u!==null)return u;let f=Ku(e,t,n,r,ne,qg,za,Hn,Wa,C);if(f!==null)return f;let d=af(e,t,n,r,ne,Hn,Ha,Va,qS,Ga);if(d!==null)return d;let p=ef(e,t,n,r,ne,Si);if(p!==null)return p;let h=Qu(e,t,n,r,ne,qg,Hn,C);if(h!==null)return h;let m=rf(e,t,n,r,ne,Hn,HS,Qg);if(m!==null)return m;let g=cf(e,t,n,r,ne,Si);if(g!==null)return g;switch(t){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 b=n.length>0?ne(e,n[0],r)[0]:e;throw new qa(b)}case"env":return[r.env?Ht(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let b=`${t}/${n.length}`,w=r.funcs?.get(b);if(w){let y=w.closure??r.funcs??new Map,x=new Map(y);x.set(b,w);for(let E=0;E<w.params.length;E++){let A=w.params[E],I=n[E];if(I){let $=ne(e,I,r),N;if($.length===0)N={type:"Call",name:"empty",args:[]};else if($.length===1)N={type:"Literal",value:$[0]};else{N={type:"Literal",value:$[$.length-1]};for(let R=$.length-2;R>=0;R--)N={type:"Comma",left:{type:"Literal",value:$[R]},right:N}}x.set(`${A}/0`,{params:[],body:N})}}let S={...r,funcs:x};return ne(e,w.body,S)}throw new Error(`Unknown function: ${t}`)}}}function Ga(e,t,n,r,s){if(wn(n),r.length>n.limits.maxDepth)throw $s(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");let i=l=>{if(l.length>n.limits.maxDepth)throw $s(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");Lt(n,s.length),s.push(l)};if(t.type==="Comma"){let l=t;Ga(e,l.left,n,r,s),Ga(e,l.right,n,r,s);return}let o=Xr(t);if(o!==null){i([...r,...o]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let l=0;l<e.length;l++)wn(n),i([...r,l]);else if(e&&typeof e=="object")for(let l of Object.keys(e))wn(n),i([...r,l]);return}if(t.type==="Recurse"){let l=[{value:e,path:[]}];for(;l.length>0;){let c=l.pop();if(!c)break;if(wn(n),i([...r,...c.path]),c.value&&typeof c.value=="object"){let u=Array.isArray(c.value)?c.value.map((f,d)=>[d,f]):Object.keys(c.value).map(f=>[f,c.value[f]]);Lt(n,0,l.length+u.length);for(let f=u.length-1;f>=0;f--){let[d,p]=u[f];l.push({value:p,path:[...c.path,d]})}}}return}if(t.type==="Pipe"){let l=Xr(t.left);if(l!==null){let c=ne(e,t.left,n);for(let u of c)Ga(u,t.right,n,[...r,...l],s);return}}ne(e,t,n).length>0&&i(r)}var vi,qa,zS,Gg,Kg,WS,lf=M(()=>{"use strict";At();Lr();Z();Er();St();Hg();Vg();sr();bo();vi=class e extends Error{label;partialResults;constructor(t,n=[]){super(`break ${t}`),this.label=t,this.partialResults=n,this.name="BreakError"}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},qa=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},zS=1e4,Gg=10*1024*1024,Kg=2e3,WS=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 Yg(e){let t=[],n=0,r=(c=0)=>e[n+c],s=()=>e[n++],i=()=>n>=e.length,o=c=>c>="0"&&c<="9",a=c=>c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="_",l=c=>a(c)||o(c);for(;!i();){let c=n,u=s();if(!(u===" "||u===" "||u===`
577
+ `||u==="\r")){if(u==="#"){for(;!i()&&r()!==`
578
+ `;)s();continue}if(u==="."&&r()==="."){s(),t.push({type:"DOTDOT",pos:c});continue}if(u==="="&&r()==="="){s(),t.push({type:"EQ",pos:c});continue}if(u==="!"&&r()==="="){s(),t.push({type:"NE",pos:c});continue}if(u==="<"&&r()==="="){s(),t.push({type:"LE",pos:c});continue}if(u===">"&&r()==="="){s(),t.push({type:"GE",pos:c});continue}if(u==="/"&&r()==="/"){s(),r()==="="?(s(),t.push({type:"UPDATE_ALT",pos:c})):t.push({type:"ALT",pos:c});continue}if(u==="+"&&r()==="="){s(),t.push({type:"UPDATE_ADD",pos:c});continue}if(u==="-"&&r()==="="){s(),t.push({type:"UPDATE_SUB",pos:c});continue}if(u==="*"&&r()==="="){s(),t.push({type:"UPDATE_MUL",pos:c});continue}if(u==="/"&&r()==="="){s(),t.push({type:"UPDATE_DIV",pos:c});continue}if(u==="%"&&r()==="="){s(),t.push({type:"UPDATE_MOD",pos:c});continue}if(u==="="&&r()!=="="){t.push({type:"ASSIGN",pos:c});continue}if(u==="."){t.push({type:"DOT",pos:c});continue}if(u==="|"){r()==="="?(s(),t.push({type:"UPDATE_PIPE",pos:c})):t.push({type:"PIPE",pos:c});continue}if(u===","){t.push({type:"COMMA",pos:c});continue}if(u===":"){t.push({type:"COLON",pos:c});continue}if(u===";"){t.push({type:"SEMICOLON",pos:c});continue}if(u==="("){t.push({type:"LPAREN",pos:c});continue}if(u===")"){t.push({type:"RPAREN",pos:c});continue}if(u==="["){t.push({type:"LBRACKET",pos:c});continue}if(u==="]"){t.push({type:"RBRACKET",pos:c});continue}if(u==="{"){t.push({type:"LBRACE",pos:c});continue}if(u==="}"){t.push({type:"RBRACE",pos:c});continue}if(u==="?"){t.push({type:"QUESTION",pos:c});continue}if(u==="+"){t.push({type:"PLUS",pos:c});continue}if(u==="-"){t.push({type:"MINUS",pos:c});continue}if(u==="*"){t.push({type:"STAR",pos:c});continue}if(u==="/"){t.push({type:"SLASH",pos:c});continue}if(u==="%"){t.push({type:"PERCENT",pos:c});continue}if(u==="<"){t.push({type:"LT",pos:c});continue}if(u===">"){t.push({type:"GT",pos:c});continue}if(o(u)){let f=u;for(;!i()&&(o(r())||r()==="."||r()==="e"||r()==="E");)(r()==="e"||r()==="E")&&(e[n+1]==="+"||e[n+1]==="-")&&(f+=s()),f+=s();t.push({type:"NUMBER",value:Number(f),pos:c});continue}if(u==='"'){let f="",d=0;for(;!i();){let p=r();if(d===0&&p==='"')break;if(d===0&&p==="\\"){if(s(),i())break;let h=s();switch(h){case"n":f+=`
579
+ `;break;case"r":f+="\r";break;case"t":f+=" ";break;case"\\":f+="\\";break;case'"':f+='"';break;case"(":f+="\\(",d=1;break;default:f+=h}continue}if(d>0){if(p==='"'){for(f+=s();!i();){let h=r();if(h==="\\"){f+=s(),i()||(f+=s());continue}if(f+=s(),h==='"')break}continue}p==="("?d++:p===")"&&d--,f+=s();continue}f+=s()}i()||s(),t.push({type:"STRING",value:f,pos:c});continue}if(a(u)||u==="$"||u==="@"){let f=u;for(;!i()&&l(r());)f+=s();let d=Xg.get(f);d?t.push({type:d,value:f,pos:c}):t.push({type:"IDENT",value:f,pos:c});continue}throw new Error(`Unexpected character '${u}' at position ${c}`)}}return t.push({type:"EOF",pos:n}),t}function Jg(e,t={}){let n=t.maxDepth??256,r=t.maxTokens??1e5,s=t.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 i=Yg(e);return new pf(i,n).parse()}var Xg,Ka,pf,e2=M(()=>{"use strict";Xg=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"]]),Ka=new Set(Xg.values());pf=class e{maxDepth;tokens;pos=0;depth;constructor(t,n,r=0){this.maxDepth=n,this.tokens=t,this.depth=r}peek(t=0){return this.tokens[this.pos+t]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(t){return this.peek().type===t}match(...t){for(let n of t)if(this.check(n))return this.advance();return null}expect(t,n){if(!this.check(t))throw new Error(`${n} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}withDepth(t){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return t()}finally{this.depth--}}isFieldNameAfterDot(t=0){let n=this.peek(t),r=this.peek(t+1);return r.type==="STRING"?!0:r.type==="IDENT"||Ka.has(r.type)?r.pos===n.pos+1:!1}isIdentLike(){let t=this.peek().type;return t==="IDENT"||Ka.has(t)}consumeFieldNameAfterDot(t){let n=this.peek();return n.type==="STRING"?this.advance().value:(n.type==="IDENT"||Ka.has(n.type))&&n.pos===t.pos+1?this.advance().value:null}parse(){let t=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return t}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 t=this.expect("IDENT","Expected variable name in pattern"),n=t.value;if(!n.startsWith("$"))throw new Error(`Variable name must start with $ at position ${t.pos}`);return{type:"var",name:n}}parsePatternField(){if(this.match("LPAREN")){let n=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let r=this.parsePattern();return{key:n,pattern:r}}let t=this.peek();if(t.type==="IDENT"||Ka.has(t.type)){let n=t.value;if(n.startsWith("$")){if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:n.slice(1),pattern:r,keyVar:n}}return{key:n.slice(1),pattern:{type:"var",name:n}}}if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:n,pattern:r}}return{key:n,pattern:{type:"var",name:`$${n}`}}}throw new Error(`Expected field name in object pattern at position ${t.pos}`)}parsePipe(){let t=this.parseComma();for(;this.match("PIPE");){let n=this.parseComma();t={type:"Pipe",left:t,right:n}}return t}parseComma(){let t=this.parseVarBind();for(;this.match("COMMA");){let n=this.parseVarBind();t={type:"Comma",left:t,right:n}}return t}parseVarBind(){let t=this.parseUpdate();if(this.match("AS")){let n=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 n.type==="var"&&r.length===0?{type:"VarBind",name:n.name,value:t,body:s}:{type:"VarBind",name:n.type==="var"?n.name:"",value:t,body:s,pattern:n.type!=="var"?n:void 0,alternatives:r.length>0?r:void 0}}return t}peekAhead(t){let n=this.pos+t;return n<this.tokens.length?this.tokens[n]:void 0}parseUpdate(){let t=this.parseAlt(),n=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()),i=n.get(r.type);if(i)return{type:"UpdateOp",op:i,path:t,value:s}}return t}parseAlt(){let t=this.parseOr();for(;this.match("ALT");){let n=this.parseOr();t={type:"BinaryOp",op:"//",left:t,right:n}}return t}parseOr(){let t=this.parseAnd();for(;this.match("OR");){let n=this.parseAnd();t={type:"BinaryOp",op:"or",left:t,right:n}}return t}parseAnd(){let t=this.parseNot();for(;this.match("AND");){let n=this.parseNot();t={type:"BinaryOp",op:"and",left:t,right:n}}return t}parseNot(){return this.parseComparison()}parseComparison(){let t=this.parseAddSub(),n=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),r=this.match("EQ","NE","LT","LE","GT","GE");if(r){let s=n.get(r.type);if(s){let i=this.parseAddSub();t={type:"BinaryOp",op:s,left:t,right:i}}}return t}parseAddSub(){let t=this.parseMulDiv();for(;;)if(this.match("PLUS")){let n=this.parseMulDiv();t={type:"BinaryOp",op:"+",left:t,right:n}}else if(this.match("MINUS")){let n=this.parseMulDiv();t={type:"BinaryOp",op:"-",left:t,right:n}}else break;return t}parseMulDiv(){let t=this.parseUnary();for(;;)if(this.match("STAR")){let n=this.parseUnary();t={type:"BinaryOp",op:"*",left:t,right:n}}else if(this.match("SLASH")){let n=this.parseUnary();t={type:"BinaryOp",op:"/",left:t,right:n}}else if(this.match("PERCENT")){let n=this.parseUnary();t={type:"BinaryOp",op:"%",left:t,right:n}}else break;return t}parseUnary(){let t=0;for(;this.match("MINUS");)if(t++,this.depth+t>this.maxDepth)throw new Error(`query parse depth limit exceeded (${this.maxDepth})`);let n=this.parsePostfix();for(;t-- >0;)n={type:"UnaryOp",op:"-",operand:n};return n}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match("QUESTION"))t={type:"Optional",expr:t};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),t={type:"Field",name:this.advance().value,base:t};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))t={type:"Iterate",base:t};else if(this.check("COLON")){this.advance();let n=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",end:n,base:t}}else{let n=this.parseExpr();if(this.match("COLON")){let r=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",start:n,end:r,base:t}}else this.expect("RBRACKET","Expected ']'"),t={type:"Index",index:n,base:t}}else break;return t}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let t=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 n=this.consumeFieldNameAfterDot(t);return n!==null?{type:"Field",name:n}:{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 n=this.advance().value;return n.includes("\\(")?this.parseStringInterpolation(n):{type:"Literal",value:n}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let t=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:t}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let t=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:t}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let t=this.withDepth(()=>this.parsePostfix()),n;return this.match("CATCH")&&(n=this.withDepth(()=>this.parsePostfix())),{type:"Try",body:t,catch:n}}if(this.match("REDUCE")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let n=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 i=n.type==="var"?n.name:"";return{type:"Reduce",expr:t,varName:i,init:r,update:s,pattern:n.type!=="var"?n:void 0}}if(this.match("FOREACH")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let n=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr(),i;this.match("SEMICOLON")&&(i=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let o=n.type==="var"?n.name:"";return{type:"Foreach",expr:t,varName:o,init:r,update:s,extract:i,pattern:n.type!=="var"?n:void 0}}if(this.match("LABEL")){let t=this.expect("IDENT","Expected label name (e.g., $out)"),n=t.value;if(!n.startsWith("$"))throw new Error(`Label name must start with $ at position ${t.pos}`);this.expect("PIPE","Expected '|' after label name");let r=this.parseExpr();return{type:"Label",name:n,body:r}}if(this.match("BREAK")){let t=this.expect("IDENT","Expected label name to break to"),n=t.value;if(!n.startsWith("$"))throw new Error(`Break label must start with $ at position ${t.pos}`);return{type:"Break",name:n}}if(this.match("DEF")){let n=this.expect("IDENT","Expected function name after def").value,r=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let o=this.expect("IDENT","Expected parameter name");for(r.push(o.value);this.match("SEMICOLON");){let a=this.expect("IDENT","Expected parameter name");r.push(a.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 i=this.parseExpr();return{type:"Def",name:n,params:r,funcBody:s,body:i}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let n=this.advance().value;if(n.startsWith("$"))return{type:"VarRef",name:n};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:n,args:r}}return{type:"Call",name:n,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 t=[];if(!this.check("RBRACE"))do{let n,r;if(this.match("LPAREN"))n=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")?(n=s,r=this.parseObjectValue()):(n=s,r={type:"Field",name:s})}else if(this.check("STRING"))n=this.advance().value,this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);t.push({key:n,value:r})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:t}}parseObjectValue(){let t=this.parseVarBind();for(;this.match("PIPE");){let n=this.parseVarBind();t={type:"Pipe",left:t,right:n}}return t}parseIf(){let t=this.parseExpr();this.expect("THEN","Expected 'then'");let n=this.parseExpr(),r=[];for(;this.match("ELIF");){let i=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let o=this.parseExpr();r.push({cond:i,then:o})}let s;return this.match("ELSE")&&(s=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:t,then:n,elifs:r,else:s}}parseStringInterpolation(t){let n=[],r="",s=0;for(;s<t.length;)if(t[s]==="\\"&&t[s+1]==="("){r&&(n.push(r),r=""),s+=2;let i=1,o="";for(;s<t.length&&i>0;){let c=t[s];if(c==='"'){for(o+=c,s++;s<t.length;){let u=t[s];if(u==="\\"){o+=u,s++,s<t.length&&(o+=t[s],s++);continue}if(o+=u,s++,u==='"')break}continue}c==="("?i++:c===")"&&i--,i>0&&(o+=c),s++}let a=Yg(o),l=new e(a,this.maxDepth,this.depth);n.push(l.parse())}else r+=t[s],s++;return r&&n.push(r),{type:"StringInterp",parts:n}}}});var t2=M(()=>{"use strict";lf();e2()});function r2(e,t,n={}){let r=new Te(t,"query JSON output",()=>new C(`output size limit exceeded (${t} bytes)`,n.limitKind??"output_size"));return hf(r,e,n,0),r.build()}function hf(e,t,n,r){if(t==null){e.append("null");return}if(typeof t=="boolean"){e.append(String(t));return}if(typeof t=="number"){e.append(Number.isFinite(t)?String(t):"null");return}if(typeof t=="string"){n.raw&&r===0?e.append(t):n2(e,t);return}let s=n.compact??!1,i=n.indent??2,o=n.useTab?" ":" ".repeat(i);if(Array.isArray(t)){e.append("[");for(let l=0;l<t.length;l++)e.append(s?l===0?"":",":l===0?`
580
+ `:`,
581
+ `),s||e.repeat(o,r+1),hf(e,t[l],n,r+1);!s&&t.length>0&&e.append(`
582
+ `).repeat(o,r),e.append("]");return}let a=Object.keys(t);n.sortKeys&&(a=a.sort()),e.append("{");for(let l=0;l<a.length;l++){let c=a[l];e.append(s?l===0?"":",":l===0?`
583
+ `:`,
584
+ `),s||e.repeat(o,r+1),n2(e,c),e.append(s?":":": "),hf(e,t[c],n,r+1)}!s&&a.length>0&&e.append(`
585
+ `).repeat(o,r),e.append("}")}function n2(e,t){e.append('"');let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r),i="";s===34?i='\\"':s===92?i="\\\\":s===8?i="\\b":s===9?i="\\t":s===10?i="\\n":s===12?i="\\f":s===13?i="\\r":s<32&&(i=`\\u${s.toString(16).padStart(4,"0")}`),i&&(e.append(t.slice(n,r)).append(i),n=r+1)}e.append(t.slice(n)).append('"')}var s2=M(()=>{"use strict";At();Z()});var i2={};ae(i2,{flagsForFuzzing:()=>JS,jqCommand:()=>YS});function KS(e){switch(e){case"\b":return"\\b";case"\f":return"\\f";case`
586
+ `:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`}}function QS(e){let t="",n=!1,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(r){t+=i,r=!1;continue}if(i==="\\"){t+=i,r=!0;continue}if(i==='"'){t+=i,n=!n;continue}if(n&&i.charCodeAt(0)<=31){t+=KS(i);continue}t+=i}return t}function mf(e,t,n){return JSON.parse(QS(e.slice(t,n)))}function Eo(e,t){let n=[],r=o=>{if(n.length>=t.maxElements)throw new C(`query result element limit exceeded (${t.maxElements})`,"array_elements");n.push(o)},s=0,i=e.length;for(;s<i;){for(;s<i&&/\s/.test(e[s]);)s++;if(s>=i)break;let o=s,a=e[s];if(a==="{"||a==="["){let l=[a==="{"?"}":"]"],c=!1,u=!1;for(s++;s<i&&l.length>0;){let f=e[s];if(u)u=!1;else if(f==="\\")u=!0;else if(f==='"')c=!c;else if(!c){if(f==="{"||f==="["){if(l.push(f==="{"?"}":"]"),l.length>t.maxDepth)throw new C(`query depth limit exceeded (${t.maxDepth})`,"recursion")}else if((f==="}"||f==="]")&&l.pop()!==f)throw new Error(`Mismatched JSON delimiter at position ${s}`)}s++}if(l.length!==0)throw new Error(`Unexpected end of JSON input at position ${s} (unclosed ${a})`);r(di(mf(e,o,s),{maxDepth:t.maxDepth,maxElements:t.maxElements}))}else if(a==='"'){let l=!1;for(s++;s<i;){let c=e[s];if(l)l=!1;else if(c==="\\")l=!0;else if(c==='"'){s++;break}s++}r(di(mf(e,o,s),t))}else if(a==="-"||a>="0"&&a<="9"){for(;s<i&&/[\d.eE+-]/.test(e[s]);)s++;r(di(mf(e,o,s),t))}else if(e.slice(s,s+4)==="true")r(!0),s+=4;else if(e.slice(s,s+5)==="false")r(!1),s+=5;else if(e.slice(s,s+4)==="null")r(null),s+=4;else{let l=e.slice(s,s+10);throw new Error(`Invalid JSON at position ${o}: unexpected '${l.split(/\s/)[0]}'`)}}return n}function _r(e){return{stdout:"",stderr:`jq: ${e}
587
+ `,exitCode:2}}var XS,YS,JS,o2=M(()=>{"use strict";ce();_n();Z();Er();vn();Gr();de();St();t2();s2();sr();bo();XS={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE...]",options:["-R, --raw-input read each line as string instead of JSON","-r, --raw-output output strings without quotes","-c, --compact-output compact instead of pretty-printed output","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --arg NAME VALUE bind $NAME to the string VALUE"," --argjson NAME JSON bind $NAME to the JSON-decoded value JSON"," --rawfile NAME FILE bind $NAME to the raw contents of FILE"," --slurpfile NAME FILE bind $NAME to the array of JSON values in FILE"," --args remaining arguments are string positional args ($ARGS.positional)"," --jsonargs remaining arguments are JSON positional args ($ARGS.positional)"," --help display this help and exit"]},YS={name:"jq",async execute(e,t){Ct(t.requireDefenseContext,"jq","execution entry");let n=(S,E)=>on(t.requireDefenseContext,"jq",S,E);if(q(e))return G(XS);let r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,d=".",p=!1,h="none",m=[],g=new Map,b=[],w=[],y={maxDepth:t.limits.maxQueryDepth,maxElements:t.limits.maxQueryElements};for(let S=0;S<e.length;S++){let E=e[S];if(E==="-R"||E==="--raw-input")s=!0;else if(E==="-r"||E==="--raw-output")r=!0;else if(E==="-c"||E==="--compact-output")i=!0;else if(E==="-e"||E==="--exit-status")o=!0;else if(E==="-s"||E==="--slurp")a=!0;else if(E==="-n"||E==="--null-input")l=!0;else if(E==="-j"||E==="--join-output")c=!0;else if(!(E==="-a"||E==="--ascii")){if(E==="-S"||E==="--sort-keys")u=!0;else if(!(E==="-C"||E==="--color")){if(!(E==="-M"||E==="--monochrome"))if(E==="--tab")f=!0;else if(E==="--arg"){let A=e[S+1],I=e[S+2];if(A===void 0||I===void 0)return _r("--arg takes two parameters (e.g. --arg varname value)");g.set(A,I),S+=2}else if(E==="--argjson"){let A=e[S+1],I=e[S+2];if(A===void 0||I===void 0)return _r("--argjson takes two parameters (e.g. --argjson varname text)");let $;try{$=Eo(I.trim(),y)}catch{return _r("invalid JSON text passed to --argjson")}if($.length!==1)return _r("invalid JSON text passed to --argjson");g.set(A,$[0]),S+=2}else if(E==="--rawfile"){let A=e[S+1],I=e[S+2];if(A===void 0||I===void 0)return _r("--rawfile takes two parameters (e.g. --rawfile varname filename)");w.push({name:A,file:I,mode:"raw"}),S+=2}else if(E==="--slurpfile"){let A=e[S+1],I=e[S+2];if(A===void 0||I===void 0)return _r("--slurpfile takes two parameters (e.g. --slurpfile varname filename)");w.push({name:A,file:I,mode:"slurp"}),S+=2}else if(E==="--args")h="args";else if(E==="--jsonargs")h="jsonargs";else if(E==="-")m.push("-");else{if(E.startsWith("--"))return re("jq",E);if(E.startsWith("-")){for(let A of E.slice(1))if(A==="R")s=!0;else if(A==="r")r=!0;else if(A==="c")i=!0;else if(A==="e")o=!0;else if(A==="s")a=!0;else if(A==="n")l=!0;else if(A==="j")c=!0;else if(A!=="a"){if(A==="S")u=!0;else if(A!=="C"){if(A!=="M")return re("jq",`-${A}`)}}}else if(!p)d=E,p=!0;else if(h==="args")b.push(E);else if(h==="jsonargs"){let A;try{A=Eo(E.trim(),y)}catch{return _r("invalid JSON text passed to --jsonargs")}if(A.length!==1)return _r("invalid JSON text passed to --jsonargs");b.push(A[0])}else m.push(E)}}}}if(w.length>0){let S=await n("arg file read",()=>ri(t,w.map(E=>E.file),{cmdName:"jq",stopOnError:!0}));if(S.exitCode!==0)return{stdout:"",stderr:S.stderr,exitCode:2};for(let E=0;E<w.length;E++){let{name:A,mode:I}=w[E],$=ue(S.files[E].content);if(I==="raw")g.set(A,$);else{let N=$.trim();try{g.set(A,N?Eo(N,y):[])}catch{return _r("invalid JSON text passed to --slurpfile")}}}}let x=[];if(!l)if(m.length===0||m.length===1&&m[0]==="-")x.push({source:"stdin",content:ue(t.stdin)});else{let S=await n("file read",()=>ri(t,m,{cmdName:"jq",stopOnError:!0}));if(S.exitCode!==0)return{stdout:"",stderr:S.stderr,exitCode:2};x=S.files.map(E=>({source:E.filename||"stdin",content:ue(E.content)}))}try{let S=Jg(d,{maxDepth:t.limits.maxQueryDepth,maxTokens:t.limits.maxQueryTokens,maxSourceLength:t.limits.maxStringLength}),E=[],A={limits:t.limits?{maxIterations:t.limits.maxJqIterations,maxStringLength:t.limits.maxStringLength,maxOutputSize:t.limits.maxOutputSize,maxArrayElements:t.limits.maxQueryElements,maxDepth:t.limits.maxQueryDepth}:void 0,env:t.env,namedArgs:g,positionalArgs:b,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext,budget:{operations:0,callDepth:0}},I=(W,_)=>{if(_.length>t.limits.maxQueryElements-W.length)throw new C(`query result element limit exceeded (${t.limits.maxQueryElements})`,"array_elements");for(let F of _)W.push(F)};if(l)E=ne(null,S,A);else if(s&&a){let W=x.map(({content:_})=>_).join("");E=ne(W,S,A)}else if(s){let W="";for(let{content:_}of x){let F=W+_,z=0,D=F.indexOf(`
588
+ `,z);for(;D!==-1;)I(E,ne(F.slice(z,D),S,A)),z=D+1,D=F.indexOf(`
589
+ `,z);W=F.slice(z)}W!==""&&I(E,ne(W,S,A))}else if(a){let W=[];for(let{content:_}of x){let F=_.trim();F&&I(W,Eo(F,y))}E=ne(W,S,A)}else for(let{content:W}of x){let _=W.trim();if(!_)continue;let F=Eo(_,y);for(let z of F)I(E,ne(z,S,A))}let $=c?"":`
590
+ `,N=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),R=[],O=0;for(let W of E){let _=R.length>0?$.length:0,F=c?0:1,z=N-O-_-F;if(z<0)throw new C(`output size limit exceeded (${N} bytes)`,"string_length");if(Mr(W,t.limits.maxQueryDepth+1)>t.limits.maxQueryDepth)throw new C(`query depth limit exceeded (${t.limits.maxQueryDepth})`,"recursion");let D=r2(W,z,{compact:i,raw:r,sortKeys:u,useTab:f,limitKind:"string_length"}),X=U(D);if(O+_+X+F>N)throw new C(`output size limit exceeded (${N} bytes)`,"string_length");O+=_+X,R.push(D)}let B=R.join($),L=o&&(E.length===0||E.every(W=>W==null||W===!1))?1:0;return{stdout:B?c?B:`${B}
591
+ `:"",stderr:"",exitCode:L}}catch(S){if(S instanceof Ae)throw S;if(S instanceof C)return{stdout:"",stderr:`jq: ${Ye(S.message)}
592
+ `,exitCode:C.EXIT_CODE};let E=Ye(S.message);return E.includes("Unknown function")?{stdout:"",stderr:`jq: error: ${E}
593
+ `,exitCode:3}:{stdout:"",stderr:`jq: parse error: ${E}
594
+ `,exitCode:5}}}},JS={name:"jq",flags:[{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"--tab",type:"boolean"}],stdinType:"json",needsArgs:!0}});var u2={};ae(u2,{base64Command:()=>nA,flagsForFuzzing:()=>rA});function Gn(e,t,n,r){if(e>t)throw new C(`base64: ${n} limit exceeded (${t} bytes)`,r)}function a2(e){let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode(...e.subarray(r,r+32768)));return t.join("")}function l2(e){if(e.length===0)return 0;let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.max(0,Math.ceil(e.length/4)*3-t)}async function c2(e,t,n){let r=Math.min(e.limits.maxInputBytes,e.limits.maxStringLength),s=e.stdin;if(t.length===0||t.length===1&&t[0]==="-")return Gn(s.length,r,"input size","string_length"),{ok:!0,data:Uint8Array.from(s,c=>c.charCodeAt(0))};let i=[],o=0;for(let c of t){if(c==="-"){Gn(o+s.length,r,"input size","string_length"),i.push(Uint8Array.from(s,u=>u.charCodeAt(0))),o+=s.length;continue}try{let u=e.fs.resolvePath(e.cwd,c),f=await e.fs.stat(u);Gn(o+f.size,r,"input size","string_length");let d=await e.fs.readFileBuffer(u);Gn(o+d.length,r,"input size","string_length"),aa(e,d.length,n),i.push(d),o+=d.length}catch(u){return he(u),{ok:!1,error:{stdout:"",stderr:`${n}: ${c}: No such file or directory
595
+ `,exitCode:1}}}}let a=new Uint8Array(o),l=0;for(let c of i)a.set(c,l),l+=c.length;return{ok:!0,data:a}}var eA,tA,nA,rA,f2=M(()=>{"use strict";ce();Nt();Z();It();Gr();de();eA={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},tA={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};nA={name:"base64",async execute(e,t){if(q(e))return G(eA);let n=Le("base64",e,tA);if(!n.ok)return n.error;let r=n.result.flags.decode,s=n.result.flags.wrap,i=n.result.positional;if(!Number.isSafeInteger(s)||s<0)return{stdout:"",stderr:`base64: invalid wrap size
596
+ `,exitCode:1};try{if(r){let u=await c2(t,i,"base64");if(!u.ok)return u.error;if(typeof Buffer<"u"){let g=Buffer.from(u.data).toString("utf8").replace(/\s/g,""),b=l2(g);Gn(b,t.limits.maxStringLength,"decoded size","string_length"),Gn(b,t.limits.maxOutputSize,"output size","output_size");let w=Buffer.from(g,"base64");return Gn(w.length,t.limits.maxOutputSize,"output size","output_size"),{stdout:w.toString("latin1"),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let d=a2(u.data).replace(/\s/g,""),p=l2(d);Gn(p,t.limits.maxStringLength,"decoded size","string_length"),Gn(p,t.limits.maxOutputSize,"output size","output_size");let h=atob(d);return Gn(h.length,t.limits.maxOutputSize,"output size","output_size"),{stdout:h,stderr:"",exitCode:0,stdoutEncoding:"binary"}}let o=await c2(t,i,"base64");if(!o.ok)return o.error;let a=Math.ceil(o.data.length/3)*4,l=s>0&&a>0?Math.ceil(a/s):0;if(l>t.limits.maxArrayElements)throw new C(`base64: wrapped line limit exceeded (${t.limits.maxArrayElements})`,"array_elements");Gn(a,t.limits.maxStringLength,"encoded size","string_length"),Gn(a+l,t.limits.maxOutputSize,"output size","output_size");let c;if(typeof Buffer<"u"?c=Buffer.from(o.data).toString("base64"):c=btoa(a2(o.data)),s>0){let u=[];for(let f=0;f<c.length;f+=s)u.push(c.slice(f,f+s));c=u.join(`
597
+ `)+(c.length>0?`
598
+ `:"")}return{stdout:c,stderr:"",exitCode:0}}catch(o){return he(o),{stdout:"",stderr:`base64: invalid input
599
+ `,exitCode:1}}}},rA={name:"base64",flags:[{flag:"-d",type:"boolean"},{flag:"-w",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var p2={};ae(p2,{diffCommand:()=>oA,flagsForFuzzing:()=>aA});import*as d2 from"diff";var sA,iA,oA,aA,h2=M(()=>{"use strict";ce();It();de();sA={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},iA={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},oA={name:"diff",async execute(e,t){if(q(e))return G(sA);let n=Le("diff",e,iA);if(!n.ok)return n.error;let r=n.result.flags.brief,s=n.result.flags.reportSame,i=n.result.flags.ignoreCase,o=n.result.positional;if(n.result.flags.unified,o.length<2)return{stdout:"",stderr:`diff: missing operand
600
+ `,exitCode:2};let a,l,[c,u]=o;try{a=c==="-"?ue(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,c))}catch{return{stdout:"",stderr:`diff: ${c}: No such file or directory
601
+ `,exitCode:2}}try{l=u==="-"?ue(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,u))}catch{return{stdout:"",stderr:`diff: ${u}: No such file or directory
602
+ `,exitCode:2}}let f=a,d=l;return i&&(f=f.toLowerCase(),d=d.toLowerCase()),f===d?s?{stdout:`Files ${c} and ${u} are identical
603
+ `,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:r?{stdout:`Files ${c} and ${u} differ
604
+ `,stderr:"",exitCode:1}:{stdout:d2.createTwoFilesPatch(c,u,a,l,"","",{context:3}),stderr:"",exitCode:1}}},aA={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}});var m2={};ae(m2,{dateCommand:()=>pA,flagsForFuzzing:()=>hA});function cA(e){try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),!0}catch{return!1}}function uA(e,t){let n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),r=o=>n.find(a=>a.type===o)?.value??"00",s=Number.parseInt(r("hour"),10)%24,i=new Date(`${r("year")}-${r("month")}-${r("day")}T${String(s).padStart(2,"0")}:${r("minute")}:${r("second")}Z`);return Number.isNaN(i.getTime())?null:i}function fA(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/);if(!n)return null;let[,r,s,i,o="00",a="00",l="00"]=n,c=new Date(`${r}-${s}-${i}T${o}:${a}:${l}Z`);if(Number.isNaN(c.getTime()))return null;try{let u=c;for(let f=0;f<3;f++){let d=uA(u,t);if(d===null)return null;let p=d.getTime()-c.getTime();if(p===0)return u;u=new Date(u.getTime()-p)}return u}catch{return null}}function dA(e,t){if(e.startsWith("@")){let s=e.slice(1);if(!/^-?\d+$/.test(s))return null;let i=Number(s);if(!Number.isSafeInteger(i))return null;let o=new Date(i*1e3);return Number.isNaN(o.getTime())?null:o}let n=e.toLowerCase().trim();if(n==="now"||n==="today")return new Date;if(n==="yesterday")return new Date(Date.now()-864e5);if(n==="tomorrow")return new Date(Date.now()+864e5);if(t&&!/Z$/i.test(e)&&!/[+-]\d{2}:?\d{2}$/.test(e)){let s=fA(e,t);if(s)return s}let r=new Date(e);return Number.isNaN(r.getTime())?null:r}var lA,pA,hA,g2=M(()=>{"use strict";de();Fc();lA={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING, not 'now'","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]};pA={name:"date",async execute(e,t){if(q(e))return G(lA);let n=!1,r=null,s=null,i=!1,o=!1;for(let p=0;p<e.length;p++){let h=e[p];if(h==="-u"||h==="--utc")n=!0;else if(h==="-d"||h==="--date")r=e[++p]??"";else if(h.startsWith("--date="))r=h.slice(7);else if(h==="-I"||h==="--iso-8601")i=!0;else if(h==="-R"||h==="--rfc-email")o=!0;else if(h.startsWith("+"))s=h.slice(1);else{if(h.startsWith("--"))return re("date",h);if(h.startsWith("-"))for(let m of h.slice(1))if(m==="u")n=!0;else if(m==="I")i=!0;else if(m==="R")o=!0;else return re("date",`-${m}`)}}let a=t.env.get("TZ");a&&!cA(a)&&(a=void 0);let l=n?"UTC":a??"UTC",c=r!==null?dA(r,a):new Date;if(!c)return{stdout:"",stderr:`date: invalid date '${r}'
605
+ `,exitCode:1};let u=Math.floor(c.getTime()/1e3),f,d={maxOperations:t.limits.maxLoopIterations,maxOutputBytes:Math.min(t.limits.maxStringLength,t.limits.maxOutputSize)-1};return s?f=Es(s,u,l,d):i?f=Es("%Y-%m-%dT%H:%M:%S%z",u,l,d):o?f=Es("%a, %d %b %Y %H:%M:%S %z",u,l,d):f=Es("%a %b %e %H:%M:%S %Z %Y",u,l,d),{stdout:`${f}
606
+ `,stderr:"",exitCode:0}}},hA={name:"date",flags:[{flag:"-d",type:"value",valueHint:"string"},{flag:"-u",type:"boolean"},{flag:"-I",type:"boolean"},{flag:"-R",type:"boolean"}]}});function Qa(e){let t=e.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!t)return null;let n=parseFloat(t[1]);switch(t[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var gf=M(()=>{"use strict"});var w2={};ae(w2,{flagsForFuzzing:()=>yA,sleepCommand:()=>gA});var mA,y2,gA,yA,b2=M(()=>{"use strict";xs();gf();de();mA={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
607
+ s - seconds (default)
608
+ m - minutes
609
+ h - hours
610
+ d - days
611
+
612
+ NUMBER may be a decimal number.`,options:[" --help display this help and exit"]},y2=36e5,gA={name:"sleep",async execute(e,t){if(q(e))return G(mA);if(e.length===0)return{stdout:"",stderr:`sleep: missing operand
613
+ `,exitCode:1};let n=0;for(let r of e){let s=Qa(r);if(s===null)return{stdout:"",stderr:`sleep: invalid time interval '${r}'
614
+ `,exitCode:1};n+=s}if(n>y2&&(n=y2),t.signal?.aborted)return{stdout:"",stderr:"",exitCode:0};if(t.sleep){let r=Promise.resolve(t.sleep(n));if(t.signal){let s,i=new Promise(o=>{s=o,t.signal?.addEventListener("abort",s,{once:!0}),t.signal?.aborted&&o()});try{await Promise.race([r,i])}finally{s&&t.signal.removeEventListener("abort",s)}}else await r}else t.signal?await new Promise(r=>{let s=()=>{Js(i),r()},i=bs(()=>{t.signal?.removeEventListener("abort",s),r()},n);t.signal?.addEventListener("abort",s,{once:!0})}):await new Promise(r=>bs(r,n));return{stdout:"",stderr:"",exitCode:0}}},yA={name:"sleep",flags:[],needsArgs:!0}});var x2={};ae(x2,{flagsForFuzzing:()=>xA,timeoutCommand:()=>bA});var wA,bA,xA,E2=M(()=>{"use strict";ra();ce();vs();xs();gf();de();wA={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
615
+
616
+ DURATION is a number with optional suffix:
617
+ s - seconds (default)
618
+ m - minutes
619
+ h - hours
620
+ d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]},bA={name:"timeout",async execute(e,t){if(q(e))return G(wA);let n=0;for(let f=0;f<e.length;f++){let d=e[f];if(d==="--preserve-status")n=f+1;else if(d==="--foreground")n=f+1;else if(d==="-k"||d==="--kill-after")f++,n=f+1;else if(d.startsWith("--kill-after="))n=f+1;else if(d==="-s"||d==="--signal")f++,n=f+1;else if(d.startsWith("--signal="))n=f+1;else{if(d.startsWith("--")&&d!=="--")return re("timeout",d);if(d.startsWith("-")&&d.length>1&&d!=="--")if(d.startsWith("-k"))n=f+1;else if(d.startsWith("-s"))n=f+1;else return re("timeout",d);else{n=f;break}}}let r=e.slice(n);if(r.length===0)return{stdout:"",stderr:`timeout: missing operand
621
+ `,exitCode:1};let s=r[0],i=Qa(s);if(i===null)return{stdout:"",stderr:`timeout: invalid time interval '${s}'
622
+ `,exitCode:1};let o=r.slice(1);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
623
+ `,exitCode:1};if(!t.exec)return{stdout:"",stderr:`timeout: exec not available
624
+ `,exitCode:1};let a=new AbortController,l=ei(t.signal,a.signal),c,u;try{let f=new Promise(h=>{u=()=>h({timedOut:!0}),l.signal?.addEventListener("abort",u,{once:!0}),c=bs(()=>{a.abort()},i)}),d=t.exec(In([o[0]]),{cwd:t.cwd,signal:l.signal,stdin:t.stdin,stdinKind:"bytes",args:o.slice(1)}).then(h=>({timedOut:!1,result:h})),p=await Promise.race([f,d]);return p.timedOut?(await d.catch(()=>{}),{stdout:"",stderr:"",exitCode:124}):p.result}finally{c!==void 0&&Js(c),u&&l.signal?.removeEventListener("abort",u),l.cleanup()}}},xA={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2}});var O_,T_,ki,Xa,S2,Ni=M(()=>{"use strict";O_=globalThis.SharedArrayBuffer,T_=globalThis.Atomics,ki=performance.now.bind(performance),Xa=globalThis.Headers,S2=globalThis.Proxy});var A2={};ae(A2,{flagsForFuzzing:()=>AA,timeCommand:()=>EA});function SA(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${n.toString().padStart(2,"0")}:${r.toFixed(2).padStart(5,"0")}`:`${n}:${r.toFixed(2).padStart(5,"0")}`}var EA,AA,C2=M(()=>{"use strict";ce();_n();Lr();vs();Ni();EA={name:"time",async execute(e,t){let n="%e %M",r=null,s=!1,i=!1,o=0;for(;o<e.length;){let h=e[o];if(h==="-f"||h==="--format"){if(o++,o>=e.length)return{stdout:"",stderr:`time: missing argument to '-f'
625
+ `,exitCode:1};n=e[o],o++}else if(h==="-o"||h==="--output"){if(o++,o>=e.length)return{stdout:"",stderr:`time: missing argument to '-o'
626
+ `,exitCode:1};r=e[o],o++}else if(h==="-a"||h==="--append")s=!0,o++;else if(h==="-v"||h==="--verbose")n=`Command being timed: %C
627
+ Elapsed (wall clock) time: %e seconds
628
+ Maximum resident set size (kbytes): %M`,o++;else if(h==="-p"||h==="--portability")i=!0,o++;else if(h==="--"){o++;break}else if(h.startsWith("-"))o++;else break}let a=e.slice(o);if(a.length===0)return{stdout:"",stderr:"",exitCode:0};let l=ki(),c=a.join(" "),u;try{if(!t.exec)return{stdout:"",stderr:`time: exec not available
629
+ `,exitCode:1};u=await t.exec(In([a[0]]),{env:Ht(t.env),cwd:t.cwd,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:a.slice(1)})}catch(h){u={stdout:"",stderr:`time: ${Ye(h.message)}
630
+ `,exitCode:127}}let d=(ki()-l)/1e3,p;if(i?p=`real ${d.toFixed(2)}
631
+ user 0.00
632
+ sys 0.00
633
+ `:(p=n.replace(/%e/g,d.toFixed(2)).replace(/%E/g,SA(d)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,c),p.endsWith(`
634
+ `)||(p+=`
635
+ `)),r)try{let h=t.fs.resolvePath(t.cwd,r);if(s&&await t.fs.exists(h)){let m=await t.fs.readFile(h);await t.fs.writeFile(h,m+p)}else await t.fs.writeFile(h,p)}catch(h){let m=Ye(h.message);return{stdout:u.stdout,stderr:u.stderr+`time: cannot write to '${r}': ${m}
636
+ `,exitCode:u.exitCode}}else u={...u,stderr:u.stderr+p};return u}};AA={name:"time",flags:[{flag:"-p",type:"boolean"}],needsArgs:!0}});var v2={};ae(v2,{flagsForFuzzing:()=>vA,seqCommand:()=>CA});var CA,vA,k2=M(()=>{"use strict";At();ce();Z();CA={name:"seq",async execute(e,t){let n=`
637
+ `,r=!1,s=[],i=0;for(;i<e.length;){let y=e[i];if(y==="-s"&&i+1<e.length){n=e[i+1],i+=2;continue}if(y==="-w"){r=!0,i++;continue}if(y==="--"){i++;break}if(y.startsWith("-")&&y!=="-"){if(y.startsWith("-s")&&y.length>2){n=y.slice(2),i++;continue}if((y==="-ws"||y==="-sw")&&(r=!0,i+1<e.length)){n=e[i+1],i+=2;continue}}s.push(y),i++}for(;i<e.length;)s.push(e[i]),i++;if(s.length===0)return{stdout:"",stderr:`seq: missing operand
638
+ `,exitCode:1};let o=1,a=1,l;if(s.length===1?l=parseFloat(s[0]):s.length===2?(o=parseFloat(s[0]),l=parseFloat(s[1])):(o=parseFloat(s[0]),a=parseFloat(s[1]),l=parseFloat(s[2])),!Number.isFinite(o)||!Number.isFinite(a)||!Number.isFinite(l))return{stdout:"",stderr:`seq: invalid floating point argument: '${s.find(x=>!Number.isFinite(parseFloat(x)))}'
639
+ `,exitCode:1};if(a===0)return{stdout:"",stderr:`seq: invalid Zero increment value: '0'
640
+ `,exitCode:1};let c=[],u=y=>{let x=String(y),S=x.indexOf(".");return S===-1?0:x.length-S-1},f=Math.max(u(o),u(a),u(l)),d=Math.min(t.limits.maxLoopIterations,t.limits.maxArrayElements),p=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),h=U(n),m=0,g=0,b=y=>{if(g>=d)throw new C(`seq: iteration limit exceeded (${d})`,"iterations");let x=Ss(Ss(m,c.length>0?h:0,"seq"),Ss(U(y),1,"seq"),"seq");if(x>p)throw new C(`seq: output size limit exceeded (${p} bytes)`,"output_size");m=x-1,c.push(y),g++};if(a>0)for(let y=o;y<=l+1e-10;y+=a)b(f>0?y.toFixed(f):String(Math.round(y)));else for(let y=o;y>=l-1e-10;y+=a)b(f>0?y.toFixed(f):String(Math.round(y)));if(r&&c.length>0){let y=0;for(let E of c)y=Math.max(y,E.startsWith("-")?E.length-1:E.length);let x=c.reduce((E,A)=>Ss(E,y+(A.startsWith("-")?1:0),"seq"),0);if(Ss(Ss(x,Nh(h,Math.max(0,c.length-1),"seq"),"seq"),1,"seq")>p)throw new C(`seq: output size limit exceeded (${p} bytes)`,"output_size");for(let E=0;E<c.length;E++){let A=c[E].startsWith("-"),$=(A?c[E].slice(1):c[E]).padStart(y,"0");c[E]=A?`-${$}`:$}}let w=yr(c,n,p-1,"seq");return{stdout:w?`${w}
641
+ `:"",stderr:"",exitCode:0}}},vA={name:"seq",flags:[{flag:"-s",type:"value",valueHint:"string"},{flag:"-w",type:"boolean"}],needsArgs:!0}});var N2={};ae(N2,{exprCommand:()=>kA,flagsForFuzzing:()=>IA});function NA(e,t){if(e.length===1)return e[0];let n=0;function r(){let f=s();for(;n<e.length&&e[n]==="|";){n++;let d=s();if(f!=="0"&&f!=="")return f;f=d}return f}function s(){let f=i();for(;n<e.length&&e[n]==="&";){n++;let d=i();(f==="0"||f===""||d==="0"||d==="")&&(f="0")}return f}function i(){let f=o();for(;n<e.length;){let d=e[n];if(["=","!=","<",">","<=",">="].includes(d)){n++;let p=o(),h=parseInt(f,10),m=parseInt(p,10),g=!Number.isNaN(h)&&!Number.isNaN(m),b;d==="="?b=g?h===m:f===p:d==="!="?b=g?h!==m:f!==p:d==="<"?b=g?h<m:f<p:d===">"?b=g?h>m:f>p:d==="<="?b=g?h<=m:f<=p:b=g?h>=m:f>=p,f=b?"1":"0"}else break}return f}function o(){let f=a();for(;n<e.length;){let d=e[n];if(d==="+"||d==="-"){n++;let p=a(),h=parseInt(f,10),m=parseInt(p,10);if(Number.isNaN(h)||Number.isNaN(m))throw new Error("non-integer argument");f=String(d==="+"?h+m:h-m)}else break}return f}function a(){let f=l();for(;n<e.length;){let d=e[n];if(d==="*"||d==="/"||d==="%"){n++;let p=l(),h=parseInt(f,10),m=parseInt(p,10);if(Number.isNaN(h)||Number.isNaN(m))throw new Error("non-integer argument");if((d==="/"||d==="%")&&m===0)throw new Error("division by zero");d==="*"?f=String(h*m):d==="/"?f=String(Math.trunc(h/m)):f=String(h%m)}else break}return f}function l(){let f=c();for(;n<e.length&&e[n]===":";){n++;let d=c(),h=ie(`^${d}`).match(f);h?f=h[1]!==void 0?h[1]:String(h[0].length):f="0"}return f}function c(){if(n>=e.length)throw new Error("syntax error");let f=e[n];if(f==="match"){n++;let d=c(),p=c(),m=ie(p).match(d);return m?m[1]!==void 0?m[1]:String(m[0].length):"0"}if(f==="substr"){n++;let d=c(),p=parseInt(c(),10),h=parseInt(c(),10);if(Number.isNaN(p)||Number.isNaN(h))throw new Error("non-integer argument");return d.substring(p-1,p-1+h)}if(f==="index"){n++;let d=c(),p=c();t(p.length+d.length);let h=new Set;for(let m=0;m<p.length;m++)h.add(p[m]);for(let m=0;m<d.length;m++)if(h.has(d[m]))return String(m+1);return"0"}if(f==="length"){n++;let d=c();return String(d.length)}if(f==="("){n++;let d=r();if(n>=e.length||e[n]!==")")throw new Error("syntax error");return n++,d}return n++,f}let u=r();if(n!==e.length)throw new Error("syntax error");return u}var kA,IA,I2=M(()=>{"use strict";Nt();_n();pt();kA={name:"expr",async execute(e,t){if(e.length===0)return{stdout:"",stderr:`expr: missing operand
642
+ `,exitCode:2};try{let n=NA(e,s=>t.executionScope?.consumeWork(s,"expr index")),r=n==="0"||n===""?1:0;return{stdout:`${n}
643
+ `,stderr:"",exitCode:r}}catch(n){return he(n),{stdout:"",stderr:`expr: ${Ye(n.message)}
644
+ `,exitCode:2}}}};IA={name:"expr",flags:[],needsArgs:!0}});function TA(e){function t(p,h){return p<<h|p>>>32-h}let n=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),r=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],s=e.length*8,i=(e.length%64<56?56:120)-e.length%64,o=new Uint8Array(e.length+i+8);o.set(e),o[e.length]=128;let a=new DataView(o.buffer);a.setUint32(o.length-8,s>>>0,!0),a.setUint32(o.length-4,Math.floor(s/4294967296),!0);let l=1732584193,c=4023233417,u=2562383102,f=271733878;for(let p=0;p<o.length;p+=64){let h=new Uint32Array(16);for(let y=0;y<16;y++)h[y]=a.getUint32(p+y*4,!0);let m=l,g=c,b=u,w=f;for(let y=0;y<64;y++){let x,S;y<16?(x=g&b|~g&w,S=y):y<32?(x=w&g|~w&b,S=(5*y+1)%16):y<48?(x=g^b^w,S=(3*y+5)%16):(x=b^(g|~w),S=7*y%16),x=x+m+n[y]+h[S]>>>0,m=w,w=b,b=g,g=g+t(x,r[y])>>>0}l=l+m>>>0,c=c+g>>>0,u=u+b>>>0,f=f+w>>>0}let d=new Uint8Array(16);return new DataView(d.buffer).setUint32(0,l,!0),new DataView(d.buffer).setUint32(4,c,!0),new DataView(d.buffer).setUint32(8,u,!0),new DataView(d.buffer).setUint32(12,f,!0),Array.from(d).map(p=>p.toString(16).padStart(2,"0")).join("")}async function O2(e,t){if(e==="md5")return TA(t);let n=OA.get(e);if(!n)throw new Error(`Unknown algorithm: ${e}`);let r=await globalThis.crypto.subtle.digest(n,new Uint8Array(t).buffer);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}function Ii(e,t,n){let r={name:e,summary:n,usage:`${e} [OPTION]... [FILE]...`,options:["-c, --check read checksums from FILEs and check them"," --help display this help and exit"]};return{name:e,async execute(s,i){if(q(s))return G(r);let o=!1,a=[];for(let f of s)if(f==="-c"||f==="--check")o=!0;else if(!(f==="-b"||f==="-t"||f==="--binary"||f==="--text")){if(f.startsWith("-")&&f!=="-")return re(e,f);a.push(f)}a.length===0&&a.push("-");let l=async f=>{if(f==="-")return Uint8Array.from(i.stdin,d=>d.charCodeAt(0));try{return await i.fs.readFileBuffer(i.fs.resolvePath(i.cwd,f))}catch{return null}};if(o){let f=0,d="";for(let p of a){let h=p==="-"?ue(i.stdin):await i.fs.readFile(i.fs.resolvePath(i.cwd,p)).catch(()=>null);if(h===null)return{stdout:"",stderr:`${e}: ${p}: No such file or directory
645
+ `,exitCode:1};for(let m of h.split(`
646
+ `)){let g=m.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!g)continue;let[,b,w]=g,y=await l(w);if(y===null){d+=`${w}: FAILED open or read
647
+ `,f++;continue}let x=await O2(t,y)===b.toLowerCase();d+=`${w}: ${x?"OK":"FAILED"}
648
+ `,x||f++}}return f>0&&(d+=`${e}: WARNING: ${f} computed checksum${f>1?"s":""} did NOT match
649
+ `),{stdout:d,stderr:"",exitCode:f>0?1:0}}let c="",u=0;for(let f of a){let d=await l(f);if(d===null){c+=`${e}: ${f}: No such file or directory
650
+ `,u=1;continue}c+=`${await O2(t,d)} ${f}
651
+ `}return{stdout:c,stderr:"",exitCode:u}}}}var OA,Ya=M(()=>{"use strict";ce();de();OA=new Map([["sha1","SHA-1"],["sha256","SHA-256"]])});var T2={};ae(T2,{flagsForFuzzing:()=>$A,md5sumCommand:()=>RA});var RA,$A,R2=M(()=>{"use strict";Ya();RA=Ii("md5sum","md5","compute MD5 message digest"),$A={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var $2={};ae($2,{flagsForFuzzing:()=>DA,sha1sumCommand:()=>PA});var PA,DA,P2=M(()=>{"use strict";Ya();PA=Ii("sha1sum","sha1","compute SHA1 message digest"),DA={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var D2={};ae(D2,{flagsForFuzzing:()=>FA,sha256sumCommand:()=>LA});var LA,FA,L2=M(()=>{"use strict";Ya();LA=Ii("sha256sum","sha256","compute SHA256 message digest"),FA={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var F2=ta(yf=>{yf.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?s-1:0,d=n?-1:1,p=e[t+f];for(f+=d,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+e[t+f],f+=d,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+f],f+=d,u-=8);if(i===0)i=1-c;else{if(i===l)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-c}return(p?-1:1)*o*Math.pow(2,i-r)};yf.write=function(e,t,n,r,s,i){var o,a,l,c=i*8-s-1,u=(1<<c)-1,f=u>>1,d=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?t+=d/l:t+=d*Math.pow(2,1-f),t*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(t*l-1)*Math.pow(2,s),o=o+f):(a=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+p]=a&255,p+=h,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[n+p]=o&255,p+=h,o/=256,c-=8);e[n+p-h]|=m*128}});function _A(){if(!(typeof globalThis.TextDecoder>"u"))return Ja??(Ja=new globalThis.TextDecoder("utf-8"))}function _2(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let n=_A();return n?n.decode(e):UA(e)}case"utf-16le":return zA(e);case"us-ascii":case"ascii":return WA(e);case"latin1":case"iso-8859-1":return jA(e);case"windows-1252":return HA(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function wf(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Ft(e,t,n){t.push(n),t.length>=Oi&&wf(e,t)}function BA(e,t,n){if(n<=65535){Ft(e,t,n);return}n-=65536,Ft(e,t,55296+(n>>10)),Ft(e,t,56320+(n&1023))}function UA(e){let t=[],n=[],r=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(r=3);r<e.length;){let s=e[r];if(s<=127){Ft(t,n,s),r++;continue}if(s<194||s>244){Ft(t,n,ar),r++;continue}if(s<=223){if(r+1>=e.length){Ft(t,n,ar),r++;continue}let u=e[r+1];if((u&192)!==128){Ft(t,n,ar),r++;continue}let f=(s&31)<<6|u&63;Ft(t,n,f),r+=2;continue}if(s<=239){if(r+2>=e.length){Ft(t,n,ar),r++;continue}let u=e[r+1],f=e[r+2];if(!((u&192)===128&&(f&192)===128&&!(s===224&&u<160)&&!(s===237&&u>=160))){Ft(t,n,ar),r++;continue}let p=(s&15)<<12|(u&63)<<6|f&63;Ft(t,n,p),r+=3;continue}if(r+3>=e.length){Ft(t,n,ar),r++;continue}let i=e[r+1],o=e[r+2],a=e[r+3];if(!((i&192)===128&&(o&192)===128&&(a&192)===128&&!(s===240&&i<144)&&!(s===244&&i>143))){Ft(t,n,ar),r++;continue}let c=(s&7)<<18|(i&63)<<12|(o&63)<<6|a&63;BA(t,n,c),r+=4}return wf(t,n),t.join("")}function zA(e){let t=[],n=[],r=e.length,s=0;for(;s+1<r;){let i=e[s]|e[s+1]<<8;if(s+=2,i>=55296&&i<=56319){if(s+1<r){let o=e[s]|e[s+1]<<8;o>=56320&&o<=57343?(Ft(t,n,i),Ft(t,n,o),s+=2):Ft(t,n,ar)}else Ft(t,n,ar);continue}if(i>=56320&&i<=57343){Ft(t,n,ar);continue}Ft(t,n,i)}return s<r&&Ft(t,n,ar),wf(t,n),t.join("")}function WA(e){let t=[];for(let n=0;n<e.length;n+=Oi){let r=Math.min(e.length,n+Oi),s=new Array(r-n);for(let i=n,o=0;i<r;i++,o++)s[o]=e[i]&127;t.push(String.fromCharCode.apply(null,s))}return t.join("")}function jA(e){let t=[];for(let n=0;n<e.length;n+=Oi){let r=Math.min(e.length,n+Oi),s=new Array(r-n);for(let i=n,o=0;i<r;i++,o++)s[o]=e[i];t.push(String.fromCharCode.apply(null,s))}return t.join("")}function HA(e){let t=[],n="";for(let r=0;r<e.length;r++){let s=e[r],i=s>=128&&s<=159?M2[s]:void 0;n+=i??String.fromCharCode(s),n.length>=Oi&&(t.push(n),n="")}return n&&t.push(n),t.join("")}var M2,MA,Ja,Oi,ar,B2=M(()=>{M2={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},MA={};for(let[e,t]of Object.entries(M2))MA[t]=Number.parseInt(e,10);Oi=32*1024,ar=65533});function bn(e){return new DataView(e.buffer,e.byteOffset)}var U2,z2,Et,Ps,bt,bf,W2,j2,xn,So=M(()=>{U2=Yp(F2(),1);B2();z2={len:1,get(e,t){return bn(e).getUint8(t)},put(e,t,n){return bn(e).setUint8(t,n),t+1}},Et={len:2,get(e,t){return bn(e).getUint16(t,!0)},put(e,t,n){return bn(e).setUint16(t,n,!0),t+2}},Ps={len:2,get(e,t){return bn(e).getUint16(t)},put(e,t,n){return bn(e).setUint16(t,n),t+2}},bt={len:4,get(e,t){return bn(e).getUint32(t,!0)},put(e,t,n){return bn(e).setUint32(t,n,!0),t+4}},bf={len:4,get(e,t){return bn(e).getUint32(t)},put(e,t,n){return bn(e).setUint32(t,n),t+4}},W2={len:4,get(e,t){return bn(e).getInt32(t)},put(e,t,n){return bn(e).setInt32(t,n),t+4}},j2={len:8,get(e,t){return bn(e).getBigUint64(t,!0)},put(e,t,n){return bn(e).setBigUint64(t,n,!0),t+8}},xn=class{constructor(t,n){this.len=t,this.encoding=n}get(t,n=0){let r=t.subarray(n,n+this.len);return _2(r,this.encoding)}}});var GA,nt,Ds,Ao=M(()=>{GA="End-Of-Stream",nt=class extends Error{constructor(){super(GA),this.name="EndOfStreamError"}},Ds=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var H2=M(()=>{});var Ls,el=M(()=>{Ao();Ls=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,n=!1){let r=await this.read(t,n);return this.peekQueue.push(t.subarray(0,r)),r}async read(t,n=!1){if(t.length===0)return 0;let r=this.readFromPeekBuffer(t);if(this.endOfStream||(r+=await this.readRemainderFromStream(t.subarray(r),n)),r===0&&!n)throw new nt;return r}readFromPeekBuffer(t){let n=t.length,r=0;for(;this.peekQueue.length>0&&n>0;){let s=this.peekQueue.pop();if(!s)throw new Error("peekData should be defined");let i=Math.min(s.length,n);t.set(s.subarray(0,i),r),r+=i,n-=i,i<s.length&&this.peekQueue.push(s.subarray(i))}return r}async readRemainderFromStream(t,n){let r=0;for(;r<t.length&&!this.endOfStream;){if(this.interrupted)throw new Ds;let s=await this.readFromStream(t.subarray(r),n);if(s===0)break;r+=s}if(!n&&r<t.length)throw new nt;return r}}});var V2=M(()=>{Ao();H2();el()});var tl,G2=M(()=>{el();tl=class extends Ls{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Co,xf=M(()=>{G2();Co=class extends tl{async readFromStream(t,n){if(t.length===0)return 0;let r=await this.reader.read(new Uint8Array(t.length),{min:n?void 0:t.length});return r.done&&(this.endOfStream=r.done),r.value?(t.set(r.value),r.value.length):0}}});var Ti,Ef=M(()=>{Ao();el();Ti=class extends Ls{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,n){let r=Math.min(n.length,t.length);return t.set(n.subarray(0,r)),r<n.length?this.buffer=n.subarray(r):this.buffer=null,r}async readFromStream(t,n){if(t.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(t,this.buffer));r<t.length&&!this.endOfStream;){let s=await this.reader.read();if(s.done){this.endOfStream=!0;break}s.value&&(r+=this.writeChunk(t.subarray(r),s.value))}if(!n&&r===0&&this.endOfStream)throw new nt;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function Sf(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Ti(t):new Co(t)}catch(t){if(t instanceof TypeError)return new Ti(e.getReader());throw t}}var q2=M(()=>{xf();Ef()});var Fs=M(()=>{Ao();V2();xf();Ef();q2()});var Br,vo=M(()=>{Fs();Br=class{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,n=this.position){let r=new Uint8Array(t.len);if(await this.readBuffer(r,{position:n})<t.len)throw new nt;return t.get(r,0)}async peekToken(t,n=this.position){let r=new Uint8Array(t.len);if(await this.peekBuffer(r,{position:n})<t.len)throw new nt;return t.get(r,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new nt;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new nt;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");if(this.fileInfo.size!==void 0){let n=this.fileInfo.size-this.position;if(t>n)return this.position+=n,n}return this.position+=t,t}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(t,n){if(!this.supportsRandomAccess()&&n&&n.position!==void 0&&n.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...n}}abort(){return Promise.resolve()}}});var ZA,nl,Z2=M(()=>{vo();Fs();ZA=256e3,nl=class extends Br{constructor(t,n){super(n),this.streamReader=t,this.fileInfo=n?.fileInfo??{}}async readBuffer(t,n){let r=this.normalizeOptions(t,n),s=r.position-this.position;if(s>0)return await this.ignore(s),this.readBuffer(t,n);if(s<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let i=await this.streamReader.read(t.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!n||!n.mayBeLess)&&i<r.length)throw new nt;return i}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=0;if(r.position){let i=r.position-this.position;if(i>0){let o=new Uint8Array(r.length+i);return s=await this.peekBuffer(o,{mayBeLess:r.mayBeLess}),t.set(o.subarray(i)),s-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{s=await this.streamReader.peek(t.subarray(0,r.length),r.mayBeLess)}catch(i){if(n?.mayBeLess&&i instanceof nt)return 0;throw i}if(!r.mayBeLess&&s<r.length)throw new nt}return s}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");let n=Math.min(ZA,t),r=new Uint8Array(n),s=0;for(;s<t;){let i=t-s,o=await this.readBuffer(r,{length:Math.min(n,i)});if(o<0)return o;s+=o}return s}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var rl,K2=M(()=>{Fs();vo();rl=class extends Br{constructor(t,n){super(n),this.uint8Array=t,this.fileInfo={...n?.fileInfo??{},size:t.length}}async readBuffer(t,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(t,n);return this.position+=r,r}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new nt;return t.set(this.uint8Array.subarray(r.position,r.position+s)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});var sl,Q2=M(()=>{Fs();vo();sl=class extends Br{constructor(t,n){super(n),this.blob=t,this.fileInfo={...n?.fileInfo??{},size:t.size,mimeType:t.type}}async readBuffer(t,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(t,n);return this.position+=r,r}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new nt;let i=await this.blob.slice(r.position,r.position+s).arrayBuffer();return t.set(new Uint8Array(i)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});function X2(e,t){let n=Sf(e),r=t??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new nl(n,r)}function Y2(e,t){return new rl(e,t)}function J2(e,t){return new sl(e,t)}var ey=M(()=>{Fs();Z2();K2();Q2();Fs();vo()});var ny=ta((UB,ty)=>{var Ri=1e3,$i=Ri*60,Pi=$i*60,Ms=Pi*24,QA=Ms*7,XA=Ms*365.25;ty.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return YA(e);if(n==="number"&&isFinite(e))return t.long?eC(e):JA(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function YA(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*XA;case"weeks":case"week":case"w":return n*QA;case"days":case"day":case"d":return n*Ms;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Pi;case"minutes":case"minute":case"mins":case"min":case"m":return n*$i;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ri;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function JA(e){var t=Math.abs(e);return t>=Ms?Math.round(e/Ms)+"d":t>=Pi?Math.round(e/Pi)+"h":t>=$i?Math.round(e/$i)+"m":t>=Ri?Math.round(e/Ri)+"s":e+"ms"}function eC(e){var t=Math.abs(e);return t>=Ms?il(e,t,Ms,"day"):t>=Pi?il(e,t,Pi,"hour"):t>=$i?il(e,t,$i,"minute"):t>=Ri?il(e,t,Ri,"second"):e+" ms"}function il(e,t,n,r){var s=t>=n*1.5;return Math.round(e/n)+" "+r+(s?"s":"")}});var sy=ta((zB,ry)=>{function tC(e){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=s,n.enabled=a,n.humanize=ny(),n.destroy=c,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let f=0;for(let d=0;d<u.length;d++)f=(f<<5)-f+u.charCodeAt(d),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=t;function n(u){let f,d=null,p,h;function m(...g){if(!m.enabled)return;let b=m,w=Number(new Date),y=w-(f||w);b.diff=y,b.prev=f,b.curr=w,f=w,g[0]=n.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let x=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(E,A)=>{if(E==="%%")return"%";x++;let I=n.formatters[A];if(typeof I=="function"){let $=g[x];E=I.call(b,$),g.splice(x,1),x--}return E}),n.formatArgs.call(b,g),(b.log||n.log).apply(b,g)}return m.namespace=u,m.useColors=n.useColors(),m.color=n.selectColor(u),m.extend=r,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==n.namespaces&&(p=n.namespaces,h=n.enabled(u)),h),set:g=>{d=g}}),typeof n.init=="function"&&n.init(m),m}function r(u,f){let d=n(this.namespace+(typeof f>"u"?":":f)+u);return d.log=this.log,d}function s(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function i(u,f){let d=0,p=0,h=-1,m=0;for(;d<u.length;)if(p<f.length&&(f[p]===u[d]||f[p]==="*"))f[p]==="*"?(h=p,m=d,p++):(d++,p++);else if(h!==-1)p=h+1,m++,d=m;else return!1;for(;p<f.length&&f[p]==="*";)p++;return p===f.length}function o(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function a(u){for(let f of n.skips)if(i(u,f))return!1;for(let f of n.names)if(i(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}ry.exports=tC});var iy=ta((En,ol)=>{En.formatArgs=rC;En.save=sC;En.load=iC;En.useColors=nC;En.storage=oC();En.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();En.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function nC(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function rC(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+ol.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let n=0,r=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(n++,s==="%c"&&(r=n))}),e.splice(r,0,t)}En.log=console.debug||console.log||(()=>{});function sC(e){try{e?En.storage.setItem("debug",e):En.storage.removeItem("debug")}catch{}}function iC(){let e;try{e=En.storage.getItem("debug")||En.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function oC(){try{return localStorage}catch{}}ol.exports=sy()(En);var{formatters:aC}=ol.exports;aC.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var _s,Af,oy,ay,ly,cy=M(()=>{So();_s={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Af={get(e){return{signature:bt.get(e,0),compressedSize:bt.get(e,8),uncompressedSize:bt.get(e,12)}},len:16},oy={get(e){let t=Et.get(e,6);return{signature:bt.get(e,0),minVersion:Et.get(e,4),dataDescriptor:!!(t&8),compressedMethod:Et.get(e,8),compressedSize:bt.get(e,18),uncompressedSize:bt.get(e,22),filenameLength:Et.get(e,26),extraFieldLength:Et.get(e,28),filename:null}},len:30},ay={get(e){return{signature:bt.get(e,0),nrOfThisDisk:Et.get(e,4),nrOfThisDiskWithTheStart:Et.get(e,6),nrOfEntriesOnThisDisk:Et.get(e,8),nrOfEntriesOfSize:Et.get(e,10),sizeOfCd:bt.get(e,12),offsetOfStartOfCd:bt.get(e,16),zipFileCommentLength:Et.get(e,20)}},len:22},ly={get(e){let t=Et.get(e,8);return{signature:bt.get(e,0),minVersion:Et.get(e,6),dataDescriptor:!!(t&8),compressedMethod:Et.get(e,10),compressedSize:bt.get(e,20),uncompressedSize:bt.get(e,24),filenameLength:Et.get(e,28),extraFieldLength:Et.get(e,30),fileCommentLength:Et.get(e,32),relativeOffsetOfLocalHeader:bt.get(e,42),filename:null}},len:46}});function fy(e){let t=new Uint8Array(bt.len);return bt.put(t,0,e),t}function cC(e,t){let n=e.length,r=t.length;if(r>n)return-1;for(let s=0;s<=n-r;s++){let i=!0;for(let o=0;o<r;o++)if(e[s+o]!==t[o]){i=!1;break}if(i)return s}return-1}function uC(e){let t=e.reduce((s,i)=>s+i.length,0),n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}var uy,Sr,Cf,lC,al,Bs,dy=M(()=>{So();uy=Yp(iy(),1);cy();Sr=(0,uy.default)("tokenizer:inflate"),Cf=256*1024,lC=fy(_s.DataDescriptor),al=fy(_s.EndOfCentralDirectory),Bs=class e{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Cf)}async isZip(){return await this.peekSignature()===_s.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(bt)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,n=Math.min(16*1024,t.fileInfo.size),r=this.syncBuffer.subarray(0,n);await this.tokenizer.readBuffer(r,{position:t.fileInfo.size-n});for(let s=r.length-4;s>=0;s--)if(r[s]===al[0]&&r[s+1]===al[1]&&r[s+2]===al[2]&&r[s+3]===al[3])return t.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Sr("Cannot reading central-directory without random-read support");return}Sr("Reading central-directory...");let t=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){Sr("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(ay,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let o=await this.tokenizer.readToken(ly);if(o.signature!==_s.CentralFileHeader)throw new Error("Expected Central-File-Header signature");o.filename=await this.tokenizer.readToken(new xn(o.filenameLength,"utf-8")),await this.tokenizer.ignore(o.extraFieldLength),await this.tokenizer.ignore(o.fileCommentLength),s.push(o),Sr(`Add central-directory file-entry: n=${i+1}/${s.length}: filename=${s[i].filename}`)}return this.tokenizer.setPosition(t),s}this.tokenizer.setPosition(t)}async unzip(t){let n=await this.readCentralDirectory();if(n)return this.iterateOverCentralDirectory(n,t);let r=!1;do{let s=await this.readLocalFileHeader();if(!s)break;let i=t(s);r=!!i.stop;let o;if(await this.tokenizer.ignore(s.extraFieldLength),s.dataDescriptor&&s.compressedSize===0){let a=[],l=Cf;Sr("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===Cf;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=cC(this.syncBuffer.subarray(0,l),lC);let u=c>=0?c:l;if(i.handler){let f=new Uint8Array(u);await this.tokenizer.readBuffer(f),a.push(f)}else await this.tokenizer.ignore(u)}Sr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,uC(a),i.handler)}else i.handler?(Sr(`Reading compressed-file-data: ${s.compressedSize} bytes`),o=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(s,o,i.handler)):(Sr(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(Sr(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(Af)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Af.len}`)}while(!r)}async iterateOverCentralDirectory(t,n){for(let r of t){let s=n(r);if(s.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let i=await this.readLocalFileHeader();if(i){await this.tokenizer.ignore(i.extraFieldLength);let o=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(o),await this.inflate(i,o,s.handler)}}if(s.stop)break}}async inflate(t,n,r){if(t.compressedMethod===0)return r(n);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);Sr(`Decompress filename=${t.filename}, compressed-size=${n.length}`);let s=await e.decompressDeflateRaw(n);return r(s)}static async decompressDeflateRaw(t){let n=new ReadableStream({start(i){i.enqueue(t),i.close()}}),r=new DecompressionStream("deflate-raw"),s=n.pipeThrough(r);try{let o=await new Response(s).arrayBuffer();return new Uint8Array(o)}catch(i){let o=i instanceof Error?`Failed to deflate ZIP entry: ${i.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(o)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(bt);if(t===_s.LocalFileHeader){let n=await this.tokenizer.readToken(oy);return n.filename=await this.tokenizer.readToken(new xn(n.filenameLength,"utf-8")),n}if(t===_s.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var ko,py=M(()=>{ko=class{constructor(t){this.tokenizer=t}inflate(){let t=this.tokenizer;return new ReadableStream({async pull(n){let r=new Uint8Array(1024),s=await t.readBuffer(r,{mayBeLess:!0});if(s===0){n.close();return}n.enqueue(r.subarray(0,s))}}).pipeThrough(new DecompressionStream("gzip"))}}});var hy=M(()=>{dy();py()});function vf(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}var XB,YB,JB,my=M(()=>{XB={utf8:new globalThis.TextDecoder("utf8")},YB=new globalThis.TextEncoder,JB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});function gy(e,t){if(t==="utf-16le"){let n=[];for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);n.push(s&255,s>>8&255)}return n}if(t==="utf-16be"){let n=[];for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);n.push(s>>8&255,s&255)}return n}return[...e].map(n=>n.charCodeAt(0))}function yy(e,t=0){let n=Number.parseInt(new xn(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(n))return!1;let r=256;for(let s=t;s<t+148;s++)r+=e[s];for(let s=t+156;s<t+512;s++)r+=e[s];return n===r}var wy,by=M(()=>{So();wy={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}});var xy,Ey,Sy=M(()=>{xy=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],Ey=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"]});function CC(e){let t=e?.streamReader;if(t?.constructor?.name!=="WebStreamByobReader")return e;let{reader:n}=t,r=async()=>{await n.cancel(),n.releaseLock()};return t.close=r,t.abort=async()=>{t.interrupted=!0,await r()},e}function Of(e,t,n){if(!Number.isFinite(e)||e<0||e>t)throw new Ur(`${n} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Yr(e,t,{maximumLength:n=qn,reason:r="skip"}={}){let s=Of(t,n,r);await e.ignore(s)}async function Nf(e,t,n,{maximumLength:r=t.length,reason:s="read"}={}){let i=n?.length??t.length,o=Of(i,r,s);return e.readBuffer(t,{...n,length:o})}async function vC(e,{maximumLength:t=Cr}={}){let s=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),i=[],o=0;try{for(;;){let{done:c,value:u}=await s.read();if(c)break;if(o+=u.length,o>t)throw await s.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);i.push(u)}}finally{s.releaseLock()}let a=new Uint8Array(o),l=0;for(let c of i)a.set(c,l),l+=c.length;return a}function NC(e,t){if(e.length<ll)return-1;let n=e.length-ll;for(let r=0;r<=n;r++)if(bt.get(e,r)===Ly&&bt.get(e,r+8)===t+r)return r;return-1}function IC(e){return(e.codePointAt(0)&32)!==0}function OC(e,t){let n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}async function TC(e,{shouldBuffer:t,maximumLength:n=Cr}={}){let{syncBuffer:r}=e,{length:s}=r,i=[],o=0;for(;;){let a=await e.tokenizer.peekBuffer(r,{mayBeLess:!0}),l=NC(r.subarray(0,a),o),c=l>=0?0:a===s?Math.min(kC,a-1):0,u=l>=0?l:a-c;if(u===0)break;if(o+=u,o>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);if(t){let f=new Uint8Array(u);await e.tokenizer.readBuffer(f),i.push(f)}else await e.tokenizer.ignore(u);if(l>=0)break}if(ln(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=o),!!t)return OC(i,o)}function RC(e,t){return ln(e.tokenizer)?Math.max(0,qn-(e.tokenizer.position-t)):Math.max(0,Cr-e.knownSizeDescriptorScannedBytes)}async function $C(e,t,{shouldBuffer:n,maximumDescriptorLength:r=Cr}={}){if(t.dataDescriptor&&t.compressedSize===0)return TC(e,{shouldBuffer:n,maximumLength:r});if(!n){await Yr(e.tokenizer,t.compressedSize,{maximumLength:ln(e.tokenizer)?Cr:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let s=_C(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>s)throw new Error(`ZIP entry compressed data exceeds ${s} bytes`);let i=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(i),i}function PC(e,t){let n=e.getReader(),r=0,s=!1,i=!1,o=async a=>{s||i||(i=!0,await n.cancel(a))};return new ReadableStream({async pull(a){if(r>=t){a.close(),await o();return}let{done:l,value:c}=await n.read();if(l||!c){s=!0,a.close();return}let u=t-r;if(c.length>u){a.enqueue(c.subarray(0,u)),r+=u,a.close(),await o();return}a.enqueue(c),r+=c.length},async cancel(a){await o(a)}})}async function Fy(e,t){return new If(t).fromBuffer(e)}function $y(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function Ar(e,t,n){n={offset:0,...n};for(let[r,s]of t.entries())if(n.mask){if(s!==(n.mask[r]&e[r+n.offset]))return!1}else if(s!==e[r+n.offset])return!1;return!0}function DC(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):No}function LC(e,t,n){return n===void 0?e.read(t):(n.throwIfAborted(),new Promise((r,s)=>{let i=()=>{n.removeEventListener("abort",o)},o=()=>{let a=n.reason;i(),(async()=>{try{await e.cancel(a)}catch{}})(),s(a)};n.addEventListener("abort",o,{once:!0}),(async()=>{try{let a=await e.read(t);i(),r(a)}catch(a){i(),s(a)}})()}))}function FC(e){return Number.isFinite(e)?Math.max(0,Math.min(fC,Math.trunc(e))):0}function MC(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function ln(e){let t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Io(e,t,n){return ln(e)&&e.position-t>n}function _C(e){let t=e.fileInfo.size,n=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(n,dC)}function BC(e){if(e instanceof nt||e instanceof Ur)return!0;if(!(e instanceof Error))return!1;if(EC.has(e.message)||AC.has(e.code))return!0;for(let t of SC)if(e.message.startsWith(t))return!0;return!1}function Py(e,t=Cr){let n=[e.compressedSize,e.uncompressedSize];for(let r of n)if(!Number.isFinite(r)||r<0||r>t)return!1;return!0}function UC(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function zC(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function Dy(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function WC(e){let t=e.indexOf('.main+xml"');if(t===-1){let s="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${s}"`)?s:void 0}let n=e.slice(0,t),r=n.lastIndexOf('"');return n.slice(r+1)}var No,fC,Cr,Ay,dC,qn,cl,Cy,pC,hC,vy,kf,ky,Ny,mC,gC,yC,wC,bC,Iy,Oy,Ty,xC,Ry,EC,SC,AC,Ur,Ly,ll,kC,If,lU,cU,My=M(()=>{So();ey();hy();my();by();Sy();No=4100,fC=No-2,Cr=1024*1024,Ay=1024,dC=2**31-1,qn=16*1024*1024,cl=Cr,Cy=Cr,pC=qn,hC=1,vy=100,kf=qn,ky=64,Ny=cl,mC=256,gC=512,yC=qn,wC=512,bC=512,Iy=256,Oy=cl,Ty=cl,xC=cl,Ry=qn,EC=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),SC=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],AC=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),Ur=class extends Error{};Ly=134695760,ll=16,kC=ll-1;Bs.prototype.inflate=async function(e,t,n){if(e.compressedMethod===0)return n(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);let r=await vC(t,{maximumLength:Cr});return n(r)};Bs.prototype.unzip=async function(e){let t=!1,n=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Io(this.tokenizer,r,qn))throw new Ur(`ZIP stream probing exceeds ${qn} bytes`);let s=await this.readLocalFileHeader();if(!s)break;if(n++,n>Ay)throw new Error(`ZIP entry count exceeds ${Ay}`);let i=e(s);t=!!i.stop,await this.tokenizer.ignore(s.extraFieldLength);let o=await $C(this,s,{shouldBuffer:!!i.handler,maximumDescriptorLength:Math.min(Cr,RC(this,r))});if(i.handler&&await this.inflate(s,o,i.handler),s.dataDescriptor){let a=new Uint8Array(ll);if(await this.tokenizer.readBuffer(a),bt.get(a,0)!==Ly)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-a.length}`)}if(Io(this.tokenizer,r,qn))throw new Ur(`ZIP stream probing exceeds ${qn} bytes`)}while(!t)};If=class e{constructor(t){let n=FC(t?.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:n},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return CC(X2(t,this.getTokenizerOptions()))}async parseTokenizer(t,n=0){this.detectionReentryCount=n;let r=t.position;for(let s of this.detectors){let i;try{i=await s.detect(t)}catch(o){if(o instanceof nt||o instanceof Ur)return;throw o}if(i)return i;if(r!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);let n=t instanceof Uint8Array?t:new Uint8Array(t);if(n?.length>1)return this.fromTokenizer(Y2(n,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let n=J2(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){this.options.signal?.throwIfAborted();let n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,n){let r=DC(n?.sampleSize??No),s,i,o=t.getReader({mode:"byob"});try{let{value:c,done:u}=await LC(o,new Uint8Array(r),this.options.signal);if(i=c,!u&&c)try{s=await this.fromBuffer(c.subarray(0,r))}catch(f){if(!(f instanceof nt))throw f;s=void 0}i=c}finally{o.releaseLock()}let a=new TransformStream({async start(c){c.enqueue(i)},transform(c,u){u.enqueue(c)}}),l=t.pipeThrough(a);return l.fileType=s,l}async detectGzip(t){if(this.gzipProbeDepth>=hC)return{ext:"gz",mime:"application/gzip"};let n=new ko(t),r=PC(n.inflate(),pC),s=ln(t),i,o,a,l;if(s){let c=new AbortController;i=setTimeout(()=>{c.abort(new DOMException(`Operation timed out after ${vy} ms`,"TimeoutError"))},vy),o=this.options.signal===void 0?c.signal:AbortSignal.any([this.options.signal,c.signal]),a=new e({...this.options,signal:o}),a.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{l=await(a??this).fromStream(r)}catch(c){if(c?.name==="AbortError"&&o?.reason?.name!=="TimeoutError")throw c}finally{clearTimeout(i),s||this.gzipProbeDepth--}return l?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,n){return Ar(this.buffer,t,n)}checkString(t,n){return this.check(gy(t,n?.encoding),n)}detectConfident=async t=>{if(this.buffer=new Uint8Array(No),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,ln(t)&&(await t.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(t);if(await t.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=Iy?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(t));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(t);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Yr(t,6,{maximumLength:6,reason:"ID3 header prefix"});let n=await t.readToken(wy),r=ln(t);if(!Number.isFinite(n)||n<0||r&&(n>kf||t.position+n>kf))return;if(t.position+n>t.fileInfo.size)return r?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Yr(t,n,{maximumLength:r?kf:t.fileInfo.size,reason:"ID3 payload"})}catch(s){if(s instanceof nt)return;throw s}return this.detectionReentryCount>=Iy?void 0:(this.detectionReentryCount++,this.parseTokenizer(t,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let n,r=UC();try{await new Bs(t).unzip(s=>{zC(r,s.filename);let i=s.filename==="[Content_Types].xml",o=Dy(r);if(!i&&o)return n=o,{stop:!0};switch(s.filename){case"META-INF/mozilla.rsa":return n={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return n={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Py(s,Cy)?{async handler(a){let l=new TextDecoder("utf-8").decode(a).trim();n=$y(l)},stop:!0}:{};case"[Content_Types].xml":return r.hasContentTypesEntry=!0,Py(s,Cy)?(r.isParsingContentTypes=!0,{async handler(a){let l=new TextDecoder("utf-8").decode(a),c=WC(l);c&&(n=$y(c)),r.hasParsedContentTypesEntry=!0,r.isParsingContentTypes=!1},stop:!0}):(r.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(s.filename)?(n={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(s){if(!BC(s))throw s;r.isParsingContentTypes&&(r.isParsingContentTypes=!1,r.hasUnparseableContentTypes=!0)}return n??Dy(r)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let n=new Uint8Array(8);return await t.readBuffer(n),Ar(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Ar(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Ar(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Ar(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Ar(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Ar(n,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let n=await this.readTiffHeader(!1);if(n)return n}if(this.check([77,77])){let n=await this.readTiffHeader(!0);if(n)return n}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function n(){let l=await t.peekNumber(z2),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let f=new Uint8Array(u+1);return await Nf(t,f,void 0,{maximumLength:f.length,reason:"EBML field"}),f}async function r(){let l=await n(),c=await n();c[0]^=128>>c.length-1;let u=Math.min(6,c.length),f=new DataView(l.buffer),d=new DataView(c.buffer,c.length-u,u);return{id:vf(f),len:vf(d)}}async function s(l){let c=0;for(;l>0;){if(c++,c>mC||Io(t,o,qn))return;let u=t.position,f=await r();if(f.id===17026){if(f.len>ky)return;let d=Of(f.len,ky,"EBML DocType");return(await t.readToken(new xn(d))).replaceAll(/\00.*$/g,"")}if(ln(t)&&(!Number.isFinite(f.len)||f.len<0||f.len>Ny)||(await Yr(t,f.len,{maximumLength:ln(t)?Ny:t.fileInfo.size,reason:"EBML payload"}),--l,t.position<=u))return}}let i=await r(),o=t.position;switch(await s(i.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let n=bf.get(this.buffer,4),r=Ps.get(this.buffer,6);if(n>0&&n<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(r>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let n=new xn(4,"latin1").get(this.buffer,2);if(n.match("^d*")&&n>=1e3&&n<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await t.ignore(8),await t.readToken(new xn(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
652
+ `,"\r"," "," ","\0"].some(n=>this.checkString(n,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){let n={ext:"png",mime:"image/png"},r={ext:"apng",mime:"image/apng"};await t.ignore(8);async function s(){return{length:await t.readToken(W2),type:await t.readToken(new xn(4,"latin1"))}}let i=ln(t),o=t.position,a=0,l=!1;do{if(a++,a>gC||Io(t,o,yC))break;let c=t.position,u=await s();if(u.length<0)return;if(u.type==="IHDR"){if(u.length!==13)return;l=!0}switch(u.type){case"IDAT":return n;case"acTL":return r;default:if(!l&&u.type!=="CgBI")return;if(i&&u.length>Oy)return l&&IC(u.type)?n:void 0;try{await Yr(t,u.length+4,{maximumLength:i?Oy+4:t.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!i&&(f instanceof Ur||f instanceof nt))return n;throw f}}if(t.position<=c)break}while(t.position+8<t.fileInfo.size);return n}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let n=new xn(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(n){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return n.startsWith("3g")?n.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
653
+ `))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let n=!1;try{async function r(){let a=new Uint8Array(16);return await Nf(t,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await t.readToken(j2))}}await Yr(t,30,{maximumLength:30,reason:"ASF header prelude"});let s=ln(t),i=t.position,o=0;for(;t.position+24<t.fileInfo.size&&(o++,!(o>wC||Io(t,i,qn)));){let a=t.position,l=await r(),c=l.size-24;if(!Number.isFinite(c)||c<0){n=!0;break}if(Ar(l.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let u=new Uint8Array(16);if(c-=await Nf(t,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),Ar(u,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(Ar(u,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(s&&c>Ty){n=!0;break}if(await Yr(t,c,{maximumLength:s?Ty:t.fileInfo.size,reason:"ASF header payload"}),t.position<=a){n=!0;break}}}catch(r){if(r instanceof nt||r instanceof Ur)ln(t)&&(n=!0);else throw r}return n?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await t.ignore(20),await t.readToken(new xn(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await t.peekBuffer(this.buffer,{length:Math.min(256,t.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let n=new DataView(this.buffer.buffer).getUint32(12,!0);if(n>12&&this.buffer.length>=n+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,n+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&yy(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let n="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:n})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:n})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
654
+ `,{offset:2,encoding:n})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async t=>{this.buffer=new Uint8Array(No);let n=MC(t.fileInfo.size);if(await t.peekBuffer(this.buffer,{length:Math.min(8,n),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,n),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let r=0;r<=this.options.mpegOffsetTolerance;++r){let s=this.scanMpeg(r);if(s)return s}};async readTiffTag(t){let n=await this.tokenizer.readToken(t?Ps:Et);switch(await this.tokenizer.ignore(10),n){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let n=await this.tokenizer.readToken(t?Ps:Et);if(!(n>bC)&&!(ln(this.tokenizer)&&2+n*12>Ry))for(let r=0;r<n;++r){let s=await this.readTiffTag(t);if(s)return s}}async readTiffHeader(t){let n={ext:"tif",mime:"image/tiff"},r=(t?Ps:Et).get(this.buffer,2),s=(t?bf:bt).get(this.buffer,4);if(r===42){if(s>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(s>=8){let a=(t?Ps:Et).get(this.buffer,8),l=(t?Ps:Et).get(this.buffer,10);if(a===28&&l===254||a===31&&l===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(ln(this.tokenizer)&&s>xC)return n;let i=ln(this.tokenizer)?Ry:this.tokenizer.fileInfo.size;try{await Yr(this.tokenizer,s,{maximumLength:i,reason:"TIFF IFD offset"})}catch(a){if(a instanceof nt)return;throw a}let o;try{o=await this.readTiffIFD(t)}catch(a){if(a instanceof nt)return;throw a}return o??n}if(r===43)return n}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},lU=new Set(xy),cU=new Set(Ey)});var _y={};ae(_y,{fileCommand:()=>QC,flagsForFuzzing:()=>XC});function GC(e,t){let n=VC.get(e);if(n)return n;let[r,s]=t.split("/"),i=s?.split("+")[0]?.replace(/-/g," ")||e;switch(r){case"image":return`${i.toUpperCase()} image data`;case"audio":return`${i.toUpperCase()} audio`;case"video":return`${i.toUpperCase()} video`;case"font":return`${i} font`;case"model":return`${i} 3D model`;case"application":return s?.includes("zip")||s?.includes("compressed")?`${i} archive data`:s?.includes("executable")?`${i} executable`:`${e.toUpperCase()} data`;default:return`${e.toUpperCase()} data`}}function qC(e){let t=e.split("/").pop()||e;if(t.startsWith(".")&&!t.includes(".",1))return t;let n=t.lastIndexOf(".");return n===-1||n===0?"":t.slice(n).toLowerCase()}function ZC(e,t){if(e.startsWith("#!")){let c=e.split(`
655
+ `)[0];return c.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:c.includes("node")||c.includes("bun")||c.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:c.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:c.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:c.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:c.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let n=e.trimStart();if(n.startsWith("<?xml"))return{description:"XML document",mime:"application/xml"};if(n.startsWith("<!DOCTYPE html")||n.toLowerCase().startsWith("<html"))return{description:"HTML document",mime:"text/html"};let r=e.includes(`\r
656
+ `),s=e.includes("\r")&&!r,i="";r?i=", with CRLF line terminators":s&&(i=", with CR line terminators");let o=qC(t),a=o?HC.get(o):void 0;if(a)return a.mime.startsWith("text/")&&i?{description:`${a.description}${i}`,mime:a.mime}:a;let l=!1;for(let c=0;c<Math.min(e.length,8192);c++)if(e.charCodeAt(c)>127){l=!0;break}return l?{description:`UTF-8 Unicode text${i}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${i}`,mime:"text/plain"}}async function KC(e,t){if(t.length===0)return{description:"empty",mime:"inode/x-empty"};let n=await Fy(t);if(n)return{description:GC(n.ext,n.mime),mime:n.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(t);return ZC(r,e)}var jC,HC,VC,QC,XC,By=M(()=>{"use strict";My();At();Nt();de();jC={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},HC=new Map([[".js",{description:"JavaScript source",mime:"text/javascript"}],[".mjs",{description:"JavaScript module",mime:"text/javascript"}],[".cjs",{description:"CommonJS module",mime:"text/javascript"}],[".ts",{description:"TypeScript source",mime:"text/typescript"}],[".tsx",{description:"TypeScript JSX source",mime:"text/typescript"}],[".jsx",{description:"JavaScript JSX source",mime:"text/javascript"}],[".py",{description:"Python script",mime:"text/x-python"}],[".rb",{description:"Ruby script",mime:"text/x-ruby"}],[".go",{description:"Go source",mime:"text/x-go"}],[".rs",{description:"Rust source",mime:"text/x-rust"}],[".c",{description:"C source",mime:"text/x-c"}],[".h",{description:"C header",mime:"text/x-c"}],[".cpp",{description:"C++ source",mime:"text/x-c++"}],[".hpp",{description:"C++ header",mime:"text/x-c++"}],[".java",{description:"Java source",mime:"text/x-java"}],[".sh",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".bash",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".zsh",{description:"Zsh shell script",mime:"text/x-shellscript"}],[".json",{description:"JSON data",mime:"application/json"}],[".yaml",{description:"YAML data",mime:"text/yaml"}],[".yml",{description:"YAML data",mime:"text/yaml"}],[".xml",{description:"XML document",mime:"application/xml"}],[".csv",{description:"CSV text",mime:"text/csv"}],[".toml",{description:"TOML data",mime:"text/toml"}],[".html",{description:"HTML document",mime:"text/html"}],[".htm",{description:"HTML document",mime:"text/html"}],[".css",{description:"CSS stylesheet",mime:"text/css"}],[".svg",{description:"SVG image",mime:"image/svg+xml"}],[".md",{description:"Markdown document",mime:"text/markdown"}],[".markdown",{description:"Markdown document",mime:"text/markdown"}],[".txt",{description:"ASCII text",mime:"text/plain"}],[".rst",{description:"reStructuredText",mime:"text/x-rst"}],[".env",{description:"ASCII text",mime:"text/plain"}],[".gitignore",{description:"ASCII text",mime:"text/plain"}],[".dockerignore",{description:"ASCII text",mime:"text/plain"}]]),VC=new Map([["jpg","JPEG image data"],["jpeg","JPEG image data"],["png","PNG image data"],["gif","GIF image data"],["webp","WebP image data"],["bmp","PC bitmap"],["ico","MS Windows icon resource"],["tif","TIFF image data"],["tiff","TIFF image data"],["psd","Adobe Photoshop Document"],["avif","AVIF image"],["heic","HEIC image"],["heif","HEIF image"],["jxl","JPEG XL image"],["icns","Mac OS X icon"],["svg","SVG Scalable Vector Graphics image"],["pdf","PDF document"],["epub","EPUB document"],["mobi","Mobipocket E-book"],["djvu","DjVu document"],["zip","Zip archive data"],["gz","gzip compressed data"],["gzip","gzip compressed data"],["bz2","bzip2 compressed data"],["xz","XZ compressed data"],["tar","POSIX tar archive"],["rar","RAR archive data"],["7z","7-zip archive data"],["lz","lzip compressed data"],["lzma","LZMA compressed data"],["zst","Zstandard compressed data"],["cab","Microsoft Cabinet archive"],["ar","Unix ar archive"],["rpm","RPM package"],["deb","Debian binary package"],["apk","Android Package"],["dmg","Apple disk image"],["iso","ISO 9660 CD-ROM filesystem data"],["vhd","Microsoft Virtual Hard Disk"],["vhdx","Microsoft Virtual Hard Disk (new format)"],["qcow2","QEMU QCOW Image"],["mp3","Audio file with ID3"],["m4a","MPEG-4 audio"],["aac","AAC audio"],["wav","RIFF (little-endian) data, WAVE audio"],["flac","FLAC audio bitstream data"],["ogg","Ogg data"],["oga","Ogg audio"],["opus","Ogg Opus audio"],["aiff","AIFF audio"],["wma","Windows Media Audio"],["amr","AMR audio"],["mid","MIDI audio"],["midi","MIDI audio"],["ape","Monkey's Audio"],["mp4","ISO Media, MPEG-4"],["m4v","MPEG-4 video"],["webm","WebM"],["avi","RIFF (little-endian) data, AVI"],["mov","ISO Media, Apple QuickTime movie"],["mkv","Matroska data"],["wmv","Windows Media Video"],["flv","Flash Video"],["3gp","3GPP multimedia"],["3g2","3GPP2 multimedia"],["ogv","Ogg video"],["mts","MPEG transport stream"],["m2ts","MPEG transport stream"],["ts","MPEG transport stream"],["mpg","MPEG video"],["mpeg","MPEG video"],["exe","PE32 executable"],["dll","PE32 DLL"],["elf","ELF executable"],["mach","Mach-O executable"],["wasm","WebAssembly (wasm) binary module"],["dex","Android Dalvik executable"],["class","Java class file"],["swf","Adobe Flash"],["doc","Microsoft Word Document"],["docx","Microsoft Word 2007+ Document"],["xls","Microsoft Excel Spreadsheet"],["xlsx","Microsoft Excel 2007+ Spreadsheet"],["ppt","Microsoft PowerPoint Presentation"],["pptx","Microsoft PowerPoint 2007+ Presentation"],["odt","OpenDocument Text"],["ods","OpenDocument Spreadsheet"],["odp","OpenDocument Presentation"],["ttf","TrueType Font"],["otf","OpenType Font"],["woff","Web Open Font Format"],["woff2","Web Open Font Format 2"],["eot","Embedded OpenType font"],["stl","Stereolithography CAD"],["obj","Wavefront 3D Object"],["gltf","GL Transmission Format"],["glb","GL Transmission Format (binary)"],["sqlite","SQLite 3.x database"],["mdb","Microsoft Access Database"],["xml","XML document"],["json","JSON data"],["macho","Mach-O binary"],["ics","iCalendar data"],["vcf","vCard data"],["msi","Microsoft Installer"],["ps","PostScript"],["ai","Adobe Illustrator"],["indd","Adobe InDesign"],["sketch","Sketch design file"],["fig","Figma design file"],["xd","Adobe XD"],["blend","Blender"],["fbx","Autodesk FBX"],["lnk","MS Windows shortcut"],["alias","Mac OS alias"],["torrent","BitTorrent file"],["pcap","pcap capture file"],["arrow","Apache Arrow"],["parquet","Apache Parquet"]]);QC={name:"file",async execute(e,t){if(q(e))return G(jC);let n=!1,r=!1,s=!1,i=[];for(let l of e)if(l.startsWith("--"))if(l==="--brief")n=!0;else if(l==="--mime"||l==="--mime-type")r=!0;else if(l==="--dereference")s=!0;else return re("file",l);else if(l.startsWith("-")&&l!=="-")for(let c of l.slice(1))if(c==="b")n=!0;else if(c==="i")r=!0;else if(c==="L")s=!0;else return re("file",`-${c}`);else i.push(l);if(i.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
657
+ `,exitCode:1};let o=new Te(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"file"),a=0;for(let l of i){t.executionScope?.consumeLimited("file-operands",1,t.limits.maxArrayElements,"file");try{let c=t.fs.resolvePath(t.cwd,l),u=s?await t.fs.stat(c):await t.fs.lstat(c);if(u.isSymbolicLink){let h=await t.fs.readlink(c),m=r?"inode/symlink":`symbolic link to ${h}`;o.append(n?`${m}
658
+ `:`${l}: ${m}
659
+ `);continue}if(u.isDirectory){let h=r?"inode/directory":"directory";o.append(n?`${h}
660
+ `:`${l}: ${h}
661
+ `);continue}let f=await t.fs.readFileBuffer(c);t.executionScope?.consumeInput(f.byteLength,"file");let d=await KC(l,f),p=r?d.mime:d.description;o.append(n?`${p}
662
+ `:`${l}: ${p}
663
+ `)}catch(c){he(c),o.append(n?`cannot open
664
+ `:`${l}: cannot open (No such file or directory)
665
+ `),a=1}}return{stdout:o.build(),stderr:"",exitCode:a}}},XC={name:"file",flags:[{flag:"-b",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var Uy={};ae(Uy,{flagsForFuzzing:()=>tv,htmlToMarkdownCommand:()=>ev});import YC from"turndown";var JC,ev,tv,zy=M(()=>{"use strict";ce();Nt();Z();de();JC={name:"html-to-markdown",summary:"convert HTML to Markdown (BashEnv extension)",usage:"html-to-markdown [OPTION]... [FILE]",description:["Convert HTML content to Markdown format using the turndown library.","This is a non-standard BashEnv extension command, not available in regular bash.","","Read HTML from FILE or standard input and output Markdown to standard output.","Commonly used with curl to convert web pages:"," curl -s https://example.com | html-to-markdown","","Supported HTML elements:"," - Headings (h1-h6) \u2192 # Markdown headings"," - Paragraphs (p) \u2192 Plain text with blank lines"," - Links (a) \u2192 [text](url)"," - Images (img) \u2192 ![alt](src)"," - Bold/Strong \u2192 **text**"," - Italic/Em \u2192 _text_"," - Code (code, pre) \u2192 `inline` or fenced blocks"," - Lists (ul, ol, li) \u2192 - or 1. items"," - Blockquotes \u2192 > quoted text"," - Horizontal rules (hr) \u2192 ---"],options:["-b, --bullet=CHAR bullet character for unordered lists (-, +, or *)","-c, --code=FENCE fence style for code blocks (``` or ~~~)","-r, --hr=STRING string for horizontal rules (default: ---)"," --heading-style=STYLE"," heading style: 'atx' for # headings (default),"," 'setext' for underlined headings (h1/h2 only)"," --help display this help and exit"],examples:["echo '<h1>Hello</h1><p>World</p>' | html-to-markdown","html-to-markdown page.html","curl -s https://example.com | html-to-markdown > page.md"]},ev={name:"html-to-markdown",async execute(e,t){if(q(e))return G(JC);let n="-",r="```",s="---",i="atx",o=[];for(let b=0;b<e.length;b++){let w=e[b];if(w==="-b"||w==="--bullet")n=e[++b]??"-";else if(w.startsWith("--bullet="))n=w.slice(9);else if(w==="-c"||w==="--code")r=e[++b]??"```";else if(w.startsWith("--code="))r=w.slice(7);else if(w==="-r"||w==="--hr")s=e[++b]??"---";else if(w.startsWith("--hr="))s=w.slice(5);else if(w.startsWith("--heading-style=")){let y=w.slice(16);(y==="setext"||y==="atx")&&(i=y)}else if(w==="-")o.push("-");else{if(w.startsWith("--"))return re("html-to-markdown",w);if(w.startsWith("-"))return re("html-to-markdown",w);o.push(w)}}let a,l=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength);if(o.length===0||o.length===1&&o[0]==="-"){if(t.stdin.length>l)throw new C(`html-to-markdown: input size limit exceeded (${l} bytes)`,"string_length");a=ue(t.stdin)}else try{let b=t.fs.resolvePath(t.cwd,o[0]);if((await t.fs.stat(b)).size>l)throw new C(`html-to-markdown: input size limit exceeded (${l} bytes)`,"string_length");if(a=await t.fs.readFile(b),U(a)>l)throw new C(`html-to-markdown: input size limit exceeded (${l} bytes)`,"string_length")}catch(b){return he(b),{stdout:"",stderr:`html-to-markdown: ${o[0]}: No such file or directory
666
+ `,exitCode:1}}if(!a.trim())return{stdout:"",stderr:"",exitCode:0};if(!["-","+","*"].includes(n))return{stdout:"",stderr:`html-to-markdown: invalid bullet marker
667
+ `,exitCode:1};if(r!=="```"&&r!=="~~~")return{stdout:"",stderr:`html-to-markdown: invalid code fence
668
+ `,exitCode:1};let c=0,u=t.limits.maxLoopIterations;for(let b=0;b<a.length;b++)if(a.charCodeAt(b)===60&&++c>u)throw new C(`html-to-markdown: complexity limit exceeded (${u} tags)`,"iterations");t.executionScope?.consumeWork(c,"html-to-markdown tags");let f=U(a),d=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),p=4;if(f>Math.floor((d-1)/p))throw new C(`html-to-markdown: prospective output size limit exceeded (${d} bytes)`,"output_size");let h=f*p+1,m=t.executionScope?.reserveBytes("html input",f,"html-to-markdown"),g=t.executionScope?.reserveBytes("html prospective output",h,"html-to-markdown");try{let b=new YC({bulletListMarker:n,codeBlockStyle:"fenced",fence:r,hr:s,headingStyle:i});b.remove(["script","style","footer"]);let w=b.turndown(a).trim();if(U(w)+1>d)throw new C(`html-to-markdown: output size limit exceeded (${d} bytes)`,"output_size");return{stdout:`${w}
669
+ `,stderr:"",exitCode:0}}catch(b){return he(b),{stdout:"",stderr:`html-to-markdown: conversion error: ${b.message}
670
+ `,exitCode:1}}finally{g?.release(),m?.release()}}},tv={name:"html-to-markdown",flags:[],stdinType:"text"}});var Wy={};ae(Wy,{flagsForFuzzing:()=>iv,helpCommand:()=>sv});function rv(e){let t=[],n=new Set(e);t.push(`Available commands:
671
+ `);let r=[];for(let[s,i]of nv){let o=i.filter(a=>n.has(a));if(o.length>0){t.push(` ${s}:`),t.push(` ${o.join(", ")}
672
+ `);for(let a of o)n.delete(a)}}for(let s of n)r.push(s);return r.length>0&&(t.push(" Other:"),t.push(` ${r.sort().join(", ")}
673
+ `)),t.push("Use '<command> --help' for details on a specific command."),`${t.join(`
674
+ `)}
675
+ `}var nv,sv,iv,jy=M(()=>{"use strict";vs();nv=new Map([["File operations",["ls","cat","head","tail","wc","touch","mkdir","rm","cp","mv","ln","chmod","stat","readlink"]],["Text processing",["grep","sed","awk","sort","uniq","cut","tr","tee","diff"]],["Search",["find"]],["Navigation & paths",["pwd","basename","dirname","tree","du"]],["Environment & shell",["echo","printf","env","printenv","export","alias","unalias","history","clear","true","false","bash","sh"]],["Data processing",["xargs","jq","base64","date"]],["Network",["curl","html-to-markdown"]]]);sv={name:"help",async execute(e,t){if(e.includes("--help")||e.includes("-h"))return{stdout:`help - display available commands
676
+
677
+ Usage: help [command]
678
+
679
+ Options:
680
+ -h, --help Show this help message
681
+
682
+ If a command name is provided, shows help for that command.
683
+ Otherwise, lists all available commands.
684
+ `,stderr:"",exitCode:0};if(e.length>0&&t.exec){let r=e[0];return t.exec(In([r]),{cwd:t.cwd,signal:t.signal,args:["--help"]})}let n=t.getRegisteredCommands?.()??[];return{stdout:rv(n),stderr:"",exitCode:0}}},iv={name:"help",flags:[]}});var Hy={};ae(Hy,{flagsForFuzzing:()=>cv,whichCommand:()=>lv});var ov,av,lv,cv,Vy=M(()=>{"use strict";It();de();ov={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"]},av={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},lv={name:"which",async execute(e,t){if(q(e))return G(ov);let n=Le("which",e,av);if(!n.ok)return n.error;let r=n.result.flags.showAll,s=n.result.flags.silent,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:"",exitCode:1};let a=(t.env.get("PATH")||"/usr/bin:/bin").split(":"),l="",c=!0;for(let u of i){let f=!1;for(let d of a){if(!d)continue;let p=t.fs.resolvePath(d,u);if(await t.fs.exists(p)&&(f=!0,s||(l+=`${p}
685
+ `),!r))break}f||(c=!1)}return{stdout:l,stderr:"",exitCode:c?0:1}}},cv={name:"which",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"boolean"}],needsArgs:!0}});var Gy={};ae(Gy,{flagsForFuzzing:()=>dv,tac:()=>fv});async function uv(e,t){if(e.length>0&&e[0]!=="-"){let s=t.fs.resolvePath(t.cwd,e[0]);try{let o=(await t.fs.readFile(s)).split(`
686
+ `);o[o.length-1]===""&&o.pop();let a=o.reverse();return{stdout:a.length>0?`${a.join(`
687
+ `)}
688
+ `:"",stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`tac: ${e[0]}: No such file or directory
689
+ `,exitCode:1}}}let n=t.stdin.split(`
690
+ `);n[n.length-1]===""&&n.pop();let r=n.reverse();return{stdout:r.length>0?`${r.join(`
691
+ `)}
692
+ `:"",stderr:"",exitCode:0,stdoutKind:"bytes"}}var fv,dv,qy=M(()=>{"use strict";ce();fv={name:"tac",execute:uv},dv={name:"tac",flags:[],stdinType:"text",needsFiles:!0}});var Zy={};ae(Zy,{flagsForFuzzing:()=>mv,hostname:()=>hv});async function pv(e,t){return{stdout:`localhost
693
+ `,stderr:"",exitCode:0}}var hv,mv,Ky=M(()=>{"use strict";hv={name:"hostname",execute:pv},mv={name:"hostname",flags:[]}});var Qy={};ae(Qy,{flagsForFuzzing:()=>wv,whoami:()=>yv});async function gv(e,t){return{stdout:`user
694
+ `,stderr:"",exitCode:0}}var yv,wv,Xy=M(()=>{"use strict";yv={name:"whoami",execute:gv},wv={name:"whoami",flags:[]}});var Yy={};ae(Yy,{flagsForFuzzing:()=>Ev,od:()=>xv});async function bv(e,t){let n="octal",r=[],s=[];for(let m=0;m<e.length;m++){let g=e[m];if(g==="-c")r.push("char");else if(g==="-An"||g==="-A"&&e[m+1]==="n")n="none",g==="-A"&&m++;else if(g==="-t"&&e[m+1]){let b=e[++m];b==="x1"?r.push("hex"):b==="c"?r.push("char"):b.startsWith("o")&&r.push("octal")}else(!g.startsWith("-")||g==="-")&&s.push(g)}r.length===0&&r.push("octal");let i=new Te(t.limits.maxInputBytes,"od input"),o=s.length===0?["-"]:s;for(let m of o){if(m==="-"){i.append(t.stdin);continue}let g=m.startsWith("/")?m:`${t.cwd}/${m}`;try{let b=await jt(t.fs,g);t.executionScope?.consumeInput(b.length,"od"),i.append(b)}catch(b){return he(b),{stdout:"",stderr:`od: ${m}: No such file or directory
695
+ `,exitCode:1}}}let a=r.includes("char");function l(m){return m===0?" \\0":m===7?" \\a":m===8?" \\b":m===9?" \\t":m===10?" \\n":m===11?" \\v":m===12?" \\f":m===13?" \\r":m>=32&&m<127?` ${String.fromCharCode(m)}`:` ${m.toString(8).padStart(3,"0")}`}function c(m){return a?` ${m.toString(16).padStart(2,"0")}`:` ${m.toString(16).padStart(2,"0")}`}function u(m){return` ${m.toString(8).padStart(3,"0")}`}let f=i.build(),d=16,p=new Te(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"od"),h=r.length;if(h>0&&f.length>Math.floor(t.limits.maxLoopIterations/h))throw new C(`od: format work limit exceeded (${t.limits.maxLoopIterations})`,"iterations");t.executionScope?.consumeWork(f.length*h,"od formatting");for(let m=0;m<f.length;m+=d)for(let g=0;g<r.length;g++){let b=r[g],w;b==="char"?w=Array.from(f.slice(m,m+d),x=>l(x.charCodeAt(0))):b==="hex"?w=Array.from(f.slice(m,m+d),x=>c(x.charCodeAt(0))):w=Array.from(f.slice(m,m+d),x=>u(x.charCodeAt(0)));let y="";g===0&&n!=="none"?y=`${m.toString(8).padStart(7,"0")} `:(g>0||n==="none")&&(y=n==="none"?"":" "),p.append(y+w.join("")).append(`
696
+ `)}return n!=="none"&&f.length>0&&p.append(f.length.toString(8).padStart(7,"0")).append(`
697
+ `),{stdout:p.build(),stderr:"",exitCode:0}}var xv,Ev,Jy=M(()=>{"use strict";At();ce();Nt();Z();xv={name:"od",execute:bv},Ev={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var Oo,e6=M(()=>{"use strict";Oo=class{options;inputBytes=0;outputBytes=0;workBytes=0;label;constructor(t){this.options=t,this.label=t.label??"codec";for(let[n,r]of[["maxInputBytes",t.maxInputBytes],["maxOutputBytes",t.maxOutputBytes],["maxExpansionRatio",t.maxExpansionRatio],["ratioGraceBytes",t.ratioGraceBytes],["maxWorkBytes",t.maxWorkBytes]])if(r!==void 0&&(!Number.isSafeInteger(r)||r<0))throw new Error(`${this.label}: invalid ${n}`)}checkpoint(){if(this.options.signal?.aborted)throw new Error(`${this.label}: operation aborted`)}acceptInput(t){this.checkpoint(),this.inputBytes=this.addWithinLimit(this.inputBytes,t,this.options.maxInputBytes,"input"),this.chargeWork(t)}acceptOutput(t){this.checkpoint();let n=this.addWithinLimit(this.outputBytes,t,this.options.maxOutputBytes,"output"),r=this.options.ratioGraceBytes??1024*1024,s=this.options.maxExpansionRatio;if(s!==void 0&&n>r&&(this.inputBytes===0||n>this.inputBytes*s))throw new Error(`${this.label}: expansion ratio exceeds limit (${s}:1)`);this.outputBytes=n,this.chargeWork(t)}get inputLength(){return this.inputBytes}get outputLength(){return this.outputBytes}chargeWork(t){let n=this.options.maxWorkBytes??this.options.maxInputBytes+this.options.maxOutputBytes;this.workBytes=this.addWithinLimit(this.workBytes,t,n,"work")}addWithinLimit(t,n,r,s){if(!Number.isSafeInteger(n)||n<0||n>r-t)throw new Error(`${this.label}: ${s} exceeds limit (${r} bytes)`);return t+n}}});var dl={};ae(dl,{flagsForFuzzing:()=>Lv,gunzipCommand:()=>Pv,gunzipFlagsForFuzzing:()=>Fv,gzipCommand:()=>$v,zcatCommand:()=>Dv,zcatFlagsForFuzzing:()=>Mv});import{constants as Tf,gunzipSync as Sv,gzipSync as Av}from"node:zlib";function t6(e){return e.best?Tf.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?Tf.Z_BEST_SPEED:Tf.Z_DEFAULT_COMPRESSION}function r6(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],n=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let i=e[r]|e[r+1]<<8;r+=2+i}let s=null;if(t&8){let i=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(s=new TextDecoder().decode(e.slice(i,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:s,mtime:n>0?new Date(n*1e3):null,headerSize:r}}function Iv(e){return e.length===0||e==="."||e===".."||e.includes("/")||e.includes("\\")||/[\0-\x1f\x7f]/.test(e)?null:e}function s6(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function fl(e){return e.length>=2&&e[0]===31&&e[1]===139}function ul(e){return Buffer.from(e).toString("latin1")}function i6(e){return e.limits.maxOutputSize}function Rf(e,t,n,r,s){if(t<=0)throw new Error("decompressed data exceeds limit (0 bytes)");let i=new Oo({maxInputBytes:n,maxOutputBytes:t,maxExpansionRatio:1e4,signal:r,label:"gzip"});if(i.acceptInput(e.length),s6(e)>t)throw new Error(`decompressed data exceeds limit (${t} bytes)`);let a;try{let l=Math.min(t,Math.floor((s?.executionScope?.remainingLiveBytes??t*2)/2));if(l<=0)throw new Error("gzip: live byte limit exceeded");a=s?.executionScope?.reserveBytes("gzip output",l*2,"gzip");let c=Sv(e,{maxOutputLength:l});return i.acceptOutput(c.length),{data:c,lease:a}}catch(l){throw a?.release(),l}}function n6(e,t,n){let r=new Oo({maxInputBytes:n.limits.maxInputBytes,maxOutputBytes:n.limits.maxOutputSize,signal:n.signal,label:"gzip"});r.acceptInput(e.length);let s;try{let i=Math.min(n.limits.maxOutputSize,Math.floor((n.executionScope?.remainingLiveBytes??n.limits.maxOutputSize*2)/2));if(i<=0)throw new Error("gzip: live byte limit exceeded");s=n.executionScope?.reserveBytes("gzip output",i*2,"gzip");let o=Av(e,{level:t,maxOutputLength:i});return r.acceptOutput(o.length),{data:o,lease:s}}catch(i){throw s?.release(),i}}async function o6(e,t,n){let r=await e.fs.stat(t);if(r.size>e.limits.maxInputBytes)throw new C(`input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");let s=e.executionScope?.reserveBytes("gzip input",r.size,n);try{let i=await e.fs.readFileBuffer(t);if(i.byteLength>r.size)throw new C("gzip: input grew while being read","string_length");return e.executionScope?.consumeInput(i.byteLength,n),{data:i,lease:s}}catch(i){throw s?.release(),i}}async function a6(e,t,n){if(t!=="-"&&t!=="")return o6(e,e.fs.resolvePath(e.cwd,t),n);let r=e.stdin,s=e.executionScope?.reserveBytes("gzip input",r.length,n);try{return{data:Uint8Array.from(r,i=>i.charCodeAt(0)),lease:s}}catch(i){throw s?.release(),i}}async function l6(e,t,n,r,s,i){let o=n.suffix,a,l,c,u=i6(e);if(t==="-"||t===""){let p=e.stdin,h=e.executionScope?.reserveBytes("gzip input",p.length,r),m;try{if(c=Uint8Array.from(p,g=>g.charCodeAt(0)),s){if(!fl(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
698
+ `,exitCode:1};try{let g=Rf(c,u,e.limits.maxInputBytes,e.signal,e);return m=g.lease,{stdout:ul(g.data),stderr:"",exitCode:0}}catch(g){he(g);let b=g instanceof Error?g.message:"unknown error";return{stdout:"",stderr:`${r}: stdin: ${b}
699
+ `,exitCode:1}}}else{let g=n6(c,t6(n),e);return m=g.lease,{stdout:ul(g.data),stderr:"",exitCode:0}}}finally{m?.release(),h?.release()}}a=e.fs.resolvePath(e.cwd,t);try{let p=await e.fs.stat(a);if(p.size>e.limits.maxInputBytes)return{stdout:"",stderr:`${r}: ${t}: input size limit exceeded (${e.limits.maxInputBytes} bytes)
700
+ `,exitCode:1};if(p.isDirectory)return n.recursive?await Ov(e,a,n,r,s,i):n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: is a directory -- ignored
701
+ `,exitCode:1}}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
702
+ `,exitCode:1}}let f,d;try{let p=await o6(e,a,r);c=p.data,f=p.lease}catch(p){return he(p),{stdout:"",stderr:`${r}: ${t}: No such file or directory
703
+ `,exitCode:1}}try{if(s){if(!t.endsWith(o))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: unknown suffix -- ignored
704
+ `,exitCode:1};if(!fl(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
705
+ `,exitCode:1};let p;try{let h=Rf(c,u,e.limits.maxInputBytes,e.signal,e);p=h.data,d=h.lease}catch(h){he(h);let m=h instanceof Error?h.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${m}
706
+ `,exitCode:1}}if(i)return{stdout:ul(p),stderr:"",exitCode:0};if(n.name){let h=r6(c),m=h.originalName?Iv(h.originalName):null;m?l=e.fs.resolvePath(e.cwd,m):l=a.slice(0,-o.length)}else l=a.slice(0,-o.length);if(!n.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${r}: ${l} already exists; not overwritten
707
+ `,exitCode:1}}catch{}if(await e.fs.writeFile(l,p),!n.keep&&!i&&await e.fs.rm(a),n.verbose){let h=c.length>0?((1-c.length/p.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${h}% -- replaced with ${l.split("/").pop()}
708
+ `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(o))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t} already has ${o} suffix -- unchanged
709
+ `,exitCode:1};let p=t6(n),h;try{let m=n6(c,p,e);h=m.data,d=m.lease}catch(m){he(m);let g=m instanceof Error?m.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${g}
710
+ `,exitCode:1}}if(i)return{stdout:ul(h),stderr:"",exitCode:0};if(l=a+o,!n.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${r}: ${l} already exists; not overwritten
711
+ `,exitCode:1}}catch{}if(await e.fs.writeFile(l,h),!n.keep&&!i&&await e.fs.rm(a),n.verbose){let m=c.length>0?((1-h.length/c.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${m}% -- replaced with ${l.split("/").pop()}
712
+ `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}finally{d?.release(),f?.release()}}async function Ov(e,t,n,r,s,i){let o=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),a=new Te(o,r),l=new Te(o,r),c=0;return await wr({fs:e.fs,root:t,symlinks:"never",limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:r},async u=>{if(u.depth===0||u.phase!=="enter"||!u.stat.isFile)return;let f=n.suffix;if(s&&!u.path.endsWith(f)||!s&&u.path.endsWith(f))return;let d=u.path.startsWith(`${e.cwd}/`)?u.path.slice(e.cwd.length+1):u.path,p=await l6(e,d,n,r,s,i);a.append(p.stdout),l.append(p.stderr),p.exitCode!==0&&(c=p.exitCode)}),{stdout:a.build(),stderr:l.build(),exitCode:c}}async function Tv(e,t,n,r){let s,i;try{let o=await a6(e,t,r);s=o.data,i=o.lease}catch(o){return he(o),{stdout:"",stderr:`${r}: ${t}: No such file or directory
713
+ `,exitCode:1}}try{if(!fl(s))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
714
+ `,exitCode:1};let o=s.length,a=s6(s),l=a>0?((1-o/a)*100).toFixed(1):"0.0",u=r6(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${o.toString().padStart(10)} ${a.toString().padStart(10)} ${l.padStart(5)}% ${u}
715
+ `,stderr:"",exitCode:0}}finally{i?.release()}}async function Rv(e,t,n,r){let s,i;try{let o=await a6(e,t,r);s=o.data,i=o.lease}catch(o){return he(o),{stdout:"",stderr:`${r}: ${t}: No such file or directory
716
+ `,exitCode:1}}try{if(!fl(s))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
717
+ `,exitCode:1};try{return Rf(s,i6(e),e.limits.maxInputBytes,e.signal,e).lease?.release(),n.verbose?{stdout:"",stderr:`${t}: OK
718
+ `,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(o){he(o);let a=o instanceof Error?o.message:"invalid";return{stdout:"",stderr:`${r}: ${t}: ${a}
719
+ `,exitCode:1}}}finally{i?.release()}}async function $f(e,t,n){let r=n==="zcat"?kv:n==="gunzip"?vv:Cv;if(q(e))return G(r);let s=Le(n,e,Nv);if(!s.ok)return s.error.stderr.includes("unrecognized option"),s.error;let i=s.result.flags,o=s.result.positional,a=n==="gunzip"||n==="zcat"||i.decompress||i.uncompress,l=n==="zcat"||i.stdout||i.toStdout;if(i.list){o.length===0&&(o=["-"]);let d=` compressed uncompressed ratio uncompressed_name
720
+ `,p="",h=0;for(let m of o){let g=await Tv(t,m,i,n);d+=g.stdout,p+=g.stderr,g.exitCode!==0&&(h=g.exitCode)}return{stdout:d,stderr:p,exitCode:h}}if(i.test){o.length===0&&(o=["-"]);let d="",p="",h=0;for(let m of o){let g=await Rv(t,m,i,n);d+=g.stdout,p+=g.stderr,g.exitCode!==0&&(h=g.exitCode)}return{stdout:d,stderr:p,exitCode:h}}o.length===0&&(o=["-"]);let c="",u="",f=0;for(let d of o){let p=await l6(t,d,i,n,a,l);c+=p.stdout,u+=p.stderr,p.exitCode!==0&&(f=p.exitCode)}return{stdout:c,stderr:u,exitCode:f}}var Cv,vv,kv,Nv,$v,Pv,Dv,Lv,Fv,Mv,pl=M(()=>{"use strict";At();ce();Nt();Bn();Z();It();e6();de();Cv={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
721
+
722
+ When no FILE is given, or when FILE is -, read from standard input.
723
+
724
+ With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},vv={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place).
725
+
726
+ When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},kv={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output.
727
+
728
+ When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},Nv={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};$v={name:"gzip",async execute(e,t){return{...await $f(e,t,"gzip"),stdoutEncoding:"binary"}}},Pv={name:"gunzip",async execute(e,t){return{...await $f(e,t,"gunzip"),stdoutEncoding:"binary"}}},Dv={name:"zcat",async execute(e,t){return{...await $f(e,t,"zcat"),stdoutEncoding:"binary"}}},Lv={name:"gzip",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-1",type:"boolean"},{flag:"-9",type:"boolean"}],stdinType:"binary",needsFiles:!0},Fv={name:"gunzip",flags:[{flag:"-c",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0},Mv={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0}});function Pf(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),n=>n.charCodeAt(0));if(t==="hex"){let n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=parseInt(e.slice(r,r+2),16);return n}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,s=>s.charCodeAt(0));let r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r}return _v.encode(e)}function To(e,t){if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let n=65536,r="";for(let s=0;s<e.length;s+=n){let i=e.subarray(s,s+n);r+=String.fromCharCode(...i)}return btoa(r)}if(t==="hex")return Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let n=65536;if(e.length<=n)return String.fromCharCode(...e);let r="";for(let s=0;s<e.length;s+=n){let i=e.subarray(s,s+n);r+=String.fromCharCode(...i)}return r}return Bv.decode(e)}function hl(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var _v,Bv,Df=M(()=>{"use strict";_v=new TextEncoder,Bv=new TextDecoder});function ml(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16)}`).replace(/%20/g,"+").replace(/%[0-9A-F]{2}/g,t=>t.toLowerCase())}function c6(e){let t=e.indexOf("=");if(t>=0){let n=e.slice(0,t),r=e.slice(t+1),s=ml(r);return n?`${n}=${s}`:s}return ml(e)}function Lf(e){let t=e.indexOf("=");if(t<0)return null;let n=e.slice(0,t),r=e.slice(t+1),s,i,o=r.match(/;type=([^;]+)$/);o&&(i=o[1],r=r.slice(0,-o[0].length));let a=r.match(/;filename=([^;]+)/);return a&&(s=a[1],r=r.replace(a[0],"")),(r.startsWith("@")||r.startsWith("<"))&&(s=s??r.slice(1).split("/").pop()),{name:n,value:r,filename:s,contentType:i}}function u6(e,t){let n=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let s of e){let i=s.value;if(i.startsWith("@")||i.startsWith("<")){let a=i.slice(1);i=t.get(a)??""}let o=`--${n}\r
729
+ `;s.filename?(o+=`Content-Disposition: form-data; name="${s.name}"; filename="${s.filename}"\r
730
+ `,s.contentType&&(o+=`Content-Type: ${s.contentType}\r
731
+ `)):o+=`Content-Disposition: form-data; name="${s.name}"\r
732
+ `,o+=`\r
733
+ ${i}\r
734
+ `,r.push(o)}return r.push(`--${n}--\r
735
+ `),{body:r.join(""),boundary:n}}var Ff=M(()=>{"use strict"});var f6,d6=M(()=>{"use strict";f6={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 Us(e,t,n){n.allowFile&&t.startsWith("@")?e.dataParts.push({file:{path:t.slice(1),mode:n.binary?"binary":"ascii"}}):e.dataParts.push({value:t}),n.binary&&(e.dataBinary=!0)}function p6(e,t){if(t.startsWith("@")){e.dataParts.push({file:{path:t.slice(1),mode:"urlencode"}});return}let n=t.indexOf("@"),r=t.indexOf("=");if(n>0&&(r<0||n<r)){e.dataParts.push({file:{path:t.slice(n+1),mode:"urlencode",name:t.slice(0,n)}});return}e.dataParts.push({value:c6(t)})}function h6(e){let t={method:"GET",headers:new Xa,dataParts:[],dataBinary:!1,getMode:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1},n=!1,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(i==="-X"||i==="--request")t.method=e[++s]??"GET",r=!0;else if(i.startsWith("-X"))t.method=i.slice(2),r=!0;else if(i.startsWith("--request="))t.method=i.slice(10),r=!0;else if(i==="-H"||i==="--header"){let o=e[++s];if(o){let a=o.indexOf(":");if(a>0){let l=o.slice(0,a).trim(),c=o.slice(a+1).trim();t.headers.append(l,c)}}}else if(i.startsWith("--header=")){let o=i.slice(9),a=o.indexOf(":");if(a>0){let l=o.slice(0,a).trim(),c=o.slice(a+1).trim();t.headers.append(l,c)}}else if(i==="-G"||i==="--get")t.getMode=!0,r||(t.method="GET");else if(i==="-d"||i==="--data")Us(t,e[++s]??"",{binary:!1,allowFile:!0}),n=!0;else if(i==="--data-raw")Us(t,e[++s]??"",{binary:!1,allowFile:!1}),n=!0;else if(i.startsWith("-d"))Us(t,i.slice(2),{binary:!1,allowFile:!0}),n=!0;else if(i.startsWith("--data="))Us(t,i.slice(7),{binary:!1,allowFile:!0}),n=!0;else if(i.startsWith("--data-raw="))Us(t,i.slice(11),{binary:!1,allowFile:!1}),n=!0;else if(i==="--data-binary")Us(t,e[++s]??"",{binary:!0,allowFile:!0}),n=!0;else if(i.startsWith("--data-binary="))Us(t,i.slice(14),{binary:!0,allowFile:!0}),n=!0;else if(i==="--data-urlencode")p6(t,e[++s]??""),n=!0;else if(i.startsWith("--data-urlencode="))p6(t,i.slice(17)),n=!0;else if(i==="-F"||i==="--form"){let o=e[++s]??"",a=Lf(o);a&&t.formFields.push(a),n=!0}else if(i.startsWith("--form=")){let o=i.slice(7),a=Lf(o);a&&t.formFields.push(a),n=!0}else if(i==="-u"||i==="--user")t.user=e[++s];else if(i.startsWith("-u"))t.user=i.slice(2);else if(i.startsWith("--user="))t.user=i.slice(7);else if(i==="-A"||i==="--user-agent")t.headers.set("User-Agent",e[++s]??"");else if(i.startsWith("-A"))t.headers.set("User-Agent",i.slice(2));else if(i.startsWith("--user-agent="))t.headers.set("User-Agent",i.slice(13));else if(i==="-e"||i==="--referer")t.headers.set("Referer",e[++s]??"");else if(i.startsWith("-e"))t.headers.set("Referer",i.slice(2));else if(i.startsWith("--referer="))t.headers.set("Referer",i.slice(10));else if(i==="-b"||i==="--cookie")t.headers.set("Cookie",e[++s]??"");else if(i.startsWith("-b"))t.headers.set("Cookie",i.slice(2));else if(i.startsWith("--cookie="))t.headers.set("Cookie",i.slice(9));else if(i==="-c"||i==="--cookie-jar")t.cookieJar=e[++s];else if(i.startsWith("--cookie-jar="))t.cookieJar=i.slice(13);else if(i==="-T"||i==="--upload-file")t.uploadFile=e[++s],t.method==="GET"&&(t.method="PUT");else if(i.startsWith("--upload-file="))t.uploadFile=i.slice(14),t.method==="GET"&&(t.method="PUT");else if(i==="-m"||i==="--max-time"){let o=parseFloat(e[++s]??"0");!Number.isNaN(o)&&o>0&&(t.timeoutMs=o*1e3)}else if(i.startsWith("--max-time=")){let o=parseFloat(i.slice(11));!Number.isNaN(o)&&o>0&&(t.timeoutMs=o*1e3)}else if(i==="--connect-timeout"){let o=parseFloat(e[++s]??"0");!Number.isNaN(o)&&o>0&&t.timeoutMs===void 0&&(t.timeoutMs=o*1e3)}else if(i.startsWith("--connect-timeout=")){let o=parseFloat(i.slice(18));!Number.isNaN(o)&&o>0&&t.timeoutMs===void 0&&(t.timeoutMs=o*1e3)}else if(i==="-o"||i==="--output")t.outputFile=e[++s];else if(i.startsWith("--output="))t.outputFile=i.slice(9);else if(i==="-D"||i==="--dump-header"){let o=e[++s];if(o===void 0)return{stdout:"",stderr:`curl: option ${i}: requires parameter
736
+ `,exitCode:1};if(o==="")return{stdout:"",stderr:`curl: option ${i}: blank argument where content is expected
737
+ `,exitCode:1};t.dumpHeader=o}else if(i.startsWith("--dump-header=")){let o=i.slice(14);if(o==="")return{stdout:"",stderr:`curl: option --dump-header: blank argument where content is expected
738
+ `,exitCode:1};t.dumpHeader=o}else if(i.startsWith("-D")&&i.length>2)t.dumpHeader=i.slice(2);else if(i==="-O"||i==="--remote-name")t.useRemoteName=!0;else if(i==="-I"||i==="--head")t.headOnly=!0,t.method="HEAD",r=!0;else if(i==="-i"||i==="--include")t.includeHeaders=!0;else if(i==="-s"||i==="--silent")t.silent=!0;else if(i==="-S"||i==="--show-error")t.showError=!0;else if(i==="-f"||i==="--fail")t.failSilently=!0;else if(i==="-L"||i==="--location")t.followRedirects=!0;else if(i==="--max-redirs"){let o=e[++s];if(o===void 0||!/^\d+$/.test(o))return{stdout:"",stderr:`curl: option --max-redirs: expected a non-negative integer
739
+ `,exitCode:2};let a=Number(o);if(!Number.isSafeInteger(a))return{stdout:"",stderr:`curl: option --max-redirs: value is out of range
740
+ `,exitCode:2};t.maxRedirects=a}else if(i.startsWith("--max-redirs=")){let o=i.slice(13);if(!/^\d+$/.test(o)||!Number.isSafeInteger(Number(o)))return{stdout:"",stderr:`curl: option --max-redirs: expected a non-negative integer
741
+ `,exitCode:2};t.maxRedirects=Number(o)}else if(i==="-w"||i==="--write-out")t.writeOut=e[++s];else if(i.startsWith("--write-out="))t.writeOut=i.slice(12);else if(i==="-v"||i==="--verbose")t.verbose=!0;else{if(i.startsWith("--")&&i!=="--")return re("curl",i);if(i.startsWith("-")&&i!=="-")for(let o of i.slice(1))switch(o){case"s":t.silent=!0;break;case"S":t.showError=!0;break;case"f":t.failSilently=!0;break;case"L":t.followRedirects=!0;break;case"I":t.headOnly=!0,t.method="HEAD",r=!0;break;case"i":t.includeHeaders=!0;break;case"O":t.useRemoteName=!0;break;case"v":t.verbose=!0;break;case"G":t.getMode=!0,r||(t.method="GET");break;default:return re("curl",`-${o}`)}else i.startsWith("-")||(t.url=i)}}return n&&!r&&!t.getMode&&(t.method="POST"),t}var m6=M(()=>{"use strict";Ni();de();Ff()});function Uv(e){return Object.entries(e).map(([t,n])=>`${t}: ${n}`).join(`\r
742
+ `)}function Ro(e,t,n){return`HTTP/1.1 ${e} ${t}\r
743
+ ${Uv(n)}\r
744
+ \r
745
+ `}function g6(e){try{return new URL(e).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function Mf(e,t){let n=e;return n=n.replace(/%\{http_code\}/g,String(t.status)),n=n.replace(/%\{content_type\}/g,t.headers["content-type"]||""),n=n.replace(/%\{url_effective\}/g,t.url),n=n.replace(/%\{size_download\}/g,String(t.bodyLength)),n=n.replace(/\\n/g,`
746
+ `),n}var y6=M(()=>{"use strict"});var w6={};ae(w6,{curlCommand:()=>Zv});async function zv(e,t){if(e.dataParts.length===0)return;let n=[];for(let r of e.dataParts)if(r.file){let s=t.fs.resolvePath(t.cwd,r.file.path),i=await t.fs.readFile(s);if(r.file.mode==="ascii")n.push(i.replace(/[\r\n]/g,""));else if(r.file.mode==="binary")n.push(i);else{let o=ml(i);n.push(r.file.name?`${r.file.name}=${o}`:o)}}else n.push(r.value??"");return n.join("&")}async function Wv(e,t,n){if(e.uploadFile){let r=t.fs.resolvePath(t.cwd,e.uploadFile);return{body:await t.fs.readFile(r)}}if(e.formFields.length>0){let r=new Map;for(let o of e.formFields)if(o.value.startsWith("@")||o.value.startsWith("<")){let a=t.fs.resolvePath(t.cwd,o.value.slice(1));try{let l=await t.fs.readFile(a);r.set(o.value.slice(1),l)}catch{r.set(o.value.slice(1),"")}}let{body:s,boundary:i}=u6(e.formFields,r);return{body:s,contentType:`multipart/form-data; boundary=${i}`}}return n!==void 0&&!e.getMode?{body:n,contentType:"application/x-www-form-urlencoded"}:{}}function jv(e,t){if(!t)return e;let n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),s=n===-1?"":e.slice(n),i=r.endsWith("?")||r.endsWith("&")?"":r.includes("?")?"&":"?";return`${r}${i}${t}${s}`}function Hv(e,t){let n=new Xa(e.headers);if(e.user){let r=Buffer.from(e.user).toString("base64");n.set("Authorization",`Basic ${r}`)}return t&&!n.has("Content-Type")&&n.set("Content-Type",t),n}async function Vv(e,t,n){if(!e.cookieJar)return;let r=t["set-cookie"];if(!r)return;let s=n.fs.resolvePath(n.cwd,e.cookieJar);await n.fs.writeFile(s,r)}function Gv(e){return To(e,"binary")}function qv(e,t,n){let r="";if(e.verbose){r+=`> ${e.method} ${n}
747
+ `;for(let[s,i]of e.headers)r+=`> ${s}: ${i}
748
+ `;r+=`>
749
+ `,r+=`< HTTP/1.1 ${t.status} ${t.statusText}
750
+ `;for(let[s,i]of Object.entries(t.headers))r+=`< ${s}: ${i}
751
+ `;r+=`<
752
+ `}return e.includeHeaders&&!e.verbose&&(r+=Ro(t.status,t.statusText,t.headers)),e.headOnly?e.includeHeaders||e.verbose||(r+=Ro(t.status,t.statusText,t.headers)):r+=Gv(t.body),e.writeOut&&(r+=Mf(e.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.byteLength})),r}var Zv,b6=M(()=>{"use strict";Df();kn();Ni();de();Ff();d6();m6();y6();Zv={name:"curl",async execute(e,t){if(q(e))return G(f6);let n=h6(e);if("exitCode"in n)return n;let r=n;if(!r.url)return{stdout:"",stderr:`curl: no URL specified
753
+ `,exitCode:2};if(!t.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available
754
+ `,exitCode:1};let s=r.url;s.match(/^https?:\/\//)||(s=`https://${s}`);try{let i=await zv(r,t);r.getMode&&(s=jv(s,i));let{body:o,contentType:a}=await Wv(r,t,i),l=Hv(r,a);if(r.dumpHeader!==void 0&&r.dumpHeader!=="-"){let m=t.fs.resolvePath(t.cwd,r.dumpHeader);await t.fs.writeFile(m,"")}let c=await t.fetch(s,{method:r.method,headers:l,body:o,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs,maxRedirects:r.maxRedirects,signal:t.signal});await Vv(r,c.headers,t);let u=Ro(c.status,c.statusText,c.headers),f="";if(c.redirectChain)for(let m of c.redirectChain)f+=Ro(m.status,m.statusText,m.headers);if(f+=u,r.dumpHeader!==void 0&&r.dumpHeader!=="-"){let m=t.fs.resolvePath(t.cwd,r.dumpHeader);await t.fs.writeFile(m,f)}if(r.failSilently&&c.status>=400){let m=r.showError||!r.silent?`curl: (22) The requested URL returned error: ${c.status}
755
+ `:"",g=r.dumpHeader==="-"?f:"";return{stdout:g,stderr:m,exitCode:22,stdoutKind:g?"bytes":void 0}}let d=!!(r.outputFile||r.useRemoteName),h=d&&!r.verbose?"":qv(r,c,s);if(d){let m=r.outputFile||g6(s),g=t.fs.resolvePath(t.cwd,m);if(await t.fs.writeFile(g,r.headOnly?"":c.body),r.verbose?h=(r.dumpHeader==="-"?f:"")+h:r.dumpHeader==="-"?h=f:h="",r.writeOut){let b=Mf(r.writeOut,{status:c.status,headers:c.headers,url:c.url,bodyLength:c.body.byteLength});r.verbose?h+=b:r.dumpHeader==="-"?h=f+b:h=b}}else r.dumpHeader==="-"&&(h=f+h);return{stdout:h,stderr:"",exitCode:0,stdoutKind:"bytes"}}catch(i){let o=mt(i),a=1;return o.includes("Network access denied")?a=7:o.includes("HTTP method")&&o.includes("not allowed")?a=3:o.includes("Redirect target not in allow-list")||o.includes("Too many redirects")?a=47:o.includes("aborted")&&(a=28),{stdout:"",stderr:!r.silent||r.showError?`curl: (${a}) ${o}
756
+ `:"",exitCode:a}}}}});xs();ra();St();vn();var _f=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(yh(),gh))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(bh(),wh))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(vh(),Ch))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(Ph(),$h))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(Lh(),Dh))).mkdirCommand},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>(Bh(),_h))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>(zh(),Uh))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(jh(),Wh))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(Vh(),Hh))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(qh(),Gh))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(Kh(),Zh))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(Xh(),Qh))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(Jh(),Yh))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(t1(),e1))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(i1(),s1))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>(a1(),o1))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(u1(),c1))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(d1(),f1))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(Ea(),xa))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(Ea(),xa))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(Ea(),xa))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(lm(),am))).rgCommand},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(xm(),bm))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(e0(),Jm))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>(u0(),c0))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(d0(),f0))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(h0(),p0))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(g0(),m0))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(b0(),w0))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(S0(),E0))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(C0(),A0))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(N0(),k0))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(T0(),O0))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>(P0(),$0))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(M0(),F0))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(z0(),U0))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(V0(),H0))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(Z0(),q0))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(Q0(),K0))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(Y0(),X0))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(og(),ig))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(lg(),ag))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>(ug(),cg))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(pg(),dg))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(mg(),hg))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(Wu(),zu))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(Wu(),zu))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Hu(),ju))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Hu(),ju))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(wg(),yg))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(Eg(),xg))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(Gu(),Vu))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(Gu(),Vu))).falseCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(Ag(),Sg))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(Zu(),qu))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(Zu(),qu))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(o2(),i2))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>(f2(),u2))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>(h2(),p2))).diffCommand},{name:"date",load:async()=>(await Promise.resolve().then(()=>(g2(),m2))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(b2(),w2))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>(E2(),x2))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(C2(),A2))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(k2(),v2))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(I2(),N2))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(R2(),T2))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(P2(),$2))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(L2(),D2))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(By(),_y))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(zy(),Uy))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(jy(),Wy))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(Vy(),Hy))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(qy(),Gy))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(Ky(),Zy))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(Xy(),Qy))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(Jy(),Yy))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(pl(),dl))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(pl(),dl))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(pl(),dl))).zcatCommand}],Kv=[],Qv=[],E6=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(b6(),w6))).curlCommand}],x6=new Map;function gl(e){return{name:e.name,async execute(t,n){let r=x6.get(e.name);return r||(r=await $t.runTrustedAsync(()=>e.load()),x6.set(e.name,r)),n.coverage,r.execute(t,n)}}}function Xv(){return _f.map(e=>e.name)}function Yv(){return E6.map(e=>e.name)}function S6(e){return(e?_f.filter(n=>e.includes(n.name)):_f).map(gl)}function A6(){return E6.map(gl)}function C6(){return Kv.map(gl)}function v6(){return Qv.map(gl)}ce();var k6=new WeakMap,N6=new WeakSet;function yl(e){let t=k6.get(e);return t===void 0&&(t=Object.freeze(Object.create(null)),k6.set(e,t),N6.add(t)),t}function I6(e){return N6.has(e)}var O6={maxSourceBytes:67108864,maxExecDepth:64,maxCallDepth:100,maxCommandCount:1e5,maxLoopIterations:1e5,maxAwkIterations:1e5,maxSedIterations:1e5,maxJqIterations:1e7,maxQueryTokens:1e5,maxQueryDepth:1e3,maxQueryElements:1e6,maxAwkParserTokens:1e5,maxAwkParserDepth:256,maxAwkParserOperations:1e6,maxCsvRows:1e6,maxCsvCells:1e7,maxWorkUnits:1e8,maxTraversalEntries:1e6,maxTraversalDepth:1e3,maxTraversalWork:1e6,maxLiveBytes:536870912,maxInputBytes:536870912,maxFileSystemBytes:1073741824,maxDatabaseBytes:1073741824,maxDatabaseResultBytes:268435456,maxArchiveBytes:1073741824,maxArchiveCompressedBytes:536870912,maxArchiveEntryBytes:536870912,maxArchiveEntries:1e6,maxWorkerMessageBytes:67108864,maxExecutionTimeMs:36e5,maxExtensionCleanupTimeMs:100,maxSqliteTimeoutMs:3e4,maxPythonTimeoutMs:3e4,maxJsTimeoutMs:3e4,maxGlobOperations:1e6,maxStringLength:67108864,maxArrayElements:1e6,maxHeredocSize:67108864,maxSubstitutionDepth:50,maxBraceExpansionResults:1e5,maxOutputSize:268435456,maxFileDescriptors:4096,maxSourceDepth:100},Jv={...O6,maxSourceBytes:8*1024*1024,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxExtensionCleanupTimeMs:25,maxGlobOperations:1e5,maxStringLength:10*1024*1024,maxArrayElements:1e5,maxHeredocSize:10*1024*1024,maxBraceExpansionResults:1e4,maxOutputSize:10*1024*1024,maxFileDescriptors:1024,maxQueryTokens:25e3,maxQueryDepth:256,maxQueryElements:1e5,maxAwkParserTokens:25e3,maxAwkParserDepth:128,maxAwkParserOperations:1e5,maxCsvRows:1e5,maxCsvCells:1e6,maxWorkUnits:1e5,maxTraversalEntries:1e5,maxTraversalDepth:256,maxTraversalWork:1e5,maxLiveBytes:64*1024*1024,maxInputBytes:32*1024*1024,maxFileSystemBytes:128*1024*1024,maxDatabaseBytes:64*1024*1024,maxDatabaseResultBytes:16*1024*1024,maxArchiveBytes:128*1024*1024,maxArchiveCompressedBytes:64*1024*1024,maxArchiveEntryBytes:64*1024*1024,maxArchiveEntries:1e5,maxWorkerMessageBytes:16*1024*1024,maxExecutionTimeMs:3e4};function wl(e,t="normal"){if(t!=="normal"&&t!=="hardened")throw new RangeError('executionLimitProfile must be "normal" or "hardened"');let n=t==="hardened"?Jv:O6;if(!e)return{...n};let r={maxSourceBytes:e.maxSourceBytes??n.maxSourceBytes,maxExecDepth:e.maxExecDepth??n.maxExecDepth,maxCallDepth:e.maxCallDepth??n.maxCallDepth,maxCommandCount:e.maxCommandCount??n.maxCommandCount,maxLoopIterations:e.maxLoopIterations??n.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??n.maxAwkIterations,maxSedIterations:e.maxSedIterations??n.maxSedIterations,maxJqIterations:e.maxJqIterations??n.maxJqIterations,maxQueryTokens:e.maxQueryTokens??n.maxQueryTokens,maxQueryDepth:e.maxQueryDepth??n.maxQueryDepth,maxQueryElements:e.maxQueryElements??n.maxQueryElements,maxAwkParserTokens:e.maxAwkParserTokens??n.maxAwkParserTokens,maxAwkParserDepth:e.maxAwkParserDepth??n.maxAwkParserDepth,maxAwkParserOperations:e.maxAwkParserOperations??n.maxAwkParserOperations,maxCsvRows:e.maxCsvRows??n.maxCsvRows,maxCsvCells:e.maxCsvCells??n.maxCsvCells,maxWorkUnits:e.maxWorkUnits??n.maxWorkUnits,maxTraversalEntries:e.maxTraversalEntries??n.maxTraversalEntries,maxTraversalDepth:e.maxTraversalDepth??n.maxTraversalDepth,maxTraversalWork:e.maxTraversalWork??n.maxTraversalWork,maxLiveBytes:e.maxLiveBytes??n.maxLiveBytes,maxInputBytes:e.maxInputBytes??n.maxInputBytes,maxFileSystemBytes:e.maxFileSystemBytes??n.maxFileSystemBytes,maxDatabaseBytes:e.maxDatabaseBytes??n.maxDatabaseBytes,maxDatabaseResultBytes:e.maxDatabaseResultBytes??n.maxDatabaseResultBytes,maxArchiveBytes:e.maxArchiveBytes??n.maxArchiveBytes,maxArchiveCompressedBytes:e.maxArchiveCompressedBytes??n.maxArchiveCompressedBytes,maxArchiveEntryBytes:e.maxArchiveEntryBytes??n.maxArchiveEntryBytes,maxArchiveEntries:e.maxArchiveEntries??n.maxArchiveEntries,maxWorkerMessageBytes:e.maxWorkerMessageBytes??n.maxWorkerMessageBytes,maxExecutionTimeMs:e.maxExecutionTimeMs??n.maxExecutionTimeMs,maxExtensionCleanupTimeMs:e.maxExtensionCleanupTimeMs??n.maxExtensionCleanupTimeMs,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??n.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??n.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??n.maxJsTimeoutMs,maxGlobOperations:e.maxGlobOperations??n.maxGlobOperations,maxStringLength:e.maxStringLength??n.maxStringLength,maxArrayElements:e.maxArrayElements??n.maxArrayElements,maxHeredocSize:e.maxHeredocSize??n.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??n.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??n.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??n.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??n.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??n.maxSourceDepth};for(let s of Object.keys(r)){let i=r[s];if(i!==Number.POSITIVE_INFINITY&&(!Number.isSafeInteger(i)||i<0))throw new RangeError(`${s} must be a non-negative safe integer or positive Infinity`)}return r}function ek(e){let{executionLimits:t,executionLimitProfile:n,fs:r,stdin:s=sa,...i}=e;return{fs:r,fsIdentity:i.fsIdentity??yl(r),cwd:"/",env:new Map,stdin:s,limits:wl(t,n),...i}}function T6(e){return"load"in e&&typeof e.load=="function"}function tk(e,t,n={}){return{name:e,trusted:n.trusted!==!1,execute:t}}function R6(e){let t=null,n=null;return{name:e.name,trusted:e.trusted!==!1,async execute(r,s){if(!t){let o=n;o||(o=e.load().then(a=>(t=a,a)),n=o);try{t=await o}catch(a){throw n===o&&(n=null),a}}let i=t;if(!i)throw new Error(`Failed to load command: ${e.name}`);return i.execute(r,s)}}}ce();ce();Z();xs();var $6=Object.freeze(Object.create(null)),bl=class{limits;signal;abortOnUnresolvedCommands;commandCount=0;workUnits=0;liveBytes=0;inputBytes=0;outputBytes=0;countersByKind=new Map;bytesByKind=new Map;depthByKind=new Map;cleanupCallbacks=[];poisoned;closed=!1;startedAt=Date.now();unresolvedCommands=new Set;get remainingLiveBytes(){return Math.max(0,this.limits.maxLiveBytes-this.liveBytes)}get outputBytesUsed(){return this.outputBytes}constructor(t,n=void 0,r=!1){this.limits=t,this.signal=n,this.abortOnUnresolvedCommands=r}recordUnresolvedCommand(t){this.unresolvedCommands.add(t)}get unresolvedCommandNames(){return[...this.unresolvedCommands]}fail(t){throw this.poisoned??=t,this.poisoned}poisonAfterAbort(t){this.poisoned??=t}assertUsable(){if(this.poisoned)throw this.poisoned;if(this.closed)throw new Error("execution budget is already closed");this.throwIfAborted()}chargeCommand(){return this.consume("commands",1,"execution")}consumeWork(t=1,n="execution"){return this.consume("work",t,n)}consumeLimited(t,n,r,s=t){this.assertUsable();let i=this.countersByKind.get(t)??0;return(!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(r)||r<0||n>r-i)&&this.fail(new C(`${s}: ${t} work limit exceeded (${r})`,"iterations")),n>this.limits.maxWorkUnits-this.workUnits&&this.fail(new C(`${s}: aggregate work limit exceeded (${this.limits.maxWorkUnits})`,"iterations")),this.countersByKind.set(t,i+n),this.workUnits+=n,i+n}consumeInput(t,n="execution"){return this.assertUsable(),(!Number.isSafeInteger(t)||t<0||t>this.limits.maxInputBytes-this.inputBytes)&&this.fail(new C(`${n}: aggregate input size limit exceeded (${this.limits.maxInputBytes} bytes)`,"string_length")),this.inputBytes+=t,this.inputBytes}consume(t,n=1,r=t){this.assertUsable();let s=this.countersByKind.get(t)??0,i=t==="commands"?this.commandCount:this.workUnits,o=t==="commands"?this.limits.maxCommandCount:this.limits.maxWorkUnits;(!Number.isSafeInteger(n)||n<0||n>o-i)&&this.fail(new C(t==="commands"?`too many commands executed (>${o}), increase executionLimits.maxCommandCount`:`${r}: ${t} work limit exceeded (${o})`,t==="commands"?"commands":"iterations"));let a=i+n;return t==="commands"?this.commandCount=a:this.workUnits=a,this.countersByKind.set(t,s+n),a}reserveBytes(t,n,r){this.assertUsable();let s=typeof t=="string"?t:"live",i=typeof t=="string"?n:t,o=typeof t=="string"?r??s:n??"execution";(!Number.isSafeInteger(i)||i<0||i>this.limits.maxLiveBytes-this.liveBytes)&&this.fail(new C(`${o}: live byte limit exceeded (${this.limits.maxLiveBytes} bytes)`,"string_length")),this.liveBytes+=i,this.bytesByKind.set(s,(this.bytesByKind.get(s)??0)+i);let a=!1;return{release:()=>{if(a)return;a=!0,this.liveBytes-=i;let l=(this.bytesByKind.get(s)??i)-i;l<=0?this.bytesByKind.delete(s):this.bytesByKind.set(s,l)}}}appendOutput(t,n,r="execution",s=0,i="text"){this.assertUsable();let o=i==="bytes"?n.length:U(n);(!Number.isSafeInteger(s)||s<0||s>o)&&this.fail(new C(`${r}: invalid ${t} accounting`,"output_size"));let a=o-s;return a>this.limits.maxOutputSize-this.outputBytes&&this.fail(new C(`${r}: total output size exceeded (>${this.limits.maxOutputSize} bytes), increase executionLimits.maxOutputSize`,"output_size")),this.outputBytes+=a,o}accountResult(t,n="execution",r=Number.POSITIVE_INFINITY){let s=t.internalOutputAccounting,i=Math.min(s?.stdout??0,r),o=Math.min(s?.stderr??0,Math.max(0,r-i)),a=this.appendOutput("stdout",t.stdout,n,i,t.stdoutKind==="bytes"||t.stdoutEncoding==="binary"?"bytes":"text"),l=this.appendOutput("stderr",t.stderr,n,o);return Object.isExtensible(t)?(t.internalOutputAccounting={stdout:a,stderr:l},t):a===0&&l===0?t:{...t,internalOutputAccounting:{stdout:a,stderr:l}}}relinquishOutput(t,n,r){this.assertUsable(),r!==$6&&this.fail(new C(`${n}: unauthorized output accounting release`,"output_size")),(!Number.isSafeInteger(t)||t<0||t>this.outputBytes)&&this.fail(new C(`${n}: invalid output accounting release`,"output_size")),this.outputBytes-=t}enterDepth(t,n=this.limits.maxCallDepth,r){this.assertUsable();let s=typeof n=="number"?n:this.limits.maxCallDepth,i=typeof n=="string"?n:r??t,o=this.depthByKind.get(t)??0;o>=s&&this.fail(new C(`${i}: maximum depth (${s}) exceeded`,"recursion")),this.depthByKind.set(t,o+1);let a=!1;return{release:()=>{if(a)return;a=!0;let l=(this.depthByKind.get(t)??1)-1;l<=0?this.depthByKind.delete(t):this.depthByKind.set(t,l)}}}throwIfAborted(t="execution"){this.signal?.aborted&&this.fail(new Ge("",`bash: ${t} aborted
757
+ `)),Date.now()-this.startedAt>this.limits.maxExecutionTimeMs&&this.fail(new Ge("",`bash: ${t} exceeded execution deadline (${this.limits.maxExecutionTimeMs}ms)
758
+ `))}remainingTimeMs(){return Math.max(0,this.limits.maxExecutionTimeMs-(Date.now()-this.startedAt))}registerCleanup(t){this.assertUsable(),this.cleanupCallbacks.push(t);let n=!0;return()=>{if(!n)return;n=!1;let r=this.cleanupCallbacks.indexOf(t);r>=0&&this.cleanupCallbacks.splice(r,1)}}async close(){if(this.closed)return;this.closed=!0;let t=[],n=Date.now()+this.limits.maxExtensionCleanupTimeMs;for(let r=this.cleanupCallbacks.length-1;r>=0;r--)try{let s=n-Date.now();if(s<=0){t.push(new Error("execution cleanup grace period exceeded"));break}let i,o=await Promise.race([Promise.resolve().then(this.cleanupCallbacks[r]).then(()=>({ok:!0}),a=>({ok:!1,error:a})),new Promise(a=>{i=Qi(()=>a({ok:!1,error:new Error("execution cleanup grace period exceeded")}),s)})]);if(Xi(i),!o.ok&&(t.push(o.error),Date.now()>=n))break}catch(s){t.push(s)}if(this.cleanupCallbacks.length=0,this.depthByKind.clear(),this.bytesByKind.clear(),this.liveBytes=0,t.length>0)throw new AggregateError(t,"execution cleanup failed")}assertExecDepth(t){this.assertUsable(),t>this.limits.maxExecDepth&&this.fail(new C(`maximum nested execution depth (${this.limits.maxExecDepth}) exceeded`,"recursion"))}};function P6(e){let t=Object.create(null);return Object.defineProperties(t,{remainingLiveBytes:{enumerable:!0,get:()=>e.remainingLiveBytes},consumeWork:{enumerable:!0,value:e.consumeWork.bind(e)},consumeLimited:{enumerable:!0,value:e.consumeLimited.bind(e)},consumeInput:{enumerable:!0,value:e.consumeInput.bind(e)},reserveBytes:{enumerable:!0,value:e.reserveBytes.bind(e)},enterDepth:{enumerable:!0,value:e.enterDepth.bind(e)},throwIfAborted:{enumerable:!0,value:e.throwIfAborted.bind(e)},remainingTimeMs:{enumerable:!0,value:e.remainingTimeMs.bind(e)},registerCleanup:{enumerable:!0,value:e.registerCleanup.bind(e)}}),Object.freeze(t)}function D6(e,t,n="pipeline"){e.relinquishOutput(t,n,$6)}ce();Df();ai();var zs=new TextEncoder;function rk(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var lr=class{data=new Map;entryIdentities=new WeakMap;nextEntryIdentity=1;maxTotalBytes;retainedBytes=0;contentReferences=new WeakMap;materializedContent(t){return t?.type==="file"&&"content"in t?t.content:null}storedByteLength(t){return t===null?0:t instanceof Uint8Array?t.byteLength:U(t)}wouldReleaseBytes(t){let n=this.materializedContent(t);return n===null?0:n instanceof Uint8Array?this.contentReferences.get(n)===1?n.byteLength:0:this.storedByteLength(n)}assertCanAllocate(t,n){let r=this.wouldReleaseBytes(this.data.get(t));if(!Number.isSafeInteger(n)||n<0||n>this.maxTotalBytes-this.retainedBytes+r)throw new Error(`ENOSPC: in-memory filesystem byte limit exceeded (${this.maxTotalBytes} bytes)`)}setEntry(t,n){let r=this.data.get(t),s=this.materializedContent(r),i=this.materializedContent(n);if(s===i){this.data.set(t,n);return}let o=this.wouldReleaseBytes(r),a=i instanceof Uint8Array?this.contentReferences.has(i)?0:i.byteLength:this.storedByteLength(i);if(a>this.maxTotalBytes-this.retainedBytes+o)throw new Error(`ENOSPC: in-memory filesystem byte limit exceeded (${this.maxTotalBytes} bytes)`);if(s instanceof Uint8Array){let l=this.contentReferences.get(s)??0;l<=1?this.contentReferences.delete(s):this.contentReferences.set(s,l-1)}i instanceof Uint8Array&&this.contentReferences.set(i,(this.contentReferences.get(i)??0)+1),this.retainedBytes+=a-o,this.data.set(t,n)}deleteEntry(t){let n=this.data.get(t);if(!n)return!1;let r=this.materializedContent(n),s=this.wouldReleaseBytes(n);if(r instanceof Uint8Array){let i=this.contentReferences.get(r)??0;i<=1?this.contentReferences.delete(r):this.contentReferences.set(r,i-1)}return this.retainedBytes-=s,this.data.delete(t)}contentByteLength(t,n){if(t instanceof Uint8Array)return t.byteLength;if(n==="hex")return Math.floor(t.length/2);if(n==="base64"){let r=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-r)}return n==="binary"||n==="latin1"?t.length:U(t)}identityFor(t){let n=this.entryIdentities.get(t);return n||(n=`memfs:${this.nextEntryIdentity++}`,this.entryIdentities.set(t,n)),n}constructor(t,n={}){if(this.maxTotalBytes=n.maxTotalBytes??1024*1024*1024,!Number.isSafeInteger(this.maxTotalBytes)||this.maxTotalBytes<0)throw new Error("InMemoryFs: invalid maxTotalBytes");if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[r,s]of Object.entries(t))typeof s=="function"?this.writeFileLazy(r,s):rk(s)?this.writeFileSync(r,s.content,void 0,{mode:s.mode,mtime:s.mtime}):this.writeFileSync(r,s)}ensureParentDirs(t){let n=oi(t);n!=="/"&&(this.data.has(n)||(this.ensureParentDirs(n),this.data.set(n,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,n,r,s){xt(t,"write");let i=Ne(t);this.ensureParentDirs(i);let o=hl(r);this.assertCanAllocate(i,this.contentByteLength(n,o));let a=Pf(n,o);this.setEntry(i,{type:"file",content:a,mode:s?.mode??420,mtime:s?.mtime??new Date})}writeFileLazy(t,n,r){xt(t,"write");let s=Ne(t);this.ensureParentDirs(s),this.setEntry(s,{type:"file",lazy:n,mode:r?.mode??420,mtime:r?.mtime??new Date})}async materializeLazy(t,n){let r=await n.lazy(),s=typeof r=="string"?zs.encode(r):r,i={type:"file",content:s,mode:n.mode,mtime:n.mtime};return this.assertCanAllocate(t,s.byteLength),this.setEntry(t,i),i}async readFile(t,n){let r=await this.readFileBuffer(t),s=hl(n);return To(r,s)}async readFileBytes(t){let n=await this.readFileBuffer(t);return To(n,"binary")}async readFileBuffer(t){xt(t,"open");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);if("lazy"in r){let s=await this.materializeLazy(n,r);return s.content instanceof Uint8Array?s.content:zs.encode(s.content)}return r.content instanceof Uint8Array?r.content:zs.encode(r.content)}async writeFile(t,n,r){this.writeFileSync(t,n,r)}async appendFile(t,n,r){xt(t,"append");let s=Ne(t),i=this.data.get(s);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=hl(r),a=this.contentByteLength(n,o);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(s,l));let c="content"in l&&l.content instanceof Uint8Array?l.content:zs.encode("content"in l?l.content:"");this.assertCanAllocate(s,c.byteLength+a);let u=Pf(n,o),f=new Uint8Array(c.length+u.length);f.set(c),f.set(u,c.length),this.setEntry(s,{type:"file",content:f,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,n,r)}async exists(t){if(t.includes("\0"))return!1;try{let n=this.resolvePathWithSymlinks(t);return this.data.has(n)}catch{return!1}}async stat(t){xt(t,"stat");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=zs.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date,identity:this.identityFor(r)}}async lstat(t){xt(t,"lstat");let n=this.resolveIntermediateSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=zs.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date,identity:this.identityFor(r)}}resolveIntermediateSymlinks(t){let n=Ne(t);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];s=`${s}/${a}`;let l=this.data.get(s),c=0,u=40;for(;l&&l.type==="symlink"&&c<u;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(s),s=ua(s,l.target),l=this.data.get(s),c++}if(c>=u)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${s}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let n=Ne(t);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",i=new Set;for(let o of r){s=`${s}/${o}`;let a=this.data.get(s),l=0,c=40;for(;a&&a.type==="symlink"&&l<c;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(s),s=ua(s,a.target),a=this.data.get(s),l++}if(l>=c)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return s}async mkdir(t,n){this.mkdirSync(t,n)}mkdirSync(t,n){xt(t,"mkdir");let r=Ne(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!n?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let s=oi(r);if(s!=="/"&&!this.data.has(s))if(n?.recursive)this.mkdirSync(s,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){xt(t,"scandir");let n=Ne(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let s=new Set;for(;r&&r.type==="symlink";){if(s.has(n))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);s.add(n),n=ua(n,r.target),r=this.data.get(n)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=n==="/"?"/":`${n}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==n&&a.startsWith(i)){let c=a.slice(i.length),u=c.split("/")[0];u&&!c.includes("/",u.length)&&!o.has(u)&&o.set(u,{name:u,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,n){xt(t,"rm");let r=Ne(t),s=this.data.get(r);if(!s){if(n?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(s.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!n?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let o of i){let a=Nn(r,o);await this.rm(a,n)}}}this.deleteEntry(r)}async cp(t,n,r){xt(t,"cp"),xt(n,"cp");let s=Ne(t),i=Ne(n),o=this.data.get(s);if(!o)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(o.type==="file")if(this.ensureParentDirs(i),"content"in o){let a=o.content instanceof Uint8Array?o.content.byteLength:zs.encode(o.content).byteLength;this.assertCanAllocate(i,a);let l=o.content instanceof Uint8Array?new Uint8Array(o.content):o.content;this.setEntry(i,{...o,content:l})}else this.setEntry(i,{...o});else if(o.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...o});else if(o.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);if(Mn(s,i))throw new Error(`EINVAL: cannot copy '${t}' into itself, '${n}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(s);for(let l of a){let c=Nn(s,l),u=Nn(i,l);await this.cp(c,u,r)}}}async mv(t,n){xt(t,"mv"),xt(n,"mv");let r=Ne(t),s=Ne(n);if(r===s)return;let i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, mv '${t}'`);if(i.type==="directory"&&Mn(r,s))throw new Error(`EINVAL: cannot move '${t}' into itself, '${n}'`);if(i.type==="directory"){await this.mkdir(s,{recursive:!0});let o=await this.readdir(r);for(let a of o)await this.mv(Nn(r,a),Nn(s,a));this.deleteEntry(r);return}this.ensureParentDirs(s),this.setEntry(s,i),this.deleteEntry(r)}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,n){return ca(t,n)}async chmod(t,n){xt(t,"chmod");let r=Ne(t),s=this.data.get(r);if(!s)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);s.mode=n}async symlink(t,n){xt(n,"symlink");let r=Ne(n);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,n){xt(t,"link"),xt(n,"link");let r=Ne(t),s=Ne(n),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(s))throw new Error(`EEXIST: file already exists, link '${n}'`);let o=i;"lazy"in o&&(o=await this.materializeLazy(r,o)),this.ensureParentDirs(s);let a={type:"file",content:o.content,mode:o.mode,mtime:o.mtime};this.entryIdentities.set(a,this.identityFor(o)),this.setEntry(s,a)}async readlink(t){xt(t,"readlink");let n=Ne(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return r.target}async realpath(t){xt(t,"realpath");let n=this.resolvePathWithSymlinks(t);if(!this.data.has(n))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return n}async utimes(t,n,r){xt(t,"utimes");let s=Ne(t),i=this.resolvePathWithSymlinks(s),o=this.data.get(i);if(!o)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);o.mtime=r}};var M6="5.1.0(1)-release",_6="Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT";function Bf(e){let{pid:t,ppid:n,uid:r,gid:s}=e;return`Name: bash
759
+ State: R (running)
760
+ Pid: ${t}
761
+ PPid: ${n}
762
+ Uid: ${r} ${r} ${r} ${r}
763
+ Gid: ${s} ${s} ${s} ${s}
764
+ `}function sk(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function ik(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function ok(e){e.mkdirSync("/dev",{recursive:!0}),e.mkdirSync("/dev/fd",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function ak(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${_6}
765
+ `),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
766
+ `),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>Bf(t)):e.writeFileSync("/proc/self/status",Bf(t)),e.writeFileSync("/proc/self/fd/0","/dev/stdin"),e.writeFileSync("/proc/self/fd/1","/dev/stdout"),e.writeFileSync("/proc/self/fd/2","/dev/stderr")}function B6(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){sk(e)&&(ik(e,t),ok(e),ak(e,n))}_n();Lr();function U6(e){let t={commands:new Set,definedFunctions:new Set,definedAliases:new Set};return Uf(e,t),{commands:[...t.commands],definedFunctions:t.definedFunctions,definedAliases:t.definedAliases}}function lk(e){return e.parts.length===1&&e.parts[0].type==="Literal"?e.parts[0].value:null}function ck(e,t){for(let n of e){let r=n.parts[0];if(r?.type!=="Literal")continue;let s=/^([A-Za-z_][A-Za-z0-9_]*)=/.exec(r.value);s&&t.definedAliases.add(s[1])}}function Uf(e,t){for(let n of e.statements)vr(n,t)}function vr(e,t){for(let n of e.pipelines)uk(n,t)}function uk(e,t){for(let n of e.commands)z6(n,t)}function z6(e,t){switch(e.type){case"SimpleCommand":if(e.name){let n=lk(e.name);n&&(t.commands.add(n),n==="alias"&&ck(e.args,t)),cn(e.name.parts,t)}for(let n of e.args)cn(n.parts,t);for(let n of e.assignments)if(n.value&&cn(n.value.parts,t),n.array)for(let r of n.array)cn(r.parts,t);for(let n of e.redirections)n.target.type==="Word"?cn(n.target.parts,t):n.target.type==="HereDoc"&&!n.target.quoted&&cn(n.target.content.parts,t);break;case"If":for(let n of e.clauses){for(let r of n.condition)vr(r,t);for(let r of n.body)vr(r,t)}if(e.elseBody)for(let n of e.elseBody)vr(n,t);break;case"For":if(e.words)for(let n of e.words)cn(n.parts,t);for(let n of e.body)vr(n,t);break;case"CStyleFor":for(let n of e.body)vr(n,t);break;case"While":case"Until":for(let n of e.condition)vr(n,t);for(let n of e.body)vr(n,t);break;case"Case":cn(e.word.parts,t);for(let n of e.items)for(let r of n.body)vr(r,t);break;case"Subshell":case"Group":for(let n of e.body)vr(n,t);break;case"ArithmeticCommand":case"ConditionalCommand":break;case"FunctionDef":t.definedFunctions.add(e.name),z6(e.body,t);break}}function cn(e,t){for(let n of e)switch(n.type){case"CommandSubstitution":Uf(n.body,t);break;case"ProcessSubstitution":Uf(n.body,t);break;case"DoubleQuoted":cn(n.parts,t);break;case"ParameterExpansion":n.operation&&W6(n.operation,t);break}}function W6(e,t){switch(e.type){case"DefaultValue":case"AssignDefault":case"UseAlternative":cn(e.word.parts,t);break;case"ErrorIfUnset":e.word&&cn(e.word.parts,t);break;case"PatternRemoval":cn(e.pattern.parts,t);break;case"PatternReplacement":cn(e.pattern.parts,t),e.replacement&&cn(e.replacement.parts,t);break;case"CaseModification":e.pattern&&cn(e.pattern.parts,t);break;case"Indirection":e.innerOp&&W6(e.innerOp,t);break}}function xl(e,t){return e===`/bin/${t}`||e===`/usr/bin/${t}`}async function El(e,t,n){if(t.includes("/")){let o=e.fs.resolvePath(e.state.cwd,t);if(!await e.fs.exists(o))return{error:"not_found",path:o};try{let a=await e.fs.stat(o);if(a.isDirectory)return{error:"permission_denied",path:o};let l=o.split("/").pop()||t,c=e.commands.get(l);return c&&xl(o,l)?{cmd:c,path:o}:(a.mode&73)!==0?{script:!0,path:o}:{error:"permission_denied",path:o}}catch{return{error:"not_found",path:o}}}if(!n&&e.state.hashTable){let o=e.state.hashTable.get(t);if(o){try{let a=await e.fs.stat(o);if(!a.isDirectory){let l=e.commands.get(t);if(l&&xl(o,t))return{cmd:l,path:o};if((a.mode&73)!==0)return{script:!0,path:o}}}catch{}e.state.hashTable.delete(t)}}let s=(n??e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let o of s){if(!o)continue;let l=`${o.startsWith("/")?o:e.fs.resolvePath(e.state.cwd,o)}/${t}`;if(await e.fs.exists(l))try{let c=await e.fs.stat(l);if(c.isDirectory)continue;let u=(c.mode&73)!==0,f=e.commands.get(t),d=xl(l,t);if(f&&d)return{cmd:f,path:l};if(u){if(f&&!d)return{script:!0,path:l};if(!f)return{script:!0,path:l}}}catch{}}if(!await e.fs.exists("/usr/bin")){let o=e.commands.get(t);if(o)return{cmd:o,path:`/usr/bin/${t}`}}return null}async function Sl(e,t){let n=[];if(t.includes("/")){let i=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(i))try{let o=await e.fs.stat(i);o.isDirectory||(o.mode&73)!==0&&n.push(t)}catch{}return n}let s=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let i of s){if(!i)continue;let a=`${i.startsWith("/")?i:e.fs.resolvePath(e.state.cwd,i)}/${t}`;if(xl(a,t)&&e.commands.has(t)){n.push(a);continue}if(await e.fs.exists(a)){try{let l=await e.fs.stat(a);if(l.isDirectory||(l.mode&73)===0)continue}catch{continue}n.push(i.startsWith("/")?a:`${i}/${t}`)}}return n}Z();ce();Z();function un(e){return{kind:e.kind,elements:new Map(e.elements)}}function Zn(e){return new Map(Array.from(e??[],([t,n])=>[t,un(n)]))}function zt(e,t){return e.state.arrays?.get(t)}function $o(e,t,n="indexed"){e.state.arrays??=new Map;let r=e.state.arrays.get(t);return r||(r={kind:n,elements:new Map},e.state.arrays.set(t,r)),r}function es(e,t,n){let r=$o(e,t,n);return r.kind=n,r}function Gt(e,t){return e.state.arrays?.has(t)??!1}function Xe(e,t,n){return zt(e,t)?.elements.get(String(n))}function ts(e,t,n){return zt(e,t)?.elements.has(String(n))??!1}function we(e,t,n,r,s){let i=$o(e,t,s),o=String(n);if(!i.elements.has(o)&&i.elements.size>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(U(r)>e.limits.maxStringLength)throw new C(`array value string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");i.elements.set(o,r)}function Ws(e,t,n,r=!1){let s=new Set(r?[]:zt(e,t)?.elements.keys()??[]);for(let i of n)if(s.add(String(i)),s.size>e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements")}function js(e,t,n){return zt(e,t)?.elements.delete(String(n))??!1}function Po(e,t){e.state.arrays?.delete(t),e.state.associativeArrays?.delete(t)}function Mt(e,t){return Array.from(zt(e,t)?.elements.keys()??[]).filter(r=>/^(0|[1-9]\d*)$/.test(r)).map(Number).sort((r,s)=>r-s)}function vt(e,t){$o(e,t,e.state.associativeArrays?.has(t)?"associative":"indexed").elements.clear()}function kr(e,t){return Array.from(zt(e,t)?.elements.keys()??[]).sort()}function Al(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function zf(e){if(e.parts.length<2)return null;let t=e.parts[0],n=e.parts[1];if(t.type!=="Glob"||!t.pattern.startsWith("["))return null;let r,s=n,i=1;if(n.type==="Literal"&&n.value.startsWith("]")){let f=n.value.slice(1);if(f.startsWith("+=")||f.startsWith("="))r=t.pattern.slice(1);else if(f===""){if(e.parts.length<3)return null;let d=e.parts[2];if(d.type!=="Literal"||!d.value.startsWith("=")&&!d.value.startsWith("+="))return null;r=t.pattern.slice(1),s=d,i=2}else return null}else if(t.pattern==="["&&(n.type==="DoubleQuoted"||n.type==="SingleQuoted")){if(e.parts.length<3)return null;let f=e.parts[2];if(f.type!=="Literal"||!f.value.startsWith("]=")&&!f.value.startsWith("]+="))return null;if(n.type==="SingleQuoted")r=n.value;else{r="";for(let d of n.parts)(d.type==="Literal"||d.type==="Escaped")&&(r+=d.value)}s=f,i=2}else if(t.pattern.endsWith("]")){if(n.type!=="Literal"||!n.value.startsWith("=")&&!n.value.startsWith("+="))return null;r=t.pattern.slice(1,-1)}else return null;r=Al(r);let o;if(s.type!=="Literal")return null;s.value.startsWith("]=")||s.value.startsWith("]+=")?o=s.value.slice(1):o=s.value;let a=o.startsWith("+=");if(!a&&!o.startsWith("="))return null;let l=[],c=a?2:1,u=o.slice(c);u&&l.push({type:"Literal",value:u});for(let f=i+1;f<e.parts.length;f++){let d=e.parts[f];d.type==="BraceExpansion"?l.push({type:"Literal",value:fk(d)}):l.push(d)}return{key:r,valueParts:l,append:a}}function fk(e){return`{${e.items.map(n=>{if(n.type==="Range"){let r=n.startStr??String(n.start),s=n.endStr??String(n.end),i=`${r}..${s}`;return n.step&&(i+=`..${n.step}`),i}return Di(n.word)}).join(",")}}`}function Di(e){let t="";for(let n of e.parts)switch(n.type){case"Literal":t+=n.value;break;case"Glob":t+=n.pattern;break;case"SingleQuoted":t+=n.value;break;case"DoubleQuoted":for(let r of n.parts)(r.type==="Literal"||r.type==="Escaped")&&(t+=r.value);break;case"Escaped":t+=n.value;break;case"BraceExpansion":t+="{",t+=n.items.map(r=>r.type==="Range"?`${r.startStr}..${r.endStr}${r.step?`..${r.step}`:""}`:Di(r.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",n.user&&(t+=n.user);break}return t}var Do=new Set([":",".","break","continue","eval","exec","exit","export","readonly","return","set","shift","trap","unset"]);function j6(e){return Do.has(e)}var Wf=new Set(["if","then","else","elif","fi","case","esac","for","select","while","until","do","done","in","function","{","}","time","[[","]]","!"]),ns=new Set([":","true","false","cd","export","unset","exit","local","set","break","continue","return","eval","shift","getopts","compgen","complete","compopt","pushd","popd","dirs","source",".","read","mapfile","readarray","declare","typeset","readonly","let","command","shopt","exec","test","[","echo","printf","pwd","alias","unalias","type","hash","ulimit","umask","trap","times","wait","kill","jobs","fg","bg","disown","suspend","fc","history","help","enable","builtin","caller"]),H6=new Set(["bg","caller","disown","enable","fc","fg","jobs","kill","suspend","times","trap","ulimit","umask"]);var dk=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],pk=["braceexpand","hashall","interactive-comments"];function jf(e){let t=[],n=[...pk.map(r=>({name:r,enabled:!0})),...dk.map(r=>({name:r,enabled:e[r]}))].sort((r,s)=>r.name.localeCompare(s.name));for(let r of n)r.enabled&&t.push(r.name);return t.join(":")}function Li(e){e.state.env.set("SHELLOPTS",jf(e.state.options))}var hk=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Hf(e){let t=[];for(let n of hk)e[n]&&t.push(n);return t.join(":")}function Vf(e){e.state.env.set("BASHOPTS",Hf(e.state.shoptOptions))}ce();bi();Lr();var ee={script(e){return{type:"Script",statements:e}},statement(e,t=[],n=!1,r,s){let i={type:"Statement",pipelines:e,operators:t,background:n};return r&&(i.deferredError=r),s!==void 0&&(i.sourceText=s),i},pipeline(e,t=!1,n=!1,r=!1,s){return{type:"Pipeline",commands:e,negated:t,timed:n,timePosix:r,pipeStderr:s}},simpleCommand(e,t=[],n=[],r=[]){return{type:"SimpleCommand",name:e,args:t,assignments:n,redirections:r}},word(e){return{type:"Word",parts:e}},literal(e){return{type:"Literal",value:e}},singleQuoted(e){return{type:"SingleQuoted",value:e}},doubleQuoted(e){return{type:"DoubleQuoted",parts:e}},escaped(e){return{type:"Escaped",value:e}},parameterExpansion(e,t=null){return{type:"ParameterExpansion",parameter:e,operation:t}},commandSubstitution(e,t=!1){return{type:"CommandSubstitution",body:e,legacy:t}},arithmeticExpansion(e){return{type:"ArithmeticExpansion",expression:e}},processSubstitution(e,t){return{type:"ProcessSubstitution",body:e,direction:t}},assignment(e,t,n=!1,r=null){return{type:"Assignment",name:e,value:t,append:n,array:r}},redirection(e,t,n=null,r){let s={type:"Redirection",fd:n,operator:e,target:t};return r&&(s.fdVariable=r),s},hereDoc(e,t,n=!1,r=!1,s){let i={type:"HereDoc",delimiter:e,content:t,stripTabs:n,quoted:r};return s!==void 0&&(i.terminated=s),i},ifNode(e,t=null,n=[]){return{type:"If",clauses:e,elseBody:t,redirections:n}},forNode(e,t,n,r=[]){return{type:"For",variable:e,words:t,body:n,redirections:r}},whileNode(e,t,n=[]){return{type:"While",condition:e,body:t,redirections:n}},untilNode(e,t,n=[]){return{type:"Until",condition:e,body:t,redirections:n}},caseNode(e,t,n=[]){return{type:"Case",word:e,items:t,redirections:n}},caseItem(e,t,n=";;"){return{type:"CaseItem",patterns:e,body:t,terminator:n}},subshell(e,t=[]){return{type:"Subshell",body:e,redirections:t}},group(e,t=[]){return{type:"Group",body:e,redirections:t}},functionDef(e,t,n=[],r){return{type:"FunctionDef",name:e,body:t,redirections:n,sourceFile:r}},conditionalCommand(e,t=[],n){return{type:"ConditionalCommand",expression:e,redirections:t,line:n}},arithmeticCommand(e,t=[],n){return{type:"ArithmeticCommand",expression:e,redirections:t,line:n}}};function V6(e,t){let n=e.length,r=t+3,s=2,i=!1,o=!1;for(;r<n&&s>0;){let a=e[r];if(i){a==="'"&&(i=!1),r++;continue}if(o){if(a==="\\"){r+=2;continue}a==='"'&&(o=!1),r++;continue}if(a==="'"){i=!0,r++;continue}if(a==='"'){o=!0,r++;continue}if(a==="\\"){r+=2;continue}if(a==="("){s++,r++;continue}if(a===")"){if(s--,s===1){let l=r+1;return!(l<n&&e[l]===")")}if(s===0)return!1;r++;continue}if(s===1&&(a==="|"&&r+1<n&&e[r+1]==="|"||a==="&"&&r+1<n&&e[r+1]==="&"||a==="|"&&r+1<n&&e[r+1]!=="|"))return!0;r++}return!1}function Cl(e,t){let n="",r=t,s=0,i=!1,o,a=l=>l===" "||l===" "||l===`
767
+ `||l===";"||l==="&"||l==="|"||l==="<"||l===">"||l==="("||l===")";for(;r<e.length;){let l=e[r];if(l==="'"){let c=s>0;for(c||(i=!0),c&&(n+=l),r++;r<e.length&&e[r]!=="'";)n+=e[r],r++;r<e.length?(c&&(n+=e[r]),r++):o=l;continue}if(l==='"'){let c=s>0;for(c||(i=!0),c&&(n+=l),r++;r<e.length&&e[r]!=='"';){if(e[r]==="\\"&&r+1<e.length){if(c){n+=e.slice(r,r+2),r+=2;continue}let u=e[r+1];if(u==="$"||u==="`"||u==='"'||u==="\\"||u===`
768
+ `){r+=2,u!==`
769
+ `&&(n+=u);continue}}n+=e[r],r++}r<e.length?(c&&(n+=e[r]),r++):o=l;continue}if(l==="\\"&&r+1<e.length){if(s>0){n+=e.slice(r,r+2),r+=2;continue}i=!0;let c=e[r+1];c!==`
770
+ `&&(n+=c),r+=2;continue}if(s===0&&(l==="$"||l==="<"||l===">")&&e[r+1]==="("){n+=`${l}(`,s=1,r+=2;continue}if(s===0&&a(l))break;s>0&&(l==="("?s++:l===")"&&s--),n+=l,r++}return{delim:n,endPos:r,quoted:i,unclosedQuote:o,unclosedSubstitution:s>0}}function mk(e,t,n){let r=t+1;for(let{delim:s,stripTabs:i}of n)for(;;){if(r>=e.length)return e.length;let o=e.indexOf(`
771
+ `,r);o===-1&&(o=e.length);let a=e.slice(r,o);if(i&&(a=a.replace(/^\t+/,"")),a===s){r=o+1;break}if(o>=e.length)return e.length;r=o+1}return Math.min(r,e.length)}function G6(e,t,n){let r=1,s=t,i=!1,o=!1,a=0,l=!1,c="",u=[],f=0;for(;s<e.length&&r>0;){let d=e[s];if(i)d==="'"&&(i=!1);else if(o)d==="\\"&&s+1<e.length?s++:d==='"'&&(o=!1);else{if(d==="("&&e[s+1]==="("?f++:d===")"&&e[s+1]===")"&&f>0&&f--,f===0&&d==="<"&&e[s+1]==="<"&&e[s+2]!=="<"){let p=s+2,h=!1;for(e[p]==="-"&&(h=!0,p++);e[p]===" "||e[p]===" ";)p++;let{delim:m,endPos:g,unclosedQuote:b,unclosedSubstitution:w}=Cl(e,p);if(b&&n(`unexpected EOF while looking for matching \`${b}'`),w&&n("unexpected EOF while looking for matching `)'"),m.length>0){u.push({delim:m,stripTabs:h}),c="",s=g;continue}}if(d===`
772
+ `&&u.length>0){let p=mk(e,s,u);u.length=0,c="",s=p;continue}d==="'"?(i=!0,c=""):d==='"'?(o=!0,c=""):d==="\\"&&s+1<e.length?(s++,c=""):/[a-zA-Z_]/.test(d)?c+=d:(c==="case"?(a++,l=!1):c==="in"&&a>0?l=!0:c==="esac"&&a>0&&(a--,l=!1),c="",d==="("?s>0&&e[s-1]==="$"?r++:l||r++:d===")"?l?l=!1:r--:d===";"&&a>0&&s+1<e.length&&e[s+1]===";"&&(l=!0))}r>0&&s++}return r>0&&n("unexpected EOF while looking for matching `)'"),s}function q6(e,t,n,r){let s=t+2,i=G6(e,s,r),o=e.slice(s,i),l=n().parse(o);return{part:ee.commandSubstitution(l,!1),endIndex:i+1}}function Z6(e,t,n,r){let s=e[t]==="<"?"input":"output",i=t+2,o=G6(e,i,r),a=n().parse(e.slice(i,o));return{part:ee.processSubstitution(a,s),endIndex:o+1}}function K6(e,t,n,r,s){let o=t+1,a="";for(;o<e.length&&e[o]!=="`";)if(e[o]==="\\"){let u=e[o+1];u==="$"||u==="`"||u==="\\"||u===`
773
+ `||n&&u==='"'?(u!==`
774
+ `&&(a+=u),o+=2):(a+=e[o],o++)}else a+=e[o],o++;o>=e.length&&s("unexpected EOF while looking for matching ``'");let c=r().parse(a);return{part:ee.commandSubstitution(c,!0),endIndex:o+1}}var gk=10485760,v;(function(e){e.EOF="EOF",e.NEWLINE="NEWLINE",e.SEMICOLON="SEMICOLON",e.AMP="AMP",e.PIPE="PIPE",e.PIPE_AMP="PIPE_AMP",e.AND_AND="AND_AND",e.OR_OR="OR_OR",e.BANG="BANG",e.LESS="LESS",e.GREAT="GREAT",e.DLESS="DLESS",e.DGREAT="DGREAT",e.LESSAND="LESSAND",e.GREATAND="GREATAND",e.LESSGREAT="LESSGREAT",e.DLESSDASH="DLESSDASH",e.CLOBBER="CLOBBER",e.TLESS="TLESS",e.AND_GREAT="AND_GREAT",e.AND_DGREAT="AND_DGREAT",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.DSEMI="DSEMI",e.SEMI_AND="SEMI_AND",e.SEMI_SEMI_AND="SEMI_SEMI_AND",e.DBRACK_START="DBRACK_START",e.DBRACK_END="DBRACK_END",e.DPAREN_START="DPAREN_START",e.DPAREN_END="DPAREN_END",e.IF="IF",e.THEN="THEN",e.ELSE="ELSE",e.ELIF="ELIF",e.FI="FI",e.FOR="FOR",e.WHILE="WHILE",e.UNTIL="UNTIL",e.DO="DO",e.DONE="DONE",e.CASE="CASE",e.ESAC="ESAC",e.IN="IN",e.FUNCTION="FUNCTION",e.SELECT="SELECT",e.TIME="TIME",e.COPROC="COPROC",e.WORD="WORD",e.NAME="NAME",e.NUMBER="NUMBER",e.ASSIGNMENT_WORD="ASSIGNMENT_WORD",e.FD_VARIABLE="FD_VARIABLE",e.COMMENT="COMMENT",e.HEREDOC_CONTENT="HEREDOC_CONTENT"})(v||(v={}));var Tn=class extends Error{line;column;constructor(t,n,r){super(`line ${n}: ${t}`),this.line=n,this.column=r,this.name="LexerError"}},Gf=new Map([["if",v.IF],["then",v.THEN],["else",v.ELSE],["elif",v.ELIF],["fi",v.FI],["for",v.FOR],["while",v.WHILE],["until",v.UNTIL],["do",v.DO],["done",v.DONE],["case",v.CASE],["esac",v.ESAC],["in",v.IN],["function",v.FUNCTION],["select",v.SELECT],["time",v.TIME],["coproc",v.COPROC]]),yk=new Set(Gf.values());function qf(e){return yk.has(e)}function Q6(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return!1;let n=e.slice(t[0].length);if(n===""||n==="+")return!0;if(n[0]==="["){let r=0,s=0;for(;s<n.length;s++)if(n[s]==="[")r++;else if(n[s]==="]"&&(r--,r===0))break;if(r!==0||s>=n.length)return!1;let i=n.slice(s+1);return i===""||i==="+"}return!1}function X6(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r==="[")t++;else if(r==="]")t--;else{if(t===0&&r==="=")return n;if(t===0&&r==="+"&&e[n+1]==="=")return n+1}}return-1}var wk=[[";",";","&",v.SEMI_SEMI_AND],["<","<","<",v.TLESS],["&",">",">",v.AND_DGREAT]],bk=[["[","[",v.DBRACK_START],["]","]",v.DBRACK_END],["(","(",v.DPAREN_START],[")",")",v.DPAREN_END],["&","&",v.AND_AND],["|","|",v.OR_OR],[";",";",v.DSEMI],[";","&",v.SEMI_AND],["|","&",v.PIPE_AMP],[">",">",v.DGREAT],["<","&",v.LESSAND],[">","&",v.GREATAND],["<",">",v.LESSGREAT],[">","|",v.CLOBBER],["&",">",v.AND_GREAT]],xk=new Map([["|",v.PIPE],["&",v.AMP],[";",v.SEMICOLON],["(",v.LPAREN],[")",v.RPAREN],["<",v.LESS],[">",v.GREAT]]);function Ek(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function Y6(e){return e===" "||e===" "||e===`
775
+ `||e===";"||e==="&"||e==="|"||e==="("||e===")"||e==="<"||e===">"}var vl=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];pendingHeredocDelimiterMode;dparenDepth=0;maxHeredocSize;constructor(t,n){this.input=t,this.maxHeredocSize=n?.maxHeredocSize??gk}tokenize(){let n=this.input.length,r=this.tokens,s=this.pendingHeredocs;for(;this.pos<n;){if(s.length>0&&r.length>0&&r[r.length-1].type===v.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=n)break;let i=this.nextToken();i&&r.push(i)}return s.length>0&&this.readHeredocContent(),r.push({type:v.EOF,value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),r}skipWhitespace(){let t=this.input,n=t.length,r=this.pos,s=this.column,i=this.line;for(;r<n;){let o=t[r];if(o===" "||o===" ")r++,s++;else if(o==="\\"&&t[r+1]===`
776
+ `)r+=2,i++,s=1;else break}this.pos=r,this.column=s,this.line=i}nextToken(){let t=this.input,n=this.pos,r=this.line,s=this.column,i=t[n],o=t[n+1],a=t[n+2],l=this.pendingHeredocDelimiterMode;if(this.pendingHeredocDelimiterMode=void 0,l!==void 0&&i!==`
777
+ `&&!(i==="#"&&this.dparenDepth===0))return this.readHeredocDelimiterToken(n,r,s,l);if(i==="#"&&this.dparenDepth===0)return this.readComment(n,r,s);if(i===`
778
+ `)return this.pos=n+1,this.line++,this.column=1,{type:v.NEWLINE,value:`
779
+ `,start:n,end:n+1,line:r,column:s};if(i==="<"&&o==="<"&&a==="-")return this.pos=n+3,this.column=s+3,this.pendingHeredocDelimiterMode=!0,this.makeToken(v.DLESSDASH,"<<-",n,r,s);for(let[u,f,d,p]of wk)if(i===u&&o===f&&a===d)return this.pos=n+3,this.column=s+3,this.makeToken(p,u+f+d,n,r,s);if(i==="<"&&o==="<")return this.pos=n+2,this.column=s+2,this.pendingHeredocDelimiterMode=!1,this.makeToken(v.DLESS,"<<",n,r,s);if(i==="("&&o==="("){let u=this.tokens[this.tokens.length-1];return this.dparenDepth===0&&u?.end===n&&(u.type===v.LESS||u.type===v.GREAT)?(this.pos=n+1,this.column=s+1,this.makeToken(v.LPAREN,"(",n,r,s)):this.dparenDepth>0?(this.pos=n+1,this.column=s+1,this.dparenDepth++,this.makeToken(v.LPAREN,"(",n,r,s)):this.looksLikeNestedSubshells(n+2)||this.dparenClosesWithSpacedParens(n+2)?(this.pos=n+1,this.column=s+1,this.makeToken(v.LPAREN,"(",n,r,s)):(this.pos=n+2,this.column=s+2,this.dparenDepth=1,this.makeToken(v.DPAREN_START,"((",n,r,s))}if(i===")"&&o===")")return this.dparenDepth===1?(this.pos=n+2,this.column=s+2,this.dparenDepth=0,this.makeToken(v.DPAREN_END,"))",n,r,s)):this.dparenDepth>1?(this.pos=n+1,this.column=s+1,this.dparenDepth--,this.makeToken(v.RPAREN,")",n,r,s)):(this.pos=n+1,this.column=s+1,this.makeToken(v.RPAREN,")",n,r,s));for(let[u,f,d]of bk)if(!(u==="("&&f==="("||u===")"&&f===")")&&!(this.dparenDepth>0&&u===";"&&(d===v.DSEMI||d===v.SEMI_AND||d===v.SEMI_SEMI_AND))&&i===u&&o===f){if(d===v.DBRACK_START||d===v.DBRACK_END){let p=t[n+2];if(p!==void 0&&p!==" "&&p!==" "&&p!==`
780
+ `&&p!==";"&&p!=="&"&&p!=="|"&&p!=="("&&p!==")"&&p!=="<"&&p!==">")break}return this.pos=n+2,this.column=s+2,this.makeToken(d,u+f,n,r,s)}if(i==="("&&this.dparenDepth>0)return this.pos=n+1,this.column=s+1,this.dparenDepth++,this.makeToken(v.LPAREN,"(",n,r,s);if(i===")"&&this.dparenDepth>1)return this.pos=n+1,this.column=s+1,this.dparenDepth--,this.makeToken(v.RPAREN,")",n,r,s);let c=xk.get(i);if(c!==void 0)return this.pos=n+1,this.column=s+1,this.makeToken(c,i,n,r,s);if(i==="{"){let u=this.scanFdVariable(n);return u!==null?(this.pos=u.end,this.column=s+(u.end-n),{type:v.FD_VARIABLE,value:u.varname,start:n,end:u.end,line:r,column:s}):o==="}"?(this.pos=n+2,this.column=s+2,{type:v.WORD,value:"{}",start:n,end:n+2,line:r,column:s,quoted:!1,singleQuoted:!1}):this.scanBraceExpansion(n)!==null?this.readWordWithBraceExpansion(n,r,s):this.scanLiteralBraceWord(n)!==null?this.readWordWithBraceExpansion(n,r,s):o!==void 0&&o!==" "&&o!==" "&&o!==`
781
+ `?this.readWord(n,r,s):(this.pos=n+1,this.column=s+1,this.makeToken(v.LBRACE,"{",n,r,s))}return i==="}"?this.isWordCharFollowing(n+1)?this.readWord(n,r,s):(this.pos=n+1,this.column=s+1,this.makeToken(v.RBRACE,"}",n,r,s)):i==="!"?o==="="?(this.pos=n+2,this.column=s+2,this.makeToken(v.WORD,"!=",n,r,s)):(this.pos=n+1,this.column=s+1,this.makeToken(v.BANG,"!",n,r,s)):this.readWord(n,r,s)}looksLikeNestedSubshells(t){let n=this.input,r=n.length,s=t;for(;s<r&&(n[s]===" "||n[s]===" ");)s++;if(s>=r)return!1;let i=n[s];if(i==="(")return this.looksLikeNestedSubshells(s+1);let o=/[a-zA-Z_]/.test(i),a=i==="!"||i==="[";if(!o&&!a)return!1;let l=s;for(;l<r&&/[a-zA-Z0-9_\-.]/.test(n[l]);)l++;if(l===s)return a;let c=l;for(;c<r&&(n[c]===" "||n[c]===" ");)c++;if(c>=r)return!1;let u=n[c];if(u==="="&&n[c+1]!=="="||u===`
782
+ `||l===c&&/[+\-*/%<>&|^!~?:]/.test(u)&&u!=="-"||u===")"&&n[c+1]===")")return!1;if(c>l&&(u==="-"||u==='"'||u==="'"||u==="$"||/[a-zA-Z_/.]/.test(u))){let f=c;for(;f<r&&n[f]!==`
783
+ `;){if(n[f]===")")return!0;f++}return!1}if(u===")"){let f=c+1;for(;f<r&&(n[f]===" "||n[f]===" ");)f++;if(n[f]==="|"&&n[f+1]==="|"||n[f]==="&"&&n[f+1]==="&"||n[f]===";"||n[f]==="|"&&n[f+1]!=="|")return!0}return!1}makeToken(t,n,r,s,i){return{type:t,value:n,start:r,end:this.pos,line:s,column:i}}readComment(t,n,r){let s=this.input,i=s.length,o=this.pos;for(;o<i&&s[o]!==`
784
+ `;)o++;let a=s.slice(t,o);return this.pos=o,this.column=r+(o-t),{type:v.COMMENT,value:a,start:t,end:o,line:n,column:r}}readWord(t,n,r){let s=this.input,i=s.length,o=this.pos,a=o;for(;o<i;){let y=s[o];if(y===" "||y===" "||y===`
785
+ `||y===";"||y==="&"||y==="|"||y==="("||y===")"||y==="<"||y===">"||y==="'"||y==='"'||y==="\\"||y==="$"||y==="`"||y==="{"||y==="}"||y==="~"||y==="*"||y==="?"||y==="[")break;o++}if(o>a){let y=s[o];if(!(y==="("&&o>a&&"@*+?!".includes(s[o-1]))){if(o>=i||y===" "||y===" "||y===`
786
+ `||y===";"||y==="&"||y==="|"||y==="("||y===")"||y==="<"||y===">"){let x=s.slice(a,o);this.pos=o,this.column=r+(o-a);let S=Gf.get(x);if(S!==void 0)return{type:S,value:x,start:t,end:o,line:n,column:r};let E=X6(x);return E>0&&Q6(x.slice(0,E))?{type:v.ASSIGNMENT_WORD,value:x,start:t,end:o,line:n,column:r}:/^[0-9]+$/.test(x)?{type:v.NUMBER,value:x,start:t,end:o,line:n,column:r}:/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(x)?{type:v.NAME,value:x,start:t,end:o,line:n,column:r,quoted:!1,singleQuoted:!1}:{type:v.WORD,value:x,start:t,end:o,line:n,column:r,quoted:!1,singleQuoted:!1}}}}o=this.pos;let l=this.column,c=this.line,u="",f=!1,d=!1,p=!1,h=!1,m=s[o]==='"'||s[o]==="'",g=!1,b=0;for(;o<i;){let y=s[o];if(!p&&!h){if(y==="("&&u.length>0&&"@*+?!".includes(u[u.length-1])){let x=this.scanExtglobPattern(o);if(x!==null){u+=x.content,o=x.end,l+=x.content.length;continue}}if(y==="["&&b===0){if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){let x=o+1<i?s[o+1]:"";if(x==="^"||x==="!"){u+=y,o++,l++;continue}b=1,u+=y,o++,l++;continue}}else if(y==="["&&b>0){u.length>0&&u[u.length-1]!=="\\"&&b++,u+=y,o++,l++;continue}else if(y==="]"&&b>0){u.length>0&&u[u.length-1]!=="\\"&&b--,u+=y,o++,l++;continue}if(b>0){if(y===`
787
+ `)break;u+=y,o++,l++;continue}if(y===" "||y===" "||y===`
788
+ `||y===";"||y==="&"||y==="|"||y==="("||y===")"||y==="<"||y===">")break}if(y==="$"&&o+1<i&&s[o+1]==="'"&&!p&&!h){for(u+="$'",o+=2,l+=2;o<i&&s[o]!=="'";)s[o]==="\\"&&o+1<i?(u+=s[o]+s[o+1],o+=2,l+=2):(u+=s[o],o++,l++);o<i&&(u+="'",o++,l++);continue}if(y==="$"&&o+1<i&&s[o+1]==='"'&&!p&&!h){o++,l++,h=!0,f=!0,u===""&&(m=!0),o++,l++;continue}if(y==="'"&&!h){if(p)if(p=!1,!m||g)u+=y;else{let x=o+1<i?s[o+1]:"";x&&!Y6(x)&&x!=="'"&&(x==='"'?(g=!0,u+=y,d=!1,f=!1):(g=!0,u+=y))}else p=!0,m&&!g?(d=!0,f=!0):u+=y;o++,l++;continue}if(y==='"'&&!p){if(h)if(h=!1,!m||g)u+=y;else{let x=o+1<i?s[o+1]:"";x&&!Y6(x)&&x!=='"'&&(x==="'"?(g=!0,u+=y,d=!1,f=!1):(g=!0,u+=y))}else h=!0,m&&!g?f=!0:u+=y;o++,l++;continue}if(y==="\\"&&!p&&o+1<i){let x=s[o+1];if(x===`
789
+ `){o+=2,c++,l=1;continue}if(h){if(x==='"'||x==="\\"||x==="$"||x==="`"||x===`
790
+ `){if(x===`
791
+ `){o+=2,l=1,c++;continue}u+=y+x,o+=2,l+=2;continue}}else{u+=y+x,o+=2,l+=2;continue}}if(y==="$"&&o+1<i&&s[o+1]==="("&&!p){u+=y,o++,l++,u+=s[o],o++,l++;let x=1,S=!1,E=!1,A=0,I=!1,$="",N=[],R=s[o]==="("&&!this.dollarDparenIsSubshell(o),O=R?1:0;for(;x>0&&o<i;){let B=s[o];if(u+=B,S)B==="'"&&(S=!1);else if(E)B==="\\"&&o+1<i?(u+=s[o+1],o++,l++):B==='"'&&(E=!1);else{if(B==="("&&s[o+1]==="("?O++:B===")"&&s[o+1]===")"&&O>0&&O--,O===0&&B==="<"&&s[o+1]==="<"&&s[o+2]!=="<"){let L=o+2,T=!1;for(s[L]==="-"&&(T=!0,L++);s[L]===" "||s[L]===" ";)L++;let{delim:W,endPos:_,unclosedQuote:F,unclosedSubstitution:z}=Cl(s,L);if(F)throw new Tn(`unexpected EOF while looking for matching \`${F}'`,c,l);if(z)throw new Tn("unexpected EOF while looking for matching `)'",c,l);if(W.length>0){u+=s.slice(o+1,_),l+=_-o,N.push({delim:W,stripTabs:T}),o=_;continue}}if(B===`
792
+ `&&N.length>0){c++,l=0;let L=o+1;for(let{delim:T,stripTabs:W}of N)for(;!(L>=i);){let _=s.indexOf(`
793
+ `,L);_===-1&&(_=i);let F=s.slice(L,_),z=W?F.replace(/^\t+/,""):F;u+=s.slice(L,Math.min(_+1,i)),_<i&&c++;let D=_>=i;if(L=_+1,z===T||D)break}N.length=0,l=0,o=Math.min(L,i);continue}if(B==="'")S=!0,$="";else if(B==='"')E=!0,$="";else if(B==="\\"&&o+1<i)u+=s[o+1],o++,l++,$="";else if(B==="$"&&o+1<i&&s[o+1]==="{"){o++,l++,u+=s[o],o++,l++;let L=1,T=!1,W=!1;for(;L>0&&o<i;){let _=s[o];if(_==="\\"&&o+1<i&&!T){u+=_,o++,l++,u+=s[o],o++,l++;continue}u+=_,T?_==="'"&&(T=!1):W?_==='"'&&(W=!1):_==="'"?T=!0:_==='"'?W=!0:_==="{"?L++:_==="}"&&L--,_===`
794
+ `?(c++,l=0):l++,o++}$="";continue}else if(B==="#"&&!R&&($===""||/\s/.test(s[o-1]||""))){for(;o+1<i&&s[o+1]!==`
795
+ `;)o++,l++,u+=s[o];$=""}else/[a-zA-Z_]/.test(B)?$+=B:($==="case"?(A++,I=!1):$==="in"&&A>0?I=!0:$==="esac"&&A>0&&(A--,I=!1),$="",B==="("?o>0&&s[o-1]==="$"?x++:I||x++:B===")"?I?I=!1:x--:B===";"&&A>0&&(o+1<i&&s[o+1]===";"||o+1<i&&s[o+1]==="&")&&(I=!0))}B===`
796
+ `&&(c++,l=0,$=""),o++,l++}continue}if(y==="$"&&o+1<i&&s[o+1]==="["&&!p){u+=y,o++,l++,u+=s[o],o++,l++;let x=1;for(;x>0&&o<i;){let S=s[o];u+=S,S==="["?x++:S==="]"?x--:S===`
797
+ `&&(c++,l=0),o++,l++}continue}if(y==="$"&&o+1<i&&s[o+1]==="{"&&!p){u+=y,o++,l++,u+=s[o],o++,l++;let x=1,S=!1,E=!1,A=c,I=l,$=c,N=l;for(;x>0&&o<i;){let R=s[o];if(R==="\\"&&o+1<i&&s[o+1]===`
798
+ `){o+=2,c++,l=1;continue}if(R==="\\"&&o+1<i&&!S){u+=R,o++,l++,u+=s[o],o++,l++;continue}u+=R,S?R==="'"&&(S=!1):E?R==='"'&&(E=!1):R==="'"?(S=!0,A=c,I=l):R==='"'?(E=!0,$=c,N=l):R==="{"?x++:R==="}"&&x--,R===`
799
+ `&&(c++,l=0),o++,l++}if(S)throw new Tn("unexpected EOF while looking for matching `''",A,I);if(E)throw new Tn("unexpected EOF while looking for matching `\"'",$,N);continue}if(y==="$"&&o+1<i&&!p){let x=s[o+1];if(x==="#"||x==="?"||x==="$"||x==="!"||x==="@"||x==="*"||x==="-"||x>="0"&&x<="9"){u+=y+x,o+=2,l+=2;continue}}if(y==="`"&&!p){for(u+=y,o++,l++;o<i&&s[o]!=="`";){let x=s[o];u+=x,x==="\\"&&o+1<i&&(u+=s[o+1],o++,l++),x===`
800
+ `&&(c++,l=0),o++,l++}o<i&&(u+=s[o],o++,l++);continue}u+=y,o++,y===`
801
+ `?(c++,l=1):l++}if(this.pos=o,this.column=l,this.line=c,g&&m&&(u=s[t]+u,f=!1,d=!1),p||h){let y=p?"'":'"';throw new Tn(`unexpected EOF while looking for matching \`${y}'`,n,r)}if(!m&&u.length>=2){if(u[0]==="'"&&u[u.length-1]==="'"){let y=u.slice(1,-1);!y.includes("'")&&!y.includes('"')&&(u=y,f=!0,d=!0)}else if(u[0]==='"'&&u[u.length-1]==='"'){let y=u.slice(1,-1),x=!1;for(let S=0;S<y.length;S++){if(y[S]==='"'){x=!0;break}y[S]==="\\"&&S+1<y.length&&S++}x||(u=y,f=!0,d=!1)}}if(u==="")return{type:v.WORD,value:"",start:t,end:o,line:n,column:r,quoted:f,singleQuoted:d};let w=Gf.get(u);if(!f&&w!==void 0)return{type:w,value:u,start:t,end:o,line:n,column:r};if(!m){let y=X6(u);if(y>0&&Q6(u.slice(0,y)))return{type:v.ASSIGNMENT_WORD,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:d}}return/^[0-9]+$/.test(u)?{type:v.NUMBER,value:u,start:t,end:o,line:n,column:r}:Ek(u)?{type:v.NAME,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:d}:{type:v.WORD,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:d}}readHeredocContent(){for(;this.pendingHeredocs.length>0;){let t=this.pendingHeredocs.shift();if(!t)break;let n=this.pos,r=this.line,s=this.column,i="",o=!1;for(;this.pos<this.input.length;){let a="",l="",c="";for(;;){for(a="";this.pos<this.input.length&&this.input[this.pos]!==`
802
+ `;)a+=this.input[this.pos],this.pos++,this.column++;let f=0;for(let d=a.length-1;a[d]==="\\";d-=1)f+=1;if(c+=a,t.quoted||f%2===0||this.pos+1>=this.input.length)break;c=c.slice(0,-1),l+=`${a}
803
+ `,this.pos++,this.line++,this.column=1}if((t.stripTabs?c.replace(/^\t+/,""):c)===t.delimiter){o=!0,this.pos<this.input.length&&this.input[this.pos]===`
804
+ `&&(this.pos++,this.line++,this.column=1);break}if(i+=l,i+=a,this.pos<this.input.length&&this.input[this.pos]===`
805
+ `?(i+=`
806
+ `,this.pos++,this.line++,this.column=1):a.length>0&&(i+=`
807
+ `),i.length>this.maxHeredocSize)throw new Tn(`Heredoc size limit exceeded (${this.maxHeredocSize} bytes)`,r,s)}this.tokens.push({type:v.HEREDOC_CONTENT,value:i,start:n,end:this.pos,line:r,column:s,heredocTerminated:o})}}readHeredocDelimiterToken(t,n,r,s){let i=this.input,{delim:o,endPos:a,quoted:l,unclosedQuote:c,unclosedSubstitution:u}=Cl(i,t);if(c)throw new Tn(`unexpected EOF while looking for matching \`${c}'`,n,r);if(u)throw new Tn("unexpected EOF while looking for matching `)'",n,r);if(a===t)throw new Tn("Expected here-document delimiter",n,r);let f=n,d=r;for(let p=t;p<a;p++)i[p]===`
808
+ `?(f+=1,d=1):d+=1;return this.pos=a,this.line=f,this.column=d,this.pendingHeredocs.push({delimiter:o,stripTabs:s,quoted:l}),{type:v.WORD,value:i.slice(t,a),start:t,end:a,line:n,column:r,quoted:l,heredocDelimiter:o}}isWordCharFollowing(t){if(t>=this.input.length)return!1;let n=this.input[t];return!(n===" "||n===" "||n===`
809
+ `||n===";"||n==="&"||n==="|"||n==="("||n===")"||n==="<"||n===">")}readWordWithBraceExpansion(t,n,r){let s=this.input,i=s.length,o=t,a=r;for(;o<i;){let c=s[o];if(c===" "||c===" "||c===`
810
+ `||c===";"||c==="&"||c==="|"||c==="("||c===")"||c==="<"||c===">")break;if(c==="{"){if(this.scanBraceExpansion(o)!==null){let f=1;for(o++,a++;o<i&&f>0;)s[o]==="{"?f++:s[o]==="}"&&f--,o++,a++;continue}o++,a++;continue}if(c==="}"){o++,a++;continue}if(c==="$"&&o+1<i&&s[o+1]==="("){o++,a++,o++,a++;let u=1;for(;u>0&&o<i;)s[o]==="("?u++:s[o]===")"&&u--,o++,a++;continue}if(c==="$"&&o+1<i&&s[o+1]==="{"){o++,a++,o++,a++;let u=1;for(;u>0&&o<i;)s[o]==="{"?u++:s[o]==="}"&&u--,o++,a++;continue}if(c==="`"){for(o++,a++;o<i&&s[o]!=="`";)s[o]==="\\"&&o+1<i?(o+=2,a+=2):(o++,a++);o<i&&(o++,a++);continue}o++,a++}let l=s.slice(t,o);return this.pos=o,this.column=a,{type:v.WORD,value:l,start:t,end:o,line:n,column:r,quoted:!1,singleQuoted:!1}}scanBraceExpansion(t){let n=this.input,r=n.length,s=t+1,i=1,o=!1,a=!1;for(;s<r&&i>0;){let l=n[s];if(l==="{")i++,s++;else if(l==="}")i--,s++;else if(l===","&&i===1)o=!0,s++;else if(l==="."&&s+1<r&&n[s+1]===".")a=!0,s+=2;else{if(l===" "||l===" "||l===`
811
+ `||l===";"||l==="&"||l==="|")return null;s++}}return i===0&&(o||a)?n.slice(t,s):null}scanLiteralBraceWord(t){let n=this.input,r=n.length,s=t+1,i=1;for(;s<r&&i>0;){let o=n[s];if(o==="{")i++,s++;else if(o==="}"){if(i--,i===0)return n.slice(t,s+1);s++}else{if(o===" "||o===" "||o===`
812
+ `||o===";"||o==="&"||o==="|")return null;s++}}return null}scanExtglobPattern(t){let n=this.input,r=n.length,s=t+1,i=1;for(;s<r&&i>0;){let o=n[s];if(o==="\\"&&s+1<r){s+=2;continue}if("@*+?!".includes(o)&&s+1<r&&n[s+1]==="("){s++,i++,s++;continue}if(o==="(")i++,s++;else if(o===")")i--,s++;else{if(o===`
813
+ `)return null;s++}}return i===0?{content:n.slice(t,s),end:s}:null}scanFdVariable(t){let n=this.input,r=n.length,s=t+1,i=s;for(;s<r;){let u=n[s];if(s===i){if(!(u>="a"&&u<="z"||u>="A"&&u<="Z"||u==="_"))return null}else if(!(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||u==="_"))break;s++}if(s===i)return null;let o=n.slice(i,s);if(s>=r||n[s]!=="}"||(s++,s>=r))return null;let a=n[s],l=s+1<r?n[s+1]:"";return a===">"||a==="<"||a==="&"&&(l===">"||l==="<")?{varname:o,end:s}:null}dollarDparenIsSubshell(t){let n=this.input,r=n.length,s=t+1,i=2,o=!1,a=!1,l=!1;for(;s<r&&i>0;){let c=n[s];if(o){c==="'"&&(o=!1),c===`
814
+ `&&(l=!0),s++;continue}if(a){if(c==="\\"){s+=2;continue}c==='"'&&(a=!1),c===`
815
+ `&&(l=!0),s++;continue}if(c==="'"){o=!0,s++;continue}if(c==='"'){a=!0,s++;continue}if(c==="\\"){s+=2;continue}if(c===`
816
+ `&&(l=!0),c==="("){i++,s++;continue}if(c===")"){if(i--,i===1){let u=s+1;if(u<r&&n[u]===")")return!1;let f=u,d=!1;for(;f<r&&(n[f]===" "||n[f]===" "||n[f]===`
817
+ `);)d=!0,f++;if(d&&f<r&&n[f]===")"||l)return!0}if(i===0)return!1;s++;continue}s++}return!1}dparenClosesWithSpacedParens(t){let n=this.input,r=n.length,s=t,i=2,o=!1,a=!1;for(;s<r&&i>0;){let l=n[s];if(o){l==="'"&&(o=!1),s++;continue}if(a){if(l==="\\"){s+=2;continue}l==='"'&&(a=!1),s++;continue}if(l==="'"){o=!0,s++;continue}if(l==='"'){a=!0,s++;continue}if(l==="\\"){s+=2;continue}if(l==="("){i++,s++;continue}if(l===")"){if(i--,i===1){let c=s+1;if(c<r&&n[c]===")")return!1;let u=c,f=!1;for(;u<r&&(n[u]===" "||n[u]===" "||n[u]===`
818
+ `);)f=!0,u++;if(f&&u<r&&n[u]===")")return!0}if(i===0)return!1;s++;continue}if(i===1&&(l==="|"&&s+1<r&&n[s+1]==="|"||l==="&"&&s+1<r&&n[s+1]==="&"||l==="|"&&s+1<r&&n[s+1]!=="|"))return!0;s++}return!1}};var Zf=1e6,Lo=1e5,Sk=1e6,J6=200,qt;(function(e){e[e.Default=0]="Default",e[e.Assignment=1]="Assignment",e[e.NoBraceExpansion=2]="NoBraceExpansion",e[e.Regex=4]="Regex"})(qt||(qt={}));var e7=new Set([v.LESS,v.GREAT,v.DLESS,v.DGREAT,v.LESSAND,v.GREATAND,v.LESSGREAT,v.DLESSDASH,v.CLOBBER,v.TLESS,v.AND_GREAT,v.AND_DGREAT]),t7=new Set([v.LESS,v.GREAT,v.DLESS,v.DGREAT,v.LESSAND,v.GREATAND,v.LESSGREAT,v.DLESSDASH,v.CLOBBER,v.TLESS]),n7=new Set([v.LESS,v.GREAT,v.DLESS,v.DGREAT,v.LESSAND,v.GREATAND,v.LESSGREAT,v.DLESSDASH,v.CLOBBER,v.TLESS,v.AND_GREAT,v.AND_DGREAT]),Wt=class extends Error{line;column;token;constructor(t,n,r,s=void 0){super(`Parse error at ${n}:${r}: ${t}`),this.line=n,this.column=r,this.token=s,this.name="ParseException"}},kl=class{iterations=0;tokens=0;depth=0;reset(){this.iterations=0,this.tokens=0,this.depth=0}chargeIteration(t,n){if(this.iterations++,this.iterations>Sk)throw new Wt("Maximum parse iterations exceeded (possible infinite loop)",t,n)}chargeTokens(t,n=1,r=1){if(this.tokens+=t,this.tokens>Lo)throw new Wt(`Too many tokens: cumulative count exceeds limit of ${Lo}`,n,r)}enter(t,n){if(this.depth++,this.depth>J6)throw this.depth--,new Wt(`Maximum parser nesting depth exceeded (${J6})`,t,n);let r=!0;return()=>{r&&(r=!1,this.depth--)}}};vn();St();Z();function yt(e,t){for(;t<e.length;){if(e[t]==="\\"&&e[t+1]===`
819
+ `){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}var Nl=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="];function Fo(e){if(e.includes("#")){let n=e.split("#");if(n.length!==2)return Number.NaN;let[r,s]=n;if(!/^\d+$/.test(r)||s.length===0)return Number.NaN;let i=Number.parseInt(r,10);if(i<2||i>64)return Number.NaN;let o=0;for(let a of s){let l;if(/[0-9]/.test(a))l=a.charCodeAt(0)-48;else if(/[a-z]/.test(a))l=a.charCodeAt(0)-97+10;else if(/[A-Z]/.test(a))l=a.charCodeAt(0)-65+(i<=36?10:36);else if(a==="@")l=62;else if(a==="_")l=63;else return Number.NaN;if(l>=i)return Number.NaN;if(o=o*i+l,o>Number.MAX_SAFE_INTEGER)return Number.MAX_SAFE_INTEGER}return o}if(e.startsWith("0x")||e.startsWith("0X")){let n=Number.parseInt(e.slice(2),16);return n>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n}if(e.startsWith("0")&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return Number.NaN;let n=Number.parseInt(e,8);return n>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n}let t=Number.parseInt(e,10);return t>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t}function r7(e,t,n,r){if(n.slice(r,r+3)!=="$((")return null;let s=r+3,i=1,o=s;for(;s<n.length-1&&i>0;)n[s]==="("&&n[s+1]==="("?(i++,s+=2):n[s]===")"&&n[s+1]===")"?(i--,i>0&&(s+=2)):s++;let a=n.slice(o,s),{expr:l}=e(t,a,0);return s+=2,{expr:{type:"ArithNested",expression:l},pos:s}}function s7(e,t){if(e.slice(t,t+2)!=="$'")return null;let n=t+2,r="";for(;n<e.length&&e[n]!=="'";)if(e[n]==="\\"&&n+1<e.length){let i=e[n+1];switch(i){case"n":r+=`
820
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case"'":r+="'";break;default:r+=i}n+=2}else r+=e[n],n++;e[n]==="'"&&n++;let s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}function i7(e,t){if(e.slice(t,t+2)!=='$"')return null;let n=t+2,r="";for(;n<e.length&&e[n]!=='"';)e[n]==="\\"&&n+1<e.length?(r+=e[n+1],n+=2):(r+=e[n],n++);e[n]==='"'&&n++;let s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}function Ak(e){let t="",n=0;for(;n<e.length;)if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);n<e.length&&n++}else t+=e[n],n++;return t}function _e(e,t){let n=Ak(t),{expr:r,pos:s}=Fi(e,n,0),i=yt(n,s);if(i<n.length){let o=t.slice(i).trim();if(o)return{type:"ArithmeticExpression",originalText:t,expression:{type:"ArithSyntaxError",errorToken:o,message:`${o}: syntax error: invalid arithmetic operator (error token is "${o}")`}}}return{type:"ArithmeticExpression",expression:r,originalText:t}}function Sn(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function An(e,t){return yt(e,t)>=e.length}function Fi(e,t,n){return Ck(e,t,n)}function Hs(e,t,n){return e.withDepth(()=>Fi(e,t,n))}function Ck(e,t,n){let{expr:r,pos:s}=Mo(e,t,n);for(s=yt(t,s);t[s]===",";){if(s++,An(t,s))return Sn(",",s);let{expr:o,pos:a}=Mo(e,t,s);r={type:"ArithBinary",operator:",",left:r,right:o},s=yt(t,a)}return{expr:r,pos:s}}function Mo(e,t,n){let{expr:r,pos:s}=vk(e,t,n);if(s=yt(t,s),t[s]==="?"){s++;let{expr:i,pos:o}=Hs(e,t,s);if(s=yt(t,o),t[s]===":"){s++;let{expr:a,pos:l}=Hs(e,t,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:a},pos:l}}}return{expr:r,pos:s}}function vk(e,t,n){let{expr:r,pos:s}=o7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="||";){if(s+=2,An(t,s))return Sn("||",s);let{expr:o,pos:a}=o7(e,t,s);r={type:"ArithBinary",operator:"||",left:r,right:o},s=a}return{expr:r,pos:s}}function o7(e,t,n){let{expr:r,pos:s}=a7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="&&";){if(s+=2,An(t,s))return Sn("&&",s);let{expr:o,pos:a}=a7(e,t,s);r={type:"ArithBinary",operator:"&&",left:r,right:o},s=a}return{expr:r,pos:s}}function a7(e,t,n){let{expr:r,pos:s}=l7(e,t,n);for(;s=yt(t,s),t[s]==="|"&&t[s+1]!=="|";){if(s++,An(t,s))return Sn("|",s);let{expr:o,pos:a}=l7(e,t,s);r={type:"ArithBinary",operator:"|",left:r,right:o},s=a}return{expr:r,pos:s}}function l7(e,t,n){let{expr:r,pos:s}=c7(e,t,n);for(;s=yt(t,s),t[s]==="^";){if(s++,An(t,s))return Sn("^",s);let{expr:o,pos:a}=c7(e,t,s);r={type:"ArithBinary",operator:"^",left:r,right:o},s=a}return{expr:r,pos:s}}function c7(e,t,n){let{expr:r,pos:s}=u7(e,t,n);for(;s=yt(t,s),t[s]==="&"&&t[s+1]!=="&";){if(s++,An(t,s))return Sn("&",s);let{expr:o,pos:a}=u7(e,t,s);r={type:"ArithBinary",operator:"&",left:r,right:o},s=a}return{expr:r,pos:s}}function u7(e,t,n){let{expr:r,pos:s}=f7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="=="||t.slice(s,s+2)==="!=";){let i=t.slice(s,s+2);if(s+=2,An(t,s))return Sn(i,s);let{expr:o,pos:a}=f7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function f7(e,t,n){let{expr:r,pos:s}=Kf(e,t,n);for(;;)if(s=yt(t,s),t.slice(s,s+2)==="<="||t.slice(s,s+2)===">="){let i=t.slice(s,s+2);if(s+=2,An(t,s))return Sn(i,s);let{expr:o,pos:a}=Kf(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else if(t[s]==="<"||t[s]===">"){let i=t[s];if(s++,An(t,s))return Sn(i,s);let{expr:o,pos:a}=Kf(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Kf(e,t,n){let{expr:r,pos:s}=d7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="<<"||t.slice(s,s+2)===">>";){let i=t.slice(s,s+2);if(s+=2,An(t,s))return Sn(i,s);let{expr:o,pos:a}=d7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function d7(e,t,n){let{expr:r,pos:s}=p7(e,t,n);for(;s=yt(t,s),(t[s]==="+"||t[s]==="-")&&t[s+1]!==t[s];){let i=t[s];if(s++,An(t,s))return Sn(i,s);let{expr:o,pos:a}=p7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function p7(e,t,n){let{expr:r,pos:s}=Il(e,t,n);for(;;)if(s=yt(t,s),t[s]==="*"&&t[s+1]!=="*"){if(s++,An(t,s))return Sn("*",s);let{expr:o,pos:a}=Il(e,t,s);r={type:"ArithBinary",operator:"*",left:r,right:o},s=a}else if(t[s]==="/"||t[s]==="%"){let i=t[s];if(s++,An(t,s))return Sn(i,s);let{expr:o,pos:a}=Il(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Il(e,t,n){let{expr:r,pos:s}=Qf(e,t,n),i=yt(t,s);if(t.slice(i,i+2)==="**"){if(i+=2,An(t,i))return Sn("**",i);let{expr:a,pos:l}=e.withDepth(()=>Il(e,t,i));return{expr:{type:"ArithBinary",operator:"**",left:r,right:a},pos:l}}return{expr:r,pos:s}}function Qf(e,t,n){let r=yt(t,n);if(t.slice(r,r+2)==="++"||t.slice(r,r+2)==="--"){let s=t.slice(r,r+2);r+=2;let{expr:i,pos:o}=e.withDepth(()=>Qf(e,t,r));return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}if(t[r]==="+"||t[r]==="-"||t[r]==="!"||t[r]==="~"){let s=t[r];r++;let{expr:i,pos:o}=e.withDepth(()=>Qf(e,t,r));return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}return Nk(e,t,r)}function kk(e,t){let n=e[t];return n==="$"||n==="`"}function Nk(e,t,n){let{expr:r,pos:s}=h7(e,t,n,!1),i=[r];for(;kk(t,s);){let{expr:a,pos:l}=h7(e,t,s,!0);i.push(a),s=l}i.length>1&&(r={type:"ArithConcat",parts:i});let o;if(t[s]==="["&&r.type==="ArithConcat"){s++;let{expr:a,pos:l}=Hs(e,t,s);o=a,s=l,t[s]==="]"&&s++}if(o&&r.type==="ArithConcat"&&(r={type:"ArithDynamicElement",nameExpr:r,subscript:o},o=void 0),s=yt(t,s),r.type==="ArithConcat"||r.type==="ArithVariable"||r.type==="ArithDynamicElement"){for(let a of Nl)if(t.slice(s,s+a.length)===a&&t.slice(s,s+a.length+1)!=="=="){s+=a.length;let{expr:l,pos:c}=e.withDepth(()=>Mo(e,t,s));return r.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r.nameExpr,subscript:r.subscript,value:l},pos:c}:r.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r,value:l},pos:c}:{expr:{type:"ArithAssignment",operator:a,variable:r.name,value:l},pos:c}}}if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let a=t.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:a,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function h7(e,t,n,r=!1){let s=yt(t,n),i=r7(Hs,e,t,s);if(i)return i;let o=s7(t,s);if(o)return o;let a=i7(t,s);if(a)return a;if(t.slice(s,s+2)==="$("&&t[s+2]!=="("){s+=2;let c=1,u=s;for(;s<t.length&&c>0;)t[s]==="("?c++:t[s]===")"&&c--,c>0&&s++;let f=t.slice(u,s);return s++,{expr:{type:"ArithCommandSubst",command:f},pos:s}}if(t[s]==="`"){s++;let c=s;for(;s<t.length&&t[s]!=="`";)s++;let u=t.slice(c,s);return t[s]==="`"&&s++,{expr:{type:"ArithCommandSubst",command:u},pos:s}}if(t[s]==="("){s++;let{expr:c,pos:u}=Hs(e,t,s);return s=yt(t,u),t[s]===")"&&s++,{expr:{type:"ArithGroup",expression:c},pos:s}}if(t[s]==="'"){s++;let c="";for(;s<t.length&&t[s]!=="'";)c+=t[s],s++;t[s]==="'"&&s++;let u=Number.parseInt(c,10);return{expr:{type:"ArithSingleQuote",content:c,value:Number.isNaN(u)?0:u},pos:s}}if(t[s]==='"'){s++;let c="";for(;s<t.length&&t[s]!=='"';)t[s]==="\\"&&s+1<t.length?(c+=t[s+1],s+=2):(c+=t[s],s++);t[s]==='"'&&s++;let u=c.trim();if(!u)return{expr:{type:"ArithNumber",value:0},pos:s};let{expr:f}=Hs(e,u,0);return{expr:f,pos:s}}if(/[0-9]/.test(t[s])){let c="",u=!1,f=!1;for(;s<t.length;){let p=t[s];if(u)if(/[0-9a-zA-Z@_]/.test(p))c+=p,s++;else break;else if(p==="#")u=!0,c+=p,s++;else if(c==="0"&&(p==="x"||p==="X")&&s+1<t.length&&/[0-9a-fA-F]/.test(t[s+1]))f=!0,c+=p,s++;else if(f&&/[0-9a-fA-F]/.test(p))c+=p,s++;else if(!f&&/[0-9]/.test(p))c+=p,s++;else break}if(s<t.length&&/[a-zA-Z_]/.test(t[s])){let p=c;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)p+=t[s],s++;return{expr:{type:"ArithSyntaxError",errorToken:p,message:`${p}: value too great for base (error token is "${p}")`},pos:s}}if(t[s]==="."&&/[0-9]/.test(t[s+1]))throw new Ve(`${c}.${t[s+1]}...: syntax error: invalid arithmetic operator`);if(t[s]==="["){let p=t.slice(s).trim();return{expr:{type:"ArithNumberSubscript",number:c,errorToken:p},pos:t.length}}return{expr:{type:"ArithNumber",value:Fo(c)},pos:s}}if(t[s]==="$"&&t[s+1]==="{"){let c=s+2,u=1,f=c;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;let d=t.slice(c,f),p=f+1;if(t[p]==="#"){let h=p+1;for(;h<t.length&&/[0-9a-zA-Z@_]/.test(t[h]);)h++;let m=t.slice(p+1,h);return{expr:{type:"ArithDynamicBase",baseExpr:d,value:m},pos:h}}if(/[0-9]/.test(t[p])||t[p]==="x"||t[p]==="X"){let h=p;if(t[p]==="x"||t[p]==="X")for(h++;h<t.length&&/[0-9a-fA-F]/.test(t[h]);)h++;else for(;h<t.length&&/[0-9]/.test(t[h]);)h++;let m=t.slice(p,h);return{expr:{type:"ArithDynamicNumber",prefix:d,suffix:m},pos:h}}return s=p,{expr:{type:"ArithBracedExpansion",content:d},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[0-9]/.test(t[s+1])){s++;let c="";for(;s<t.length&&/[0-9]/.test(t[s]);)c+=t[s],s++;return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:!0},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[*@#?\-!$]/.test(t[s+1])){let c=t[s+1];return s+=2,{expr:{type:"ArithSpecialVar",name:c},pos:s}}let l=!1;if(t[s]==="$"&&s+1<t.length&&/[a-zA-Z_]/.test(t[s+1])&&(l=!0,s++),s<t.length&&/[a-zA-Z_]/.test(t[s])){let c="";for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)c+=t[s],s++;if(t[s]==="["&&!r){s++;let u;if(t[s]==="'"||t[s]==='"'){let d=t[s];for(s++,u="";s<t.length&&t[s]!==d;)u+=t[s],s++;t[s]===d&&s++,s=yt(t,s),t[s]==="]"&&s++}let f;if(u===void 0){let{expr:d,pos:p}=Hs(e,t,s);f=d,s=p,t[s]==="]"&&s++}if(s=yt(t,s),t[s]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:s};if(!r){for(let d of Nl)if(t.slice(s,s+d.length)===d&&t.slice(s,s+d.length+1)!=="=="){s+=d.length;let{expr:p,pos:h}=e.withDepth(()=>Mo(e,t,s));return{expr:{type:"ArithAssignment",operator:d,variable:c,subscript:f,stringKey:u,value:p},pos:h}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:s}}if(s=yt(t,s),!r){for(let u of Nl)if(t.slice(s,s+u.length)===u&&t.slice(s,s+u.length+1)!=="=="){s+=u.length;let{expr:f,pos:d}=e.withDepth(()=>Mo(e,t,s));return{expr:{type:"ArithAssignment",operator:u,variable:c,value:f},pos:d}}}return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:l},pos:s}}if(t[s]==="#"){let c=s+1;for(;c<t.length&&t[c]!==`
821
+ `;)c++;let u=t.slice(s,c).trim()||"#";return{expr:{type:"ArithSyntaxError",errorToken:u,message:`${u}: syntax error: invalid arithmetic operator (error token is "${u}")`},pos:t.length}}return{expr:{type:"ArithNumber",value:0},pos:s}}var Ol=e=>{let t,n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="\\"&&t==='"'&&r+1<e.length){n+=s+e[r+1],r+=1;continue}if(s==="'"||s==='"'){t===s?t=void 0:t||(t=s),n+=s;continue}if(s==="\\"&&!t&&r+1<e.length){let i=e[r+1];n+=i==="$"||i==="`"?`\\${i}`:i,r+=1;continue}n+=s}return n};function Ik(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)===192){if(n+1<e.length&&(e[n+1]&192)===128&&r>=194){let s=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(s),n+=2;continue}t+=String.fromCharCode(r),n++;continue}if((r&240)===224){if(n+2<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128){if(r===224&&e[n+1]<160){t+=String.fromCharCode(r),n++;continue}let s=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(s>=55296&&s<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(s),n+=3;continue}t+=String.fromCharCode(r),n++;continue}if((r&248)===240&&r<=244){if(n+3<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128&&(e[n+3]&192)===128){if(r===240&&e[n+1]<144){t+=String.fromCharCode(r),n++;continue}let s=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(s>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(s),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function y7(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function Xf(e,t,n,r,s){let i=1,o=n+1;for(;o<t.length&&i>0;)t[o]===r?i++:t[o]===s&&i--,i>0&&o++;return i===0?o:-1}function Vs(e,t,n){let r=n,s=1;for(;r<t.length&&s>0;){let i=t[r];if(i==="\\"&&r+1<t.length){r+=2;continue}if(i==="'"){let o=t.indexOf("'",r+1);if(o!==-1){r=o+1;continue}}if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)t[r]==="\\"&&r+1<t.length?r+=2:r++;r<t.length&&r++;continue}i==="{"?s++:i==="}"&&s--,s>0&&r++}return r}function w7(e,t,n){let r=n,s=!1;for(;r<t.length;){let i=t[r];if(i==="/"&&s||i==="}")break;if(i==="'"){let o=t.indexOf("'",r+1);if(o!==-1){r=o+1,s=!0;continue}}if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)t[r]==="\\"&&r+1<t.length?r+=2:r++;r<t.length&&r++,s=!0;continue}i==="\\"?(r+=2,s=!0):(r++,s=!0)}return r}function b7(e,t,n){let r=n,s="";for(;r<t.length;){let i=t[r];if(i==="*"||i==="?")s+=i,r++;else if(i==="["){let o=Ok(t,r);o===-1?(s+=i,r++):(s+=t.slice(r,o+1),r=o+1)}else break}return{pattern:s,endIndex:r}}function Ok(e,t){let n=t+1;for(n<e.length&&e[n]==="^"&&n++,n<e.length&&e[n]==="]"&&n++;n<e.length;){let r=e[n];if(r==="\\"&&n+1<e.length){let s=e[n+1];if(s==='"'||s==="'")return-1;n+=2;continue}if(r==="]")return n;if(r==='"'||r==="$"||r==="`")return-1;if(r==="'"){let s=e.indexOf("'",n+1);if(s!==-1){n=s+1;continue}}if(r==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){n=s+2;continue}}if(r==="["&&n+1<e.length&&(e[n+1]==="."||e[n+1]==="=")){let i=`${e[n+1]}]`,o=e.indexOf(i,n+2);if(o!==-1){n=o+2;continue}}n++}return-1}function x7(e,t,n){let r="",s=n;for(;s<t.length&&t[s]!=="'";){let i=t[s];if(i==="\\"&&s+1<t.length)switch(t[s+1]){case"n":r+=`
822
+ `,s+=2;break;case"t":r+=" ",s+=2;break;case"r":r+="\r",s+=2;break;case"\\":r+="\\",s+=2;break;case"'":r+="'",s+=2;break;case'"':r+='"',s+=2;break;case"a":r+="\x07",s+=2;break;case"b":r+="\b",s+=2;break;case"e":case"E":r+="\x1B",s+=2;break;case"f":r+="\f",s+=2;break;case"v":r+="\v",s+=2;break;case"x":{let a=[],l=s;for(;l+1<t.length&&t[l]==="\\"&&t[l+1]==="x";){let c=t.slice(l+2,l+4),u=parseInt(c,16);if(!Number.isNaN(u)&&c.length>0)a.push(u),l+=2+c.length;else break}a.length>0?(r+=Ik(a),s=l):(r+="\\x",s+=2);break}case"u":{let a=t.slice(s+2,s+6),l=parseInt(a,16);Number.isNaN(l)?(r+="\\u",s+=2):(r+=String.fromCharCode(l),s+=6);break}case"c":{if(s+2<t.length){let l=t[s+2].charCodeAt(0)&31;r+=String.fromCharCode(l),s+=3}else r+="\\c",s+=2;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let a="",l=s+1;for(;l<t.length&&l<s+4&&/[0-7]/.test(t[l]);)a+=t[l],l++;let c=parseInt(a,8);r+=String.fromCharCode(c),s=l;break}default:r+=i,s++}else r+=i,s++}return s<t.length&&t[s]==="'"&&s++,{part:ee.literal(r),endIndex:s}}function Yf(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:_e(e,n)}function g7(e){let t=[],n="",r=0;for(let s=0;s<e.length;s++){let i=e[s];i==="{"?(r++,n+=i):i==="}"?(r--,n+=i):i===","&&r===0?(t.push(n),n=""):n+=i}return t.push(n),t}function E7(e,t,n,r){let s=Xf(e,t,n,"{","}");if(s===-1)return null;let i=t.slice(n+1,s),o=i.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(o)return{part:{type:"BraceExpansion",items:[{type:"Range",start:Number.parseInt(o[1],10),end:Number.parseInt(o[2],10),step:o[3]?Number.parseInt(o[3],10):void 0,startStr:o[1],endStr:o[2]}]},endIndex:s+1};let a=i.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return a?{part:{type:"BraceExpansion",items:[{type:"Range",start:a[1],end:a[2],step:a[3]?Number.parseInt(a[3],10):void 0}]},endIndex:s+1}:i.includes(",")&&r?{part:{type:"BraceExpansion",items:g7(i).map(u=>e.withDepth(()=>({type:"Word",word:ee.word(r(e,u,!1,!1,!1))})))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:g7(i).map(u=>({type:"Word",word:ee.word([ee.literal(u)])}))},endIndex:s+1}:null}function Jf(e,t){let n="";for(let r of t.parts)switch(r.type){case"Literal":n+=r.value;break;case"SingleQuoted":n+=`'${r.value}'`;break;case"Escaped":n+=r.value;break;case"DoubleQuoted":n+='"';for(let s of r.parts)s.type==="Literal"||s.type==="Escaped"?n+=s.value:s.type==="ParameterExpansion"&&(n+=`\${${s.parameter}}`);n+='"';break;case"ParameterExpansion":n+=`\${${r.parameter}}`;break;case"Glob":n+=r.pattern;break;case"TildeExpansion":n+="~",r.user&&(n+=r.user);break;case"BraceExpansion":{n+="{";let s=[];for(let i of r.items)if(i.type==="Range"){let o=i.startStr??String(i.start),a=i.endStr??String(i.end);i.step!==void 0?s.push(`${o}..${a}..${i.step}`):s.push(`${o}..${a}`)}else s.push(Jf(e,i.word));s.length===1&&r.items[0].type==="Range"?n+=s[0]:n+=s.join(","),n+="}";break}default:n+=r.type}return n}function S7(e,t){return{[v.LESS]:"<",[v.GREAT]:">",[v.DGREAT]:">>",[v.LESSAND]:"<&",[v.GREATAND]:">&",[v.LESSGREAT]:"<>",[v.CLOBBER]:">|",[v.TLESS]:"<<<",[v.AND_GREAT]:"&>",[v.AND_DGREAT]:"&>>",[v.DLESS]:"<",[v.DLESSDASH]:"<"}[t]||">"}function _o(e){let t=e.current(),n=t.type;if(n===v.NUMBER){let r=e.peek(1);return t.end!==r.start||e.isProcessSubstitutionStart(1)?!1:t7.has(r.type)}if(n===v.FD_VARIABLE){let r=e.peek(1);return t.end!==r.start||e.isProcessSubstitutionStart(1)?!1:n7.has(r.type)}return!e.isProcessSubstitutionStart()&&e7.has(n)}function Tl(e){let t=null,n;e.check(v.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(v.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),s=S7(e,r.type);if(r.type===v.DLESS||r.type===v.DLESSDASH)return Tk(e,t,n,r.type===v.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return ee.redirection(s,i,t,n)}function Tk(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.heredocDelimiter??s.value,o=s.quoted||!1,a=ee.redirection(r?"<<-":"<<",ee.hereDoc(i,ee.word([]),r,o),t,n);return e.addPendingHeredoc(a,i,r,o),a}function td(e){let t=e.getSourceLine(),n=[],r=null,s=[],i=[];for(;e.check(v.ASSIGNMENT_WORD)||_o(e);)e.checkIterationLimit(),e.check(v.ASSIGNMENT_WORD)?n.push(Rk(e)):i.push(Tl(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(v.DBRACK_START)||e.check(v.DPAREN_START))){let a=e.advance();r=ee.word([ee.literal(a.value)])}for(;(!e.isStatementEnd()||e.check(v.RBRACE))&&!e.check(v.PIPE,v.PIPE_AMP);)if(e.checkIterationLimit(),_o(e))i.push(Tl(e));else if(e.check(v.ASSIGNMENT_WORD)){let a=e.advance(),l=a.value,c=l.endsWith("="),u=l.endsWith("=(");if((c||u)&&(u||e.check(v.LPAREN))){let f=u?l.slice(0,-2):l.slice(0,-1);u||e.expect(v.LPAREN);let d=ed(e);e.expect(v.RPAREN);let p=d.map(m=>Jf(e,m)),h=`${f}=(${p.join(" ")})`;s.push(e.parseWordFromString(h,!1,!1,!0))}else{let f=e.parseWordFromString(l,a.quoted,a.singleQuoted,!0);s.push(e.parseAdjacentWordParts(f.parts,a.end,qt.Assignment))}}else if(e.isWord())s.push(e.parseWord());else if(e.check(v.RBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(v.LBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(v.DBRACK_END)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(v.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=ee.simpleCommand(r,s,n,i);return o.line=t,o}function Rk(e){let t=e.expect(v.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let s=r[0],i,o=s.length;if(n[o]==="["){let f=0,d=o+1;for(;o<n.length;o++)if(n[o]==="[")f++;else if(n[o]==="]"&&(f--,f===0))break;f!==0&&e.error(`Invalid assignment: ${n}`),i=Ol(n.slice(d,o)),o++}let a=n[o]==="+";a&&o++,n[o]!=="="&&e.error(`Invalid assignment: ${n}`),o++;let l=n.slice(o);if(l==="("){let f=ed(e);e.expect(v.RPAREN);let d=i!==void 0?`${s}[${i}]`:s;return ee.assignment(d,null,a,f)}if(l===""&&e.check(v.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let d=ed(e);e.expect(v.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return ee.assignment(p,null,a,d)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null;t.end===e.current().start&&e.isProcessSubstitutionStart()&&(c=e.parseAdjacentWordParts(c?.parts??[],t.end,qt.Assignment));let u=i!==void 0?`${s}[${i}]`:s;return ee.assignment(u,c,a,null)}var $k=new Set([v.AMP,v.PIPE,v.PIPE_AMP,v.SEMICOLON,v.AND_AND,v.OR_OR,v.DSEMI,v.SEMI_AND,v.SEMI_SEMI_AND]);function ed(e){let t=[];for(e.skipNewlines();!e.check(v.RPAREN,v.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):$k.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}function nd(e,t){e.expect(v.IF);let n=[],r=e.parseCompoundList();e.expect(v.THEN);let s=e.parseCompoundList();if(s.length===0){let a=e.check(v.FI)?"fi":e.check(v.ELSE)?"else":e.check(v.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${a}'`)}for(n.push({condition:r,body:s});e.check(v.ELIF);){e.advance();let a=e.parseCompoundList();e.expect(v.THEN);let l=e.parseCompoundList();if(l.length===0){let c=e.check(v.FI)?"fi":e.check(v.ELSE)?"else":e.check(v.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${c}'`)}n.push({condition:a,body:l})}let i=null;e.check(v.ELSE)&&(e.advance(),i=e.parseCompoundList(),i.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(v.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return ee.ifNode(n,i,o)}function rd(e,t){let n=e.expect(v.FOR);if(e.check(v.DPAREN_START))return Dk(e,t,e.getSourceLine(n));e.isWord()||e.error("Expected variable name in for loop");let s=e.advance().value,i=null;if(e.skipNewlines(),e.check(v.IN))for(e.advance(),i=[];!e.check(v.SEMICOLON,v.NEWLINE,v.DO,v.EOF)&&e.isWord();)i.push(e.parseWord());e.check(v.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(v.DO);let o=e.parseCompoundList();e.expect(v.DONE);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return ee.forNode(s,i,o,a)}function Dk(e,t,n){e.expect(v.DPAREN_START);let r=null,s=null,i=null,o=["","",""],a=0,l=0;for(;!e.check(v.DPAREN_END,v.EOF);){let f=e.advance();if(f.type===v.SEMICOLON&&l===0){if(a++,a>2)break}else f.value==="("&&l++,f.value===")"&&l--,o[a]+=f.value}e.expect(v.DPAREN_END),o[0].trim()&&(r=_e(e,o[0].trim())),o[1].trim()&&(s=_e(e,o[1].trim())),o[2].trim()&&(i=_e(e,o[2].trim())),e.skipNewlines(),e.check(v.SEMICOLON)&&e.advance(),e.skipNewlines();let c;e.check(v.LBRACE)?(e.advance(),c=e.parseCompoundList(),e.expect(v.RBRACE)):(e.expect(v.DO),c=e.parseCompoundList(),e.expect(v.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:r,condition:s,update:i,body:c,redirections:u,line:n}}function sd(e,t){e.expect(v.WHILE);let n=e.parseCompoundList();e.expect(v.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(v.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return ee.whileNode(n,r,s)}function id(e,t){e.expect(v.UNTIL);let n=e.parseCompoundList();e.expect(v.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(v.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return ee.untilNode(n,r,s)}function od(e,t){e.expect(v.CASE),e.isWord()||e.error("Expected word after 'case'");let n=e.parseWord();e.skipNewlines(),e.expect(v.IN),e.skipNewlines();let r=[];for(;!e.check(v.ESAC,v.EOF);){e.checkIterationLimit();let i=e.getPos(),o=Lk(e);if(o&&r.push(o),e.skipNewlines(),e.getPos()===i&&!o)break}e.expect(v.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return ee.caseNode(n,r,s)}function Lk(e){e.check(v.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(v.PIPE));)e.advance();if(t.length===0)return null;e.expect(v.RPAREN),e.skipNewlines();let n=[];for(;!e.check(v.DSEMI,v.SEMI_AND,v.SEMI_SEMI_AND,v.ESAC,v.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===v.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(v.LPAREN)&&e.peek(1).type===v.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let s=e.getPos(),i=e.parseStatement();if(i&&n.push(i),e.skipSeparators(!1),e.getPos()===s&&!i)break}let r=";;";return e.check(v.DSEMI)?(e.advance(),r=";;"):e.check(v.SEMI_AND)?(e.advance(),r=";&"):e.check(v.SEMI_SEMI_AND)&&(e.advance(),r=";;&"),ee.caseItem(t,n,r)}function ad(e,t){e.expect(v.LPAREN);let n=e.parseCompoundList();e.expect(v.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return ee.subshell(n,r)}function ld(e,t){e.expect(v.LBRACE);let n=e.parseCompoundList();e.expect(v.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return ee.group(n,r)}var Mk=["-a","-b","-c","-d","-e","-f","-g","-h","-k","-p","-r","-s","-t","-u","-w","-x","-G","-L","-N","-O","-S","-z","-n","-o","-v","-R"],_k=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"];function C7(e){return e.isWord()||e.check(v.LBRACE)||e.check(v.RBRACE)||e.check(v.ASSIGNMENT_WORD)}function v7(e){if(e.check(v.BANG)&&e.peek(1).type===v.LPAREN){e.advance(),e.advance();let t=1,n="!(";for(;t>0&&!e.check(v.EOF);)if(e.check(v.LPAREN))t++,n+="(",e.advance();else if(e.check(v.RPAREN))t--,t>0&&(n+=")"),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(v.PIPE))n+="|",e.advance();else break;return n+=")",e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function ud(e){return e.skipNewlines(),Bk(e)}function Bk(e){let t=k7(e);for(e.skipNewlines();e.check(v.OR_OR);){e.advance(),e.skipNewlines();let n=k7(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function k7(e){let t=cd(e);for(e.skipNewlines();e.check(v.AND_AND);){e.advance(),e.skipNewlines();let n=cd(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function cd(e){return e.skipNewlines(),e.check(v.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:e.withDepth(()=>cd(e))}):Uk(e)}function Uk(e){if(e.check(v.LPAREN)){e.advance();let t=e.withDepth(()=>ud(e));return e.expect(v.RPAREN),{type:"CondGroup",expression:t}}if(C7(e)){let t=e.current(),n=t.value;if(Mk.includes(n)&&!t.quoted){if(e.advance(),e.check(v.DBRACK_END)&&e.error(`Expected operand after ${n}`),C7(e)){let i=e.parseWordNoBraceExpansion();return{type:"CondUnary",operator:n,operand:i}}let s=e.current();e.error(`unexpected argument \`${s.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&_k.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=zk(e):s==="=="||s==="!="?i=v7(e):i=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:s,left:r,right:i}}if(e.check(v.LESS)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:r,right:s}}if(e.check(v.GREAT)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:">",left:r,right:s}}if(e.isWord()&&e.current().value==="="){e.advance();let s=v7(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function zk(e){let t=[],n=0,r=-1,s=e.getInput(),i=()=>e.check(v.DBRACK_END)||e.check(v.AND_AND)||e.check(v.OR_OR)||e.check(v.NEWLINE)||e.check(v.EOF);for(;!i();){let o=e.current(),a=r>=0&&o.start>r;if(n===0&&a)break;if(n>0&&a){let l=s.slice(r,o.start);t.push({type:"Literal",value:l})}if(e.isWord()||e.check(v.ASSIGNMENT_WORD)){let l=e.parseWordForRegex();t.push(...l.parts),r=e.peek(-1).end}else if(e.check(v.LPAREN)){let l=e.advance();t.push({type:"Literal",value:"("}),n++,r=l.end}else if(e.check(v.DPAREN_START)){let l=e.advance();t.push({type:"Literal",value:"(("}),n+=2,r=l.end}else if(e.check(v.DPAREN_END))if(n>=2){let l=e.advance();t.push({type:"Literal",value:"))"}),n-=2,r=l.end}else{if(n===1)break;break}else if(e.check(v.RPAREN))if(n>0){let l=e.advance();t.push({type:"Literal",value:")"}),n--,r=l.end}else break;else if(e.check(v.PIPE)){let l=e.advance();t.push({type:"Literal",value:"|"}),r=l.end}else if(e.check(v.SEMICOLON))if(n>0){let l=e.advance();t.push({type:"Literal",value:";"}),r=l.end}else break;else if(n>0&&e.check(v.LESS)){let l=e.advance();t.push({type:"Literal",value:"<"}),r=l.end}else if(n>0&&e.check(v.GREAT)){let l=e.advance();t.push({type:"Literal",value:">"}),r=l.end}else if(n>0&&e.check(v.DGREAT)){let l=e.advance();t.push({type:"Literal",value:">>"}),r=l.end}else if(n>0&&e.check(v.DLESS)){let l=e.advance();t.push({type:"Literal",value:"<<"}),r=l.end}else if(n>0&&e.check(v.LESSAND)){let l=e.advance();t.push({type:"Literal",value:"<&"}),r=l.end}else if(n>0&&e.check(v.GREATAND)){let l=e.advance();t.push({type:"Literal",value:">&"}),r=l.end}else if(n>0&&e.check(v.LESSGREAT)){let l=e.advance();t.push({type:"Literal",value:"<>"}),r=l.end}else if(n>0&&e.check(v.CLOBBER)){let l=e.advance();t.push({type:"Literal",value:">|"}),r=l.end}else if(n>0&&e.check(v.TLESS)){let l=e.advance();t.push({type:"Literal",value:"<<<"}),r=l.end}else if(n>0&&e.check(v.AMP)){let l=e.advance();t.push({type:"Literal",value:"&"}),r=l.end}else if(n>0&&e.check(v.LBRACE)){let l=e.advance();t.push({type:"Literal",value:"{"}),r=l.end}else if(n>0&&e.check(v.RBRACE)){let l=e.advance();t.push({type:"Literal",value:"}"}),r=l.end}else break}return t.length===0&&e.error("Expected regex pattern after =~"),{type:"Word",parts:t}}function jk(e){let t="";for(let n=0;n<e.length;n++){let r=e[n],s=e[n+1];if(r!=="\\"||s===void 0){t+=r;continue}"\\[]^-".includes(s)&&(t+="\\"),t+=s,n++}return t}function Bo(e){return e.length>0?e:[ee.literal("")]}function Hk(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if("@*+?!".includes(s)&&r+1<e.length&&e[r+1]==="("){r++,n++,r++;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function Vk(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:ee.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:ee.parameterExpansion(i),endIndex:r}}function Gk(e,t,n,r=!1){let s=n+2,i=!1;t[s]==="!"&&(i=!0,s++);let o=!1;t[s]==="#"&&!/[}:#%/^,]/.test(t[s+1]||"}")&&(o=!0,s++);let a="",l=t[s];if(/[@*#?$!-]/.test(l)&&!/[a-zA-Z0-9_]/.test(t[s+1]||""))a=l,s++;else for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)a+=t[s],s++;if(t[s]==="["){let u=Xf(e,t,s,"[","]");if(a+=`[${Ol(t.slice(s+1,u))}]`,s=u+1,t[s]==="["){let f=1,d=s;for(;d<t.length&&f>0;)t[d]==="{"?f++:t[d]==="}"&&f--,f>0&&d++;let p=t.slice(n+2,d);return{part:ee.parameterExpansion("",{type:"BadSubstitution",text:p}),endIndex:d+1}}}if(a===""&&!i&&!o&&t[s]!=="}"){let u=1,f=s;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;if(u>0)throw new Wt("unexpected EOF while looking for matching '}'",0,0);let d=t.slice(n+2,f);return{part:ee.parameterExpansion("",{type:"BadSubstitution",text:d}),endIndex:f+1}}let c=null;if(i){let u=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=fd(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):(c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="")}else c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="";else if(t[s]==="*"||t[s]==="@"&&!/[QPaAEKkuUL]/.test(t[s+1]||"")){let f=t[s];s++,c={type:"VarNamePrefix",prefix:a,star:f==="*"},a=""}else if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=fd(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):c={type:"Indirection"}}else c={type:"Indirection"}}else if(o)if(t[s]===":")for(c={type:"LengthSliceError"};s<t.length&&t[s]!=="}";)s++;else t[s]!=="}"&&/[-+=?]/.test(t[s])?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):t[s]==="/"?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):c={type:"Length"};if(!c&&s<t.length&&t[s]!=="}"){let u=fd(e,t,s,a,r);c=u.operation,s=u.endIndex}if(s<t.length&&t[s]!=="}"){let u=t[s];if(!/[:\-+=?#%/^,@[]/.test(u)){let f=s;for(;f<t.length&&t[f]!=="}";)f++;let d=t.slice(n,f+1);e.error(`\${${d.slice(2,-1)}}: bad substitution`)}}for(;s<t.length&&t[s]!=="}";)s++;if(s>=t.length)throw new Wt("unexpected EOF while looking for matching '}'",0,0);return{part:ee.parameterExpansion(a,c),endIndex:s+1}}function fd(e,t,n,r,s=!1){let i=n,o=t[i],a=t[i+1]||"";if(o===":"){let l=a;if("-=?+".includes(l)){i+=2;let b=Vs(e,t,i),w=t.slice(i,b),y=e.withDepth(()=>rs(e,w,!1,!1,!0,!1,s,!1,!1,!0)),x=ee.word(Bo(y));if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:b};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:b};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:b};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:b}}i++;let c=Vs(e,t,i),u=t.slice(i,c),f=-1,d=0,p=0;for(let g=0;g<u.length;g++){let b=u[g];if(b==="("||b==="[")d++;else if(b===")"||b==="]")d--;else if(b==="?"&&d===0)p++;else if(b===":"&&d===0)if(p>0)p--;else{f=g;break}}let h=f>=0?u.slice(0,f):u,m=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:Yf(e,h),length:m!==null?Yf(e,m):null},endIndex:c}}if("-=?+".includes(o)){i++;let l=Vs(e,t,i),c=t.slice(i,l),u=e.withDepth(()=>rs(e,c,!1,!1,!0,!1,s,!1,!1,!0)),f=ee.word(Bo(u));if(o==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:l};if(o==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:l};if(o==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:l};if(o==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:l}}if(o==="#"||o==="%"){let l=a===o,c=o==="#"?"prefix":"suffix";i+=l?2:1;let u=Vs(e,t,i),f=t.slice(i,u),d=e.withDepth(()=>rs(e,f,!1,!1,!1));return{operation:{type:"PatternRemoval",pattern:ee.word(Bo(d)),side:c,greedy:l},endIndex:u}}if(o==="/"){let l=a==="/";i+=l?2:1;let c=null;t[i]==="#"?(c="start",i++):t[i]==="%"&&(c="end",i++);let u;c!==null&&(t[i]==="/"||t[i]==="}")?u=i:u=w7(e,t,i);let f=t.slice(i,u),d=e.withDepth(()=>rs(e,f,!1,!1,!1)),p=ee.word(Bo(d)),h=null,m=u;if(t[u]==="/"){let g=u+1,b=Vs(e,t,g),w=t.slice(g,b),y=e.withDepth(()=>rs(e,w,!1,!1,!1));h=ee.word(Bo(y)),m=b}return{operation:{type:"PatternReplacement",pattern:p,replacement:h,all:l,anchor:c},endIndex:m}}if(o==="^"||o===","){let l=a===o,c=o==="^"?"upper":"lower";i+=l?2:1;let u=Vs(e,t,i),f=t.slice(i,u),d=f?ee.word([ee.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:d},endIndex:u}}return o==="@"&&/[QPaAEKkuUL]/.test(a)?{operation:{type:"Transform",operator:a},endIndex:i+2}:{operation:null,endIndex:i}}function dd(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:ee.literal("$"),endIndex:s};let i=t[s];if(i==="("&&t[s+1]==="(")return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(i==="["){let o=1,a=s+1;for(;a<t.length&&o>0;)t[a]==="["?o++:t[a]==="]"&&o--,o>0&&a++;if(o===0){let l=t.slice(s+1,a),c=_e(e,l);return{part:ee.arithmeticExpansion(c),endIndex:a+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?Gk(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?Vk(e,t,n):{part:ee.literal("$"),endIndex:s}}function N7(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(ee.literal(s)),s="")};for(;r<t.length;){let o=t[r];if(o==="\\"&&r+1<t.length){let a=t[r+1];if(a==="$"||a==="`"||a==='"'||a==="\\"){s+=a,r+=2;continue}s+=o,r++;continue}if(o==="$"){i();let{part:a,endIndex:l}=dd(e,t,r,!0);a&&n.push(a),r=l;continue}if(o==="`"){i();let{part:a,endIndex:l}=e.parseBacktickSubstitution(t,r,!0);n.push(a),r=l;continue}s+=o,r++}return i(),n}function qk(e,t,n){let r=[],s=n,i="",o=()=>{i&&(r.push(ee.literal(i)),i="")};for(;s<t.length&&t[s]!=='"';){let a=t[s];if(a==="\\"&&s+1<t.length){let l=t[s+1];if('"\\$`\n'.includes(l)){i+=l,s+=2;continue}i+=a,s++;continue}if(a==="$"){o();let{part:l,endIndex:c}=dd(e,t,s,!0);l&&r.push(l),s=c;continue}if(a==="`"){o();let{part:l,endIndex:c}=e.parseBacktickSubstitution(t,s,!0);r.push(l),s=c;continue}i+=a,s++}return o(),{part:ee.doubleQuoted(r),endIndex:s}}function rs(e,t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!0){if(r)return[ee.singleQuoted(t)];if(n){let m=N7(e,t);return[ee.doubleQuoted(m)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let m=t.slice(1,-1),g=!1;for(let b=0;b<m.length;b++){if(m[b]==='"'){g=!0;break}m[b]==="\\"&&b+1<m.length&&b++}if(!g){let b=N7(e,m);return[ee.doubleQuoted(b)]}}let f=[],d=0,p="",h=()=>{p&&(f.push(ee.literal(p)),p="")};for(;d<t.length;){let m=t[d];if(m==="\\"&&d+1<t.length){let g=t[d+1];if(l){h(),f.push(ee.escaped(g)),d+=2;continue}if(!i&&!o){g!==`
823
+ `&&(h(),f.push(ee.escaped(g))),d+=2;continue}let b=i?g==="$"||g==="`"||g===`
824
+ `:g==="$"||g==="`"||g==='"'||g==="'"||g===`
825
+ `||c&&g==="}",w=o?"*?[]\\".includes(g):"*?[]\\(){}.^+".includes(g);b?g!==`
826
+ `&&(p+=g):w?(h(),f.push(ee.escaped(g))):p+=`\\${g}`,d+=2;continue}if(m==="'"&&!o&&!i){h();let g=t.indexOf("'",d+1);if(g===-1){p+=t.slice(d);break}f.push(ee.singleQuoted(t.slice(d+1,g))),d=g+1;continue}if(m==='"'&&!i){h();let{part:g,endIndex:b}=qk(e,t,d+1);f.push(g),d=b+1;continue}if(m==="$"&&t[d+1]==="'"){h();let{part:g,endIndex:b}=x7(e,t,d+2);f.push(g),d=b;continue}if(m==="$"){h();let{part:g,endIndex:b}=dd(e,t,d);g&&f.push(g),d=b;continue}if(m==="`"){h();let{part:g,endIndex:b}=e.parseBacktickSubstitution(t,d);f.push(g),d=b;continue}if((m==="<"||m===">")&&t[d+1]==="("&&!i&&!o){h();let{part:g,endIndex:b}=e.parseProcessSubstitutionFromString(t,d);f.push(g),d=b;continue}if(m==="~"){let g=d>0?t[d-1]:"";if(d===0&&u||g==="="||s&&g===":"){let w=y7(e,t,d),y=t[w];if(y===void 0||y==="/"||y===":"){h();let x=t.slice(d+1,w)||null;f.push({type:"TildeExpansion",user:x}),d=w;continue}}}if("@*+?!".includes(m)&&d+1<t.length&&t[d+1]==="("){let g=Hk(t,d+1);if(g!==-1){h();let b=t.slice(d,g+1);f.push({type:"Glob",pattern:b}),d=g+1;continue}}if(m==="*"||m==="?"||m==="["){h();let{pattern:g,endIndex:b}=b7(e,t,d);f.push({type:"Glob",pattern:l?jk(g):g}),d=b;continue}if(m==="{"&&!s&&!a&&!i){let g=E7(e,t,d,rs);if(g){h(),f.push(g.part),d=g.endIndex;continue}}p+=m,d++}return h(),f}var be=class e{tokens=[];pos=0;pendingHeredocs=[];parseBudget;ownsParseBudget;_input="";processLineState;constructor(t){this.parseBudget=t??new kl,this.ownsParseBudget=t===void 0}getInput(){return this._input}checkIterationLimit(){let t=this.current();this.parseBudget.chargeIteration(t?.line??1,t?.column??1)}enterDepth(){let t=this.current();return this.parseBudget.enter(t?.line??1,t?.column??1)}withDepth(t){let n=this.enterDepth();try{return t()}finally{n()}}parse(t,n){this.ownsParseBudget&&this.parseBudget.reset();let r=this.ownsParseBudget?void 0:this.enterDepth();try{if(t.length>Zf)throw new Wt(`Input too large: ${t.length} bytes exceeds limit of ${Zf}`,1,1);this._input=t,this.processLineState=void 0;let s=new vl(t,n);if(this.tokens=s.tokenize(),this.tokens.length>Lo)throw new Wt(`Too many tokens: ${this.tokens.length} exceeds limit of ${Lo}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseBudget.chargeTokens(this.tokens.length),this.parseScript()}finally{r?.()}}parseTokens(t){this.ownsParseBudget&&this.parseBudget.reset();let n=this.ownsParseBudget?void 0:this.enterDepth();try{return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.processLineState=void 0,this.parseBudget.chargeTokens(t.length),this.parseScript()}finally{n?.()}}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){let t=this.current();return this.pos<this.tokens.length-1&&this.pos++,t}getPos(){return this.pos}getSourceLine(t=this.current()){let n=this.processLineState;return n?(n.currentPhysicalLine===void 0?n.currentPhysicalLine=t.line:t.line>n.currentPhysicalLine&&(n.currentPhysicalLine=t.line,n.currentLogicalLine+=1),n.currentLogicalLine):t.line}check(t,n,r,s,...i){let o=this.tokens[this.pos]?.type;return o===t||n!==void 0&&o===n||r!==void 0&&o===r||s!==void 0&&o===s?!0:i.length>0?i.includes(o):!1}expect(t,n){if(this.check(t))return this.advance();let r=this.current();throw new Wt(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new Wt(t,n.line,n.column,n)}skipNewlines(){for(;this.check(v.NEWLINE,v.COMMENT);)this.check(v.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(v.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(v.SEMICOLON,v.COMMENT)){this.advance();continue}if(t&&this.check(v.DSEMI,v.SEMI_AND,v.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(t,n,r,s){this.pendingHeredocs.push({redirect:t,delimiter:n,stripTabs:r,quoted:s})}processHeredocs(){for(let t of this.pendingHeredocs)if(this.check(v.HEREDOC_CONTENT)){let n=this.advance(),r;t.quoted?r=ee.word([ee.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=ee.hereDoc(t.delimiter,r,t.stripTabs,t.quoted,n.heredocTerminated??!1)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(v.EOF,v.NEWLINE,v.SEMICOLON,v.AMP,v.AND_AND,v.OR_OR,v.RPAREN,v.RBRACE,v.DSEMI,v.SEMI_AND,v.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return this.isWord()||t===v.ASSIGNMENT_WORD||t===v.FD_VARIABLE||t===v.LPAREN||t===v.LBRACE||t===v.DPAREN_START||t===v.DBRACK_START||_o(this)}parseScript(){let t=[],r=0;for(this.skipNewlines();!this.check(v.EOF);){r++,r>1e4&&this.error("Parser stuck: too many iterations (>10000)");let s=this.checkUnexpectedToken();if(s){t.push(s),this.skipSeparators(!1);continue}let i=this.pos,o=this.parseStatement();o&&t.push(o),this.check(v.HEREDOC_CONTENT)&&this.processHeredocs(),this.skipSeparators(!1),this.check(v.DSEMI,v.SEMI_AND,v.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===i&&!this.check(v.EOF)&&this.error(`syntax error near unexpected token \`${this.current().value}'`)}return ee.script(t)}checkUnexpectedToken(){let t=this.current().type,n=this.current().value;if(this.currentTokenJoinsProcessSubstitution())return null;if((t===v.DO||t===v.DONE||t===v.THEN||t===v.ELSE||t===v.ELIF||t===v.FI||t===v.ESAC)&&this.error(`syntax error near unexpected token \`${n}'`),t===v.RBRACE||t===v.RPAREN){let r=`syntax error near unexpected token \`${n}'`;return this.advance(),ee.statement([ee.pipeline([ee.simpleCommand(null,[],[],[])])],[],!1,{message:r,token:n})}return(t===v.DSEMI||t===v.SEMI_AND||t===v.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${n}'`),t===v.SEMICOLON&&this.error(`syntax error near unexpected token \`${n}'`),(t===v.AMP||t===v.AND_AND||t===v.OR_OR||t===v.PIPE||t===v.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${n}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let t=this.current().start,n=[],r=[],s=!1,i=this.parsePipeline();for(n.push(i);this.check(v.AND_AND,v.OR_OR);){let l=this.advance();r.push(l.type===v.AND_AND?"&&":"||"),this.skipNewlines();let c=this.parsePipeline();n.push(c)}this.check(v.AMP)&&(this.advance(),s=!0);let o=this.pos>0?this.tokens[this.pos-1].end:t,a=this._input.slice(t,o);return ee.statement(n,r,s,void 0,a)}parseTimePrefix(){if(!this.check(v.TIME)||this.currentTokenJoinsProcessSubstitution())return;this.advance();let t=!1;return this.check(v.WORD,v.NAME)&&this.current().value==="-p"&&(this.advance(),t=!0),t}parsePipeline(){let t=!1,n=!1,r=0;for(;this.check(v.BANG)&&!this.currentTokenJoinsProcessSubstitution();)this.advance(),r++;if(r===0){let l=this.parseTimePrefix();if(l!==void 0)for(t=!0,n=l;this.check(v.BANG)&&!this.currentTokenJoinsProcessSubstitution();)this.advance(),r++}let s=r%2===1,i=[],o=[],a=this.parseCommand();for(i.push(a);this.check(v.PIPE,v.PIPE_AMP);){let l=this.advance();this.skipNewlines(),o.push(l.type===v.PIPE_AMP);let c=this.parseCommand();i.push(c)}return ee.pipeline(i,s,t,n,o.length>0?o:void 0)}parseCommand(){if(this.currentTokenJoinsProcessSubstitution())return td(this);let t=this.current();switch(t.type){case v.IF:return nd(this);case v.FOR:return rd(this);case v.WHILE:return sd(this);case v.UNTIL:return id(this);case v.CASE:return od(this);case v.LPAREN:return ad(this);case v.LBRACE:return ld(this);case v.DPAREN_START:return this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand();case v.DBRACK_START:return this.parseConditionalCommand();case v.FUNCTION:return this.parseFunctionDef();case v.TIME:break;case v.BANG:this.error(`syntax error near unexpected token \`${t.value}'`);break;default:qf(t.type)&&this.error(`syntax error near unexpected token \`${t.value}'`)}return this.check(v.NAME,v.WORD)&&this.peek(1).type===v.LPAREN&&this.peek(2).type===v.RPAREN?this.parseFunctionDef():td(this)}dparenClosesWithSpacedParens(){let t=1,n=1;for(;n<this.tokens.length-this.pos;){let r=this.peek(n);if(r.type===v.EOF)return!1;if(r.type===v.DPAREN_START||r.type===v.LPAREN)t++;else if(r.type===v.DPAREN_END){if(t-=2,t<=0)return!1}else if(r.type===v.RPAREN&&(t--,t===0&&this.peek(n+1).type===v.RPAREN))return!0;n++}return!1}parseNestedSubshellsFromDparen(){this.advance();let t=this.parseCompoundList();this.expect(v.RPAREN),this.expect(v.RPAREN);let n=this.parseOptionalRedirections(),r=ee.subshell(t,[]);return ee.subshell([ee.statement([ee.pipeline([r],!1,!1,!1)])],n)}isWord(){return this.isWordToken(qt.Default)||this.isProcessSubstitutionStart()||this.currentTokenJoinsProcessSubstitution()}isWordToken(t){let n=this.current().type;return n===v.WORD||n===v.NAME||n===v.NUMBER||qf(n)||n===v.BANG||n===v.ASSIGNMENT_WORD&&(t&qt.Regex)!==0}isProcessSubstitutionStart(t=0){let n=this.peek(t),r=this.peek(t+1);return(n.type===v.LESS||n.type===v.GREAT)&&r.type===v.LPAREN&&n.end===r.start}currentTokenJoinsProcessSubstitution(){return this.current().type===v.COMMENT||!this.isAdjacentWordToken(qt.Default)?!1:this.current().end===this.peek(1).start&&this.isProcessSubstitutionStart(1)}isAdjacentWordToken(t){let n=this.current().type;return this.isWordToken(t)||n===v.ASSIGNMENT_WORD||n===v.COMMENT||n===v.LBRACE||n===v.RBRACE||n===v.DBRACK_START||n===v.DBRACK_END||n===v.FD_VARIABLE}parseWord(t=qt.Default){if(this.isProcessSubstitutionStart())return this.parseAdjacentWordParts([],this.current().start,t);let n=this.advance(),r=this.parseWordToken(n,t);return this.parseAdjacentWordParts(r.parts,n.end,t)}parseAdjacentWordParts(t,n,r=qt.Default){for(;n===this.current().start;){if(this.isProcessSubstitutionStart()){t.push(this.parseProcessSubstitution()),n=this.tokens[this.pos-1].end;continue}if(!this.isAdjacentWordToken(r))break;let s=this.advance();t.push(...this.parseWordToken(s,r,t.length===0).parts),n=s.end}return ee.word(t)}parseWordNoBraceExpansion(){return this.parseWord(qt.NoBraceExpansion)}parseWordForRegex(){return this.parseWord(qt.NoBraceExpansion|qt.Regex)}parseWordToken(t,n,r=!0){return t.type===v.LBRACE||t.type===v.RBRACE||t.type===v.DBRACK_START||t.type===v.DBRACK_END||t.type===v.FD_VARIABLE?ee.word([ee.literal(t.type===v.FD_VARIABLE?`{${t.value}}`:t.value)]):this.parseWordFromString(t.value,t.quoted,t.singleQuoted,(n&qt.Assignment)!==0,!1,(n&qt.NoBraceExpansion)!==0,(n&qt.Regex)!==0,r)}parseWordFromString(t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!0){let c=rs(this,t,n,r,s,i,!1,o,a,!1,l);return ee.word(c)}parseCommandSubstitution(t,n){return q6(t,n,()=>new e(this.parseBudget),r=>this.error(r))}parseProcessSubstitutionFromString(t,n){return Z6(t,n,()=>new e(this.parseBudget),r=>this.error(r))}parseProcessSubstitution(){let t=this.advance();this.expect(v.LPAREN);let n=this.processLineState,r=this.getSourceLine(t);this.processLineState={currentLogicalLine:r};let s;try{s=ee.script(this.parseCompoundList())}finally{this.processLineState=n}return this.check(v.EOF)&&this.error("unexpected EOF while looking for matching `)'"),this.expect(v.RPAREN),ee.processSubstitution(s,t.type===v.LESS?"input":"output")}parseBacktickSubstitution(t,n,r=!1){return K6(t,n,r,()=>new e(this.parseBudget),s=>this.error(s))}isDollarDparenSubshell(t,n){return V6(t,n)}parseArithmeticExpansion(t,n){let r=n+3,s=1,i=0,o=r;for(;o<t.length-1&&s>0;)t[o]==="$"&&t[o+1]==="("?t[o+2]==="("?(s++,o+=3):(i++,o+=2):t[o]==="("&&t[o+1]==="("?(s++,o+=2):t[o]===")"&&t[o+1]===")"?i>0?(i--,o++):(s--,s>0&&(o+=2)):t[o]==="("?(i++,o++):(t[o]===")"&&i>0&&i--,o++);let a=t.slice(r,o),l=this.parseArithmeticExpression(a);return{part:ee.arithmeticExpansion(l),endIndex:o+2}}parseArithmeticCommand(){let t=this.expect(v.DPAREN_START),n="",r=1,s=0,i=!1,o=!1;for(;r>0&&!this.check(v.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(v.RPAREN)){r--,o=!0,this.advance();continue}if(this.check(v.DPAREN_END)){r--,o=!0;continue}n+=")";continue}if(this.check(v.DPAREN_START))r++,n+="((",this.advance();else if(this.check(v.DPAREN_END))s>=2?(s-=2,n+="))",this.advance()):s===1?(s--,n+=")",i=!0,this.advance()):(r--,o=!0,r>0&&(n+="))"),this.advance());else if(this.check(v.LPAREN))s++,n+="(",this.advance();else if(this.check(v.RPAREN))s>0&&s--,n+=")",this.advance();else{let c=this.current().value,u=n.length>0?n[n.length-1]:"";n.length>0&&!n.endsWith(" ")&&!(c==="="&&/[|&^+\-*/%<>]$/.test(n))&&!(c==="<"&&u==="<")&&!(c===">"&&u===">")&&(n+=" "),n+=c,this.advance()}}o||this.expect(v.DPAREN_END);let a=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return ee.arithmeticCommand(a,l,this.getSourceLine(t))}parseConditionalCommand(){let t=this.expect(v.DBRACK_START),n=ud(this);this.expect(v.DBRACK_END);let r=this.parseOptionalRedirections();return ee.conditionalCommand(n,r,this.getSourceLine(t))}parseFunctionDef(){let t;if(this.check(v.FUNCTION)){if(this.advance(),this.check(v.NAME)||this.check(v.WORD))t=this.advance().value;else{let s=this.current();throw new Wt("Expected function name",s.line,s.column,s)}this.check(v.LPAREN)&&(this.advance(),this.expect(v.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(v.LPAREN),this.expect(v.RPAREN);this.skipNewlines();let n=this.parseCompoundCommandBody({forFunctionBody:!0}),r=this.parseOptionalRedirections();return ee.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(v.LBRACE))return ld(this,{skipRedirections:n});if(this.check(v.LPAREN))return ad(this,{skipRedirections:n});if(this.check(v.IF))return nd(this,{skipRedirections:n});if(this.check(v.FOR))return rd(this,{skipRedirections:n});if(this.check(v.WHILE))return sd(this,{skipRedirections:n});if(this.check(v.UNTIL))return id(this,{skipRedirections:n});if(this.check(v.CASE))return od(this,{skipRedirections:n});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth();try{let n=[];for(this.skipNewlines();(this.currentTokenJoinsProcessSubstitution()||!this.check(v.EOF,v.FI,v.ELSE,v.ELIF,v.THEN,v.DO,v.DONE,v.ESAC,v.RPAREN,v.RBRACE,v.DSEMI,v.SEMI_AND,v.SEMI_SEMI_AND))&&this.isCommandStart();){this.checkIterationLimit();let r=this.pos,s=this.parseStatement();if(s&&n.push(s),this.skipSeparators(),this.pos===r&&!s)break}return n}finally{t()}}parseOptionalRedirections(){let t=[];for(;_o(this);){this.checkIterationLimit();let n=this.pos;if(t.push(Tl(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return _e(this,t)}};function Kn(e,t){return new be().parse(e,t)}function I7(e){return qs(e)}function qs(e){return e.statements.map(O7).join(`
827
+ `)}function O7(e){let t=[];for(let r=0;r<e.pipelines.length;r++)t.push(Kk(e.pipelines[r])),r<e.operators.length&&t.push(e.operators[r]);let n=t.join(" ");return e.background&&(n+=" &"),n}function Kk(e){let t=[];e.timed&&t.push(e.timePosix?"time -p":"time"),e.negated&&t.push("!");let n=[];for(let s=0;s<e.commands.length;s++)if(n.push(T7(e.commands[s])),s<e.commands.length-1){let i=e.pipeStderr?.[s];n.push(i?"|&":"|")}return(t.length>0?`${t.join(" ")} `:"")+n.join(" ")}function T7(e){switch(e.type){case"SimpleCommand":return Qk(e);case"If":return iN(e);case"For":return oN(e);case"CStyleFor":return aN(e);case"While":return lN(e);case"Until":return cN(e);case"Case":return uN(e);case"Subshell":return dN(e);case"Group":return pN(e);case"ArithmeticCommand":return hN(e);case"ConditionalCommand":return mN(e);case"FunctionDef":return gN(e);default:{let t=e;throw new Error(`Unsupported command type: ${t.type}`)}}}function Qk(e){let t=[];for(let n of e.assignments)t.push(Xk(n));e.name&&t.push(_t(e.name));for(let n of e.args)t.push(_t(n));for(let n of e.redirections)t.push(P7(n));return t.join(" ")}function Xk(e){let t=e.append?"+=":"=";if(e.array){let n=e.array.map(_t).join(" ");return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${_t(e.value)}`:`${e.name}${t}`}function _t(e){return e.parts.map(t=>Rl(t,!1)).join("")}function ss(e){return e.parts.map(t=>Rl(t,!0)).join("")}function Rl(e,t){switch(e.type){case"Literal":return t?Jk(e.value):Yk(e.value);case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(n=>Rl(n,!0)).join("")}"`;case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return R7(e);case"CommandSubstitution":return e.legacy?`\`${qs(e.body)}\``:`$(${qs(e.body)})`;case"ArithmeticExpansion":return`$((${ct(e.expression.expression)}))`;case"ProcessSubstitution":return e.direction==="input"?`<(${qs(e.body)})`:`>(${qs(e.body)})`;case"BraceExpansion":return rN(e);case"TildeExpansion":return e.user!==null?`~${e.user}`:"~";case"Glob":return e.pattern;default:{let n=e;throw new Error(`Unsupported word part type: ${n.type}`)}}}function Yk(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,"\\$&")}function Jk(e){return e.replace(/[$`"\\]/g,"\\$&")}function eN(e,t){return e.parts.map(n=>tN(n,t)).join("")}function tN(e,t){switch(e.type){case"Literal":return t?e.value:e.value.replace(/[$`]/g,"\\$&");case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return R7(e);case"CommandSubstitution":return e.legacy?`\`${qs(e.body)}\``:`$(${qs(e.body)})`;case"ArithmeticExpansion":return`$((${ct(e.expression.expression)}))`;default:return Rl(e,!1)}}function R7(e){return e.operation?`\${${$7(e.parameter,e.operation)}}`:nN(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function nN(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function $7(e,t){switch(t.type){case"Length":return`#${e}`;case"LengthSliceError":return`#${e}:`;case"BadSubstitution":return t.text;case"DefaultValue":return`${e}${t.checkEmpty?":":""}-${ss(t.word)}`;case"AssignDefault":return`${e}${t.checkEmpty?":":""}=${ss(t.word)}`;case"ErrorIfUnset":return`${e}${t.checkEmpty?":":""}?${t.word?ss(t.word):""}`;case"UseAlternative":return`${e}${t.checkEmpty?":":""}+${ss(t.word)}`;case"Substring":{let n=ct(t.offset.expression);return t.length?`${e}:${n}:${ct(t.length.expression)}`:`${e}:${n}`}case"PatternRemoval":{let n=t.side==="prefix"?"#":"%",r=t.greedy?`${n}${n}`:n;return`${e}${r}${ss(t.pattern)}`}case"PatternReplacement":{let n="/";t.all?n="//":t.anchor==="start"?n="/#":t.anchor==="end"&&(n="/%");let r=t.replacement?`/${ss(t.replacement)}`:"";return`${e}${n}${ss(t.pattern)}${r}`}case"CaseModification":{let n=t.direction==="upper"?"^":",",r=t.all?`${n}${n}`:n,s=t.pattern?ss(t.pattern):"";return`${e}${r}${s}`}case"Transform":return`${e}@${t.operator}`;case"Indirection":return t.innerOp?`!${$7(e,t.innerOp)}`:`!${e}`;case"ArrayKeys":return`!${t.array}[${t.star?"*":"@"}]`;case"VarNamePrefix":return`!${t.prefix}${t.star?"*":"@"}`;default:{let n=t;throw new Error(`Unsupported parameter operation type: ${n.type}`)}}}function rN(e){return`{${e.items.map(sN).join(",")}}`}function sN(e){if(e.type==="Word")return _t(e.word);let t=e.startStr??String(e.start),n=e.endStr??String(e.end);return e.step!==void 0?`${t}..${n}..${e.step}`:`${t}..${n}`}function P7(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd!==null?String(e.fd):"";if(e.operator==="<<"||e.operator==="<<-"){let n=e.target;if(n.terminated===!1)throw new Error("Cannot serialize an unterminated here-document");let r=n.quoted?`'${n.delimiter}'`:n.delimiter,s=eN(n.content,n.quoted);return`${t}${e.operator}${r}
828
+ ${s}${n.delimiter}`}return e.operator==="<<<"?`${t}<<< ${_t(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${_t(e.target)}`:`${t}${e.operator} ${_t(e.target)}`}function cr(e){return e.length===0?"":` ${e.map(P7).join(" ")}`}function Qn(e){return e.map(O7).join(`
829
+ `)}function iN(e){let t=[];for(let n=0;n<e.clauses.length;n++){let r=e.clauses[n],s=n===0?"if":"elif";t.push(`${s} ${Qn(r.condition)}; then
830
+ ${Qn(r.body)}`)}return e.elseBody&&t.push(`else
831
+ ${Qn(e.elseBody)}`),`${t.join(`
832
+ `)}
833
+ fi${cr(e.redirections)}`}function oN(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(_t).join(" ");t=`for ${e.variable} in ${n}`}return`${t}; do
834
+ ${Qn(e.body)}
835
+ done${cr(e.redirections)}`}function aN(e){let t=e.init?ct(e.init.expression):"",n=e.condition?ct(e.condition.expression):"",r=e.update?ct(e.update.expression):"";return`for ((${t}; ${n}; ${r})); do
836
+ ${Qn(e.body)}
837
+ done${cr(e.redirections)}`}function lN(e){return`while ${Qn(e.condition)}; do
838
+ ${Qn(e.body)}
839
+ done${cr(e.redirections)}`}function cN(e){return`until ${Qn(e.condition)}; do
840
+ ${Qn(e.body)}
841
+ done${cr(e.redirections)}`}function uN(e){let t=e.items.map(fN).join(`
842
+ `);return`case ${_t(e.word)} in
843
+ ${t}
844
+ esac${cr(e.redirections)}`}function fN(e){let t=e.patterns.map(_t).join(" | "),n=Qn(e.body);return n?`${t})
845
+ ${n}
846
+ ${e.terminator}`:`${t})
847
+ ${e.terminator}`}function dN(e){return`(${Qn(e.body)})${cr(e.redirections)}`}function pN(e){return`{ ${Qn(e.body)}; }${cr(e.redirections)}`}function hN(e){return`((${ct(e.expression.expression)}))${cr(e.redirections)}`}function mN(e){return`[[ ${Gs(e.expression)} ]]${cr(e.redirections)}`}function gN(e){let t=T7(e.body);return`${e.name}() ${t}${cr(e.redirections)}`}function ct(e){switch(e.type){case"ArithNumber":return String(e.value);case"ArithVariable":return e.hasDollarPrefix?`$${e.name}`:e.name;case"ArithSpecialVar":return`$${e.name}`;case"ArithBinary":return`${ct(e.left)} ${e.operator} ${ct(e.right)}`;case"ArithUnary":return e.prefix?`${e.operator}${ct(e.operand)}`:`${ct(e.operand)}${e.operator}`;case"ArithTernary":return`${ct(e.condition)} ? ${ct(e.consequent)} : ${ct(e.alternate)}`;case"ArithAssignment":return`${e.subscript?`${e.variable}[${ct(e.subscript)}]`:e.stringKey!==void 0?`${e.variable}[${e.stringKey}]`:e.variable} ${e.operator} ${ct(e.value)}`;case"ArithDynamicAssignment":return`${e.subscript?`${ct(e.target)}[${ct(e.subscript)}]`:ct(e.target)} ${e.operator} ${ct(e.value)}`;case"ArithDynamicElement":return`${ct(e.nameExpr)}[${ct(e.subscript)}]`;case"ArithGroup":return`(${ct(e.expression)})`;case"ArithNested":return`$((${ct(e.expression)}))`;case"ArithCommandSubst":return`$(${e.command})`;case"ArithBracedExpansion":return`\${${e.content}}`;case"ArithArrayElement":return e.stringKey!==void 0?`${e.array}[${e.stringKey}]`:e.index?`${e.array}[${ct(e.index)}]`:e.array;case"ArithDynamicBase":return`\${${e.baseExpr}}#${e.value}`;case"ArithDynamicNumber":return`\${${e.prefix}}${e.suffix}`;case"ArithConcat":return e.parts.map(ct).join("");case"ArithDoubleSubscript":return`${e.array}[${ct(e.index)}]`;case"ArithNumberSubscript":return`${e.number}[${e.errorToken}]`;case"ArithSyntaxError":return e.errorToken;case"ArithSingleQuote":return`'${e.content}'`;default:{let t=e;throw new Error(`Unsupported arithmetic expression type: ${t.type}`)}}}function Gs(e){switch(e.type){case"CondBinary":return`${_t(e.left)} ${e.operator} ${_t(e.right)}`;case"CondUnary":return`${e.operator} ${_t(e.operand)}`;case"CondNot":return`! ${Gs(e.operand)}`;case"CondAnd":return`${Gs(e.left)} && ${Gs(e.right)}`;case"CondOr":return`${Gs(e.left)} || ${Gs(e.right)}`;case"CondGroup":return`( ${Gs(e.expression)} )`;case"CondWord":return _t(e.word);default:{let t=e;throw new Error(`Unsupported conditional expression type: ${t.type}`)}}}Z();var yN="BASH_ALIAS_";function $l(e,t,n,r){let s=U(t);if(s>n-r.value)throw new C(`alias expansion exceeds string length limit (${n} bytes)`,"string_length");return r.value+=s,e+t}function D7(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function L7(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function F7(e,t){return e.env.get(`${yN}${t}`)}function _7(e,t,n){return B7(e,t,n)}function B7(e,t,n,r=!0){if(!t.name||!D7(t.name))return t;let s=L7(t.name);if(!s)return t;let i=F7(e,s);if(!i||n.has(s))return t;try{n.add(s);let o=new be,a={value:0},l=$l("",i,e.limits.maxStringLength,a),c=i.endsWith(" ");if(!c)for(let p of t.args){let h=_t(p);l=$l(l,` ${h}`,e.limits.maxStringLength,a)}let u;try{u=o.parse(l)}catch(p){if(p instanceof Wt)throw p;return t}if(u.statements.length!==1||u.statements[0].pipelines.length!==1||u.statements[0].pipelines[0].commands.length!==1)return M7(e,t,i);let f=u.statements[0].pipelines[0].commands[0];if(f.type!=="SimpleCommand")return M7(e,t,i);let d={...f,assignments:[...t.assignments,...f.assignments],redirections:[...f.redirections,...t.redirections],line:t.line};if(c&&t.args.length>0){d={...d,args:[...d.args,...t.args]};let p=1;for(;r&&d.args.length>0;){let h=d.args[0];if(!D7(h))break;let m=L7(h),g=m?F7(e,m):null;if(!g)break;if(p>=e.limits.maxCallDepth)throw new C(`alias expansion depth limit exceeded (${e.limits.maxCallDepth})`,"recursion");p++;let b={type:"SimpleCommand",name:h,args:d.args.slice(1),assignments:[],redirections:[]},w=B7(e,b,n,!1);if(w===b||(d={...d,name:w.name,args:[...w.args]},!g.endsWith(" ")))break}}return d}catch(o){throw n.delete(s),o}}function M7(e,t,n){let r={value:0},s=$l("",n,e.limits.maxStringLength,r);for(let c of t.args){let u=_t(c);s=$l(s,` ${u}`,e.limits.maxStringLength,r)}let i=new be,o=i.parseWordFromString("eval",!1,!1),a=0;for(let c of s)c==="'"&&a++;if(r.value+2+a*3>e.limits.maxStringLength)throw new C(`alias expansion exceeds string length limit (${e.limits.maxStringLength} bytes)`,"string_length");let l=i.parseWordFromString(`'${s.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:o,args:[l],assignments:t.assignments,redirections:t.redirections,line:t.line}}Z();Z();pt();Yi();pt();var wN=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9a-fA-F"]]);function pd(e){return wN.get(e)??""}function U7(e){let t=[],n="",r=0;for(;r<e.length;){let s=e[r];if(s==="["){for(n+=s,r++,r<e.length&&(e[r]==="!"||e[r]==="^")&&(n+=e[r],r++),r<e.length&&e[r]==="]"&&(n+=e[r],r++);r<e.length&&e[r]!=="]";){if(e[r]==="["&&r+1<e.length&&e[r+1]===":"){let i=e.indexOf(":]",r+2);if(i!==-1){n+=e.slice(r,i+2),r=i+2;continue}}if(e[r]==="\\"&&r+1<e.length){n+=e[r]+e[r+1],r+=2;continue}n+=e[r],r++}r<e.length&&e[r]==="]"&&(n+=e[r],r++)}else s===":"?(n!==""&&t.push(n),n="",r++):s==="\\"&&r+1<e.length?(n+=s+e[r+1],r+=2):(n+=s,r++)}return n!==""&&t.push(n),t}function z7(e){let t="^";for(let n=0;n<e.length;n++){let r=e[n];if(r==="*")t+="[^/]*";else if(r==="?")t+="[^/]";else if(r==="["){let s=n+1,i="[";s<e.length&&(e[s]==="^"||e[s]==="!")&&(i+="^",s++),s<e.length&&e[s]==="]"&&(i+="\\]",s++);let o=s;for(;o<e.length;){if(e[o]==="\\"&&o+1<e.length){o+=2;continue}if(e[o]==="["&&o+1<e.length&&e[o+1]===":"){let l=e.indexOf(":]",o+2);if(l!==-1){o=l+2;continue}}if(e[o]==="]")break;o++}let a=s;for(;s<e.length&&e[s]!=="]";){if(e[s]==="["&&s+1<e.length&&e[s+1]===":"){let l=e.indexOf(":]",s+2);if(l!==-1){let c=e.slice(s+2,l),u=pd(c);i+=u,s=l+2;continue}}if(e[s]==="\\"&&s+1<e.length){i+=`\\${e[s+1]}`,s+=2;continue}if(e[s]==="-"){let l=s===a,c=s+1===o;l||c?i+="\\-":i+="-"}else i+=e[s];s++}i+="]",t+=i,n=s}else if(r==="\\"&&n+1<e.length){let s=e[n+1];/[.+^${}()|\\*?[\]]/.test(s)?t+=`\\${s}`:t+=s,n++}else/[.+^${}()|]/.test(r)?t+=`\\${r}`:t+=r}return t+="$",ie(t)}function hd(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function md(e){let t=[],n="",r=0,s=!1,i=0;for(;i<e.length;){let o=e[i];if(o==="'"&&!s){s=!0,n+="\0QUOTE_START\0",i++;continue}if(o==="'"&&s){s=!1,n+="\0QUOTE_END\0",i++;continue}if(s){n+=o,i++;continue}if(o==="\\"){n+=o,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}o==="("?(r++,n+=o):o===")"?(r--,n+=o):o==="|"&&r===0?(t.push(n),n=""):n+=o,i++}return t.push(n),t}var W7=5,is=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;consumeOperation;constructor(t,n,r,s){this.fs=t,this.cwd=n,typeof s=="boolean"?(this.globstar=s,this.maxOps=1e5):s?(this.globstar=s.globstar??!1,this.nullglob=s.nullglob??!1,this.failglob=s.failglob??!1,this.dotglob=s.dotglob??!1,this.extglob=s.extglob??!1,this.globskipdots=s.globskipdots??!0,this.maxOps=s.maxGlobOperations??1e5,this.consumeOperation=s.consumeOperation):this.maxOps=1e5;let i=r?.get("GLOBIGNORE");i!==void 0&&i!==""&&(this.hasGlobignore=!0,this.globignorePatterns=U7(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new C(`Glob operation limit exceeded (${this.maxOps})`,"glob_operations");this.consumeOperation?.()}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(t){return!this.hasGlobignore&&!this.globskipdots?t:t.filter(n=>{let r=n.split("/").pop()||n;if((this.hasGlobignore||this.globskipdots)&&(r==="."||r===".."))return!1;if(this.hasGlobignore){for(let s of this.globignorePatterns)if(this.matchGlobignorePattern(n,s))return!1}return!0})}matchGlobignorePattern(t,n){return z7(n).test(t)}isGlobPattern(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandArgs(t,n){let r=t.map((o,a)=>(n?.[a]??!1)||!this.isGlobPattern(o)?null:this.expand(o)),s=await Promise.all(r.map(o=>o||Promise.resolve(null))),i=[];for(let o=0;o<t.length;o++){let a=s[o];a===null?i.push(t[o]):a.length>0?i.push(...a):i.push(t[o])}return i}async expand(t){if(this.globstar){let r=t.split("/"),s=0;for(let i of r)if(i==="**"&&(s++,s>W7))throw new C(`Glob pattern has too many ** segments (max ${W7})`,"glob_operations")}let n;if(t.includes("**")&&this.globstar&&this.isGlobstarValid(t))n=await this.expandRecursive(t);else{let r=t.replace(/\*\*+/g,"*");n=await this.expandSimple(r)}return this.filterGlobignore(n)}isGlobstarValid(t){let n=t.split("/");for(let r of n)if(r.includes("**")&&r!=="**")return!1;return!0}hasGlobChars(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandSimple(t){let n=t.startsWith("/"),r=t.split("/").filter(c=>c!==""),s=-1;for(let c=0;c<r.length;c++)if(this.hasGlobChars(r[c])){s=c;break}if(s===-1)return[t];let i,o;if(s===0)n?(i="/",o="/"):(i=this.cwd,o="");else{let c=r.slice(0,s);n?(i=`/${c.join("/")}`,o=`/${c.join("/")}`):(i=this.fs.resolvePath(this.cwd,c.join("/")),o=c.join("/"))}let a=r.slice(s);return(await this.expandSegments(i,o,a)).sort()}async expandSegments(t,n,r){if(this.checkOpsLimit(),r.length===0)return[n];let[s,...i]=r,o=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let a=await this.fs.readdirWithFileTypes(t),l=[],c=[...a],u=this.dotglob||this.hasGlobignore;if(s.startsWith(".")||this.dotglob){let d=a.some(h=>h.name==="."),p=a.some(h=>h.name==="..");d||c.push({name:".",isFile:!1,isDirectory:!0,isSymbolicLink:!1}),p||c.push({name:"..",isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let d of c)if(!(d.name.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(d.name,s)){let p=t==="/"?`/${d.name}`:`${t}/${d.name}`,h;n===""?h=d.name:n==="/"?h=`/${d.name}`:h=`${n}/${d.name}`,i.length===0?l.push(Promise.resolve([h])):d.isDirectory&&l.push(this.expandSegments(p,h,i))}let f=await Promise.all(l);for(let d of f)o.push(...d)}else{this.checkOpsLimit();let a=await this.fs.readdir(t),l=[],c=[...a],u=this.dotglob||this.hasGlobignore;(s.startsWith(".")||this.dotglob)&&(a.includes(".")||c.push("."),a.includes("..")||c.push(".."));for(let d of c)if(!(d.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(d,s)){let p=t==="/"?`/${d}`:`${t}/${d}`,h;n===""?h=d:n==="/"?h=`/${d}`:h=`${n}/${d}`,i.length===0?l.push(Promise.resolve([h])):l.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(p)).isDirectory)return this.expandSegments(p,h,i)}catch(m){if(m instanceof C)throw m}return[]})())}let f=await Promise.all(l);for(let d of f)o.push(...d)}}catch(a){if(a instanceof C)throw a}return o}async expandRecursive(t){let n=[],r=t.indexOf("**"),s=t.slice(0,r).replace(/\/$/,"")||".",o=t.slice(r+2).replace(/^\//,"");return o.includes("**")&&this.isGlobstarValid(o)?(await this.walkDirectoryMultiGlobstar(s,o,n),[...new Set(n)].sort()):(await this.walkDirectory(s,o,n),n.sort())}async walkDirectoryMultiGlobstar(t,n,r){this.checkOpsLimit();let s=this.fs.resolvePath(this.cwd,t);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(s):null;if(i){let o=[];for(let c of i){let u=t==="."?c.name:`${t}/${c.name}`;c.isDirectory&&o.push(u)}let a=t==="."?n:`${t}/${n}`,l=await this.expandRecursive(a);r.push(...l);for(let c=0;c<o.length;c+=100){let u=o.slice(c,c+100);await Promise.all(u.map(f=>this.walkDirectoryMultiGlobstar(f,n,r)))}}else{this.checkOpsLimit();let o=await this.fs.readdir(s),a=[];for(let u of o){let f=t==="."?u:`${t}/${u}`,d=this.fs.resolvePath(this.cwd,f);try{this.checkOpsLimit(),(await this.fs.stat(d)).isDirectory&&a.push(f)}catch(p){if(p instanceof C)throw p}}let l=t==="."?n:`${t}/${n}`,c=await this.expandRecursive(l);r.push(...c);for(let u=0;u<a.length;u+=100){let f=a.slice(u,u+100);await Promise.all(f.map(d=>this.walkDirectoryMultiGlobstar(d,n,r)))}}}catch(i){if(i instanceof C)throw i}}async walkDirectory(t,n,r){this.checkOpsLimit();let s=this.fs.resolvePath(this.cwd,t);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(s),o=[],a=[];for(let l of i){let c=t==="."?l.name:`${t}/${l.name}`;l.isDirectory?a.push(c):n&&this.matchPattern(l.name,n)&&o.push(c)}r.push(...o);for(let l=0;l<a.length;l+=100){let c=a.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u,n,r)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(s),o=[];for(let l=0;l<i.length;l+=100){let c=i.slice(l,l+100),u=await Promise.all(c.map(async f=>{let d=t==="."?f:`${t}/${f}`,p=this.fs.resolvePath(this.cwd,d);try{this.checkOpsLimit();let h=await this.fs.stat(p);return{name:f,path:d,isDirectory:h.isDirectory}}catch(h){if(h instanceof C)throw h;return null}}));o.push(...u.filter(f=>f!==null))}for(let l of o)!l.isDirectory&&n&&this.matchPattern(l.name,n)&&r.push(l.path);let a=o.filter(l=>l.isDirectory);for(let l=0;l<a.length;l+=100){let c=a.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u.path,n,r)))}}}catch(i){if(i instanceof C)throw i}}matchPattern(t,n){return this.patternToRegex(n).test(t)}patternToRegex(t){let n=this.patternToRegexStr(t);return ie(`^${n}$`)}patternToRegexStr(t){let n="",r=!1;for(let s=0;s<t.length;s++){if(t.slice(s,s+13)==="\0QUOTE_START\0"){r=!0,s+=12;continue}if(t.slice(s,s+11)==="\0QUOTE_END\0"){r=!1,s+=10;continue}let i=t[s];if(r){/[.+^${}()|\\*?[\]]/.test(i)?n+=`\\${i}`:n+=i;continue}if(this.extglob&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<t.length&&t[s+1]==="("){let o=hd(t,s+1);if(o!==-1){let a=t.slice(s+2,o),l=md(a),c=l.map(f=>this.patternToRegexStr(f)),u=c.length>0?c.join("|"):"(?:)";if(i==="@")n+=`(?:${u})`;else if(i==="*")n+=`(?:${u})*`;else if(i==="+")n+=`(?:${u})+`;else if(i==="?")n+=`(?:${u})?`;else if(i==="!")if(o<t.length-1){let d=l.map(h=>this.computePatternLength(h));if(d.every(h=>h!==null)&&d.every(h=>h===d[0])&&d[0]!==null){let h=d[0];if(h===0)n+="(?:.+)";else{let m=[];h>0&&m.push(`.{0,${h-1}}`),m.push(`.{${h+1},}`),m.push(`(?!(?:${u})).{${h}}`),n+=`(?:${m.join("|")})`}}else n+=`(?:(?!(?:${u})).)*?`}else n+=`(?!(?:${u})$).*`;s=o;continue}}if(i==="*")n+=".*";else if(i==="?")n+=".";else if(i==="["){let o=s+1,a="[";o<t.length&&(t[o]==="^"||t[o]==="!")&&(a+="^",o++),o<t.length&&t[o]==="]"&&(a+="\\]",o++);let l=o;for(;l<t.length;){if(t[l]==="\\"&&l+1<t.length){l+=2;continue}if(t[l]==="["&&l+1<t.length&&t[l+1]===":"){let u=t.indexOf(":]",l+2);if(u!==-1){l=u+2;continue}}if(t[l]==="]")break;l++}let c=o;for(;o<t.length&&t[o]!=="]";){if(t[o]==="["&&o+1<t.length&&t[o+1]===":"){let u=t.indexOf(":]",o+2);if(u!==-1){let f=t.slice(o+2,u),d=pd(f);a+=d,o=u+2;continue}}if(t[o]==="\\"&&o+1<t.length){a+=`\\${t[o+1]}`,o+=2;continue}if(t[o]==="-"){let u=o===c,f=o+1===l;u||f?a+="\\-":a+="-"}else a+=t[o];o++}a+="]",n+=a,s=o}else if(i==="\\"&&s+1<t.length){let o=t[s+1];/[.+^${}()|\\*?[\]]/.test(o)?n+=`\\${o}`:n+=o,s++}else/[.+^${}()|]/.test(i)?n+=`\\${i}`:n+=i}return n}computePatternLength(t){let n=0,r=0,s=!1;for(;r<t.length;){if(t.slice(r,r+13)==="\0QUOTE_START\0"){s=!0,r+=13;continue}if(t.slice(r,r+11)==="\0QUOTE_END\0"){s=!1,r+=11;continue}let i=t[r];if(s){n+=1,r++;continue}if((i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&r+1<t.length&&t[r+1]==="("){let o=hd(t,r+1);if(o!==-1){if(i==="@"){let a=t.slice(r+2,o),c=md(a).map(u=>this.computePatternLength(u));if(c.every(u=>u!==null)&&c.every(u=>u===c[0])){n+=c[0],r=o+1;continue}return null}return null}}if(i==="*")return null;if(i==="?"){n+=1,r++;continue}if(i==="["){let o=t.indexOf("]",r+1);if(o!==-1){n+=1,r=o+1;continue}n+=1,r++;continue}if(i==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}};Z();function gd(e){for(let t=0;t<e.length;t++){if(e[t]==="\\"){t++;continue}if(e[t]==="$"){let n=e[t+1];if(n==="{"||n&&/[a-zA-Z_]/.test(n))return!0}}return!1}function bN(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type==="DefaultValue"||t.type==="AssignDefault"||t.type==="UseAlternative"||t.type==="ErrorIfUnset")&&(n=t.word?.parts),!n)return!1;for(let r of n)if(r.type==="DoubleQuoted"||r.type==="SingleQuoted")return!0;return!1}function j7(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type==="DefaultValue"||t.type==="AssignDefault"||t.type==="UseAlternative"||t.type==="ErrorIfUnset")&&(n=t.word?.parts),!n||n.length===0)return!1;for(let r of n)if(r.type!=="DoubleQuoted"&&r.type!=="SingleQuoted")return!1;return!0}function Uo(e){let t=!1,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1;for(let l of e){if((l.type==="SingleQuoted"||l.type==="DoubleQuoted")&&(t=!0,l.type==="DoubleQuoted"))for(let c of l.parts)c.type==="ParameterExpansion"&&(c.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/)&&(!c.operation||c.operation.type==="PatternRemoval"||c.operation.type==="PatternReplacement")&&(s=!0),(c.operation?.type==="VarNamePrefix"||c.operation?.type==="ArrayKeys")&&(o=!0),c.operation?.type==="Indirection"&&(a=!0));l.type==="CommandSubstitution"&&(n=!0),l.type==="ParameterExpansion"&&(i=!0,(l.parameter==="@"||l.parameter==="*")&&(r=!0),bN(l)&&(t=!0),(l.operation?.type==="VarNamePrefix"||l.operation?.type==="ArrayKeys")&&(o=!0),l.operation?.type==="Indirection"&&(a=!0)),l.type==="Glob"&&gd(l.pattern)&&(i=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:s,hasParamExpansion:i,hasVarNamePrefixExpansion:o,hasIndirection:a}}Z();Z();var xN=`
848
+ `;function Zs(e,t){if(e>=t)throw new C(`array element limit exceeded (${t})`,"array_elements")}function yd(e,t,n,r,s){Zs(e.length,s),Zs(t.length,s),e.push(n),t.push(r)}function Bt(e){return e.get("IFS")??xN}function Zt(e){return e.get("IFS")===""}function Pl(e){let t=Bt(e);if(t==="")return!0;for(let n of t)if(n!==" "&&n!==" "&&n!==`
849
+ `)return!1;return!0}function H7(e){let t=!1,n=[];for(let r of e.split(""))r==="-"?t=!0:/[\\^$.*+?()[\]{}|]/.test(r)?n.push(`\\${r}`):r===" "?n.push("\\t"):r===`
850
+ `?n.push("\\n"):n.push(r);return t&&n.push("\\-"),n.join("")}function Ie(e){let t=e.get("IFS");return t===void 0?" ":t[0]||""}var EN=`
851
+ `;function SN(e){return EN.includes(e)}function wd(e){let t=new Set,n=new Set;for(let r of e)SN(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function bd(e,t,n,r,s){if(t==="")return e===""?{words:[],wordStarts:[]}:(Zs(0,n),{words:[e],wordStarts:[0]});let{whitespace:i,nonWhitespace:o}=wd(t),a=[],l=[],c=0;for(;c<e.length&&i.has(e[c]);)c++;if(c>=e.length)return{words:[],wordStarts:[]};if(o.has(e[c]))for(yd(a,l,"",c,n),c++;c<e.length&&i.has(e[c]);)c++;for(;c<e.length&&!(r!==void 0&&a.length>=r);){let u=c;for(;c<e.length;){let f=e[c];if(!s&&f==="\\"){c++,c<e.length&&c++;continue}if(i.has(f)||o.has(f))break;c++}if(yd(a,l,e.substring(u,c),u,n),c>=e.length)break;for(;c<e.length&&i.has(e[c]);)c++;if(c<e.length&&o.has(e[c])){for(c++;c<e.length&&i.has(e[c]);)c++;for(;c<e.length&&o.has(e[c])&&!(r!==void 0&&a.length>=r);)for(yd(a,l,"",c,n),c++;c<e.length&&i.has(e[c]);)c++}}return{words:a,wordStarts:l}}function Dl(e,t,n){if(t==="")return e&&Zs(0,n),{words:e?[e]:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};if(e==="")return{words:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};let{whitespace:r,nonWhitespace:s}=wd(t),i=[],o=0,a=!1,l=!1,c=o;for(;o<e.length&&r.has(e[o]);)o++;if(o>c&&(a=!0),o>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(s.has(e[o]))for(Zs(i.length,n),i.push(""),o++;o<e.length&&r.has(e[o]);)o++;for(;o<e.length;){let u=o;for(;o<e.length;){let d=e[o];if(r.has(d)||s.has(d))break;o++}if(Zs(i.length,n),i.push(e.substring(u,o)),o>=e.length){l=!1;break}let f=o;for(;o<e.length&&r.has(e[o]);)o++;if(o<e.length&&s.has(e[o])){for(o++;o<e.length&&r.has(e[o]);)o++;for(;o<e.length&&s.has(e[o]);)for(Zs(i.length,n),i.push(""),o++;o<e.length&&r.has(e[o]);)o++}o>=e.length&&o>f&&(l=!0)}return{words:i,hadLeadingDelimiter:a,hadTrailingDelimiter:l}}function ot(e,t,n){return Dl(e,t,n).words}function AN(e,t){for(let n of e)if(t.has(n))return!0;return!1}function V7(e,t,n){if(t==="")return e;let{whitespace:r,nonWhitespace:s}=wd(t),i=e.length;for(;i>0&&r.has(e[i-1]);){if(!n&&i>=2){let a=0,l=i-2;for(;l>=0&&e[l]==="\\";)a++,l--;if(a%2===1)break}i--}let o=e.substring(0,i);if(o.length>=1&&s.has(o[o.length-1])){if(!n&&o.length>=2){let l=0,c=o.length-2;for(;c>=0&&o[c]==="\\";)l++,c--;if(l%2===1)return o}let a=o.substring(0,o.length-1);if(!AN(a,s))return a}return o}function rt(e,t){return e.state.namerefs?.has(t)??!1}function zr(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function G7(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function q7(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function Z7(e,t){return e.state.invalidNamerefs?.has(t)??!1}function xd(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function Ll(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let s=n[1],i=Gt(e,s),o=e.state.associativeArrays?.has(s)??!1;return i||o}return Gt(e,t)?!0:e.state.env.has(t)}function fn(e,t,n=100){if(!rt(e,t)||Z7(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!rt(e,s))return s;let i=e.state.env.get(s);if(i===void 0||i===""||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(i))return s;s=i}}function Ks(e,t){if(rt(e,t))return e.state.env.get(t)}function Fl(e,t,n,r=100){if(!rt(e,t)||Z7(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!rt(e,i))return i;let o=e.state.env.get(i);if(o===void 0||o==="")return n!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&Ll(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o))return i;i=o}}function K7(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(r,s)=>e.state.env.get(s)??"");return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(r,s)=>e.state.env.get(s)??""),n}function xe(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((i,o)=>[o,i]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((i,o)=>[o,String(i)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((i,o)=>[o,i]):e.state.associativeArrays?.has(t)?kr(e,t).map(i=>[i,Xe(e,t,i)??""]):Mt(e,t).map(s=>[s,Xe(e,t,s)??""])}function ur(e,t){return t==="FUNCNAME"?(e.state.funcNameStack?.length??0)>0:t==="BASH_LINENO"?(e.state.callLineStack?.length??0)>0:t==="BASH_SOURCE"?(e.state.sourceStack?.length??0)>0:e.state.associativeArrays?.has(t)?Gt(e,t):Gt(e,t)}async function je(e,t,n=!0,r=!1){switch(t){case"?":return String(e.state.lastExitCode);case"$":return String(e.state.virtualPid);case"#":return e.state.env.get("#")||"0";case"@":return e.state.env.get("@")||"";case"_":return e.state.lastArg;case"-":{let o="";return o+="h",e.state.options.errexit&&(o+="e"),e.state.options.noglob&&(o+="f"),e.state.options.nounset&&(o+="u"),e.state.options.verbose&&(o+="v"),e.state.options.xtrace&&(o+="x"),o+="B",e.state.options.noclobber&&(o+="C"),o+="s",o}case"*":{let o=Number.parseInt(e.state.env.get("#")||"0",10);if(o===0)return"";let a=[];for(let l=1;l<=o;l++)a.push(e.state.env.get(String(l))||"");return a.join(Ie(e.state.env))}case"0":return e.state.env.get("0")||"bash";case"PWD":return e.state.env.get("PWD")??"";case"OLDPWD":return e.state.env.get("OLDPWD")??"";case"PPID":return String(e.state.virtualPpid);case"UID":return String(e.state.virtualUid);case"EUID":return String(e.state.virtualUid);case"RANDOM":return String(Math.floor(Math.random()*32768));case"SECONDS":return String(Math.floor((Date.now()-e.state.startTime)/1e3));case"BASH_VERSION":return M6;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let o=e.state.funcNameStack?.[0];if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Jt("FUNCNAME");return""}case"BASH_LINENO":{let o=e.state.callLineStack?.[0];if(o!==void 0)return String(o);if(n&&e.state.options.nounset)throw new Jt("BASH_LINENO");return""}case"BASH_SOURCE":{let o=e.state.sourceStack?.[0];if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Jt("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new rn(`\${${t}}`);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let o=s[1],a=s[2];if(rt(e,o)){let f=fn(e,o);if(f&&f!==o){if(f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";o=f}}if(a==="@"||a==="*"){let f=xe(e,o);if(f.length>0)return f.map(([,p])=>p).join(" ");let d=e.state.env.get(o);return d!==void 0?d:""}if(o==="FUNCNAME"){let f=Number.parseInt(a,10);return!Number.isNaN(f)&&f>=0?e.state.funcNameStack?.[f]??"":""}if(o==="BASH_LINENO"){let f=Number.parseInt(a,10);if(!Number.isNaN(f)&&f>=0){let d=e.state.callLineStack?.[f];return d!==void 0?String(d):""}return""}if(o==="BASH_SOURCE"){let f=Number.parseInt(a,10);return!Number.isNaN(f)&&f>=0?e.state.sourceStack?.[f]??"":""}if(e.state.associativeArrays?.has(o)){let f=Al(a);f=K7(e,f);let d=Xe(e,o,f);if(d===void 0&&n&&e.state.options.nounset)throw new Jt(`${o}[${a}]`);return d||""}let c;if(/^-?\d+$/.test(a))c=Number.parseInt(a,10);else try{let f=new be,d=_e(f,a);c=await Re(e,d.expression)}catch{let f=e.state.env.get(a);c=f?Number.parseInt(f,10):0,Number.isNaN(c)&&(c=0)}if(c<0){let f=xe(e,o),d=e.state.currentLine;if(f.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${d}: ${o}: bad array subscript
852
+ `,"";let h=Math.max(...f.map(([g])=>typeof g=="number"?g:0))+1+c;return h<0?(e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${d}: ${o}: bad array subscript
853
+ `,""):Xe(e,o,h)||""}let u=Xe(e,o,c);if(u!==void 0)return u;if(c===0){let f=e.state.env.get(o);if(f!==void 0)return f}if(n&&e.state.options.nounset)throw new Jt(`${o}[${c}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let o=e.state.env.get(t);if(o===void 0&&n&&e.state.options.nounset)throw new Jt(t);return o||""}if(rt(e,t)){let o=fn(e,t);if(o===void 0)return"";if(o!==t)return await je(e,o,n,r);let a=e.state.env.get(t);if((a===void 0||a==="")&&n&&e.state.options.nounset)throw new Jt(t);return a||""}let i=e.state.env.get(t);if(i!==void 0)return e.state.tempEnvBindings?.some(o=>o.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),i;if(ur(e,t)){let o=Xe(e,t,0);if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Jt(t);return""}if(n&&e.state.options.nounset)throw new Jt(t);return""}async function Nr(e,t){if(new Set(["?","$","#","_","-","0","PPID","UID","EUID","RANDOM","SECONDS","BASH_VERSION","!","BASHPID","LINENO"]).has(t))return!0;if(t==="@"||t==="*")return Number.parseInt(e.state.env.get("#")||"0",10)>0;if(t==="PWD"||t==="OLDPWD")return e.state.env.has(t);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let s=r[1],i=r[2];if(rt(e,s)){let l=fn(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return xe(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=K7(e,Al(i));return ts(e,s,l)}let a;if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else try{let l=new be,c=_e(l,i);a=await Re(e,c.expression)}catch{let l=e.state.env.get(i);a=l?Number.parseInt(l,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let l=xe(e,s);if(l.length===0)return!1;let u=Math.max(...l.map(([f])=>typeof f=="number"?f:0))+1+a;return u<0?!1:ts(e,s,u)}return ts(e,s,a)}if(rt(e,t)){let s=fn(e,t);return s===void 0||s===t?e.state.env.has(t):Nr(e,s)}return e.state.env.has(t)?!0:ur(e,t)?ts(e,t,0):!1}async function Q7(e,t){let n="",r=0;for(;r<t.length;){if(t[r]==="$"){if(t[r+1]==="{"){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="{"?s++:t[i]==="}"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]==="("){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="("?s++:t[i]===")"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await je(e,i);n+=o,r=s;continue}if(/[0-9]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[0-9]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await je(e,i);n+=o,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await je(e,s);n+=i,r+=2;continue}}if(t[r]==='"'){for(n+='"',r++;r<t.length&&t[r]!=='"';)if(t[r]==="$"&&/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await je(e,i);n+=o,r=s}else t[r]==="\\"?(n+=t[r],r++,r<t.length&&(n+=t[r],r++)):(n+=t[r],r++);r<t.length&&(n+='"',r++);continue}n+=t[r],r++}return n}async function Ed(e,t){let n=t,r=t.startsWith('"')&&t.endsWith('"'),s=t.startsWith("'")&&t.endsWith("'");if((r||s)&&(n=t.slice(1,-1)),s)return n;let i="",o=0;for(;o<n.length;)if(n[o]==="$")if(n[o+1]==="("){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="("&&n[l-1]==="$"||n[l]==="("?a++:n[l]===")"&&a--,l++;let c=n.slice(o+2,l-1);if(e.execFn){let u=await e.execFn(c,{signal:e.state.signal});i+=u.stdout.replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}o=l}else if(n[o+1]==="{"){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="{"?a++:n[l]==="}"&&a--,l++;let c=n.slice(o+2,l-1),u=await je(e,c);i+=u,o=l}else if(/[a-zA-Z_]/.test(n[o+1]||"")){let a=o+1;for(;a<n.length&&/[a-zA-Z0-9_]/.test(n[a]);)a++;let l=n.slice(o+1,a),c=await je(e,l);i+=c,o=a}else i+=n[o],o++;else if(n[o]==="`"){let a=o+1;for(;a<n.length&&n[a]!=="`";)a++;let l=n.slice(o+1,a);if(e.execFn){let c=await e.execFn(l,{signal:e.state.signal});i+=c.stdout.replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}o=a+1}else i+=n[o],o++;return i}St();Z();var zo=1e4,Sd={maxResults:zo,maxStringBytes:10*1024*1024};function Ml(e,t,n,r){if(e.length>=n.maxResults)return!1;let s=U(t);if(s>n.maxStringBytes-r.value)throw new C(`brace expansion string limit exceeded (${n.maxStringBytes} bytes)`,"string_length");return e.push(t),r.value+=s,!0}function CN(e,t,n,r,s,i=Sd){let o=n??1;o===0&&(o=1);let a=Math.abs(o),l=[],c=0;if(r?.match(/^-?0\d/)&&(c=Math.max(c,r.replace(/^-/,"").length)),s?.match(/^-?0\d/)&&(c=Math.max(c,s.replace(/^-/,"").length)),c>i.maxStringBytes)throw new C(`brace expansion padding limit exceeded (${i.maxStringBytes} bytes)`,"string_length");let u={value:0},f=d=>{if(c>0){let p=d<0,h=String(Math.abs(d)).padStart(c,"0");return p?`-${h}`:h}return String(d)};if(e<=t)for(let d=e,p=0;d<=t&&p<zo&&Ml(l,f(d),i,u);d+=a,p++);else for(let d=e,p=0;d>=t&&p<zo&&Ml(l,f(d),i,u);d-=a,p++);return l}function vN(e,t,n,r=Sd){let s=n??1;s===0&&(s=1);let i=e.charCodeAt(0),o=t.charCodeAt(0),a=Math.abs(s),l=e>="A"&&e<="Z",c=e>="a"&&e<="z",u=t>="A"&&t<="Z",f=t>="a"&&t<="z";if(l&&f||c&&u){let h=n!==void 0?`..${n}`:"";throw new ti(`{${e}..${t}${h}}: invalid sequence`)}let d=[],p={value:0};if(i<=o)for(let h=i,m=0;h<=o&&m<zo&&Ml(d,String.fromCharCode(h),r,p);h+=a,m++);else for(let h=i,m=0;h>=o&&m<zo&&Ml(d,String.fromCharCode(h),r,p);h-=a,m++);return d}function Ad(e,t,n,r,s,i=Sd){let o=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:CN(e,t,n,r,s,i),literal:`{${e}..${t}${o}}`}:typeof e=="string"&&typeof t=="string"?{expanded:vN(e,t,n,i),literal:`{${e}..${t}${o}}`}:{expanded:null,literal:`{${e}..${t}${o}}`}}function X7(e){if(e.statements.length!==1)return null;let t=e.statements[0];if(t.operators.length!==0||t.pipelines.length!==1)return null;let n=t.pipelines[0];if(n.negated||n.commands.length!==1)return null;let r=n.commands[0];if(r.type!=="SimpleCommand")return null;let s=r;if(s.name!==null||s.args.length!==0||s.assignments.length!==0||s.redirections.length!==1)return null;let i=s.redirections[0];return i.operator!=="<"||i.target.type!=="Word"?null:{target:i.target}}function Ir(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function Cd(e){let t="",n=0;for(;n<e.length;)e[n]==="\\"&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);return t}function Rn(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function Mi(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}pt();Z();function Fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $e(e,t,n=!1){let r="",s=0;for(;s<e.length;){let i=e[s];if(n&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<e.length&&e[s+1]==="("){let o=kN(e,s+1);if(o!==-1){let a=e.slice(s+2,o),c=NN(a).map(f=>$e(f,t,n)),u=c.length>0?c.join("|"):"(?:)";i==="@"?r+=`(?:${u})`:i==="*"?r+=`(?:${u})*`:i==="+"?r+=`(?:${u})+`:i==="?"?r+=`(?:${u})?`:i==="!"&&(r+=`(?!(?:${u})$).*`),s=o+1;continue}}if(i==="\\")if(s+1<e.length){let o=e[s+1];/[\\^$.|+(){}[\]*?]/.test(o)?r+=`\\${o}`:r+=o,s+=2}else r+="\\\\",s++;else if(i==="*")r+=t?".*":".*?",s++;else if(i==="?")r+=".",s++;else if(i==="["){let o=IN(e,s);if(o===-1)r+="\\[",s++;else{let a=e.slice(s+1,o);r+=ON(a),s=o+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function kN(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function NN(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function IN(e,t){let n=t+1;for(n<e.length&&e[n]==="^"&&n++,n<e.length&&e[n]==="]"&&n++;n<e.length;){if(e[n]==="\\"&&n+1<e.length){n+=2;continue}if(e[n]==="]")return n;if(e[n]==="'"){let r=e.indexOf("'",n+1);if(r!==-1){n=r+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let r=e.indexOf(":]",n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function ON(e){let t="[",n=0;for((e[0]==="^"||e[0]==="!")&&(t+="^",n++);n<e.length;){if(e[n]==="'"){let s=e.indexOf("'",n+1);if(s!==-1){let i=e.slice(n+1,s);for(let o of i)o==="\\"?t+="\\\\":o==="]"?t+="\\]":o==="^"&&t==="["?t+="\\^":t+=o;n=s+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s);t+=RN(i),n=s+2;continue}}let r=e[n];r==="\\"?n+1<e.length?(t+=`\\${e[n+1]}`,n+=2):(t+="\\\\",n++):r==="-"&&n>0&&n<e.length-1?(t+="-",n++):r==="^"&&n===0?(t+="^",n++):(r==="]"&&n===0?t+="\\]":t+=r,n++)}return t+="]",t}var TN=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]);function RN(e){return TN.get(e)??""}pt();function fr(e,t,n,r,s){if(r==="prefix")return e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal"),ie(`^${n}`,"s").replace(t,"");let i=ie(`${n}$`,"s");if(s)return e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal"),i.replace(t,"");e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal");let o=ie(`^(?:.*)(${n})$`,"s").exec(t);if(!o)return t;let a=o[1]??"";return t.slice(0,t.length-a.length)}function _i(e,t){let n=new Set;for(let r of e.state.env.keys())r.startsWith(t)&&n.add(r);for(let r of e.state.arrays?.keys()??[])r.startsWith(t)&&n.add(r);return[...n].sort()}At();Z();function _l(e,t,n,r,s){let i=new Te(e.limits.maxStringLength,"pattern replacement",()=>new C(`pattern replacement: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length"));n.lastIndex=0;let o=0,a=n.exec(t);for(;a!==null&&(e.executionScope.consumeLimited("pattern_operations",1,e.limits.maxGlobOperations,"pattern replacement"),!(s&&a[0].length===0&&a.index===t.length||(i.append(t.slice(o,a.index)),i.append(r),o=a.index+a[0].length,!s)));)a[0].length===0&&(o++,n.lastIndex<=a.index&&(n.lastIndex=a.index+1)),a=n.exec(t);return i.append(t.slice(o)),n.lastIndex=0,i.build()}St();Z();function Y7(e){let t=[],n=0;return{append(r){let s=U(r);if(s>e-n)throw new C(`prompt expansion exceeds string length limit (${e} bytes)`,"string_length");r&&t.push(r),n+=s},build:()=>t.join("")}}function $N(e,t,n){let r=(o,a=2)=>String(o).padStart(a,"0");if(e===""){let o=r(t.getHours()),a=r(t.getMinutes()),l=r(t.getSeconds());return`${o}:${a}:${l}`}let s=Y7(n),i=0;for(;i<e.length;)if(e[i]==="%"){if(i+1>=e.length){s.append("%"),i++;continue}let o=e[i+1];switch(o){case"H":s.append(r(t.getHours()));break;case"M":s.append(r(t.getMinutes()));break;case"S":s.append(r(t.getSeconds()));break;case"d":s.append(r(t.getDate()));break;case"m":s.append(r(t.getMonth()+1));break;case"Y":s.append(String(t.getFullYear()));break;case"y":s.append(r(t.getFullYear()%100));break;case"I":{let a=t.getHours()%12;a===0&&(a=12),s.append(r(a));break}case"p":s.append(t.getHours()<12?"AM":"PM");break;case"P":s.append(t.getHours()<12?"am":"pm");break;case"%":s.append("%");break;case"a":{let a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];s.append(a[t.getDay()]);break}case"b":{let a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];s.append(a[t.getMonth()]);break}default:s.append(`%${o}`)}i+=2}else s.append(e[i]),i++;return s.build()}function Wo(e,t){let n=Y7(e.limits.maxStringLength),r=0,s=e.state.env.get("USER")||e.state.env.get("LOGNAME")||"user",i=e.state.env.get("HOSTNAME")||"localhost",o=i.split(".")[0],a=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",c=a.startsWith(l)?`~${a.slice(l.length)}`:a,u=a.split("/").pop()||a,f=new Date,d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let m=t[r];if(m==="\\"){if(r+1>=t.length){n.append("\\"),r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let b="",w=r+1;for(;w<t.length&&w<r+4&&t[w]>="0"&&t[w]<="7";)b+=t[w],w++;let y=Number.parseInt(b,8)%256;n.append(String.fromCharCode(y)),r=w;continue}switch(g){case"\\":n.append("\\"),r+=2;break;case"a":n.append("\x07"),r+=2;break;case"e":n.append("\x1B"),r+=2;break;case"n":n.append(`
854
+ `),r+=2;break;case"r":n.append("\r"),r+=2;break;case"$":n.append("$"),r+=2;break;case"[":case"]":r+=2;break;case"u":n.append(s),r+=2;break;case"h":n.append(o),r+=2;break;case"H":n.append(i),r+=2;break;case"w":n.append(c),r+=2;break;case"W":n.append(u),r+=2;break;case"d":{let b=String(f.getDate()).padStart(2," ");n.append(`${d[f.getDay()]} ${p[f.getMonth()]} ${b}`),r+=2;break}case"t":{let b=String(f.getHours()).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0"),y=String(f.getSeconds()).padStart(2,"0");n.append(`${b}:${w}:${y}`),r+=2;break}case"T":{let b=f.getHours()%12;b===0&&(b=12);let w=String(b).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0"),x=String(f.getSeconds()).padStart(2,"0");n.append(`${w}:${y}:${x}`),r+=2;break}case"@":{let b=f.getHours()%12;b===0&&(b=12);let w=String(b).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0"),x=f.getHours()<12?"AM":"PM";n.append(`${w}:${y} ${x}`),r+=2;break}case"A":{let b=String(f.getHours()).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0");n.append(`${b}:${w}`),r+=2;break}case"D":if(r+2<t.length&&t[r+2]==="{"){let b=t.indexOf("}",r+3);if(b!==-1){let w=t.slice(r+3,b);n.append($N(w,f,e.limits.maxStringLength)),r=b+1}else n.append("\\D"),r+=2}else n.append("\\D"),r+=2;break;case"s":n.append("bash"),r+=2;break;case"v":n.append("5.0"),r+=2;break;case"V":n.append("5.0.0"),r+=2;break;case"j":n.append("0"),r+=2;break;case"l":n.append("tty"),r+=2;break;case"#":n.append(h),r+=2;break;case"!":n.append(h),r+=2;break;case"x":n.append("\\x"),r+=2;break;default:n.append(`\\${g}`),r+=2}}else n.append(m),r++}return n.build()}function os(e){if(e==="")return"''";if(/[\n\r\t\x00-\x1f\x7f']/.test(e)){let n="$'";for(let r of e)switch(r){case"'":n+="\\'";break;case"\\":n+="\\\\";break;case`
855
+ `:n+="\\n";break;case"\r":n+="\\r";break;case" ":n+="\\t";break;default:{let s=r.charCodeAt(0);s<32||s===127?n+=`\\${s.toString(8).padStart(3,"0")}`:n+=r}}return`${n}'`}return`'${e}'`}Z();function Cn(e,t){e.state.readonlyVars=e.state.readonlyVars||new Set,e.state.readonlyVars.add(t)}function dn(e,t){return e.state.readonlyVars?.has(t)??!1}function st(e,t,n="bash"){if(dn(e,t)){let r=`${n}: ${t}: readonly variable
856
+ `;throw new ye(1,"",r)}return null}function dr(e,t){let n=e.state.exportedVars?.has(t)??!1;if(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(t),e.state.localScopes.length>0&&e.state.localScopes[e.state.localScopes.length-1].has(t)&&!n){for(e.state.localExportedVars||(e.state.localExportedVars=[]);e.state.localExportedVars.length<e.state.localScopes.length;)e.state.localExportedVars.push(new Set);e.state.localExportedVars[e.state.localExportedVars.length-1].add(t)}}function Bl(e,t){e.state.exportedVars?.delete(t)}function as(e,t){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return"";let n="",r=zt(e,t)?.kind==="indexed",s=e.state.associativeArrays?.has(t)??!1;return r&&!s&&(n+="a"),s&&(n+="A"),e.state.integerVars?.has(t)&&(n+="i"),rt(e,t)&&(n+="n"),dn(e,t)&&(n+="r"),e.state.exportedVars?.has(t)&&(n+="x"),n}async function J7(e,t,n,r){return e.coverage?.hit("bash:expansion:default_value"),(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):n.effectiveValue}async function ew(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:assign_default"),(r.isUnset||n.checkEmpty&&r.isEmpty)&&n.word){let o=await s(e,n.word.parts,r.inDoubleQuotes),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,l,c]=a,u;if(/^\d+$/.test(c))u=Number.parseInt(c,10);else{try{let f=new be,d=_e(f,c);u=await Re(e,d.expression)}catch{let f=e.state.env.get(c);u=f?Number.parseInt(f,10):0}Number.isNaN(u)&&(u=0)}we(e,l,u,o)}else e.state.env.set(t,o);return o}return r.effectiveValue}async function tw(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:error_if_unset"),r.isUnset||n.checkEmpty&&r.isEmpty){let o=n.word?await s(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new ye(1,"",`bash: ${o}
857
+ `)}return r.effectiveValue}async function nw(e,t,n,r){return e.coverage?.hit("bash:expansion:use_alternative"),!(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):""}async function rw(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_removal");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let a of n.pattern.parts)if(a.type==="Glob")i+=$e(a.pattern,n.greedy,o);else if(a.type==="Literal")i+=$e(a.value,n.greedy,o);else if(a.type==="SingleQuoted"||a.type==="Escaped")i+=Fe(a.value);else if(a.type==="DoubleQuoted"){let l=await r(e,a.parts);i+=Fe(l)}else if(a.type==="ParameterExpansion"){let l=await s(e,a);i+=$e(l,n.greedy,o)}else{let l=await s(e,a);i+=Fe(l)}return fr(e,t,i,n.side,n.greedy)}async function sw(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_replacement");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let c of n.pattern.parts)if(c.type==="Glob")i+=$e(c.pattern,!0,o);else if(c.type==="Literal")i+=$e(c.value,!0,o);else if(c.type==="SingleQuoted"||c.type==="Escaped")i+=Fe(c.value);else if(c.type==="DoubleQuoted"){let u=await r(e,c.parts);i+=Fe(u)}else if(c.type==="ParameterExpansion"){let u=await s(e,c);i+=$e(u,!0,o)}else{let u=await s(e,c);i+=Fe(u)}let a=n.replacement?await r(e,n.replacement.parts):"";if(n.anchor==="start"?i=`^${i}`:n.anchor==="end"&&(i=`${i}$`),i==="")return t;let l=n.all?"gs":"s";try{let c=ie(i,l);return _l(e,t,c,a,n.all)}catch(c){if(c instanceof C)throw c;return t}}function iw(e,t,n){e.coverage?.hit("bash:expansion:length");let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let s=r[1],i=xe(e,s);return i.length>0?String(i.length):e.state.env.get(s)!==void 0?"1":"0"}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&ur(e,t)){if(t==="FUNCNAME"){let i=e.state.funcNameStack?.[0]||"";return String([...i].length)}if(t==="BASH_LINENO"){let i=e.state.callLineStack?.[0];return String(i!==void 0?[...String(i)].length:0)}let s=Xe(e,t,0)||"";return String([...s].length)}return String([...n].length)}async function ow(e,t,n,r){e.coverage?.hit("bash:expansion:substring");let s=await Re(e,r.offset.expression),i=r.length?await Re(e,r.length.expression):void 0;if(t==="@"||t==="*"){let c=Number.parseInt(e.state.env.get("#")||"0",10),u=[];for(let h=1;h<=c;h++)u.push(e.state.env.get(String(h))||"");let f=e.state.env.get("0")||"bash",d,p;if(s<=0)if(d=[f,...u],s<0){if(p=d.length+s,p<0)return""}else p=0;else d=u,p=s-1;if(p<0||p>=d.length)return"";if(i!==void 0){let h=i<0?d.length+i:p+i;return d.slice(p,Math.max(p,h)).join(" ")}return d.slice(p).join(" ")}let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(o){let c=o[1];if(e.state.associativeArrays?.has(c))throw new ye(1,"",`bash: \${${c}[@]: 0: 3}: bad substitution
858
+ `);let u=xe(e,c),f=0;if(s<0){if(u.length>0){let d=u[u.length-1][0],h=(typeof d=="number"?d:0)+1+s;if(h<0||(f=u.findIndex(([m])=>typeof m=="number"&&m>=h),f<0))return""}}else if(f=u.findIndex(([d])=>typeof d=="number"&&d>=s),f<0)return"";if(i!==void 0){if(i<0)throw new Ve(`${o[1]}[@]: substring expression < 0`);return u.slice(f,f+i).map(([,d])=>d).join(" ")}return u.slice(f).map(([,d])=>d).join(" ")}let a=[...n],l=s;if(l<0&&(l=Math.max(0,a.length+l)),i!==void 0){if(i<0){let c=a.length+i;return a.slice(l,Math.max(l,c)).join("")}return a.slice(l,l+i).join("")}return a.slice(l).join("")}async function aw(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:case_modification"),n.pattern){let i=e.state.shoptOptions.extglob,o="";for(let f of n.pattern.parts)if(f.type==="Glob")o+=$e(f.pattern,!0,i);else if(f.type==="Literal")o+=$e(f.value,!0,i);else if(f.type==="SingleQuoted"||f.type==="Escaped")o+=Fe(f.value);else if(f.type==="DoubleQuoted"){let d=await r(e,f.parts);o+=Fe(d)}else if(f.type==="ParameterExpansion"){let d=await s(e,f);o+=$e(d,!0,i)}let a=ie(`^(?:${o})$`),l=n.direction==="upper"?f=>f.toUpperCase():f=>f.toLowerCase(),c="",u=!1;for(let f of t)!n.all&&u?c+=f:a.test(f)?(c+=l(f),u=!0):c+=f;return c}return n.direction==="upper"?n.all?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1):n.all?t.toLowerCase():t.charAt(0).toLowerCase()+t.slice(1)}function lw(e,t,n,r,s){e.coverage?.hit("bash:expansion:transform");let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(i&&s.operator==="Q")return xe(e,i[1]).map(([,c])=>os(c)).join(" ");if(i&&s.operator==="a")return as(e,i[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&s.operator==="a")return as(e,o[1]);switch(s.operator){case"Q":return r?"":os(n);case"P":return Wo(e,n);case"a":return as(e,t);case"A":return r?"":`${t}=${os(n)}`;case"E":return n.replace(/\\([\\abefnrtv'"?])/g,(a,l)=>{switch(l){case"\\":return"\\";case"a":return"\x07";case"b":return"\b";case"e":return"\x1B";case"f":return"\f";case"n":return`
859
+ `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";default:return l}});case"K":case"k":return r?"":os(n);case"u":return n.charAt(0).toUpperCase()+n.slice(1);case"U":return n.toUpperCase();case"L":return n.toLowerCase();default:return n}}async function cw(e,t,n,r,s,i,o=!1){if(e.coverage?.hit("bash:expansion:indirection"),rt(e,t))return Ks(e,t)||"";let a=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new rn(`\${!${t}}`)}let l=n;if(a&&(l===""||l.includes(" ")))throw new rn(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new rn(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,o)}return await je(e,l)}function uw(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=xe(e,t.array).map(([s])=>String(s));return t.star?r.join(Ie(e.state.env)):r.join(" ")}function fw(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=_i(e,t.prefix);return t.star?n.join(Ie(e.state.env)):n.join(" ")}function dw(e,t,n,r){let s=Number.parseInt(e.state.env.get("#")||"0",10),i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t==="*")return{isEmpty:s===0,effectiveValue:n};if(t==="@")return{isEmpty:s===0||s===1&&e.state.env.get("1")==="",effectiveValue:n};if(i){let[,o,a]=i,l=xe(e,o);if(l.length===0)return{isEmpty:!0,effectiveValue:""};if(a==="*"){let c=Ie(e.state.env),u=l.map(([,f])=>f).join(c);return{isEmpty:r?u==="":!1,effectiveValue:u}}return{isEmpty:l.length===1&&l.every(([,c])=>c===""),effectiveValue:l.map(([,c])=>c).join(" ")}}return{isEmpty:n==="",effectiveValue:n}}Nt();Z();function pw(e){let t=0;for(;t<e.length;){let n=e[t];if(n==="\\"&&t+1<e.length){t+=2;continue}if(n==="'"){let r=e.indexOf("'",t+1);if(r!==-1){t=r+1;continue}}if(n==="$"&&t+1<e.length&&e[t+1]==="("||n==="`")return!0;t++}return!1}function hw(e,t){let n=1,r=t,s=!1,i=!1;for(;r<e.length&&n>0;){let o=e[r];if(o==="\\"&&!s&&r+1<e.length){r+=2;continue}if(o==="'"&&!i){s=!s,r++;continue}if(o==='"'&&!s){i=!i,r++;continue}if(!s&&!i){if(o==="(")n++;else if(o===")"&&(n--,n===0))return r}r++}return-1}async function Ul(e,t){let n=new be,r;try{r=n.parse(t)}catch{return""}let s=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let i=new Map(e.state.env),o=Zn(e.state.arrays),a=e.state.cwd,l=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let c=await e.executeScript(r),u=c.exitCode;return e.state.env=i,e.state.arrays=o,e.state.cwd=a,e.state.suppressVerbose=l,e.state.lastExitCode=u,e.state.env.set("?",String(u)),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr),e.state.bashPid=s,c.stdout.replace(/\n+$/,"")}catch(c){return e.state.env=i,e.state.arrays=o,e.state.cwd=a,e.state.bashPid=s,e.state.suppressVerbose=l,he(c),c instanceof ye?(e.state.lastExitCode=c.exitCode,e.state.env.set("?",String(c.exitCode)),c.stdout?.replace(/\n+$/,"")??""):""}}function vd(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let o=t.slice(r+1,i);n+=Rn(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=PN(e,a);n+=Rn(l),r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}function PN(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}async function mw(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let o=t.slice(r+1,i);n+=Rn(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=await DN(e,a);n+=Rn(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=hw(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await Ul(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await Ul(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}async function DN(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=hw(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await Ul(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await Ul(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}function kd(e,t){if(!t.startsWith("~"))return t;e.coverage?.hit("bash:expansion:tilde");let n=e.state.env.get("HOME")!==void 0?e.state.env.get("HOME"):"/home/user";if(t==="~"||t.startsWith("~/"))return n+t.slice(1);let r=1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;let s=t.slice(1,r),i=t.slice(r);return i!==""&&!i.startsWith("/")?t:s==="root"?`/root${i}`:t}function ls(e,t){return t.split(":").map(n=>kd(e,n)).join(":")}Z();Z();function Kt(e,t,n,r){if(e.length>n-t.length)throw new C(`${r} element limit exceeded (${n})`,"array_elements");for(let s of t)e.push(s)}pt();async function LN(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=$e(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=$e(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=Fe(i.value);else if(i.type==="DoubleQuoted"){let o=await n(e,i.parts);s+=Fe(o)}else if(i.type==="ParameterExpansion"){let o=await r(e,i);s+=$e(o,!0,e.state.shoptOptions.extglob)}else{let o=await r(e,i);s+=Fe(o)}return s}async function gw(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternReplacement")return null;let i=s.parts[0],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=xe(e,a),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(a);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let d="";c.pattern&&(d=await LN(e,c.pattern,n,r));let p=c.replacement?await n(e,c.replacement.parts):"",h=d;c.anchor==="start"?h=`^${d}`:c.anchor==="end"&&(h=`${d}$`);let m=[];try{let g=ie(h,c.all?"g":"");for(let b of f)m.push(g.replace(b,p))}catch{m.push(...f)}if(l){let g=Ie(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function yw(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternRemoval")return null;let i=s.parts[0],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=xe(e,a),f=u.map(([,m])=>m);if(u.length===0){let m=e.state.env.get(a);m!==void 0&&f.push(m)}if(f.length===0)return{values:[],quoted:!0};let d="",p=e.state.shoptOptions.extglob;if(c.pattern)for(let m of c.pattern.parts)if(m.type==="Glob")d+=$e(m.pattern,c.greedy,p);else if(m.type==="Literal")d+=$e(m.value,c.greedy,p);else if(m.type==="SingleQuoted"||m.type==="Escaped")d+=Fe(m.value);else if(m.type==="DoubleQuoted"){let g=await n(e,m.parts);d+=Fe(g)}else if(m.type==="ParameterExpansion"){let g=await r(e,m);d+=$e(g,c.greedy,p)}else{let g=await r(e,m);d+=Fe(g)}let h=[];for(let m of f)h.push(fr(e,m,d,c.side,c.greedy));if(l){let m=Ie(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}pt();async function ww(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="DefaultValue"&&n.parts[0].operation?.type!=="UseAlternative"&&n.parts[0].operation?.type!=="AssignDefault")return null;let r=n.parts[0],s=r.operation,i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/),o,a=!1;if(i){let l=i[1];a=i[2]==="*";let c=xe(e,l),u=c.length>0||e.state.env.has(l),f=c.length===0||c.length===1&&c.every(([,p])=>p===""),d=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=u&&!(d&&f):o=!u||d&&f,!o){if(c.length>0){let h=c.map(([,m])=>m);if(a){let m=Ie(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}let p=e.state.env.get(l);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}}else{let l=r.parameter,c=await Nr(e,l),u=await je(e,l),f=u==="",d=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=c&&!(d&&f):o=!c||d&&f,!o)return{values:[u],quoted:!0}}if(o&&s.word){let l=s.word.parts,c=null,u=!1;for(let f of l)if(f.type==="ParameterExpansion"&&!f.operation){let d=f.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(d){c=d[1],u=d[2]==="*";break}}if(c){let f=xe(e,c);if(f.length>0){let p=f.map(([,h])=>h);if(u||a){let h=Ie(e.state.env);return{values:[p.join(h)],quoted:!0}}return{values:p,quoted:!0}}let d=e.state.env.get(c);return d!==void 0?{values:[d],quoted:!0}:{values:[],quoted:!0}}}return null}async function bw(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],o=-1,a="",l=!1,c=null;for(let m=0;m<i.parts.length;m++){let g=i.parts[m];if(g.type==="ParameterExpansion"&&(g.operation?.type==="PatternRemoval"||g.operation?.type==="PatternReplacement")){let b=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(b){o=m,a=b[1],l=b[2]==="*",c=g.operation;break}}}if(o===-1||o===0&&o===i.parts.length-1)return null;let u="";for(let m=0;m<o;m++)u+=await r(e,i.parts[m]);let f="";for(let m=o+1;m<i.parts.length;m++)f+=await r(e,i.parts[m]);let d=xe(e,a),p=d.map(([,m])=>m);if(d.length===0){let m=e.state.env.get(a);if(m!==void 0)p=[m];else{if(l)return{values:[u+f],quoted:!0};let g=u+f;return{values:g?[g]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let m=c,g="",b=e.state.shoptOptions.extglob;if(m.pattern)for(let w of m.pattern.parts)if(w.type==="Glob")g+=$e(w.pattern,m.greedy,b);else if(w.type==="Literal")g+=$e(w.value,m.greedy,b);else if(w.type==="SingleQuoted"||w.type==="Escaped")g+=Fe(w.value);else if(w.type==="DoubleQuoted"){let y=await s(e,w.parts);g+=Fe(y)}else if(w.type==="ParameterExpansion"){let y=await r(e,w);g+=$e(y,m.greedy,b)}else{let y=await r(e,w);g+=Fe(y)}p=p.map(w=>fr(e,w,g,m.side,m.greedy))}else if(c?.type==="PatternReplacement"){let m=c,g="";if(m.pattern)for(let y of m.pattern.parts)if(y.type==="Glob")g+=$e(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")g+=$e(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")g+=Fe(y.value);else if(y.type==="DoubleQuoted"){let x=await s(e,y.parts);g+=Fe(x)}else if(y.type==="ParameterExpansion"){let x=await r(e,y);g+=$e(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,y);g+=Fe(x)}let b=m.replacement?await s(e,m.replacement.parts):"",w=g;m.anchor==="start"?w=`^${g}`:m.anchor==="end"&&(w=`${g}$`);try{let y=ie(w,m.all?"g":"");p=p.map(x=>y.replace(x,b))}catch{}}if(l){let m=Ie(e.state.env);return{values:[u+p.join(m)+f],quoted:!0}}return p.length===1?{values:[u+p[0]+f],quoted:!0}:{values:[u+p[0],...p.slice(1,-1),p[p.length-1]+f],quoted:!0}}async function xw(e,t,n,r){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o="",a=!1;for(let p=0;p<s.parts.length;p++){let h=s.parts[p];if(h.type==="ParameterExpansion"&&!h.operation){let m=h.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(m){i=p,o=m[1],a=m[2]==="*";break}}}if(i===-1)return null;let l="";for(let p=0;p<i;p++)l+=await r(e,s.parts[p]);let c="";for(let p=i+1;p<s.parts.length;p++)c+=await r(e,s.parts[p]);let u=xe(e,o),f=u.map(([,p])=>p);if(u.length===0){let p=e.state.env.get(o);if(p!==void 0)return{values:[l+p+c],quoted:!0};if(a)return{values:[l+c],quoted:!0};let h=l+c;return{values:h?[h]:[],quoted:!0}}if(a){let p=Ie(e.state.env);return{values:[l+f.join(p)+c],quoted:!0}}return f.length===1?{values:[l+f[0]+c],quoted:!0}:{values:[l+f[0],...f.slice(1,-1),f[f.length-1]+c],quoted:!0}}St();Z();async function Ew(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation?.type!=="Substring")return null;let s=r.parts[0],i=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let o=i[1],a=i[2]==="*",l=s.operation;if(e.state.associativeArrays?.has(o))throw new ye(1,"",`bash: \${${o}[@]: 0: 3}: bad substitution
860
+ `);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=xe(e,o);if(f.length>e.limits.maxArrayElements)throw new C(`array transform element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let d=0;if(c<0){if(f.length>0){let h=f[f.length-1][0],g=(typeof h=="number"?h:0)+1+c;if(g<0)return{values:[],quoted:!0};d=f.findIndex(([b])=>typeof b=="number"&&b>=g),d<0&&(d=f.length)}}else d=f.findIndex(([h])=>typeof h=="number"&&h>=c),d<0&&(d=f.length);let p;if(u!==void 0){if(u<0)throw new Ve(`${o}[@]: substring expression < 0`);p=f.slice(d,d+u).map(([,h])=>h)}else p=f.slice(d).map(([,h])=>h);if(p.length===0)return{values:[],quoted:!0};if(a){let h=Ie(e.state.env);return{values:[p.join(h)],quoted:!0}}return{values:p,quoted:!0}}function Sw(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="Transform")return null;let r=n.parts[0],s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let i=s[1],o=s[2]==="*",a=r.operation,l=xe(e,i);if(l.length===0){let d=e.state.env.get(i);if(d!==void 0){let p;switch(a.operator){case"a":p="";break;case"P":p=Wo(e,d);break;case"Q":p=os(d);break;default:p=d}if(U(p)>e.limits.maxStringLength)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[p],quoted:!0}}return o?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=as(e,i),u=[],f=0;for(let[,d]of l){let p;switch(a.operator){case"a":p=c;break;case"P":p=Wo(e,d);break;case"Q":p=os(d);break;case"u":p=d.charAt(0).toUpperCase()+d.slice(1);break;case"U":p=d.toUpperCase();break;case"L":p=d.toLowerCase();break;default:p=d}let h=U(p);if(h>e.limits.maxStringLength-f)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");u.push(p),f+=h}if(o){let d=Ie(e.state.env);if(Math.max(0,u.length-1)*U(d)>e.limits.maxStringLength-f)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u.join(d)],quoted:!0}}return{values:u,quoted:!0}}function Aw(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion")return null;let r=n.parts[0];if(r.operation)return null;let s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!s)return null;let i=s[1];if(rt(e,i)){let l=Ks(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let o=xe(e,i);if(o.length>0)return{values:o.map(([,l])=>l),quoted:!0};let a=e.state.env.get(i);return a!==void 0?{values:[a],quoted:!0}:{values:[],quoted:!0}}function Cw(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation)return null;let s=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)||!rt(e,s))return null;let i=Ks(e,s);if(!i)return null;let o=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!o)return null;let a=o[1],l=xe(e,a);if(l.length>0)return{values:l.map(([,u])=>u),quoted:!0};let c=e.state.env.get(a);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}Z();async function vw(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let o=i.parts[0],a=o.operation,l=await je(e,o.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!a.innerOp&&(l==="@"||l==="*")){let h=Number.parseInt(e.state.env.get("#")||"0",10),m=[];for(let g=1;g<=h;g++)m.push(e.state.env.get(String(g))||"");return l==="*"?{values:[m.join(Ie(e.state.env))],quoted:!0}:{values:m,quoted:!0}}return null}let u=c[1],f=c[2]==="*",d=xe(e,u);if(a.innerOp){if(a.innerOp.type==="Substring")return FN(e,d,u,f,a.innerOp);if(a.innerOp.type==="DefaultValue"||a.innerOp.type==="UseAlternative"||a.innerOp.type==="AssignDefault"||a.innerOp.type==="ErrorIfUnset")return MN(e,d,u,f,a.innerOp,s);if(a.innerOp.type==="Transform"&&a.innerOp.operator==="a"){let m=as(e,u),g=d.map(()=>m);return f?{values:[g.join(Ie(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let h=[];for(let[,m]of d){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:a.innerOp},b=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",m);try{let w=await r(e,g,!0);h.push(w)}finally{b!==void 0?e.state.env.set("_indirect_elem_",b):e.state.env.delete("_indirect_elem_")}}return f?{values:[h.join(Ie(e.state.env))],quoted:!0}:{values:h,quoted:!0}}if(d.length>0){let h=d.map(([,m])=>m);return f?{values:[h.join(Ie(e.state.env))],quoted:!0}:{values:h,quoted:!0}}let p=e.state.env.get(u);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}async function FN(e,t,n,r,s){let i=s.offset?await Re(e,s.offset.expression):0,o=s.length?await Re(e,s.length.expression):void 0,a=0;if(i<0){if(t.length>0){let u=t[t.length-1][0],d=(typeof u=="number"?u:0)+1+i;if(d<0)return{values:[],quoted:!0};if(a=t.findIndex(([p])=>typeof p=="number"&&p>=d),a<0)return{values:[],quoted:!0}}}else if(a=t.findIndex(([u])=>typeof u=="number"&&u>=i),a<0)return{values:[],quoted:!0};let l;if(o!==void 0){if(o<0)throw new Ve(`${n}[@]: substring expression < 0`);l=t.slice(a,a+o)}else l=t.slice(a);let c=l.map(([,u])=>u);return r?{values:[c.join(Ie(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function MN(e,t,n,r,s,i){let o=s.checkEmpty??!1,a=t.map(([,u])=>u),l=t.length===0,c=t.length===0;if(s.type==="UseAlternative")return!c&&!(o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(s.type==="DefaultValue")return(c||o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:r?{values:[a.join(Ie(e.state.env))],quoted:!0}:{values:a,quoted:!0};if(s.type==="AssignDefault"){if((c||o&&l)&&s.word){let f=await i(e,s.word.parts,!0);return we(e,n,0,f),{values:[f],quoted:!0}}return r?{values:[a.join(Ie(e.state.env))],quoted:!0}:{values:a,quoted:!0}}return r?{values:[a.join(Ie(e.state.env))],quoted:!0}:{values:a,quoted:!0}}async function kw(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="UseAlternative"&&t[0].operation?.type!=="DefaultValue")return null;let n=t[0],r=n.operation,s=r?.word;if(!s||s.parts.length!==1||s.parts[0].type!=="DoubleQuoted")return null;let i=s.parts[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let o=i.parts[0],l=(await je(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await Nr(e,n.parameter),u=await je(e,n.parameter)==="",f=r.checkEmpty??!1,d;if(r.type==="UseAlternative"?d=c&&!(f&&u):d=!c||f&&u,d){let p=l[1],h=l[2]==="*",m=xe(e,p);if(m.length>0){let b=m.map(([,w])=>w);return h?{values:[b.join(Ie(e.state.env))],quoted:!0}:{values:b,quoted:!0}}let g=e.state.env.get(p);return g!==void 0?{values:[g],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function Nw(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="Indirection")return null;let n=t[0],s=n.operation.innerOp;if(!s||s.type!=="UseAlternative"&&s.type!=="DefaultValue")return null;let i=s.word;if(!i||i.parts.length!==1||i.parts[0].type!=="DoubleQuoted")return null;let o=i.parts[0];if(o.parts.length!==1||o.parts[0].type!=="ParameterExpansion"||o.parts[0].operation?.type!=="Indirection")return null;let a=o.parts[0],c=(await je(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await je(e,n.parameter),f=await Nr(e,n.parameter),d=u==="",p=s.checkEmpty??!1,h;if(s.type==="UseAlternative"?h=f&&!(p&&d):h=!f||p&&d,h){let m=c[1],g=c[2]==="*",b=xe(e,m);if(b.length>0){let y=b.map(([,x])=>x);return g?{values:[y.join(Ie(e.state.env))],quoted:!0}:{values:y,quoted:!0}}let w=e.state.env.get(m);return w!==void 0?{values:[w],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}St();pt();Z();function Iw(e){let t=Number.parseInt(e.state.env.get("#")||"0",10);if(t>e.limits.maxArrayElements)throw new C(`positional parameter element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let n=[],r=0;for(let s=1;s<=t;s++){let i=e.state.env.get(String(s))||"",o=U(i);if(o>e.limits.maxStringLength-r)throw new C(`positional parameter string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");n.push(i),r+=o}return n}function zl(e,t,n){if(U(t)>n-U(e))throw new C(`positional expansion string limit exceeded (${n} bytes)`,"string_length");return e+t}function Nd(e,t,n,r){if(e.length>=r.limits.maxArrayElements)throw new C(`positional expansion element limit exceeded (${r.limits.maxArrayElements})`,"array_elements");let s=U(t);if(s>r.limits.maxStringLength-n.value)throw new C(`positional expansion string limit exceeded (${r.limits.maxStringLength} bytes)`,"string_length");e.push(t),n.value+=s}async function Ow(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let w=0;w<s.parts.length;w++){let y=s.parts[w];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="Substring"){i=w,o=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=Number.parseInt(e.state.env.get("#")||"0",10),d=[];for(let w=1;w<=f;w++)d.push(e.state.env.get(String(w))||"");let p=e.state.env.get("0")||"bash",h;if(c<=0){let w=[p,...d],y=w.length+c;if(y<0)h=[];else{let x=c<0?y:0;if(u!==void 0){let S=u<0?w.length+u:x+u;h=w.slice(x,Math.max(x,S))}else h=w.slice(x)}}else{let w=c-1;if(w>=d.length)h=[];else if(u!==void 0){let y=u<0?d.length+u:w+u;h=d.slice(w,Math.max(w,y))}else h=d.slice(w)}let m="";for(let w=0;w<i;w++)m+=await r(e,s.parts[w]);let g="";for(let w=i+1;w<s.parts.length;w++)g+=await r(e,s.parts[w]);if(h.length===0){let w=m+g;return{values:w?[w]:[],quoted:!0}}if(o){let w=Ie(e.state.env);return{values:[m+h.join(w)+g],quoted:!0}}return h.length===1?{values:[m+h[0]+g],quoted:!0}:{values:[m+h[0],...h.slice(1,-1),h[h.length-1]+g],quoted:!0}}async function Tw(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let w=0;w<s.parts.length;w++){let y=s.parts[w];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternReplacement"){i=w,o=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=Iw(e),u="";for(let w=0;w<i;w++)u=zl(u,await n(e,s.parts[w]),e.limits.maxStringLength);let f="";for(let w=i+1;w<s.parts.length;w++)f=zl(f,await n(e,s.parts[w]),e.limits.maxStringLength);if(c.length===0){let w=u+f;return{values:w?[w]:[],quoted:!0}}let d="";if(l.pattern)for(let w of l.pattern.parts)if(w.type==="Glob")d+=$e(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")d+=$e(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")d+=Fe(w.value);else if(w.type==="DoubleQuoted"){let y=await r(e,w.parts);d+=Fe(y)}else if(w.type==="ParameterExpansion"){let y=await n(e,w);d+=$e(y,!0,e.state.shoptOptions.extglob)}else{let y=await n(e,w);d+=Fe(y)}let p=l.replacement?await r(e,l.replacement.parts):"",h=d;l.anchor==="start"?h=`^${d}`:l.anchor==="end"&&(h=`${d}$`);let m=[],g={value:0};try{let w=ie(h,l.all?"g":"");for(let y of c){let x=0;w.lastIndex=0;for(let N=w.exec(y);N&&(x++,!!l.all);N=w.exec(y))N[0].length===0&&w.lastIndex++;let S=U(y),E=U(p),A=0,I=/\$(?:\$|&|\d+|<[^>]+>|`|')/g;for(;I.exec(p)!==null;)A++;if(S+x*E+x*A*S>e.limits.maxStringLength-g.value)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");Nd(m,w.replace(y,p),g,e)}}catch(w){if(w instanceof C)throw w;for(let y of c)Nd(m,y,g,e)}if(o){let w=Ie(e.state.env);if(g.value+Math.max(0,m.length-1)*U(w)+U(u)+U(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u+m.join(w)+f],quoted:!0}}if(U(u)+g.value+U(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return m.length===1?{values:[u+m[0]+f],quoted:!0}:{values:[u+m[0],...m.slice(1,-1),m[m.length-1]+f],quoted:!0}}async function Rw(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let b=0;b<s.parts.length;b++){let w=s.parts[b];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternRemoval"){i=b,o=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=Iw(e),u="";for(let b=0;b<i;b++)u=zl(u,await n(e,s.parts[b]),e.limits.maxStringLength);let f="";for(let b=i+1;b<s.parts.length;b++)f=zl(f,await n(e,s.parts[b]),e.limits.maxStringLength);if(c.length===0){let b=u+f;return{values:b?[b]:[],quoted:!0}}let d="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let b of l.pattern.parts)if(b.type==="Glob")d+=$e(b.pattern,l.greedy,p);else if(b.type==="Literal")d+=$e(b.value,l.greedy,p);else if(b.type==="SingleQuoted"||b.type==="Escaped")d+=Fe(b.value);else if(b.type==="DoubleQuoted"){let w=await r(e,b.parts);d+=Fe(w)}else if(b.type==="ParameterExpansion"){let w=await n(e,b);d+=$e(w,l.greedy,p)}else{let w=await n(e,b);d+=Fe(w)}let h=[],m={value:0};for(let b of c)Nd(h,fr(e,b,d,l.side,l.greedy),m,e);if(o){let b=Ie(e.state.env);if(m.value+Math.max(0,h.length-1)*U(b)+U(u)+U(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u+h.join(b)+f],quoted:!0}}if(U(u)+m.value+U(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return h.length===1?{values:[u+h[0]+f],quoted:!0}:{values:[u+h[0],...h.slice(1,-1),h[h.length-1]+f],quoted:!0}}async function $w(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0],s=-1,i=!1;for(let d=0;d<r.parts.length;d++){let p=r.parts[d];if(p.type==="ParameterExpansion"&&(p.parameter==="@"||p.parameter==="*")){s=d,i=p.parameter==="*";break}}if(s===-1)return null;let o=r.parts[s];if(o.type==="ParameterExpansion"&&o.operation)return null;let a=Number.parseInt(e.state.env.get("#")||"0",10),l="";for(let d=0;d<s;d++)l+=await n(e,r.parts[d]);let c="";for(let d=s+1;d<r.parts.length;d++)c+=await n(e,r.parts[d]);if(a===0){if(i)return{values:[l+c],quoted:!0};let d=l+c;return{values:d?[d]:[],quoted:!0}}let u=[];for(let d=1;d<=a;d++)u.push(e.state.env.get(String(d))||"");if(i){let d=Ie(e.state.env);return{values:[l+u.join(d)+c],quoted:!0}}return u.length===1?{values:[l+u[0]+c],quoted:!0}:{values:[l+u[0],...u.slice(1,-1),u[u.length-1]+c],quoted:!0}}ce();pt();Z();function Or(e,t,n,r){if(t.length>=e.limits.maxArrayElements)throw new C(`unquoted expansion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let s=U(n);if(s>e.limits.maxStringLength-r.value)throw new C(`unquoted expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");t.push(n),r.value+=s}function Id(e,t,n,r){let s=U(n),i=Math.max(0,t.length-1);if(s>0&&i>Math.floor((e.limits.maxStringLength-r)/s))throw new C(`unquoted expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return t.join(n)}function _N(e){return new is(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")})}async function Wl(e,t){if(e.state.options.noglob)return t;let n=_N(e),r=[];for(let s of t)if(Ir(s,e.state.shoptOptions.extglob)){let i=await n.expand(s);if(i.length>0)Kt(r,i,e.limits.maxArrayElements,"unquoted glob expansion");else{if(n.hasFailglob())throw new mr(s);n.hasNullglob()||r.push(s)}}else r.push(s);return r}async function Pw(e,t,n,r){let s=-1,i="",o=!1;for(let x=0;x<t.length;x++){let S=t[x];if(S.type==="ParameterExpansion"&&S.operation?.type==="PatternReplacement"){let E=S.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(E){s=x,i=E[1],o=E[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=xe(e,i),u=c.map(([,x])=>x);if(c.length===0){let x=e.state.env.get(i);x!==void 0&&(u=[x])}if(u.length===0)return{values:[],quoted:!1};let f="";if(l.pattern)for(let x of l.pattern.parts)if(x.type==="Glob")f+=$e(x.pattern,!0,e.state.shoptOptions.extglob);else if(x.type==="Literal")f+=$e(x.value,!0,e.state.shoptOptions.extglob);else if(x.type==="SingleQuoted"||x.type==="Escaped")f+=Fe(x.value);else if(x.type==="DoubleQuoted"){let S=await n(e,x.parts);f+=Fe(S)}else if(x.type==="ParameterExpansion"){let S=await r(e,x);f+=$e(S,!0,e.state.shoptOptions.extglob)}else{let S=await r(e,x);f+=Fe(S)}let d=l.replacement?await n(e,l.replacement.parts):"",p=f;l.anchor==="start"?p=`^${f}`:l.anchor==="end"&&(p=`${f}$`);let h=[],m={value:0};try{let x=ie(p,l.all?"g":"");for(let S of u)Or(e,h,_l(e,S,x,d,l.all),m)}catch(x){if(x instanceof C)throw x;for(let S of u)Or(e,h,S,m)}let g=Bt(e.state.env),b=Zt(e.state.env);if(o){let x=Ie(e.state.env),S=Id(e,h,x,m.value);return b?{values:S?[S]:[],quoted:!1}:{values:ot(S,g,e.limits.maxArrayElements),quoted:!1}}if(b)return{values:h,quoted:!1};let w=[],y={value:0};for(let x of h)if(x==="")Or(e,w,"",y);else for(let S of ot(x,g,e.limits.maxArrayElements))Or(e,w,S,y);return{values:w,quoted:!1}}async function Dw(e,t,n,r){let s=-1,i="",o=!1;for(let y=0;y<t.length;y++){let x=t[y];if(x.type==="ParameterExpansion"&&x.operation?.type==="PatternRemoval"){let S=x.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(S){s=y,i=S[1],o=S[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=xe(e,i),u=c.map(([,y])=>y);if(c.length===0){let y=e.state.env.get(i);y!==void 0&&(u=[y])}if(u.length===0)return{values:[],quoted:!1};let f="",d=e.state.shoptOptions.extglob;if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")f+=$e(y.pattern,l.greedy,d);else if(y.type==="Literal")f+=$e(y.value,l.greedy,d);else if(y.type==="SingleQuoted"||y.type==="Escaped")f+=Fe(y.value);else if(y.type==="DoubleQuoted"){let x=await n(e,y.parts);f+=Fe(x)}else if(y.type==="ParameterExpansion"){let x=await r(e,y);f+=$e(x,l.greedy,d)}else{let x=await r(e,y);f+=Fe(x)}let p=[],h={value:0};for(let y of u)Or(e,p,fr(e,y,f,l.side,l.greedy),h);let m=Bt(e.state.env),g=Zt(e.state.env);if(o){let y=Ie(e.state.env),x=Id(e,p,y,h.value);return g?{values:x?[x]:[],quoted:!1}:{values:ot(x,m,e.limits.maxArrayElements),quoted:!1}}if(g)return{values:p,quoted:!1};let b=[],w={value:0};for(let y of p)if(y==="")Or(e,b,"",w);else for(let x of ot(y,m,e.limits.maxArrayElements))Or(e,b,x,w);return{values:b,quoted:!1}}async function Lw(e,t,n,r){let s=-1,i=!1;for(let w=0;w<t.length;w++){let y=t[w];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){s=w,i=y.parameter==="*";break}}if(s===-1)return null;let a=t[s].operation,l=Number.parseInt(e.state.env.get("#")||"0",10),c=[];for(let w=1;w<=l;w++)c.push(e.state.env.get(String(w))||"");if(c.length===0)return{values:[],quoted:!1};let u="",f=e.state.shoptOptions.extglob;if(a.pattern)for(let w of a.pattern.parts)if(w.type==="Glob")u+=$e(w.pattern,a.greedy,f);else if(w.type==="Literal")u+=$e(w.value,a.greedy,f);else if(w.type==="SingleQuoted"||w.type==="Escaped")u+=Fe(w.value);else if(w.type==="DoubleQuoted"){let y=await n(e,w.parts);u+=Fe(y)}else if(w.type==="ParameterExpansion"){let y=await r(e,w);u+=$e(y,a.greedy,f)}else{let y=await r(e,w);u+=Fe(y)}let d=[],p={value:0};for(let w of c)Or(e,d,fr(e,w,u,a.side,a.greedy),p);let h=Bt(e.state.env),m=Zt(e.state.env);if(i){let w=Ie(e.state.env),y=Id(e,d,w,p.value);return m?{values:y?[y]:[],quoted:!1}:{values:ot(y,h,e.limits.maxArrayElements),quoted:!1}}if(m)return{values:d,quoted:!1};let g=[],b={value:0};for(let w of d)if(w==="")Or(e,g,"",b);else for(let y of ot(w,h,e.limits.maxArrayElements))Or(e,g,y,b);return{values:g,quoted:!1}}async function Fw(e,t,n,r){let s=-1,i=!1;for(let y=0;y<t.length;y++){let x=t[y];if(x.type==="ParameterExpansion"&&(x.parameter==="@"||x.parameter==="*")&&x.operation?.type==="Substring"){s=y,i=x.parameter==="*";break}}if(s===-1)return null;let a=t[s].operation,l=a.offset?await n(e,a.offset.expression):0,c=a.length?await n(e,a.length.expression):void 0,u=Number.parseInt(e.state.env.get("#")||"0",10),f=[];for(let y=1;y<=u;y++)f.push(e.state.env.get(String(y))||"");let d=e.state.env.get("0")||"bash",p;if(l<=0){let y=[d,...f],x=y.length+l;if(x<0)p=[];else{let S=l<0?x:0;if(c!==void 0){let E=c<0?y.length+c:S+c;p=y.slice(S,Math.max(S,E))}else p=y.slice(S)}}else{let y=l-1;if(y>=f.length)p=[];else if(c!==void 0){let x=c<0?f.length+c:y+c;p=f.slice(y,Math.max(y,x))}else p=f.slice(y)}let h="";for(let y=0;y<s;y++)h+=await r(e,t[y]);let m="";for(let y=s+1;y<t.length;y++)m+=await r(e,t[y]);let g=Bt(e.state.env),b=Zt(e.state.env);if(p.length===0){let y=h+m;return y?b?{values:[y],quoted:!1}:{values:ot(y,g,e.limits.maxArrayElements),quoted:!1}:{values:[],quoted:!1}}let w;if(i){let y=Ie(e.state.env),x=h+p.join(y)+m;b?w=x?[x]:[]:w=ot(x,g,e.limits.maxArrayElements)}else if(b)p.length===1?w=[h+p[0]+m]:w=[h+p[0],...p.slice(1,-1),p[p.length-1]+m];else{w=[];for(let y=0;y<p.length;y++){let x=p[y];if(y===0&&(x=h+x),y===p.length-1&&(x=x+m),x==="")w.push("");else{let S=ot(x,g,e.limits.maxArrayElements);Kt(w,S,e.limits.maxArrayElements,"unquoted expansion")}}}return{values:await Wl(e,w),quoted:!1}}async function Mw(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].parameter!=="@"&&t[0].parameter!=="*"||t[0].operation)return null;let n=t[0].parameter==="*",r=Number.parseInt(e.state.env.get("#")||"0",10);if(r===0)return{values:[],quoted:!1};let s=[];for(let c=1;c<=r;c++)s.push(e.state.env.get(String(c))||"");let i=Bt(e.state.env),o=Zt(e.state.env),a=Pl(e.state.env),l;if(n)if(o)l=s.filter(c=>c!=="");else{let c=Ie(e.state.env),u=s.join(c);l=ot(u,i,e.limits.maxArrayElements)}else if(o)l=s.filter(c=>c!=="");else if(a){l=[];for(let c of s){if(c==="")continue;let u=ot(c,i,e.limits.maxArrayElements);Kt(l,u,e.limits.maxArrayElements,"unquoted expansion")}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=ot(c,i,e.limits.maxArrayElements);Kt(l,u,e.limits.maxArrayElements,"unquoted expansion")}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await Wl(e,l),quoted:!1}}async function _w(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation)return null;let n=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let r=n[1],s=n[2]==="*",i=xe(e,r),o;if(i.length===0){let f=e.state.env.get(r);if(f!==void 0)o=[f];else return{values:[],quoted:!1}}else o=i.map(([,f])=>f);let a=Bt(e.state.env),l=Zt(e.state.env),c=Pl(e.state.env),u;if(s)if(l)u=o.filter(f=>f!=="");else{let f=Ie(e.state.env),d=o.join(f);u=ot(d,a,e.limits.maxArrayElements)}else if(l)u=o.filter(f=>f!=="");else if(c){u=[];for(let f of o){if(f==="")continue;let d=ot(f,a,e.limits.maxArrayElements);Kt(u,d,e.limits.maxArrayElements,"unquoted expansion")}}else{u=[];for(let f of o)if(f==="")u.push("");else{let d=ot(f,a,e.limits.maxArrayElements);Kt(u,d,e.limits.maxArrayElements,"unquoted expansion")}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await Wl(e,u),quoted:!1}}function Bw(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=_i(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=Bt(e.state.env),i=Zt(e.state.env),o;if(n.star)if(i)o=r;else{let a=Ie(e.state.env),l=r.join(a);o=ot(l,s,e.limits.maxArrayElements)}else if(i)o=r;else{o=[];for(let a of r){let l=ot(a,s,e.limits.maxArrayElements);Kt(o,l,e.limits.maxArrayElements,"unquoted expansion")}}return{values:o,quoted:!1}}function Uw(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=xe(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=Bt(e.state.env),o=Zt(e.state.env),a;if(n.star)if(o)a=s;else{let l=Ie(e.state.env),c=s.join(l);a=ot(c,i,e.limits.maxArrayElements)}else if(o)a=s;else{a=[];for(let l of s){let c=ot(l,i,e.limits.maxArrayElements);Kt(a,c,e.limits.maxArrayElements,"unquoted expansion")}}return{values:a,quoted:!1}}async function zw(e,t,n){let r=-1;for(let d=0;d<t.length;d++){let p=t[d];if(p.type==="ParameterExpansion"&&(p.parameter==="@"||p.parameter==="*")&&!p.operation){r=d;break}}if(r===-1||t.length<=1)return null;let s=Number.parseInt(e.state.env.get("#")||"0",10),i=[];for(let d=1;d<=s;d++)i.push(e.state.env.get(String(d))||"");let o="";for(let d=0;d<r;d++)o+=await n(e,t[d]);let a="";for(let d=r+1;d<t.length;d++)a+=await n(e,t[d]);let l=Bt(e.state.env),c=Zt(e.state.env),u=Pl(e.state.env);if(s===0){let d=o+a;return{values:d?[d]:[],quoted:!1}}let f;{let d=[];for(let p=0;p<i.length;p++){let h=i[p];p===0&&(h=o+h),p===i.length-1&&(h=h+a),d.push(h)}if(c)f=d.filter(p=>p!=="");else if(u){f=[];for(let p of d){if(p==="")continue;let h=ot(p,l,e.limits.maxArrayElements);Kt(f,h,e.limits.maxArrayElements,"unquoted expansion")}}else{f=[];for(let p of d)if(p==="")f.push("");else{let h=ot(p,l,e.limits.maxArrayElements);Kt(f,h,e.limits.maxArrayElements,"unquoted expansion")}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await Wl(e,f),quoted:!1}}async function Hw(e,t,n){e.coverage?.hit("bash:expansion:word_glob");let r=t.parts,{hasQuoted:s,hasCommandSub:i,hasArrayVar:o,hasArrayAtExpansion:a,hasParamExpansion:l,hasVarNamePrefixExpansion:c,hasIndirection:u}=Uo(r),d=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(d&&d.length>1)return BN(e,d,s);let p=await UN(e,r,a,c,u,n);if(p!==null)return p;let h=await WN(e,r,n);if(h!==null)return h;let m=await jN(e,r,n);if(m!==null)return m;let g=await VN(e,r,n.expandPart);if(g!==null)return jw(e,g);if((i||o||l)&&!Zt(e.state.env)){let w=Bt(e.state.env),y=n.buildIfsCharClassPattern(w),x=await n.smartWordSplit(e,r,w,y,n.expandPart);return jw(e,x)}let b=await n.expandWordAsync(e,t);return GN(e,t,r,b,s,n.expandWordForGlobbing)}async function BN(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&Ir(s,e.state.shoptOptions.extglob)){let i=await jl(e,s);Kt(r,i,e.limits.maxArrayElements,"brace/glob expansion")}else r.push(s);return{values:r,quoted:!1}}async function UN(e,t,n,r,s,i){if(n){let o=Aw(e,t);if(o!==null)return o}{let o=Cw(e,t);if(o!==null)return o}{let o=await ww(e,t);if(o!==null)return o}{let o=await bw(e,t,n,i.expandPart,i.expandWordPartsAsync);if(o!==null)return o}{let o=await xw(e,t,n,i.expandPart);if(o!==null)return o}{let o=await Ew(e,t,i.evaluateArithmetic);if(o!==null)return o}{let o=Sw(e,t);if(o!==null)return o}{let o=await gw(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}{let o=await yw(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let o=zN(e,t);if(o!==null)return o}{let o=await vw(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(o!==null)return o}{let o=await kw(e,t);if(o!==null)return o}{let o=await Nw(e,t);if(o!==null)return o}return null}function zN(e,t){let n=t[0];if(n.type!=="DoubleQuoted")return null;if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="VarNamePrefix"){let r=n.parts[0].operation,s=_i(e,r.prefix);return r.star?{values:[s.join(Ie(e.state.env))],quoted:!0}:{values:s,quoted:!0}}if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="ArrayKeys"){let r=n.parts[0].operation,i=xe(e,r.array).map(([o])=>String(o));return r.star?{values:[i.join(Ie(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function WN(e,t,n){{let r=await Ow(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await Tw(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await Rw(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await $w(e,t,n.expandPart);if(r!==null)return r}return null}async function jN(e,t,n){{let r=await Pw(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Dw(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Lw(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Fw(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await Mw(e,t);if(r!==null)return r}{let r=await _w(e,t);if(r!==null)return r}{let r=Bw(e,t);if(r!==null)return r}{let r=Uw(e,t);if(r!==null)return r}{let r=await zw(e,t,n.expandPart);if(r!==null)return r}return null}function Ww(e){if(e.type!=="DoubleQuoted")return null;for(let t=0;t<e.parts.length;t++){let n=e.parts[t];if(n.type!=="ParameterExpansion"||n.operation)continue;let r=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(r)return{type:"array",name:r[1],atIndex:t,isStar:r[2]==="*"};if(n.parameter==="@"||n.parameter==="*")return{type:"positional",atIndex:t,isStar:n.parameter==="*"}}return null}async function HN(e,t,n,r){let s="";for(let a=0;a<n.atIndex;a++)s+=await r(e,t.parts[a]);let i="";for(let a=n.atIndex+1;a<t.parts.length;a++)i+=await r(e,t.parts[a]);let o;if(n.type==="array"){if(o=xe(e,n.name).map(([,l])=>l),o.length===0){let l=e.state.env.get(n.name);l!==void 0&&(o=[l])}}else{let a=Number.parseInt(e.state.env.get("#")||"0",10);o=[];for(let l=1;l<=a;l++)o.push(e.state.env.get(String(l))||"")}if(n.isStar){let a=Ie(e.state.env),l=o.join(a);return[s+l+i]}if(o.length===0){let a=s+i;return a?[a]:[]}return o.length===1?[s+o[0]+i]:[s+o[0],...o.slice(1,-1),o[o.length-1]+i]}async function VN(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(Ww(l)){r=!0;break}if(!r)return null;let s=Bt(e.state.env),i=Zt(e.state.env),o=[];for(let l of t){let c=Ww(l);if(c&&l.type==="DoubleQuoted"){let u=await HN(e,l,c,n);o.push(u)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let u=await n(e,l);o.push([u])}else if(l.type==="Literal")o.push([l.value]);else if(l.type==="ParameterExpansion"){let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=ot(u,s,e.limits.maxArrayElements);o.push(f)}}else{let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=ot(u,s,e.limits.maxArrayElements);o.push(f)}}}let a=[];for(let l of o)if(l.length!==0)if(a.length===0)Kt(a,l,e.limits.maxArrayElements,"word expansion");else{let c=a.length-1;a[c]=a[c]+l[0];for(let u=1;u<l.length;u++)a.push(l[u])}return a}async function jw(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(Ir(r,e.state.shoptOptions.extglob)){let s=await jl(e,r);Kt(n,s,e.limits.maxArrayElements,"glob expansion")}else n.push(r);return{values:n,quoted:!1}}async function jl(e,t){let n=new is(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new mr(t);return n.hasNullglob()?[]:[t]}async function GN(e,t,n,r,s,i){let o=n.some(a=>a.type==="Glob");if(!e.state.options.noglob&&o){let a=await i(e,t);if(Ir(a,e.state.shoptOptions.extglob)){let c=await jl(e,a);if(c.length>0&&c[0]!==a)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=Cd(r);if(!Zt(e.state.env)){let c=Bt(e.state.env);return{values:ot(l,c,e.limits.maxArrayElements),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&Ir(r,e.state.shoptOptions.extglob)){let a=await i(e,t);if(Ir(a,e.state.shoptOptions.extglob)){let l=await jl(e,a);if(l.length>0&&l[0]!==a)return{values:l,quoted:!1}}}if(r===""&&!s)return{values:[],quoted:!1};if(o&&!s){let a=Cd(r);if(!Zt(e.state.env)){let l=Bt(e.state.env);return{values:ot(a,l,e.limits.maxArrayElements),quoted:!1}}return{values:[a],quoted:!1}}return{values:[r],quoted:s}}Z();function tn(e,t,n){if(t.length>=e.limits.maxArrayElements)throw new C(`word splitting element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");t.push(n)}async function Gw(e,t){let n=t.operation;if(!n||n.type!=="DefaultValue"&&n.type!=="AssignDefault"&&n.type!=="UseAlternative")return null;let r=n.word;if(!r||r.parts.length===0)return null;let s=await Nr(e,t.parameter),o=await je(e,t.parameter,!1)==="",a=n.checkEmpty??!1,l;return n.type==="UseAlternative"?l=s&&!(a&&o):l=!s||a&&o,l?r.parts:null}function qN(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function ZN(e,t){if(t.type!=="ParameterExpansion")return null;let n=await Gw(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>qN(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function KN(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?gd(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&j7(e))}async function qw(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let d=t[0],p=await Gw(e,d);if(p&&p.length>0&&p.length>1&&p.some(m=>m.type==="DoubleQuoted"||m.type==="SingleQuoted")&&p.some(m=>m.type==="Literal"||m.type==="ParameterExpansion"||m.type==="CommandSubstitution"||m.type==="ArithmeticExpansion"))return Vw(e,p,n,r,s)}let i=[],o=!1;for(let d of t){let p=KN(d),h=d.type==="DoubleQuoted"||d.type==="SingleQuoted",m=p?await ZN(e,d):null,g=await s(e,d);i.push({value:g,isSplittable:p,isQuoted:h,mixedDefaultParts:m??void 0}),p&&(o=!0)}if(!o){let d=i.map(p=>p.value).join("");return d?[d]:[]}let a=[],l="",c=!1,u=!1,f=!1;for(let d of i)if(!d.isSplittable)u?d.isQuoted&&d.value===""?(l!==""&&tn(e,a,l),tn(e,a,""),c=!0,l="",u=!1,f=!0):d.value!==""?(l!==""&&tn(e,a,l),l=d.value,u=!1,f=!1):(l+=d.value,f=!1):(l+=d.value,f=d.isQuoted&&d.value==="");else if(d.mixedDefaultParts){let p=await Vw(e,d.mixedDefaultParts,n,r,s);if(p.length!==0)if(p.length===1)l+=p[0],c=!0;else{l+=p[0],tn(e,a,l),c=!0;for(let h=1;h<p.length-1;h++)tn(e,a,p[h]);l=p[p.length-1]}u=!1,f=!1}else{let{words:p,hadLeadingDelimiter:h,hadTrailingDelimiter:m}=Dl(d.value,n,e.limits.maxArrayElements);if(f&&h&&l===""&&(tn(e,a,""),c=!0),p.length===0)m&&(u=!0);else if(p.length===1)l+=p[0],c=!0,u=m;else{l+=p[0],tn(e,a,l),c=!0;for(let g=1;g<p.length-1;g++)tn(e,a,p[g]);l=p[p.length-1],u=m}f=!1}return l!==""?tn(e,a,l):a.length===0&&c&&tn(e,a,""),a}function QN(e,t){return e.length>0&&t.includes(e[0])}async function Vw(e,t,n,r,s){let i=[];for(let u of t){let d=!(u.type==="DoubleQuoted"||u.type==="SingleQuoted"),p=await s(e,u);i.push({value:p,isSplittable:d})}let o=[],a="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(a!==""&&tn(e,o,a),a=u.value,c=!1):a+=u.value;else{QN(u.value,n)&&a!==""&&(tn(e,o,a),a="",l=!0);let{words:d,hadTrailingDelimiter:p}=Dl(u.value,n,e.limits.maxArrayElements);if(d.length===0)p&&(c=!0);else if(d.length===1)a+=d[0],l=!0,c=p;else{a+=d[0],tn(e,o,a),l=!0;for(let h=1;h<d.length-1;h++)tn(e,o,d[h]);a=d[d.length-1],c=p}}return a!==""?tn(e,o,a):o.length===0&&l&&tn(e,o,""),o}function Zw(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function Kw(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}ce();ce();ai();var Bi=class{baseFs;mounts=new Map;constructor(t){if(this.baseFs=t?.base??new lr,t?.mounts)for(let{mountPoint:n,filesystem:r}of t.mounts)this.mount(n,r)}mount(t,n){this.validateMountPath(t);let r=Ne(t);this.validateMount(r),this.mounts.set(r,{mountPoint:r,filesystem:n})}unmount(t){let n=Ne(t);if(!this.mounts.has(n))throw new Error(`No filesystem mounted at '${t}'`);this.mounts.delete(n)}getMounts(){return Array.from(this.mounts.values()).map(t=>({mountPoint:t.mountPoint,filesystem:t.filesystem}))}isMountPoint(t){let n=Ne(t);return this.mounts.has(n)}validateMountPath(t){let n=t.split("/");for(let r of n)if(r==="."||r==="..")throw new Error(`Invalid mount point '${t}': contains '.' or '..' segments`)}validateMount(t){if(t==="/")throw new Error("Cannot mount at root '/'");for(let n of this.mounts.keys())if(n!==t){if(t.startsWith(`${n}/`))throw new Error(`Cannot mount at '${t}': inside existing mount '${n}'`);if(n.startsWith(`${t}/`))throw new Error(`Cannot mount at '${t}': would contain existing mount '${n}'`)}}routePath(t){xt(t,"access");let n=Ne(t),r=null,s=0;for(let i of this.mounts.values()){let o=i.mountPoint;if(n===o)return{fs:i.filesystem,relativePath:"/"};n.startsWith(`${o}/`)&&o.length>s&&(r=i,s=o.length)}if(r){let i=n.slice(s);return{fs:r.filesystem,relativePath:i||"/"}}return{fs:this.baseFs,relativePath:n}}getChildMountPoints(t){let n=Ne(t),r=n==="/"?"/":`${n}/`,s=[];for(let i of this.mounts.keys())if(i.startsWith(r)){let a=i.slice(r.length).split("/")[0];a&&!s.includes(a)&&s.push(a)}return s}async readFile(t,n){let{fs:r,relativePath:s}=this.routePath(t);return r.readFile(s,n)}async readFileBytes(t){let{fs:n,relativePath:r}=this.routePath(t);return jt(n,r)}async readFileBuffer(t){let{fs:n,relativePath:r}=this.routePath(t);return n.readFileBuffer(r)}async writeFile(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.writeFile(i,n,r)}async appendFile(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.appendFile(i,n,r)}async exists(t){let n=Ne(t);if(this.mounts.has(n)||this.getChildMountPoints(n).length>0)return!0;let{fs:s,relativePath:i}=this.routePath(t);return s.exists(i)}async stat(t){let n=Ne(t),r=this.mounts.get(n);if(r)try{return await r.filesystem.stat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(n).length>0)try{return await this.baseFs.stat(n)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:i,relativePath:o}=this.routePath(t);return i.stat(o)}async lstat(t){let n=Ne(t),r=this.mounts.get(n);if(r)try{return await r.filesystem.lstat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(n).length>0)try{return await this.baseFs.lstat(n)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:i,relativePath:o}=this.routePath(t);return i.lstat(o)}async mkdir(t,n){let r=Ne(t);if(this.mounts.has(r)){if(n?.recursive)return;throw new Error(`EEXIST: directory already exists, mkdir '${t}'`)}if(this.getChildMountPoints(r).length>0&&n?.recursive)return;let{fs:i,relativePath:o}=this.routePath(t);return i.mkdir(o,n)}async readdir(t){let n=Ne(t),r=new Set,s=null,{fs:i,relativePath:o}=this.routePath(t);try{let l=await i.readdir(o);for(let c of l)r.add(c)}catch(l){let c=l.code,u=l.message||"";if(c!=="ENOENT"&&!u.includes("ENOENT"))throw l;s=l}let a=this.getChildMountPoints(n);for(let l of a)r.add(l);if(r.size===0&&s&&!this.mounts.has(n))throw s;return Array.from(r).sort()}async rm(t,n){let r=Ne(t);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot remove '${t}'`);if(this.getChildMountPoints(r).length>0)throw new Error(`EBUSY: contains mount points, cannot remove '${t}'`);let{fs:i,relativePath:o}=this.routePath(t);return i.rm(o,n)}async cp(t,n,r){if((await this.stat(t)).isDirectory&&Mn(t,n))throw new Error(`EINVAL: cannot copy '${t}' into itself, '${n}'`);let i=this.routePath(t),o=this.routePath(n);return i.fs===o.fs?i.fs.cp(i.relativePath,o.relativePath,r):this.crossMountCopy(t,n,r)}async mv(t,n){let r=Ne(t);if((await this.stat(t)).isDirectory&&Mn(t,n))throw new Error(`EINVAL: cannot move '${t}' into itself, '${n}'`);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot move '${t}'`);let i=this.routePath(t),o=this.routePath(n);if(i.fs===o.fs)return i.fs.mv(i.relativePath,o.relativePath);await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}resolvePath(t,n){return ca(t,n)}getAllPaths(){let t=new Set;for(let n of this.baseFs.getAllPaths())t.add(n);for(let n of this.mounts.keys()){let r=n.split("/").filter(Boolean),s="";for(let o of r)s=`${s}/${o}`,t.add(s);let i=this.mounts.get(n);if(i)for(let o of i.filesystem.getAllPaths())o==="/"?t.add(n):t.add(`${n}${o}`)}return Array.from(t).sort()}async chmod(t,n){let r=Ne(t),s=this.mounts.get(r);if(s)return s.filesystem.chmod("/",n);let{fs:i,relativePath:o}=this.routePath(t);return i.chmod(o,n)}async symlink(t,n){let{fs:r,relativePath:s}=this.routePath(n);return r.symlink(t,s)}async link(t,n){let r=this.routePath(t),s=this.routePath(n);if(r.fs!==s.fs)throw new Error(`EXDEV: cross-device link not permitted, link '${t}' -> '${n}'`);return r.fs.link(r.relativePath,s.relativePath)}async readlink(t){let{fs:n,relativePath:r}=this.routePath(t);return n.readlink(r)}async realpath(t){let n=Ne(t);if(this.mounts.get(n))return n;let{fs:s,relativePath:i}=this.routePath(t),o=await s.realpath(i);for(let[a,l]of this.mounts)if(n===a||n.startsWith(`${a}/`))return o==="/"?a:`${a}${o}`;return o}async crossMountCopy(t,n,r){let s=await this.lstat(t);if(s.isFile){let i=await this.readFileBuffer(t);await this.writeFile(n,i),await this.chmod(n,s.mode)}else if(s.isDirectory){if(!r?.recursive)throw new Error(`cp: ${t} is a directory (not copied)`);await this.mkdir(n,{recursive:!0});let i=await this.readdir(t);for(let o of i){let a=Nn(t,o),l=Nn(n,o);await this.crossMountCopy(a,l,r)}}else if(s.isSymbolicLink){let i=await this.readlink(t);await this.symlink(i,n)}}async utimes(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.utimes(i,n,r)}};Z();var Hl="/dev/fd",Xw=63,XN=10,Qw=Xw-XN+1,Od=class extends lr{isLiveDescriptor;constructor(t){super(),this.isLiveDescriptor=t}assertLiveDescriptor(t,n){this.isLiveDescriptor(t)||this.refuse(t,n)}refuse(t,n){throw new Error(`EROFS: read-only file system, ${n} '${Hl}${t}'`)}async writeFile(t,n,r){return this.assertLiveDescriptor(t,"write"),super.writeFile(t,n,r)}async appendFile(t,n,r){return this.assertLiveDescriptor(t,"append"),super.appendFile(t,n,r)}async rm(t,n){return this.assertLiveDescriptor(t,"rm"),super.rm(t,n)}async mkdir(t,n){this.refuse(t,"mkdir")}async cp(t,n){this.refuse(n,"cp")}async mv(t,n){this.refuse(n,"mv")}async symlink(t,n){this.refuse(n,"symlink")}async link(t,n){this.refuse(n,"link")}async chmod(t,n){this.refuse(t,"chmod")}async utimes(t,n,r){this.refuse(t,"utimes")}};function YN(e){let t=new Od(n=>Yw(e).some(r=>r.path===`${Hl}${n}`));e.fs=new Bi({base:e.fs,mounts:[{mountPoint:Hl,filesystem:t}]}),e.state.processSubstitutionFsMounted=!0}async function JN(e,t,n){try{await e.fs.writeFile(t,n,"binary");return}catch(r){if(e.state.processSubstitutionFsMounted)throw r;YN(e)}await e.fs.writeFile(t,n,"binary")}async function eI(e,t){try{await e.fs.rm(t,{force:!0})}catch{}}function Yw(e){let t=e.state.processSubstitutions;if(t)return t;let n=[];return e.state.processSubstitutions=n,n}async function Jw(e,t,n){let r=e.substitutionDepth??0,s=e.limits.maxSubstitutionDepth;if(r>=s)throw new C(`Process substitution nesting limit exceeded (${s})`,"substitution_depth");let i=e.substitutionDepth,o=new Map(e.state.env),a=Zn(e.state.arrays),l=e.state.cwd,c=e.state.bashPid,u=e.state.suppressVerbose,f=e.state.groupStdin,d=e.state.lastExitCode,p=e.state.env.get("?");e.substitutionDepth=r+1,e.state.bashPid=e.state.nextVirtualPid++,e.state.suppressVerbose=!0,n!==void 0&&(e.state.groupStdin=n);let h;try{h=await e.executeScript(t)}catch(m){if(m instanceof C)throw m;if(m instanceof ye)return{stdout:m.stdout,stderr:m.stderr,exitCode:m.exitCode};throw m}finally{e.substitutionDepth=i,e.state.env=o,e.state.arrays=a,e.state.cwd=l,e.state.bashPid=c,e.state.suppressVerbose=u,e.state.groupStdin=f,e.state.lastExitCode=d,p!==void 0?e.state.env.set("?",p):e.state.env.delete("?")}return h}async function e4(e,t){let n=Yw(e);if(n.length>=Qw)throw new C(`Process substitution limit exceeded (${Qw} concurrent)`,"file_descriptors");let r="";if(t.direction==="input"){let o=await Jw(e,t.body,void 0);if(o.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+o.stderr),r=Vr(o),r.length>e.limits.maxStringLength)throw new C(`process substitution: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length")}let s=Xw-n.length,i=`${Hl}/${s}`;n.push({fd:s,path:i,direction:t.direction,body:t.body});try{await JN(e,i,r)}catch(o){throw n.pop(),o}return i}function t4(e){return e.state.processSubstitutions?.length??0}var tI={stdout:"",stderr:""};async function Td(e,t){let n=e.state.processSubstitutions;if(!n||n.length<=t)return tI;let r="",s="";for(;n.length>t;){let i=n[n.length-1],o="";if(i.direction==="output")try{o=await jt(e.fs,i.path)}catch{}if(await eI(e,i.path),n.pop(),i.direction==="output"){let a=await Jw(e,i.body,o);r+=Vr(a),s+=a.stderr}}return{stdout:r,stderr:s}}function cs(e,t,n){if(e.length>t)throw new C(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}async function pr(e,t,n=!1){let r=[];for(let s of t)r.push(await $n(e,s,n));return r.join("")}function nI(e){return Kw(e)}function r4(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!nI(t))return!1;return!0}function rI(e,t,n=!1){let r=Zw(t);if(r!==null)return r;switch(t.type){case"TildeExpansion":return n?t.user===null?"~":`~${t.user}`:(e.coverage?.hit("bash:expansion:tilde"),t.user===null?e.state.env.get("HOME")??"/home/user":t.user==="root"?"/root":`~${t.user}`);case"Glob":return vd(e,t.pattern);default:return null}}async function Be(e,t){return $d(e,t)}async function s4(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped")n.push(Mi(r.value));else if(r.type==="SingleQuoted")n.push(r.value);else if(r.type==="DoubleQuoted"){let s=await pr(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await $n(e,r);n.push(Mi(s))}else n.push(await $n(e,r));return n.join("")}async function i4(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped"){let s=r.value;"()|*?[]".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="SingleQuoted")n.push(Rn(r.value));else if(r.type==="DoubleQuoted"){let s=await pr(e,r.parts);n.push(Rn(s))}else n.push(await $n(e,r));return n.join("")}async function o4(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Rn(r.value));else if(r.type==="Escaped"){let s=r.value;"*?[]\\()|".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="DoubleQuoted"){let s=await pr(e,r.parts);n.push(Rn(s))}else r.type==="Glob"?pw(r.pattern)?n.push(await mw(e,r.pattern)):n.push(vd(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await $n(e,r));return n.join("")}function Gl(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&Gl(t.parts))return!0;return!1}var n4=1e5;async function a4(e,t,n={count:0}){let r=()=>{n.count++,e.executionScope.consumeLimited("brace_operations",1,Math.min(n4,e.limits.maxBraceExpansionResults),"brace expansion")},s=(o,a)=>{if(o.length>=e.limits.maxBraceExpansionResults)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");r(),o.push(a)},i=[[]];for(let o of t)if(o.type==="BraceExpansion"){let a=[],l=!1,c="";for(let d of o.items)if(d.type==="Range"){let p=Ad(d.start,d.end,d.step,d.startStr,d.endStr,{maxResults:e.limits.maxBraceExpansionResults,maxStringBytes:e.limits.maxStringLength});if(p.expanded)for(let h of p.expanded)s(a,h);else{l=!0,c=p.literal;break}}else{let p=await a4(e,d.word.parts,n);for(let h of p){let m=[];for(let g of h)typeof g=="string"?m.push(g):m.push(await $n(e,g));s(a,m.join(""))}}if(l){for(let d of i)r(),d.push(c);continue}if(i.length*a.length>e.limits.maxBraceExpansionResults||n.count>n4)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");let f=[];for(let d of i)for(let p of a){if(f.length>=e.limits.maxBraceExpansionResults)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");r(),f.push([...d,p])}i=f}else for(let a of i)r(),a.push(o);return i}async function l4(e,t){let n=t.parts;if(!Gl(n))return[await Be(e,t)];let r=await a4(e,n),s=[];for(let i of r){let o=[];for(let a of i)typeof a=="string"?o.push(a):o.push(await $n(e,a));s.push(kd(e,o.join("")))}return s}function sI(){return{expandWordAsync:$d,expandWordForGlobbing:o4,expandWordWithBracesAsync:l4,expandWordPartsAsync:pr,expandPart:$n,expandParameterAsync:Vl,hasBraceExpansion:Gl,evaluateArithmetic:Re,buildIfsCharClassPattern:H7,smartWordSplit:qw}}async function hr(e,t){return Hw(e,t,sI())}function iI(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function Rd(e,t){if(Number.parseInt(e.state.env.get("#")||"0",10)<2)return!1;function r(s){for(let i of s)if(i.type==="DoubleQuoted"){for(let o of i.parts)if(o.type==="ParameterExpansion"&&o.parameter==="@"&&!o.operation)return!0}return!1}return r(t.parts)}async function c4(e,t){if(Rd(e,t))return{error:`bash: $@: ambiguous redirect
861
+ `};let n=t.parts,{hasQuoted:r}=Uo(n);if(Gl(n)&&(await l4(e,t)).length>1)return{error:`bash: ${n.map(p=>p.type==="Literal"?p.value:p.type==="BraceExpansion"?`{${p.items.map(m=>{if(m.type==="Range"){let g=m.step?`..${m.step}`:"";return`${m.startStr??m.start}..${m.endStr??m.end}${g}`}return m.word.parts.map(g=>g.type==="Literal"?g.value:"").join("")}).join(",")}}`:"").join("")}: ambiguous redirect
862
+ `};let s=await $d(e,t),{hasParamExpansion:i,hasCommandSub:o}=Uo(n);if((i||o)&&!r&&!Zt(e.state.env)){let f=Bt(e.state.env);if(ot(s,f,e.limits.maxArrayElements).length>1)return{error:`bash: $${iI(n)}: ambiguous redirect
863
+ `}}if(r||e.state.options.noglob||n.some(f=>f.type==="ProcessSubstitution"))return{target:s};let l=await o4(e,t);if(!Ir(l,e.state.shoptOptions.extglob))return{target:s};let c=new is(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")}),u=await c.expand(l);return u.length===0?c.hasFailglob()?{error:`bash: no match: ${s}
864
+ `}:{target:s}:u.length===1?{target:u[0]}:{error:`bash: ${s}: ambiguous redirect
865
+ `}}async function $d(e,t){let n=t.parts,r=n.length;if(r===1){let o=await $n(e,n[0]);return cs(o,e.limits.maxStringLength,"word expansion"),o}let s=[];for(let o=0;o<r;o++)s.push(await $n(e,n[o]));let i=s.join("");return cs(i,e.limits.maxStringLength,"word expansion"),i}async function $n(e,t,n=!1){if(t.type==="ParameterExpansion")return Vl(e,t,n);let r=rI(e,t,n);if(r!==null)return r;switch(t.type){case"DoubleQuoted":{let s=[];for(let i of t.parts)s.push(await $n(e,i,!0));return s.join("")}case"CommandSubstitution":{let s=X7(t.body);if(s)try{let p=await Be(e,s.target),h=p.startsWith("/")?p:`${e.state.cwd}/${p}`,m=await e.fs.readFile(h);e.state.lastExitCode=0,e.state.env.set("?","0");let g=m.replace(/\n+$/,"");return cs(g,e.limits.maxStringLength,"command substitution"),g}catch(p){if(p instanceof C)throw p;return e.state.lastExitCode=1,e.state.env.set("?","1"),""}let i=e.substitutionDepth??0,o=e.limits.maxSubstitutionDepth;if(i>=o)throw new C(`Command substitution nesting limit exceeded (${o})`,"substitution_depth");let a=e.substitutionDepth;e.substitutionDepth=i+1;let l=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let c=new Map(e.state.env),u=Zn(e.state.arrays),f=e.state.cwd,d=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let p=await e.executeScript(t.body),h=p.exitCode;e.state.env=c,e.state.arrays=u,e.state.cwd=f,e.state.suppressVerbose=d,e.state.lastExitCode=h,e.state.env.set("?",String(h)),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr),e.state.bashPid=l,e.substitutionDepth=a;let m=p.stdout.replace(/\n+$/,"");return cs(m,e.limits.maxStringLength,"command substitution"),m}catch(p){if(e.state.env=c,e.state.arrays=u,e.state.cwd=f,e.state.bashPid=l,e.substitutionDepth=a,e.state.suppressVerbose=d,p instanceof C)throw p;if(p instanceof ye){e.state.lastExitCode=p.exitCode,e.state.env.set("?",String(p.exitCode)),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr);let h=p.stdout.replace(/\n+$/,"");return cs(h,e.limits.maxStringLength,"command substitution"),h}throw p}}case"ProcessSubstitution":return e4(e,t);case"ArithmeticExpansion":{let s=t.expression.originalText;if(s&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(s)){let o=await Q7(e,s),a=new be,l=_e(a,o);return String(await Re(e,l.expression,!0))}return String(await Re(e,t.expression.expression,!0))}case"BraceExpansion":{let s=[];for(let i of t.items)if(i.type==="Range"){let o=Ad(i.start,i.end,i.step,i.startStr,i.endStr,{maxResults:e.limits.maxBraceExpansionResults,maxStringBytes:e.limits.maxStringLength});if(o.expanded)s.push(...o.expanded);else return o.literal}else s.push(await Be(e,i.word));return s.join(" ")}default:return""}}async function Vl(e,t,n=!1){let{parameter:r}=t,{operation:s}=t,i=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let[,d,p]=i;if(e.state.associativeArrays?.has(d)||p.includes("$(")||p.includes("`")||p.includes("${")){let m=await Ed(e,p);r=`${d}[${m}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&rt(e,r)){let d=fn(e,r);if(d&&d!==r){let p=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(p){let[,h,m]=p;if(e.state.associativeArrays?.has(h)||m.includes("$(")||m.includes("`")||m.includes("${")){let b=await Ed(e,m);r=`${h}[${b}]`}}}}let o=s&&(s.type==="DefaultValue"||s.type==="AssignDefault"||s.type==="UseAlternative"||s.type==="ErrorIfUnset"),a=await je(e,r,!o);if(!s)return a;let l=!await Nr(e,r),{isEmpty:c,effectiveValue:u}=dw(e,r,a,n),f={value:a,isUnset:l,isEmpty:c,effectiveValue:u,inDoubleQuotes:n};switch(s.type){case"DefaultValue":return J7(e,s,f,pr);case"AssignDefault":return ew(e,r,s,f,pr);case"ErrorIfUnset":return tw(e,r,s,f,pr);case"UseAlternative":return nw(e,s,f,pr);case"PatternRemoval":{let d=await rw(e,a,s,pr,$n);return cs(d,e.limits.maxStringLength,"pattern removal"),d}case"PatternReplacement":{let d=await sw(e,a,s,pr,$n);return cs(d,e.limits.maxStringLength,"pattern replacement"),d}case"Length":return iw(e,r,a);case"LengthSliceError":throw new rn(r);case"BadSubstitution":throw new rn(s.text);case"Substring":return ow(e,r,a,s);case"CaseModification":{let d=await aw(e,a,s,pr,Vl);return cs(d,e.limits.maxStringLength,"case modification"),d}case"Transform":return lw(e,r,a,l,s);case"Indirection":return cw(e,r,a,l,s,Vl,n);case"ArrayKeys":return uw(e,s);case"VarNamePrefix":return fw(e,s);default:return a}}function f4(){return{visited:new Set,depth:0}}function oI(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":if(t===0)throw new Ve("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new Ve("division by 0");return e%t;case"**":if(t<0)throw new Ve("exponent less than 0");return e**t;case"<<":return e<<t;case">>":return e>>t;case"<":return e<t?1:0;case"<=":return e<=t?1:0;case">":return e>t?1:0;case">=":return e>=t?1:0;case"==":return e===t?1:0;case"!=":return e!==t?1:0;case"&":return e&t;case"|":return e|t;case"^":return e^t;case",":return t;default:return 0}}function u4(e,t,n){switch(n){case"=":return t;case"+=":return e+t;case"-=":return e-t;case"*=":return e*t;case"/=":return t!==0?Math.trunc(e/t):0;case"%=":return t!==0?e%t:0;case"<<=":return e<<t;case">>=":return e>>t;case"&=":return e&t;case"|=":return e|t;case"^=":return e^t;default:return t}}function aI(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function lI(e,t){let n=e.state.env.get(t);if(n!==void 0)return n;let r=Xe(e,t,0);return r!==void 0?r:await je(e,t)}async function cI(e,t,n){if(!t)return 0;let r=Number.parseInt(t,10);if(!Number.isNaN(r)&&/^-?\d+$/.test(t.trim()))return r;let s=t.trim();if(!s)return 0;let i=new be,{expr:o,pos:a}=Fi(i,s,0);if(a<s.length){let l=s.slice(a).trim(),c=l.split(/\s+/)[0]||l;throw new Ve(`syntax error in expression (error token is "${c}")`,"","")}return await zi(e,o,!1,n)}async function ql(e,t,n,r){if(r.depth>100)throw new Ve("maximum variable indirection depth exceeded");if(r.visited.has(t))throw new Ve(`arithmetic variable cycle detected at ${t}`);r.visited.add(t),r.depth++;try{return await cI(e,n,r)}finally{r.depth--,r.visited.delete(t)}}async function Pd(e,t,n){if(n.depth>100)throw new Ve("maximum variable indirection depth exceeded");if(n.visited.has(t))throw new Ve(`arithmetic variable cycle detected at ${t}`);n.visited.add(t),n.depth++;try{let r=await lI(e,t);if(!r)return 0;let s=Number.parseInt(r,10);if(!Number.isNaN(s)&&/^-?\d+$/.test(r.trim()))return s;let i=r.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return await Pd(e,i,n);let o=new be,{expr:a,pos:l}=Fi(o,i,0);if(l<i.length){let c=i.slice(l).trim(),u=c.split(/\s+/)[0]||c;throw new Ve(`${i}: syntax error in expression (error token is "${u}")`)}return await zi(e,a,!1,n)}finally{n.depth--,n.visited.delete(t)}}async function Zl(e,t){if(t.startsWith("#")){let f=t.slice(1),d=f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(d){let h=d[1],m=xe(e,h);return String(m.length)}let p=e.state.env.get(f)||"";return String(p.length)}if(t.startsWith("!")){let f=t.slice(1),d=e.state.env.get(f)||"";return e.state.env.get(d)||""}let n=[":-",":=",":?",":+","-","=","?","+"],r=-1,s="";for(let f of n){let d=t.indexOf(f);d>0&&(r===-1||d<r)&&(r=d,s=f)}if(r===-1)return await je(e,t);let i=t.slice(0,r),o=t.slice(r+s.length),a=e.state.env.get(i),l=a===void 0,c=a==="",u=s.startsWith(":");switch(s){case":-":case"-":return l||u&&c?o:a||"";case":=":case"=":return l||u&&c?(e.state.env.set(i,o),o):a||"";case":+":case"+":return!(l||u&&c)?o:"";case":?":case"?":{if(l||u&&c)throw new Error(o||`${i}: parameter null or not set`);return a||""}default:return a||""}}async function Re(e,t,n=!1){return zi(e,t,n,f4())}async function zi(e,t,n,r){let s=(i,o=n)=>zi(e,i,o,r);switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new Ve("value too great for base");return t.value;case"ArithVariable":return await Pd(e,t.name,r);case"ArithSpecialVar":{let o=(await je(e,t.name)).trim();if(!o)return 0;let a=Number.parseInt(o,10);if(!Number.isNaN(a)&&/^-?\d+$/.test(o))return a;let l=new be,{expr:c}=Fi(l,o,0);return await s(c)}case"ArithNested":return await s(t.expression);case"ArithCommandSubst":{if(e.execFn){let i=await e.execFn(t.command,{signal:e.state.signal});i.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+i.stderr);let o=i.stdout.trim();return Number.parseInt(o,10)||0}return 0}case"ArithBracedExpansion":{let i=await Zl(e,t.content);return Number.parseInt(i,10)||0}case"ArithDynamicBase":{let i=await Zl(e,t.baseExpr),o=Number.parseInt(i,10);if(o<2||o>64)return 0;let a=`${o}#${t.value}`;return Fo(a)}case"ArithDynamicNumber":{let o=await Zl(e,t.prefix)+t.suffix;return Fo(o)}case"ArithArrayElement":{let i=e.state.associativeArrays?.has(t.array),o=async a=>{let l=Xe(e,t.array,a);return l!==void 0?await ql(e,`${t.array}[${a}]`,l,r):0};if(t.stringKey!==void 0)return await o(t.stringKey);if(i&&t.index?.type==="ArithVariable"&&!t.index.hasDollarPrefix)return await o(t.index.name);if(i&&t.index?.type==="ArithVariable"&&t.index.hasDollarPrefix){let a=await je(e,t.index.name);return await o(a)}if(t.index){let a=await s(t.index);if(a<0){let u=xe(e,t.array),f=e.state.currentLine;if(u.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${f}: ${t.array}: bad array subscript
866
+ `,0;let p=Math.max(...u.map(([h])=>typeof h=="number"?h:0))+1+a;if(p<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${f}: ${t.array}: bad array subscript
867
+ `,0;a=p}let l=`${t.array}[${a}]`,c=Xe(e,t.array,a);if(c!==void 0)return ql(e,l,c,r);if(a===0){let u=e.state.env.get(t.array);if(u!==void 0)return ql(e,t.array,u,r)}if(e.state.options.nounset&&!(e.state.env.has(t.array)||Gt(e,t.array)))throw new Jt(`${t.array}[${a}]`);return 0}return 0}case"ArithDoubleSubscript":throw new Ve("double subscript","","");case"ArithNumberSubscript":throw new Ve(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new Ve(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new Ve(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await s(t.left)||await s(t.right)?1:0;if(t.operator==="&&")return await s(t.left)&&await s(t.right)?1:0;let i=await s(t.left),o=await s(t.right);return oI(i,o,t.operator)}case"ArithUnary":{let i=await s(t.operand);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let o=t.operand.name,a=Number.parseInt(await je(e,o),10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}if(t.operand.type==="ArithArrayElement"){let o=t.operand.array,a=e.state.associativeArrays?.has(o),l;if(t.operand.stringKey!==void 0)l=t.operand.stringKey;else if(a&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)l=t.operand.index.name;else if(a&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix)l=await je(e,t.operand.index.name);else if(t.operand.index){let f=await s(t.operand.index);l=String(f)}else return i;let c=Number.parseInt(Xe(e,o,l)||"0",10)||0,u=t.operator==="++"?c+1:c-1;return we(e,o,l,String(u),a?"associative":"indexed"),t.prefix?u:c}if(t.operand.type==="ArithConcat"){let o="";for(let a of t.operand.parts)o+=await Ui(e,a,n,r);if(o&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}}if(t.operand.type==="ArithDynamicElement"){let o="";if(t.operand.nameExpr.type==="ArithConcat")for(let a of t.operand.nameExpr.parts)o+=await Ui(e,a,n,r);else t.operand.nameExpr.type==="ArithVariable"&&(o=t.operand.nameExpr.hasDollarPrefix?await je(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(o&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){let a=await s(t.operand.subscript),l=Number.parseInt(Xe(e,o,a)||"0",10)||0,c=t.operator==="++"?l+1:l-1;return we(e,o,a,String(c)),t.prefix?c:l}}return i}return aI(i,t.operator)}case"ArithTernary":return await s(t.condition)?await s(t.consequent):await s(t.alternate);case"ArithAssignment":{let i=t.variable,o=i,a;if(t.stringKey!==void 0)a=t.stringKey;else if(t.subscript){let d=e.state.associativeArrays?.has(i);if(d&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)a=t.subscript.name;else if(d&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix)a=await je(e,t.subscript.name)||"\\";else if(d){let p=await s(t.subscript);a=String(p)}else{let p=await s(t.subscript);if(p<0){let h=xe(e,i);h.length>0&&(p=Math.max(...h.map(([g])=>typeof g=="number"?g:0))+1+p)}a=String(p)}}let l=a===void 0?e.state.env.get(o):Xe(e,i,a),c=Number.parseInt(l||"0",10)||0,u=await s(t.value),f=u4(c,u,t.operator);return a===void 0?e.state.env.set(o,String(f)):we(e,i,a,String(f),e.state.associativeArrays?.has(i)?"associative":"indexed"),f}case"ArithGroup":return await s(t.expression);case"ArithConcat":{let i="";for(let o of t.parts)i+=await Ui(e,o,n,r);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)?await Pd(e,i,r):Number.parseInt(i,10)||0}case"ArithDynamicAssignment":{let i="";if(t.target.type==="ArithConcat")for(let u of t.target.parts)i+=await Ui(e,u,n,r);else t.target.type==="ArithVariable"&&(i=t.target.hasDollarPrefix?await je(e,t.target.name):t.target.name);if(!i||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return 0;let o=i;if(t.subscript){let u=await s(t.subscript);o=`${i}_${u}`}let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=await s(t.value),c=u4(a,l,t.operator);return e.state.env.set(o,String(c)),c}case"ArithDynamicElement":{let i="";if(t.nameExpr.type==="ArithConcat")for(let c of t.nameExpr.parts)i+=await Ui(e,c,n,r);else t.nameExpr.type==="ArithVariable"&&(i=t.nameExpr.hasDollarPrefix?await je(e,t.nameExpr.name):t.nameExpr.name);if(!i||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return 0;let o=await s(t.subscript),a=`${i}_${o}`,l=e.state.env.get(a);return l!==void 0?ql(e,a,l,r):0}default:return 0}}async function Ui(e,t,n=!1,r=f4()){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await zi(e,t,n,r));case"ArithVariable":return t.hasDollarPrefix?await je(e,t.name):t.name;case"ArithSpecialVar":return await je(e,t.name);case"ArithBracedExpansion":return await Zl(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let s="";for(let i of t.parts)s+=await Ui(e,i,n,r);return s}default:return String(await zi(e,t,n,r))}}St();Z();async function d4(e,t){let n="",r=0;for(let S of t.parts){let E=S.type==="Literal"?S.value:"\0",A=U(E);if(A>e.limits.maxStringLength-r)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");n+=E,r+=A}let s=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!s||!n.endsWith(")"))return null;let i=s[1],o=[],a=[],l=!1,c="",u=0,f=0,d=!1,p=!0,h=S=>{let E=U(S);if(E>e.limits.maxStringLength-f-u)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");c+=S,u+=E},m=(S,E=!1)=>{if(o.length>=e.limits.maxArrayElements)throw new C(`array assignment element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let A=U(S);if(A>e.limits.maxStringLength-f)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");o.push(S),a.push(E),f+=A},g=()=>{m(c,p),c="",u=0,d=!1,p=!0};for(let S of t.parts)if(S.type==="Literal"){let E=S.value;if(!l){let A=E.indexOf("=(");A!==-1&&(l=!0,E=E.slice(A+2))}if(l){E.endsWith(")")&&(E=E.slice(0,-1));for(let A of E)/\s/.test(A)?(c||d)&&g():h(A)}}else if(l)if(S.type==="BraceExpansion")if(/^\[.+\]=/.test(c))h(Di({type:"Word",parts:[S]}));else{(c||d)&&g();let A=await hr(e,{type:"Word",parts:[S]});for(let I of A.values)m(I)}else{(S.type==="SingleQuoted"||S.type==="DoubleQuoted"||S.type==="Escaped")&&(d=!0),p=!1;let E=await Be(e,{type:"Word",parts:[S]});h(E)}(c||d)&&g();let b=o.splice(0),w=a.splice(0);f=0;for(let S=0;S<b.length;S++){let E=b[S];if(!w[S]){m(E);continue}let A=E.match(/^(\[[^\]]+\]=)(.*)$/s);if(A){let I=ls(e,A[2]);E=A[1]+I}if(E.includes("{")&&E.includes("}")){let I=new be().parseWordFromString(E,!1,!1);if(I.parts.some($=>$.type==="BraceExpansion")){let $=await hr(e,I);for(let N of $.values)m(N);continue}}m(E)}let y=[`${i}=(`],x=U(y[0]);for(let S=0;S<o.length;S++){let E=o[S],A;/^\[.+\]=/.test(E)?A=E:E===""?A="''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(E)&&!E.startsWith("'")&&!E.startsWith('"')?A=`'${E.replace(/'/g,"'\\''")}'`:A=E;let I=`${S>0?" ":""}${A}`,$=U(I);if($+1>e.limits.maxStringLength-x)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");y.push(I),x+=$}return y.push(")"),y.join("")}async function p4(e,t){let n=-1,r=-1,s=!1;for(let m=0;m<t.parts.length;m++){let g=t.parts[m];if(g.type==="Literal"){let b=g.value.indexOf("+=");if(b!==-1){let y=g.value.slice(0,b);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(y)){n=m,r=b,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(y)){n=m,r=b,s=!0;break}}let w=g.value.indexOf("=");if(w!==-1&&(w===0||g.value[w-1]!=="+")){let y=g.value.slice(0,w);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(y)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(y)){n=m,r=w;break}}}}if(n===-1)return null;let i=t.parts.slice(0,n),o=t.parts[n];if(o.type!=="Literal")return null;let a=s?2:1,l=o.value.slice(0,r),c=o.value.slice(r+a),u=t.parts.slice(n+1),f="";for(let m of i)f+=await Be(e,{type:"Word",parts:[m]});f+=l;let d={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},p=d.parts.length>0?await Be(e,d):"";return`${f}${s?"+=":"="}${p}`}var uI=["tar","yq","xan","sqlite3","python3","python"];function h4(e){return uI.includes(e)}ce();Nt();_n();Er();vn();Ni();xs();Z();Z();var Me=Object.freeze({stdout:"",stderr:"",exitCode:0,internalStdinConsumed:0});function Pe(e=""){return{stdout:e,stderr:"",exitCode:0}}function K(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function Q(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function Ot(e){return{stdout:"",stderr:"",exitCode:e?0:1,internalStdinConsumed:0}}function us(e,t,n="",r=""){throw new C(e,t,n,r)}function m4(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new C(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function Dd(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new gr;return Me}if(t.length>1)throw new ye(1,"",`bash: break: too many arguments
868
+ `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new ye(128,"",`bash: break: ${t[0]}: numeric argument required
869
+ `);n=r}throw new Qt(n)}async function Ld(e,t){let n,r=!1,s=!1,i=0;for(;i<t.length;)if(t[i]==="--"){i++;break}else if(t[i]==="-L")s=!1,i++;else if(t[i]==="-P")s=!0,i++;else if(t[i].startsWith("-")&&t[i]!=="-")i++;else break;let o=t.slice(i);if(o.length===0||o[0]==="~"?n=e.state.env.get("HOME")||"/":o[0]==="-"?(n=e.state.previousDir,r=!0):n=o[0],!n.startsWith("/")&&!n.startsWith("./")&&!n.startsWith("../")&&n!=="."&&n!==".."){let f=e.state.env.get("CDPATH");if(f){let d=f.split(":").filter(p=>p);for(let p of d){let h=p.startsWith("/")?`${p}/${n}`:`${e.state.cwd}/${p}/${n}`;try{if((await e.fs.stat(h)).isDirectory){n=h,r=!0;break}}catch{}}}}let l=(n.startsWith("/")?n:`${e.state.cwd}/${n}`).split("/").filter(f=>f&&f!=="."),c="";for(let f of l)if(f==="..")c=c.split("/").slice(0,-1).join("/")||"/";else{c=c?`${c}/${f}`:`/${f}`;try{if(!(await e.fs.stat(c)).isDirectory)return K(`bash: cd: ${n}: Not a directory
870
+ `)}catch{return K(`bash: cd: ${n}: No such file or directory
871
+ `)}}let u=c||"/";if(s)try{u=await e.fs.realpath(u)}catch{}return e.state.previousDir=e.state.cwd,e.state.cwd=u,e.state.env.set("PWD",e.state.cwd),e.state.env.set("OLDPWD",e.state.previousDir),Pe(r?`${u}
872
+ `:"")}At();ce();pt();Z();function Fd(e,t){return e.fs.resolvePath(e.state.cwd,t)}var fI=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function Kl(e){return fI.includes(e)}async function Ql(e,t,n){let r=Fd(e,n);switch(t){case"-e":case"-a":return e.fs.exists(r);case"-f":return await e.fs.exists(r)?(await e.fs.stat(r)).isFile:!1;case"-d":return await e.fs.exists(r)?(await e.fs.stat(r)).isDirectory:!1;case"-r":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&256)!==0:!1;case"-w":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&128)!==0:!1;case"-x":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&64)!==0:!1;case"-s":return await e.fs.exists(r)?(await e.fs.stat(r)).size>0:!1;case"-L":case"-h":try{return(await e.fs.lstat(r)).isSymbolicLink}catch{return!1}case"-k":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&512)!==0:!1;case"-g":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&1024)!==0:!1;case"-u":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&2048)!==0:!1;case"-G":case"-O":return e.fs.exists(r);case"-b":return!1;case"-c":return["/dev/null","/dev/zero","/dev/random","/dev/urandom","/dev/tty","/dev/stdin","/dev/stdout","/dev/stderr"].includes(r);case"-p":return!1;case"-S":return!1;case"-t":return!1;case"-N":return e.fs.exists(r);default:return!1}}var dI=["-nt","-ot","-ef"];function Xl(e){return dI.includes(e)}async function Yl(e,t,n,r){let s=Fd(e,n),i=Fd(e,r);switch(t){case"-nt":{let[o,a]=await Promise.all([e.fs.stat(s).catch(()=>null),e.fs.stat(i).catch(()=>null)]);return o!==null&&(a===null||o.mtime>a.mtime)}case"-ot":{let[o,a]=await Promise.all([e.fs.stat(s).catch(()=>null),e.fs.stat(i).catch(()=>null)]);return a!==null&&(o===null||o.mtime<a.mtime)}case"-ef":try{let[o,a]=await Promise.all([e.fs.realpath(s),e.fs.realpath(i)]);if(o===a)return!0;let[l,c]=await Promise.all([e.fs.stat(s),e.fs.stat(i)]);return l.dev!==void 0&&l.ino!==void 0&&c.dev!==void 0&&c.ino!==void 0?l.dev===c.dev&&l.ino===c.ino:l.identity&&c.identity?l.identity===c.identity:!1}catch{return!1}default:return!1}}var pI=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function Jl(e){return pI.has(e)}function ec(e,t,n){switch(e){case"-eq":return t===n;case"-ne":return t!==n;case"-lt":return t<n;case"-le":return t<=n;case"-gt":return t>n;case"-ge":return t>=n}}function jo(e){return e==="="||e==="=="||e==="!="}function tc(e,t,n,r=!1,s=!1,i=!1,o=256){if(r){let l=Wi(t,n,s,i,o);return e==="!="?!l:l}if(s){let l=t.toLowerCase()===n.toLowerCase();return e==="!="?!l:l}let a=t===n;return e==="!="?!a:a}var hI=new Set(["-z","-n"]);function nc(e){return hI.has(e)}function rc(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}async function sc(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let r=n[1],s=n[2];if(e.state.associativeArrays?.has(r)){let a=s;return(a.startsWith("'")&&a.endsWith("'")||a.startsWith('"')&&a.endsWith('"'))&&(a=a.slice(1,-1)),a=a.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(l,c)=>e.state.env.get(c)||""),ts(e,r,a)}let o;try{let a=new be,l=_e(a,s);o=await Re(e,l.expression)}catch{if(/^-?\d+$/.test(s))o=Number.parseInt(s,10);else{let a=e.state.env.get(s);o=a?Number.parseInt(a,10):0}}if(o<0){let a=Mt(e,r),l=e.state.currentLine;if(a.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
873
+ `,!1;if(o=Math.max(...a)+1+o,o<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
874
+ `,!1}return ts(e,r,o)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?kr(e,t).length>0:Mt(e,t).length>0}async function fs(e,t){switch(t.type){case"CondBinary":{let n=await Be(e,t.left),r=t.right.parts.length>0&&t.right.parts.every(i=>i.type==="SingleQuoted"||i.type==="DoubleQuoted"||i.type==="Escaped"&&t.operator!=="=~"),s;if(t.operator==="=~")if(r){let i=await Be(e,t.right);s=Mi(i)}else s=await s4(e,t.right);else jo(t.operator)&&!r?s=await i4(e,t.right):s=await Be(e,t.right);if(jo(t.operator)){let i=e.state.shoptOptions.nocasematch;return tc(t.operator,n,s,!r,i,!0,e.limits.maxCallDepth)}if(Jl(t.operator))return ec(t.operator,await y4(e,n),await y4(e,s));if(Xl(t.operator))return Yl(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,o=bI(s),l=ie(o,i?"i":"").match(n);if(vt(e,"BASH_REMATCH"),l)for(let c=0;c<l.length;c++)we(e,"BASH_REMATCH",c,l[c]||"");return l!==null}catch{throw new Error("syntax error in regular expression")}case"<":return n<s;case">":return n>s;default:return!1}}case"CondUnary":{let n=await Be(e,t.operand);return Kl(t.operator)?Ql(e,t.operator,n):nc(t.operator)?rc(t.operator,n):t.operator==="-v"?await sc(e,n):t.operator==="-o"?_d(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await Be(e,t.operand.expression.word)})`!=="":!await fs(e,t.operand);case"CondAnd":return await fs(e,t.left)?await fs(e,t.right):!1;case"CondOr":return await fs(e,t.left)?!0:await fs(e,t.right);case"CondGroup":return await fs(e,t.expression);case"CondWord":return await Be(e,t.word)!=="";default:return!1}}async function Ho(e,t){if(t.length===0)return Q("","",1);if(t.length===1)return Ot(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?K(`test: '(' without matching ')'
875
+ `,2):Kl(r)?Ot(await Ql(e,r,s)):nc(r)?Ot(rc(r,s)):r==="!"?Ot(!s):r==="-v"?Ot(await sc(e,s)):r==="-o"?Ot(_d(e,s)):r==="="||r==="=="||r==="!="||r==="<"||r===">"||r==="-eq"||r==="-ne"||r==="-lt"||r==="-le"||r==="-gt"||r==="-ge"||r==="-nt"||r==="-ot"||r==="-ef"?K(`test: ${r}: unary operator expected
876
+ `,2):Q("","",1)}if(t.length===3){let r=t[0],s=t[1],i=t[2];if(jo(s))return Ot(tc(s,r,i));if(Jl(s)){let o=ic(r),a=ic(i);return!o.valid||!a.valid?Q("","",2):Ot(ec(s,o.value,a.value))}if(Xl(s))return Ot(await Yl(e,s,r,i));switch(s){case"-a":return Ot(r!==""&&i!=="");case"-o":return Ot(r!==""||i!=="");case">":return Ot(r>i);case"<":return Ot(r<i)}if(r==="!"){let o=await Ho(e,[s,i]);return Q("",o.stderr,o.exitCode===0?1:o.exitCode===1?0:o.exitCode)}if(r==="("&&i===")")return Ot(s!=="")}if(t.length===4){if(t[0]==="!"){let r=await Ho(e,t.slice(1));return Q("",r.stderr,r.exitCode===0?1:r.exitCode===1?0:r.exitCode)}if(t[0]==="("&&t[3]===")")return Ho(e,[t[1],t[2]])}let n=await b4(e,t,0);return n.pos<t.length?K(`test: too many arguments
877
+ `,2):Ot(n.value)}async function b4(e,t,n){return mI(e,t,n)}async function mI(e,t,n){let{value:r,pos:s}=await g4(e,t,n);for(;t[s]==="-o";){let i=await g4(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function g4(e,t,n){let{value:r,pos:s}=await Md(e,t,n);for(;t[s]==="-a";){let i=await Md(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Md(e,t,n){let r=e.executionScope.enterDepth("test_expression",e.limits.maxCallDepth,"test expression");try{if(t[n]==="!"){let{value:s,pos:i}=await Md(e,t,n+1);return{value:!s,pos:i}}return gI(e,t,n)}finally{r.release()}}async function gI(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:o}=await b4(e,t,n+1);return{value:i,pos:t[o]===")"?o+1:o}}let s=t[n+1];if(jo(s)){let i=r,o=t[n+2]??"";return{value:tc(s,i,o),pos:n+3}}if(Jl(s)){let i=ic(r),o=ic(t[n+2]??"0");return!i.valid||!o.valid?{value:!1,pos:n+3}:{value:ec(s,i.value,o.value),pos:n+3}}if(Xl(s)){let i=r,o=t[n+2]??"";return{value:await Yl(e,s,i,o),pos:n+3}}if(Kl(r)){let i=t[n+1]??"";return{value:await Ql(e,r,i),pos:n+2}}if(nc(r)){let i=t[n+1]??"";return{value:rc(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await sc(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:_d(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function Wi(e,t,n=!1,r=!1,s=256){r&&yI(t,s);let i=`^${x4(t,r)}$`;return ie(i,n?"is":"s").test(e)}function yI(e,t){let n=0,r=[];for(let s=0;s<e.length;s++){if(e[s]==="\\"){s++;continue}if(e[s]==="("){let i=s>0&&"@*+?!".includes(e[s-1]);if(r.push(i),i&&n++,n>t)throw new C(`extglob maximum depth (${t}) exceeded`,"recursion")}else e[s]===")"&&r.length>0&&r.pop()&&n--}}function x4(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=E4(e,r+1);if(i!==-1){let o=e.slice(r+2,i),a=S4(o),l=a.map(u=>x4(u,t)),c=l.length>0?l.join("|"):"(?:)";if(s==="@")n+=`(?:${c})`;else if(s==="*")n+=`(?:${c})*`;else if(s==="+")n+=`(?:${c})+`;else if(s==="?")n+=`(?:${c})?`;else if(s==="!")if(i<e.length-1){let f=a.map(p=>A4(p,t));if(f.every(p=>p!==null)&&f.every(p=>p===f[0])&&f[0]!==null){let p=f[0];if(p===0)n+="(?:.+)";else{let h=[];p>0&&h.push(`.{0,${p-1}}`),h.push(`.{${p+1},}`),h.push(`(?!(?:${c})).{${p}}`),n+=`(?:${h.join("|")})`}}else n+=`(?:(?!(?:${c})).)*?`}else n+=`(?!(?:${c})$).*`;r=i;continue}}if(s==="\\")if(r+1<e.length){let i=e[r+1];/[\\^$.|+(){}[\]*?]/.test(i)?n+=`\\${i}`:n+=i,r++}else n+="\\\\";else if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=e.indexOf("]",r+1);i!==-1?(n+=e.slice(r,i+1),r=i):n+="\\["}else/[\\^$.|+(){}]/.test(s)?n+=`\\${s}`:n+=s}return n}function E4(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function S4(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function A4(e,t){let n=0,r=0;for(;r<e.length;){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=E4(e,r+1);if(i!==-1){if(s==="@"){let o=e.slice(r+2,i),l=S4(o).map(c=>A4(c,t));if(l.every(c=>c!==null)&&l.every(c=>c===l[0])){n+=l[0],r=i+1;continue}return null}return null}}if(s==="*")return null;if(s==="?"){n+=1,r++;continue}if(s==="["){let i=e.indexOf("]",r+1);if(i!==-1){n+=1,r=i+1;continue}n+=1,r++;continue}if(s==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}function _d(e,t){let r=new Map([["errexit",()=>e.state.options.errexit===!0],["nounset",()=>e.state.options.nounset===!0],["pipefail",()=>e.state.options.pipefail===!0],["xtrace",()=>e.state.options.xtrace===!0],["e",()=>e.state.options.errexit===!0],["u",()=>e.state.options.nounset===!0],["x",()=>e.state.options.xtrace===!0]]).get(t);return r?r():!1}async function y4(e,t){if(t=t.trim(),t==="")return 0;if(/^[+-]?(\d+#[a-zA-Z0-9@_]+|0[xX][0-9a-fA-F]+|0[0-7]+|\d+)$/.test(t))return w4(t);try{let n=new be,r=_e(n,t);return await Re(e,r.expression)}catch{return w4(t)}}function wI(e,t){let n=0;for(let r of e){let s;if(r>="0"&&r<="9")s=r.charCodeAt(0)-48;else if(r>="a"&&r<="z")s=r.charCodeAt(0)-97+10;else if(r>="A"&&r<="Z")s=r.charCodeAt(0)-65+36;else if(r==="@")s=62;else if(r==="_")s=63;else return Number.NaN;if(s>=t)return Number.NaN;n=n*t+s}return n}function w4(e){if(e=e.trim(),e==="")return 0;let t=!1;e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1));let n,r=e.match(/^(\d+)#([a-zA-Z0-9@_]+)$/);if(r){let s=Number.parseInt(r[1],10);s>=2&&s<=64?n=wI(r[2],s):n=0}else/^0[xX][0-9a-fA-F]+$/.test(e)?n=Number.parseInt(e,16):/^0[0-7]+$/.test(e)?n=Number.parseInt(e,8):n=Number.parseInt(e,10);return Number.isNaN(n)&&(n=0),t?-n:n}function ic(e){if(e=e.trim(),e==="")return{value:0,valid:!0};let t=!1;if(e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1)),!/^\d+$/.test(e))return{value:0,valid:!1};let n=Number.parseInt(e,10);return Number.isNaN(n)?{value:0,valid:!1}:{value:t?-n:n,valid:!0}}function bI(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)t+=e[n]+e[n+1],n+=2;else if(e[n]==="["){let r=xI(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function xI(e,t){let n=t+1,r="[";n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++);let s=!1;n<e.length&&e[n]==="]"&&(s=!0,n++);let i=!1;n<e.length&&e[n]==="["&&n+1<e.length&&e[n+1]!==":"&&(i=!0,n++);let o="",a=!1;for(;n<e.length;){let l=e[n];if(l==="]"){a=!0,n++;break}if(l==="["&&n+1<e.length&&e[n+1]===":"){let c=e.indexOf(":]",n+2);if(c!==-1){let u=e.slice(n+2,c);o+=EI(u),n=c+2;continue}}if(l==="["&&n+1<e.length){let c=e[n+1];if(c==="."||c==="="){let u=`${c}]`,f=e.indexOf(u,n+2);if(f!==-1){let d=e.slice(n+2,f);o+=d,n=f+2;continue}}}if(l==="\\"&&n+1<e.length){o+=l+e[n+1],n+=2;continue}o+=l,n++}return a?(s&&(r+="\\]"),i&&(r+="\\["),r+=o,r+="]",{converted:r,endIndex:n}):{converted:"\\[",endIndex:t+1}}function EI(e){return new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]).get(e)??""}Z();ce();Z();function Bd(e,t,n){if(n&&e.length>=n.maxElements)throw new C(`array element limit exceeded (${n.maxElements})`,"array_elements");e.push(t)}function Wr(e,t){if(t&&U(e)>t.maxStringBytes)throw new C(`array assignment string limit exceeded (${t.maxStringBytes} bytes)`,"string_length");let n=[],r="",s=!1,i=!1,o=!1,a=!1;for(let l of e){if(o){r+=l,o=!1,a=!0;continue}if(l==="\\"){o=!0;continue}if(l==="'"&&!i){s||(a=!0),s=!s;continue}if(l==='"'&&!s){i||(a=!0),i=!i;continue}if((l===" "||l===" "||l===`
878
+ `)&&!s&&!i){a&&(Bd(n,r,t),r="",a=!1);continue}r+=l,a=!0}return a&&Bd(n,r,t),n}function oc(e,t){if(t&&U(e)>t.maxStringBytes)throw new C(`array assignment string limit exceeded (${t.maxStringBytes} bytes)`,"string_length");let n=[],r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;if(e[r]!=="["){r++;continue}r++;let s="";if(e[r]==="'"||e[r]==='"'){let o=e[r];for(r++;r<e.length&&e[r]!==o;)s+=e[r],r++;e[r]===o&&r++}else for(;r<e.length&&e[r]!=="]"&&e[r]!=="=";)s+=e[r],r++;for(;r<e.length&&e[r]!=="]";)r++;if(e[r]==="]"&&r++,e[r]!=="=")continue;r++;let i="";if(e[r]==="'"||e[r]==='"'){let o=e[r];for(r++;r<e.length&&e[r]!==o;)e[r]==="\\"&&r+1<e.length&&r++,i+=e[r],r++;e[r]===o&&r++}else for(;r<e.length&&!/\s/.test(e[r]);)i+=e[r],r++;Bd(n,[s,i],t)}return n}function C4(e,t){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(n)return{name:n[1],isArray:!0,arrayElements:Wr(n[2],t)};let r=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(r)return{name:r[1],isArray:!1,arrayIndex:r[2],value:r[3]};if(e.includes("=")){let s=e.indexOf("=");return{name:e.slice(0,s),isArray:!1,value:e.slice(s+1)}}return{name:e,isArray:!1}}async function SI(e,t){try{let n=new be,r=_e(n,t);return await Re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function v4(e,t,n={}){let{name:r,isArray:s,arrayElements:i,value:o,arrayIndex:a}=t,{makeReadonly:l=!1,checkReadonly:c=!0}=n;if(c){let u=st(e,r);if(u)return u}if(s&&i){e.executionScope.consumeWork(i.length,"array assignment");let u=zt(e,r),f=u?un(u):void 0,d=e.state.env.get(r);try{vt(e,r);for(let p=0;p<i.length;p++)we(e,r,p,i[p]);e.state.env.delete(r)}catch(p){throw e.state.arrays??=new Map,f?e.state.arrays.set(r,f):e.state.arrays.delete(r),d===void 0?e.state.env.delete(r):e.state.env.set(r,d),p}}else if(a!==void 0&&o!==void 0){let u=await SI(e,a);we(e,r,u,o)}else o!==void 0&&e.state.env.set(r,o);return l&&Cn(e,r),null}function ds(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function Ud(e,t){return e.state.localVarDepth?.get(t)}function ac(e,t){e.state.localVarDepth?.delete(t)}function k4(e,t,n){e.state.localVarStack=e.state.localVarStack||new Map;let r=e.state.localVarStack.get(t)||[];r.push({value:n,scopeIndex:e.state.localScopes.length-1}),e.state.localVarStack.set(t,r)}function lc(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function N4(e,t){if(e.state.localVarStack)for(let[n,r]of e.state.localVarStack.entries()){for(;r.length>0&&r[r.length-1].scopeIndex===t;)r.pop();r.length===0&&e.state.localVarStack.delete(n)}}Z();ce();Z();var zd="__file__:",Wd="__file_append__:",Vd="__rw__:",jd="__dupout__:",Hd="__dupin__:",Tt=3;function AI(e){let t=e.slice(Vd.length),n=t.indexOf(":");if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let s=n+1,i=t.slice(s,s+r),o=t.slice(s+r+1),a=o.indexOf(":");if(a===-1)return null;let l=Number.parseInt(o.slice(0,a),10);return Number.isNaN(l)||l<0?null:{path:i,position:l,content:o.slice(a+1)}}function I4(e,t){let n=Number.parseInt(e.slice(t.length),10);return Number.isNaN(n)?null:n}function CI(e){if(e.startsWith(zd))return{kind:"output",path:e.slice(zd.length),append:!1};if(e.startsWith(Wd))return{kind:"output",path:e.slice(Wd.length),append:!0};if(e.startsWith(Vd)){let t=AI(e);if(t)return{kind:"readwrite",...t}}if(e.startsWith(jd)){let t=I4(e,jd);if(t!==null)return{kind:"dup-out",sourceFd:t}}if(e.startsWith(Hd)){let t=I4(e,Hd);if(t!==null)return{kind:"dup-in",sourceFd:t}}return{kind:"input",content:e}}function Gd(e){switch(e.kind){case"input":return e.content;case"output":return`${e.append?Wd:zd}${e.path}`;case"readwrite":return`${Vd}${e.path.length}:${e.path}:${e.position}:${e.content}`;case"dup-out":return`${jd}${e.sourceFd}`;case"dup-in":return`${Hd}${e.sourceFd}`;case"closed":throw new Error("Closed descriptors have no table encoding")}}function vI(e){return e.state.fileDescriptors??=new Map,e.state.fileDescriptors}function kI(e,t,n){n?(e.state.inputFds??=new Set,e.state.inputFds.add(t)):e.state.inputFds?.delete(t)}function ji(e,t){return e.state.fdAliases?.get(t)}function ps(e,t){return[...ji(e,t)??[t]]}function O4(e,t){let n=ji(e,t);if(n&&(n.delete(t),e.state.fdAliases?.delete(t),n.size<2))for(let r of n)e.state.fdAliases?.delete(r)}function qd(e,t,n){if(t===n)return;e.state.fdAliases??=new Map;let r=ji(e,n)??new Set([n]);r.add(t);for(let s of r)e.state.fdAliases.set(s,r)}function cc(e,t){return e.state.fileDescriptors?.get(t)}function Pn(e,t){let n=cc(e,t);if(n!==void 0)return e.state.inputFds?.has(t)?{kind:"input",content:n}:CI(n)}function Qs(e,t){return e.state.fileDescriptors?.has(t)===!0}function Zd(e,t,n,r){let s=vI(e);s.has(t)||m4(e),s.set(t,n),kI(e,t,r)}function uc(e,t,n,r=!1){O4(e,t),Zd(e,t,n,r)}function Xn(e,t,n){uc(e,t,Gd(n),n.kind==="input")}function Tr(e,t){e.state.fileDescriptors?.delete(t),e.state.inputFds?.delete(t),O4(e,t)}function fc(e,t,n){let r=cc(e,n);return r===void 0?!1:(uc(e,t,r,e.state.inputFds?.has(n)===!0),qd(e,t,n),!0)}function Kd(e,t,n){let r=cc(e,n);if(r===void 0)return!1;if(t===n)return!0;let s=e.state.inputFds?.has(n)===!0,i=[...ji(e,n)??[]].filter(a=>a!==n);Tr(e,n),uc(e,t,r,s);let o=i.find(a=>Qs(e,a));return o!==void 0&&qd(e,t,o),!0}function dc(e,t){let n=Pn(e,t);if(n===void 0)return{error:"not-open"};switch(n.kind){case"input":return{content:n.content};case"readwrite":return{content:n.content.slice(n.position)};case"output":case"dup-out":return{error:"write-only"};case"dup-in":return{error:"not-open"};case"closed":return{error:"not-open"}}}function hs(e,t,n){let r=Pn(e,t);if(r===void 0)return;let s;if(r.kind==="input")s={kind:"input",content:r.content.slice(n)};else if(r.kind==="readwrite")s={...r,position:r.position+n};else return;let i=Gd(s),o=s.kind==="input";for(let a of ji(e,t)??[t])Zd(e,a,i,o)}async function Qd(e,t,n,r,s){if(t.kind==="output")return await e.fs.appendFile(t.path,r,s),!0;let o=n.map(u=>Pn(e,u)).find(u=>u?.kind==="readwrite")??t;if(o.kind!=="readwrite")return!1;let a=o.content.slice(0,o.position)+r+o.content.slice(o.position+r.length),l={...o,position:o.position+r.length,content:a};await e.fs.writeFile(o.path,a,s);let c=Gd(l);for(let u of n)Qs(e,u)&&Zd(e,u,c,!1);return!0}function ms(e,t,n){if(t.has(n))return;let r=ji(e,n);t.set(n,{raw:cc(e,n),isInput:e.state.inputFds?.has(n)===!0,aliases:r?[...r].filter(s=>s!==n):[]})}function pc(e,t){let n=e.state.fileDescriptors;if(n)for(let[r,{raw:s,isInput:i,aliases:o}]of t){if(s===void 0){Tr(e,r);continue}uc(e,r,s,i);let a=o.find(l=>n.has(l));a!==void 0&&qd(e,r,a)}}function Xd(e){switch(e.operator){case"<":case"<>":case"<<":case"<<-":case"<<<":case"<&":return e.fd??0;case">":case">>":case">|":case">&":return e.fd??1;default:return null}}function T4(e){if(e.fdVariable)return!1;let t=Xd(e);return t!==null&&t>=Tt}async function NI(e,t,n,r){try{if(!await e.fs.exists(t))return null;if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
879
+ `;if(r.checkNoclobber&&e.state.options.noclobber&&!r.isClobber&&n!=="/dev/null")return`bash: ${n}: cannot overwrite existing file
880
+ `}catch{return`bash: ${n}: cannot open redirect target
881
+ `}return null}function R4(e){let n=Math.min(e.length,8192);for(let r=0;r<n;r++)if(e.charCodeAt(r)>127)return"utf8";return"binary"}var Vo="scoped",P4="bare",D4="persistent",II=e=>new C(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors"),OI=(e,t)=>Qs(e,t)||(e.state.fileDescriptors?.size??0)<e.limits.maxFileDescriptors,$4=e=>{let t=Math.max(e.state.nextFd??10,10);for(;Qs(e,t);)t+=1;return t},hc=e=>{let t=e.endsWith("-"),n=t?e.slice(0,-1):e;return/^\d+$/.test(n)?{sourceFd:Number.parseInt(n,10),move:t}:null},TI=(e,t,n)=>{let r=Pn(e,t);return t<Tt?r?{kind:"entry",entry:r,descriptors:ps(e,t)}:{kind:"standard",fd:t}:r?n?r.kind==="input"||r.kind==="readwrite"||r.kind==="dup-in"?{kind:"entry",entry:r,descriptors:ps(e,t)}:null:r.kind==="output"||r.kind==="readwrite"||r.kind==="dup-out"?{kind:"entry",entry:r,descriptors:ps(e,t)}:null:null};async function Hi(e,t,n,r,s=!0){let i=e.fs.resolvePath(e.state.cwd,t),o=await NI(e,i,t,{checkNoclobber:!n,isClobber:r});if(o)return{error:Q("",o,1)};if(t==="/dev/full")return{error:Q("",`bash: /dev/full: No space left on device
882
+ `,1)};if(t==="/dev/stdout")return{entry:{kind:"dup-out",sourceFd:1}};if(t==="/dev/stderr")return{entry:{kind:"dup-out",sourceFd:2}};try{n?await e.fs.appendFile(i,"","binary"):await e.fs.writeFile(i,"","binary")}catch(a){if(!s)throw a;return{error:Q("",`bash: ${t}: cannot open redirect target
883
+ `,1)}}return{entry:{kind:"output",path:i,append:n}}}async function Yd(e,t,n){let r=e.fs.resolvePath(e.state.cwd,t);try{let s=await e.fs.readFile(r);return n?{entry:{kind:"readwrite",path:r,position:0,content:s}}:{entry:{kind:"input",content:s}}}catch{if(!n)return{error:Q("",`bash: ${t}: No such file or directory
884
+ `,1)};try{return await e.fs.writeFile(r,"","binary"),{entry:{kind:"readwrite",path:r,position:0,content:""}}}catch{return{error:Q("",`bash: ${t}: No such file or directory
885
+ `,1)}}}}var RI=async(e,t)=>{let n=await Be(e,t.content);return t.stripTabs?n.split(`
886
+ `).map(r=>r.replace(/^\t+/,"")).join(`
887
+ `):n};async function $I(e,t,n,r){let s=new Map,i=new Map,o=(w,y)=>e.state.closedStandardFds?.has(w)?{kind:"closed"}:Pn(e,w)??y,a=new Map([[0,o(0,{kind:"dup-in",sourceFd:0})],[1,o(1,{kind:"dup-out",sourceFd:1})],[2,o(2,{kind:"dup-out",sourceFd:2})]]),l=r.numericSnapshot,c,u=-1,f=a.get(0);f?.kind==="input"?(c=f.content,u=0):f?.kind==="readwrite"&&(c=f.content.slice(f.position),u=0);let d=()=>({targets:s,dupSources:i,standardRoutes:a,stdin:c,stdinSourceFd:u,error:null}),p=async(w,y,x)=>{let S={...d(),error:await gs(e,w,t.slice(0,y),s,i,a)};return x?{...S,errorCause:x}:S},h=async(w,y)=>{if(OI(e,w))return null;let x=II(e);return p(Q("",x.stderr,C.EXIT_CODE),y,x)},m=(w,y)=>{w!==null&&w<Tt&&a.set(w,y),r.policy==="persistent"&&w!==null&&w<Tt&&(e.state.closedStandardFds?.delete(w),Xn(e,w,y))},g=(w,y)=>{a.set(w,y),ms(e,r.standardSnapshot,w),r.standardClosedSnapshot.has(w)||r.standardClosedSnapshot.set(w,e.state.closedStandardFds?.has(w)===!0),e.state.closedStandardFds?.delete(w),Xn(e,w,y)},b=(w,y)=>{if(w<Tt){let x=a.get(w);return x?.kind==="closed"?null:x?{kind:"entry",entry:x,descriptors:ps(e,w)}:{kind:"standard",fd:w}}return TI(e,w,y)};for(let w=0;w<t.length;w++){let y=t[w],x=Xd(y);if(y.target.type==="HereDoc"){let A=await RI(e,y.target);if(y.fdVariable){try{st(e,y.fdVariable)}catch(N){if(!(N instanceof ye))throw N;return p(Q(N.stdout,N.stderr,N.exitCode),w,N)}let I=$4(e),$=await h(I,w);if($)return $;ms(e,r.fdVariableSnapshot,I),r.fdVariableEnv.has(y.fdVariable)||r.fdVariableEnv.set(y.fdVariable,e.state.env.get(y.fdVariable)),Xn(e,I,{kind:"input",content:A}),e.state.env.set(y.fdVariable,String(I)),e.state.nextFd=I+1}else if(x!==null&&x>=Tt){let I=await h(x,w);if(I)return I;ms(e,l,x),Xn(e,x,{kind:"input",content:A})}else if(x===0||x===null)c=Ln(A),u=-1,m(x,{kind:"input",content:c});else{let I={kind:"input",content:A};r.policy==="persistent"?m(x,I):g(x,I)}continue}let S,E=y.operator===">&"||y.operator==="<&";if(E){if(Rd(e,y.target))return p(Q("",`bash: $@: ambiguous redirect
888
+ `,1),w);S=await Be(e,y.target)}else if(y.operator==="<<<")S=await Be(e,y.target);else{let A=await c4(e,y.target);if("error"in A)return p(Q("",A.error,1),w);S=A.target}if(s.set(w,S),S.includes("\0"))return p(Q("",`bash: ${S.replace(/\0/g,"")}: No such file or directory
889
+ `,1),w);if(y.fdVariable){try{st(e,y.fdVariable)}catch(O){if(!(O instanceof ye))throw O;return p(Q(O.stdout,O.stderr,O.exitCode),w,O)}if(E&&S==="-"){let O=Number.parseInt(e.state.env.get(y.fdVariable)??"",10);Number.isNaN(O)||(ms(e,r.fdVariableSnapshot,O),Tr(e,O));continue}let A=$4(e),I=E?hc(S):null;if(I&&!b(I.sourceFd,y.operator==="<&"))return p(Q("",`bash: ${I.sourceFd}: Bad file descriptor
890
+ `,1),w);if(!(I?.move===!0&&I.sourceFd>=Tt)){let O=await h(A,w);if(O)return O}ms(e,r.fdVariableSnapshot,A),r.fdVariableEnv.has(y.fdVariable)||r.fdVariableEnv.set(y.fdVariable,e.state.env.get(y.fdVariable));let N,R;if(E){let O=I;if(O){let B=b(O.sourceFd,y.operator==="<&");if(!B)return p(Q("",`bash: ${O.sourceFd}: Bad file descriptor
891
+ `,1),w);R=O,B.kind==="standard"?N={kind:y.operator==="<&"?"dup-in":"dup-out",sourceFd:B.fd}:O.sourceFd<Tt&&(N=B.entry)}else{if(y.operator==="<&")return p(Q("",`bash: ${S}: ambiguous redirect
892
+ `,1),w);let B=await Hi(e,S,!1,!1);if(B.error)return p(B.error,w);N=B.entry}}else if(y.operator===">"||y.operator===">|"||y.operator===">>"||y.operator==="&>"||y.operator==="&>>"){let O=y.operator===">>"||y.operator==="&>>",B=await Hi(e,S,O,y.operator===">|");if(B.error)return p(B.error,w);N=B.entry}else if(y.operator==="<<<")N={kind:"input",content:`${S}
893
+ `};else if(y.operator==="<"||y.operator==="<>"){let O=await Yd(e,S,y.operator==="<>");if(O.error)return p(O.error,w);N=O.entry}if(R&&R.sourceFd>=Tt){if(!(R.move?Kd(e,A,R.sourceFd):fc(e,A,R.sourceFd)))return p(Q("",`bash: ${R.sourceFd}: Bad file descriptor
894
+ `,1),w)}else N&&Xn(e,A,N);R?.move&&R.sourceFd!==A&&R.sourceFd<Tt&&Tr(e,R.sourceFd),e.state.env.set(y.fdVariable,String(A)),e.state.nextFd=A+1;continue}if(T4(y)){let A=x;if(E&&S==="-"){ms(e,l,A),Tr(e,A);continue}let I=E?hc(S):null;if(I&&!b(I.sourceFd,y.operator==="<&"))return p(Q("",`bash: ${I.sourceFd}: Bad file descriptor
895
+ `,1),w);if(!(I?.move===!0&&I.sourceFd>=Tt)){let N=await h(A,w);if(N)return N}if(ms(e,l,A),E){let N=I;if(!N){if(y.operator==="<&")return p(Q("",`bash: ${S}: ambiguous redirect
896
+ `,1),w);let O=await Hi(e,S,!1,!1);if(O.error)return p(O.error,w);Xn(e,A,O.entry);continue}let R=b(N.sourceFd,y.operator==="<&");if(!R)return p(Q("",`bash: ${N.sourceFd}: Bad file descriptor
897
+ `,1),w);if(R.kind==="standard")Xn(e,A,{kind:y.operator==="<&"?"dup-in":"dup-out",sourceFd:R.fd});else if(N.sourceFd<Tt)Xn(e,A,R.entry);else if(!(N.move?Kd(e,A,N.sourceFd):fc(e,A,N.sourceFd)))return p(Q("",`bash: ${N.sourceFd}: Bad file descriptor
898
+ `,1),w);N.move&&N.sourceFd!==A&&N.sourceFd<Tt&&Tr(e,N.sourceFd);continue}if(y.operator===">"||y.operator===">|"||y.operator===">>"){let N=await Hi(e,S,y.operator===">>",y.operator===">|");if(N.error)return p(N.error,w);Xn(e,A,N.entry)}else if(y.operator==="<<<")Xn(e,A,{kind:"input",content:`${S}
899
+ `});else if(y.operator==="<"||y.operator==="<>"){let N=await Yd(e,S,y.operator==="<>");if(N.error)return p(N.error,w);Xn(e,A,N.entry)}continue}if(E){if(S==="-"){x===0&&(c="",u=-1),x!==null&&x<Tt&&(a.set(x,{kind:"closed"}),r.policy==="persistent"&&(Tr(e,x),e.state.closedStandardFds??=new Set,e.state.closedStandardFds.add(x)));continue}let A=hc(S);if(!A){if(y.operator==="<&")return p(Q("",`bash: ${S}: ambiguous redirect
900
+ `,1),w);let $=await Hi(e,S,!1,!1,!1);if($.error)return p($.error,w);let N=$.entry;i.set(w,{kind:"entry",entry:N,descriptors:[]}),y.fd==null?(m(1,N),m(2,N)):m(x,N);continue}let I=b(A.sourceFd,y.operator==="<&");if(!I)return p(Q("",`bash: ${A.sourceFd}: Bad file descriptor
901
+ `,1),w);if(i.set(w,I),I.kind==="entry"&&r.policy==="persistent"&&x!==null&&x<Tt&&A.sourceFd>=Tt){if(!fc(e,x,A.sourceFd))return p(Q("",`bash: ${A.sourceFd}: Bad file descriptor
902
+ `,1),w);a.set(x,Pn(e,x)),e.state.closedStandardFds?.delete(x)}else I.kind==="standard"?m(x,{kind:y.operator==="<&"?"dup-in":"dup-out",sourceFd:I.fd}):m(x,I.entry);if(y.operator==="<&"&&x===0)if(I.kind==="standard")c=I.fd===0?n:"",u=-1;else if(I.entry.kind==="input"||I.entry.kind==="readwrite"){let $=A.sourceFd<Tt&&!Qs(e,A.sourceFd)?{content:I.entry.kind==="input"?I.entry.content:I.entry.content.slice(I.entry.position)}:dc(e,A.sourceFd);if("error"in $)return p(Q("",`bash: ${A.sourceFd}: Bad file descriptor
903
+ `,1),w);c=$.content,u=Qs(e,A.sourceFd)?A.sourceFd:-1}else c=n,u=-1;A.move&&(A.sourceFd>=Tt?Tr(e,A.sourceFd):(a.set(A.sourceFd,{kind:"closed"}),r.policy==="persistent"&&(Tr(e,A.sourceFd),e.state.closedStandardFds??=new Set,e.state.closedStandardFds.add(A.sourceFd))));continue}if(y.operator===">"||y.operator===">|"||y.operator===">>"||y.operator==="&>"||y.operator==="&>>"){let A=await Hi(e,S,y.operator===">>"||y.operator==="&>>",y.operator===">|",!1);if(A.error)return p(A.error,w);let I=A.entry;y.operator==="&>"||y.operator==="&>>"?(m(1,I),m(2,I)):m(x,I);continue}if(y.operator==="<<<")c=Ln(`${S}
904
+ `),u=-1,m(x,{kind:"input",content:c});else if(y.operator==="<"){let A=e.fs.resolvePath(e.state.cwd,S);try{c=await jt(e.fs,A),u=-1,m(x,{kind:"input",content:c})}catch{return p(Q("",`bash: ${S}: No such file or directory
905
+ `,1),w)}}else if(y.operator==="<>"){let A=await Yd(e,S,!0);if(A.error)return p(A.error,w);let I=A.entry;m(x,I),x===0&&I.kind==="readwrite"&&(c=I.content,u=-1)}}return d()}function Vi(e,t,n){let r={numericSnapshot:new Map,fdVariableSnapshot:new Map,standardSnapshot:new Map,standardClosedSnapshot:new Map,fdVariableEnv:new Map,nextFd:e.state.nextFd,policy:n},s=!1;return{prepare:(i="")=>$I(e,t,i,r),finish:()=>{if(!s){if(s=!0,n!=="persistent"&&pc(e,r.numericSnapshot),n!=="persistent"){pc(e,r.standardSnapshot);for(let[i,o]of r.standardClosedSnapshot)o?(e.state.closedStandardFds??=new Set,e.state.closedStandardFds.add(i)):e.state.closedStandardFds?.delete(i)}if(n==="bare"){pc(e,r.fdVariableSnapshot);for(let[i,o]of r.fdVariableEnv)o===void 0?e.state.env.delete(i):e.state.env.set(i,o);e.state.nextFd=r.nextFd}}}}}function Gi(e){if(!e.error)throw new Error("Expected a redirection error");if(e.errorCause)throw e.errorCause.stdout=e.error.stdout,e.errorCause.stderr=e.error.stderr,e.errorCause;return e.error}async function Jd(e,t,n,r){let s=t instanceof ye||t instanceof Ut||t instanceof Yt?t.exitCode:t instanceof C?C.EXIT_CODE:0,i=await gs(e,Q(t.stdout,t.stderr,s),n,r.targets,r.dupSources,r.standardRoutes);t.stdout=i.stdout,t.stderr=i.stderr,t.internalOutputAccounting=i.internalOutputAccounting??{stdout:U(i.stdout),stderr:U(i.stderr)}}async function Dn(e,t,n,r){let s=Vi(e,t,Vo),i;try{if(i=await s.prepare(n),i.error)return Gi(i);let o=e.state.groupStdin,a=e.state.groupStdinSourceFd;i.stdin!==void 0&&(e.state.groupStdin=i.stdin,e.state.groupStdinSourceFd=i.stdinSourceFd);try{let l=await r(i);return await gs(e,l,t,i.targets,i.dupSources,i.standardRoutes)}finally{i.stdin!==void 0&&(e.state.groupStdin=o,e.state.groupStdinSourceFd=a)}}catch(o){throw!(o instanceof ut)||!i||await Jd(e,o,t,i),o}finally{s.finish()}}async function gs(e,t,n,r,s=new Map,i=new Map,o="bash",a=!1){n.length>0&&(t=e.executionScope.accountResult(t,"redirection"));let{stdout:l,stderr:c,exitCode:u}=t,d=t.stdoutKind==="bytes"||t.stdoutKind===void 0&&t.stdoutEncoding==="binary"?"binary":"utf8",p=x=>d,h={kind:"live-stdout"},m={kind:"live-stderr"},g=x=>{if(!x)return null;if(x.kind==="entry"){if(x.entry.kind==="dup-out"){if(x.entry.sourceFd===1)return{kind:"live-stdout"};if(x.entry.sourceFd===2)return{kind:"live-stderr"}}return x.entry.kind==="output"||x.entry.kind==="readwrite"?{kind:"descriptor",source:x}:null}return x.fd===1?h:x.fd===2?m:null},b=x=>{let S=i.get(x)??Pn(e,x);return S?S.kind==="closed"?{kind:"invalid-output",fd:x}:S.kind==="input"||S.kind==="dup-in"?{kind:"invalid-output",fd:x}:S.kind==="dup-out"?S.sourceFd===1?{kind:"live-stdout"}:S.sourceFd===2?{kind:"live-stderr"}:null:S.kind==="output"||S.kind==="readwrite"?{kind:"descriptor",source:{kind:"entry",entry:S,descriptors:ps(e,x)}}:null:null};h=b(1)??h,m=b(2)??m;for(let x=0;x<n.length;x++){let S=n[x];if(S.target.type==="HereDoc"||S.fdVariable)continue;let E=r.get(x);if(E!==void 0)switch(S.operator){case">":case">|":case">>":{let A=S.fd??1;if(A!==1&&A!==2)break;let I=S.operator===">>";if(E==="/dev/stdout"){A===2&&(m=h);break}if(E==="/dev/stderr"){A===1&&(h=m);break}if(E==="/dev/full"){c+=`bash: echo: write error: No space left on device
906
+ `,u=1,A===1&&(l="");break}if(E==="/dev/null"&&A===2){m={kind:"discard"};break}let $=e.fs.resolvePath(e.state.cwd,E);A===1?h={kind:"file",path:$,append:I}:m={kind:"file",path:$,append:I};break}case">&":case"<&":{let A=S.fd??(S.operator==="<&"?0:1);if(A>=Tt||A===0)break;if(E==="-"){A===1?h={kind:"discard"}:m={kind:"discard"};break}let I=g(s.get(x));if(!I)break;S.fd==null&&hc(E)===null?(h=I,m=I):A===1?h=I:A===2&&(m=I);break}case"&>":{h={kind:"file",path:e.fs.resolvePath(e.state.cwd,E),append:!1},m=h;break}case"&>>":{h={kind:"file",path:e.fs.resolvePath(e.state.cwd,E),append:!0},m=h;break}}}if(l!==""||c!==""){let x=l,S=c;l="",c="",h.kind==="invalid-output"&&x!==""&&(x="",S+=`${a?"":"bash: "}${o}: write error: Bad file descriptor
907
+ `,u=1),m.kind==="invalid-output"&&(S="");let E=async(A,I,$)=>{A.append?await e.fs.appendFile(A.path,I,$):await e.fs.writeFile(A.path,I,$)};if(h===m&&(h.kind==="file"||h.kind==="descriptor")){let A=x+S;A!==""&&(h.kind==="file"?await E(h,A,p(A)):await Qd(e,h.source.entry,h.source.descriptors,A,p(A)))}else for(let[A,I,$]of[[x,h,!0],[S,m,!1]])if(A!=="")switch(I.kind){case"live-stdout":l+=A;break;case"live-stderr":c+=A;break;case"file":await E(I,A,$?p(A):R4(A));break;case"descriptor":await Qd(e,I.source.entry,I.source.descriptors,A,$?p(A):R4(A));break;case"invalid-output":break;case"discard":break}}let w=Q(l,c,u);if(t.stdoutKind&&(w.stdoutKind=t.stdoutKind),t.stdoutEncoding==="binary"&&(w.stdoutEncoding="binary"),t.internalPipeStatusOverride&&(w.internalPipeStatusOverride=t.internalPipeStatusOverride),n.length>0||e.state.fileDescriptors?.has(1)===!0||e.state.fileDescriptors?.has(2)===!0){let x=(t.internalOutputAccounting?.stdout??0)+(t.internalOutputAccounting?.stderr??0),S=U(w.stdout),E=U(w.stderr),A=Math.min(S,x);w.internalOutputAccounting={stdout:A,stderr:Math.min(E,x-A)},e.executionScope.accountResult(w,"redirection")}else t.internalOutputAccounting&&(w.internalOutputAccounting=t.internalOutputAccounting);return w}function L4(e,t){if(e.state.options.posix&&Do.has(t.name)){let r=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin
908
+ `;throw new ye(2,"",r)}let n={...t,sourceFile:t.sourceFile??e.state.currentSource??"main"};return e.state.functions.set(t.name,n),Me}async function mc(e,t,n,r="",s,i=!1){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,us(`${t.name}: maximum recursion depth (${e.limits.maxCallDepth}) exceeded, increase executionLimits.maxCallDepth`,"recursion")),e.state.funcNameStack||(e.state.funcNameStack=[]),e.state.callLineStack||(e.state.callLineStack=[]),e.state.sourceStack||(e.state.sourceStack=[]),e.state.funcNameStack.unshift(t.name),e.state.callLineStack.unshift(s??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??"main"),e.state.localScopes.push(new Map),e.state.localArrayScopes??=[],e.state.localArrayScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let o=new Map,a=Number.parseInt(e.state.env.get("#")??"0",10),l=Math.max(n.length,a);for(let p=0;p<l;p++){let h=String(p+1);o.set(h,e.state.env.get(h)),p<n.length?e.state.env.set(h,n[p]):e.state.env.delete(h)}o.set("@",e.state.env.get("@")),o.set("#",e.state.env.get("#")),e.state.env.set("@",n.join(" ")),e.state.env.set("#",String(n.length));let c=!1,u=()=>{if(c)return;c=!0;let p=e.state.localScopes.length-1,h=e.state.localScopes.pop(),m=e.state.localArrayScopes?.pop();if(h)for(let[g,b]of h)b===void 0?e.state.env.delete(g):e.state.env.set(g,b);if(m){e.state.arrays??=new Map;for(let[g,b]of m)b===void 0?(e.state.arrays.delete(g),e.state.associativeArrays?.delete(g)):(e.state.arrays.set(g,un(b)),e.state.associativeArrays??=new Set,b.kind==="associative"?e.state.associativeArrays.add(g):e.state.associativeArrays.delete(g))}if(N4(e,p),e.state.fullyUnsetLocals)for(let[g,b]of e.state.fullyUnsetLocals.entries())b===p&&e.state.fullyUnsetLocals.delete(g);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let g=e.state.localExportedVars.pop();if(g)for(let b of g)e.state.exportedVars?.delete(b)}for(let[g,b]of o)b===void 0?e.state.env.delete(g):e.state.env.set(g,b);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},f=null,d=Vi(e,t.redirections,Vo);try{if(f=await d.prepare(r),f.error)return Gi(f);let p=f.stdin??r,h=i||f.stdin!==void 0||r!=="",m=await e.executeCommand(t.body,p,h);return gs(e,m,t.redirections,f.targets,f.dupSources,f.standardRoutes)}catch(p){if(p instanceof ut&&f&&(await Jd(e,p,t.redirections,f),p instanceof Ut))return Q(p.stdout,p.stderr,p.exitCode);throw p}finally{d.finish(),u()}}var M4=e=>e.type==="Escaped"?ee.literal(`\\${e.value}`):e.type==="DoubleQuoted"?{...e,parts:e.parts.map(M4)}:e,_4=["!","[[","]]","case","do","done","elif","else","esac","fi","for","function","if","in","then","time","until","while","{","}"],np=[".",":","[","alias","bg","bind","break","builtin","caller","cd","command","compgen","complete","compopt","continue","declare","dirs","disown","echo","enable","eval","exec","exit","export","false","fc","fg","getopts","hash","help","history","jobs","kill","let","local","logout","mapfile","popd","printf","pushd","pwd","read","readarray","readonly","return","set","shift","shopt","source","suspend","test","times","trap","true","type","typeset","ulimit","umask","unalias","unset","wait"],PI=["autocd","assoc_expand_once","cdable_vars","cdspell","checkhash","checkjobs","checkwinsize","cmdhist","compat31","compat32","compat40","compat41","compat42","compat43","compat44","complete_fullquote","direxpand","dirspell","dotglob","execfail","expand_aliases","extdebug","extglob","extquote","failglob","force_fignore","globasciiranges","globstar","gnu_errfmt","histappend","histreedit","histverify","hostcomplete","huponexit","inherit_errexit","interactive_comments","lastpipe","lithist","localvar_inherit","localvar_unset","login_shell","mailwarn","no_empty_cmd_completion","nocaseglob","nocasematch","nullglob","progcomp","progcomp_alias","promptvars","restricted_shell","shift_verbose","sourcepath","xpg_echo"],DI=np;async function rp(e,t){let n=[],r=null,s="",i="",o=null,a=!1,l=!1,c=!1,u=null,f=null,d=null,p=[],h=["alias","arrayvar","binding","builtin","command","directory","disabled","enabled","export","file","function","group","helptopic","hostname","job","keyword","running","service","setopt","shopt","signal","stopped","user","variable"];for(let E=0;E<t.length;E++){let A=t[E];if(A==="-v")n.push("variable");else if(A==="-e")n.push("export");else if(A==="-f")n.push("file");else if(A==="-d")n.push("directory");else if(A==="-k")n.push("keyword");else if(A==="-A"){if(E++,E>=t.length)return K(`compgen: -A: option requires an argument
909
+ `,2);let I=t[E];if(!h.includes(I))return K(`compgen: ${I}: invalid action name
910
+ `,2);n.push(I)}else if(A==="-W"){if(E++,E>=t.length)return K(`compgen: -W: option requires an argument
911
+ `,2);r=t[E]}else if(A==="-P"){if(E++,E>=t.length)return K(`compgen: -P: option requires an argument
912
+ `,2);s=t[E]}else if(A==="-S"){if(E++,E>=t.length)return K(`compgen: -S: option requires an argument
913
+ `,2);i=t[E]}else if(A==="-o"){if(E++,E>=t.length)return K(`compgen: -o: option requires an argument
914
+ `,2);let I=t[E];if(I==="plusdirs")a=!0;else if(I==="dirnames")l=!0;else if(I==="default")c=!0;else if(!(I==="filenames"||I==="nospace"||I==="bashdefault"||I==="noquote"))return K(`compgen: ${I}: invalid option name
915
+ `,2)}else if(A==="-F"){if(E++,E>=t.length)return K(`compgen: -F: option requires an argument
916
+ `,2);f=t[E]}else if(A==="-C"){if(E++,E>=t.length)return K(`compgen: -C: option requires an argument
917
+ `,2);d=t[E]}else if(A==="-X"){if(E++,E>=t.length)return K(`compgen: -X: option requires an argument
918
+ `,2);u=t[E]}else if(A==="-G"){if(E++,E>=t.length)return K(`compgen: -G: option requires an argument
919
+ `,2)}else if(A==="--"){p.push(...t.slice(E+1));break}else A.startsWith("-")||p.push(A)}o=p[0]??null;let m=[],g=new Set,b=()=>e.limits.maxArrayElements-m.length,w=E=>{for(let A of E){if(m.length>=e.limits.maxArrayElements)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(U(A)>e.limits.maxStringLength)throw new C(`compgen: completion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");e.executionScope.consumeWork(1,"compgen completion"),m.push(A),g.add(A)}};if(l){let E=await ep(e,o,b());w(E)}if(c){let E=await F4(e,o,b());w(E)}for(let E of n)if(E==="variable"){let A=LI(e,o,b());w(A)}else if(E==="export"){let A=FI(e,o,b());w(A)}else if(E==="function"){let A=MI(e,o,b());w(A)}else if(E==="builtin"){let A=_I(e,o,b());w(A)}else if(E==="keyword"){let A=BI(e,o,b());w(A)}else if(E==="alias"){let A=UI(e,o,b());w(A)}else if(E==="shopt"){let A=zI(e,o,b());w(A)}else if(E==="helptopic"){let A=WI(e,o,b());w(A)}else if(E==="directory"){let A=await ep(e,o,b());w(A)}else if(E==="file"){let A=await F4(e,o,b());w(A)}else if(E==="user"){let A=jI(e,o,b());w(A)}else if(E==="command"){let A=await HI(e,o,b());w(A)}if(r!==null)try{let E=await VI(e,r),A=GI(e,E,b(),o);for(let I of A)w([I])}catch(E){if(E instanceof C)throw E;return Q("","",1)}if(a){let E=await ep(e,o,b(),g);for(let A of E)g.has(A)||w([A])}let y="";if(f!==null){let E=e.state.functions.get(f);if(E){let A=new Map,I=zt(e,"COMP_WORDS"),$=I?un(I):void 0;vt(e,"COMP_WORDS"),$o(e,"COMP_WORDS"),A.set("COMP_CWORD",e.state.env.get("COMP_CWORD")),e.state.env.set("COMP_CWORD","-1"),A.set("COMP_LINE",e.state.env.get("COMP_LINE")),e.state.env.set("COMP_LINE",""),A.set("COMP_POINT",e.state.env.get("COMP_POINT")),e.state.env.set("COMP_POINT","0");let N=zt(e,"COMPREPLY"),R=N?un(N):void 0,O=e.state.env.get("COMPREPLY");vt(e,"COMPREPLY"),e.state.env.delete("COMPREPLY");let B=["compgen",p[0]??"",""];try{let L=await mc(e,E,B,"");if(L.exitCode!==0)return tp(e,A),qi(e,"COMP_WORDS",$),qi(e,"COMPREPLY",R),O!==void 0&&e.state.env.set("COMPREPLY",O),Q("",L.stderr,1);y=L.stdout;let T=qI(e,b());w(T)}catch(L){if(L instanceof C)throw L;return tp(e,A),qi(e,"COMP_WORDS",$),qi(e,"COMPREPLY",R),O!==void 0&&e.state.env.set("COMPREPLY",O),Q("","",1)}tp(e,A),qi(e,"COMP_WORDS",$),qi(e,"COMPREPLY",R),O!==void 0&&e.state.env.set("COMPREPLY",O)}}if(d!==null)try{let E=Kn(d),A=await e.executeScript(E);if(A.exitCode!==0)return Q("",A.stderr,A.exitCode);if(A.stdout)for(let I of ZI(A.stdout))I.length>0&&w([I])}catch(E){if(E.name==="ParseException")return K(`compgen: -C: ${E.message}
920
+ `,2);throw E}let x=m;if(u!==null){let E=u.startsWith("!"),A=E?u.slice(1):u;x=m.filter(I=>{let $=Wi(I,A,!1,!0,e.limits.maxCallDepth);return E?$:!$})}if(x.length===0&&o!==null)return Q(y,"",1);let S=new Te(e.limits.maxOutputSize,"compgen");S.append(y);for(let E of x)S.append(s).append(E).append(i).append(`
921
+ `);return Pe(S.build())}function LI(e,t,n){let r=Yn(e,t,n);for(let s of e.state.env.keys())/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)&&r.add(s);for(let s of e.state.arrays?.keys()??[])r.add(s);return r.build()}function FI(e,t,n){let r=Yn(e,t,n),s=e.state.exportedVars??new Set;for(let i of s)e.state.env.has(i)&&r.add(i);return r.build()}function MI(e,t,n){let r=Yn(e,t,n);for(let s of e.state.functions.keys())r.add(s);return r.build()}function _I(e,t,n){let r=Yn(e,t,n);for(let s of np)r.add(s);return r.build()}function BI(e,t,n){let r=Yn(e,t,n);for(let s of _4)r.add(s);return r.build()}function UI(e,t,n){let r=Yn(e,t,n);for(let s of e.state.env.keys())if(s.startsWith("BASH_ALIAS_")){let i=s.slice(11);r.add(i)}return r.build()}function zI(e,t,n){let r=Yn(e,t,n);for(let s of PI)r.add(s);return r.build()}function WI(e,t,n){let r=Yn(e,t,n);for(let s of DI)r.add(s);return r.build()}async function ep(e,t,n=e.limits.maxArrayElements,r){let s=Yn(e,null,n,r);try{let i=e.state.cwd,o=t??"";if(t){let l=t.lastIndexOf("/");if(l!==-1){let c=t.slice(0,l)||"/";o=t.slice(l+1),c.startsWith("/")?i=c:i=`${e.state.cwd}/${c}`}}let a=await e.fs.readdir(i);for(let l of a){e.executionScope.consumeWork(1,"compgen directory scan");let c=`${i}/${l}`;try{if((await e.fs.stat(c)).isDirectory&&(!o||l.startsWith(o)))if(t?.includes("/")){let f=t.lastIndexOf("/"),d=t.slice(0,f+1);s.add(d+l)}else s.add(l)}catch(u){if(u instanceof C)throw u}}}catch(i){if(i instanceof C)throw i}return s.build()}async function F4(e,t,n=e.limits.maxArrayElements){let r=Yn(e,null,n);try{let s=e.state.cwd,i=t??"";if(t){let a=t.lastIndexOf("/");if(a!==-1){let l=t.slice(0,a)||"/";i=t.slice(a+1),l.startsWith("/")?s=l:s=`${e.state.cwd}/${l}`}}let o=await e.fs.readdir(s);for(let a of o)if(e.executionScope.consumeWork(1,"compgen file scan"),!i||a.startsWith(i))if(t?.includes("/")){let l=t.lastIndexOf("/"),c=t.slice(0,l+1);r.add(c+a)}else r.add(a)}catch(s){if(s instanceof C)throw s}return r.build()}function jI(e,t,n){let r=Yn(e,t,n);return r.add("root"),r.add("nobody"),r.build()}async function HI(e,t,n){let r=Yn(e,t,n);for(let i of np)r.add(i);for(let i of e.state.functions.keys())r.add(i);for(let i of e.state.env.keys())i.startsWith("BASH_ALIAS_")&&r.add(i.slice(11));for(let i of _4)r.add(i);let s=e.state.env.get("PATH")??"/usr/bin:/bin";for(let i of s.split(":"))if(i)try{let o=await e.fs.readdir(i);for(let a of o)r.add(a)}catch(o){if(o instanceof C)throw o}return r.build()}function Yn(e,t,n,r){let s=new Set;return{add(i){if(e.executionScope.consumeWork(1,"compgen candidate collection"),!(t!==null&&!i.startsWith(t))&&!r?.has(i)&&!s.has(i)){if(s.size>=n)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(U(i)>e.limits.maxStringLength)throw new C(`compgen: completion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");s.add(i)}},build(){return Array.from(s).sort()}}}async function VI(e,t){let r=new be().parseWordFromString(t,!1,!1);return await Be(e,ee.word(r.parts.map(M4)))}function GI(e,t,n,r){let s=e.state.env.get("IFS")??`
922
+ `;if(s.length===0){if(r!==null&&!t.startsWith(r))return[];if(n===0)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");return[t]}let i=new Set(s.split("")),o=[],a=u=>{if(!(r!==null&&!u.startsWith(r))){if(o.length>=n)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");o.push(u)}},l="",c=0;for(;c<t.length;){let u=t[c];if(u==="\\"&&c+1<t.length){let f=t[c+1];l+=f,c+=2}else i.has(u)?(l.length>0&&(a(l),l=""),c++):(l+=u,c++)}return l.length>0&&a(l),o}function tp(e,t){for(let[n,r]of t)r===void 0?e.state.env.delete(n):e.state.env.set(n,r)}function qi(e,t,n){e.state.arrays??=new Map,n?e.state.arrays.set(t,un(n)):e.state.arrays.delete(t)}function qI(e,t){let n=[],r=s=>{if(n.length>=t)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");n.push(s)};if(Gt(e,"COMPREPLY")){let s=xe(e,"COMPREPLY");for(let[,i]of s)r(i)}else{let s=e.state.env.get("COMPREPLY");s!==void 0&&r(s)}return n}function*ZI(e){let t=0;for(;t<=e.length;){let n=e.indexOf(`
923
+ `,t),r=n===-1?e.length:n;if(r>t&&(yield e.slice(t,r)),n===-1)return;t=n+1}}ce();function Go(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!0}return!1}function sp(e){let t="$'";for(let n=0;n<e.length;n++){let r=e[n],s=e.charCodeAt(n);s===7?t+="\\a":s===8?t+="\\b":s===9?t+="\\t":s===10?t+="\\n":s===11?t+="\\v":s===12?t+="\\f":s===13?t+="\\r":s===27?t+="\\e":s===39?t+="\\'":s===92?t+="\\\\":s<32||s===127?t+=`\\${s.toString(8).padStart(3,"0")}`:t+=r}return t+="'",t}function B4(e){if(Go(e))return U4(e);if(e==="")return 2;if(/^[a-zA-Z0-9_/.:\-@%+,=]+$/.test(e))return U(e);let t=U(e)+2;for(let n of e)n==="'"&&(t+=3);return t}function Rt(e){return Go(e)?sp(e):e===""?"''":/^[a-zA-Z0-9_/.:\-@%+,=]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function gc(e){if(Go(e))return U4(e);let t=U(e)+2;for(let n of e)(n==="\\"||n==='"'||n==="$"||n==="`")&&t++;return t}function ys(e){return Go(e)?sp(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`")}"`}function U4(e){let t=3;for(let n of e){let r=n.codePointAt(0)??0;r===7||r===8||r===9||r===10||r===11||r===12||r===13||r===27||r===39||r===92?t+=2:r<32||r===127?t+=4:t+=U(n)}return t}function qo(e){return Go(e)?sp(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`")}"`}var KI=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function op(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,s=!1,i,o,a,l=[],c=[],u=[];for(let f=0;f<t.length;f++){let d=t[f];if(d==="-p")n=!0;else if(d==="-r")r=!0;else if(d==="-D")s=!0;else if(d==="-W"){if(f++,f>=t.length)return K(`complete: -W: option requires an argument
924
+ `,2);i=t[f]}else if(d==="-F"){if(f++,f>=t.length)return K(`complete: -F: option requires an argument
925
+ `,2);o=t[f]}else if(d==="-o"){if(f++,f>=t.length)return K(`complete: -o: option requires an argument
926
+ `,2);let p=t[f];if(!KI.includes(p))return K(`complete: ${p}: invalid option name
927
+ `,2);l.push(p)}else if(d==="-A"){if(f++,f>=t.length)return K(`complete: -A: option requires an argument
928
+ `,2);c.push(t[f])}else if(d==="-C"){if(f++,f>=t.length)return K(`complete: -C: option requires an argument
929
+ `,2);a=t[f]}else if(d==="-G"){if(f++,f>=t.length)return K(`complete: -G: option requires an argument
930
+ `,2)}else if(d==="-P"){if(f++,f>=t.length)return K(`complete: -P: option requires an argument
931
+ `,2)}else if(d==="-S"){if(f++,f>=t.length)return K(`complete: -S: option requires an argument
932
+ `,2)}else if(d==="-X"){if(f++,f>=t.length)return K(`complete: -X: option requires an argument
933
+ `,2)}else if(d==="--"){u.push(...t.slice(f+1));break}else d.startsWith("-")||u.push(d)}if(r){if(u.length===0)return e.state.completionSpecs.clear(),e.state.defaultCompletionSpec=void 0,e.state.emptyCompletionSpec=void 0,Pe("");for(let f of u)e.state.completionSpecs.delete(f);return Pe("")}if(n)return u.length===0?ip(e):ip(e,u);if(t.length===0||u.length===0&&!i&&!o&&!a&&l.length===0&&c.length===0&&!s)return ip(e);if(o&&u.length===0&&!s)return K(`complete: -F: option requires a command name
934
+ `,2);if(s){let f={isDefault:!0};return i!==void 0&&(f.wordlist=i),o!==void 0&&(f.function=o),a!==void 0&&(f.command=a),l.length>0&&(f.options=l),c.length>0&&(f.actions=c),e.state.defaultCompletionSpec=f,Pe("")}for(let f of u){let d=Object.create(null);i!==void 0&&(d.wordlist=i),o!==void 0&&(d.function=o),a!==void 0&&(d.command=a),l.length>0&&(d.options=l),c.length>0&&(d.actions=c),e.state.completionSpecs.set(f,d)}return Pe("")}function ip(e,t){let n=e.state.completionSpecs??new Map;if(n.size===0&&!e.state.defaultCompletionSpec){if(t&&t.length>0){let i="";for(let o of t)i+=`complete: ${o}: no completion specification
935
+ `;return Q("",i,1)}return Pe("")}let r=[],s=t||Array.from(n.keys());for(let i of s){let o=n.get(i);if(!o){if(t)return Q(r.join(`
936
+ `)+(r.length>0?`
937
+ `:""),`complete: ${i}: no completion specification
938
+ `,1);continue}let a="complete";if(o.options)for(let l of o.options)a+=` -o ${Rt(l)}`;if(o.actions)for(let l of o.actions)a+=` -A ${Rt(l)}`;o.wordlist!==void 0&&(o.wordlist.includes(" ")||o.wordlist.includes("'")?a+=` -W ${Rt(o.wordlist)}`:a+=` -W ${Rt(o.wordlist)}`),o.function!==void 0&&(a+=` -F ${Rt(o.function)}`),o.command!==void 0&&(a+=` -C ${Rt(o.command)}`),o.isDefault&&(a+=" -D"),a+=`${i.startsWith("-")?" -- ":" "}${Rt(i)}`,r.push(a)}if(!t&&e.state.defaultCompletionSpec){let i=e.state.defaultCompletionSpec,o="complete";for(let a of i.options??[])o+=` -o ${Rt(a)}`;for(let a of i.actions??[])o+=` -A ${Rt(a)}`;i.wordlist!==void 0&&(o+=` -W ${Rt(i.wordlist)}`),i.function!==void 0&&(o+=` -F ${Rt(i.function)}`),i.command!==void 0&&(o+=` -C ${Rt(i.command)}`),o+=" -D",r.push(o)}return r.length===0?Pe(""):Pe(`${r.join(`
939
+ `)}
940
+ `)}var z4=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function ap(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,s=[],i=[],o=[];for(let a=0;a<t.length;a++){let l=t[a];if(l==="-D")n=!0;else if(l==="-E")r=!0;else if(l==="-o"){if(a++,a>=t.length)return K(`compopt: -o: option requires an argument
941
+ `,2);let c=t[a];if(!z4.includes(c))return K(`compopt: ${c}: invalid option name
942
+ `,2);s.push(c)}else if(l==="+o"){if(a++,a>=t.length)return K(`compopt: +o: option requires an argument
943
+ `,2);let c=t[a];if(!z4.includes(c))return K(`compopt: ${c}: invalid option name
944
+ `,2);i.push(c)}else if(l==="--"){o.push(...t.slice(a+1));break}else!l.startsWith("-")&&!l.startsWith("+")&&o.push(l)}if(n){let a=e.state.defaultCompletionSpec??{isDefault:!0},l=new Set(a.options??[]);for(let c of s)l.add(c);for(let c of i)l.delete(c);return a.options=l.size>0?Array.from(l):void 0,e.state.defaultCompletionSpec=a,Pe("")}if(r){let a=e.state.emptyCompletionSpec??Object.create(null),l=new Set(a.options??[]);for(let c of s)l.add(c);for(let c of i)l.delete(c);return a.options=l.size>0?Array.from(l):void 0,e.state.emptyCompletionSpec=a,Pe("")}if(o.length>0){for(let a of o){let l=e.state.completionSpecs.get(a)??{},c=new Set(l.options??[]);for(let u of s)c.add(u);for(let u of i)c.delete(u);l.options=c.size>0?Array.from(c):void 0,e.state.completionSpecs.set(a,l)}return Pe("")}return K(`compopt: not currently executing completion function
945
+ `,1)}Z();function lp(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new gr;return Me}if(t.length>1)throw new ye(1,"",`bash: continue: too many arguments
946
+ `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new ye(1,"",`bash: continue: ${t[0]}: numeric argument required
947
+ `);n=r}throw new Xt(n)}At();function W4(e,t){let n="";return e.state.integerVars?.has(t)&&(n+="i"),e.state.lowercaseVars?.has(t)&&(n+="l"),rt(e,t)&&(n+="n"),e.state.readonlyVars?.has(t)&&(n+="r"),e.state.uppercaseVars?.has(t)&&(n+="u"),e.state.exportedVars?.has(t)&&(n+="x"),n===""?"--":`-${n}`}function cp(e){return Rt(e)}function up(e){return`'${e.replace(/'/g,"'\\''")}'`}function j4(e,t){let n="",r="",s=!1;for(let i of t){let o=W4(e,i);if(e.state.associativeArrays?.has(i)){let u=kr(e,i);if(u.length===0)n+=`declare -A ${i}=()
948
+ `;else{let f=u.map(d=>{let p=Xe(e,i,d)??"",h=cp(p);return`[${up(d)}]=${h}`});n+=`declare -A ${i}=(${f.join(" ")})
949
+ `}continue}let l=Mt(e,i);if(l.length>0){let u=l.map(f=>{let d=Xe(e,i,f)??"";return`[${f}]=${ys(d)}`});n+=`declare -a ${i}=(${u.join(" ")})
950
+ `;continue}if(Gt(e,i)){n+=`declare -a ${i}=()
951
+ `;continue}let c=e.state.env.get(i);if(c!==void 0)n+=`declare ${o} ${i}=${qo(c)}
952
+ `;else{let u=e.state.declaredVars?.has(i),f=e.state.localVarDepth?.has(i);u||f?n+=`declare ${o} ${i}
953
+ `:(r+=`bash: declare: ${i}: not found
954
+ `,s=!0)}}return Q(n,r,s?1:0)}function H4(e,t){let{filterExport:n,filterReadonly:r,filterNameref:s,filterIndexedArray:i,filterAssocArray:o}=t,a=n||r||s||i||o,l="",c=new Set;for(let f of e.state.env.keys())f.startsWith("BASH_")||c.add(f);for(let f of e.state.arrays?.keys()??[])c.add(f);if(e.state.localVarDepth)for(let f of e.state.localVarDepth.keys())c.add(f);if(e.state.associativeArrays)for(let f of e.state.associativeArrays)c.add(f);let u=Array.from(c).sort();for(let f of u){let d=W4(e,f),p=e.state.associativeArrays?.has(f),h=Mt(e,f),m=!p&&Gt(e,f);if(a&&(o&&!p||i&&!m||n&&!e.state.exportedVars?.has(f)||r&&!e.state.readonlyVars?.has(f)||s&&!rt(e,f)))continue;if(p){let b=kr(e,f);if(b.length===0)l+=`declare -A ${f}=()
955
+ `;else{let w=b.map(y=>{let x=Xe(e,f,y)??"",S=cp(x);return`[${up(y)}]=${S}`});l+=`declare -A ${f}=(${w.join(" ")})
956
+ `}continue}if(h.length>0){let b=h.map(w=>{let y=Xe(e,f,w)??"";return`[${w}]=${ys(y)}`});l+=`declare -a ${f}=(${b.join(" ")})
957
+ `;continue}if(Gt(e,f)){l+=`declare -a ${f}=()
958
+ `;continue}let g=e.state.env.get(f);g!==void 0&&(l+=`declare ${d} ${f}=${qo(g)}
959
+ `)}return Pe(l)}function V4(e){let t="",n=Array.from(e.state.associativeArrays??[]).sort();for(let r of n){let s=kr(e,r);if(s.length===0)t+=`declare -A ${r}=()
960
+ `;else{let i=s.map(o=>{let a=Xe(e,r,o)??"",l=cp(a);return`[${up(o)}]=${l}`});t+=`declare -A ${r}=(${i.join(" ")})
961
+ `}}return Pe(t)}function G4(e){let t="",n=new Set(Array.from(e.state.arrays??[]).filter(([,s])=>s.kind==="indexed").map(([s])=>s)),r=Array.from(n).sort();for(let s of r){let i=Mt(e,s);if(i.length===0)t+=`declare -a ${s}=()
962
+ `;else{let o=i.map(a=>{let l=Xe(e,s,a)??"";return`[${a}]=${ys(l)}`});t+=`declare -a ${s}=(${o.join(" ")})
963
+ `}}return Pe(t)}function q4(e){let t="",n=new Set;for(let s of e.state.env.keys())s.startsWith("BASH_")||n.add(s);let r=Array.from(n).sort();for(let s of r){if(e.state.associativeArrays?.has(s)||Mt(e,s).length>0||Gt(e,s))continue;let a=e.state.env.get(s);a!==void 0&&(t+=`${s}=${Rt(a)}
964
+ `)}return Pe(t)}function fp(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Zo(e,t){return e.state.integerVars?.has(t)??!1}function dp(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function QI(e,t){return e.state.lowercaseVars?.has(t)??!1}function pp(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function XI(e,t){return e.state.uppercaseVars?.has(t)??!1}function Zi(e,t,n){return QI(e,t)?n.toLowerCase():XI(e,t)?n.toUpperCase():n}async function Z4(e,t){try{let n=new be,r=_e(n,t),s=await Re(e,r.expression);return String(s)}catch{return"0"}}function YI(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return null;let n=t[0],r=n.length;if(e[r]!=="[")return null;let s=0,i=r+1;for(;r<e.length;r++)if(e[r]==="[")s++;else if(e[r]==="]"&&(s--,s===0))break;if(s!==0)return null;let o=e.slice(i,r);if(r++,e[r]!=="=")return null;r++;let a=e.slice(r);return{name:n,indexExpr:o,value:a}}async function hp(e,t){let n={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength},r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,d=!1,p=!1,h=!1,m=!1,g=!1,b=!1,w=[];for(let N=0;N<t.length;N++){let R=t[N];if(R==="-a")r=!0;else if(R==="-A")s=!0;else if(R==="-r")i=!0;else if(R==="-x")o=!0;else if(R==="-p")a=!0;else if(R==="-n")l=!0;else if(R==="+n")c=!0;else if(R==="+a")u=!0;else if(R==="+x")f=!0;else if(R==="--"){w.push(...t.slice(N+1));break}else if(R.startsWith("+")){for(let O of R.slice(1))if(O==="n")c=!0;else if(O==="a")u=!0;else if(O==="x")f=!0;else if(O!=="r"){if(O!=="i"){if(!(O==="f"||O==="F"))return Q("",`bash: typeset: +${O}: invalid option
965
+ `,2)}}}else if(R==="-i")d=!0;else if(R==="-l")p=!0;else if(R==="-u")h=!0;else if(R==="-f")m=!0;else if(R==="-F")g=!0;else if(R==="-g")b=!0;else if(R.startsWith("-"))for(let O of R.slice(1))if(O==="a")r=!0;else if(O==="A")s=!0;else if(O==="r")i=!0;else if(O==="x")o=!0;else if(O==="p")a=!0;else if(O==="n")l=!0;else if(O==="i")d=!0;else if(O==="l")p=!0;else if(O==="u")h=!0;else if(O==="f")m=!0;else if(O==="F")g=!0;else if(O==="g")b=!0;else return Q("",`bash: typeset: -${O}: invalid option
966
+ `,2);else w.push(R)}let x=e.state.localScopes.length>0&&!b,S=N=>{if(!x)return;let R=e.state.localScopes[e.state.localScopes.length-1];R.has(N)||R.set(N,e.state.env.get(N))},E=N=>{if(!x)return;let R=e.state.localScopes[e.state.localScopes.length-1];for(R.has(N)||R.set(N,e.state.env.get(N)),e.state.localArrayScopes??=[];e.state.localArrayScopes.length<e.state.localScopes.length;)e.state.localArrayScopes.push(new Map);let O=e.state.localArrayScopes.at(-1);if(O&&!O.has(N)){let B=zt(e,N);O.set(N,B?un(B):void 0)}},A=N=>{x&&ds(e,N)};if(g){if(w.length===0){let O=Array.from(e.state.functions.keys()).sort(),B="";for(let L of O)B+=`declare -f ${L}
967
+ `;return Pe(B)}let N=!0,R="";for(let O of w)e.state.functions.has(O)?R+=`${O}
968
+ `:N=!1;return Q(R,"",N?0:1)}if(m){if(w.length===0){let R="",O=Array.from(e.state.functions.keys()).sort();for(let B of O)R+=`${B} ()
969
+ {
970
+ # function body
971
+ }
972
+ `;return Pe(R)}let N=!0;for(let R of w)e.state.functions.has(R)||(N=!1);return Q("","",N?0:1)}if(a&&w.length>0)return j4(e,w);if(a&&w.length===0)return H4(e,{filterExport:o,filterReadonly:i,filterNameref:l,filterIndexedArray:r,filterAssocArray:s});if(w.length===0&&s&&!a)return V4(e);if(w.length===0&&r&&!a)return G4(e);if(w.length===0&&!a)return q4(e);let I="",$=0;for(let N of w){let R=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(R&&!u){let T=R[1],W=R[2],_=st(e,T);if(_)return _;if(s&&Mt(e,T).length>0){I+=`bash: declare: ${T}: cannot convert indexed to associative array
973
+ `,$=1;continue}if((r||!s&&!r)&&e.state.associativeArrays?.has(T)){I+=`bash: declare: ${T}: cannot convert associative to indexed array
974
+ `,$=1;continue}let F=s&&W.includes("[")?oc(W,n):void 0,z=F===void 0?Wr(W,{...n,maxElements:s?n.maxElements*2:n.maxElements}):void 0;if(e.executionScope.consumeWork(F?.length??z?.length??0,"declare array assignment"),E(T),s?(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(T),es(e,T,"associative")):es(e,T,"indexed"),vt(e,T),e.state.env.delete(T),s&&W.includes("["))for(let[D,X]of F??[])we(e,T,D,ls(e,X),"associative");else if(s){let D=z??[];for(let X=0;X<D.length;X+=2){let V=D[X],Y=X+1<D.length?D[X+1]:"";we(e,T,V,Y,"associative")}}else{let D=z??[];if(D.some(V=>/^\[[^\]]+\]=/.test(V))){let V=0;for(let Y of D){let J=Y.match(/^\[([^\]]+)\]=(.*)$/);if(J){let ge=J[1],Oe=J[2],Ee;if(/^-?\d+$/.test(ge))Ee=Number.parseInt(ge,10);else try{let pe=new be,De=_e(pe,ge);Ee=await Re(e,De.expression)}catch{Ee=0}we(e,T,Ee,ls(e,Oe)),V=Ee+1}else we(e,T,V,Y),V++}}else for(let V=0;V<D.length;V++)we(e,T,V,D[V])}A(T),i&&Cn(e,T),o&&dr(e,T);continue}if(c){let T=N.includes("=")?N.slice(0,N.indexOf("=")):N;if(G7(e,T),!N.includes("="))continue}if(f){let T=N.includes("=")?N.slice(0,N.indexOf("=")):N;if(Bl(e,T),!N.includes("="))continue}let O=YI(N);if(O){let{name:T,indexExpr:W,value:_}=O,F=st(e,T);if(F)return F;E(T);let z;try{let D=new be,X=_e(D,W);z=await Re(e,X.expression)}catch{let D=parseInt(W,10);z=Number.isNaN(D)?0:D}we(e,T,z,_),A(T),i&&Cn(e,T),o&&dr(e,T);continue}let B=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(B&&!u){let T=B[1],W=B[2],_=st(e,T);if(_)return _;E(T);let F=Wr(W,n);if(e.state.associativeArrays?.has(T)){let z=oc(W,n);e.executionScope.consumeWork(z.length,"declare array append"),Ws(e,T,z.map(([D])=>D));for(let[D,X]of z)we(e,T,D,X,"associative")}else{e.executionScope.consumeWork(F.length,"declare array append");let z=Mt(e,T),D=0,X=e.state.env.get(T);z.length===0&&X!==void 0?(we(e,T,0,X),e.state.env.delete(T),D=1):z.length>0&&(D=Math.max(...z)+1),Ws(e,T,Array.from({length:F.length},(V,Y)=>D+Y));for(let V=0;V<F.length;V++)we(e,T,D+V,F[V])}A(T),i&&Cn(e,T),o&&dr(e,T);continue}let L=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(L){let T=L[1],W=L[2],_=st(e,T);if(_)return _;S(T),d&&fp(e,T),p&&dp(e,T),h&&pp(e,T);let z=Mt(e,T).length>0||e.state.associativeArrays?.has(T);if(Zo(e,T)){let D=e.state.env.get(T)??"0",X=parseInt(D,10)||0,V=parseInt(await Z4(e,W),10)||0;W=String(X+V),e.state.env.set(T,W)}else if(z){W=Zi(e,T,W);let D=Xe(e,T,0)??"";we(e,T,0,yr([D,W],"",e.limits.maxStringLength,"declare append"))}else{W=Zi(e,T,W);let D=e.state.env.get(T)??"";e.state.env.set(T,yr([D,W],"",e.limits.maxStringLength,"declare append"))}A(T),i&&Cn(e,T),o&&dr(e,T),e.state.options.allexport&&!f&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(T));continue}if(N.includes("=")){let T=N.indexOf("="),W=N.slice(0,T),_=N.slice(T+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(W)){I+=`bash: typeset: \`${W}': not a valid identifier
975
+ `,$=1;continue}let F=st(e,W);if(F)return F;if(S(W),l){if(_!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(_)){I+=`bash: declare: \`${_}': invalid variable name for name reference
976
+ `,$=1;continue}e.state.env.set(W,_),zr(e,W),_!==""&&Ll(e,_)&&xd(e,W),A(W),i&&Cn(e,W),o&&dr(e,W);continue}if(d&&fp(e,W),p&&dp(e,W),h&&pp(e,W),Zo(e,W)&&(_=await Z4(e,_)),_=Zi(e,W,_),rt(e,W)){let z=fn(e,W);z&&z!==W?e.state.env.set(z,_):e.state.env.set(W,_)}else e.state.env.set(W,_);A(W),i&&Cn(e,W),o&&dr(e,W),e.state.options.allexport&&!f&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(W))}else{let T=N;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(T)){I+=`bash: typeset: \`${T}': not a valid identifier
977
+ `,$=1;continue}if(r||s?E(T):S(T),l){zr(e,T);let _=e.state.env.get(T);_!==void 0&&_!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(_)?q7(e,T):_&&Ll(e,_)&&xd(e,T),A(T),i&&Cn(e,T),o&&dr(e,T);continue}if(d&&fp(e,T),p&&dp(e,T),h&&pp(e,T),s){if(Mt(e,T).length>0){I+=`bash: declare: ${T}: cannot convert indexed to associative array
978
+ `,$=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(T),es(e,T,"associative")}let W=Gt(e,T);!e.state.env.has(T)&&!W&&(r||s?es(e,T,s?"associative":"indexed"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(T))),A(T),i&&Cn(e,T),o&&dr(e,T)}}return Q("",I,$)}async function mp(e,t){let n={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength},r=!1,s=!1,i=!1,o=[];for(let a=0;a<t.length;a++){let l=t[a];if(l==="-a")r=!0;else if(l==="-A")s=!0;else if(l==="-p")i=!0;else if(l==="--"){o.push(...t.slice(a+1));break}else l.startsWith("-")||o.push(l)}if(o.length===0){let a="",l=Array.from(e.state.readonlyVars||[]).sort();for(let c of l){let u=e.state.env.get(c);if(u!==void 0){let f=u.replace(/\\/g,"\\\\").replace(/"/g,'\\"');a+=`declare -r ${c}="${f}"
979
+ `}}return Pe(a)}for(let a of o){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(l){let d=l[1],p=l[2],h=st(e,d);if(h)return h;let m=Wr(p,n);if(e.state.associativeArrays?.has(d)){let g=oc(p,n);e.executionScope.consumeWork(g.length,"readonly array append"),Ws(e,d,g.map(([b])=>b));for(let[b,w]of g)we(e,d,b,w,"associative")}else{e.executionScope.consumeWork(m.length,"readonly array append");let g=Mt(e,d),b=0,w=e.state.env.get(d);g.length===0&&w!==void 0?(we(e,d,0,w),e.state.env.delete(d),b=1):g.length>0&&(b=Math.max(...g)+1),Ws(e,d,Array.from({length:m.length},(y,x)=>b+x));for(let y=0;y<m.length;y++)we(e,d,b+y,m[y])}Cn(e,d);continue}let c=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(c){let d=c[1],p=c[2],h=st(e,d);if(h)return h;let m=e.state.env.get(d)??"";e.state.env.set(d,yr([m,p],"",e.limits.maxStringLength,"readonly append")),Cn(e,d);continue}let u=C4(a,n);if(u.value===void 0&&!u.isArray){Cn(e,u.name);continue}let f=await v4(e,u,{makeReadonly:!0});if(f)return f}return Me}function gp(e){return e.state.directoryStack??=[],e.state.directoryStack}function Ko(e,t){return t&&e===t?"~":t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function JI(e){let t=e.split("/").filter(r=>r&&r!=="."),n=[];for(let r of t)r===".."?n.pop():n.push(r);return`/${n.join("/")}`}async function yp(e,t){let n=gp(e),r;for(let a=0;a<t.length;a++){let l=t[a];if(l==="--"){if(a+1<t.length){if(r!==void 0)return K(`bash: pushd: too many arguments
980
+ `,2);r=t[a+1],a++}}else{if(l.startsWith("-")&&l!=="-")return K(`bash: pushd: ${l}: invalid option
981
+ `,2);if(r!==void 0)return K(`bash: pushd: too many arguments
982
+ `,2);r=l}}if(r===void 0){if(n.length<2)return K(`bash: pushd: no other directory
983
+ `,1);let a=n[0];n[0]=n[1],n[1]=a,r=n[0]}let s;if(r.startsWith("/"))s=r;else if(r===".."){let a=e.state.cwd.split("/").filter(l=>l);a.pop(),s=`/${a.join("/")}`}else r==="."?s=e.state.cwd:r.startsWith("~")?s=(e.state.env.get("HOME")||"/")+r.slice(1):s=`${e.state.cwd}/${r}`;s=JI(s);try{if(!(await e.fs.stat(s)).isDirectory)return K(`bash: pushd: ${r}: Not a directory
984
+ `,1)}catch{return K(`bash: pushd: ${r}: No such file or directory
985
+ `,1)}n.unshift(e.state.cwd),e.state.previousDir=e.state.cwd,e.state.cwd=s,e.state.env.set("PWD",s),e.state.env.set("OLDPWD",e.state.previousDir);let i=e.state.env.get("HOME")||"",o=`${[s,...n].map(a=>Ko(a,i)).join(" ")}
986
+ `;return Pe(o)}function wp(e,t){let n=gp(e);for(let o of t)if(o!=="--")return o.startsWith("-")&&o!=="-"?K(`bash: popd: ${o}: invalid option
987
+ `,2):K(`bash: popd: too many arguments
988
+ `,2);if(n.length===0)return K(`bash: popd: directory stack empty
989
+ `,1);let r=n.shift();if(!r)return K(`bash: popd: directory stack empty
990
+ `,1);e.state.previousDir=e.state.cwd,e.state.cwd=r,e.state.env.set("PWD",r),e.state.env.set("OLDPWD",e.state.previousDir);let s=e.state.env.get("HOME")||"",i=`${[r,...n].map(o=>Ko(o,s)).join(" ")}
991
+ `;return Pe(i)}function bp(e,t){let n=gp(e),r=!1,s=!1,i=!1,o=!1;for(let u of t)if(u!=="--")if(u.startsWith("-"))for(let f of u.slice(1))if(f==="c")r=!0;else if(f==="l")s=!0;else if(f==="p")i=!0;else if(f==="v")i=!0,o=!0;else return K(`bash: dirs: -${f}: invalid option
992
+ `,2);else return K(`bash: dirs: too many arguments
993
+ `,1);if(r)return e.state.directoryStack=[],Me;let a=[e.state.cwd,...n],l=e.state.env.get("HOME")||"",c;return o?(c=a.map((u,f)=>{let d=s?u:Ko(u,l);return` ${f} ${d}`}).join(`
994
+ `),c+=`
995
+ `):i?c=a.map(u=>s?u:Ko(u,l)).join(`
996
+ `)+`
997
+ `:c=a.map(u=>s?u:Ko(u,l)).join(" ")+`
998
+ `,Pe(c)}Z();async function yc(e,t,n,r=!1){let s=t;if(s.length>0){let l=s[0];if(l==="--")s=s.slice(1);else if(l.startsWith("-")&&l!=="-"&&l.length>1)return K(`bash: eval: ${l}: invalid option
999
+ eval: usage: eval [arg ...]
1000
+ `,2)}if(s.length===0)return Me;let i=s.join(" ");if(i.trim()==="")return Me;let o=e.state.groupStdin,a=r||n!==void 0&&n!=="";a&&(e.state.groupStdin=n??"");try{let l=Kn(i);return await e.executeScript(l)}catch(l){if(l instanceof Qt||l instanceof Xt||l instanceof Ut||l instanceof ye||l instanceof kt)throw l;if(l.name==="ParseException")return K(`bash: eval: ${l.message}
1001
+ `);throw l}finally{(a||o!==void 0&&e.state.groupStdin===void 0)&&(e.state.groupStdin=o)}}Z();function xp(e,t){let n,r="";if(t.length===0)n=e.state.lastExitCode;else{let s=t[0];if(s===""||!/^-?\d+$/.test(s))r=`bash: exit: ${s}: numeric argument required
1002
+ `,n=2;else{let i=BigInt(s);n=Number((i%256n+256n)%256n)}}throw new ye(n,"",r)}function Ep(e,t){let n=!1,r=[];for(let o of t)o==="-n"?n=!0:o==="-p"||o==="--"||r.push(o);if(r.length===0&&!n){let o="",a=e.state.exportedVars??new Set,l=Array.from(a).sort();for(let c of l){let u=e.state.env.get(c);u!==void 0&&(o+=`declare -x ${c}=${qo(u)}
1003
+ `)}return Pe(o)}if(n){for(let o of r){let a,l;if(o.includes("=")){let c=o.indexOf("=");a=o.slice(0,c),l=o.slice(c+1)}else a=o;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a))return Q("",`bash: export: \`${o}': not a valid identifier
1004
+ `,1);l!==void 0&&(st(e,a),e.state.env.set(a,l)),Bl(e,a)}return Me}let s="",i=0;for(let o of r){let a,l,c=!1,u=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(u)a=u[1],l=u[2],c=!0;else if(o.includes("=")){let f=o.indexOf("=");a=o.slice(0,f),l=o.slice(f+1)}else a=o;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)){s+=`bash: export: \`${o}': not a valid identifier
1005
+ `,i=1;continue}if(l!==void 0)if(st(e,a),c){let f=e.state.env.get(a)??"";e.state.env.set(a,f+l)}else e.state.env.set(a,l);else e.state.env.has(a)||e.state.env.set(a,"");dr(e,a)}return Q("",s,i)}function wc(e,t){if(t.length<2)return K(`bash: getopts: usage: getopts optstring name [arg ...]
1006
+ `);let n=t[0],r=t[1],s=!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r),i=n.startsWith(":"),o=i?n.slice(1):n,a;if(t.length>2)a=t.slice(2);else{let m=Number.parseInt(e.state.env.get("#")||"0",10);a=[];for(let g=1;g<=m;g++)a.push(e.state.env.get(String(g))||"")}let l=Number.parseInt(e.state.env.get("OPTIND")||"1",10);l<1&&(l=1);let c=Number.parseInt(e.state.env.get("__GETOPTS_CHARINDEX")||"0",10);if(e.state.env.set("OPTARG",""),l>a.length)return s||e.state.env.set(r,"?"),e.state.env.set("OPTIND",String(a.length+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:s?2:1,stdout:"",stderr:""};let u=a[l-1];if(!u||u==="-"||!u.startsWith("-"))return s||e.state.env.set(r,"?"),{exitCode:s?2:1,stdout:"",stderr:""};if(u==="--")return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),s||e.state.env.set(r,"?"),{exitCode:s?2:1,stdout:"",stderr:""};let f=c===0?1:c,d=u[f];if(!d)return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),wc(e,t);let p=o.indexOf(d);if(p===-1){let m="";return i?e.state.env.set("OPTARG",d):m=`bash: illegal option -- ${d}
1007
+ `,s||e.state.env.set(r,"?"),f+1<u.length?(e.state.env.set("__GETOPTS_CHARINDEX",String(f+1)),e.state.env.set("OPTIND",String(l))):(e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0")),{exitCode:s?2:0,stdout:"",stderr:m}}if(p+1<o.length&&o[p+1]===":")if(f+1<u.length)e.state.env.set("OPTARG",u.slice(f+1)),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0");else{if(l>=a.length){let m="";return i?(e.state.env.set("OPTARG",d),s||e.state.env.set(r,":")):(m=`bash: option requires an argument -- ${d}
1008
+ `,s||e.state.env.set(r,"?")),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:s?2:0,stdout:"",stderr:m}}e.state.env.set("OPTARG",a[l]),e.state.env.set("OPTIND",String(l+2)),e.state.env.set("__GETOPTS_CHARINDEX","0")}else f+1<u.length?(e.state.env.set("__GETOPTS_CHARINDEX",String(f+1)),e.state.env.set("OPTIND",String(l))):(e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"));return s||e.state.env.set(r,d),{exitCode:s?2:0,stdout:"",stderr:""}}async function Sp(e,t){e.state.hashTable||(e.state.hashTable=new Map);let n=!1,r=!1,s=!1,i=!1,o=!1,a="",l=[],c=0;for(;c<t.length;){let h=t[c];if(h==="--"){c++,l.push(...t.slice(c));break}if(h==="-r")n=!0,c++;else if(h==="-d")r=!0,c++;else if(h==="-l")s=!0,c++;else if(h==="-t")o=!0,c++;else if(h==="-p"){if(i=!0,c++,c>=t.length)return K(`bash: hash: -p: option requires an argument
1009
+ `,1);a=t[c],c++}else if(h.startsWith("-")&&h.length>1){for(let m of h.slice(1))if(m==="r")n=!0;else if(m==="d")r=!0;else if(m==="l")s=!0;else if(m==="t")o=!0;else return m==="p"?K(`bash: hash: -p: option requires an argument
1010
+ `,1):K(`bash: hash: -${m}: invalid option
1011
+ `,1);c++}else l.push(h),c++}if(n)return e.state.hashTable.clear(),Me;if(r){if(l.length===0)return K(`bash: hash: -d: option requires an argument
1012
+ `,1);let h=!1,m="";for(let g of l)e.state.hashTable.has(g)?e.state.hashTable.delete(g):(m+=`bash: hash: ${g}: not found
1013
+ `,h=!0);return h?K(m,1):Me}if(o){if(l.length===0)return K(`bash: hash: -t: option requires an argument
1014
+ `,1);let h="",m=!1,g="";for(let b of l){let w=e.state.hashTable.get(b);w?l.length>1?h+=`${b} ${w}
1015
+ `:h+=`${w}
1016
+ `:(g+=`bash: hash: ${b}: not found
1017
+ `,m=!0)}return m?{exitCode:1,stdout:h,stderr:g}:Pe(h)}if(i){if(l.length===0)return K(`bash: hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
1018
+ `,1);let h=l[0];return e.state.hashTable.set(h,a),Me}if(l.length===0){if(e.state.hashTable.size===0)return Pe(`hash: hash table empty
1019
+ `);let h="";if(s)for(let[m,g]of e.state.hashTable){let b=m.startsWith("-")?" --":"";h+=`builtin hash -p ${Rt(g)}${b} ${Rt(m)}
1020
+ `}else{h=`hits command
1021
+ `;for(let[,m]of e.state.hashTable)h+=` 1 ${m}
1022
+ `}return Pe(h)}let u=!1,f="",p=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let h of l){if(h.includes("/")){f+=`bash: hash: ${h}: cannot use / in name
1023
+ `,u=!0;continue}let m=!1;for(let g of p){if(!g)continue;let b=`${g}/${h}`;if(await e.fs.exists(b)){e.state.hashTable.set(h,b),m=!0;break}}m||(f+=`bash: hash: ${h}: not found
1024
+ `,u=!0)}return u?K(f,1):Me}pt();var K4=new Map([[":",[": [arguments]",`Null command.
1025
+ No effect; the command does nothing.
1026
+ Exit Status:
1027
+ Always succeeds.`]],[".",[". filename [arguments]",`Execute commands from a file in the current shell.
1028
+ Read and execute commands from FILENAME in the current shell.
1029
+ The entries in $PATH are used to find the directory containing FILENAME.
1030
+ Exit Status:
1031
+ Returns the status of the last command executed in FILENAME.`]],["[",["[ arg... ]",`Evaluate conditional expression.
1032
+ This is a synonym for the "test" builtin, but the last argument must
1033
+ be a literal \`]', to match the opening \`['.`]],["alias",["alias [-p] [name[=value] ... ]",`Define or display aliases.
1034
+ Without arguments, \`alias' prints the list of aliases in the reusable
1035
+ form \`alias NAME=VALUE' on standard output.
1036
+ Exit Status:
1037
+ alias returns true unless a NAME is supplied for which no alias has been
1038
+ defined.`]],["bg",["bg [job_spec ...]",`Move jobs to the background.
1039
+ Place the jobs identified by each JOB_SPEC in the background, as if they
1040
+ had been started with \`&'.`]],["break",["break [n]",`Exit for, while, or until loops.
1041
+ Exit a FOR, WHILE or UNTIL loop. If N is specified, break N enclosing
1042
+ loops.
1043
+ Exit Status:
1044
+ The exit status is 0 unless N is not greater than or equal to 1.`]],["builtin",["builtin [shell-builtin [arg ...]]",`Execute shell builtins.
1045
+ Execute SHELL-BUILTIN with arguments ARGs without performing command
1046
+ lookup. This is useful when you wish to reimplement a shell builtin
1047
+ as a shell function, but need to execute the builtin within the function.
1048
+ Exit Status:
1049
+ Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
1050
+ not a shell builtin.`]],["caller",["caller [expr]",`Return the context of the current subroutine call.
1051
+ Without EXPR, returns "$line $filename". With EXPR, returns
1052
+ "$line $subroutine $filename"; this extra information can be used to
1053
+ provide a stack trace.
1054
+ Exit Status:
1055
+ Returns 0 unless the shell is not executing a subroutine call or
1056
+ EXPR is invalid.`]],["cd",["cd [-L|-P] [dir]",`Change the shell working directory.
1057
+ Change the current directory to DIR. The default DIR is the value of the
1058
+ HOME shell variable.
1059
+
1060
+ The variable CDPATH defines the search path for the directory containing
1061
+ DIR. Alternative directory names in CDPATH are separated by a colon (:).
1062
+ A null directory name is the same as the current directory. If DIR begins
1063
+ with a slash (/), then CDPATH is not used.
1064
+
1065
+ If the directory is not found, and the shell option \`cdable_vars' is set,
1066
+ the word is assumed to be a variable name. If that variable has a value,
1067
+ its value is used for DIR.
1068
+
1069
+ Options:
1070
+ -L force symbolic links to be followed
1071
+ -P use the physical directory structure without following symbolic
1072
+ links
1073
+
1074
+ The default is to follow symbolic links, as if \`-L' were specified.
1075
+
1076
+ Exit Status:
1077
+ Returns 0 if the directory is changed; non-zero otherwise.`]],["command",["command [-pVv] command [arg ...]",`Execute a simple command or display information about commands.
1078
+ Runs COMMAND with ARGS suppressing shell function lookup, or display
1079
+ information about the specified COMMANDs.
1080
+
1081
+ Options:
1082
+ -p use a default value for PATH that is guaranteed to find all of
1083
+ the standard utilities
1084
+ -v print a description of COMMAND similar to the \`type' builtin
1085
+ -V print a more verbose description of each COMMAND
1086
+
1087
+ Exit Status:
1088
+ Returns exit status of COMMAND, or failure if COMMAND is not found.`]],["compgen",["compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]",`Display possible completions depending on the options.
1089
+ Intended to be used from within a shell function generating possible
1090
+ completions. If the optional WORD argument is supplied, matches against
1091
+ WORD are generated.
1092
+ Exit Status:
1093
+ Returns success unless an invalid option is supplied or an error occurs.`]],["complete",["complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]",`Specify how arguments are to be completed.
1094
+ For each NAME, specify how arguments are to be completed.
1095
+ Exit Status:
1096
+ Returns success unless an invalid option is supplied or an error occurs.`]],["continue",["continue [n]",`Resume for, while, or until loops.
1097
+ Resumes the next iteration of the enclosing FOR, WHILE or UNTIL loop.
1098
+ If N is specified, resumes the Nth enclosing loop.
1099
+ Exit Status:
1100
+ The exit status is 0 unless N is not greater than or equal to 1.`]],["declare",["declare [-aAfFgilnrtux] [-p] [name[=value] ...]",`Set variable values and attributes.
1101
+ Declare variables and give them attributes. If no NAMEs are given,
1102
+ display the attributes and values of all variables.
1103
+
1104
+ Options:
1105
+ -a to make NAMEs indexed arrays (if supported)
1106
+ -A to make NAMEs associative arrays (if supported)
1107
+ -i to make NAMEs have the \`integer' attribute
1108
+ -l to convert the value of each NAME to lower case on assignment
1109
+ -n make NAME a reference to the variable named by its value
1110
+ -r to make NAMEs readonly
1111
+ -t to make NAMEs have the \`trace' attribute
1112
+ -u to convert the value of each NAME to upper case on assignment
1113
+ -x to make NAMEs export
1114
+
1115
+ Exit Status:
1116
+ Returns success unless an invalid option is supplied or a variable
1117
+ assignment error occurs.`]],["dirs",["dirs [-clpv] [+N] [-N]",`Display directory stack.
1118
+ Display the list of currently remembered directories. Directories
1119
+ find their way onto the list with the \`pushd' command; you can get
1120
+ back up through the list with the \`popd' command.
1121
+ Exit Status:
1122
+ Returns success unless an invalid option is supplied or an error occurs.`]],["disown",["disown [-h] [-ar] [jobspec ...]",`Remove jobs from current shell.
1123
+ Without any JOBSPECs, remove the current job.`]],["echo",["echo [-neE] [arg ...]",`Write arguments to the standard output.
1124
+ Display the ARGs, separated by a single space character and followed by a
1125
+ newline, on the standard output.
1126
+
1127
+ Options:
1128
+ -n do not append a newline
1129
+ -e enable interpretation of the following backslash escapes
1130
+ -E explicitly suppress interpretation of backslash escapes
1131
+
1132
+ Exit Status:
1133
+ Returns success unless a write error occurs.`]],["enable",["enable [-a] [-dnps] [-f filename] [name ...]",`Enable and disable shell builtins.
1134
+ Enables and disables builtin shell commands.
1135
+ Exit Status:
1136
+ Returns success unless NAME is not a shell builtin or an error occurs.`]],["eval",["eval [arg ...]",`Execute arguments as a shell command.
1137
+ Combine ARGs into a single string, use the result as input to the shell,
1138
+ and execute the resulting commands.
1139
+ Exit Status:
1140
+ Returns exit status of command or success if command is null.`]],["exec",["exec [-cl] [-a name] [command [arguments ...]] [redirection ...]",`Replace the shell with the given command.
1141
+ Execute COMMAND, replacing this shell with the specified program.
1142
+ ARGUMENTS become the arguments to COMMAND. If COMMAND is not specified,
1143
+ any redirections take effect in the current shell.
1144
+ Exit Status:
1145
+ Returns success unless COMMAND is not found or a redirection error occurs.`]],["exit",["exit [n]",`Exit the shell.
1146
+ Exits the shell with a status of N. If N is omitted, the exit status
1147
+ is that of the last command executed.`]],["export",["export [-fn] [name[=value] ...] or export -p",`Set export attribute for shell variables.
1148
+ Marks each NAME for automatic export to the environment of subsequently
1149
+ executed commands. If VALUE is supplied, assign VALUE before exporting.
1150
+
1151
+ Options:
1152
+ -f refer to shell functions
1153
+ -n remove the export property from each NAME
1154
+ -p display a list of all exported variables and functions
1155
+
1156
+ Exit Status:
1157
+ Returns success unless an invalid option is given or NAME is invalid.`]],["false",["false",`Return an unsuccessful result.
1158
+ Exit Status:
1159
+ Always fails.`]],["fc",["fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]",`Display or execute commands from the history list.
1160
+ Exit Status:
1161
+ Returns success or status of executed command.`]],["fg",["fg [job_spec]",`Move job to the foreground.
1162
+ Place the job identified by JOB_SPEC in the foreground, making it the
1163
+ current job.`]],["getopts",["getopts optstring name [arg]",`Parse option arguments.
1164
+ Getopts is used by shell procedures to parse positional parameters
1165
+ as options.
1166
+
1167
+ OPTSTRING contains the option letters to be recognized; if a letter
1168
+ is followed by a colon, the option is expected to have an argument,
1169
+ which should be separated from it by white space.
1170
+ Exit Status:
1171
+ Returns success if an option is found; fails if the end of options is
1172
+ encountered or an error occurs.`]],["hash",["hash [-lr] [-p pathname] [-dt] [name ...]",`Remember or display program locations.
1173
+ Determine and remember the full pathname of each command NAME.
1174
+ Exit Status:
1175
+ Returns success unless NAME is not found or an invalid option is given.`]],["help",["help [-s] [pattern ...]",`Display information about builtin commands.
1176
+ Displays brief summaries of builtin commands. If PATTERN is
1177
+ specified, gives detailed help on all commands matching PATTERN,
1178
+ otherwise the list of help topics is printed.
1179
+
1180
+ Options:
1181
+ -s output only a short usage synopsis for each topic matching
1182
+ PATTERN
1183
+
1184
+ Exit Status:
1185
+ Returns success unless PATTERN is not found.`]],["history",["history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]",`Display or manipulate the history list.
1186
+ Display the history list with line numbers, prefixing each modified
1187
+ entry with a \`*'.
1188
+ Exit Status:
1189
+ Returns success unless an invalid option is given or an error occurs.`]],["jobs",["jobs [-lnprs] [jobspec ...] or jobs -x command [args]",`Display status of jobs.
1190
+ Lists the active jobs.
1191
+ Exit Status:
1192
+ Returns success unless an invalid option is given or an error occurs.`]],["kill",["kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]",`Send a signal to a job.
1193
+ Send the processes identified by PID or JOBSPEC the signal named by
1194
+ SIGSPEC or SIGNUM.
1195
+ Exit Status:
1196
+ Returns success unless an invalid option is given or an error occurs.`]],["let",["let arg [arg ...]",`Evaluate arithmetic expressions.
1197
+ Evaluate each ARG as an arithmetic expression. Evaluation is done in
1198
+ fixed-width integers with no check for overflow, though division by 0
1199
+ is trapped and flagged as an error.
1200
+ Exit Status:
1201
+ If the last ARG evaluates to 0, let returns 1; 0 is returned otherwise.`]],["local",["local [option] name[=value] ...",`Define local variables.
1202
+ Create a local variable called NAME, and give it VALUE. OPTION can
1203
+ be any option accepted by \`declare'.
1204
+
1205
+ Local can only be used within a function; it makes the variable NAME
1206
+ have a visible scope restricted to that function and its children.
1207
+ Exit Status:
1208
+ Returns success unless an invalid option is supplied, a variable
1209
+ assignment error occurs, or the shell is not executing a function.`]],["logout",["logout [n]",`Exit a login shell.
1210
+ Exits a login shell with exit status N. Returns an error if not executed
1211
+ in a login shell.`]],["mapfile",["mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]",`Read lines from the standard input into an indexed array variable.
1212
+ Read lines from the standard input into the indexed array variable ARRAY,
1213
+ or from file descriptor FD if the -u option is supplied.
1214
+
1215
+ Options:
1216
+ -d delim Use DELIM to terminate lines, instead of newline
1217
+ -n count Copy at most COUNT lines
1218
+ -O origin Begin assigning to ARRAY at index ORIGIN
1219
+ -s count Discard the first COUNT lines read
1220
+ -t Remove a trailing DELIM from each line read (default newline)
1221
+ -u fd Read lines from file descriptor FD instead of standard input
1222
+
1223
+ Exit Status:
1224
+ Returns success unless an invalid option is given or ARRAY is readonly.`]],["popd",["popd [-n] [+N | -N]",`Remove directories from stack.
1225
+ Removes entries from the directory stack.
1226
+ Exit Status:
1227
+ Returns success unless an invalid argument is supplied or the directory
1228
+ change fails.`]],["printf",["printf [-v var] format [arguments]",`Formats and prints ARGUMENTS under control of the FORMAT.
1229
+
1230
+ Options:
1231
+ -v var assign the output to shell variable VAR rather than
1232
+ display it on the standard output
1233
+
1234
+ FORMAT is a character string which contains three types of objects: plain
1235
+ characters, which are simply copied to standard output; character escape
1236
+ sequences, which are converted and copied to the standard output; and
1237
+ format specifications, each of which causes printing of the next successive
1238
+ argument.
1239
+ Exit Status:
1240
+ Returns success unless an invalid option is given or a write or assignment
1241
+ error occurs.`]],["pushd",["pushd [-n] [+N | -N | dir]",`Add directories to stack.
1242
+ Adds a directory to the top of the directory stack, or rotates
1243
+ the stack, making the new top of the stack the current working
1244
+ directory.
1245
+ Exit Status:
1246
+ Returns success unless an invalid argument is supplied or the directory
1247
+ change fails.`]],["pwd",["pwd [-LP]",`Print the name of the current working directory.
1248
+
1249
+ Options:
1250
+ -L print the value of $PWD if it names the current working
1251
+ directory
1252
+ -P print the physical directory, without any symbolic links
1253
+
1254
+ By default, \`pwd' behaves as if \`-L' were specified.
1255
+ Exit Status:
1256
+ Returns 0 unless an invalid option is given or the current directory
1257
+ cannot be read.`]],["read",["read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]",`Read a line from the standard input and split it into fields.
1258
+ Reads a single line from the standard input, or from file descriptor FD
1259
+ if the -u option is supplied. The line is split into fields as with word
1260
+ splitting, and the first word is assigned to the first NAME, the second
1261
+ word to the second NAME, and so on, with any leftover words assigned to
1262
+ the last NAME.
1263
+ Exit Status:
1264
+ The return code is zero, unless end-of-file is encountered, read times out,
1265
+ or an invalid file descriptor is supplied as the argument to -u.`]],["readarray",["readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]","Read lines from a file into an array variable.\n A synonym for `mapfile'."]],["readonly",["readonly [-aAf] [name[=value] ...] or readonly -p",`Mark shell variables as unchangeable.
1266
+ Mark each NAME as read-only; the values of these NAMEs may not be
1267
+ changed by subsequent assignment.
1268
+ Exit Status:
1269
+ Returns success unless an invalid option is given or NAME is invalid.`]],["return",["return [n]",`Return from a shell function.
1270
+ Causes a function or sourced script to exit with the return value
1271
+ specified by N. If N is omitted, the return status is that of the
1272
+ last command executed within the function or script.
1273
+ Exit Status:
1274
+ Returns N, or failure if the shell is not executing a function or script.`]],["set",["set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]",`Set or unset values of shell options and positional parameters.
1275
+ Change the value of shell attributes and positional parameters, or
1276
+ display the names and values of shell variables.
1277
+
1278
+ Options:
1279
+ -e Exit immediately if a command exits with a non-zero status.
1280
+ -u Treat unset variables as an error when substituting.
1281
+ -x Print commands and their arguments as they are executed.
1282
+ -o option-name
1283
+ Set the variable corresponding to option-name
1284
+
1285
+ Exit Status:
1286
+ Returns success unless an invalid option is given.`]],["shift",["shift [n]",`Shift positional parameters.
1287
+ Rename the positional parameters $N+1,$N+2 ... to $1,$2 ... If N is
1288
+ not given, it is assumed to be 1.
1289
+ Exit Status:
1290
+ Returns success unless N is negative or greater than $#.`]],["shopt",["shopt [-pqsu] [-o] [optname ...]",`Set and unset shell options.
1291
+ Change the setting of each shell option OPTNAME. Without any option
1292
+ arguments, list each supplied OPTNAME, or all shell options if no
1293
+ OPTNAMEs are given, with an indication of whether or not each is set.
1294
+
1295
+ Options:
1296
+ -o restrict OPTNAMEs to those defined for use with \`set -o'
1297
+ -p print each shell option with an indication of its status
1298
+ -q suppress output
1299
+ -s enable (set) each OPTNAME
1300
+ -u disable (unset) each OPTNAME
1301
+
1302
+ Exit Status:
1303
+ Returns success if OPTNAME is enabled; fails if an invalid option is
1304
+ given or OPTNAME is disabled.`]],["source",["source filename [arguments]",`Execute commands from a file in the current shell.
1305
+ Read and execute commands from FILENAME in the current shell.
1306
+ The entries in $PATH are used to find the directory containing FILENAME.
1307
+ Exit Status:
1308
+ Returns the status of the last command executed in FILENAME.`]],["suspend",["suspend [-f]",`Suspend shell execution.
1309
+ Suspend the execution of this shell until it receives a SIGCONT signal.`]],["test",["test [expr]",`Evaluate conditional expression.
1310
+ Exits with a status of 0 (true) or 1 (false) depending on
1311
+ the evaluation of EXPR. Expressions may be unary or binary.
1312
+ Exit Status:
1313
+ Returns success if EXPR evaluates to true; fails if EXPR evaluates to
1314
+ false or an invalid argument is given.`]],["times",["times",`Display process times.
1315
+ Prints the accumulated user and system times for the shell and all of its
1316
+ child processes.
1317
+ Exit Status:
1318
+ Always succeeds.`]],["trap",["trap [-lp] [[arg] signal_spec ...]",`Trap signals and other events.
1319
+ Defines and activates handlers to be run when the shell receives signals
1320
+ or other conditions.
1321
+ Exit Status:
1322
+ Returns success unless a SIGSPEC is invalid or an invalid option is given.`]],["true",["true",`Return a successful result.
1323
+ Exit Status:
1324
+ Always succeeds.`]],["type",["type [-afptP] name [name ...]",`Display information about command type.
1325
+ For each NAME, indicate how it would be interpreted if used as a
1326
+ command name.
1327
+
1328
+ Options:
1329
+ -a display all locations containing an executable named NAME
1330
+ -f suppress shell function lookup
1331
+ -P force a PATH search for each NAME, even if it is an alias,
1332
+ builtin, or function, and returns the name of the disk file
1333
+ that would be executed
1334
+ -p returns either the name of the disk file that would be executed,
1335
+ or nothing if \`type -t NAME' would not return \`file'
1336
+ -t output a single word which is one of \`alias', \`keyword',
1337
+ \`function', \`builtin', \`file' or \`', if NAME is an alias,
1338
+ shell reserved word, shell function, shell builtin, disk file,
1339
+ or not found, respectively
1340
+
1341
+ Exit Status:
1342
+ Returns success if all of the NAMEs are found; fails if any are not found.`]],["typeset",["typeset [-aAfFgilnrtux] [-p] name[=value] ...","Set variable values and attributes.\n A synonym for `declare'."]],["ulimit",["ulimit [-SHabcdefiklmnpqrstuvxPT] [limit]",`Modify shell resource limits.
1343
+ Provides control over the resources available to the shell and processes
1344
+ it creates, on systems that allow such control.
1345
+ Exit Status:
1346
+ Returns success unless an invalid option is supplied or an error occurs.`]],["umask",["umask [-p] [-S] [mode]",`Display or set file mode mask.
1347
+ Sets the user file-creation mask to MODE. If MODE is omitted, prints
1348
+ the current value of the mask.
1349
+ Exit Status:
1350
+ Returns success unless MODE is invalid or an invalid option is given.`]],["unalias",["unalias [-a] name [name ...]",`Remove each NAME from the list of defined aliases.
1351
+ Exit Status:
1352
+ Returns success unless a NAME is not an existing alias.`]],["unset",["unset [-f] [-v] [-n] [name ...]",`Unset values and attributes of shell variables and functions.
1353
+ For each NAME, remove the corresponding variable or function.
1354
+
1355
+ Options:
1356
+ -f treat each NAME as a shell function
1357
+ -v treat each NAME as a shell variable
1358
+ -n treat each NAME as a name reference and unset the variable itself
1359
+ rather than the variable it references
1360
+
1361
+ Without options, unset first tries to unset a variable, and if that fails,
1362
+ tries to unset a function.
1363
+ Exit Status:
1364
+ Returns success unless an invalid option is given or a NAME is read-only.`]],["wait",["wait [-fn] [id ...]",`Wait for job completion and return exit status.
1365
+ Waits for each process identified by an ID, which may be a process ID or a
1366
+ job specification, and reports its termination status.
1367
+ Exit Status:
1368
+ Returns the status of the last ID; fails if ID is invalid or an invalid
1369
+ option is given.`]]]),Q4=[...K4.keys()].sort();function Ap(e,t){let n=!1,r=[],s=0;for(;s<t.length;){let l=t[s];if(l==="--"){for(s++;s<t.length;)r.push(t[s]),s++;break}if(l.startsWith("-")&&l.length>1){for(let c=1;c<l.length;c++){let u=l[c];if(u==="s")n=!0;else return K(`bash: help: -${u}: invalid option
1370
+ `,2)}s++}else r.push(l),s++}if(r.length===0)return tO();let i="",o=!1,a="";for(let l of r){let c=eO(l);if(c.length===0){a+=`bash: help: no help topics match \`${l}'. Try \`help help' or \`man -k ${l}' or \`info ${l}'.
1371
+ `,o=!0;continue}for(let u of c){let f=K4.get(u);if(!f)continue;let[d,p]=f;n?i+=`${u}: ${d}
1372
+ `:i+=`${u}: ${d}
1373
+ ${p}
1374
+ `}}return{exitCode:o?1:0,stdout:i,stderr:a}}function eO(e){let t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,"."),n=ie(`^${t}$`);return Q4.filter(r=>n.test(r))}function tO(){let e=[];e.push("just-bash shell builtins"),e.push("These shell commands are defined internally. Type `help' to see this list."),e.push("Type `help name' to find out more about the function `name'."),e.push("");let t=36,n=Q4.slice(),r=Math.ceil(n.length/2);for(let s=0;s<r;s++){let i=n[s]||"",o=n[s+r]||"",a=i.padEnd(t);e.push(o?`${a}${o}`:i)}return Pe(`${e.join(`
1375
+ `)}
1376
+ `)}function nO(e){let t=[],n="",r=0;for(let s of e){for(let i of s)i==="("?r++:i===")"&&r--;n?n+=` ${s}`:n=s,r===0&&(t.push(n),n="")}return n&&t.push(n),t}async function Cp(e,t){if(t.length===0)return K(`bash: let: expression expected
1377
+ `);let n=nO(t),r=0;for(let s of n)try{let o=Kn(`(( ${s} ))`).statements[0];if(o&&o.pipelines.length>0&&o.pipelines[0].commands.length>0){let a=o.pipelines[0].commands[0];a.type==="ArithmeticCommand"&&(r=await Re(e,a.expression.expression))}}catch(i){return K(`bash: let: ${s}: ${i.message}
1378
+ `)}return Q("","",r===0?1:0)}At();async function vp(e,t){let n={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength};if(e.state.localScopes.length===0)return K(`bash: local: can only be used in a function
1379
+ `);let r=e.state.localScopes[e.state.localScopes.length-1];for(e.state.localArrayScopes??=[];e.state.localArrayScopes.length<e.state.localScopes.length;)e.state.localArrayScopes.push(new Map);let s=e.state.localArrayScopes.at(-1),i=d=>{if(r.has(d)||r.set(d,e.state.env.get(d)),s&&!s.has(d)){let p=zt(e,d);s.set(d,p?un(p):void 0)}},o="",a=0,l=!1,c=!1,u=!1,f=[];for(let d of t)if(d==="-n")l=!0;else if(d==="-a")c=!0;else if(d==="-p")u=!0;else if(d.startsWith("-")&&!d.includes("="))for(let p of d.slice(1))p==="n"?l=!0:p==="a"?c=!0:p==="p"&&(u=!0);else f.push(d);if(f.length===0){let d="",p=Array.from(r.keys()).sort();for(let h of p){let m=e.state.env.get(h);m!==void 0&&(d+=`${h}=${m}
1380
+ `)}return Q(d,"",0)}for(let d of f){let p,h,m=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(m){p=m[1];let x=m[2];if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(p)){o+=`bash: local: \`${d}': not a valid identifier
1381
+ `,a=1;continue}st(e,p,"bash");let S=Wr(x,n);e.executionScope.consumeWork(S.length,"local array assignment"),i(p),vt(e,p),es(e,p,"indexed");for(let E=0;E<S.length;E++)we(e,p,E,S[E]);ds(e,p),l&&zr(e,p);continue}let g=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(g){p=g[1];let x=g[2];st(e,p,"bash"),i(p);let S=Wr(x,n);e.executionScope.consumeWork(S.length,"local array append");let E=Mt(e,p),A=0,I=e.state.env.get(p);E.length===0&&I!==void 0?(we(e,p,0,I),e.state.env.delete(p),A=1):E.length>0&&(A=Math.max(...E)+1),Ws(e,p,Array.from({length:S.length},($,N)=>A+N));for(let $=0;$<S.length;$++)we(e,p,A+$,S[$]);ds(e,p),l&&zr(e,p);continue}let b=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(b){p=b[1];let x=b[2];st(e,p,"bash"),r.has(p)||r.set(p,e.state.env.get(p));let S=e.state.env.get(p)??"";e.state.env.set(p,yr([S,x],"",e.limits.maxStringLength,"local append")),ds(e,p),l&&zr(e,p);continue}let w=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(w){p=w[1];let x=w[2],S=w[3];st(e,p,"bash"),i(p);let E;try{let A=new be,I=_e(A,x);E=await Re(e,I.expression)}catch{let A=parseInt(x,10);E=Number.isNaN(A)?0:A}we(e,p,E,S),ds(e,p),l&&zr(e,p);continue}if(d.includes("=")){let x=d.indexOf("=");p=d.slice(0,x),h=d.slice(x+1)}else p=d;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(p)){o+=`bash: local: \`${d}': not a valid identifier
1382
+ `,a=1;continue}let y=r.has(p);if(h!==void 0){let x=e.state.env.get(p);if(e.state.tempEnvBindings){let S=e.state.accessedTempEnvVars?.has(p),E=e.state.mutatedTempEnvVars?.has(p);if(!S&&!E)for(let A=e.state.tempEnvBindings.length-1;A>=0;A--){let I=e.state.tempEnvBindings[A];if(I.has(p)){x=I.get(p);break}}}k4(e,p,x)}if(!y){let x=e.state.env.get(p);if(e.state.tempEnvBindings)for(let S=e.state.tempEnvBindings.length-1;S>=0;S--){let E=e.state.tempEnvBindings[S];if(E.has(p)){x=E.get(p);break}}r.set(p,x),c&&i(p)}if(c&&h===void 0)vt(e,p),es(e,p,"indexed");else if(h!==void 0){if(st(e,p,"bash"),l&&h!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(h)){o+=`bash: local: \`${h}': invalid variable name for name reference
1383
+ `,a=1;continue}e.state.env.set(p,h),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(p))}else{let x=e.state.tempEnvBindings?.some(S=>S.has(p));!y&&!x&&e.state.env.delete(p)}ds(e,p),l&&zr(e,p)}return Q("",o,a)}ce();Z();function kp(e,t,n){let r=`
1384
+ `,s=0,i=0,o=0,a=!1,l="MAPFILE",c=0;for(;c<t.length;){let w=t[c];w==="-d"&&c+1<t.length?(r=t[c+1]===""?"\0":t[c+1]||`
1385
+ `,c+=2):w==="-n"&&c+1<t.length?(s=Number.parseInt(t[c+1],10)||0,c+=2):w==="-O"&&c+1<t.length?(i=Number.parseInt(t[c+1],10)||0,c+=2):w==="-s"&&c+1<t.length?(o=Number.parseInt(t[c+1],10)||0,c+=2):w==="-t"?(a=!0,c++):w==="-u"||w==="-C"||w==="-c"?c+=2:(w.startsWith("-")||(l=w),c++)}if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(l))return Q("",`mapfile: ${l}: not a valid identifier
1386
+ `,1);if(!Number.isSafeInteger(i)||i<0)return Q("",`mapfile: invalid array origin
1387
+ `,1);st(e,l,"mapfile");let u=n;!u&&e.state.groupStdin!==void 0&&(u=e.state.groupStdin);let f=[],d=0,p=0,h=0,m=e.limits.maxArrayElements,g=w=>{if(U(w)>e.limits.maxStringLength)throw new C(`mapfile: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");f.push(w)};for(;d<u.length;){e.executionScope.consumeWork(1,"mapfile input");let w=u.indexOf(r,d);if(w===-1){if(d<u.length){if(h<o)h++;else if(s===0||p<s){let S=u.slice(d),E=S.indexOf("\0");if(E!==-1&&(S=S.substring(0,E)),f.length>=m)return Q("",`mapfile: array element limit exceeded (${m})
1388
+ `,1);g(S),p++}}break}let y=u.slice(d,w),x=y.indexOf("\0");if(x!==-1&&(y=y.substring(0,x)),!a&&r!=="\0"&&(y+=r),d=w+r.length,h<o){h++;continue}if(s>0&&p>=s)break;if(f.length>=m)return Q("",`mapfile: array element limit exceeded (${m})
1389
+ `,1);g(y),p++}let b=new Set(i===0?[]:e.state.arrays?.get(l)?.elements.keys()??[]);for(let w=0;w<f.length;w++)if(b.add(String(i+w)),b.size>m)return Q("",`mapfile: array element limit exceeded (${m})
1390
+ `,1);i===0&&vt(e,l);for(let w=0;w<f.length;w++)we(e,l,i+w,f[w]);return e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=""),{...Q("","",0),internalStdinConsumed:u.length}}ce();Z();function Np(e,t,n,r=-1){let s=!1,i=`
1391
+ `,o="",a=-1,l=-1,c=null,u=-1,f=-1,d=[],p=0,h=!1,m=(F,z)=>{let D=1;for(;D<F.length;){let X=F[D];if(X==="r")s=!0,D++;else if(X==="s")D++;else{if(X==="d")return D+1<F.length?(i=F.substring(D+1),{nextArgIndex:z+1}):z+1<t.length?(i=t[z+1],{nextArgIndex:z+2}):{nextArgIndex:z+1};if(X==="n"){if(D+1<F.length){let V=F.substring(D+1);return a=Number.parseInt(V,10),(Number.isNaN(a)||a<0)&&(h=!0,a=0),{nextArgIndex:z+1}}else if(z+1<t.length)return a=Number.parseInt(t[z+1],10),(Number.isNaN(a)||a<0)&&(h=!0,a=0),{nextArgIndex:z+2};return{nextArgIndex:z+1}}else if(X==="N"){if(D+1<F.length){let V=F.substring(D+1);return l=Number.parseInt(V,10),(Number.isNaN(l)||l<0)&&(h=!0,l=0),{nextArgIndex:z+1}}else if(z+1<t.length)return l=Number.parseInt(t[z+1],10),(Number.isNaN(l)||l<0)&&(h=!0,l=0),{nextArgIndex:z+2};return{nextArgIndex:z+1}}else{if(X==="a")return D+1<F.length?(c=F.substring(D+1),{nextArgIndex:z+1}):z+1<t.length?(c=t[z+1],{nextArgIndex:z+2}):{nextArgIndex:z+1};if(X==="p")return D+1<F.length?(o=F.substring(D+1),{nextArgIndex:z+1}):z+1<t.length?(o=t[z+1],{nextArgIndex:z+2}):{nextArgIndex:z+1};if(X==="u"){if(D+1<F.length){let V=F.substring(D+1);return u=Number.parseInt(V,10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:z+1}}else if(z+1<t.length)return u=Number.parseInt(t[z+1],10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:z+2};return{nextArgIndex:z+1}}else if(X==="t"){if(D+1<F.length){let V=F.substring(D+1);return f=Number.parseFloat(V),Number.isNaN(f)&&(f=0),{nextArgIndex:z+1}}else if(z+1<t.length)return f=Number.parseFloat(t[z+1]),Number.isNaN(f)&&(f=0),{nextArgIndex:z+2};return{nextArgIndex:z+1}}else if(X==="e"||X==="i"||X==="P"){if(X==="i"&&z+1<t.length)return{nextArgIndex:z+2};D++}else D++}}}return{nextArgIndex:z+1}};for(;p<t.length;){let F=t[p];if(F.startsWith("-")&&F.length>1&&F!=="--"){let z=m(F,p);if(z.nextArgIndex===-1)return{stdout:"",stderr:"",exitCode:2};if(z.nextArgIndex===-2)return{stdout:"",stderr:"",exitCode:1};p=z.nextArgIndex}else if(F==="--")for(p++;p<t.length;)d.push(t[p]),p++;else d.push(F),p++}if(h)return Q("","",1);d.length===0&&c===null&&d.push("REPLY");let g=new Set;c&&g.add(c);for(let F of d)g.add(F);l>=0&&d.length===0&&g.add("REPLY");for(let F of g){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(F))return Q("",`bash: read: \`${F}': not a valid identifier
1392
+ `,1);st(e,F,"bash")}if(f===0){if(c)vt(e,c);else{for(let F of d)e.state.env.set(F,"");d.length===0&&e.state.env.set("REPLY","")}return Q("","",0)}if(f<0&&f!==-1)return Q("","",1);let b=n,w=Pn(e,u),y=u>0&&!(w?.kind==="dup-in"&&w.sourceFd===0);if(y){let F=dc(e,u);if("error"in F){let D=F.error==="write-only"||u===1||u===2?`bash: read: read error: ${u}: Bad file descriptor
1393
+ `:`bash: read: ${u}: invalid file descriptor: Bad file descriptor
1394
+ `;return Q("",D,1)}b=F.content}else!b&&e.state.groupStdin!==void 0&&(b=e.state.groupStdin);let x=i===""?"\0":i,S="",E=0,A=F=>{let z=U(F);if(z>e.limits.maxStringLength-E)throw new C(`read: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");S+=F,E+=z},I=F=>{if(U(F)>e.limits.maxStringLength)throw new C(`read: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length")},$=0,N=!0,R=F=>{y?hs(e,u,F):r>=0?hs(e,r,F):e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=b.substring(F),e.state.groupStdinSourceFd!==void 0&&hs(e,e.state.groupStdinSourceFd,F))};if(l>=0){let F=Math.min(l,b.length);S=b.substring(0,F),I(S),$=F,N=F>=l,R($);let z=d[0]||"REPLY";e.state.env.set(z,S);for(let D=1;D<d.length;D++)e.state.env.set(d[D],"");return Q("","",N?0:1)}else if(a>=0){let F=0,z=0,D=!1;for(;z<b.length&&F<a;){let X=b[z];if(X===x){$=z+1,D=!0;break}if(!s&&X==="\\"&&z+1<b.length){let V=b[z+1];if(V===x&&x===`
1395
+ `){z+=2,$=z;continue}if(V===x){z+=2,F++,A(V),$=z;continue}A(V),z+=2,F++,$=z}else A(X),z++,F++,$=z}N=F>=a||D,R($)}else{$=0;let F=0;for(;F<b.length;){let z=b[F];if(z===x){$=F+x.length,N=!0;break}if(!s&&z==="\\"&&F+1<b.length){let D=b[F+1];if(D===`
1396
+ `){F+=2;continue}if(D===x){A(D),F+=2;continue}A(z),A(D),F+=2;continue}A(z),F++}if(F>=b.length&&(N=!1,$=F,S.length===0&&b.length===0)){for(let z of d)e.state.env.set(z,"");return c&&vt(e,c),Q("","",1)}R($)}x===`
1397
+ `&&S.endsWith(`
1398
+ `)&&(S=S.slice(0,-1));let O=F=>s?F:F.replace(/\\(.)/g,"$1");if(d.length===1&&d[0]==="REPLY")return e.state.env.set("REPLY",O(S)),Q("","",N?0:1);let B=Bt(e.state.env),L=e.limits.maxArrayElements;if(c){let{words:F}=bd(S,B,L,void 0,s);vt(e,c);for(let z=0;z<F.length;z++)we(e,c,z,O(F[z]));return Q("","",N?0:1)}let T=d.length,{words:W,wordStarts:_}=bd(S,B,L,T,s);for(let F=0;F<d.length;F++){let z=d[F];if(F<d.length-1)e.state.env.set(z,O(W[F]??""));else if(F<_.length){let D=S.substring(_[F]);D=V7(D,B,s),D=O(D),e.state.env.set(z,D)}else e.state.env.set(z,"")}return Q("","",N?0:1)}Z();function Ip(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return K("bash: return: can only `return' from a function or sourced script\n");let n=e.state.lastExitCode;if(t.length>0){let r=t[0],s=Number.parseInt(r,10);if(r===""||Number.isNaN(s)||!/^-?\d+$/.test(r))return K(`bash: return: ${r}: numeric argument required
1399
+ `,2);n=(s%256+256)%256}throw new Ut(n)}At();Z();var Qo=`set: usage: set [-eux] [+eux] [-o option] [+o option]
1400
+ Options:
1401
+ -e Exit immediately if a command exits with non-zero status
1402
+ +e Disable -e
1403
+ -u Treat unset variables as an error when substituting
1404
+ +u Disable -u
1405
+ -x Print commands and their arguments as they are executed
1406
+ +x Disable -x
1407
+ -o errexit Same as -e
1408
+ +o errexit Disable errexit
1409
+ -o nounset Same as -u
1410
+ +o nounset Disable nounset
1411
+ -o pipefail Return status of last failing command in pipeline
1412
+ +o pipefail Disable pipefail
1413
+ -o xtrace Same as -x
1414
+ +o xtrace Disable xtrace
1415
+ `,X4=new Map([["e","errexit"],["u","nounset"],["x","xtrace"],["v","verbose"],["f","noglob"],["C","noclobber"],["a","allexport"],["n","noexec"],["h",null],["b",null],["m",null],["B",null],["H",null],["P",null],["T",null],["E",null],["p",null]]),bc=new Map([["errexit","errexit"],["pipefail","pipefail"],["nounset","nounset"],["xtrace","xtrace"],["verbose","verbose"],["noclobber","noclobber"],["noglob","noglob"],["allexport","allexport"],["noexec","noexec"],["posix","posix"],["vi","vi"],["emacs","emacs"],["notify",null],["monitor",null],["braceexpand",null],["histexpand",null],["physical",null],["functrace",null],["errtrace",null],["privileged",null],["hashall",null],["ignoreeof",null],["interactive-comments",null],["keyword",null],["onecmd",null]]),e3=["errexit","nounset","pipefail","verbose","xtrace","posix","allexport","noclobber","noglob","noexec","vi","emacs"],t3=["braceexpand","errtrace","functrace","hashall","histexpand","history","ignoreeof","interactive-comments","keyword","monitor","nolog","notify","onecmd","physical","privileged"];function Op(e,t,n){t!==null&&(n&&(t==="vi"?e.state.options.emacs=!1:t==="emacs"&&(e.state.options.vi=!1)),e.state.options[t]=n,Li(e))}function rO(e,t){return t+1<e.length&&!e[t+1].startsWith("-")&&!e[t+1].startsWith("+")}function sO(e,t,n){let r=Mt(e,n);if(r.length===0){t.append(n).append("=()");return}t.append(n).append("=(");for(let s=0;s<r.length;s++){let i=r[s],o=Xe(e,n,i)??"";s>0&&t.append(" "),t.append(`[${i}]=`),t.reserve(gc(o)),t.append(ys(o))}t.append(")")}function iO(e,t){if(/^[a-zA-Z0-9_]+$/.test(t)){e.append(t);return}e.reserve(gc(t)),e.append(ys(t))}function oO(e,t,n){let r=kr(e,n);if(r.length===0){t.append(n).append("=()");return}t.append(n).append("=(");for(let s=0;s<r.length;s++){let i=r[s],o=Xe(e,n,i)??"";s>0&&t.append(" "),t.append("["),iO(t,i),t.append("]="),t.reserve(gc(o)),t.append(ys(o))}t.append(" )")}function aO(e){let t=new Set,n=e.state.associativeArrays??new Set;for(let[r,s]of e.state.arrays??[])s.kind==="indexed"&&!n.has(r)&&t.add(r);return t}function lO(e){return e.state.associativeArrays??new Set}function Y4(e){let t=e3.map(r=>`${r.padEnd(16)}${e.state.options[r]?"on":"off"}`),n=t3.map(r=>`${r.padEnd(16)}off`);return`${[...t,...n].sort().join(`
1416
+ `)}
1417
+ `}function J4(e){let t=e3.map(r=>`set ${e.state.options[r]?"-o":"+o"} ${r}`),n=t3.map(r=>`set +o ${r}`);return`${[...t,...n].sort().join(`
1418
+ `)}
1419
+ `}function Rp(e,t){if(t.includes("--help"))return Pe(Qo);if(t.length===0){let i=aO(e),o=lO(e),a=[];for(let[u,f]of e.state.env)/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)&&(i.has(u)||o.has(u)||a.push([u,f]));let l=[...a.map(([u,f])=>({kind:"scalar",name:u,value:f})),...Array.from(i,u=>({kind:"indexed",name:u})),...Array.from(o,u=>({kind:"associative",name:u}))];l.sort((u,f)=>u.name<f.name?-1:u.name>f.name?1:0);let c=new Te(e.limits.maxOutputSize,"set");for(let u of l)e.executionScope.consumeWork(1,"set variable listing"),u.kind==="scalar"?(c.append(u.name).append("="),c.reserve(B4(u.value)),c.append(Rt(u.value))):u.kind==="indexed"?sO(e,c,u.name):oO(e,c,u.name),c.append(`
1420
+ `);return Pe(c.build())}let n=[],r=()=>n.length>0?Pe(n.join("")):Me,s=0;for(;s<t.length;){let i=t[s];if((i==="-o"||i==="+o")&&rO(t,s)){let o=t[s+1];if(!bc.has(o)){let a=`bash: set: ${o}: invalid option name
1421
+ ${Qo}`;if(e.state.options.posix)throw new hn(1,"",a);return K(a)}Op(e,bc.get(o)??null,i==="-o"),s+=2;continue}if(i==="-o"){n.push(Y4(e)),s++;continue}if(i==="+o"){n.push(J4(e)),s++;continue}if(i.length>1&&(i[0]==="-"||i[0]==="+")&&i[1]!=="-"){let o=i[0]==="-",a=0;for(let l=1;l<i.length;l++){let c=i[l];if(c==="o"){let u=s+1+a;if(u<t.length&&!t[u].startsWith("-")&&!t[u].startsWith("+")){let d=t[u];if(!bc.has(d)){let p=`bash: set: ${d}: invalid option name
1422
+ ${Qo}`;if(e.state.options.posix)throw new hn(1,"",p);return K(p)}Op(e,bc.get(d)??null,o),a++;continue}n.push(o?Y4(e):J4(e));continue}if(!X4.has(c)){let u=`bash: set: ${i[0]}${c}: invalid option
1423
+ ${Qo}`;if(e.state.options.posix)throw new hn(1,"",u);return K(u)}Op(e,X4.get(c)??null,o)}s+=1+a;continue}if(i==="--")return Tp(e,t.slice(s+1)),r();if(i==="-"){if(e.state.options.xtrace=!1,e.state.options.verbose=!1,Li(e),s+1<t.length)return Tp(e,t.slice(s+1)),r();s++;continue}if(i==="+"){s++;continue}if(i.startsWith("-")||i.startsWith("+")){let o=`bash: set: ${i}: invalid option
1424
+ ${Qo}`;if(e.state.options.posix)throw new hn(1,"",o);return K(o)}return Tp(e,t.slice(s)),r()}return r()}function Tp(e,t){let n=1;for(;e.state.env.has(String(n));)e.state.env.delete(String(n)),n++;for(let r=0;r<t.length;r++)e.state.env.set(String(r+1),t[r]);e.state.env.set("#",String(t.length)),e.state.env.set("@",t.join(" ")),e.state.env.set("*",t.join(" "))}Z();function $p(e,t){let n=1;if(t.length>0){let o=Number.parseInt(t[0],10);if(Number.isNaN(o)||o<0){let a=`bash: shift: ${t[0]}: numeric argument required
1425
+ `;if(e.state.options.posix)throw new hn(1,"",a);return K(a)}n=o}let r=Number.parseInt(e.state.env.get("#")||"0",10);if(n>r){let o=`bash: shift: shift count out of range
1426
+ `;if(e.state.options.posix)throw new hn(1,"",o);return K(o)}if(n===0)return Me;let s=[];for(let o=1;o<=r;o++)s.push(e.state.env.get(String(o))||"");let i=s.slice(n);for(let o=1;o<=r;o++)e.state.env.delete(String(o));for(let o=0;o<i.length;o++)e.state.env.set(String(o+1),i[o]);return e.state.env.set("#",String(i.length)),e.state.env.set("@",i.join(" ")),Me}Z();async function Pp(e,t){let n=t;if(n.length>0&&n[0]==="--"&&(n=n.slice(1)),n.length===0)return Q("",`bash: source: filename argument required
1427
+ `,2);let r=n[0],s=null,i=null;if(r.includes("/")){let c=e.fs.resolvePath(e.state.cwd,r);try{i=await e.fs.readFile(c),s=c}catch{}}else{let u=(e.state.env.get("PATH")||"").split(":").filter(f=>f);for(let f of u){let d=e.fs.resolvePath(e.state.cwd,`${f}/${r}`);try{if((await e.fs.stat(d)).isDirectory)continue;i=await e.fs.readFile(d),s=d;break}catch{}}if(i===null){let f=e.fs.resolvePath(e.state.cwd,r);try{i=await e.fs.readFile(f),s=f}catch{}}}if(i===null)return K(`bash: ${r}: No such file or directory
1428
+ `);let o=new Map;if(n.length>1){for(let u=1;u<=9;u++)o.set(String(u),e.state.env.get(String(u)));o.set("#",e.state.env.get("#")),o.set("@",e.state.env.get("@"));let c=n.slice(1);e.state.env.set("#",String(c.length)),e.state.env.set("@",c.join(" "));for(let u=0;u<c.length&&u<9;u++)e.state.env.set(String(u+1),c[u]);for(let u=c.length+1;u<=9;u++)e.state.env.delete(String(u))}let a=e.state.currentSource,l=()=>{if(e.state.sourceDepth--,e.state.currentSource=a,n.length>1)for(let[c,u]of o)u===void 0?e.state.env.delete(c):e.state.env.set(c,u)};if(e.state.sourceDepth++,e.state.sourceDepth>e.limits.maxSourceDepth)throw e.state.sourceDepth--,new C(`source: maximum nesting depth (${e.limits.maxSourceDepth}) exceeded, increase executionLimits.maxSourceDepth`,"recursion");e.state.currentSource=r;try{let c=Kn(i),u=await e.executeScript(c);return l(),u}catch(c){if(l(),c instanceof ye)throw c;if(c instanceof Ut)return Q(c.stdout,c.stderr,c.exitCode);if(c.name==="ParseException")return K(`bash: ${r}: ${c.message}
1429
+ `);throw c}}function n3(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function cO(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}async function r3(e,t){if(cO(t))return null;try{let n=new be,r=_e(n,t);return await Re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}function s3(e,t){if(e.state.localVarStack?.has(t)){let r=lc(e,t);if(r){r.value===void 0?e.state.env.delete(t):e.state.env.set(t,r.value);let s=e.state.localVarStack?.get(t);if(!s||s.length===0)ac(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,r.scopeIndex),Dp(e,t);else{let i=s[s.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,i.scopeIndex+1)}return!0}return e.state.env.delete(t),ac(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let r=e.state.localScopes.length-1;r>=0;r--){let s=e.state.localScopes[r];if(s.has(t)){let i=s.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),s.delete(t);let o=!1;for(let a=r-1;a>=0;a--)if(e.state.localScopes[a].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,a+1),o=!0;break}return o||ac(e,t),!0}}return!1}function Dp(e,t){if(!e.state.tempEnvBindings||e.state.tempEnvBindings.length===0)return!1;for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(t)){let s=r.get(t);return s===void 0?e.state.env.delete(t):e.state.env.set(t,s),r.delete(t),!0}}return!1}async function i3(e,t){if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith('"')&&t.endsWith('"')){let n=t.slice(1,-1),s=new be().parseWordFromString(n,!0,!1);return Be(e,s)}if(t.includes("$")){let r=new be().parseWordFromString(t,!1,!1);return Be(e,r)}return t}async function Lp(e,t){let n="both",r="",s=0;for(let i of t){if(i==="-v"){n="variable";continue}if(i==="-f"){n="function";continue}if(n==="function"){e.state.functions.delete(i);continue}if(n==="variable"){let c=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(c){let d=c[1],p=c[2];if(dn(e,d)){r+=`bash: unset: ${d}: cannot unset: readonly variable
1430
+ `,s=1;continue}if(p==="@"||p==="*"){Po(e,d),e.state.env.delete(d);continue}let h=e.state.associativeArrays?.has(d);if(h){let y=await i3(e,p);js(e,d,y);continue}let m=ur(e,d),g=e.state.declaredVars?.has(d);if((e.state.env.has(d)||g)&&!m&&!h){r+=`bash: unset: ${d}: not an array variable
1431
+ `,s=1;continue}let w=await r3(e,p);if(w===null&&m){r+=`bash: unset: ${p}: not a valid identifier
1432
+ `,s=1;continue}if(w===null)continue;if(w<0){let y=xe(e,d),x=y.length,S=e.state.currentLine;if(x===0){r+=`bash: line ${S}: unset: [${w}]: bad array subscript
1433
+ `,s=1;continue}let E=x+w;if(E<0){r+=`bash: line ${S}: unset: [${w}]: bad array subscript
1434
+ `,s=1;continue}let A=y[E][0];js(e,d,A);continue}js(e,d,w);continue}if(!n3(i)){r+=`bash: unset: \`${i}': not a valid identifier
1435
+ `,s=1;continue}let u=i;if(rt(e,i)){let d=fn(e,i);d&&d!==i&&(u=d)}if(dn(e,u)){r+=`bash: unset: ${u}: cannot unset: readonly variable
1436
+ `,s=1;continue}Po(e,u);let f=Ud(e,u);if(f!==void 0&&f!==e.state.callDepth)s3(e,u);else if(e.state.fullyUnsetLocals?.has(u))e.state.env.delete(u);else if(f!==void 0){let d=e.state.accessedTempEnvVars?.has(u),p=e.state.mutatedTempEnvVars?.has(u);if((d||p)&&e.state.localVarStack?.has(u)){let h=lc(e,u);h?h.value===void 0?e.state.env.delete(u):e.state.env.set(u,h.value):e.state.env.delete(u)}else e.state.env.delete(u)}else Dp(e,u)||e.state.env.delete(u);e.state.exportedVars?.delete(u);continue}let o=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(o){let c=o[1],u=o[2];if(dn(e,c)){r+=`bash: unset: ${c}: cannot unset: readonly variable
1437
+ `,s=1;continue}if(u==="@"||u==="*"){Po(e,c),e.state.env.delete(c);continue}let f=e.state.associativeArrays?.has(c);if(f){let m=await i3(e,u);js(e,c,m);continue}let d=ur(e,c);if(e.state.env.has(c)&&!d&&!f){r+=`bash: unset: ${c}: not an array variable
1438
+ `,s=1;continue}let h=await r3(e,u);if(h===null&&d){r+=`bash: unset: ${u}: not a valid identifier
1439
+ `,s=1;continue}if(h===null)continue;if(h<0){let m=xe(e,c),g=m.length,b=e.state.currentLine;if(g===0){r+=`bash: line ${b}: unset: [${h}]: bad array subscript
1440
+ `,s=1;continue}let w=g+h;if(w<0){r+=`bash: line ${b}: unset: [${h}]: bad array subscript
1441
+ `,s=1;continue}let y=m[w][0];js(e,c,y);continue}js(e,c,h);continue}if(!n3(i)){r+=`bash: unset: \`${i}': not a valid identifier
1442
+ `,s=1;continue}let a=i;if(rt(e,i)){let c=fn(e,i);c&&c!==i&&(a=c)}if(dn(e,a)){r+=`bash: unset: ${a}: cannot unset: readonly variable
1443
+ `,s=1;continue}Po(e,a);let l=Ud(e,a);if(l!==void 0&&l!==e.state.callDepth)s3(e,a);else if(e.state.fullyUnsetLocals?.has(a))e.state.env.delete(a);else if(l!==void 0){let c=e.state.accessedTempEnvVars?.has(a),u=e.state.mutatedTempEnvVars?.has(a);if((c||u)&&e.state.localVarStack?.has(a)){let f=lc(e,a);f?f.value===void 0?e.state.env.delete(a):e.state.env.set(a,f.value):e.state.env.delete(a)}else e.state.env.delete(a)}else Dp(e,a)||e.state.env.delete(a);e.state.exportedVars?.delete(a),e.state.functions.delete(i)}return Q("",r,s)}St();Z();function Rr(e,t,n,r){let s=n+U(t)+1;if(s>r)throw new C(`shopt: output size limit exceeded (${r} bytes)`,"output_size");return e.push(t),s}var Fp=["extglob","dotglob","nullglob","failglob","globstar","globskipdots","nocaseglob","nocasematch","expand_aliases","lastpipe","xpg_echo"],uO=["autocd","cdable_vars","cdspell","checkhash","checkjobs","checkwinsize","cmdhist","compat31","compat32","compat40","compat41","compat42","compat43","compat44","complete_fullquote","direxpand","dirspell","execfail","extdebug","extquote","force_fignore","globasciiranges","gnu_errfmt","histappend","histreedit","histverify","hostcomplete","huponexit","inherit_errexit","interactive_comments","lithist","localvar_inherit","localvar_unset","login_shell","mailwarn","no_empty_cmd_completion","progcomp","progcomp_alias","promptvars","restricted_shell","shift_verbose","sourcepath"];function xc(e){return Fp.includes(e)}function fO(e){return uO.includes(e)}function o3(e,t){let n=e.limits.maxArrayElements;if(t.length>n)throw new C(`shopt: argument limit exceeded (${n})`,"array_elements");let r=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),s=!1,i=!1,o=!1,a=!1,l=!1,c=[],u=0;for(;u<t.length;){let g=t[u];if(g==="--"){u++;break}if(g.startsWith("-")&&g.length>1){for(let b=1;b<g.length;b++){let w=g[b];switch(w){case"s":s=!0;break;case"u":i=!0;break;case"p":o=!0;break;case"q":a=!0;break;case"o":l=!0;break;default:return{exitCode:2,stdout:"",stderr:`shopt: -${w}: invalid option
1444
+ `}}}u++}else break}for(;u<t.length;)c.push(t[u]),u++;if(l)return dO(e,c,s,i,o,a);if(s&&i)return{exitCode:1,stdout:"",stderr:`shopt: cannot set and unset shell options simultaneously
1445
+ `};if(c.length===0){if(s||i){let b=[];for(let w of Fp){let y=e.state.shoptOptions[w];s&&y?b.push(o?`shopt -s ${w}`:`${w} on`):i&&!y&&b.push(o?`shopt -u ${w}`:`${w} off`)}return{exitCode:0,stdout:b.length>0?`${b.join(`
1446
+ `)}
1447
+ `:"",stderr:""}}let g=[];for(let b of Fp){let w=e.state.shoptOptions[b];g.push(o?`shopt ${w?"-s":"-u"} ${b}`:`${b} ${w?"on":"off"}`)}return{exitCode:0,stdout:`${g.join(`
1448
+ `)}
1449
+ `,stderr:""}}let f=!1,d=[],p=0,h=[],m=0;for(let g of c){if(!xc(g)&&!fO(g)){p=Rr(d,`shopt: ${g}: invalid shell option name`,p,r),f=!0;continue}if(s)xc(g)&&(e.state.shoptOptions[g]=!0,Vf(e));else if(i)xc(g)&&(e.state.shoptOptions[g]=!1,Vf(e));else if(xc(g)){let b=e.state.shoptOptions[g];a?b||(f=!0):o?(m=Rr(h,`shopt ${b?"-s":"-u"} ${g}`,m,r),b||(f=!0)):(m=Rr(h,`${g} ${b?"on":"off"}`,m,r),b||(f=!0))}else a?f=!0:o?(m=Rr(h,`shopt -u ${g}`,m,r),f=!0):(m=Rr(h,`${g} off`,m,r),f=!0)}return{exitCode:f?1:0,stdout:h.length>0?`${h.join(`
1450
+ `)}
1451
+ `:"",stderr:d.length>0?`${d.join(`
1452
+ `)}
1453
+ `:""}}function dO(e,t,n,r,s,i){let o=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),a=new Map([["errexit","errexit"],["pipefail","pipefail"],["nounset","nounset"],["xtrace","xtrace"],["verbose","verbose"],["posix","posix"],["allexport","allexport"],["noclobber","noclobber"],["noglob","noglob"],["noexec","noexec"],["vi","vi"],["emacs","emacs"]]),l=["braceexpand","errtrace","functrace","hashall","histexpand","history","ignoreeof","interactive-comments","keyword","monitor","nolog","notify","onecmd","physical","privileged"],c=[...a.keys(),...l].sort();if(t.length===0){let m=[];for(let g of c){let b=l.includes(g),w=a.get(g),y=b||!w?!1:e.state.options[w];n&&!y||r&&y||m.push(s?`set ${y?"-o":"+o"} ${g}`:`${g} ${y?"on":"off"}`)}return{exitCode:0,stdout:m.length>0?`${m.join(`
1454
+ `)}
1455
+ `:"",stderr:""}}let u=!1,f=[],d=0,p=[],h=0;for(let m of t){let g=a.has(m),b=l.includes(m);if(!g&&!b){d=Rr(f,`shopt: ${m}: invalid option name`,d,o),u=!0;continue}if(b){n||r||(i?u=!0:s?(h=Rr(p,`set +o ${m}`,h,o),u=!0):(h=Rr(p,`${m} off`,h,o),u=!0));continue}let w=a.get(m);if(w)if(n)w==="vi"?e.state.options.emacs=!1:w==="emacs"&&(e.state.options.vi=!1),e.state.options[w]=!0,Li(e);else if(r)e.state.options[w]=!1,Li(e);else{let y=e.state.options[w];i?y||(u=!0):s?(h=Rr(p,`set ${y?"-o":"+o"} ${m}`,h,o),y||(u=!0)):(h=Rr(p,`${m} ${y?"on":"off"}`,h,o),y||(u=!0))}}return{exitCode:u?1:0,stdout:p.length>0?`${p.join(`
1456
+ `)}
1457
+ `:"",stderr:f.length>0?`${f.join(`
1458
+ `)}
1459
+ `:""}}Er();function pO(e){return e!==null&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}function ft(e,t,n,r){return((...s)=>{Ct(t,n,`${r} call`);let i=e(...s);return pO(i)?i.then(o=>(Ct(t,n,`${r} post-await`),o),o=>{throw Ct(t,n,`${r} post-await`),o}):(Ct(t,n,`${r} return`),i)})}function hO(e,t,n){let r={readFile:ft(e.readFile.bind(e),t,n,"fs.readFile"),...typeof e.readFileBytes=="function"?{readFileBytes:ft(e.readFileBytes.bind(e),t,n,"fs.readFileBytes")}:Object.create(null),readFileBuffer:ft(e.readFileBuffer.bind(e),t,n,"fs.readFileBuffer"),writeFile:ft(e.writeFile.bind(e),t,n,"fs.writeFile"),appendFile:ft(e.appendFile.bind(e),t,n,"fs.appendFile"),exists:ft(e.exists.bind(e),t,n,"fs.exists"),stat:ft(e.stat.bind(e),t,n,"fs.stat"),mkdir:ft(e.mkdir.bind(e),t,n,"fs.mkdir"),readdir:ft(e.readdir.bind(e),t,n,"fs.readdir"),rm:ft(e.rm.bind(e),t,n,"fs.rm"),cp:ft(e.cp.bind(e),t,n,"fs.cp"),mv:ft(e.mv.bind(e),t,n,"fs.mv"),resolvePath:ft(e.resolvePath.bind(e),t,n,"fs.resolvePath"),getAllPaths:ft(e.getAllPaths.bind(e),t,n,"fs.getAllPaths"),chmod:ft(e.chmod.bind(e),t,n,"fs.chmod"),symlink:ft(e.symlink.bind(e),t,n,"fs.symlink"),link:ft(e.link.bind(e),t,n,"fs.link"),readlink:ft(e.readlink.bind(e),t,n,"fs.readlink"),lstat:ft(e.lstat.bind(e),t,n,"fs.lstat"),realpath:ft(e.realpath.bind(e),t,n,"fs.realpath"),utimes:ft(e.utimes.bind(e),t,n,"fs.utimes")};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=ft(e.readdirWithFileTypes.bind(e),t,n,"fs.readdirWithFileTypes")),r}function Mp(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r=Object.getOwnPropertyDescriptors(e);r.fs={value:hO(e.fs,e.requireDefenseContext,n),enumerable:!0,configurable:!0,writable:!0};let s=Object.defineProperties(Object.create(Object.getPrototypeOf(e)),r);return e.exec&&(s.exec=ft(e.exec,e.requireDefenseContext,n,"exec")),e.origCommand&&(s.origCommand=ft(e.origCommand,e.requireDefenseContext,n,"origCommand")),e.fetch&&(s.fetch=ft(e.fetch,e.requireDefenseContext,n,"fetch")),e.sleep&&(s.sleep=ft(e.sleep,e.requireDefenseContext,n,"sleep")),e.getRegisteredCommands&&(s.getRegisteredCommands=ft(e.getRegisteredCommands,e.requireDefenseContext,n,"getRegisteredCommands")),s}Z();kn();At();Z();Z();var a3="+ ";async function l3(e){let t=e.state.env.get("PS4");if(t===void 0)return a3;if(t==="")return"";let n=e.state.options.xtrace;e.state.options.xtrace=!1;try{let s=new be().parseWordFromString(t,!1,!1);return await Be(e,s)}catch(r){if(r instanceof Ve&&!r.fatal)return t;if(r instanceof ut||r instanceof Error&&r.name==="AbortError")throw r;return e.state.expansionStderr=`${e.state.expansionStderr||""}bash: ${t}: bad substitution
1460
+ `,t||a3}finally{e.state.options.xtrace=n}}function mO(e){return e.map(t=>gO(t)).join(" ")}function gO(e){if(e==="")return"''";if(!/[\s'"\\$`!*?[\]{}|&;<>()~#\n\t]/.test(e))return e;let n=/[\x00-\x1f\x7f]/.test(e),r=e.includes(`
1461
+ `),s=e.includes(" "),i=e.includes("\\"),o=e.includes("'");if(n||r||s||i){let l="";for(let c of e){let u=c.charCodeAt(0);c===`
1462
+ `?l+="\\n":c===" "?l+="\\t":c==="\\"?l+="\\\\":c==="'"?l+="'":c==='"'?l+='"':u<32||u===127?u<256?l+=`\\x${u.toString(16).padStart(2,"0")}`:l+=`\\u${u.toString(16).padStart(4,"0")}`:l+=c}return`$'${l}'`}return o?`"${e.replace(/([\\$`"])/g,"\\$1")}"`:`'${e}'`}async function c3(e,t,n){if(!e.state.options.xtrace)return"";let r=await l3(e),s=[t,...n],i=mO(s);return`${r}${i}
1463
+ `}async function u3(e,t,n){return e.state.options.xtrace?`${await l3(e)}${t}=${n}
1464
+ `:""}function Ec(e,t,n){return yr([t,n],"",e.limits.maxStringLength,"array assignment")}async function f3(e,t){let n=new Map,r="";for(let s of t.assignments){let i=s.name;if(s.array){let u=await yO(e,t,i,s.array,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(r+=u.xtraceOutput,u.continueToNext)continue}let o=s.value?await Be(e,s.value):"";if(i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:Q("",`bash: ${i}: bad array subscript
1465
+ `,1)};let l=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(l){let u=await SO(e,t,l[1],l[2],o,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(u.continueToNext)continue}let c=await AO(e,t,i,o,s.append,n);if(c.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:c.error};r+=c.xtraceOutput,c.continueToNext}return{continueToNext:!1,xtraceOutput:r,tempAssignments:n}}async function yO(e,t,n,r,s,i){let o="";if(/\[.+\]$/.test(n))return{continueToNext:!1,xtraceOutput:"",error:Q("",`bash: ${n}: cannot assign list to array member
1466
+ `,1)};if(rt(e,n)){let h=Ks(e,n);if(h===void 0||h==="")throw new ye(1,"","");let m=fn(e,n);if(m&&/^[a-zA-Z_][a-zA-Z0-9_]*\[@\]$/.test(m))return{continueToNext:!1,xtraceOutput:"",error:Q("",`bash: ${n}: cannot assign list to array member
1467
+ `,1)}}if(dn(e,n)){if(t.name)return o+=`bash: ${n}: readonly variable
1468
+ `,{continueToNext:!0,xtraceOutput:o};let h=st(e,n);if(h)return{continueToNext:!1,xtraceOutput:"",error:h}}let a=e.state.associativeArrays?.has(n),l=zt(e,n),c=l?un(l):void 0,u=e.state.env.get(n),f=()=>{e.state.arrays??=new Map,c?e.state.arrays.set(n,c):e.state.arrays.delete(n),u===void 0?e.state.env.delete(n):e.state.env.set(n,u)},d=wO(r),p=()=>{vt(e,n),e.state.env.delete(n)};try{a&&d?await bO(e,t,n,r,s,p,h=>{o+=h}):d?await xO(e,n,r,s,p):await EO(e,n,r,s,p)}catch(h){throw f(),h}if(t.name){i.set(n,e.state.env.get(n));let m=`(${r.map(g=>Di(g)).join(" ")})`;e.state.env.set(n,m)}return{continueToNext:!0,xtraceOutput:o}}function wO(e){return e.some(t=>{if(t.parts.length>=2){let n=t.parts[0],r=t.parts[1];if(n.type!=="Glob"||!n.pattern.startsWith("["))return!1;if(n.pattern==="["&&(r.type==="DoubleQuoted"||r.type==="SingleQuoted")){if(t.parts.length<3)return!1;let s=t.parts[2];return s.type!=="Literal"?!1:s.value.startsWith("]=")||s.value.startsWith("]+=")}return r.type!=="Literal"?!1:r.value.startsWith("]")?r.value.startsWith("]=")||r.value.startsWith("]+="):n.pattern.endsWith("]")?r.value.startsWith("=")||r.value.startsWith("+="):!1}return!1})}async function bO(e,t,n,r,s,i,o){let a=[];for(let l of r){if(a.length>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let c=zf(l);if(c){let{key:u,valueParts:f,append:d}=c,p;f.length>0?(p=await Be(e,{type:"Word",parts:f}),f.every(m=>m.type==="Literal"||m.type==="TildeExpansion")&&(p=ls(e,p))):p="",a.push({type:"keyed",key:u,value:p,append:d})}else{let u=await Be(e,l);a.push({type:"invalid",expandedValue:u})}}e.executionScope.consumeWork(a.length,"associative array assignment"),s||i();for(let l of a)if(l.type==="keyed")if(l.append){let c=Xe(e,n,l.key)??"";we(e,n,l.key,Ec(e,c,l.value),"associative")}else we(e,n,l.key,l.value,"associative");else{let c=t.line??e.state.currentLine??1;o(`bash: line ${c}: ${n}: ${l.expandedValue}: must use subscript when assigning associative array
1469
+ `)}}async function xO(e,t,n,r,s){let i=[],o=0;for(let l of n){let c=zf(l);if(c){if(o>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let{key:u,valueParts:f,append:d}=c,p;f.length>0?(p=await Be(e,{type:"Word",parts:f}),f.every(m=>m.type==="Literal"||m.type==="TildeExpansion")&&(p=ls(e,p))):p="",i.push({type:"keyed",indexExpr:u,value:p,append:d}),o++}else{let u=await hr(e,l);if(u.values.length>e.limits.maxArrayElements-o)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");i.push({type:"non-keyed",values:u.values}),o+=u.values.length}}e.executionScope.consumeWork(o,"indexed array assignment"),r||s();let a=0;for(let l of i)if(l.type==="keyed"){let c;try{let u=new be,f=_e(u,l.indexExpr);c=await Re(e,f.expression,!1)}catch{if(/^-?\d+$/.test(l.indexExpr))c=Number.parseInt(l.indexExpr,10);else{let u=e.state.env.get(l.indexExpr);c=u?Number.parseInt(u,10):0,Number.isNaN(c)&&(c=0)}}if(l.append){let u=Xe(e,t,c)??"";we(e,t,c,Ec(e,u,l.value))}else we(e,t,c,l.value);a=c+1}else for(let c of l.values)we(e,t,a++,c)}async function EO(e,t,n,r,s){let i=[];for(let a of n){let l=await hr(e,a);for(let c of l.values){if(i.length>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");i.push(c)}}let o=0;if(e.executionScope.consumeWork(i.length,"indexed array assignment"),r){let a=xe(e,t);if(a.length>0)o=Math.max(...a.map(([c])=>typeof c=="number"?c:0))+1;else{let l=e.state.env.get(t);l!==void 0&&(we(e,t,0,l),e.state.env.delete(t),o=1)}}else s();for(let a=0;a<i.length;a++)we(e,t,o+a,i[a])}async function SO(e,t,n,r,s,i,o){let a=n;if(rt(e,n)){let f=fn(e,n);if(f&&f!==n){if(f.includes("["))return{continueToNext:!1,xtraceOutput:"",error:Q("",`bash: \`${f}': not a valid identifier
1470
+ `,1)};a=f}}if(dn(e,a)){if(t.name)return{continueToNext:!0,xtraceOutput:""};let f=st(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let l=e.state.associativeArrays?.has(a),c;if(l)c=await d3(e,r);else{let f=await _p(e,a,r);if(f.error)return{continueToNext:!1,xtraceOutput:"",error:f.error};c=String(f.index)}let u=i?Ec(e,Xe(e,a,c)||"",s):s;return t.name||we(e,a,c,u,l?"associative":"indexed"),{continueToNext:!0,xtraceOutput:""}}async function d3(e,t){let n;if(t.startsWith("'")&&t.endsWith("'"))n=t.slice(1,-1);else if(t.startsWith('"')&&t.endsWith('"')){let r=t.slice(1,-1),i=new be().parseWordFromString(r,!0,!1);n=await Be(e,i)}else if(t.includes("$")){let s=new be().parseWordFromString(t,!1,!1);n=await Be(e,s)}else n=t;return n}async function _p(e,t,n){let r=n;n.startsWith('"')&&n.endsWith('"')&&n.length>=2&&(r=n.slice(1,-1));let s;if(/^-?\d+$/.test(r))s=Number.parseInt(r,10);else{try{let i=new be,o=_e(i,r);s=await Re(e,o.expression,!1)}catch(i){if(i instanceof ye||i instanceof kt)throw i;if(i instanceof Ve){let l=`bash: line ${e.state.currentLine}: ${n}: ${i.message}
1471
+ `;if(i.fatal)throw new ye(1,"",l);return{index:0,error:Q("",l,1)}}let o=e.state.currentLine;return{index:0,error:Q("",`bash: line ${o}: ${t}[${n}]: bad array subscript
1472
+ `,1)}}Number.isNaN(s)&&(s=0)}if(s<0){let i=xe(e,t);if(i.length===0){let a=e.state.currentLine;return{index:0,error:Q("",`bash: line ${a}: ${t}[${n}]: bad array subscript
1473
+ `,1)}}if(s=Math.max(...i.map(([a])=>typeof a=="number"?a:0))+1+s,s<0){let a=e.state.currentLine;return{index:0,error:Q("",`bash: line ${a}: ${t}[${n}]: bad array subscript
1474
+ `,1)}}}return{index:s}}async function AO(e,t,n,r,s,i){let o="",a=n,l=null;if(rt(e,n)){let f=Fl(e,n,r);if(f===void 0)return{continueToNext:!1,xtraceOutput:"",error:Q("",`bash: ${n}: circular name reference
1475
+ `,1)};if(f===null)return{continueToNext:!0,xtraceOutput:""};a=f;let d=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);d&&(l={arrayName:d[1],subscriptExpr:d[2]},a=d[1])}if(dn(e,a)){if(t.name)return o+=`bash: ${a}: readonly variable
1476
+ `,{continueToNext:!0,xtraceOutput:o};let f=st(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let c;if(Zo(e,a))try{let f=new be;if(s){let p=`(${e.state.env.get(a)||"0"}) + (${r})`,h=_e(f,p);c=String(await Re(e,h.expression))}else{let d=_e(f,r);c=String(await Re(e,d.expression))}}catch{c="0"}else{let f=ur(e,a)?Xe(e,a,0):e.state.env.get(a);c=s?Ec(e,f||"",r):r}c=Zi(e,a,c),o+=await u3(e,a,c);let u;return l?u=await CO(e,l):ur(e,a)&&(u="0"),t.name?u===void 0&&(i.set(a,e.state.env.get(a)),e.state.env.set(a,c)):(u===void 0?e.state.env.set(a,c):we(e,a,u,c),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(a)),e.state.tempEnvBindings?.some(f=>f.has(a))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(a))),{continueToNext:!1,xtraceOutput:o}}async function CO(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return d3(e,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{let o=new be,a=_e(o,r);i=await Re(e,a.expression,!1)}catch{let o=e.state.env.get(r);i=o?Number.parseInt(o,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let o=xe(e,n);o.length>0&&(i=Math.max(...o.map(l=>l[0]))+1+i)}return String(i)}async function m3(e,t,n,r){let s=!1,i=!1,o=!1,a=!1,l=!1,c=[];for(let m of t)if(m.startsWith("-")&&m.length>1)for(let g of m.slice(1))g==="t"?s=!0:g==="p"?i=!0:g==="P"?o=!0:g==="a"?a=!0:g==="f"&&(l=!0);else c.push(m);let u="",f="",d=0,p=!1,h=!1;for(let m of c){let g=!1;if(o){if(a){let E=await r(m);if(E.length>0){for(let A of E)u+=`${A}
1477
+ `;p=!0,g=!0}}else{let E=await n(m);E&&(u+=`${E}
1478
+ `,p=!0,g=!0)}g||(h=!0);continue}let b=!l&&e.state.functions.has(m);if(a&&b){if(!i)if(s)u+=`function
1479
+ `;else{let E=e.state.functions.get(m),A=E?p3(m,E):`${m} is a function
1480
+ `;u+=A}g=!0}let w=e.state.env.get(`BASH_ALIAS_${m}`);if(w!==void 0&&(a||!g)&&(i||(s?u+=`alias
1481
+ `:u+=`${m} is aliased to \`${w}'
1482
+ `),g=!0,!a)||Wf.has(m)&&(a||!g)&&(i||(s?u+=`keyword
1483
+ `:u+=`${m} is a shell keyword
1484
+ `),g=!0,!a))continue;if(!a&&b&&!g){if(!i)if(s)u+=`function
1485
+ `;else{let E=e.state.functions.get(m),A=E?p3(m,E):`${m} is a function
1486
+ `;u+=A}g=!0;continue}if(!(ns.has(m)&&(a||!g)&&(i||(s?u+=`builtin
1487
+ `:u+=`${m} is a shell builtin
1488
+ `),g=!0,!a))){if(a){let E=await r(m);for(let A of E)i?u+=`${A}
1489
+ `:s?u+=`file
1490
+ `:u+=`${m} is ${A}
1491
+ `,p=!0,g=!0}else if(!g){let E=await n(m);E&&(i?u+=`${E}
1492
+ `:s?u+=`file
1493
+ `:u+=`${m} is ${E}
1494
+ `,p=!0,g=!0)}if(!g&&(h=!0,!s&&!i)){let E=!0;if(m.includes("/")){let A=e.fs.resolvePath(e.state.cwd,m);await e.fs.exists(A)&&(E=!1)}E&&(f+=`bash: type: ${m}: not found
1495
+ `)}}}return i?d=h&&!p?1:0:d=h?1:0,Q(u,f,d)}function p3(e,t){let n;return t.body.type==="Group"?n=t.body.body.map(s=>Xo(s)).join("; "):n=Xo(t.body),`${e} is a function
1496
+ ${e} ()
1497
+ {
1498
+ ${n}
1499
+ }
1500
+ `}function Xo(e){if(Array.isArray(e))return e.map(t=>Xo(t)).join("; ");if(e.type==="Statement"){let t=[];for(let n=0;n<e.pipelines.length;n++){let r=e.pipelines[n];t.push(vO(r)),e.operators[n]&&t.push(e.operators[n])}return t.join(" ")}if(e.type==="SimpleCommand"){let t=e,n=[];t.name&&n.push(h3(t.name));for(let r of t.args)n.push(h3(r));return n.join(" ")}return e.type==="Group"?`{ ${e.body.map(r=>Xo(r)).join("; ")}; }`:"..."}function h3(e){return e.parts.map(g3).join("")}function g3(e){switch(e.type){case"Literal":return e.value;case"Escaped":return`\\${e.value}`;case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(g3).join("")}"`;default:return _t(ee.word([e]))}}function vO(e){let t=e.commands.map(n=>Xo(n));return(e.negated?"! ":"")+t.join(" | ")}async function y3(e,t,n,r){let s="",i="",o=0;for(let a of t){if(!a){o=1;continue}let l=e.state.env.get(`BASH_ALIAS_${a}`);if(l!==void 0)r?s+=`${a} is an alias for "${l}"
1501
+ `:s+=`alias ${a}='${l}'
1502
+ `;else if(Wf.has(a))r?s+=`${a} is a shell keyword
1503
+ `:s+=`${a}
1504
+ `;else if(ns.has(a))r?s+=`${a} is a shell builtin
1505
+ `:s+=`${a}
1506
+ `;else if(e.state.functions.has(a))r?s+=`${a} is a function
1507
+ `:s+=`${a}
1508
+ `;else if(a.includes("/")){let c=e.fs.resolvePath(e.state.cwd,a),u=!1;if(await e.fs.exists(c))try{let f=await e.fs.stat(c);f.isDirectory||(f.mode&73)!==0&&(r?s+=`${a} is ${a}
1509
+ `:s+=`${a}
1510
+ `,u=!0)}catch{}u||(r&&(i+=`${a}: not found
1511
+ `),o=1)}else if(e.commands.has(a)){let u=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":"),f=null;for(let d of u){if(!d)continue;let p=`${d}/${a}`;try{let h=await e.fs.stat(p);if(!h.isDirectory&&(h.mode&73)!==0){f=p;break}}catch{}}f||(f=`/usr/bin/${a}`),r?s+=`${a} is ${f}
1512
+ `:s+=`${f}
1513
+ `}else r&&(i+=`${a}: not found
1514
+ `),o=1}return Q(s,i,o)}async function w3(e,t){if(t.includes("/")){let s=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(s)){try{let i=await e.fs.stat(s);if(i.isDirectory||!((i.mode&73)!==0))return null}catch{return null}return t}return null}let r=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let s of r){if(!s)continue;let o=`${s.startsWith("/")?s:e.fs.resolvePath(e.state.cwd,s)}/${t}`;if(await e.fs.exists(o)){try{let a=await e.fs.stat(o);if(a.isDirectory||(a.mode&73)===0)continue}catch{continue}return`${s}/${t}`}}if(e.commands.has(t)){for(let s of r)if(s==="/usr/bin"||s==="/bin")return`${s}/${t}`;return`/usr/bin/${t}`}return null}function b3(e,t){let n=!0,r=e.signal?new AbortController:void 0,s=new WeakMap,i=()=>{if(!n)throw new Ge("",`bash: ${t} used its context after cancellation
1515
+ `)},o=f=>{if(f===null||typeof f!="object"&&typeof f!="function")return f;let d=s.get(f);if(d!==void 0)return d;if(typeof f=="object"&&I6(f))return f;if(f instanceof Uint8Array){let g=new Uint8Array(f);return s.set(f,g),g}if(f instanceof ArrayBuffer){let g=f.slice(0);return s.set(f,g),g}if(f instanceof Promise){let g=f.then(b=>(i(),o(b)));return s.set(f,g),g}if(typeof f=="function"){let g=function(...b){return i(),o(Reflect.apply(f,this,b))};return s.set(f,g),g}let p=Object.getPrototypeOf(f);if(Array.isArray(f)||p===Object.prototype||p===null){let g=Array.isArray(f)?[]:Object.create(p);s.set(f,g);let b=Object.getOwnPropertyDescriptors(f);for(let w of Object.values(b)){if("value"in w){let y=w.value;w.value=typeof y=="function"?(...x)=>(i(),o(Reflect.apply(y,f,x))):o(y)}if(w.get){let y=w.get;w.get=()=>(i(),o(Reflect.apply(y,f,[])))}if(w.set){let y=w.set;w.set=x=>{i(),Reflect.apply(y,f,[x])}}}return Object.defineProperties(g,b),g}let h=new Map,m=new S2(f,{get(g,b){if(i(),b==="constructor"||b==="prototype"||b==="__proto__")throw new Error(`${t}: unsafe context property access`);let w=Reflect.get(g,b,g);if(typeof w!="function")return o(w);if(h.has(b))return h.get(b);let y=(...x)=>(i(),o(Reflect.apply(w,g,x)));return h.set(b,y),y},set(g,b,w){if(i(),b==="constructor"||b==="prototype"||b==="__proto__")throw new Error(`${t}: unsafe context property access`);return Reflect.set(g,b,w,g)}});return s.set(f,m),m},a=f=>o(f),l=f=>f&&((...d)=>(i(),o(f(...d)))),c=f=>({value:f,enumerable:!0,configurable:!0,writable:!0}),u=Object.getOwnPropertyDescriptors(e);return Object.assign(u,{fs:c(a(e.fs)),env:c(a(e.env)),limits:c(Object.freeze({...e.limits})),exportedEnv:c(e.exportedEnv?Object.freeze({...e.exportedEnv}):void 0),executionScope:c(e.executionScope?a(e.executionScope):void 0),fileDescriptors:c(e.fileDescriptors?a(e.fileDescriptors):void 0),coverage:c(e.coverage?a(e.coverage):void 0),assignShellVariable:c(l(e.assignShellVariable)),exec:c(l(e.exec)),origCommand:c(l(e.origCommand)),execWithInheritedStdin:c(l(e.execWithInheritedStdin)),fetch:c(l(e.fetch)),getRegisteredCommands:c(l(e.getRegisteredCommands)),sleep:c(l(e.sleep)),trace:c(l(e.trace)),invokeTool:c(l(e.invokeTool)),signal:c(r?.signal)}),{context:Object.defineProperties(Object.create(Object.getPrototypeOf(e)),u),revoke(){n=!1,r?.signal.aborted||r?.abort(new Ge("",`bash: ${t} context revoked
1516
+ `))}}}async function kO(e,t,n,r,s,i){let o=s.remainingTimeMs()??t.limits.maxExecutionTimeMs,a=t.limits.maxExtensionCleanupTimeMs,l,c,u,d=Promise.resolve().then(e).then(h=>({kind:"result",result:h}),h=>({kind:"error",error:h})),p=new Promise(h=>{let m=()=>{n(),h({kind:"abort"})};c=m,i?.addEventListener("abort",m,{once:!0}),i?.aborted&&m(),l=Qi(()=>{n(),h({kind:"deadline"})},o)});try{let h=await Promise.race([d,p]);if(h.kind==="result")return h.result;if(h.kind==="error")throw h.error;n();let m=await Promise.race([d.then(()=>!0),new Promise(b=>{u=Qi(()=>b(!1),a)})]),g=h.kind==="deadline"?new Ge("",`bash: ${r} exceeded its execution deadline
1517
+ `):new Ge("",`bash: execution aborted
1518
+ `);throw m||s.poisonAfterAbort(g),g}finally{n(),Xi(l),Xi(u),c&&i?.removeEventListener("abort",c)}}async function x3(e,t,n,r,s,i,o,a,l=!1){let{ctx:c,runCommand:u}=e;if(c.coverage&&ns.has(t)&&c.coverage.hit(`bash:builtin:${t}`),t==="export")return Ep(c,n);if(t==="unset")return Lp(c,n);if(t==="exit")return xp(c,n);if(t==="local")return vp(c,n);if(t==="set")return Rp(c,n);if(t==="break")return Dd(c,n);if(t==="continue")return lp(c,n);if(t==="return")return Ip(c,n);if(t==="eval"&&c.state.options.posix)return yc(c,n,s,l);if(t==="shift")return $p(c,n);if(t==="getopts")return wc(c,n);if(t==="compgen")return rp(c,n);if(t==="complete")return op(c,n);if(t==="compopt")return ap(c,n);if(t==="pushd")return await yp(c,n);if(t==="popd")return wp(c,n);if(t==="dirs")return bp(c,n);if(t==="source"||t===".")return Pp(c,n);if(t==="read")return Np(c,n,s,a);if(t==="mapfile"||t==="readarray")return kp(c,n,s);if(t==="declare"||t==="typeset")return hp(c,n);if(t==="readonly")return mp(c,n);if(!i){let f=c.state.functions.get(t);if(f)return mc(c,f,n,s,void 0,l)}if(t==="__just_bash_tee_restore"){if(n.length===0||n.length>c.limits.maxArrayElements)return K(`bash: invalid internal pipeline status restore
1519
+ `,2);let f=[];for(let h of n){if(!/^(?:0|[1-9][0-9]{0,2})$/.test(h))return K(`bash: invalid internal pipeline status restore
1520
+ `,2);let m=Number(h);if(!Number.isSafeInteger(m)||m>255)return K(`bash: invalid internal pipeline status restore
1521
+ `,2);f.push(m)}let d=f[f.length-1]??0,p=[...f].reverse().find(h=>h!==0);return{stdout:"",stderr:"",exitCode:c.state.options.pipefail&&p!==void 0?p:d,internalPipeStatusOverride:f}}if(t==="eval")return yc(c,n,s,l);if(t==="cd")return await Ld(c,n);if(t===":"||t==="true")return Me;if(t==="false")return Ot(!1);if(t==="let")return Cp(c,n);if(t==="command")return NO(e,n,s,l);if(t==="builtin")return IO(e,n,s,l);if(t==="shopt")return o3(c,n);if(t==="exec"){if(n.length===0)return Me;let[f,...d]=n;return{...await u(f,d,[],s,!1,!1,-1,l),internalProducerOmitsShellPrefix:!0}}if(t==="wait")return Me;if(t==="type")return await m3(c,n,f=>w3(c,f),f=>Sl(c,f));if(t==="hash")return Sp(c,n);if(t==="help")return Ap(c,n);if(t==="["||t==="test"){let f=n;if(t==="["){if(n[n.length-1]!=="]")return K("[: missing `]'\n",2);f=n.slice(0,-1)}return Ho(c,f)}return null}async function NO(e,t,n,r=!1){let{ctx:s,runCommand:i}=e;if(t.length===0)return Me;let o=!1,a=!1,l=!1,c=t;for(;c.length>0&&c[0].startsWith("-");){let d=c[0];if(d==="--"){c=c.slice(1);break}for(let p of d.slice(1))p==="p"?o=!0:p==="V"?a=!0:p==="v"&&(l=!0);c=c.slice(1)}if(c.length===0)return Me;if(l||a)return await y3(s,c,l,a);let[u,...f]=c;return i(u,f,[],n,!0,o,-1,r)}async function IO(e,t,n,r=!1){let{runCommand:s}=e;if(t.length===0)return Me;let i=t;if(i[0]==="--"&&(i=i.slice(1),i.length===0))return Me;let o=i[0];if(o!=="__just_bash_tee_restore"&&!ns.has(o))return K(`bash: builtin: ${o}: not a shell builtin
1522
+ `);let[,...a]=i;return s(o,a,[],n,!0,!1,-1,r)}async function E3(e,t,n,r,s){let{ctx:i,buildExportedEnv:o,executeUserScript:a}=e,c=await El(i,t,s?"/usr/bin:/bin":void 0);if(!c){i.executionScope.recordUnresolvedCommand(t);let S=i.executionScope.abortOnUnresolvedCommands;if(h4(t)){let E=`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle.
1523
+ `;if(S)throw new kt(t,"",E);return K(E,127)}if(S)throw new kt(t,"",`bash: ${t}: command not found
1524
+ `);return K(`bash: ${t}: command not found
1525
+ `,127)}if("error"in c)return c.error==="permission_denied"?K(`bash: ${t}: Permission denied
1526
+ `,126):K(`bash: ${t}: No such file or directory
1527
+ `,127);if("script"in c)return t.includes("/")||(i.state.hashTable||(i.state.hashTable=new Map),i.state.hashTable.set(t,c.path)),await a(c.path,n,r);let{cmd:u,path:f}=c;t.includes("/")||(i.state.hashTable||(i.state.hashTable=new Map),i.state.hashTable.set(t,f));let d=r||i.state.groupStdin||"",p=!1,h=o();i.state.fileDescriptors??=new Map;let m={fs:i.fs,fsIdentity:yl(i.fs),cwd:i.state.cwd,env:i.state.env,assignShellVariable:async(S,E,A)=>{if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(S))throw new Error(`${S}: not a valid identifier`);let I=A===void 0?S:`${S}[${A}]`,$=Fl(i,S,E);if($===void 0)throw new Error(`${S}: circular name reference`);if($===null)return;let N=$.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(?:\[(.*)\])?$/);if(!N)throw new Error(`${I}: not a valid identifier`);let R=N[1],O=N[2]??A;if(dn(i,S)||dn(i,R))throw new Error(`${R}: readonly variable`);if(O===void 0)i.state.env.set(R,E);else{let B=i.state.associativeArrays?.has(R)?"associative":"indexed";if(B==="associative"){we(i,R,O,E,B);return}let L=await _p(i,R,O);if(L.error)throw new ye(L.error.exitCode,L.error.stdout,L.error.stderr);we(i,R,L.index,E,B)}},exportedEnv:h,get stdin(){return p=!0,d},limits:i.limits,executionScope:u.internalIsExtension?P6(i.executionScope):i.executionScope,exec:(S,E)=>i.execFn(S,E,!1),execWithInheritedStdin:(S,E)=>i.execFn(S,{...E,stdin:d,stdinKind:"bytes"},!0),fetch:i.fetch,getRegisteredCommands:()=>Array.from(i.commands.keys()),sleep:i.sleep,trace:i.trace,fileDescriptors:i.state.fileDescriptors,xpgEcho:i.state.shoptOptions.xpg_echo,coverage:i.coverage,signal:i.state.signal,requireDefenseContext:i.requireDefenseContext,jsBootstrapCode:i.jsBootstrapCode,invokeTool:i.invokeTool},g=u.internalOriginalCommand,b=()=>{};if(g){let S=Object.getOwnPropertyDescriptors(m);S.executionScope={value:i.executionScope,enumerable:!0,configurable:!0,writable:!0};let E=Object.defineProperties(Object.create(Object.getPrototypeOf(m)),S),A=b3(E,g.name),I=Mp(A.context,g.name);b=A.revoke,m.origCommand=$=>{let N=()=>g.execute($,I);return g.trusted?$t.runTrustedAsync(N):$t.runUntrustedAsync(N)}}let w=b3(m,t),y=Mp(w.context,t),x=()=>{w.revoke(),b()};try{let S=()=>on(i.requireDefenseContext,"command",`${t} execution`,()=>u.execute(n,y)),E=()=>kO(S,y,x,t,i.executionScope,i.state.signal),A=u.trusted?await $t.runTrustedAsync(E):await E();return{...A,internalStdinConsumed:A.internalStdinConsumed??(p?r.length:0)}}catch(S){return he(S),K(`${t}: ${Ye(mt(S))}
1528
+ `)}}ce();Z();bi();async function Bp(e,t){let n=e.state.inCondition;e.state.inCondition=!0;let r=new yn(e.executionScope,"condition"),s=0;try{for(let i of t){let o=await e.executeStatement(i);r.appendResult(o),s=o.exitCode}}catch(i){throw r.prependTo(i),i}finally{e.state.inCondition=n}return r.build(s)}kn();Nt();Z();kn();function Yo(e,t,n,r){if(e instanceof Qt)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:"rethrow",stdout:t,stderr:n,error:e}):{action:"break",stdout:t,stderr:n};if(e instanceof Xt)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:"rethrow",stdout:t,stderr:n,error:e}):{action:"continue",stdout:t,stderr:n};if(Lc(e)||e instanceof Ut||e instanceof Yt||e instanceof ye)return e instanceof ut&&e.prependOutput(t,n),{action:"rethrow",stdout:t,stderr:n,error:e};let s=mt(e);return{action:"error",stdout:t,stderr:`${n}${s}
1529
+ `,exitCode:1}}function S3(e,t){return e!==void 0?{owns:!0,stdin:e}:t!==""?{owns:!0,stdin:t}:{owns:!1}}var ws=class{ctx;stdoutChunks=[];stderrChunks=[];totalBytes=0;constructor(t){this.ctx=t}append(t,n){let r=U(t)+U(n);r>this.ctx.limits.maxOutputSize-this.totalBytes&&us(`total output size exceeded (>${this.ctx.limits.maxOutputSize} bytes), increase executionLimits.maxOutputSize`,"output_size"),t&&this.stdoutChunks.push(t),n&&this.stderrChunks.push(n),this.totalBytes+=r}appendUnaccounted(t,n){this.ctx.executionScope.appendOutput("stdout",t,"control-flow"),this.ctx.executionScope.appendOutput("stderr",n,"control-flow"),this.append(t,n)}replace(t,n){this.stdoutChunks=[],this.stderrChunks=[],this.totalBytes=0,this.append(t,n)}get stdout(){return this.stdoutChunks.join("")}get stderr(){return this.stderrChunks.join("")}build(t){let n=this.stdout,r=this.stderr;return{stdout:n,stderr:r,exitCode:t,internalOutputAccounting:{stdout:U(n),stderr:U(r)}}}};async function Up(e,t,n){let r=0;try{for(let s of t){let i=await e.executeStatement(s);n.append(i.stdout,i.stderr),r=i.exitCode}}catch(s){if(ia(s)||s instanceof Yt||s instanceof ye||s instanceof kt||s instanceof C||s instanceof gr)throw s.prependOutput(n.stdout,n.stderr),s;return n.appendUnaccounted("",`${mt(s)}
1530
+ `),n.build(1)}return n.build(r)}async function A3(e,t){return Dn(e,t.redirections,"",()=>OO(e,t))}async function OO(e,t){let n=new ws(e);for(let r of t.clauses){let s=await Bp(e,r.condition);if(n.append(s.stdout,s.stderr),s.exitCode===0)return Up(e,r.body,n)}return t.elseBody?Up(e,t.elseBody,n):n.build(0)}async function C3(e,t){return Dn(e,t.redirections,"",()=>TO(e,t))}async function TO(e,t){let n=new ws(e),r=0,s=0;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t.variable))return K(`bash: \`${t.variable}': not a valid identifier
1531
+ `);let i=[];if(t.words===null)i=(e.state.env.get("@")||"").split(" ").filter(Boolean);else if(t.words.length===0)i=[];else try{for(let o of t.words){let a=await hr(e,o);Kt(i,a.values,e.limits.maxArrayElements,"for-loop expansion")}}catch(o){if(o instanceof mr)return{stdout:"",stderr:o.stderr,exitCode:1};throw o}e.state.loopDepth++;try{for(let o of i){s++,s>e.limits.maxLoopIterations&&us(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",n.stdout,n.stderr),e.state.env.set(t.variable,o);try{for(let a of t.body){let l=await e.executeStatement(a);n.append(l.stdout,l.stderr),r=l.exitCode}}catch(a){let l=Yo(a,n.stdout,n.stderr,e.state.loopDepth);if(n.replace(l.stdout,l.stderr),l.action==="break")break;if(l.action==="continue")continue;if(l.action==="error")return n.build(l.exitCode??1);throw l.error}}}finally{e.state.loopDepth--}return n.build(r)}async function v3(e,t){return Dn(e,t.redirections,"",()=>RO(e,t))}async function RO(e,t){let n=t.line;n!==void 0&&(e.state.currentLine=n);let r=new ws(e),s=0,i=0;t.init&&await Re(e,t.init.expression),e.state.loopDepth++;try{for(;i++,i>e.limits.maxLoopIterations&&us(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r.stdout,r.stderr),!(t.condition&&(n!==void 0&&(e.state.currentLine=n),await Re(e,t.condition.expression)===0));){try{for(let o of t.body){let a=await e.executeStatement(o);r.append(a.stdout,a.stderr),s=a.exitCode}}catch(o){let a=Yo(o,r.stdout,r.stderr,e.state.loopDepth);if(r.replace(a.stdout,a.stderr),a.action==="break")break;if(a.action==="continue"){t.update&&await Re(e,t.update.expression);continue}if(a.action==="error")return r.build(a.exitCode??1);throw a.error}t.update&&await Re(e,t.update.expression)}}finally{e.state.loopDepth--}return r.build(s)}async function k3(e,t,n=""){return Dn(e,t.redirections,n,r=>$O(e,t,n,r))}async function $O(e,t,n,r){let s=new ws(e),i=0,o=0,a=S3(r.stdin,n),l=e.state.groupStdin;a.owns&&(e.state.groupStdin=a.stdin),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&us(`while loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s.stdout,s.stderr);let c=0,u=!1,f=!1,d=e.state.inCondition;e.state.inCondition=!0;try{for(let p of t.condition){let h=await e.executeStatement(p);s.append(h.stdout,h.stderr),c=h.exitCode}}catch(p){if(p instanceof Qt){if(s.append(p.stdout,p.stderr),p.levels>1&&e.state.loopDepth>1)throw p.levels--,p.stdout=s.stdout,p.stderr=s.stderr,e.state.inCondition=d,p;u=!0}else if(p instanceof Xt){if(s.append(p.stdout,p.stderr),p.levels>1&&e.state.loopDepth>1)throw p.levels--,p.stdout=s.stdout,p.stderr=s.stderr,e.state.inCondition=d,p;f=!0}else throw e.state.inCondition=d,p}finally{e.state.inCondition=d}if(u)break;if(!f){if(c!==0)break;try{for(let p of t.body){let h=await e.executeStatement(p);s.append(h.stdout,h.stderr),i=h.exitCode}}catch(p){let h=Yo(p,s.stdout,s.stderr,e.state.loopDepth);if(s.replace(h.stdout,h.stderr),h.action==="break")break;if(h.action==="continue")continue;if(h.action==="error")return s.build(h.exitCode??1);throw h.error}}}}finally{e.state.loopDepth--,a.owns&&(e.state.groupStdin=l)}return s.build(i)}async function N3(e,t,n=""){return Dn(e,t.redirections,n,r=>PO(e,t,n,r))}async function PO(e,t,n,r){let s=new ws(e),i=0,o=0,a=S3(r.stdin,n),l=e.state.groupStdin;a.owns&&(e.state.groupStdin=a.stdin),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&us(`until loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s.stdout,s.stderr);let c=await Bp(e,t.condition);if(s.append(c.stdout,c.stderr),c.exitCode===0)break;try{for(let u of t.body){let f=await e.executeStatement(u);s.append(f.stdout,f.stderr),i=f.exitCode}}catch(u){let f=Yo(u,s.stdout,s.stderr,e.state.loopDepth);if(s.replace(f.stdout,f.stderr),f.action==="break")break;if(f.action==="continue")continue;if(f.action==="error")return s.build(f.exitCode??1);throw f.error}}}finally{e.state.loopDepth--,a.owns&&(e.state.groupStdin=l)}return s.build(i)}async function I3(e,t){return Dn(e,t.redirections,"",()=>DO(e,t))}async function DO(e,t){let n=new ws(e),r=0,s=await Be(e,t.word),i=!1;for(let o=0;o<t.items.length;o++){let a=t.items[o],l=i;if(!i)for(let c of a.patterns){let u=await Be(e,c);r4(c)&&(u=Rn(u));let f=e.state.shoptOptions.nocasematch,d=e.state.shoptOptions.extglob;if(Wi(s,u,f,d,e.limits.maxCallDepth)){l=!0;break}}if(l){let c=await Up(e,a.body,n);if(n.replace(c.stdout,c.stderr),r=c.exitCode,a.terminator===";;")break;a.terminator===";&"?i=!0:i=!1}else i=!1}return n.build(r)}Z();function zp(e,t){if(e.parts.length!==1)return!1;let n=e.parts[0];return n.type!=="Literal"?!1:t.includes(n.value)}ce();Ni();Z();async function O3(e,t,n){let r=t.timed?ki():0,s="",i=Me,o=0,a=[],l="",c=0,u=t.commands.length>1,f=e.state.lastArg,d=e.state.groupStdin,p=e.state.groupStdinSourceFd;for(let w=0;w<t.commands.length;w++){let y=t.commands[w],x=w===t.commands.length-1,S=w===0;u&&(e.state.lastArg="",e.state.groupStdin=S?d:void 0,e.state.groupStdinSourceFd=S?p:void 0);let E=u&&(!x||!e.state.shoptOptions.lastpipe),A=E?new Map(e.state.env):null,I=E?Zn(e.state.arrays):null,$,N=e.executionScope.outputBytesUsed;try{e.state.commandCount=e.executionScope.chargeCommand(),$=await n(y,s)}catch(R){if(R instanceof rn)$={stdout:R.stdout,stderr:R.stderr,exitCode:1};else if(R instanceof ye&&t.commands.length>1)$={stdout:R.stdout,stderr:R.stderr,exitCode:R.exitCode};else if(R instanceof Yt&&t.commands.length>1)$={stdout:R.stdout,stderr:R.stderr,exitCode:R.exitCode};else throw A&&(e.state.env=A,e.state.arrays=I??new Map),R}finally{u&&(S&&(d=e.state.groupStdin,p=e.state.groupStdinSourceFd),e.state.groupStdin=d,e.state.groupStdinSourceFd=p)}if(A&&(e.state.env=A,e.state.arrays=I??new Map),$=e.executionScope.accountResult($,"pipeline",e.executionScope.outputBytesUsed-N),!x){let R=t.pipeStderr?.[w]??!1,O=$.internalOutputAccounting?.stdout??0,B=R?$.internalOutputAccounting?.stderr??0:0;D6(e.executionScope,O+B,"pipeline"),$={...$,internalOutputAccounting:{stdout:0,stderr:R?0:$.internalOutputAccounting?.stderr??0}}}a.push($.exitCode),$.exitCode!==0&&(o=$.exitCode),x?i=$:(t.pipeStderr?.[w]??!1?s=Ln($.stderr)+Vr($):(s=Vr($),l+=$.stderr,c+=$.internalOutputAccounting?.stderr??0),i={stdout:"",stderr:"",exitCode:$.exitCode})}l&&(i={...i,stderr:l+i.stderr,internalOutputAccounting:{stdout:i.internalOutputAccounting?.stdout??0,stderr:c+(i.internalOutputAccounting?.stderr??0)}});let h=t.commands.length>1||t.commands.length===1&&t.commands[0].type==="SimpleCommand",m=i.internalPipeStatusOverride??a;if(h){vt(e,"PIPESTATUS");for(let w=0;w<m.length;w++)we(e,"PIPESTATUS",w,String(m[w]))}if(e.state.options.pipefail&&o!==0&&(i={...i,exitCode:o}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let y=(ki()-r)/1e3,x=Math.floor(y/60),S=y%60,E;t.timePosix?E=`real ${y.toFixed(2)}
1532
+ user 0.00
1533
+ sys 0.00
1534
+ `:E=`
1535
+ real ${`${x}m${S.toFixed(3)}s`}
1536
+ user 0m0.000s
1537
+ sys 0m0.000s
1538
+ `,i={...i,stderr:i.stderr+E}}u&&!e.state.shoptOptions.lastpipe&&(e.state.lastArg=f),i=e.executionScope.accountResult(i,"pipeline");let{internalPipeStatusOverride:g,...b}=i;return b}bi();Z();kn();function Wp(e){return e?{...e,options:e.options?[...e.options]:void 0,actions:e.actions?[...e.actions]:void 0}:void 0}function LO(e){return e?new Map(Array.from(e,([t,n])=>[t,Wp(n)])):void 0}function FO(e){if(!e)return;let t=new Map,n=new Map;for(let[r,s]of e){let i=t.get(s);i||(i=new Set(s),t.set(s,i)),n.set(r,i)}return n}function MO(e){return e?.map(t=>new Map(Array.from(t,([n,r])=>[n,r?{kind:r.kind,elements:new Map(r.elements)}:void 0])))}function _O(e){return e?new Map(Array.from(e,([t,n])=>[t,n.map(r=>({...r}))])):void 0}function jp(e){let t={env:e.env,arrays:e.arrays,cwd:e.cwd,previousDir:e.previousDir,lastExitCode:e.lastExitCode,lastArg:e.lastArg,currentLine:e.currentLine,options:e.options,shoptOptions:e.shoptOptions,fileDescriptors:e.fileDescriptors,inputFds:e.inputFds,fdAliases:e.fdAliases,closedStandardFds:e.closedStandardFds,nextFd:e.nextFd,readonlyVars:e.readonlyVars,associativeArrays:e.associativeArrays,namerefs:e.namerefs,boundNamerefs:e.boundNamerefs,invalidNamerefs:e.invalidNamerefs,integerVars:e.integerVars,lowercaseVars:e.lowercaseVars,uppercaseVars:e.uppercaseVars,exportedVars:e.exportedVars,tempExportedVars:e.tempExportedVars,localExportedVars:e.localExportedVars,declaredVars:e.declaredVars,localScopes:e.localScopes,localArrayScopes:e.localArrayScopes,localVarDepth:e.localVarDepth,localVarStack:e.localVarStack,fullyUnsetLocals:e.fullyUnsetLocals,tempEnvBindings:e.tempEnvBindings,mutatedTempEnvVars:e.mutatedTempEnvVars,accessedTempEnvVars:e.accessedTempEnvVars,functions:e.functions,callDepth:e.callDepth,sourceDepth:e.sourceDepth,callLineStack:e.callLineStack,funcNameStack:e.funcNameStack,sourceStack:e.sourceStack,currentSource:e.currentSource,inCondition:e.inCondition,loopDepth:e.loopDepth,parentHasLoopContext:e.parentHasLoopContext,errexitSafe:e.errexitSafe,directoryStack:e.directoryStack,hashTable:e.hashTable,completionSpecs:e.completionSpecs,defaultCompletionSpec:e.defaultCompletionSpec,emptyCompletionSpec:e.emptyCompletionSpec,groupStdin:e.groupStdin,groupStdinSourceFd:e.groupStdinSourceFd,bashPid:e.bashPid,expansionExitCode:e.expansionExitCode,expansionStderr:e.expansionStderr};e.env=new Map(e.env),e.arrays=Zn(e.arrays),e.options={...e.options},e.shoptOptions={...e.shoptOptions},e.fileDescriptors=e.fileDescriptors?new Map(e.fileDescriptors):void 0,e.inputFds=e.inputFds?new Set(e.inputFds):void 0,e.fdAliases=FO(e.fdAliases),e.closedStandardFds=e.closedStandardFds?new Set(e.closedStandardFds):void 0,e.readonlyVars=new Set(e.readonlyVars),e.associativeArrays=new Set(e.associativeArrays),e.namerefs=new Set(e.namerefs),e.boundNamerefs=new Set(e.boundNamerefs),e.invalidNamerefs=new Set(e.invalidNamerefs),e.integerVars=new Set(e.integerVars),e.lowercaseVars=new Set(e.lowercaseVars),e.uppercaseVars=new Set(e.uppercaseVars),e.exportedVars=new Set(e.exportedVars),e.tempExportedVars=new Set(e.tempExportedVars),e.localExportedVars=e.localExportedVars?.map(r=>new Set(r)),e.declaredVars=new Set(e.declaredVars),e.localScopes=e.localScopes.map(r=>new Map(r)),e.localArrayScopes=MO(e.localArrayScopes),e.localVarDepth=e.localVarDepth?new Map(e.localVarDepth):void 0,e.localVarStack=_O(e.localVarStack),e.fullyUnsetLocals=e.fullyUnsetLocals?new Map(e.fullyUnsetLocals):void 0,e.tempEnvBindings=e.tempEnvBindings?.map(r=>new Map(r)),e.mutatedTempEnvVars=e.mutatedTempEnvVars?new Set(e.mutatedTempEnvVars):void 0,e.accessedTempEnvVars=e.accessedTempEnvVars?new Set(e.accessedTempEnvVars):void 0,e.functions=new Map(e.functions),e.callLineStack=e.callLineStack?[...e.callLineStack]:void 0,e.funcNameStack=e.funcNameStack?[...e.funcNameStack]:void 0,e.sourceStack=e.sourceStack?[...e.sourceStack]:void 0,e.directoryStack=e.directoryStack?[...e.directoryStack]:void 0,e.hashTable=e.hashTable?new Map(e.hashTable):void 0,e.completionSpecs=LO(e.completionSpecs),e.defaultCompletionSpec=Wp(e.defaultCompletionSpec),e.emptyCompletionSpec=Wp(e.emptyCompletionSpec);let n=!1;return()=>{n||(n=!0,Object.assign(e,t))}}async function T3(e,t,n,r,s=!1){let i=e.state.loopDepth,o=new Map;for(let l of e.state.fileDescriptors?.keys()??[]){let c=Pn(e,l);c&&o.set(l,c)}let a=jp(e.state);e.state.parentHasLoopContext=i>0,e.state.loopDepth=0,e.state.bashPid=e.state.nextVirtualPid++;try{return await Dn(e,t.redirections,n,l=>BO(e,t,l.stdin??n,r,s||l.stdin!==void 0))}finally{let l=new Map;for(let[c,u]of o){let f=Pn(e,c),d=u.kind==="input"&&f?.kind==="input"?u.content.length-f.content.length:u.kind==="readwrite"&&f?.kind==="readwrite"&&u.path===f.path?f.position-u.position:0;if(d<=0)continue;let p=Math.min(...ps(e,c));l.set(p,Math.max(l.get(p)??0,d))}a();for(let[c,u]of l)hs(e,c,u)}}async function BO(e,t,n,r,s){(s||n)&&(e.state.groupStdin=n);let i=new yn(e.executionScope,"subshell"),o=0;try{for(let a of t.body){let l=await r(a);i.appendResult(l),o=l.exitCode}}catch(a){if(a instanceof C)throw i.prependTo(a),a;if(a instanceof gr||a instanceof Qt||a instanceof Xt)return i.append("stdout",a.stdout,a.internalOutputAccounting.stdout),i.append("stderr",a.stderr,a.internalOutputAccounting.stderr),i.build(0);if(a instanceof ye||a instanceof Ut||a instanceof Yt)return i.append("stdout",a.stdout,a.internalOutputAccounting.stdout),i.append("stderr",a.stderr,a.internalOutputAccounting.stderr),i.build(a.exitCode);if(a instanceof kt)throw a.prependOutput(i.stdout,i.stderr),a;return i.append("stderr",`${mt(a)}
1539
+ `),i.build(1)}return i.build(o)}async function R3(e,t,n,r,s=!1){return Dn(e,t.redirections,n,i=>UO(e,t,n,r,s,i))}async function UO(e,t,n,r,s,i){let o=new yn(e.executionScope,"group"),a=0,l=i.stdin??n,c=s||n!==""||i.stdin!==void 0,u=e.state.groupStdin;c&&(e.state.groupStdin=l);let f=()=>{(c||u!==void 0&&e.state.groupStdin===void 0)&&(e.state.groupStdin=u)};try{for(let d of t.body){let p=await r(d);o.appendResult(p),a=p.exitCode}}catch(d){if(f(),d instanceof C)throw o.prependTo(d),d;if(ia(d)||d instanceof Yt||d instanceof ye||d instanceof kt)throw d.prependOutput(o.stdout,o.stderr),d;return o.append("stderr",`${mt(d)}
1540
+ `),o.build(1)}return f(),o.build(a)}async function $3(e,t,n,r,s){let i;try{i=await e.fs.readFile(t)}catch{return K(`bash: ${t}: No such file or directory
1541
+ `,127)}if(i.startsWith("#!")){let l=i.indexOf(`
1542
+ `);l!==-1&&(i=i.slice(l+1))}let o=e.state.loopDepth,a=jp(e.state);e.state.parentHasLoopContext=o>0,e.state.loopDepth=0,e.state.bashPid=e.state.nextVirtualPid++,r&&(e.state.groupStdin=r),e.state.currentSource=t,e.state.env.set("0",t),e.state.env.set("#",String(n.length)),e.state.env.set("@",n.join(" ")),e.state.env.set("*",n.join(" "));for(let l=0;l<n.length&&l<9;l++)e.state.env.set(String(l+1),n[l]);for(let l=n.length+1;l<=9;l++)e.state.env.delete(String(l));try{let c=new be().parse(i),u=await s(c);return a(),u}catch(l){if(a(),l instanceof ye)return Q(l.stdout,l.stderr,l.exitCode);if(l instanceof kt||l instanceof C)throw l;if(l.name==="ParseException")return K(`bash: ${t}: ${l.message}
1543
+ `);throw l}}function zO(e){throw new TypeError(`Unsupported command node: ${JSON.stringify(e)}`)}var Jo=class{ctx;constructor(t,n){this.ctx={state:n,fs:t.fs,commands:t.commands,limits:t.limits,executionScope:t.executionScope,execFn:t.exec,executeScript:this.executeScript.bind(this),executeStatement:this.executeStatement.bind(this),executeCommand:this.executeCommand.bind(this),fetch:t.fetch,sleep:t.sleep,trace:t.trace,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext??!1,jsBootstrapCode:t.jsBootstrapCode,invokeTool:t.invokeTool}}assertDefenseContext(t){if(!this.ctx.requireDefenseContext||$t.isInSandboxedContext())return;let n=`interpreter ${t} attempted outside defense context`;throw new Ae(n,{timestamp:Date.now(),type:"missing_defense_context",message:n,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:$t.getCurrentExecutionId()})}buildExportedEnv(){let t=this.ctx.state.exportedVars,n=this.ctx.state.tempExportedVars,r=new Set;if(t)for(let i of t)r.add(i);if(n)for(let i of n)r.add(i);if(r.size===0)return Object.create(null);let s=Object.create(null);for(let i of r){let o=this.ctx.state.env.get(i);o!==void 0&&(s[i]=o)}return s}async executeScript(t){this.assertDefenseContext("execution");let n=0,r=new yn(this.ctx.executionScope,"script");for(let s of t.statements)try{let i=await this.executeStatement(s);r.appendResult(i,Pc(i)),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n))}catch(i){if(i instanceof ye||i instanceof kt)throw i.prependOutput(r.stdout,r.stderr),i;if(i instanceof hn)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Ht(this.ctx.state.env)};if(i instanceof C)throw r.prependTo(i),i;if(i instanceof Yt)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Ht(this.ctx.state.env)};if(i instanceof Jt)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Ht(this.ctx.state.env)};if(i instanceof rn)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Ht(this.ctx.state.env)};if(i instanceof Ve){r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n));continue}if(i instanceof ti){r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n));continue}if(i instanceof Qt||i instanceof Xt){if(this.ctx.state.loopDepth>0)throw i.prependOutput(r.stdout,r.stderr),i;r.append("stdout",i.stdout),r.append("stderr",i.stderr);continue}throw i instanceof Ut&&i.prependOutput(r.stdout,r.stderr),i}return{...r.build(n),env:Ht(this.ctx.state.env)}}async executeUserScript(t,n,r=""){return $3(this.ctx,t,n,r,s=>this.executeScript(s))}async executeStatement(t){if(this.assertDefenseContext("statement"),this.ctx.state.signal?.aborted)throw new Ge;if(t.deferredError)throw new Wt(t.deferredError.message,t.line??1,1);if(this.ctx.state.options.noexec)return Me;this.ctx.state.errexitSafe=!1;let n=new yn(this.ctx.executionScope,"statement");this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&t.sourceText&&n.append("stderr",`${t.sourceText}
1544
+ `);let r=0,s=-1,i=!1;try{for(let l=0;l<t.pipelines.length;l++){let c=t.pipelines[l],u=l>0?t.operators[l-1]:null;if(u==="&&"&&r!==0||u==="||"&&r===0)continue;let f=await this.executePipeline(c);n.appendResult(f,Pc(f)),r=f.exitCode,s=l,i=c.negated,this.ctx.state.lastExitCode=r,this.ctx.state.env.set("?",String(r))}}catch(l){throw n.prependTo(l),l}let o=s<t.pipelines.length-1,a=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=o||i||a,this.ctx.state.options.errexit&&r!==0&&s===t.pipelines.length-1&&!i&&!this.ctx.state.inCondition&&!a){let l=new Yt(r);throw l.prependOutput(n.stdout,n.stderr),l}return n.build(r)}async executePipeline(t){return O3(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n,r=!1){let s=t4(this.ctx),i;try{i=await this.executeCommandInner(t,n,r)}catch(a){throw await Td(this.ctx,s).catch(()=>{}),a}let o=await Td(this.ctx,s);return!o.stdout&&!o.stderr?i:{...i,stdout:o.stdout?Vr(i)+o.stdout:i.stdout,stdoutKind:o.stdout?"bytes":i.stdoutKind,stderr:i.stderr+o.stderr}}async executeCommandInner(t,n,r){switch(this.assertDefenseContext("command"),this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return A3(this.ctx,t);case"For":return C3(this.ctx,t);case"CStyleFor":return v3(this.ctx,t);case"While":return k3(this.ctx,t,n);case"Until":return N3(this.ctx,t,n);case"Case":return I3(this.ctx,t);case"Subshell":return this.executeSubshell(t,n,r);case"Group":return this.executeGroup(t,n,r);case"FunctionDef":return L4(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return zO(t)}}async executeSimpleCommand(t,n){let r;try{return await this.executeSimpleCommandInner(t,n,s=>{r=s})}catch(s){if(r?.finish(),s instanceof mr)return K(s.stderr);throw s}}async executeSimpleCommandInner(t,n,r){if(t.line!==void 0&&(this.ctx.state.currentLine=t.line),this.ctx.state.shoptOptions.expand_aliases&&t.name){let N=t,R=0;for(;;){let O=this.expandAlias(N);if(O===N)break;if(R>=this.ctx.limits.maxCallDepth)throw new C(`alias expansion depth limit exceeded (${this.ctx.limits.maxCallDepth})`,"recursion");R++,N=O}this.aliasExpansionStack.clear(),N!==t&&(t=N)}this.ctx.state.expansionStderr="";let s=await f3(this.ctx,t);if(s.error)return s.error;let i=s.tempAssignments,o=s.xtraceOutput,a=()=>{for(let[N,R]of i)R===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,R)};if(!t.name){if(t.redirections.length>0){let R=Vi(this.ctx,t.redirections,P4);r(R);let O=await R.prepare(n);if(O.error){if(a(),!O.errorCause)return R.finish(),O.error;try{return Gi(O)}finally{R.finish()}}let B=Q("",o,0),L=await gs(this.ctx,B,t.redirections,O.targets,O.dupSources,O.standardRoutes);return R.finish(),L}this.ctx.state.lastArg="";let N=(this.ctx.state.expansionStderr||"")+o;return this.ctx.state.expansionStderr="",Q("",N,this.ctx.state.lastExitCode)}let l=t.name&&zp(t.name,["local","declare","typeset","export","readonly"]),c=Array.from(i.keys());if(c.length>0&&!l){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let N of c)this.ctx.state.tempExportedVars.add(N)}let u=await Be(this.ctx,t.name),f=[],d=[],p=(N,R)=>{if(f.length>=this.ctx.limits.maxArrayElements)throw new C(`expanded argument element limit exceeded (${this.ctx.limits.maxArrayElements})`,"array_elements");f.push(N),d.push(R)};if(zp(t.name,["local","declare","typeset","export","readonly"])&&(u==="local"||u==="declare"||u==="typeset"||u==="export"||u==="readonly"))for(let N of t.args){let R=await d4(this.ctx,N);if(R)p(R,!0);else{let O=await p4(this.ctx,N);if(O!==null)p(O,!0);else{let B=await hr(this.ctx,N);for(let L of B.values)p(L,B.quoted)}}}else for(let N of t.args){let R=await hr(this.ctx,N);for(let O of R.values)p(O,R.quoted)}let m=t.name.parts.every(N=>N.type==="CommandSubstitution"||N.type==="ParameterExpansion"||N.type==="ArithmeticExpansion");!u&&m&&f.length>0&&(u=f.shift(),d.shift());let g=Vi(this.ctx,t.redirections,u==="exec"?D4:Vo);r(g);let b=await g.prepare(n);if(b.error)return a(),b.errorCause?Gi(b):(g.finish(),b.error);let w=b.stdinSourceFd,y=b.stdin!==void 0;if(b.stdin!==void 0&&(n=b.stdin),!u)return m?(g.finish(),Q("","",this.ctx.state.lastExitCode)):(g.finish(),K(`bash: : command not found
1545
+ `,127));if(u==="exec"&&(f.length===0||f[0]==="--")){for(let[N,R]of i)R===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,R);if(this.ctx.state.tempExportedVars)for(let N of i.keys())this.ctx.state.tempExportedVars.delete(N);return g.finish(),Me}if(this.ctx.state.extraArgs){let N=this.ctx.state.extraArgs;this.ctx.state.extraArgs=void 0;for(let R of N)p(R,!0)}let x=await c3(this.ctx,u,f);i.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(i)));let S,E=null;try{S=await this.runCommand(u,f,d,n,!1,!1,w,y)}catch(N){if(N instanceof Qt||N instanceof Xt)E=N,S=Me;else throw N}w>=0&&u!=="read"&&hs(this.ctx,w,S.internalStdinConsumed??0);let A=o+x;if(A&&(S={...S,stderr:A+S.stderr}),S=await gs(this.ctx,S,t.redirections,b.targets,b.dupSources,b.standardRoutes,S.internalProducerCommand??u,S.internalProducerOmitsShellPrefix),g.finish(),E)throw E;if(f.length>0){let N=f[f.length-1];if((u==="declare"||u==="local"||u==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(N)){let R=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);R&&(N=R[1])}this.ctx.state.lastArg=N}else this.ctx.state.lastArg=u;let I=j6(u)&&u!=="unset"&&u!=="eval";if(!this.ctx.state.options.posix||!I)for(let[N,R]of i)this.ctx.state.fullyUnsetLocals?.has(N)||(R===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,R));if(this.ctx.state.tempExportedVars)for(let N of i.keys())this.ctx.state.tempExportedVars.delete(N);return i.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(S={...S,stderr:this.ctx.state.expansionStderr+S.stderr},this.ctx.state.expansionStderr=""),S}async runCommand(t,n,r,s,i=!1,o=!1,a=-1,l=!1){let c={ctx:this.ctx,runCommand:(d,p,h,m,g,b,w,y)=>this.runCommand(d,p,h,m,g,b,w,y),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(d,p,h)=>this.executeUserScript(d,p,h)},u=await x3(c,t,n,r,s,i,o,a,l);return u!==null?u.internalProducerCommand===void 0?{...u,internalProducerCommand:t}:u:{...await E3(c,t,n,s,o),internalProducerCommand:t}}aliasExpansionStack=new Set;expandAlias(t){return _7({env:this.ctx.state.env,limits:this.ctx.limits},t,this.aliasExpansionStack)}async findCommandInPath(t){return Sl(this.ctx,t)}async executeSubshell(t,n="",r=!1){return T3(this.ctx,t,n,s=>this.executeStatement(s),r)}async executeGroup(t,n="",r=!1){return R3(this.ctx,t,n,s=>this.executeStatement(s),r)}async executeArithmeticCommand(t){return t.line!==void 0&&(this.ctx.state.currentLine=t.line),Dn(this.ctx,t.redirections,"",async()=>{try{let n=await Re(this.ctx,t.expression.expression),r=Ot(n!==0);return this.ctx.state.expansionStderr&&(r={...r,stderr:this.ctx.state.expansionStderr+r.stderr},this.ctx.state.expansionStderr=""),r}catch(n){return K(`bash: arithmetic expression: ${n.message}
1546
+ `)}})}async executeConditionalCommand(t){return t.line!==void 0&&(this.ctx.state.currentLine=t.line),Dn(this.ctx,t.redirections,"",async()=>{try{let n=await fs(this.ctx,t.expression),r=Ot(n);return this.ctx.state.expansionStderr&&(r={...r,stderr:this.ctx.state.expansionStderr+r.stderr},this.ctx.state.expansionStderr=""),r}catch(n){let r=n instanceof Ve?1:2;return K(`bash: conditional expression: ${n.message}
1547
+ `,r)}})}};ra();vn();xs();function Hp(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function WO(e){let t=Hp(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}var jO=3;function P3(e){let t=e;for(let n=0;n<jO;n++){if(t.includes("\\")||t.includes(";")||/%(?![0-9a-f]{2})/i.test(t))return!0;let r=t.toLowerCase();if(r.includes("%2f")||r.includes("%2e")||r.includes("%5c")||r.includes("%3b"))return!0;let s;try{s=decodeURIComponent(t)}catch{return!0}if(s===t)return!1;t=s}return t.includes("%")}function HO(e,t){return t==="/"||t===""?!0:t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`)}function Vp(e,t){let n=Hp(e);if(!n)return!1;let r=WO(t);return!r||n.origin!==r.origin||r.pathPrefix!=="/"&&r.pathPrefix!==""&&P3(n.pathname)?!1:HO(n.pathname,r.pathPrefix)}function D3(e){return typeof e=="string"?e:e.url}function L3(e,t){return!t||t.length===0?!1:t.some(n=>Vp(e,D3(n)))}function Gp(e){let t=VO(e);if(t==="localhost"||t.endsWith(".localhost"))return!0;let n=F3(t);if(n)return Sc(n);let r=qO(t);return r?ZO(r):!1}function VO(e){let t=e.trim().toLowerCase();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function GO(e){if(!e)return null;let t=10,n=e;if(n.startsWith("0x")||n.startsWith("0X")?(t=16,n=n.slice(2)):n.length>1&&n.startsWith("0")&&(t=8),!n||t===16&&!/^[0-9a-fA-F]+$/.test(n)||t===10&&!/^\d+$/.test(n)||t===8&&!/^[0-7]+$/.test(n))return null;let r=Number.parseInt(n,t);return!Number.isFinite(r)||r<0?null:r}function F3(e){let t=e.split(".");if(t.length===0||t.length>4)return null;let n=t.map(l=>GO(l));if(n.some(l=>l===null))return null;let r=n;if(t.length===1){let l=r[0];return l>4294967295?null:[l>>>24&255,l>>>16&255,l>>>8&255,l&255]}if(t.length===2){let[l,c]=r;return l>255||c>16777215?null:[l,c>>>16&255,c>>>8&255,c&255]}if(t.length===3){let[l,c,u]=r;return l>255||c>255||u>65535?null:[l,c,u>>>8&255,u&255]}let[s,i,o,a]=r;return s>255||i>255||o>255||a>255?null:[s,i,o,a]}function qO(e){let t=e,n=null;if(t.includes(".")){let m=t.lastIndexOf(":");if(m<0)return null;let g=t.slice(m+1),b=F3(g);if(!b)return null;n=b,t=t.slice(0,m)}let r=t.includes("::")?t.split("::").length-1:0;if(r>1)return null;let[s,i]=t.split("::"),o=s?s.split(":").filter(Boolean):[],a=i?i.split(":").filter(Boolean):[],l=m=>/^[0-9a-f]{1,4}$/i.test(m)?Number.parseInt(m,16):null,c=o.map(l),u=a.map(l);if(c.some(m=>m===null)||u.some(m=>m===null))return null;let f=n?2:0,d=c.length+u.length+f,p=0;if(r===1){if(p=8-d,p<0)return null}else if(d!==8)return null;let h=[...c,...new Array(p).fill(0),...u];return n&&(h.push(n[0]<<8|n[1]),h.push(n[2]<<8|n[3])),h.length===8?h:null}function Sc(e){let[t,n]=e;return t===127||t===10||t===172&&n>=16&&n<=31||t===192&&n===168||t===169&&n===254||t===0||t===100&&n>=64&&n<=127||t===198&&(n===18||n===19)||t===192&&n===0&&e[2]===0||t===192&&n===0&&e[2]===2||t===198&&n===51&&e[2]===100||t===203&&n===0&&e[2]===113||t>=240}function ZO(e){if(e.every(s=>s===0)||e.slice(0,7).every(s=>s===0)&&e[7]===1||(e[0]&65472)===65152||(e[0]&65024)===64512)return!0;if(e[0]===0&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===65535){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Sc(s)}if(e[0]===8193&&e[1]===3512)return!0;if(e[0]===100&&e[1]===65435&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===0){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Sc(s)}if(e[0]===100&&e[1]===65435&&e[2]===1)return!0;if(e[0]===8194){let s=[e[1]>>>8&255,e[1]&255,e[2]>>>8&255,e[2]&255];return Sc(s)}return!1}function M3(e){let t=[];for(let n of e){if(typeof n!="string"&&(n===null||typeof n!="object"||!("url"in n)||typeof n.url!="string")){t.push('Invalid allow-list entry: must be a string URL or an object with a "url" string property');continue}let r=D3(n);if(!Hp(r)){t.push(`Invalid URL in allow-list: "${r}" - must be a valid URL with scheme and host (e.g., "https://example.com")`);continue}let i=new URL(r);if(i.protocol!=="http:"&&i.protocol!=="https:"){t.push(`Only http and https URLs are allowed in allow-list: "${r}"`);continue}if(!i.hostname){t.push(`Allow-list entry must include a hostname: "${r}"`);continue}if(i.pathname!=="/"&&i.pathname!==""&&P3(i.pathname)){t.push(`Allow-list entry contains ambiguous path separators: "${r}"`);continue}(i.search||i.hash)&&t.push(`Query strings and fragments are ignored in allow-list entries: "${r}"`)}return t}var Jn=class extends Error{constructor(t,n){let r=n??"URL not in allow-list";super(`Network access denied: ${r}: ${t}`),this.name="NetworkAccessDeniedError"}},Xs=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},jr=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},Ac=class extends Error{constructor(t,n){super(`HTTP method '${t}' not allowed. Allowed methods: ${n.join(", ")}`),this.name="MethodNotAllowedError"}},Ys=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};var KO=20,QO=3e4,XO=10485760,YO=["GET","HEAD"],qp;qp=null;var JO=new Set(["GET","HEAD","OPTIONS"]),eT=new Set([301,302,303,307,308]);function ea(e){return e.reason instanceof Error?e.reason:new DOMException("The operation was aborted","AbortError")}function tT(e){if(e?.aborted)throw ea(e)}function Kp(e){let t=e.allowedUrlPrefixes??[];if(e._dnsResolve)throw new Error("NetworkConfig._dnsResolve is no longer supported: DNS resolution is performed by guarded-fetch and cannot be overridden");if(e._createConnectionOwner)throw new Error("NetworkConfig._createConnectionOwner is no longer supported: connect-time IP pinning is performed by guarded-fetch and cannot be overridden");let n=e._fetch;if(!e.dangerouslyAllowFullInternetAccess){let x=M3(t);if(x.length>0)throw new Error(`Invalid network allow-list:
1548
+ ${x.join(`
1549
+ `)}`)}let r=[];for(let x of t)typeof x=="object"&&x.transform&&x.transform.length>0&&r.push(x);function s(x){if(r.length===0)return null;let S=null;for(let E of r)if(Vp(x,E.url)&&E.transform){S||(S=new Headers);for(let A of E.transform)for(let[I,$]of Object.entries(A.headers))S.set(I,$)}return S}if(e.maxRedirects!==void 0&&(!Number.isSafeInteger(e.maxRedirects)||e.maxRedirects<0))throw new RangeError("maxRedirects must be a non-negative safe integer");let i=e.maxRedirects??KO,o=e.timeoutMs??QO,a=e.maxResponseSize??XO,l=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??YO,c=e.denyPrivateRanges??(typeof process<"u"&&!0),u=[];for(let x of t){let S=typeof x=="string"?x:x.url;try{u.push(new URL(S).hostname)}catch{}}function f(x){try{return new URL(x).hostname||"localhost.invalid"}catch{return"localhost.invalid"}}function d(x){return e.dangerouslyAllowFullInternetAccess?c?{allowedHosts:void 0,skipSsrfCheckForAllowedHosts:void 0}:{allowedHosts:[f(x)],skipSsrfCheckForAllowedHosts:!0}:{allowedHosts:u,skipSsrfCheckForAllowedHosts:!c}}function p(x){try{return Gp(new URL(x).hostname)}catch{return!1}}async function h(x,S){let E={method:S.method,headers:S.headers,signal:S.signal,redirect:"manual"};return S.body!==void 0&&(E.body=S.body),await(n??globalThis.fetch)(x,E)}function m(x){if(!e.dangerouslyAllowFullInternetAccess&&!L3(x,t))throw new Jn(x)}function g(x){if(!c)return;let S;try{S=new URL(x)}catch{throw new Jn(x,"invalid URL")}if(Gp(S.hostname))throw new Jn(x,"private/loopback IP address blocked")}function b(x){if(e.dangerouslyAllowFullInternetAccess)return;let S=x.toUpperCase();if(!l.includes(S))throw new Ac(S,l)}function w(x,S,E,A){if(!E.isGuardedFetchError(x))return x;let I=x,{onRedirectHop:$,subReason:N}=A;switch(I.code){case"host_not_allowed":case"protocol_not_allowed":return $?new jr(S):new Jn(S);case"hostname_unsafe":return $?new jr(S):new Jn(S,N==="dns_resolution_failed"?"DNS resolution failed for private IP check":"hostname resolves to private/loopback IP address");case"redirect_to_unsafe_host":return new jr(S);case"too_many_redirects":return new Xs(i);case"response_too_large":return new Ys(a);default:return x}}async function y(x,S={}){let E=S.method?.toUpperCase()??"GET",A=S.followRedirects??!0;if(S.maxRedirects!==void 0&&(!Number.isSafeInteger(S.maxRedirects)||S.maxRedirects<0))throw new RangeError("maxRedirects must be a non-negative safe integer");let I=S.maxRedirects??i,$=Math.min(i,I),N=S.timeoutMs!==void 0?Math.min(S.timeoutMs,o):o,R=new AbortController,O=bs(()=>R.abort(new DOMException("The operation was aborted","AbortError")),N),B=ei(S.signal,R.signal);try{m(x),g(x),b(E);let L=qp?await qp:null,T=x,W=0,_=[],F=E,z=S.body,D=S.headers,X=!1;for(;;){tT(B.signal);let V=await $t.runTrustedAsync(async()=>{let Y=D;if(X&&Y){let pe=Y instanceof Headers?new Headers(Y):new Headers(Y);pe.delete("authorization"),pe.delete("cookie"),Y=pe}let J=s(T),ge=rT(Y,J),Oe={method:F,headers:ge,signal:B.signal,followRedirects:!1,timeoutMs:N,sanitizeHeaders:!1};if(z&&!JO.has(F)&&(Oe.body=z),Object.assign(Oe,d(T)),!L||p(T)){if(c)throw new Jn(T,"DNS pinning unavailable for private IP enforcement");return await h(T,Oe)}c?n&&(Oe.fetch=n):(Oe.fetch=n??globalThis.fetch,Oe.dispatcher=null);let Ee;Oe.onUrlBlocked=pe=>{Ee=pe.subReason};try{return await L.guardedFetch(T,Oe)}catch(pe){throw w(pe,T,L,{onRedirectHop:W>0,subReason:Ee})}});if(eT.has(V.status)&&A){let Y=V.headers.get("location");if(!Y)return await _3(V,T,a,B.signal,_);_.push({status:V.status,statusText:V.statusText,headers:B3(V.headers)});let J=new URL(Y,T).href;await Zp(nT(V),B.signal);try{m(J),g(J)}catch(Ee){throw B.signal?.aborted?ea(B.signal):Ee instanceof Jn?new jr(J):Ee}let ge=V.status;if(((ge===301||ge===302)&&F==="POST"||ge===303&&F!=="GET"&&F!=="HEAD")&&(F="GET",z=void 0,b(F)),new URL(J).origin!==new URL(T).origin&&(X=!0),W++,W>$)throw new Xs($);T=J;continue}return await _3(V,T,a,B.signal,_)}}finally{Js(O),B.cleanup()}}return y}async function Zp(e,t){if(!t)return e;if(t.aborted)throw e.catch(()=>{}),ea(t);let n,r=new Promise((s,i)=>{n=()=>i(ea(t)),t.addEventListener("abort",n,{once:!0})});try{return await Promise.race([e,r])}finally{n&&t.removeEventListener("abort",n)}}async function nT(e){e.body&&!e.body.locked&&await e.body.cancel()}function rT(e,t){if(!e&&!t)return;if(!t)return e;let n=e instanceof Headers?new Headers(e):new Headers(e);for(let[r,s]of t)n.set(r,s);return n}function B3(e){let t=Object.create(null);return e.forEach((n,r)=>{t[r.toLowerCase()]=n}),t}async function _3(e,t,n,r,s){let i=B3(e.headers);if(n>0){let l=e.headers.get("content-length");if(l){let c=parseInt(l,10);if(!Number.isNaN(c)&&c>n)throw new Ys(n)}}let o;if(n>0&&e.body){let l=e.body.getReader(),c=[],u=0;try{for(;;){let{done:d,value:p}=await Zp(l.read(),r);if(d)break;if(p){if(u+=p.byteLength,u>n)throw await l.cancel(),new Ys(n);c.push(p)}}}catch(d){throw r?.aborted&&await l.cancel(ea(r)).catch(()=>{}),d}o=new Uint8Array(u);let f=0;for(let d of c)o.set(d,f),f+=d.byteLength}else{let l=await Zp(e.arrayBuffer(),r);if(n>0&&l.byteLength>n)throw new Ys(n);o=new Uint8Array(l)}let a={status:e.status,statusText:e.statusText,headers:i,body:o,url:t};return s&&s.length>0&&(a.redirectChain=s),a}vn();St();Z();function Cc(e,t){if(e.length>t||U(e)>t)throw new C(`script input size limit exceeded (${t} bytes)`,"string_length")}var Xp=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;abortOnUnresolvedCommands=!1;invokeToolFn;transformPlugins=[];state;constructor(t={}){this.limits=wl({...t.executionLimits,...t.maxCallDepth!==void 0&&{maxCallDepth:t.maxCallDepth},...t.maxCommandCount!==void 0&&{maxCommandCount:t.maxCommandCount},...t.maxLoopIterations!==void 0&&{maxLoopIterations:t.maxLoopIterations}},t.executionLimitProfile);let n=t.fs??new lr(t.files,{maxTotalBytes:this.limits.maxFileSystemBytes});this.fs=n,this.useDefaultLayout=!t.cwd&&!t.files;let r=t.cwd||(this.useDefaultLayout?"/home/user":"/"),s=new Map([["HOME",this.useDefaultLayout?"/home/user":"/"],["PATH","/usr/bin:/bin"],["IFS",`
1550
+ `],["OSTYPE","linux-gnu"],["MACHTYPE","x86_64-pc-linux-gnu"],["HOSTTYPE","x86_64"],["HOSTNAME","localhost"],["PWD",r],["OLDPWD",r],["OPTIND","1"],...Object.entries(t.env??{})]);if(t.fetch?this.secureFetch=t.fetch:t.network&&(this.secureFetch=Kp(t.network)),this.sleepFn=t.sleep,this.traceFn=t.trace,this.logger=t.logger,this.defenseInDepthConfig=t.defenseInDepth??!0,this.abortOnUnresolvedCommands=t.abortOnUnresolvedCommands??!1,this.coverageWriter=t.coverage,this.state={env:s,arrays:new Map,cwd:r,previousDir:"/home/user",functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastArg:"",startTime:Date.now(),lastBackgroundPid:0,virtualPid:t.processInfo?.pid??1,virtualPpid:t.processInfo?.ppid??0,virtualUid:t.processInfo?.uid??1e3,virtualGid:t.processInfo?.gid??1e3,bashPid:t.processInfo?.pid??1,nextVirtualPid:(t.processInfo?.pid??1)+1,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1,posix:!1,allexport:!1,noclobber:!1,noglob:!1,noexec:!1,vi:!1,emacs:!1},shoptOptions:{extglob:!1,dotglob:!1,nullglob:!1,failglob:!1,globstar:!1,globskipdots:!0,nocaseglob:!1,nocasematch:!1,expand_aliases:!1,lastpipe:!1,xpg_echo:!1},inCondition:!1,loopDepth:0,exportedVars:new Set(["HOME","PATH","PWD","OLDPWD",...Object.keys(t.env||{})]),readonlyVars:new Set(["SHELLOPTS","BASHOPTS"]),hashTable:new Map},this.state.env.set("SHELLOPTS",jf(this.state.options)),this.state.env.set("BASHOPTS",Hf(this.state.shoptOptions)),B6(n,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),r!=="/"&&n instanceof lr)try{n.mkdirSync(r,{recursive:!0})}catch{}for(let o of S6(t.commands))this.registerBundledCommand(o);if(t.fetch||t.network)for(let o of A6())this.registerBundledCommand(o);if(t.python)for(let o of C6())this.registerBundledCommand(o);let i=typeof t.javascript=="object"?t.javascript:Object.create(null);if(t.javascript||i.invokeTool){for(let o of v6())this.registerBundledCommand(o);i.bootstrap&&(this.jsBootstrapCode=i.bootstrap),i.invokeTool&&(this.invokeToolFn=i.invokeTool)}if(t.customCommands)for(let o of t.customCommands)if(T6(o)){let a=R6(o);this.registerCommandInternal(a,!0)}else this.registerCommandInternal(o,!0)}registerCommand(t){this.registerCommandInternal(t,!0)}registerBundledCommand(t){this.registerCommandInternal(t,!1)}registerCommandInternal(t,n,r=n?t.trusted??!0:t.trusted){let s=this.commands.get(t.name),i=n?s?.internalOriginalCommand??(s&&!s.internalIsExtension?s:void 0):void 0,o={name:t.name,trusted:r,internalIsExtension:n,internalOriginalCommand:i,execute:(l,c)=>t.execute(l,c)};this.commands.set(t.name,o);let a=this.fs;if(typeof a.writeFileSync=="function"){let l=`#!/bin/bash
1551
+ # Built-in command: ${t.name}
1552
+ `;try{a.writeFileSync(`/bin/${t.name}`,l)}catch{}try{a.writeFileSync(`/usr/bin/${t.name}`,l)}catch{}}}logResult(t){return this.logger&&(t.stdout&&this.logger.debug("stdout",{output:t.stdout}),t.stderr&&this.logger.info("stderr",{output:t.stderr}),this.logger.info("exit",{exitCode:t.exitCode})),t.stdout=U3(t.stdout),t.stderr=U3(t.stderr),t}async exec(t,n){let r=new bl(this.limits,n?.signal,this.abortOnUnresolvedCommands),s;try{s=await this.execInScope(t,n,r,0,n?.signal,!1,!1)}catch(o){try{await r.close()}catch{}throw o}let i=s;try{await r.close()}catch{i={...s,stderr:`${s.stderr}bash: execution cleanup failed
1553
+ `,exitCode:126}}return i.unresolvedCommands=r.unresolvedCommandNames,t.trim()?this.logResult(i):i}async execInScope(t,n,r,s,i,o=!1,a=!0){let l=f=>a?this.logResult(f):f,c=ei(i,n?.signal),u=n?{...n,signal:c.signal}:{signal:c.signal};try{if(r.assertExecDepth(s),Cc(t,this.limits.maxSourceBytes),!t.trim())return{stdout:"",stderr:"",exitCode:0,env:mn(this.state.env,u.env)};this.logger?.info("exec",{command:t});let f=u.cwd??this.state.cwd,d,p=f;if(u.cwd)if(u.env&&"PWD"in u.env)d=u.env.PWD;else if(u.env&&!("PWD"in u.env))try{d=await this.fs.realpath(f),p=d}catch{d=f}else d=f;let h=u.replaceEnv?new Map:new Map(this.state.env);if(u.env)for(let[y,x]of Object.entries(u.env))h.set(y,x);d!==void 0&&h.set("PWD",d);let m={...this.state,env:h,arrays:u.replaceEnv?new Map:Zn(this.state.arrays),cwd:p,previousDir:u.env?.OLDPWD??this.state.previousDir,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options},hashTable:this.state.hashTable,groupStdin:oT(u.stdin,u.stdinKind,this.limits.maxInputBytes,this.limits.maxStringLength,r,o),signal:u.signal,extraArgs:u.args},g=t;u.rawScript||(g=Qp(t));let b=this.defenseInDepthConfig?$t.getInstance(this.defenseInDepthConfig):null,w=b?.activate();try{let y=async()=>{let x=Kn(g,{maxHeredocSize:this.limits.maxHeredocSize}),S;if(this.transformPlugins.length>0){let N=Object.create(null);for(let R of this.transformPlugins){let O=R.transform({ast:x,metadata:N});x=O.ast,O.metadata&&(N=Ns(N,O.metadata))}S=N}let E={fs:this.fs,commands:this.commands,limits:this.limits,executionScope:r,exec:(N,R,O=!1)=>this.execInScope(N,R,r,s+1,u.signal,O),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn,coverage:this.coverageWriter,requireDefenseContext:b?.isEnabled()===!0,jsBootstrapCode:this.jsBootstrapCode,invokeTool:this.invokeToolFn},$=await new Jo(E,m).executeScript(x);return S&&($.metadata=S),l($)};return w?await w.run(y):await y()}catch(y){if(y instanceof ye)return l({stdout:y.stdout,stderr:y.stderr,exitCode:y.exitCode,internalOutputAccounting:y.internalOutputAccounting,env:mn(this.state.env,u.env)});if(y instanceof kt){if(s>0)throw y;return l({stdout:y.stdout,stderr:y.stderr,exitCode:y.exitCode,internalOutputAccounting:y.internalOutputAccounting,env:mn(this.state.env,u.env)})}if(y instanceof hn)return l({stdout:y.stdout,stderr:y.stderr,exitCode:y.exitCode,env:mn(this.state.env,u.env)});if(y instanceof Ve)return l({stdout:y.stdout,stderr:y.stderr,exitCode:1,env:mn(this.state.env,u.env)});if(y instanceof Ge)return l({stdout:y.stdout,stderr:y.stderr,exitCode:124,env:mn(this.state.env,u.env)});if(y instanceof C)return l({stdout:y.stdout,stderr:Ye(y.stderr),exitCode:C.EXIT_CODE,internalOutputAccounting:y.internalOutputAccounting,env:mn(this.state.env,u.env)});if(y instanceof Ae)return l({stdout:"",stderr:`bash: security violation: ${Ye(y.message)}
1554
+ `,exitCode:1,env:mn(this.state.env,u.env)});if(y.name==="ParseException")return l({stdout:"",stderr:`bash: syntax error: ${Ye(y.message)}
1555
+ `,exitCode:2,env:mn(this.state.env,u.env)});if(y instanceof Tn)return l({stdout:"",stderr:`bash: ${Ye(y.message)}
1556
+ `,exitCode:2,env:mn(this.state.env,u.env)});if(y instanceof RangeError)return l({stdout:"",stderr:`bash: ${Ye(y.message)}
1557
+ `,exitCode:1,env:mn(this.state.env,u.env)});throw y}finally{w?.deactivate()}}catch(f){if(f instanceof Ge)return l({stdout:f.stdout,stderr:f.stderr,exitCode:124,env:mn(this.state.env,u.env)});if(f instanceof C)return l({stdout:f.stdout,stderr:Ye(f.stderr),exitCode:C.EXIT_CODE,internalOutputAccounting:f.internalOutputAccounting,env:mn(this.state.env,u.env)});throw f}finally{c.cleanup()}}async readFile(t){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,t))}async writeFile(t,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,t),n)}getCwd(){return this.state.cwd}getEnv(){return Ht(this.state.env)}registerTransformPlugin(t){this.transformPlugins.push(t)}transform(t){Cc(t,this.limits.maxSourceBytes);let n=Qp(t),r=Kn(n,{maxHeredocSize:this.limits.maxHeredocSize}),s=Object.create(null);for(let i of this.transformPlugins){let o=i.transform({ast:r,metadata:s});r=o.ast,o.metadata&&(s=Ns(s,o.metadata))}return{script:I7(r),ast:r,metadata:s}}async analyzeCommands(t){Cc(t,this.limits.maxSourceBytes);let n=Kn(Qp(t),{maxHeredocSize:this.limits.maxHeredocSize}),{commands:r,definedFunctions:s,definedAliases:i}=U6(n),o=[];for(let a of r)s.has(a)||i.has(a)||await this.resolvesCommandForAnalysis(a)||o.push(a);return{commands:r,unresolved:o}}async resolvesCommandForAnalysis(t){if((Do.has(t)||ns.has(t))&&!H6.has(t)||this.state.functions.has(t))return!0;let n=await El({fs:this.fs,state:{...this.state,hashTable:new Map},commands:this.commands},t);return n!==null&&!("error"in n)}};function sT(e,t){let n=t;for(let r=0;r<e.length;r++){let s=e[r];if(n==="single")s==="'"&&(n="none");else if(n==="double")s==="\\"?r++:s==='"'&&(n="none");else if(s==="'")n="single";else if(s==='"')n="double";else if(s==="\\")r++;else if(s==="#"&&(r===0||/\s/.test(e[r-1])))break}return n}function Qp(e){let t=e.split(`
1558
+ `),n=[],r=[],s="none";for(let i=0;i<t.length;i++){let o=t[i];if(r.length>0){let u=r[r.length-1];if((u.stripTabs?o.replace(/^\t+/,""):o)===u.delimiter){n.push(o.trimStart()),r.pop();continue}n.push(o);continue}let a=s,l=a==="none"?o.trimStart():o;if(n.push(l),s=sT(o,a),a!=="none")continue;let c=/<<(-?)\s*(['"]?)([\w-]+)\2/g;for(let u of l.matchAll(c)){let f=u[1]==="-",d=u[3];r.push({delimiter:d,stripTabs:f})}}return n.join(`
1559
+ `)}var iT=new TextDecoder("utf-8",{fatal:!0});function U3(e){if(!e)return e;let t=!1;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);if(s>255)return e;s>127&&(t=!0)}if(!t)return e;let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);try{return iT.decode(n)}catch{return e}}function oT(e,t,n,r,s,i){if(e===void 0)return;let o=t==="bytes"?e.length:U(e);if(o>n||o>r)throw new C(`stdin size limit exceeded (${Math.min(n,r)} bytes)`,"string_length");return i||s.consumeInput(o,"stdin"),t==="bytes"?e:Ln(e)}export{Xp as Bash,lr as InMemoryFs,Bi as MountableFs,Jn as NetworkAccessDeniedError,jr as RedirectNotAllowedError,Xs as TooManyRedirectsError,ek as createCommandContext,tk as defineCommand,Xv as getCommandNames,Yv as getNetworkCommandNames};
1560
+ /*! Bundled license information:
1561
+
1562
+ re2js/build/index.esm.js:
1563
+ (*!
1564
+ * re2js
1565
+ * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
1566
+ *
1567
+ * @version v1.3.3
1568
+ * @author Alexey Vasiliev
1569
+ * @homepage https://github.com/le0pard/re2js#readme
1570
+ * @repository github:le0pard/re2js
1571
+ * @license MIT
1572
+ *)
1573
+
1574
+ ieee754/index.js:
1575
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
1576
+ */