@eidos.space/just-bash 3.0.2

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 (899) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/LICENSE +201 -0
  3. package/README.md +609 -0
  4. package/dist/AGENTS.md +325 -0
  5. package/dist/Bash.d.ts +257 -0
  6. package/dist/ast/types.d.ts +609 -0
  7. package/dist/banned-patterns-test.d.ts +1 -0
  8. package/dist/bin/chunks/alias-YRVAW27Y.js +3 -0
  9. package/dist/bin/chunks/awk2-RLMNTGI7.js +3 -0
  10. package/dist/bin/chunks/base64-RZRLGMB3.js +3 -0
  11. package/dist/bin/chunks/basename-F3AQ4KAQ.js +3 -0
  12. package/dist/bin/chunks/bash-CLP24TE2.js +3 -0
  13. package/dist/bin/chunks/cat-LQH5FSAR.js +3 -0
  14. package/dist/bin/chunks/chmod-S564JCJW.js +3 -0
  15. package/dist/bin/chunks/chunk-22HCD466.js +3 -0
  16. package/dist/bin/chunks/chunk-2AIXTPH2.js +9 -0
  17. package/dist/bin/chunks/chunk-2ETT4ELS.js +4 -0
  18. package/dist/bin/chunks/chunk-2GG3NVC4.js +10 -0
  19. package/dist/bin/chunks/chunk-2NRAWO6E.js +7 -0
  20. package/dist/bin/chunks/chunk-2SVX7I5P.js +14 -0
  21. package/dist/bin/chunks/chunk-3BYTCO2H.js +12 -0
  22. package/dist/bin/chunks/chunk-3MRB66F4.js +3 -0
  23. package/dist/bin/chunks/chunk-3UKQXBQ3.js +6 -0
  24. package/dist/bin/chunks/chunk-3WIMLJM7.js +8 -0
  25. package/dist/bin/chunks/chunk-47WZ2U6M.js +9 -0
  26. package/dist/bin/chunks/chunk-4KSZJAQK.js +6 -0
  27. package/dist/bin/chunks/chunk-5XSZHUEI.js +15 -0
  28. package/dist/bin/chunks/chunk-6FSBHK6H.js +22 -0
  29. package/dist/bin/chunks/chunk-6WJQNLR2.js +7 -0
  30. package/dist/bin/chunks/chunk-77MLOOQS.js +11 -0
  31. package/dist/bin/chunks/chunk-7AYT3UKI.js +6 -0
  32. package/dist/bin/chunks/chunk-7JZKVC3F.js +2 -0
  33. package/dist/bin/chunks/chunk-7NC4CPHS.js +20 -0
  34. package/dist/bin/chunks/chunk-7UU7KPEM.js +7 -0
  35. package/dist/bin/chunks/chunk-7VCQWCSH.js +15 -0
  36. package/dist/bin/chunks/chunk-AGKL4LDL.js +4 -0
  37. package/dist/bin/chunks/chunk-AJF3OBTR.js +4 -0
  38. package/dist/bin/chunks/chunk-ALVEEXFD.js +19 -0
  39. package/dist/bin/chunks/chunk-B2DRBHGQ.js +3 -0
  40. package/dist/bin/chunks/chunk-BE4PARL3.js +13 -0
  41. package/dist/bin/chunks/chunk-BGX3RW7H.js +10 -0
  42. package/dist/bin/chunks/chunk-BIJXTWZ4.js +3 -0
  43. package/dist/bin/chunks/chunk-BPZJYOUA.js +33 -0
  44. package/dist/bin/chunks/chunk-BZP56QBM.js +24 -0
  45. package/dist/bin/chunks/chunk-C7ISPH7Y.js +18 -0
  46. package/dist/bin/chunks/chunk-CAZ75E7E.js +3 -0
  47. package/dist/bin/chunks/chunk-D6CPXGKK.js +75 -0
  48. package/dist/bin/chunks/chunk-DJAX3ZRG.js +8 -0
  49. package/dist/bin/chunks/chunk-DYIBFLS3.js +17 -0
  50. package/dist/bin/chunks/chunk-EDTBGO7F.js +37 -0
  51. package/dist/bin/chunks/chunk-F3GKANW3.js +12 -0
  52. package/dist/bin/chunks/chunk-F3WNDKOC.js +3 -0
  53. package/dist/bin/chunks/chunk-FKVQZWJQ.js +10 -0
  54. package/dist/bin/chunks/chunk-FOUVACI7.js +16 -0
  55. package/dist/bin/chunks/chunk-FVRXEJYQ.js +141 -0
  56. package/dist/bin/chunks/chunk-G4AUMZUY.js +4 -0
  57. package/dist/bin/chunks/chunk-H7JTIXAO.js +4 -0
  58. package/dist/bin/chunks/chunk-HL4ZS7TX.js +6 -0
  59. package/dist/bin/chunks/chunk-HN2DCT7T.js +13 -0
  60. package/dist/bin/chunks/chunk-I4IRHQDW.js +3 -0
  61. package/dist/bin/chunks/chunk-IEXQTXU5.js +34 -0
  62. package/dist/bin/chunks/chunk-IZGLHVBB.js +8 -0
  63. package/dist/bin/chunks/chunk-J7TUF2VI.js +9 -0
  64. package/dist/bin/chunks/chunk-JNUX75OX.js +85 -0
  65. package/dist/bin/chunks/chunk-JXLDT4KX.js +4 -0
  66. package/dist/bin/chunks/chunk-JZW7NFK2.js +288 -0
  67. package/dist/bin/chunks/chunk-KFMPGSUT.js +9 -0
  68. package/dist/bin/chunks/chunk-KI54R2QB.js +3 -0
  69. package/dist/bin/chunks/chunk-KRRM5UCC.js +3 -0
  70. package/dist/bin/chunks/chunk-KUMHQGUR.js +3 -0
  71. package/dist/bin/chunks/chunk-L24QXM5S.js +34 -0
  72. package/dist/bin/chunks/chunk-LAHBP3FW.js +11 -0
  73. package/dist/bin/chunks/chunk-LC6D27QJ.js +3 -0
  74. package/dist/bin/chunks/chunk-LNNWMRCB.js +3 -0
  75. package/dist/bin/chunks/chunk-LNVSXNT7.js +3 -0
  76. package/dist/bin/chunks/chunk-LSQTB2QK.js +7 -0
  77. package/dist/bin/chunks/chunk-M65CQLJE.js +101 -0
  78. package/dist/bin/chunks/chunk-MLUOPG3W.js +3 -0
  79. package/dist/bin/chunks/chunk-MNWK4UIM.js +22 -0
  80. package/dist/bin/chunks/chunk-MROECM42.js +3 -0
  81. package/dist/bin/chunks/chunk-MUFNRCMY.js +24 -0
  82. package/dist/bin/chunks/chunk-N6YW4W3Z.js +29 -0
  83. package/dist/bin/chunks/chunk-NE4R2FVV.js +5 -0
  84. package/dist/bin/chunks/chunk-NXVG64T3.js +22 -0
  85. package/dist/bin/chunks/chunk-NYIPFY36.js +3 -0
  86. package/dist/bin/chunks/chunk-O2BCKSMK.js +3 -0
  87. package/dist/bin/chunks/chunk-OLEQNRKX.js +8 -0
  88. package/dist/bin/chunks/chunk-OPMLWMNH.js +17 -0
  89. package/dist/bin/chunks/chunk-PAYQNSZN.js +18 -0
  90. package/dist/bin/chunks/chunk-PBOVSFTJ.js +3 -0
  91. package/dist/bin/chunks/chunk-PXP4YYZA.js +13 -0
  92. package/dist/bin/chunks/chunk-PZQVSQX6.js +4 -0
  93. package/dist/bin/chunks/chunk-Q2GOPGDA.js +6 -0
  94. package/dist/bin/chunks/chunk-Q4UMTSRO.js +15 -0
  95. package/dist/bin/chunks/chunk-QL33F2W6.js +8 -0
  96. package/dist/bin/chunks/chunk-RVPTAYDS.js +4 -0
  97. package/dist/bin/chunks/chunk-SMSELHIY.js +12 -0
  98. package/dist/bin/chunks/chunk-UGJM7CKP.js +17 -0
  99. package/dist/bin/chunks/chunk-UO5LOD7U.js +12 -0
  100. package/dist/bin/chunks/chunk-UOMNSQEZ.js +10 -0
  101. package/dist/bin/chunks/chunk-UR4CEP4Y.js +3 -0
  102. package/dist/bin/chunks/chunk-V2RP73X4.js +15 -0
  103. package/dist/bin/chunks/chunk-VBDLSL7Y.js +10 -0
  104. package/dist/bin/chunks/chunk-VZK4FHWJ.js +3 -0
  105. package/dist/bin/chunks/chunk-WDWNEHHE.js +9 -0
  106. package/dist/bin/chunks/chunk-X4MX6EHF.js +6 -0
  107. package/dist/bin/chunks/chunk-XBB73LFB.js +5 -0
  108. package/dist/bin/chunks/chunk-XFFUAO3F.js +3 -0
  109. package/dist/bin/chunks/chunk-XHCCSVP6.js +9 -0
  110. package/dist/bin/chunks/chunk-XJ37N3S5.js +7 -0
  111. package/dist/bin/chunks/chunk-XPTYN6UE.js +8 -0
  112. package/dist/bin/chunks/chunk-XRUDFQG5.js +7 -0
  113. package/dist/bin/chunks/chunk-Y4FPH5DQ.js +64 -0
  114. package/dist/bin/chunks/chunk-YJ5OCPSK.js +7 -0
  115. package/dist/bin/chunks/chunk-YOIFOOGX.js +9 -0
  116. package/dist/bin/chunks/chunk-YOKQNNQO.js +6 -0
  117. package/dist/bin/chunks/chunk-YUZRUF5F.js +10 -0
  118. package/dist/bin/chunks/chunk-YY5PJR7O.js +7 -0
  119. package/dist/bin/chunks/chunk-ZFUVUYWG.js +15 -0
  120. package/dist/bin/chunks/clear-FGNEKYDU.js +3 -0
  121. package/dist/bin/chunks/column-AQB3A3PJ.js +3 -0
  122. package/dist/bin/chunks/comm-Q4VDF6ZO.js +3 -0
  123. package/dist/bin/chunks/cp-HYXTMN3D.js +3 -0
  124. package/dist/bin/chunks/curl-PLHETP4J.js +27 -0
  125. package/dist/bin/chunks/cut-ZI2HIAW7.js +3 -0
  126. package/dist/bin/chunks/date-JEZYSA4F.js +3 -0
  127. package/dist/bin/chunks/diff-YDJ42RKS.js +3 -0
  128. package/dist/bin/chunks/dirname-VCINTLPD.js +3 -0
  129. package/dist/bin/chunks/du-4LRQIGRG.js +3 -0
  130. package/dist/bin/chunks/echo-KCOHTNDF.js +3 -0
  131. package/dist/bin/chunks/env-NY32PQJM.js +3 -0
  132. package/dist/bin/chunks/expand-YYSO35NS.js +3 -0
  133. package/dist/bin/chunks/expansion-PPP6PD75.js +3 -0
  134. package/dist/bin/chunks/expr-7PLWSWZI.js +3 -0
  135. package/dist/bin/chunks/file-GRZLWDVH.js +3 -0
  136. package/dist/bin/chunks/find-P4DOE7CE.js +3 -0
  137. package/dist/bin/chunks/flag-coverage-RFKIBJ6L.js +3 -0
  138. package/dist/bin/chunks/fold-5MF7QZWQ.js +3 -0
  139. package/dist/bin/chunks/grep-VAYCFO4O.js +3 -0
  140. package/dist/bin/chunks/gzip-UGBQQKIH.js +3 -0
  141. package/dist/bin/chunks/head-QNC2ZYDO.js +3 -0
  142. package/dist/bin/chunks/help-CGUEOGXQ.js +3 -0
  143. package/dist/bin/chunks/history-AQQWW3QB.js +3 -0
  144. package/dist/bin/chunks/hostname-USNWOQCK.js +3 -0
  145. package/dist/bin/chunks/html-to-markdown-QEFY7XQR.js +3 -0
  146. package/dist/bin/chunks/join-EJ73DYTK.js +3 -0
  147. package/dist/bin/chunks/jq-GGTKKMEN.js +3 -0
  148. package/dist/bin/chunks/js-exec-BC6NI55L.js +98 -0
  149. package/dist/bin/chunks/js-exec-worker.js +4443 -0
  150. package/dist/bin/chunks/ln-LP4HMCSM.js +3 -0
  151. package/dist/bin/chunks/ls-KBNHNZWQ.js +3 -0
  152. package/dist/bin/chunks/md5sum-MCVDIB35.js +3 -0
  153. package/dist/bin/chunks/mkdir-P4DKRCDX.js +3 -0
  154. package/dist/bin/chunks/mv-QQK4FQX6.js +3 -0
  155. package/dist/bin/chunks/nl-KUPLVCTS.js +3 -0
  156. package/dist/bin/chunks/od-YQ5ZUI2H.js +3 -0
  157. package/dist/bin/chunks/paste-A5KKPWXX.js +3 -0
  158. package/dist/bin/chunks/printf-Z5C2UOI5.js +3 -0
  159. package/dist/bin/chunks/pwd-FCNDA467.js +3 -0
  160. package/dist/bin/chunks/python3-BQWDPUBM.js +13 -0
  161. package/dist/bin/chunks/readlink-25V57VOL.js +3 -0
  162. package/dist/bin/chunks/rev-PYHOZ4D4.js +3 -0
  163. package/dist/bin/chunks/rg-BGFMSIVK.js +3 -0
  164. package/dist/bin/chunks/rm-ECNUFR66.js +3 -0
  165. package/dist/bin/chunks/rmdir-DLOHIA7Q.js +3 -0
  166. package/dist/bin/chunks/sed-FWA634SN.js +3 -0
  167. package/dist/bin/chunks/seq-UXDJE6FB.js +3 -0
  168. package/dist/bin/chunks/sha1sum-4KF52U3Y.js +3 -0
  169. package/dist/bin/chunks/sha256sum-6YEPULPX.js +3 -0
  170. package/dist/bin/chunks/sleep-QHAPNY3Q.js +3 -0
  171. package/dist/bin/chunks/sort-4C6WOKNK.js +3 -0
  172. package/dist/bin/chunks/split-TV7NL7LA.js +3 -0
  173. package/dist/bin/chunks/sqlite3-W777NCI4.js +3 -0
  174. package/dist/bin/chunks/sqlite3-worker.js +1728 -0
  175. package/dist/bin/chunks/stat-BD6KT3BP.js +3 -0
  176. package/dist/bin/chunks/strings-MDD72LR6.js +3 -0
  177. package/dist/bin/chunks/tac-C2N4NQ6S.js +3 -0
  178. package/dist/bin/chunks/tail-BCB5W6JC.js +3 -0
  179. package/dist/bin/chunks/tar-DOO744MK.js +3 -0
  180. package/dist/bin/chunks/tee-UQHPO4OW.js +3 -0
  181. package/dist/bin/chunks/time-ZPY52VT2.js +3 -0
  182. package/dist/bin/chunks/timeout-5AX3ZS3X.js +3 -0
  183. package/dist/bin/chunks/touch-DFGSVIX7.js +3 -0
  184. package/dist/bin/chunks/tr-G7K6M6HP.js +3 -0
  185. package/dist/bin/chunks/tree-6D7SMPUR.js +3 -0
  186. package/dist/bin/chunks/true-SKL4L7JP.js +3 -0
  187. package/dist/bin/chunks/unexpand-QIR4EDPG.js +3 -0
  188. package/dist/bin/chunks/uniq-I7PVFJR4.js +3 -0
  189. package/dist/bin/chunks/wc-6NGWULAP.js +3 -0
  190. package/dist/bin/chunks/which-LCXKCLFC.js +3 -0
  191. package/dist/bin/chunks/whoami-TZDZDU7T.js +3 -0
  192. package/dist/bin/chunks/worker.js +3150 -0
  193. package/dist/bin/chunks/xan-KX4VPXUN.js +3 -0
  194. package/dist/bin/chunks/xan-view-JXOZLJ7S.js +3 -0
  195. package/dist/bin/chunks/xargs-UWHPYLY7.js +3 -0
  196. package/dist/bin/chunks/yq-GCDCJBKB.js +3 -0
  197. package/dist/bin/just-bash.js +755 -0
  198. package/dist/bin/shell/chunks/alias-YRVAW27Y.js +3 -0
  199. package/dist/bin/shell/chunks/awk2-RLMNTGI7.js +3 -0
  200. package/dist/bin/shell/chunks/base64-RZRLGMB3.js +3 -0
  201. package/dist/bin/shell/chunks/basename-F3AQ4KAQ.js +3 -0
  202. package/dist/bin/shell/chunks/bash-CLP24TE2.js +3 -0
  203. package/dist/bin/shell/chunks/cat-LQH5FSAR.js +3 -0
  204. package/dist/bin/shell/chunks/chmod-S564JCJW.js +3 -0
  205. package/dist/bin/shell/chunks/chunk-22HCD466.js +3 -0
  206. package/dist/bin/shell/chunks/chunk-2AIXTPH2.js +9 -0
  207. package/dist/bin/shell/chunks/chunk-2ETT4ELS.js +4 -0
  208. package/dist/bin/shell/chunks/chunk-2GG3NVC4.js +10 -0
  209. package/dist/bin/shell/chunks/chunk-2NRAWO6E.js +7 -0
  210. package/dist/bin/shell/chunks/chunk-2SVX7I5P.js +14 -0
  211. package/dist/bin/shell/chunks/chunk-3BYTCO2H.js +12 -0
  212. package/dist/bin/shell/chunks/chunk-3MRB66F4.js +3 -0
  213. package/dist/bin/shell/chunks/chunk-3UKQXBQ3.js +6 -0
  214. package/dist/bin/shell/chunks/chunk-3WIMLJM7.js +8 -0
  215. package/dist/bin/shell/chunks/chunk-47WZ2U6M.js +9 -0
  216. package/dist/bin/shell/chunks/chunk-4KSZJAQK.js +6 -0
  217. package/dist/bin/shell/chunks/chunk-5XSZHUEI.js +15 -0
  218. package/dist/bin/shell/chunks/chunk-6FSBHK6H.js +22 -0
  219. package/dist/bin/shell/chunks/chunk-6WJQNLR2.js +7 -0
  220. package/dist/bin/shell/chunks/chunk-77MLOOQS.js +11 -0
  221. package/dist/bin/shell/chunks/chunk-7AYT3UKI.js +6 -0
  222. package/dist/bin/shell/chunks/chunk-7JZKVC3F.js +2 -0
  223. package/dist/bin/shell/chunks/chunk-7NC4CPHS.js +20 -0
  224. package/dist/bin/shell/chunks/chunk-7UU7KPEM.js +7 -0
  225. package/dist/bin/shell/chunks/chunk-7VCQWCSH.js +15 -0
  226. package/dist/bin/shell/chunks/chunk-AGKL4LDL.js +4 -0
  227. package/dist/bin/shell/chunks/chunk-AJF3OBTR.js +4 -0
  228. package/dist/bin/shell/chunks/chunk-ALVEEXFD.js +19 -0
  229. package/dist/bin/shell/chunks/chunk-B2DRBHGQ.js +3 -0
  230. package/dist/bin/shell/chunks/chunk-BE4PARL3.js +13 -0
  231. package/dist/bin/shell/chunks/chunk-BGX3RW7H.js +10 -0
  232. package/dist/bin/shell/chunks/chunk-BIJXTWZ4.js +3 -0
  233. package/dist/bin/shell/chunks/chunk-BPZJYOUA.js +33 -0
  234. package/dist/bin/shell/chunks/chunk-BZP56QBM.js +24 -0
  235. package/dist/bin/shell/chunks/chunk-C7ISPH7Y.js +18 -0
  236. package/dist/bin/shell/chunks/chunk-CAZ75E7E.js +3 -0
  237. package/dist/bin/shell/chunks/chunk-D6CPXGKK.js +75 -0
  238. package/dist/bin/shell/chunks/chunk-DJAX3ZRG.js +8 -0
  239. package/dist/bin/shell/chunks/chunk-DYIBFLS3.js +17 -0
  240. package/dist/bin/shell/chunks/chunk-EDTBGO7F.js +37 -0
  241. package/dist/bin/shell/chunks/chunk-F3GKANW3.js +12 -0
  242. package/dist/bin/shell/chunks/chunk-F3WNDKOC.js +3 -0
  243. package/dist/bin/shell/chunks/chunk-FKVQZWJQ.js +10 -0
  244. package/dist/bin/shell/chunks/chunk-FOUVACI7.js +16 -0
  245. package/dist/bin/shell/chunks/chunk-FVRXEJYQ.js +141 -0
  246. package/dist/bin/shell/chunks/chunk-G4AUMZUY.js +4 -0
  247. package/dist/bin/shell/chunks/chunk-H7JTIXAO.js +4 -0
  248. package/dist/bin/shell/chunks/chunk-HL4ZS7TX.js +6 -0
  249. package/dist/bin/shell/chunks/chunk-HN2DCT7T.js +13 -0
  250. package/dist/bin/shell/chunks/chunk-I4IRHQDW.js +3 -0
  251. package/dist/bin/shell/chunks/chunk-IEXQTXU5.js +34 -0
  252. package/dist/bin/shell/chunks/chunk-IZGLHVBB.js +8 -0
  253. package/dist/bin/shell/chunks/chunk-J7TUF2VI.js +9 -0
  254. package/dist/bin/shell/chunks/chunk-JNUX75OX.js +85 -0
  255. package/dist/bin/shell/chunks/chunk-JXLDT4KX.js +4 -0
  256. package/dist/bin/shell/chunks/chunk-JZW7NFK2.js +288 -0
  257. package/dist/bin/shell/chunks/chunk-KFMPGSUT.js +9 -0
  258. package/dist/bin/shell/chunks/chunk-KI54R2QB.js +3 -0
  259. package/dist/bin/shell/chunks/chunk-KRRM5UCC.js +3 -0
  260. package/dist/bin/shell/chunks/chunk-KUMHQGUR.js +3 -0
  261. package/dist/bin/shell/chunks/chunk-L24QXM5S.js +34 -0
  262. package/dist/bin/shell/chunks/chunk-LAHBP3FW.js +11 -0
  263. package/dist/bin/shell/chunks/chunk-LC6D27QJ.js +3 -0
  264. package/dist/bin/shell/chunks/chunk-LNNWMRCB.js +3 -0
  265. package/dist/bin/shell/chunks/chunk-LNVSXNT7.js +3 -0
  266. package/dist/bin/shell/chunks/chunk-LSQTB2QK.js +7 -0
  267. package/dist/bin/shell/chunks/chunk-M65CQLJE.js +101 -0
  268. package/dist/bin/shell/chunks/chunk-MLUOPG3W.js +3 -0
  269. package/dist/bin/shell/chunks/chunk-MNWK4UIM.js +22 -0
  270. package/dist/bin/shell/chunks/chunk-MROECM42.js +3 -0
  271. package/dist/bin/shell/chunks/chunk-MUFNRCMY.js +24 -0
  272. package/dist/bin/shell/chunks/chunk-N6YW4W3Z.js +29 -0
  273. package/dist/bin/shell/chunks/chunk-NE4R2FVV.js +5 -0
  274. package/dist/bin/shell/chunks/chunk-NXVG64T3.js +22 -0
  275. package/dist/bin/shell/chunks/chunk-NYIPFY36.js +3 -0
  276. package/dist/bin/shell/chunks/chunk-O2BCKSMK.js +3 -0
  277. package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +8 -0
  278. package/dist/bin/shell/chunks/chunk-OPMLWMNH.js +17 -0
  279. package/dist/bin/shell/chunks/chunk-PAYQNSZN.js +18 -0
  280. package/dist/bin/shell/chunks/chunk-PBOVSFTJ.js +3 -0
  281. package/dist/bin/shell/chunks/chunk-PXP4YYZA.js +13 -0
  282. package/dist/bin/shell/chunks/chunk-PZQVSQX6.js +4 -0
  283. package/dist/bin/shell/chunks/chunk-Q2GOPGDA.js +6 -0
  284. package/dist/bin/shell/chunks/chunk-Q4UMTSRO.js +15 -0
  285. package/dist/bin/shell/chunks/chunk-QL33F2W6.js +8 -0
  286. package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +4 -0
  287. package/dist/bin/shell/chunks/chunk-SMSELHIY.js +12 -0
  288. package/dist/bin/shell/chunks/chunk-UGJM7CKP.js +17 -0
  289. package/dist/bin/shell/chunks/chunk-UO5LOD7U.js +12 -0
  290. package/dist/bin/shell/chunks/chunk-UOMNSQEZ.js +10 -0
  291. package/dist/bin/shell/chunks/chunk-UR4CEP4Y.js +3 -0
  292. package/dist/bin/shell/chunks/chunk-V2RP73X4.js +15 -0
  293. package/dist/bin/shell/chunks/chunk-VBDLSL7Y.js +10 -0
  294. package/dist/bin/shell/chunks/chunk-VZK4FHWJ.js +3 -0
  295. package/dist/bin/shell/chunks/chunk-WDWNEHHE.js +9 -0
  296. package/dist/bin/shell/chunks/chunk-X4MX6EHF.js +6 -0
  297. package/dist/bin/shell/chunks/chunk-XBB73LFB.js +5 -0
  298. package/dist/bin/shell/chunks/chunk-XFFUAO3F.js +3 -0
  299. package/dist/bin/shell/chunks/chunk-XHCCSVP6.js +9 -0
  300. package/dist/bin/shell/chunks/chunk-XJ37N3S5.js +7 -0
  301. package/dist/bin/shell/chunks/chunk-XPTYN6UE.js +8 -0
  302. package/dist/bin/shell/chunks/chunk-XRUDFQG5.js +7 -0
  303. package/dist/bin/shell/chunks/chunk-Y4FPH5DQ.js +64 -0
  304. package/dist/bin/shell/chunks/chunk-YJ5OCPSK.js +7 -0
  305. package/dist/bin/shell/chunks/chunk-YOIFOOGX.js +9 -0
  306. package/dist/bin/shell/chunks/chunk-YOKQNNQO.js +6 -0
  307. package/dist/bin/shell/chunks/chunk-YUZRUF5F.js +10 -0
  308. package/dist/bin/shell/chunks/chunk-YY5PJR7O.js +7 -0
  309. package/dist/bin/shell/chunks/chunk-ZFUVUYWG.js +15 -0
  310. package/dist/bin/shell/chunks/clear-FGNEKYDU.js +3 -0
  311. package/dist/bin/shell/chunks/column-AQB3A3PJ.js +3 -0
  312. package/dist/bin/shell/chunks/comm-Q4VDF6ZO.js +3 -0
  313. package/dist/bin/shell/chunks/cp-HYXTMN3D.js +3 -0
  314. package/dist/bin/shell/chunks/curl-PLHETP4J.js +27 -0
  315. package/dist/bin/shell/chunks/cut-ZI2HIAW7.js +3 -0
  316. package/dist/bin/shell/chunks/date-JEZYSA4F.js +3 -0
  317. package/dist/bin/shell/chunks/diff-YDJ42RKS.js +3 -0
  318. package/dist/bin/shell/chunks/dirname-VCINTLPD.js +3 -0
  319. package/dist/bin/shell/chunks/du-4LRQIGRG.js +3 -0
  320. package/dist/bin/shell/chunks/echo-KCOHTNDF.js +3 -0
  321. package/dist/bin/shell/chunks/env-NY32PQJM.js +3 -0
  322. package/dist/bin/shell/chunks/expand-YYSO35NS.js +3 -0
  323. package/dist/bin/shell/chunks/expansion-PPP6PD75.js +3 -0
  324. package/dist/bin/shell/chunks/expr-7PLWSWZI.js +3 -0
  325. package/dist/bin/shell/chunks/file-GRZLWDVH.js +3 -0
  326. package/dist/bin/shell/chunks/find-P4DOE7CE.js +3 -0
  327. package/dist/bin/shell/chunks/flag-coverage-RFKIBJ6L.js +3 -0
  328. package/dist/bin/shell/chunks/fold-5MF7QZWQ.js +3 -0
  329. package/dist/bin/shell/chunks/grep-VAYCFO4O.js +3 -0
  330. package/dist/bin/shell/chunks/gzip-UGBQQKIH.js +3 -0
  331. package/dist/bin/shell/chunks/head-QNC2ZYDO.js +3 -0
  332. package/dist/bin/shell/chunks/help-CGUEOGXQ.js +3 -0
  333. package/dist/bin/shell/chunks/history-AQQWW3QB.js +3 -0
  334. package/dist/bin/shell/chunks/hostname-USNWOQCK.js +3 -0
  335. package/dist/bin/shell/chunks/html-to-markdown-QEFY7XQR.js +3 -0
  336. package/dist/bin/shell/chunks/join-EJ73DYTK.js +3 -0
  337. package/dist/bin/shell/chunks/jq-GGTKKMEN.js +3 -0
  338. package/dist/bin/shell/chunks/js-exec-BC6NI55L.js +98 -0
  339. package/dist/bin/shell/chunks/ln-LP4HMCSM.js +3 -0
  340. package/dist/bin/shell/chunks/ls-KBNHNZWQ.js +3 -0
  341. package/dist/bin/shell/chunks/md5sum-MCVDIB35.js +3 -0
  342. package/dist/bin/shell/chunks/mkdir-P4DKRCDX.js +3 -0
  343. package/dist/bin/shell/chunks/mv-QQK4FQX6.js +3 -0
  344. package/dist/bin/shell/chunks/nl-KUPLVCTS.js +3 -0
  345. package/dist/bin/shell/chunks/od-YQ5ZUI2H.js +3 -0
  346. package/dist/bin/shell/chunks/paste-A5KKPWXX.js +3 -0
  347. package/dist/bin/shell/chunks/printf-Z5C2UOI5.js +3 -0
  348. package/dist/bin/shell/chunks/pwd-FCNDA467.js +3 -0
  349. package/dist/bin/shell/chunks/python3-BQWDPUBM.js +13 -0
  350. package/dist/bin/shell/chunks/readlink-25V57VOL.js +3 -0
  351. package/dist/bin/shell/chunks/rev-PYHOZ4D4.js +3 -0
  352. package/dist/bin/shell/chunks/rg-BGFMSIVK.js +3 -0
  353. package/dist/bin/shell/chunks/rm-ECNUFR66.js +3 -0
  354. package/dist/bin/shell/chunks/rmdir-DLOHIA7Q.js +3 -0
  355. package/dist/bin/shell/chunks/sed-FWA634SN.js +3 -0
  356. package/dist/bin/shell/chunks/seq-UXDJE6FB.js +3 -0
  357. package/dist/bin/shell/chunks/sha1sum-4KF52U3Y.js +3 -0
  358. package/dist/bin/shell/chunks/sha256sum-6YEPULPX.js +3 -0
  359. package/dist/bin/shell/chunks/sleep-QHAPNY3Q.js +3 -0
  360. package/dist/bin/shell/chunks/sort-4C6WOKNK.js +3 -0
  361. package/dist/bin/shell/chunks/split-TV7NL7LA.js +3 -0
  362. package/dist/bin/shell/chunks/sqlite3-W777NCI4.js +3 -0
  363. package/dist/bin/shell/chunks/stat-BD6KT3BP.js +3 -0
  364. package/dist/bin/shell/chunks/strings-MDD72LR6.js +3 -0
  365. package/dist/bin/shell/chunks/tac-C2N4NQ6S.js +3 -0
  366. package/dist/bin/shell/chunks/tail-BCB5W6JC.js +3 -0
  367. package/dist/bin/shell/chunks/tar-DOO744MK.js +3 -0
  368. package/dist/bin/shell/chunks/tee-UQHPO4OW.js +3 -0
  369. package/dist/bin/shell/chunks/time-ZPY52VT2.js +3 -0
  370. package/dist/bin/shell/chunks/timeout-5AX3ZS3X.js +3 -0
  371. package/dist/bin/shell/chunks/touch-DFGSVIX7.js +3 -0
  372. package/dist/bin/shell/chunks/tr-G7K6M6HP.js +3 -0
  373. package/dist/bin/shell/chunks/tree-6D7SMPUR.js +3 -0
  374. package/dist/bin/shell/chunks/true-SKL4L7JP.js +3 -0
  375. package/dist/bin/shell/chunks/unexpand-QIR4EDPG.js +3 -0
  376. package/dist/bin/shell/chunks/uniq-I7PVFJR4.js +3 -0
  377. package/dist/bin/shell/chunks/wc-6NGWULAP.js +3 -0
  378. package/dist/bin/shell/chunks/which-LCXKCLFC.js +3 -0
  379. package/dist/bin/shell/chunks/whoami-TZDZDU7T.js +3 -0
  380. package/dist/bin/shell/chunks/xan-KX4VPXUN.js +3 -0
  381. package/dist/bin/shell/chunks/xan-view-JXOZLJ7S.js +3 -0
  382. package/dist/bin/shell/chunks/xargs-UWHPYLY7.js +3 -0
  383. package/dist/bin/shell/chunks/yq-GCDCJBKB.js +3 -0
  384. package/dist/bin/shell/shell.js +734 -0
  385. package/dist/browser.d.ts +23 -0
  386. package/dist/bundle/browser.js +1515 -0
  387. package/dist/bundle/chunks/alias-RTYYYW3D.js +2 -0
  388. package/dist/bundle/chunks/awk2-LA3USKJP.js +2 -0
  389. package/dist/bundle/chunks/base64-C2AIWVNC.js +2 -0
  390. package/dist/bundle/chunks/basename-UB3CIYNI.js +2 -0
  391. package/dist/bundle/chunks/bash-YZ33HQZQ.js +2 -0
  392. package/dist/bundle/chunks/cat-TSFMZVYS.js +2 -0
  393. package/dist/bundle/chunks/chmod-TFEPA42X.js +2 -0
  394. package/dist/bundle/chunks/chunk-27JIFWUR.js +3 -0
  395. package/dist/bundle/chunks/chunk-2JIPICV3.js +13 -0
  396. package/dist/bundle/chunks/chunk-2SMD2AUA.js +3 -0
  397. package/dist/bundle/chunks/chunk-2VDTE5BV.js +14 -0
  398. package/dist/bundle/chunks/chunk-2VJJEDV2.js +8 -0
  399. package/dist/bundle/chunks/chunk-46RN27KI.js +100 -0
  400. package/dist/bundle/chunks/chunk-4I3HOE5Z.js +21 -0
  401. package/dist/bundle/chunks/chunk-4JLVZKHC.js +8 -0
  402. package/dist/bundle/chunks/chunk-4MZPEZTU.js +3 -0
  403. package/dist/bundle/chunks/chunk-4N6J7B5P.js +6 -0
  404. package/dist/bundle/chunks/chunk-4RUAZWKT.js +33 -0
  405. package/dist/bundle/chunks/chunk-4WKZNNJK.js +2 -0
  406. package/dist/bundle/chunks/chunk-5H5SCKJM.js +11 -0
  407. package/dist/bundle/chunks/chunk-6LASZU3O.js +5 -0
  408. package/dist/bundle/chunks/chunk-6SHYIICL.js +4 -0
  409. package/dist/bundle/chunks/chunk-6VAT5Z2D.js +5 -0
  410. package/dist/bundle/chunks/chunk-7AISL3XV.js +12 -0
  411. package/dist/bundle/chunks/chunk-7EUWTCWK.js +2 -0
  412. package/dist/bundle/chunks/chunk-7JHM3L42.js +6 -0
  413. package/dist/bundle/chunks/chunk-A4R2GWRF.js +9 -0
  414. package/dist/bundle/chunks/chunk-ACSZB4FE.js +11 -0
  415. package/dist/bundle/chunks/chunk-AQ6FYS2X.js +2 -0
  416. package/dist/bundle/chunks/chunk-BVKWRAS6.js +12 -0
  417. package/dist/bundle/chunks/chunk-BZUGFHVS.js +2 -0
  418. package/dist/bundle/chunks/chunk-CBJVD2XA.js +7 -0
  419. package/dist/bundle/chunks/chunk-CHFEPBH4.js +18 -0
  420. package/dist/bundle/chunks/chunk-CN5XGDNN.js +6 -0
  421. package/dist/bundle/chunks/chunk-DLL7UR66.js +2 -0
  422. package/dist/bundle/chunks/chunk-EBAPSGAO.js +9 -0
  423. package/dist/bundle/chunks/chunk-FAXLQUCQ.js +10 -0
  424. package/dist/bundle/chunks/chunk-FHC24QSK.js +7 -0
  425. package/dist/bundle/chunks/chunk-FJK43EBQ.js +14 -0
  426. package/dist/bundle/chunks/chunk-FOCWZZDE.js +2 -0
  427. package/dist/bundle/chunks/chunk-FW54FHZR.js +2 -0
  428. package/dist/bundle/chunks/chunk-FX4RBUYU.js +5 -0
  429. package/dist/bundle/chunks/chunk-FX7KQCEA.js +33 -0
  430. package/dist/bundle/chunks/chunk-FZRQOL3C.js +7 -0
  431. package/dist/bundle/chunks/chunk-G5EVRAOO.js +74 -0
  432. package/dist/bundle/chunks/chunk-GGC5NEPZ.js +8 -0
  433. package/dist/bundle/chunks/chunk-GIUR5SNU.js +15 -0
  434. package/dist/bundle/chunks/chunk-GJC3WVOW.js +2 -0
  435. package/dist/bundle/chunks/chunk-GSPYNYZA.js +6 -0
  436. package/dist/bundle/chunks/chunk-GTQIUQM6.js +5 -0
  437. package/dist/bundle/chunks/chunk-HBVMHTO5.js +2 -0
  438. package/dist/bundle/chunks/chunk-HDRAUQK2.js +2 -0
  439. package/dist/bundle/chunks/chunk-HJBTD7PY.js +21 -0
  440. package/dist/bundle/chunks/chunk-ICIEVHY5.js +36 -0
  441. package/dist/bundle/chunks/chunk-KATRCGLX.js +2 -0
  442. package/dist/bundle/chunks/chunk-KD3KENL6.js +11 -0
  443. package/dist/bundle/chunks/chunk-KWGBQNTV.js +32 -0
  444. package/dist/bundle/chunks/chunk-L2UW7DWF.js +2 -0
  445. package/dist/bundle/chunks/chunk-L64BMZUV.js +2 -0
  446. package/dist/bundle/chunks/chunk-LEKBROJD.js +6 -0
  447. package/dist/bundle/chunks/chunk-LNBPBRV4.js +21 -0
  448. package/dist/bundle/chunks/chunk-LPJEKUCB.js +8 -0
  449. package/dist/bundle/chunks/chunk-LSLPJOYM.js +3 -0
  450. package/dist/bundle/chunks/chunk-MFDPAVC6.js +14 -0
  451. package/dist/bundle/chunks/chunk-MLIO3BK2.js +7 -0
  452. package/dist/bundle/chunks/chunk-MQKGGNPS.js +16 -0
  453. package/dist/bundle/chunks/chunk-MZFCCXPZ.js +63 -0
  454. package/dist/bundle/chunks/chunk-N6DXJ2JN.js +287 -0
  455. package/dist/bundle/chunks/chunk-NRSASXYY.js +2 -0
  456. package/dist/bundle/chunks/chunk-OC35HPHG.js +2 -0
  457. package/dist/bundle/chunks/chunk-OGJ5CFPR.js +9 -0
  458. package/dist/bundle/chunks/chunk-OVGANXCG.js +8 -0
  459. package/dist/bundle/chunks/chunk-Q7H5W7YE.js +140 -0
  460. package/dist/bundle/chunks/chunk-QAYAQNCG.js +23 -0
  461. package/dist/bundle/chunks/chunk-QIQMJJZ4.js +4 -0
  462. package/dist/bundle/chunks/chunk-R4IFXNY5.js +28 -0
  463. package/dist/bundle/chunks/chunk-R74UQCKX.js +5 -0
  464. package/dist/bundle/chunks/chunk-S3LEJEPP.js +2 -0
  465. package/dist/bundle/chunks/chunk-S443BAN4.js +7 -0
  466. package/dist/bundle/chunks/chunk-SAI2SPQQ.js +8 -0
  467. package/dist/bundle/chunks/chunk-SBBYKIYU.js +3 -0
  468. package/dist/bundle/chunks/chunk-SETW5JBN.js +9 -0
  469. package/dist/bundle/chunks/chunk-SHKOQWO4.js +3 -0
  470. package/dist/bundle/chunks/chunk-SJYEXC2Z.js +14 -0
  471. package/dist/bundle/chunks/chunk-SO6R3ZKN.js +16 -0
  472. package/dist/bundle/chunks/chunk-STHBFACM.js +1 -0
  473. package/dist/bundle/chunks/chunk-SX2HC7SO.js +2 -0
  474. package/dist/bundle/chunks/chunk-T4TFLF3R.js +16 -0
  475. package/dist/bundle/chunks/chunk-TDD4NFYE.js +2 -0
  476. package/dist/bundle/chunks/chunk-TN7HHBQW.js +5 -0
  477. package/dist/bundle/chunks/chunk-U73A73IE.js +17 -0
  478. package/dist/bundle/chunks/chunk-UIJUTQPH.js +3 -0
  479. package/dist/bundle/chunks/chunk-UP6MSJGD.js +17 -0
  480. package/dist/bundle/chunks/chunk-VLCHOJWK.js +6 -0
  481. package/dist/bundle/chunks/chunk-VPADYNBD.js +10 -0
  482. package/dist/bundle/chunks/chunk-W5DWRFSU.js +2 -0
  483. package/dist/bundle/chunks/chunk-WM5IJFMP.js +8 -0
  484. package/dist/bundle/chunks/chunk-WNH3HOQA.js +2 -0
  485. package/dist/bundle/chunks/chunk-WPGQVBSY.js +6 -0
  486. package/dist/bundle/chunks/chunk-WVRWIZF5.js +23 -0
  487. package/dist/bundle/chunks/chunk-XCQWV4AU.js +12 -0
  488. package/dist/bundle/chunks/chunk-XDGLKIHR.js +9 -0
  489. package/dist/bundle/chunks/chunk-XHLMAZX2.js +5 -0
  490. package/dist/bundle/chunks/chunk-XRFHFXFP.js +2 -0
  491. package/dist/bundle/chunks/chunk-XUIHBHL5.js +5 -0
  492. package/dist/bundle/chunks/chunk-XYXUMFSU.js +14 -0
  493. package/dist/bundle/chunks/chunk-Y4LIDHSD.js +7 -0
  494. package/dist/bundle/chunks/chunk-YCLFEX4T.js +3 -0
  495. package/dist/bundle/chunks/chunk-YS4NUBYX.js +9 -0
  496. package/dist/bundle/chunks/chunk-ZDIT6ST5.js +7 -0
  497. package/dist/bundle/chunks/chunk-ZDPFA4L3.js +6 -0
  498. package/dist/bundle/chunks/chunk-ZZKH2ELC.js +11 -0
  499. package/dist/bundle/chunks/clear-HKGFEOF6.js +2 -0
  500. package/dist/bundle/chunks/column-XT6UFXNQ.js +2 -0
  501. package/dist/bundle/chunks/comm-VV2LDX2J.js +2 -0
  502. package/dist/bundle/chunks/cp-BISAAS7A.js +2 -0
  503. package/dist/bundle/chunks/curl-GRYA74XW.js +26 -0
  504. package/dist/bundle/chunks/cut-OKARJCCV.js +2 -0
  505. package/dist/bundle/chunks/date-UUUPW43J.js +2 -0
  506. package/dist/bundle/chunks/diff-MWJFIG7X.js +2 -0
  507. package/dist/bundle/chunks/dirname-MPHRFUTI.js +2 -0
  508. package/dist/bundle/chunks/du-572XNP42.js +2 -0
  509. package/dist/bundle/chunks/echo-NDWZZHPO.js +2 -0
  510. package/dist/bundle/chunks/env-36M5BO7M.js +2 -0
  511. package/dist/bundle/chunks/expand-JSPG6VOP.js +2 -0
  512. package/dist/bundle/chunks/expansion-R25BK4W3.js +2 -0
  513. package/dist/bundle/chunks/expr-5JAACS4X.js +2 -0
  514. package/dist/bundle/chunks/file-IPZJC3FQ.js +2 -0
  515. package/dist/bundle/chunks/find-INTH3OLC.js +2 -0
  516. package/dist/bundle/chunks/flag-coverage-XWSYNE72.js +2 -0
  517. package/dist/bundle/chunks/fold-4TQNYMSW.js +2 -0
  518. package/dist/bundle/chunks/grep-V3LQVMRQ.js +2 -0
  519. package/dist/bundle/chunks/gzip-O5ASJAFY.js +2 -0
  520. package/dist/bundle/chunks/head-442HYESI.js +2 -0
  521. package/dist/bundle/chunks/help-HZ6M2CKN.js +2 -0
  522. package/dist/bundle/chunks/history-WYYKSLSZ.js +2 -0
  523. package/dist/bundle/chunks/hostname-C4HQXXUP.js +2 -0
  524. package/dist/bundle/chunks/html-to-markdown-JW4MSQZO.js +2 -0
  525. package/dist/bundle/chunks/join-TBRGI3LQ.js +2 -0
  526. package/dist/bundle/chunks/jq-4XLYLOS5.js +2 -0
  527. package/dist/bundle/chunks/js-exec-N5KEZBH7.js +97 -0
  528. package/dist/bundle/chunks/js-exec-worker.js +4443 -0
  529. package/dist/bundle/chunks/ln-4LGSXXGD.js +2 -0
  530. package/dist/bundle/chunks/ls-ZJGQER7M.js +2 -0
  531. package/dist/bundle/chunks/md5sum-SPU24VSG.js +2 -0
  532. package/dist/bundle/chunks/mkdir-MEPGZOB6.js +2 -0
  533. package/dist/bundle/chunks/mv-W5BIQ646.js +2 -0
  534. package/dist/bundle/chunks/nl-WSDW7I4O.js +2 -0
  535. package/dist/bundle/chunks/od-WOKFDJTP.js +2 -0
  536. package/dist/bundle/chunks/paste-7JC6S4DX.js +2 -0
  537. package/dist/bundle/chunks/printf-TWGXF445.js +2 -0
  538. package/dist/bundle/chunks/pwd-WE6EN5AV.js +2 -0
  539. package/dist/bundle/chunks/python3-POMOR4OA.js +12 -0
  540. package/dist/bundle/chunks/readlink-OPJF4DL5.js +2 -0
  541. package/dist/bundle/chunks/rev-5EHFX4EJ.js +2 -0
  542. package/dist/bundle/chunks/rg-S4FXYXWB.js +2 -0
  543. package/dist/bundle/chunks/rm-SSGETQVQ.js +2 -0
  544. package/dist/bundle/chunks/rmdir-OC4ZLPYA.js +2 -0
  545. package/dist/bundle/chunks/sed-S5UIK574.js +2 -0
  546. package/dist/bundle/chunks/seq-M5EC7Q57.js +2 -0
  547. package/dist/bundle/chunks/sha1sum-2PTOAFR6.js +2 -0
  548. package/dist/bundle/chunks/sha256sum-NS7D3IXX.js +2 -0
  549. package/dist/bundle/chunks/sleep-X22JJINO.js +2 -0
  550. package/dist/bundle/chunks/sort-SW2YEO5B.js +2 -0
  551. package/dist/bundle/chunks/split-4KKZZXXE.js +2 -0
  552. package/dist/bundle/chunks/sqlite3-CGOEFJAO.js +2 -0
  553. package/dist/bundle/chunks/sqlite3-worker.js +1728 -0
  554. package/dist/bundle/chunks/stat-CD34IZ4P.js +2 -0
  555. package/dist/bundle/chunks/strings-6WDHLGMX.js +2 -0
  556. package/dist/bundle/chunks/tac-2STMMJYW.js +2 -0
  557. package/dist/bundle/chunks/tail-R4PCA2C4.js +2 -0
  558. package/dist/bundle/chunks/tar-STHHZTZ6.js +2 -0
  559. package/dist/bundle/chunks/tee-YUZ2FKCJ.js +2 -0
  560. package/dist/bundle/chunks/time-D4LNBSWX.js +2 -0
  561. package/dist/bundle/chunks/timeout-YDCRSLPQ.js +2 -0
  562. package/dist/bundle/chunks/touch-UA33VN3N.js +2 -0
  563. package/dist/bundle/chunks/tr-36LHWFRQ.js +2 -0
  564. package/dist/bundle/chunks/tree-YLD52CNT.js +2 -0
  565. package/dist/bundle/chunks/true-FHQXJXBE.js +2 -0
  566. package/dist/bundle/chunks/unexpand-CADSA4VO.js +2 -0
  567. package/dist/bundle/chunks/uniq-XSIZR6PB.js +2 -0
  568. package/dist/bundle/chunks/wc-LF7NU4LA.js +2 -0
  569. package/dist/bundle/chunks/which-XEM24D5D.js +2 -0
  570. package/dist/bundle/chunks/whoami-XMTX52VE.js +2 -0
  571. package/dist/bundle/chunks/worker.js +3150 -0
  572. package/dist/bundle/chunks/xan-Y6WF3IRG.js +2 -0
  573. package/dist/bundle/chunks/xan-view-HDVKHFC2.js +2 -0
  574. package/dist/bundle/chunks/xargs-MGZPH7AX.js +2 -0
  575. package/dist/bundle/chunks/yq-4QJW3EQG.js +2 -0
  576. package/dist/bundle/index.cjs +2178 -0
  577. package/dist/bundle/index.js +710 -0
  578. package/dist/commands/alias/alias.d.ts +6 -0
  579. package/dist/commands/awk/ast.d.ts +202 -0
  580. package/dist/commands/awk/awk2.d.ts +9 -0
  581. package/dist/commands/awk/builtins.d.ts +17 -0
  582. package/dist/commands/awk/interpreter/context.d.ts +75 -0
  583. package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
  584. package/dist/commands/awk/interpreter/fields.d.ts +25 -0
  585. package/dist/commands/awk/interpreter/index.d.ts +8 -0
  586. package/dist/commands/awk/interpreter/interpreter.d.ts +54 -0
  587. package/dist/commands/awk/interpreter/statements.d.ts +11 -0
  588. package/dist/commands/awk/interpreter/type-coercion.d.ts +32 -0
  589. package/dist/commands/awk/interpreter/types.d.ts +13 -0
  590. package/dist/commands/awk/interpreter/variables.d.ts +35 -0
  591. package/dist/commands/awk/lexer.d.ts +100 -0
  592. package/dist/commands/awk/parser2-print.d.ts +35 -0
  593. package/dist/commands/awk/parser2.d.ts +81 -0
  594. package/dist/commands/base64/base64.d.ts +7 -0
  595. package/dist/commands/basename/basename.d.ts +4 -0
  596. package/dist/commands/bash/bash.d.ts +6 -0
  597. package/dist/commands/browser-excluded.d.ts +16 -0
  598. package/dist/commands/cat/cat.d.ts +4 -0
  599. package/dist/commands/chmod/chmod.d.ts +4 -0
  600. package/dist/commands/clear/clear.d.ts +4 -0
  601. package/dist/commands/column/column.d.ts +11 -0
  602. package/dist/commands/comm/comm.d.ts +12 -0
  603. package/dist/commands/cp/cp.d.ts +4 -0
  604. package/dist/commands/curl/curl.d.ts +8 -0
  605. package/dist/commands/curl/form.d.ts +21 -0
  606. package/dist/commands/curl/help.d.ts +9 -0
  607. package/dist/commands/curl/parse.d.ts +9 -0
  608. package/dist/commands/curl/response-formatting.d.ts +20 -0
  609. package/dist/commands/curl/types.d.ts +60 -0
  610. package/dist/commands/cut/cut.d.ts +4 -0
  611. package/dist/commands/date/date.d.ts +7 -0
  612. package/dist/commands/diff/diff.d.ts +7 -0
  613. package/dist/commands/dirname/dirname.d.ts +4 -0
  614. package/dist/commands/du/du.d.ts +4 -0
  615. package/dist/commands/duration.d.ts +5 -0
  616. package/dist/commands/echo/echo.d.ts +4 -0
  617. package/dist/commands/env/env.d.ts +6 -0
  618. package/dist/commands/expand/expand.d.ts +12 -0
  619. package/dist/commands/expand/unexpand.d.ts +12 -0
  620. package/dist/commands/expr/expr.d.ts +9 -0
  621. package/dist/commands/file/file.d.ts +9 -0
  622. package/dist/commands/find/find.d.ts +4 -0
  623. package/dist/commands/find/matcher.d.ts +69 -0
  624. package/dist/commands/find/parser.d.ts +2 -0
  625. package/dist/commands/find/types.d.ts +88 -0
  626. package/dist/commands/flag-coverage.d.ts +2 -0
  627. package/dist/commands/fold/fold.d.ts +12 -0
  628. package/dist/commands/format-mode.d.ts +4 -0
  629. package/dist/commands/fuzz-flags-types.d.ts +17 -0
  630. package/dist/commands/fuzz-flags.d.ts +8 -0
  631. package/dist/commands/grep/grep.d.ts +8 -0
  632. package/dist/commands/gzip/gzip.d.ts +13 -0
  633. package/dist/commands/head/head-tail-shared.d.ts +38 -0
  634. package/dist/commands/head/head.d.ts +4 -0
  635. package/dist/commands/help/help.d.ts +4 -0
  636. package/dist/commands/help.d.ts +16 -0
  637. package/dist/commands/history/history.d.ts +4 -0
  638. package/dist/commands/hostname/hostname.d.ts +11 -0
  639. package/dist/commands/html-to-markdown/html-to-markdown.d.ts +9 -0
  640. package/dist/commands/join/join.d.ts +12 -0
  641. package/dist/commands/jq/jq.d.ts +9 -0
  642. package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
  643. package/dist/commands/js-exec/js-exec-worker.d.ts +32 -0
  644. package/dist/commands/js-exec/js-exec.d.ts +11 -0
  645. package/dist/commands/js-exec/module-shims.d.ts +29 -0
  646. package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
  647. package/dist/commands/ln/ln.d.ts +4 -0
  648. package/dist/commands/ls/ls.d.ts +4 -0
  649. package/dist/commands/md5sum/checksum.d.ts +7 -0
  650. package/dist/commands/md5sum/md5sum.d.ts +4 -0
  651. package/dist/commands/md5sum/sha1sum.d.ts +4 -0
  652. package/dist/commands/md5sum/sha256sum.d.ts +4 -0
  653. package/dist/commands/mkdir/mkdir.d.ts +4 -0
  654. package/dist/commands/mv/mv.d.ts +4 -0
  655. package/dist/commands/nl/nl.d.ts +12 -0
  656. package/dist/commands/od/od.d.ts +12 -0
  657. package/dist/commands/paste/paste.d.ts +4 -0
  658. package/dist/commands/printf/escapes.d.ts +25 -0
  659. package/dist/commands/printf/printf.d.ts +4 -0
  660. package/dist/commands/printf/strftime.d.ts +9 -0
  661. package/dist/commands/pwd/pwd.d.ts +4 -0
  662. package/dist/commands/python3/python3.d.ts +16 -0
  663. package/dist/commands/python3/worker.d.ts +28 -0
  664. package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
  665. package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
  666. package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
  667. package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
  668. package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
  669. package/dist/commands/query-engine/builtins/index.d.ts +17 -0
  670. package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
  671. package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
  672. package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
  673. package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
  674. package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
  675. package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
  676. package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
  677. package/dist/commands/query-engine/evaluator.d.ts +40 -0
  678. package/dist/commands/query-engine/index.d.ts +8 -0
  679. package/dist/commands/query-engine/parser-types.d.ts +171 -0
  680. package/dist/commands/query-engine/parser.d.ts +9 -0
  681. package/dist/commands/query-engine/path-operations.d.ts +15 -0
  682. package/dist/commands/query-engine/safe-object.d.ts +83 -0
  683. package/dist/commands/query-engine/value-operations.d.ts +41 -0
  684. package/dist/commands/readlink/readlink.d.ts +4 -0
  685. package/dist/commands/registry.d.ts +56 -0
  686. package/dist/commands/rev/rev.d.ts +13 -0
  687. package/dist/commands/rg/file-types.d.ts +49 -0
  688. package/dist/commands/rg/gitignore.d.ts +98 -0
  689. package/dist/commands/rg/rg-options.d.ts +61 -0
  690. package/dist/commands/rg/rg-parser.d.ts +20 -0
  691. package/dist/commands/rg/rg-search.d.ts +15 -0
  692. package/dist/commands/rg/rg.d.ts +14 -0
  693. package/dist/commands/rm/rm.d.ts +4 -0
  694. package/dist/commands/rmdir/rmdir.d.ts +4 -0
  695. package/dist/commands/search-engine/index.d.ts +10 -0
  696. package/dist/commands/search-engine/matcher.d.ts +66 -0
  697. package/dist/commands/search-engine/regex.d.ts +46 -0
  698. package/dist/commands/sed/executor.d.ts +7 -0
  699. package/dist/commands/sed/lexer.d.ts +86 -0
  700. package/dist/commands/sed/parser.d.ts +18 -0
  701. package/dist/commands/sed/sed-regex.d.ts +23 -0
  702. package/dist/commands/sed/sed.d.ts +4 -0
  703. package/dist/commands/sed/types.d.ts +216 -0
  704. package/dist/commands/seq/seq.d.ts +16 -0
  705. package/dist/commands/sleep/sleep.d.ts +4 -0
  706. package/dist/commands/sort/comparator.d.ts +9 -0
  707. package/dist/commands/sort/parser.d.ts +11 -0
  708. package/dist/commands/sort/sort.d.ts +4 -0
  709. package/dist/commands/sort/types.d.ts +30 -0
  710. package/dist/commands/split/split.d.ts +12 -0
  711. package/dist/commands/sqlite3/formatters.d.ts +15 -0
  712. package/dist/commands/sqlite3/sqlite3.d.ts +23 -0
  713. package/dist/commands/sqlite3/worker.d.ts +45 -0
  714. package/dist/commands/sqlite3/worker.js +1728 -0
  715. package/dist/commands/stat/stat.d.ts +4 -0
  716. package/dist/commands/strings/strings.d.ts +12 -0
  717. package/dist/commands/tac/tac.d.ts +11 -0
  718. package/dist/commands/tail/tail.d.ts +4 -0
  719. package/dist/commands/tar/archive.d.ts +135 -0
  720. package/dist/commands/tar/bzip2-compress.d.ts +17 -0
  721. package/dist/commands/tar/tar-options.d.ts +37 -0
  722. package/dist/commands/tar/tar.d.ts +10 -0
  723. package/dist/commands/tee/tee.d.ts +4 -0
  724. package/dist/commands/time/time.d.ts +27 -0
  725. package/dist/commands/timeout/timeout.d.ts +4 -0
  726. package/dist/commands/touch/touch.d.ts +4 -0
  727. package/dist/commands/tr/tr.d.ts +4 -0
  728. package/dist/commands/tree/tree.d.ts +4 -0
  729. package/dist/commands/true/true.d.ts +6 -0
  730. package/dist/commands/uniq/uniq.d.ts +4 -0
  731. package/dist/commands/wc/wc.d.ts +4 -0
  732. package/dist/commands/which/which.d.ts +4 -0
  733. package/dist/commands/whoami/whoami.d.ts +11 -0
  734. package/dist/commands/worker-bridge/bridge-handler.d.ts +73 -0
  735. package/dist/commands/worker-bridge/protocol.d.ts +141 -0
  736. package/dist/commands/worker-bridge/sync-backend.d.ts +86 -0
  737. package/dist/commands/xan/aggregation.d.ts +20 -0
  738. package/dist/commands/xan/column-selection.d.ts +19 -0
  739. package/dist/commands/xan/csv.d.ts +37 -0
  740. package/dist/commands/xan/moonblade-parser.d.ts +80 -0
  741. package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
  742. package/dist/commands/xan/moonblade-tokenizer.d.ts +25 -0
  743. package/dist/commands/xan/subcommands.d.ts +15 -0
  744. package/dist/commands/xan/xan-agg.d.ts +8 -0
  745. package/dist/commands/xan/xan-columns.d.ts +8 -0
  746. package/dist/commands/xan/xan-core.d.ts +10 -0
  747. package/dist/commands/xan/xan-data.d.ts +52 -0
  748. package/dist/commands/xan/xan-filter.d.ts +8 -0
  749. package/dist/commands/xan/xan-map.d.ts +11 -0
  750. package/dist/commands/xan/xan-reshape.d.ts +40 -0
  751. package/dist/commands/xan/xan-simple.d.ts +40 -0
  752. package/dist/commands/xan/xan-view.d.ts +12 -0
  753. package/dist/commands/xan/xan.d.ts +10 -0
  754. package/dist/commands/xargs/xargs.d.ts +4 -0
  755. package/dist/commands/yq/formats.d.ts +64 -0
  756. package/dist/commands/yq/yq.d.ts +13 -0
  757. package/dist/custom-commands.d.ts +42 -0
  758. package/dist/encoding.d.ts +115 -0
  759. package/dist/fs/encoding.d.ts +17 -0
  760. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +75 -0
  761. package/dist/fs/in-memory-fs/index.d.ts +1 -0
  762. package/dist/fs/init.d.ts +22 -0
  763. package/dist/fs/interface.d.ts +251 -0
  764. package/dist/fs/mountable-fs/index.d.ts +1 -0
  765. package/dist/fs/mountable-fs/mountable-fs.d.ts +118 -0
  766. package/dist/fs/overlay-fs/index.d.ts +1 -0
  767. package/dist/fs/overlay-fs/overlay-fs.d.ts +165 -0
  768. package/dist/fs/path-utils.d.ts +46 -0
  769. package/dist/fs/read-write-fs/index.d.ts +1 -0
  770. package/dist/fs/read-write-fs/read-write-fs.d.ts +98 -0
  771. package/dist/fs/real-fs-utils.d.ts +90 -0
  772. package/dist/fs/sanitize-error.d.ts +19 -0
  773. package/dist/index.d.cts +29 -0
  774. package/dist/index.d.ts +29 -0
  775. package/dist/interpreter/alias-expansion.d.ts +23 -0
  776. package/dist/interpreter/arithmetic.d.ts +24 -0
  777. package/dist/interpreter/assignment-expansion.d.ts +24 -0
  778. package/dist/interpreter/builtin-dispatch.d.ts +39 -0
  779. package/dist/interpreter/builtins/break.d.ts +6 -0
  780. package/dist/interpreter/builtins/cd.d.ts +6 -0
  781. package/dist/interpreter/builtins/compgen.d.ts +26 -0
  782. package/dist/interpreter/builtins/complete.d.ts +17 -0
  783. package/dist/interpreter/builtins/compopt.d.ts +28 -0
  784. package/dist/interpreter/builtins/continue.d.ts +6 -0
  785. package/dist/interpreter/builtins/declare-array-parsing.d.ts +14 -0
  786. package/dist/interpreter/builtins/declare-print.d.ts +39 -0
  787. package/dist/interpreter/builtins/declare.d.ts +35 -0
  788. package/dist/interpreter/builtins/dirs.d.ts +29 -0
  789. package/dist/interpreter/builtins/eval.d.ts +9 -0
  790. package/dist/interpreter/builtins/exit.d.ts +5 -0
  791. package/dist/interpreter/builtins/export.d.ts +14 -0
  792. package/dist/interpreter/builtins/getopts.d.ts +18 -0
  793. package/dist/interpreter/builtins/hash.d.ts +19 -0
  794. package/dist/interpreter/builtins/help.d.ts +12 -0
  795. package/dist/interpreter/builtins/index.d.ts +45 -0
  796. package/dist/interpreter/builtins/let.d.ts +18 -0
  797. package/dist/interpreter/builtins/local.d.ts +6 -0
  798. package/dist/interpreter/builtins/mapfile.d.ts +17 -0
  799. package/dist/interpreter/builtins/read.d.ts +6 -0
  800. package/dist/interpreter/builtins/return.d.ts +6 -0
  801. package/dist/interpreter/builtins/set.d.ts +9 -0
  802. package/dist/interpreter/builtins/shift.d.ts +15 -0
  803. package/dist/interpreter/builtins/shopt.d.ts +7 -0
  804. package/dist/interpreter/builtins/source.d.ts +6 -0
  805. package/dist/interpreter/builtins/unset.d.ts +16 -0
  806. package/dist/interpreter/builtins/variable-assignment.d.ts +66 -0
  807. package/dist/interpreter/command-resolution.d.ts +43 -0
  808. package/dist/interpreter/conditionals.d.ts +17 -0
  809. package/dist/interpreter/control-flow.d.ts +21 -0
  810. package/dist/interpreter/defense-aware-command-context.d.ts +6 -0
  811. package/dist/interpreter/errors.d.ts +158 -0
  812. package/dist/interpreter/expansion/analysis.d.ts +37 -0
  813. package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
  814. package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
  815. package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
  816. package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
  817. package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
  818. package/dist/interpreter/expansion/brace-range.d.ts +20 -0
  819. package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
  820. package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
  821. package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
  822. package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
  823. package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
  824. package/dist/interpreter/expansion/pattern-removal.d.ts +18 -0
  825. package/dist/interpreter/expansion/pattern.d.ts +23 -0
  826. package/dist/interpreter/expansion/positional-params.d.ts +59 -0
  827. package/dist/interpreter/expansion/prompt.d.ts +39 -0
  828. package/dist/interpreter/expansion/quoting.d.ts +13 -0
  829. package/dist/interpreter/expansion/tilde.d.ts +12 -0
  830. package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
  831. package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
  832. package/dist/interpreter/expansion/variable.d.ts +36 -0
  833. package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
  834. package/dist/interpreter/expansion/word-split.d.ts +29 -0
  835. package/dist/interpreter/expansion.d.ts +53 -0
  836. package/dist/interpreter/functions.d.ts +12 -0
  837. package/dist/interpreter/helpers/array.d.ts +43 -0
  838. package/dist/interpreter/helpers/condition.d.ts +22 -0
  839. package/dist/interpreter/helpers/errors.d.ts +8 -0
  840. package/dist/interpreter/helpers/file-tests.d.ts +33 -0
  841. package/dist/interpreter/helpers/ifs.d.ts +104 -0
  842. package/dist/interpreter/helpers/loop.d.ts +24 -0
  843. package/dist/interpreter/helpers/nameref.d.ts +65 -0
  844. package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
  845. package/dist/interpreter/helpers/quoting.d.ts +24 -0
  846. package/dist/interpreter/helpers/readonly.d.ts +45 -0
  847. package/dist/interpreter/helpers/regex.d.ts +8 -0
  848. package/dist/interpreter/helpers/result.d.ts +60 -0
  849. package/dist/interpreter/helpers/shell-constants.d.ts +25 -0
  850. package/dist/interpreter/helpers/shellopts.d.ts +28 -0
  851. package/dist/interpreter/helpers/statements.d.ts +20 -0
  852. package/dist/interpreter/helpers/string-compare.d.ts +24 -0
  853. package/dist/interpreter/helpers/string-tests.d.ts +13 -0
  854. package/dist/interpreter/helpers/tilde.d.ts +13 -0
  855. package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
  856. package/dist/interpreter/helpers/word-matching.d.ts +26 -0
  857. package/dist/interpreter/helpers/word-parts.d.ts +22 -0
  858. package/dist/interpreter/helpers/xtrace.d.ts +18 -0
  859. package/dist/interpreter/index.d.ts +3 -0
  860. package/dist/interpreter/interpreter.d.ts +79 -0
  861. package/dist/interpreter/pipeline-execution.d.ts +16 -0
  862. package/dist/interpreter/redirections.d.ts +51 -0
  863. package/dist/interpreter/simple-command-assignments.d.ts +29 -0
  864. package/dist/interpreter/subshell-group.d.ts +32 -0
  865. package/dist/interpreter/type-command.d.ts +37 -0
  866. package/dist/interpreter/types.d.ts +349 -0
  867. package/dist/limits.d.ts +52 -0
  868. package/dist/network/allow-list/shared.d.ts +57 -0
  869. package/dist/network/allow-list.d.ts +59 -0
  870. package/dist/network/dns-pin.d.ts +43 -0
  871. package/dist/network/fetch.d.ts +25 -0
  872. package/dist/network/index.d.ts +7 -0
  873. package/dist/network/types.d.ts +155 -0
  874. package/dist/parser/arithmetic-parser.d.ts +23 -0
  875. package/dist/parser/arithmetic-primaries.d.ts +45 -0
  876. package/dist/parser/command-parser.d.ts +10 -0
  877. package/dist/parser/compound-parser.d.ts +28 -0
  878. package/dist/parser/conditional-parser.d.ts +8 -0
  879. package/dist/parser/expansion-parser.d.ts +16 -0
  880. package/dist/parser/lexer.d.ts +197 -0
  881. package/dist/parser/parser-substitution.d.ts +62 -0
  882. package/dist/parser/parser.d.ts +135 -0
  883. package/dist/parser/types.d.ts +25 -0
  884. package/dist/parser/word-parser.d.ts +33 -0
  885. package/dist/sandbox/Command.d.ts +35 -0
  886. package/dist/sandbox/Sandbox.d.ts +90 -0
  887. package/dist/sandbox/index.d.ts +2 -0
  888. package/dist/shell-metadata.d.ts +25 -0
  889. package/dist/timers.d.ts +4 -0
  890. package/dist/types.d.ts +247 -0
  891. package/dist/utils/args.d.ts +55 -0
  892. package/dist/utils/constants.d.ts +15 -0
  893. package/dist/utils/file-reader.d.ts +74 -0
  894. package/dist/utils/glob.d.ts +25 -0
  895. package/dist/vitest-setup.d.ts +1 -0
  896. package/package.json +127 -0
  897. package/vendor/cpython-emscripten/python.cjs +2 -0
  898. package/vendor/cpython-emscripten/python.wasm +0 -0
  899. package/vendor/cpython-emscripten/python313.zip +0 -0
@@ -0,0 +1,1515 @@
1
+ var H7=Object.create;var Ga=Object.defineProperty;var j7=Object.getOwnPropertyDescriptor;var G7=Object.getOwnPropertyNames;var V7=Object.getPrototypeOf,q7=Object.prototype.hasOwnProperty;var Yn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var Li=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ee=(e,t)=>{for(var n in t)Ga(e,n,{get:t[n],enumerable:!0})},Z7=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of G7(t))!q7.call(e,s)&&s!==n&&Ga(e,s,{get:()=>t[s],enumerable:!(r=j7(t,s))||r.enumerable});return e};var Pf=(e,t,n)=>(n=e!=null?H7(V7(e)):{},Z7(t||!e||!e.__esModule?Ga(n,"default",{value:e,enumerable:!0}):n,e));function Df(){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","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"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&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 t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==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 t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==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{}return e.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}})}var _f=v(()=>{"use strict"});function Ff(){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 X7(e,t,...n){return Ue.run(e,()=>t(...n))}function Y7(e){return e===void 0?{...Va,enabled:!1}:typeof e=="boolean"?{...Va,enabled:e}:{...Va,...e}}var ar,qa,K7,de,Ue,Q7,Va,Et,un=v(()=>{"use strict";_f();ar=!0;qa=null;if(!ar)try{let{AsyncLocalStorage:e}=Yn("node:async_hooks");qa=e}catch{}K7=`
2
+
3
+ This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,de=class extends Error{violation;constructor(t,n){super(t+K7),this.violation=n,this.name="SecurityViolationError"}},Ue=!ar&&qa?new qa:null,Q7=1e3;Va={enabled:!0,auditMode:!1};Et=class e{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){let n=Y7(t);if(!e.instance)e.instance=new e(n);else{let r=e.instance.config;if(n.enabled!==r.enabled||n.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${n.enabled}, auditMode: ${n.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return e.instance}static resetInstance(){e.instance&&(e.instance.forceDeactivate(),e.instance=null),e.trustedExecutionDepth.clear()}static isInSandboxedContext(){return Ue?Ue?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(Ue)return Ue?.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}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}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let t of this.activeExecutionIds)return t}static bindCurrentContext(t){if(!Ue)return t;let n=e.instance,r=Ue.getStore(),s=r?.sandboxActive===!0?r.executionId:n?.getPreferredActiveExecutionId();if(!s)return t;let i=n?.getCachedContext(s)??{sandboxActive:!0,executionId:s};return((...o)=>{let a=e.instance;if(!(a&&!a.isExecutionIdActive(s)&&(a.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!a.config.auditMode)))return X7(i,t,...o)})}isEnabled(){return this.config.enabled===!0&&Ue!==null&&!ar}updateConfig(t){this.config={...this.config,...t}}activate(){if(ar||!this.config.enabled||!Ue){let r=Ff(),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}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let t=Ff(),n=!1;return{run:r=>n?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(t),Ue.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(!Ue)return t();let n=Ue.getStore();if(!n)return t();let{executionId:r}=n;return Ue.run({...n,trusted:!0},()=>{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(!Ue)return t();let n=Ue.getStore();if(!n)return t();let{executionId:r}=n;return Ue.run({...n,trusted:!0},async()=>{e.enterTrustedScope(r);try{return await t()}finally{e.leaveTrustedScope(r)}})}shouldBlock(){if(ar||this.config.auditMode||!Ue)return!1;let t=Ue?.getStore();return!(t?.sandboxActive!==!0||t.trusted||e.isTrustedScopeActive(t.executionId))}recordViolation(t,n,r){let s={timestamp:Date.now(),type:t,message:r,path:n,stack:new Error().stack,executionId:Ue?.getStore()?.executionId};if(this.violations.length<Q7&&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 de(l,c)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&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 de(l,c)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&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 de(u,f)}if(i.config.auditMode&&Ue?.getStore()?.sandboxActive===!0){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`,p=i.recordViolation(r,u,f);throw new de(f,p)}return 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 de(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 de(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 de(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 de(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 de(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 de(u,f)}return Reflect.defineProperty(o,a,l)}})}applyPatches(){this.patchFailures=[];let t=Df(),n=new Set(["process_send","process_channel","process_stdout","process_stderr"]);for(let i of t)n.has(i.violationType)||this.applyPatch(i);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.lockWellKnownSymbols(),this.protectProxyRevocable();let r=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(i=>r.includes(i));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let 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 de(i,o)}t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&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 Ue.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(!Ue)return Reflect.apply(s,this,[a,l]);let c=Ue.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),p=(h,d)=>typeof h!="function"?h:i.bind({box:t,executionId:u,captured:f,cb:h,kind:d});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 de(a,l)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&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 de(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 de(s,i)}return t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&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 de(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 de(s,i)}return t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&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 de(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);try{let n=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");this.originalDescriptors.push({target:Error,prop:"stackTraceLimit",descriptor:n}),Object.defineProperty(Error,"stackTraceLimit",{value:Error.stackTraceLimit,writable:!1,configurable:!0})}catch{}}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 de(a,l)}return t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&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(!(ar||e.importHooksRegistered))try{let t=this,n=Yn("node:module"),r=new Set;for(let o of n.builtinModules??[]){let a=o.startsWith("node:")?o.slice(5):o;r.add(a);let l=a.indexOf("/");l>0&&r.add(a.slice(0,l))}let s=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let a=o.startsWith("node:")?o.slice(5):o;if(!a)return!1;if(typeof n.isBuiltin=="function"&&n.isBuiltin(a)||r.has(a))return!0;let l=a.indexOf("/");return l>0&&r.has(a.slice(0,l))},i=()=>{let o=Ue?.getStore();return t.config.auditMode===!0&&o?.sandboxActive===!0&&o.trusted!==!0&&!e.isTrustedScopeActive(o.executionId)};if(typeof n.registerHooks=="function"){n.registerHooks({resolve(o,a,l){if(o.startsWith("data:")||o.startsWith("blob:"))throw new Error(`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);if(s(o)){let c=`import(${o})`,u=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(t.shouldBlock()){let f=t.recordViolation("dynamic_import_builtin",c,u);throw new de(u,f)}i()&&t.recordViolation("dynamic_import_builtin",c,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return l(o,a)}}),e.importHooksRegistered=!0;return}if(typeof n.register=="function"){let o=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(`
4
+ `);n.register(`data:text/javascript,${encodeURIComponent(o)}`),e.importHooksRegistered=!0}}catch(t){console.debug("[DefenseInDepthBox] Could not register import() hooks:",t instanceof Error?t.message:t)}}protectModuleLoad(){if(!ar)try{let t=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(t=o.constructor)}if(!t&&typeof Yn<"u"&&typeof Yn.main<"u"&&(t=Yn.main.constructor),!t||typeof t._load!="function")return;let n=t._load,r=Object.getOwnPropertyDescriptor(t,"_load");this.originalDescriptors.push({target:t,prop:"_load",descriptor:r});let i=this.createBlockingProxy(n,"Module._load","module_load");Object.defineProperty(t,"_load",{value:i,writable:!0,configurable:!0})}catch(t){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",t instanceof Error?t.message:t)}}protectModuleResolveFilename(){if(!ar)try{let t=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(t=o.constructor)}if(!t&&typeof Yn<"u"&&typeof Yn.main<"u"&&(t=Yn.main.constructor),!t||typeof t._resolveFilename!="function")return;let n=t._resolveFilename,r=Object.getOwnPropertyDescriptor(t,"_resolveFilename");this.originalDescriptors.push({target:t,prop:"_resolveFilename",descriptor:r});let i=this.createBlockingProxy(n,"Module._resolveFilename","module_resolve_filename");Object.defineProperty(t,"_resolveFilename",{value:i,writable:!0,configurable:!0})}catch(t){this.patchFailures.push("Module._resolveFilename"),console.debug("[DefenseInDepthBox] Could not protect Module._resolveFilename:",t instanceof Error?t.message:t)}}applyPatch(t){let{target:n,prop:r,violationType:s,strategy:i}=t;try{let o=n[r];if(o===void 0)return;let a=Object.getOwnPropertyDescriptor(n,r);if(this.originalDescriptors.push({target:n,prop:r,descriptor:a}),i==="freeze")typeof o=="object"&&o!==null&&Object.freeze(o);else{let l=this.getPathForTarget(n,r),c=typeof o=="function"?this.createBlockingProxy(o,l,s):this.createBlockingObjectProxy(o,l,s,t.allowedKeys);Object.defineProperty(n,r,{value:c,writable:!0,configurable:!0})}}catch(o){let a=this.getPathForTarget(n,r);this.patchFailures.push(a),console.debug(`[DefenseInDepthBox] Could not patch ${a}:`,o instanceof Error?o.message:o)}}restorePatches(){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 t4(e){return typeof e!="function"?e:Et.bindCurrentContext(e)}var J7,e4,rk,sk,Ir,ns,Zs=v(()=>{"use strict";un();J7=globalThis.setTimeout.bind(globalThis),e4=globalThis.clearTimeout.bind(globalThis),rk=globalThis.setInterval.bind(globalThis),sk=globalThis.clearInterval.bind(globalThis);Ir=((e,t,...n)=>J7(t4(e),t,...n)),ns=e4});var Lf={};ee(Lf,{echoCommand:()=>r4,flagsForFuzzing:()=>s4});function n4(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+=`
5
+ `,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 r4,s4,Mf=v(()=>{"use strict";r4={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=n4(i);if(i=o.output,o.stop)return{stdout:i,stderr:"",exitCode:0}}return n||(i+=`
6
+ `),{stdout:i,stderr:"",exitCode:0}}},s4={name:"echo",flags:[{flag:"-n",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-E",type:"boolean"}],stdinType:"none",needsArgs:!0}});function ae(e){let t=e;if(!t)return t;let n=!1;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);if(i>255)return t;i>127&&(n=!0)}if(!n)return t;let r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);try{return i4.decode(r)}catch{return t}}function Dn(e){if(!e)return e;let t=o4.encode(e),n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return n}function a4(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}async function _n(e,t){return typeof e.readFileBytes=="function"?e.readFileBytes(t):a4(await e.readFileBuffer(t))}function l4(e){return e.stdoutKind?e.stdoutKind:e.stdoutEncoding==="binary"?"bytes":"text"}function Za(e){return l4(e)==="bytes"?e.stdout:Dn(e.stdout)}var i4,o4,Uf,ge=v(()=>{"use strict";i4=new TextDecoder("utf-8",{fatal:!0}),o4=new TextEncoder;Uf=""});function M(e){let t=`${e.name} - ${e.summary}
7
+
8
+ `;if(t+=`Usage: ${e.usage}
9
+ `,e.description){if(t+=`
10
+ Description:
11
+ `,typeof e.description=="string")for(let n of e.description.split(`
12
+ `))t+=n?` ${n}
13
+ `:`
14
+ `;else if(e.description.length>0)for(let n of e.description)t+=n?` ${n}
15
+ `:`
16
+ `}if(e.options&&e.options.length>0){t+=`
17
+ Options:
18
+ `;for(let n of e.options)t+=` ${n}
19
+ `}if(e.examples&&e.examples.length>0){t+=`
20
+ Examples:
21
+ `;for(let n of e.examples)t+=` ${n}
22
+ `}if(e.notes&&e.notes.length>0){t+=`
23
+ Notes:
24
+ `;for(let n of e.notes)t+=` ${n}
25
+ `}return{stdout:t,stderr:"",exitCode:0}}function U(e){return e.includes("--help")}function K(e,t){return{stdout:"",stderr:t.startsWith("--")?`${e}: unrecognized option '${t}'
26
+ `:`${e}: invalid option -- '${t.replace(/^-/,"")}'
27
+ `,exitCode:1}}var ie=v(()=>{"use strict"});function Se(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,p;u!==-1?(f=c.slice(2,u),p=c.slice(u+1)):f=c.slice(2);let h=s.get(f);if(!h)return{ok:!1,error:K(e,c)};let{name:d,type:m}=h;if(m==="boolean")i[d]=!0;else{if(p===void 0){if(l+1>=t.length)return{ok:!1,error:{stdout:"",stderr:`${e}: option '--${f}' requires an argument
28
+ `,exitCode:1}};p=t[++l]}i[d]=m==="number"?parseInt(p,10):p}}else{let u=c.slice(1);for(let f=0;f<u.length;f++){let p=u[f],h=r.get(p);if(!h)return{ok:!1,error:K(e,`-${p}`)};let{name:d,type:m}=h;if(m==="boolean")i[d]=!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 -- '${p}'
29
+ `,exitCode:1}};i[d]=m==="number"?parseInt(g,10):g;break}}}}return{ok:!0,result:{flags:i,positional:o}}}var at=v(()=>{"use strict";ie()});var rs=v(()=>{"use strict"});async function $r(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),p=await Promise.all(f.map(async h=>{if(s&&h==="-")return{filename:"-",content:e.stdin,error:null};try{let d=e.fs.resolvePath(e.cwd,h),m=await _n(e.fs,d);return{filename:h,content:m,error:null}}catch{return{filename:h,content:Uf,error:`${r}: ${h}: No such file or directory
30
+ `}}}));for(let h of p)if(h.error){if(l+=h.error,c=1,i)return{files:a,stderr:l,exitCode:c}}else a.push({filename:h.filename,content:h.content})}return{files:a,stderr:l,exitCode:c}}async function ss(e,t,n){let r=await $r(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 Or=v(()=>{"use strict";ge();rs()});var Bf={};ee(Bf,{catCommand:()=>f4,flagsForFuzzing:()=>h4});function p4(e,t){let n=e.split(`
31
+ `),r=e.endsWith(`
32
+ `),s=r?n.slice(0,-1):n;return{content:s.map((o,a)=>`${String(t+a).padStart(6," ")} ${o}`).join(`
33
+ `)+(r?`
34
+ `:""),nextLineNumber:t+s.length}}var c4,u4,f4,h4,Wf=v(()=>{"use strict";ge();at();Or();ie();c4={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},u4={number:{short:"n",long:"number",type:"boolean"}},f4={name:"cat",async execute(e,t){if(U(e))return M(c4);let n=Se("cat",e,u4);if(!n.ok)return n.error;let r=n.result.flags.number,s=n.result.positional,i=await $r(t,s,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),o="",a=1;for(let{content:l}of i.files){let c=l;if(r){let u=p4(c,a);o+=u.content,a=u.nextLineNumber}else o+=c}return{stdout:o,stderr:i.stderr,exitCode:i.exitCode,stdoutEncoding:"binary"}}};h4={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 Mi(e){return e instanceof It||e instanceof $t||e instanceof St}var Nt,It,$t,St,Ht,Rt,we,Le,Pt,Fn,is,X,os,Ln,nn,Ae=v(()=>{"use strict";Nt=class extends Error{stdout;stderr;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}},It=class extends Nt{levels;name="BreakError";constructor(t=1,n="",r=""){super("break",n,r),this.levels=t}},$t=class extends Nt{levels;name="ContinueError";constructor(t=1,n="",r=""){super("continue",n,r),this.levels=t}},St=class extends Nt{exitCode;name="ReturnError";constructor(t=0,n="",r=""){super("return",n,r),this.exitCode=t}},Ht=class extends Nt{exitCode;name="ErrexitError";constructor(t,n="",r=""){super(`errexit: command exited with status ${t}`,n,r),this.exitCode=t}},Rt=class extends Nt{varName;name="NounsetError";constructor(t,n=""){super(`${t}: unbound variable`,n,`bash: ${t}: unbound variable
35
+ `),this.varName=t}},we=class extends Nt{exitCode;name="ExitError";constructor(t,n="",r=""){super("exit",n,r),this.exitCode=t}},Le=class extends Nt{name="ArithmeticError";fatal;constructor(t,n="",r="",s=!1){super(t,n,r),this.stderr=r||`bash: ${t}
36
+ `,this.fatal=s}},Pt=class extends Nt{name="BadSubstitutionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}: bad substitution
37
+ `}},Fn=class extends Nt{name="GlobError";constructor(t,n="",r=""){super(`no match: ${t}`,n,r),this.stderr=r||`bash: no match: ${t}
38
+ `}},is=class extends Nt{name="BraceExpansionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}
39
+ `}},X=class extends Nt{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(t,n,r="",s=""){super(t,r,s),this.limitType=n,this.stderr=s||`bash: ${t}
40
+ `}},os=class extends Nt{name="ExecutionAbortedError";constructor(t="",n=""){super("execution aborted",t,n)}},Ln=class extends Nt{name="SubshellExitError";constructor(t="",n=""){super("subshell exit",t,n)}};nn=class extends Nt{exitCode;name="PosixFatalError";constructor(t,n="",r=""){super("posix fatal error",n,r),this.exitCode=t}}});function Xe(e){return e instanceof Error?e.message:String(e)}var rn=v(()=>{"use strict"});function Ui(e,t,n){let r=e;n>=0&&r.length>n&&(r=r.slice(0,n));let s=Math.abs(t);return s>r.length&&(t<0?r=r.padEnd(s," "):r=r.padStart(s," ")),r}function zf(e,t){let n=t,r=0,s=-1,i=!1;for(n<e.length&&e[n]==="-"&&(i=!0,n++);n<e.length&&/\d/.test(e[n]);)r=r*10+parseInt(e[n],10),n++;if(n<e.length&&e[n]===".")for(n++,s=0;n<e.length&&/\d/.test(e[n]);)s=s*10+parseInt(e[n],10),n++;return i&&r>0&&(r=-r),[r,s,n-t]}function Bi(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)switch(e[n+1]){case"n":t+=`
41
+ `,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"\\":t+="\\",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"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let s="",i=n+1;for(;i<e.length&&i<n+4&&/[0-7]/.test(e[i]);)s+=e[i],i++;t+=String.fromCharCode(parseInt(s,8)),n=i;break}case"x":{let s=[],i=n;for(;i+3<e.length&&e[i]==="\\"&&e[i+1]==="x"&&/[0-9a-fA-F]{2}/.test(e.slice(i+2,i+4));)s.push(parseInt(e.slice(i+2,i+4),16)),i+=4;if(s.length>0){try{let o=new TextDecoder("utf-8",{fatal:!0});t+=o.decode(new Uint8Array(s))}catch{for(let o of s)t+=String.fromCharCode(o)}n=i}else t+=e[n],n++;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++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\u",n+=2);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++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\U",n+=2);break}default:t+=e[n],n++}else t+=e[n],n++;return t}var Ka=v(()=>{"use strict"});function Gf(e,t,n){let r=new Date(t*1e3),s="",i=0;for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let o=e[i+1],a=m4(r,o,n);a!==null?(s+=a,i+=2):(s+=e[i],i++)}else s+=e[i],i++;return s}function d4(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=l=>s.find(c=>c.type===l)?.value??"",o=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),a=i("weekday");return{year:Number.parseInt(i("year"),10)||e.getFullYear(),month:Number.parseInt(i("month"),10)||e.getMonth()+1,day:Number.parseInt(i("day"),10)||e.getDate(),hour:Number.parseInt(i("hour"),10)||e.getHours(),minute:Number.parseInt(i("minute"),10)||e.getMinutes(),second:Number.parseInt(i("second"),10)||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 m4(e,t,n){let r=d4(e,n),s=(l,c=2)=>String(l).padStart(c,"0"),i=Vf(r.year,r.month,r.day),o=Hf(r.year,r.month,r.day,r.weekday,0),a=Hf(r.year,r.month,r.day,r.weekday,1);switch(t){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][r.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month-1]} ${String(r.day).padStart(2," ")} ${s(r.hour)}:${s(r.minute)}:${s(r.second)} ${r.year}`;case"C":return s(Math.floor(r.year/100));case"d":return s(r.day);case"D":return`${s(r.month)}/${s(r.day)}/${s(r.year%100)}`;case"e":return String(r.day).padStart(2," ");case"F":return`${r.year}-${s(r.month)}-${s(r.day)}`;case"g":return s(jf(r.year,r.month,r.day)%100);case"G":return String(jf(r.year,r.month,r.day));case"H":return s(r.hour);case"I":return s(r.hour%12||12);case"j":return String(i).padStart(3,"0");case"k":return String(r.hour).padStart(2," ");case"l":return String(r.hour%12||12).padStart(2," ");case"m":return s(r.month);case"M":return s(r.minute);case"n":return`
42
+ `;case"N":return"000000000";case"p":return r.hour<12?"AM":"PM";case"P":return r.hour<12?"am":"pm";case"r":return`${s(r.hour%12||12)}:${s(r.minute)}:${s(r.second)} ${r.hour<12?"AM":"PM"}`;case"R":return`${s(r.hour)}:${s(r.minute)}`;case"s":return String(Math.floor(e.getTime()/1e3));case"S":return s(r.second);case"t":return" ";case"T":return`${s(r.hour)}:${s(r.minute)}:${s(r.second)}`;case"u":return String(r.weekday===0?7:r.weekday);case"U":return s(o);case"V":return s(w4(r.year,r.month,r.day));case"w":return String(r.weekday);case"W":return s(a);case"x":return`${s(r.month)}/${s(r.day)}/${s(r.year%100)}`;case"X":return`${s(r.hour)}:${s(r.minute)}:${s(r.second)}`;case"y":return s(r.year%100);case"Y":return String(r.year);case"z":return g4(e,n);case"Z":return y4(e,n);case"%":return"%";default:return null}}function g4(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 y4(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 Vf(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 Hf(e,t,n,r,s){let i=Vf(e,t,n),l=(new Date(e,0,1).getDay()-s+7)%7,c=(r-s+7)%7,u=i-1+l;return Math.floor((u-c+7)/7)}function w4(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 jf(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 qf=v(()=>{"use strict"});var Kf={};ee(Kf,{flagsForFuzzing:()=>T4,printfCommand:()=>E4});import{sprintf as as}from"sprintf-js";function b4(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 A4(e,t,n,r){let s="",i=0,o=0,a=!1,l="";for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let c=i;if(i++,e[i]==="%"){s+="%",i++;continue}let u=e.slice(c).match(/^%(-?\d*)(?:\.(\d+))?\(([^)]*)\)T/);if(u){let A=u[1]?parseInt(u[1],10):0,I=u[2]?parseInt(u[2],10):-1,$=u[3],D=u[0],R=t[n+o]||"";o++;let L;R===""||R==="-1"||R==="-2"?L=Math.floor(Date.now()/1e3):L=parseInt(R,10)||0;let C=Gf($,L,r);if(I>=0&&C.length>I&&(C=C.slice(0,I)),A!==0){let O=Math.abs(A);C.length<O&&(A<0?C=C.padEnd(O," "):C=C.padStart(O," "))}s+=C,i=c+D.length;continue}for(;i<e.length&&"+-0 #'".includes(e[i]);)i++;let f=!1;if(e[i]==="*")f=!0,i++;else for(;i<e.length&&/\d/.test(e[i]);)i++;let p=!1;if(e[i]===".")if(i++,e[i]==="*")p=!0,i++;else for(;i<e.length&&/\d/.test(e[i]);)i++;i<e.length&&"hlL".includes(e[i])&&i++;let h=e[i]||"";i++;let m=e.slice(c,i);if(f){let A=parseInt(t[n+o]||"0",10);o++,m=m.replace("*",String(A))}if(p){let A=parseInt(t[n+o]||"0",10);o++,m=m.replace(".*",`.${A}`)}let g=t[n+o]||"";o++;let{value:y,parseError:b,parseErrMsg:w,stopped:x}=S4(m,h,g);if(s+=y,b&&(a=!0,w&&(l=w)),x)return{result:s,argsConsumed:o,error:a,errMsg:l,stopped:!0}}else s+=e[i],i++;return{result:s,argsConsumed:o,error:a,errMsg:l,stopped:!1}}function S4(e,t,n){let r=!1,s="";switch(t){case"d":case"i":{let i=Wi(n);return r=bn,r&&(s=`printf: ${n}: invalid number
43
+ `),{value:Zf(e,i),parseError:r,parseErrMsg:s}}case"o":{let i=Wi(n);return r=bn,r&&(s=`printf: ${n}: invalid number
44
+ `),{value:C4(e,i),parseError:r,parseErrMsg:s}}case"u":{let i=Wi(n);r=bn,r&&(s=`printf: ${n}: invalid number
45
+ `);let o=i<0?i>>>0:i;return{value:Zf(e.replace("u","d"),o),parseError:r,parseErrMsg:s}}case"x":case"X":{let i=Wi(n);return r=bn,r&&(s=`printf: ${n}: invalid number
46
+ `),{value:v4(e,i),parseError:r,parseErrMsg:s}}case"e":case"E":case"f":case"F":case"g":case"G":{let i=parseFloat(n)||0;return{value:$4(e,t,i),parseError:!1,parseErrMsg:""}}case"c":{if(n==="")return{value:"",parseError:!1,parseErrMsg:""};let a=new TextEncoder().encode(n)[0];return{value:String.fromCharCode(a),parseError:!1,parseErrMsg:""}}case"s":return{value:N4(e,n),parseError:!1,parseErrMsg:""};case"q":return{value:I4(e,n),parseError:!1,parseErrMsg:""};case"b":{let i=O4(n);return{value:i.value,parseError:!1,parseErrMsg:"",stopped:i.stopped}}default:try{return{value:as(e,n),parseError:!1,parseErrMsg:""}}catch{return{value:"",parseError:!0,parseErrMsg:`printf: [sprintf] unexpected placeholder
47
+ `}}}}function Wi(e){bn=!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)?(bn=!0,0):(n&&(bn=!0),r)}if(e.startsWith("0")&&e.length>1&&/^-?0[0-7]+$/.test(e))return n&&(bn=!0),parseInt(e,8)||0;if(/^\d+#/.test(e)){bn=!0;let r=e.match(/^(\d+)#/);return r?parseInt(r[1],10):0}if(e!==""&&!/^-?\d+$/.test(e)){bn=!0;let r=parseInt(e,10);return Number.isNaN(r)?0:r}return n&&(bn=!0),parseInt(e,10)||0}function Zf(e,t){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[diu]$/);if(!n)return as(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 C4(e,t){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?o$/);if(!n)return as(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 v4(e,t){let n=e.includes("X"),r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[xX]$/);if(!r)return as(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 k4(e){if(e==="")return"''";if(/^[a-zA-Z0-9_./-]+$/.test(e))return e;if(/[\x00-\x1f\x7f-\xff]/.test(e)){let r="$'";for(let s of e){let i=s.charCodeAt(0);s==="'"?r+="\\'":s==="\\"?r+="\\\\":s===`
48
+ `?r+="\\n":s===" "?r+="\\t":s==="\r"?r+="\\r":s==="\x07"?r+="\\a":s==="\b"?r+="\\b":s==="\f"?r+="\\f":s==="\v"?r+="\\v":s==="\x1B"?r+="\\E":i<32||i>=127&&i<=255?r+=`\\${i.toString(8).padStart(3,"0")}`:s==='"'?r+='\\"':r+=s}return r+="'",r}let n="";for(let r of e)" |&;<>()$`\\\"'*?[#~=%!{}".includes(r)?n+=`\\${r}`:n+=r;return n}function N4(e,t){let n=e.match(/^%(-?)(\d*)(\.(\d*))?s$/);if(!n)return as(e.replace(/0+(?=\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=r?-s:s;return Ui(t,o,i)}function I4(e,t){let n=k4(t),r=e.match(/^%(-?)(\d*)q$/);if(!r)return n;let s=r[1]==="-",i=r[2]?parseInt(r[2],10):0,o=n;return i>o.length&&(s?o=o.padEnd(i," "):o=o.padStart(i," ")),o}function $4(e,t,n){let r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[eEfFgG]$/);if(!r)return as(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 O4(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)switch(e[n+1]){case"n":t+=`
49
+ `,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"\\":t+="\\",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"c":return{value:t,stopped:!0};case"x":{let s=[],i=n;for(;i+1<e.length&&e[i]==="\\"&&e[i+1]==="x";){let o="",a=i+2;for(;a<e.length&&a<i+4&&/[0-9a-fA-F]/.test(e[a]);)o+=e[a],a++;if(o)s.push(parseInt(o,16)),i=a;else break}s.length>0?(t+=b4(s),n=i):(t+="\\x",n+=2);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++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\u",n+=2);break}case"0":{let s="",i=n+2;for(;i<e.length&&i<n+5&&/[0-7]/.test(e[i]);)s+=e[i],i++;s?t+=String.fromCharCode(parseInt(s,8)):t+="\0",n=i;break}case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let s="",i=n+1;for(;i<e.length&&i<n+4&&/[0-7]/.test(e[i]);)s+=e[i],i++;t+=String.fromCharCode(parseInt(s,8)),n=i;break}default:t+=e[n],n++}else t+=e[n],n++;return{value:t,stopped:!1}}var x4,E4,bn,T4,Qf=v(()=>{"use strict";Ae();rn();ie();Ka();qf();x4={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)"]},E4={name:"printf",async execute(e,t){if(U(e))return M(x4);if(e.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments]
50
+ `,exitCode:2};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
51
+ `,exitCode:1};if(n=e[r+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(\[[a-zA-Z0-9_@*"'$]+\])?$/.test(n))return{stdout:"",stderr:`printf: \`${n}': not a valid identifier
52
+ `,exitCode:2};r+=2}else{if(o.startsWith("-")&&o!=="-")break;break}}if(r>=e.length)return{stdout:"",stderr:`printf: usage: printf format [arguments]
53
+ `,exitCode:1};let s=e[r],i=e.slice(r+1);try{let o=Bi(s),a="",l=0,c=!1,u="",f=t.env.get("TZ"),p=t.limits?.maxStringLength;do{let{result:h,argsConsumed:d,error:m,errMsg:g,stopped:y}=A4(o,i,l,f);if(a+=h,p!==void 0&&p>0&&a.length>p)throw new X(`printf: output size limit exceeded (${p} bytes)`,"string_length");if(l+=d,m&&(c=!0,g&&(u=g)),y)break}while(l<i.length&&l>0);if(l===0&&i.length>0,n){let h=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(h){let d=h[1],m=h[3];m=m.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(g,y)=>t.env.get(y)??""),t.env.set(`${d}_${m}`,a)}else t.env.set(n,a);return{stdout:"",stderr:u,exitCode:c?1:0}}return{stdout:a,stderr:u,exitCode:c?1:0}}catch(o){if(o instanceof X)throw o;return{stdout:"",stderr:`printf: ${Xe(o)}
54
+ `,exitCode:1}}}};bn=!1;T4={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0}});var Jf={};ee(Jf,{flagsForFuzzing:()=>F4,lsCommand:()=>D4});import{minimatch as Xf}from"minimatch";function zi(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 Hi(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 Tr(e){return e.isDirectory?"/":e.isSymbolicLink?"@":(e.mode&73)!==0?"*":""}async function _4(e,t,n,r,s,i=!1,o=!1,a=!1,l=!1){let c=n||r,u=t.fs.getAllPaths(),f=t.fs.resolvePath(t.cwd,"."),p=[];for(let h of u){let d=h.startsWith(f)&&h.slice(f.length+1)||h;if(Xf(d,e)||Xf(h,e)){let m=d.split("/").pop()||d;if(!c&&m.startsWith("."))continue;p.push(d||h)}}if(p.length===0)return{stdout:"",stderr:`ls: ${e}: No such file or directory
55
+ `,exitCode:2};if(a){let h=[];for(let d of p){let m=t.fs.resolvePath(t.cwd,d);try{let g=await t.fs.stat(m);h.push({path:d,size:g.size??0})}catch{h.push({path:d,size:0})}}h.sort((d,m)=>m.size-d.size),p.length=0,p.push(...h.map(d=>d.path))}else p.sort();if(i&&p.reverse(),s){let h=[];for(let d of p){let m=t.fs.resolvePath(t.cwd,d);try{let g=await t.fs.stat(m),y=g.isDirectory?"drwxr-xr-x":"-rw-r--r--",b=l?Tr(await t.fs.lstat(m)):g.isDirectory?"/":"",w=g.size??0,x=o?zi(w).padStart(5):String(w).padStart(5),A=g.mtime??new Date(0),I=Hi(A);h.push(`${y} 1 user user ${x} ${I} ${d}${b}`)}catch{h.push(`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${d}`)}}return{stdout:`${h.join(`
56
+ `)}
57
+ `,stderr:"",exitCode:0}}if(l){let h=[];for(let d of p){let m=t.fs.resolvePath(t.cwd,d);try{let g=await t.fs.lstat(m);h.push(`${d}${Tr(g)}`)}catch{h.push(d)}}return{stdout:`${h.join(`
58
+ `)}
59
+ `,stderr:"",exitCode:0}}return{stdout:`${p.join(`
60
+ `)}
61
+ `,stderr:"",exitCode:0}}async function Yf(e,t,n,r,s,i,o,a=!1,l=!1,c=!1,u=!1,f=!1){let p=n||r,h=t.fs.resolvePath(t.cwd,e);try{let d=await t.fs.stat(h);if(!d.isDirectory){let y=u?Tr(await t.fs.lstat(h)):"";if(s){let b=d.size??0,w=l?zi(b).padStart(5):String(b).padStart(5),x=d.mtime??new Date(0),A=Hi(x);return{stdout:`-rw-r--r-- 1 user user ${w} ${A} ${e}${y}
62
+ `,stderr:"",exitCode:0}}return{stdout:`${e}${y}
63
+ `,stderr:"",exitCode:0}}let m=await t.fs.readdir(h);if(p||(m=m.filter(y=>!y.startsWith("."))),c){let y=[];for(let b of m){let w=h==="/"?`/${b}`:`${h}/${b}`;try{let x=await t.fs.stat(w);y.push({name:b,size:x.size??0})}catch{y.push({name:b,size:0})}}y.sort((b,w)=>w.size-b.size),m=y.map(b=>b.name)}else m.sort();n&&(m=[".","..",...m]),a&&m.reverse();let g="";if((i||o)&&(g+=`${e}:
64
+ `),s){g+=`total ${m.length}
65
+ `;let y=m.filter(A=>A==="."||A===".."),b=m.filter(A=>A!=="."&&A!=="..");for(let A of y)g+=`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${A}
66
+ `;let w=[];for(let A=0;A<b.length;A+=100){let I=b.slice(A,A+100),$=await Promise.all(I.map(async D=>{let R=h==="/"?`/${D}`:`${h}/${D}`;try{let L=await t.fs.stat(R),C=L.isDirectory?"drwxr-xr-x":"-rw-r--r--",O=u?Tr(await t.fs.lstat(R)):L.isDirectory?"/":"",T=L.size??0,N=l?zi(T).padStart(5):String(T).padStart(5),F=L.mtime??new Date(0),B=Hi(F);return{name:D,line:`${C} 1 user user ${N} ${B} ${D}${O}
67
+ `}}catch{return{name:D,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${D}
68
+ `}}}));w.push(...$)}let x=new Map(b.map((A,I)=>[A,I]));w.sort((A,I)=>(x.get(A.name)??0)-(x.get(I.name)??0));for(let{line:A}of w)g+=A}else if(u){let y=[],b=m.filter(x=>x!=="."&&x!==".."),w=m.filter(x=>x==="."||x==="..");for(let x of w)y.push(`${x}/`);for(let x=0;x<b.length;x+=100){let A=b.slice(x,x+100),I=await Promise.all(A.map(async $=>{let D=h==="/"?`/${$}`:`${h}/${$}`;try{let R=await t.fs.lstat(D);return`${$}${Tr(R)}`}catch{return $}}));y.push(...I)}g+=y.join(`
69
+ `)+(y.length?`
70
+ `:"")}else g+=m.join(`
71
+ `)+(m.length?`
72
+ `:"");if(i){let y=m.filter(x=>x!=="."&&x!==".."),b=[];if(t.fs.readdirWithFileTypes)b=(await t.fs.readdirWithFileTypes(h)).filter(A=>A.isDirectory&&y.includes(A.name)).map(A=>({name:A.name,isDirectory:!0}));else for(let x=0;x<y.length;x+=100){let A=y.slice(x,x+100),I=await Promise.all(A.map(async $=>{let D=h==="/"?`/${$}`:`${h}/${$}`;try{let R=await t.fs.stat(D);return{name:$,isDirectory:R.isDirectory}}catch{return{name:$,isDirectory:!1}}}));b.push(...I.filter($=>$.isDirectory))}b.sort((x,A)=>x.name.localeCompare(A.name)),a&&b.reverse();let w=[];for(let x=0;x<b.length;x+=100){let A=b.slice(x,x+100),I=await Promise.all(A.map(async $=>{let D=e==="."?`./${$.name}`:`${e}/${$.name}`,R=await Yf(D,t,n,r,s,i,!1,a,l,c,u,!0);return{name:$.name,result:R}}));w.push(...I)}w.sort((x,A)=>x.name.localeCompare(A.name)),a&&w.reverse();for(let{result:x}of w)g+=`
73
+ `,g+=x.stdout}return{stdout:g,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`ls: ${e}: No such file or directory
74
+ `,exitCode:2}}}var R4,P4,D4,F4,e1=v(()=>{"use strict";at();rs();ie();R4={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"]},P4={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"}},D4={name:"ls",async execute(e,t){if(U(e))return M(R4);let n=Se("ls",e,P4);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.sortBySize,u=n.result.flags.classifyFiles,f=n.result.flags.directoryOnly,p=n.result.flags.sortByTime;n.result.flags.onePerLine;let h=n.result.positional;h.length===0&&h.push(".");let d="",m="",g=0;for(let y=0;y<h.length;y++){let b=h[y];if(y>0&&d&&!d.endsWith(`
75
+
76
+ `)&&(d+=`
77
+ `),f){let w=t.fs.resolvePath(t.cwd,b);try{let x=await t.fs.stat(w);if(i){let A=x.isDirectory?"drwxr-xr-x":"-rw-r--r--",I=u?Tr(await t.fs.lstat(w)):x.isDirectory?"/":"",$=x.size??0,D=o?zi($).padStart(5):String($).padStart(5),R=x.mtime??new Date(0),L=Hi(R);d+=`${A} 1 user user ${D} ${L} ${b}${I}
78
+ `}else{let A=u?Tr(await t.fs.lstat(w)):"";d+=`${b}${A}
79
+ `}}catch{m+=`ls: cannot access '${b}': No such file or directory
80
+ `,g=2}continue}if(b.includes("*")||b.includes("?")||b.includes("[")){let w=await _4(b,t,r,s,i,l,o,c,u);d+=w.stdout,m+=w.stderr,w.exitCode!==0&&(g=w.exitCode)}else{let w=await Yf(b,t,r,s,i,a,h.length>1,l,o,c,u);d+=w.stdout,m+=w.stderr,w.exitCode!==0&&(g=w.exitCode)}}return{stdout:d,stderr:m,exitCode:g}}};F4={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}});function L4(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 He(e){return L4(e,!1,!1)}var xn=v(()=>{"use strict"});var t1={};ee(t1,{flagsForFuzzing:()=>B4,mkdirCommand:()=>U4});var M4,U4,B4,n1=v(()=>{"use strict";xn();rn();at();M4={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},U4={name:"mkdir",async execute(e,t){let n=Se("mkdir",e,M4);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
81
+ `,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}'
82
+ `)}catch(u){let f=Xe(u);f.includes("ENOENT")||f.includes("no such file")?a+=`mkdir: cannot create directory '${c}': No such file or directory
83
+ `:f.includes("EEXIST")||f.includes("already exists")?a+=`mkdir: cannot create directory '${c}': File exists
84
+ `:a+=`mkdir: cannot create directory '${c}': ${He(f)}
85
+ `,l=1}return{stdout:o,stderr:a,exitCode:l}}},B4={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var i1={};ee(i1,{flagsForFuzzing:()=>G4,rmdirCommand:()=>H4});async function j4(e,t,n,r){let s="",i="",a=e.fs.resolvePath(e.cwd,t),l=await r1(e,a,t,r);if(s+=l.stdout,i+=l.stderr,l.exitCode!==0)return{stdout:s,stderr:i,exitCode:l.exitCode};if(n){let c=a,u=t;for(;;){let f=s1(c),p=s1(u);if(f===c||f==="/"||f==="."||p==="."||p==="")break;let h=await r1(e,f,p,r);if(s+=h.stdout,h.exitCode!==0)break;c=f,u=p}}return{stdout:s,stderr:i,exitCode:0}}async function r1(e,t,n,r){try{if(!await e.fs.exists(t))return{stdout:"",stderr:`rmdir: failed to remove '${n}': No such file or directory
86
+ `,exitCode:1};if(!(await e.fs.stat(t)).isDirectory)return{stdout:"",stderr:`rmdir: failed to remove '${n}': Not a directory
87
+ `,exitCode:1};if((await e.fs.readdir(t)).length>0)return{stdout:"",stderr:`rmdir: failed to remove '${n}': Directory not empty
88
+ `,exitCode:1};await e.fs.rm(t,{recursive:!1,force:!1});let a="";return r&&(a=`rmdir: removing directory, '${n}'
89
+ `),{stdout:a,stderr:"",exitCode:0}}catch(s){let i=Xe(s);return{stdout:"",stderr:`rmdir: failed to remove '${n}': ${i}
90
+ `,exitCode:1}}}function s1(e){let t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n===-1?".":n===0?"/":t.substring(0,n)}var W4,z4,H4,G4,o1=v(()=>{"use strict";rn();at();W4=`Usage: rmdir [-pv] DIRECTORY...
91
+ Remove empty directories.
92
+
93
+ Options:
94
+ -p, --parents Remove DIRECTORY and its ancestors
95
+ -v, --verbose Output a diagnostic for every directory processed`,z4={parents:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},help:{long:"help",type:"boolean"}},H4={name:"rmdir",async execute(e,t){let n=Se("rmdir",e,z4);if(!n.ok)return n.error;if(n.result.flags.help)return{stdout:`${W4}
96
+ `,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
97
+ `,exitCode:1};let o="",a="",l=0;for(let c of i){let u=await j4(t,c,r,s);o+=u.stdout,a+=u.stderr,u.exitCode!==0&&(l=u.exitCode)}return{stdout:o,stderr:a,exitCode:l}}};G4={name:"rmdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var a1={};ee(a1,{flagsForFuzzing:()=>Z4,touchCommand:()=>q4});function V4(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 q4,Z4,l1=v(()=>{"use strict";rn();ie();q4={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'
98
+ `,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 K("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'
99
+ `,exitCode:1};r=e[++l],u=!0;break}else if(f==="r"||f==="t"){l++,u=!0;break}else return K("touch",`-${f}`);if(u)continue}else n.push(c)}}if(n.length===0)return{stdout:"",stderr:`touch: missing file operand
100
+ `,exitCode:1};let i=null;if(r!==null&&(i=V4(r),i===null))return{stdout:"",stderr:`touch: invalid date format '${r}'
101
+ `,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}': ${Xe(c)}
102
+ `,a=1}return{stdout:"",stderr:o,exitCode:a}}},Z4={name:"touch",flags:[{flag:"-c",type:"boolean"},{flag:"-a",type:"boolean"},{flag:"-m",type:"boolean"},{flag:"-d",type:"value",valueHint:"string"}],needsArgs:!0}});var c1={};ee(c1,{flagsForFuzzing:()=>X4,rmCommand:()=>Q4});var K4,Q4,X4,u1=v(()=>{"use strict";xn();rn();at();K4={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"}},Q4={name:"rm",async execute(e,t){let n=Se("rm",e,K4);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
103
+ `,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
104
+ `,c=1;continue}await t.fs.rm(f,{recursive:r,force:s}),i&&(a+=`removed '${u}'
105
+ `)}catch(f){if(!s){let p=Xe(f);p.includes("ENOENT")||p.includes("no such file")?l+=`rm: cannot remove '${u}': No such file or directory
106
+ `:p.includes("ENOTEMPTY")||p.includes("not empty")?l+=`rm: cannot remove '${u}': Directory not empty
107
+ `:l+=`rm: cannot remove '${u}': ${He(p)}
108
+ `,c=1}}return{stdout:a,stderr:l,exitCode:c}}},X4={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var f1={};ee(f1,{cpCommand:()=>e3,flagsForFuzzing:()=>t3});var Y4,J4,e3,t3,p1=v(()=>{"use strict";rn();at();ie();Y4={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"]},J4={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"}},e3={name:"cp",async execute(e,t){if(U(e))return M(Y4);let n=Se("cp",e,J4);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
109
+ `,exitCode:1};let l=a.pop()??"",c=a,u=t.fs.resolvePath(t.cwd,l),f="",p="",h=0,d=!1;try{d=(await t.fs.stat(u)).isDirectory}catch{}if(c.length>1&&!d)return{stdout:"",stderr:`cp: target '${l}' is not a directory
110
+ `,exitCode:1};for(let m of c)try{let g=t.fs.resolvePath(t.cwd,m),y=await t.fs.stat(g),b=u;if(d){let w=m.split("/").pop()||m;b=u==="/"?`/${w}`:`${u}/${w}`}if(y.isDirectory&&!r){p+=`cp: -r not specified; omitting directory '${m}'
111
+ `,h=1;continue}if(s)try{await t.fs.stat(b);continue}catch{}await t.fs.cp(g,b,{recursive:r}),o&&(f+=`'${m}' -> '${b}'
112
+ `)}catch(g){let y=Xe(g);y.includes("ENOENT")||y.includes("no such file")?p+=`cp: cannot stat '${m}': No such file or directory
113
+ `:p+=`cp: cannot copy '${m}': ${y}
114
+ `,h=1}return{stdout:f,stderr:p,exitCode:h}}},t3={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 h1={};ee(h1,{flagsForFuzzing:()=>i3,mvCommand:()=>s3});var n3,r3,s3,i3,d1=v(()=>{"use strict";rn();at();ie();n3={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"]},r3={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},s3={name:"mv",async execute(e,t){if(U(e))return M(n3);let n=Se("mv",e,r3);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
115
+ `,exitCode:1};let a=o.pop()??"",l=o,c=t.fs.resolvePath(t.cwd,a),u="",f="",p=0,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
116
+ `,exitCode:1};for(let d of l)try{let m=t.fs.resolvePath(t.cwd,d),g=c;if(h){let y=d.split("/").pop()||d;g=c==="/"?`/${y}`:`${c}/${y}`}if(s)try{await t.fs.stat(g);continue}catch{}if(await t.fs.mv(m,g),i){let y=h?`${a}/${d.split("/").pop()||d}`:a;u+=`renamed '${d}' -> '${y}'
117
+ `}}catch(m){let g=Xe(m);g.includes("ENOENT")||g.includes("no such file")?f+=`mv: cannot stat '${d}': No such file or directory
118
+ `:f+=`mv: cannot move '${d}': ${g}
119
+ `,p=1}return{stdout:u,stderr:f,exitCode:p}}},i3={name:"mv",flags:[{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var m1={};ee(m1,{flagsForFuzzing:()=>l3,lnCommand:()=>a3});var o3,a3,l3,g1=v(()=>{"use strict";xn();ie();o3={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"]},a3={name:"ln",async execute(e,t){if(U(e))return M(o3);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 K("ln",f)}let o=e.slice(i);if(o.length<2)return{stdout:"",stderr:`ln: missing file operand
120
+ `,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
121
+ `,exitCode:1}}else return{stdout:"",stderr:`ln: failed to create ${n?"symbolic ":""}link '${l}': File exists
122
+ `,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
123
+ `,exitCode:1};await t.fs.link(f,c)}}catch(f){let p=f;return p.message.includes("EPERM")?{stdout:"",stderr:`ln: '${a}': hard link not allowed for directory
124
+ `,exitCode:1}:{stdout:"",stderr:`ln: ${He(p.message)}
125
+ `,exitCode:1}}let u="";return s&&(u=`'${l}' -> '${a}'
126
+ `),{stdout:u,stderr:"",exitCode:0}}},l3={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var w1={};ee(w1,{chmodCommand:()=>u3,flagsForFuzzing:()=>f3});async function y1(e,t,n,r,s){let i="",o=await e.fs.readdir(t);for(let a of o){let l=t==="/"?`/${a}`:`${t}/${a}`,c;if(n!==void 0)c=n;else if(r!==void 0){let f=await e.fs.stat(l);c=Qa(r,f.mode)}else c=420;await e.fs.chmod(l,c),s&&(i+=`mode of '${l}' changed to ${c.toString(8).padStart(4,"0")}
127
+ `),(await e.fs.stat(l)).isDirectory&&(i+=await y1(e,l,n,r,s))}return i}function Qa(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 p=0;f==="u"?p=6:f==="g"?p=3:f==="o"&&(p=0);let h=c<<p;a==="+"?n|=h:a==="-"?n&=~h:a==="="&&(n&=~(7<<p),n|=h)}a==="+"?n|=u:a==="-"?n&=~u:a==="="&&(l.includes("s")&&(o.includes("u")&&(n&=-2049,n|=u&2048),o.includes("g")&&(n&=-1025,n|=u&1024)),l.includes("t")&&(n&=-513,n|=u&512))}return n}var c3,u3,f3,b1=v(()=>{"use strict";ie();c3={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"]},u3={name:"chmod",async execute(e,t){if(U(e))return M(c3);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
128
+ `,exitCode:1};let n=!1,r=!1,s=0;for(;s<e.length&&e[s].startsWith("-");){let p=e[s];if(p==="-R"||p==="--recursive")n=!0,s++;else if(p==="-v"||p==="--verbose")r=!0,s++;else if(p==="--"){s++;break}else{if(/^[+-]?[rwxugo]+/.test(p)||/^\d+$/.test(p))break;if(/^-[Rv]+$/.test(p)){p.includes("R")&&(n=!0),p.includes("v")&&(r=!0),s++;continue}return K("chmod",p)}}if(e.length-s<2)return{stdout:"",stderr:`chmod: missing operand
129
+ `,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{Qa(i,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${i}'
130
+ `,exitCode:1}}let c="",u="",f=!1;for(let p of o){let h=t.fs.resolvePath(t.cwd,p);try{let d;if(a&&l!==void 0)d=l;else{let m=await t.fs.stat(h);d=Qa(i,m.mode)}if(await t.fs.chmod(h,d),r&&(c+=`mode of '${p}' changed to ${d.toString(8).padStart(4,"0")}
131
+ `),n&&(await t.fs.stat(h)).isDirectory){let g=await y1(t,h,a?l:void 0,a?void 0:i,r);c+=g}}catch{u+=`chmod: cannot access '${p}': No such file or directory
132
+ `,f=!0}}return{stdout:c,stderr:u,exitCode:f?1:0}}};f3={name:"chmod",flags:[{flag:"-R",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var x1={};ee(x1,{flagsForFuzzing:()=>h3,pwdCommand:()=>p3});var p3,h3,E1=v(()=>{"use strict";p3={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}
133
+ `,stderr:"",exitCode:0}}},h3={name:"pwd",flags:[{flag:"-P",type:"boolean"},{flag:"-L",type:"boolean"}]}});var A1={};ee(A1,{flagsForFuzzing:()=>g3,readlinkCommand:()=>m3});var d3,m3,g3,S1=v(()=>{"use strict";ie();d3={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"]},m3={name:"readlink",async execute(e,t){if(U(e))return M(d3);let n=!1,r=0;for(;r<e.length&&e[r].startsWith("-");){let a=e[r];if(a==="-f"||a==="--canonicalize")n=!0,r++;else if(a==="--"){r++;break}else return K("readlink",a)}let s=e.slice(r);if(s.length===0)return{stdout:"",stderr:`readlink: missing operand
134
+ `,exitCode:1};let i="",o=!1;for(let a of s){let l=t.fs.resolvePath(t.cwd,a);try{if(n){let c=l,u=new Set;for(;!u.has(c);){u.add(c);try{let f=await t.fs.readlink(c);if(f.startsWith("/"))c=f;else{let p=c.substring(0,c.lastIndexOf("/"))||"/";c=t.fs.resolvePath(p,f)}}catch{break}}i+=`${c}
135
+ `}else{let c=await t.fs.readlink(l);i+=`${c}
136
+ `}}catch{n?i+=`${l}
137
+ `:o=!0}}return{stdout:i,stderr:"",exitCode:o?1:0}}},g3={name:"readlink",flags:[{flag:"-f",type:"boolean"},{flag:"-e",type:"boolean"}],needsArgs:!0}});function ji(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:K(t,c)};if(c.startsWith("-")&&c!=="-")return{ok:!1,error:K(t,c)};a.push(c)}}return r!==null&&(Number.isNaN(r)||r<0)?{ok:!1,error:{stdout:"",stderr:`${t}: invalid number of bytes
138
+ `,exitCode:1}}:Number.isNaN(n)||n<0?{ok:!1,error:{stdout:"",stderr:`${t}: invalid number of lines
139
+ `,exitCode:1}}:{ok:!0,options:{lines:n,bytes:r,quiet:s,verbose:i,files:a,fromLine:o}}}async function Gi(e,t,n,r){let{quiet:s,verbose:i,files:o}=t;if(o.length===0)return{stdout:r(e.stdin),stderr:"",exitCode:0};let a="",l="",c=0,u=i||!s&&o.length>1,f=0;for(let p=0;p<o.length;p++){let h=o[p];try{let d=e.fs.resolvePath(e.cwd,h),m=await e.fs.readFile(d);u&&(f>0&&(a+=`
140
+ `),a+=`==> ${h} <==
141
+ `),a+=r(m),f++}catch{l+=`${n}: ${h}: No such file or directory
142
+ `,c=1}}return{stdout:a,stderr:l,exitCode:c}}function C1(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(`
143
+ `,r);if(o===-1)return`${e}
144
+ `;s++,r=o+1}return r>0?e.slice(0,r):""}function v1(e,t,n,r){if(n!==null)return e.slice(-n);let s=e.length;if(s===0)return"";if(r){let l=0,c=1;for(;l<s&&c<t;){let f=e.indexOf(`
145
+ `,l);if(f===-1)break;c++,l=f+1}let u=e.slice(l);return u.endsWith(`
146
+ `)?u:`${u}
147
+ `}if(t===0)return"";let i=s-1;e[i]===`
148
+ `&&i--;let o=0;for(;i>=0&&o<t;){if(e[i]===`
149
+ `&&(o++,o===t)){i++;break}i--}i<0&&(i=0);let a=e.slice(i);return e[s-1]===`
150
+ `?a:`${a}
151
+ `}var Xa=v(()=>{"use strict";ge();ie()});var k1={};ee(k1,{flagsForFuzzing:()=>b3,headCommand:()=>w3});var y3,w3,b3,N1=v(()=>{"use strict";ie();Xa();y3={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"]},w3={name:"head",async execute(e,t){if(U(e))return M(y3);let n=ji(e,"head");if(!n.ok)return n.error;let{lines:r,bytes:s}=n.options;return Gi(t,n.options,"head",i=>C1(i,r,s))}},b3={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 I1={};ee(I1,{flagsForFuzzing:()=>A3,tailCommand:()=>E3});var x3,E3,A3,$1=v(()=>{"use strict";Xa();ie();x3={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"]},E3={name:"tail",async execute(e,t){if(U(e))return M(x3);let n=ji(e,"tail");if(!n.ok)return n.error;let{lines:r,bytes:s,fromLine:i}=n.options;return Gi(t,n.options,"tail",o=>v1(o,r,s,i??!1))}},A3={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 T1={};ee(T1,{flagsForFuzzing:()=>k3,wcCommand:()=>v3});function O1(e,t){let n=e,r=n.length,s=t?Array.from(ae(e)).length:r,i=0,o=0,a=!1;for(let l=0;l<r;l++){let c=n[l];c===`
152
+ `?(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 Ya(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 S3,C3,v3,k3,R1=v(()=>{"use strict";ge();at();Or();ie();S3={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"]},C3={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"}},v3={name:"wc",async execute(e,t){if(U(e))return M(S3);let n=Se("wc",e,C3);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 $r(t,a,{cmdName:"wc",stopOnError:!1});if(a.length===0){let w=O1(c.files[0].content,o);return{stdout:`${Ya(w,r,s,l,"",0)}
153
+ `,stderr:"",exitCode:0}}let u=[],f=0,p=0,h=0;for(let{filename:w,content:x}of c.files){let A=O1(x,o);f+=A.lines,p+=A.words,h+=A.third,u.push({filename:w,stats:A})}let d=a.length>1?f:Math.max(...u.map(w=>w.stats.lines)),m=a.length>1?p:Math.max(...u.map(w=>w.stats.words)),g=a.length>1?h:Math.max(...u.map(w=>w.stats.third)),y=a.length>1?3:0;r&&(y=Math.max(y,String(d).length)),s&&(y=Math.max(y,String(m).length)),l&&(y=Math.max(y,String(g).length));let b="";for(let{filename:w,stats:x}of u)b+=`${Ya(x,r,s,l,w,y)}
154
+ `;return a.length>1&&(b+=`${Ya({lines:f,words:p,third:h},r,s,l,"total",y)}
155
+ `),{stdout:b,stderr:c.stderr,exitCode:c.exitCode}}};k3={name:"wc",flags:[{flag:"-l",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-m",type:"boolean"}],stdinType:"text",needsFiles:!0}});function Ks(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 Ja=v(()=>{"use strict"});var P1={};ee(P1,{flagsForFuzzing:()=>O3,statCommand:()=>$3});var N3,I3,$3,O3,D1=v(()=>{"use strict";at();Ja();ie();N3={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"]},I3={format:{short:"c",type:"string"}},$3={name:"stat",async execute(e,t){if(U(e))return M(N3);let n=Se("stat",e,I3);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
156
+ `,exitCode:1};let i="",o="",a=!1;for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{let u=await t.fs.stat(c);if(r){let f=r,p=u.mode.toString(8),h=Ks(u.mode,u.isDirectory);f=f.replace(/%n/g,l),f=f.replace(/%N/g,`'${l}'`),f=f.replace(/%s/g,String(u.size)),f=f.replace(/%F/g,u.isDirectory?"directory":"regular file"),f=f.replace(/%a/g,p),f=f.replace(/%A/g,h),f=f.replace(/%u/g,"1000"),f=f.replace(/%U/g,"user"),f=f.replace(/%g/g,"1000"),f=f.replace(/%G/g,"group"),i+=`${f}
157
+ `}else{let f=u.mode.toString(8).padStart(4,"0"),p=Ks(u.mode,u.isDirectory);i+=` File: ${l}
158
+ `,i+=` Size: ${u.size} Blocks: ${Math.ceil(u.size/512)}
159
+ `,i+=`Access: (${f}/${p})
160
+ `,i+=`Modify: ${u.mtime.toISOString()}
161
+ `}}catch{o+=`stat: cannot stat '${l}': No such file or directory
162
+ `,a=!0}}return{stdout:i,stderr:o,exitCode:a?1:0}}},O3={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var G,P,k,fn,ue,Oe,ep,lr,Vi,el,cs,Un,tl,nl,Ye,us,je,rl,En,sl,qi,he,il,Zi,Qs,T3,R3,ol,al,_,ll,ls,cl,ul,$e,_1,F1,L1,M1,U1,B1,W1,z1,H1,j1,G1,V1,q1,Z1,K1,Q1,X1,Y1,J1,Mn,Xs,fl,pl,hl,dl,ml,cr,tp=v(()=>{G=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},P=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[`
163
+ `,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)}},k=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}},fn=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 k(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 k(new Uint32Array([0,31,1,127,159,1]));static Cf=new k(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 k(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new k(new Uint32Array([55296,57343,1]));static L=new k(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 k(new Uint32Array([837,837,1]));static Ll=new k(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 k(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 k(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 k(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 k(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 k(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 k(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 k(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 k(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 k(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new k(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 k(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new k(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 k(new Uint32Array([921,953,32,8126,8126,1]));static N=new k(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 k(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 k(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 k(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 k(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 k(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new k(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 k(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 k(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new k(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new k(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 k(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 k(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 k(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 k(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 k(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 k(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 k(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new k(new Uint32Array([8232,8232,1]));static Zp=new k(new Uint32Array([8233,8233,1]));static Zs=new k(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new k(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new k(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new k(new Uint32Array([82944,83526,1]));static Arabic=new k(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 k(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new k(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new k(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new k(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new k(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new k(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new k(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 k(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new k(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new k(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new k(new Uint32Array([10240,10495,1]));static Buginese=new k(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new k(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new k(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new k(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new k(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new k(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new k(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new k(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new k(new Uint32Array([69552,69579,1]));static Common=new k(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 k(new Uint32Array([924,956,32]));static Coptic=new k(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new k(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new k(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new k(new Uint32Array([77712,77810,1]));static Cyrillic=new k(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 k(new Uint32Array([66560,66639,1]));static Devanagari=new k(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new k(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 k(new Uint32Array([71680,71739,1]));static Duployan=new k(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new k(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new k(new Uint32Array([66816,66855,1]));static Elymaic=new k(new Uint32Array([69600,69622,1]));static Ethiopic=new k(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 k(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new k(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 k(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new k(new Uint32Array([66352,66378,1]));static Grantha=new k(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 k(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 k(new Uint32Array([181,837,656]));static Gujarati=new k(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 k(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new k(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 k(new Uint32Array([90368,90425,1]));static Han=new k(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 k(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 k(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new k(new Uint32Array([5920,5940,1]));static Hatran=new k(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new k(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 k(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new k(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new k(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 k(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new k(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new k(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new k(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new k(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new k(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 k(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 k(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new k(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new k(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 k(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new k(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new k(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new k(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new k(new Uint32Array([93504,93561,1]));static Lao=new k(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 k(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 k(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new k(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new k(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new k(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 k(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new k(new Uint32Array([66176,66204,1]));static Lydian=new k(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new k(new Uint32Array([69968,70006,1]));static Makasar=new k(new Uint32Array([73440,73464,1]));static Malayalam=new k(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 k(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new k(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new k(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new k(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 k(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new k(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new k(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new k(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new k(new Uint32Array([67968,67999,1]));static Miao=new k(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new k(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new k(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new k(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new k(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new k(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new k(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new k(new Uint32Array([124112,124153,1]));static Nandinagari=new k(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new k(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new k(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new k(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new k(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new k(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new k(new Uint32Array([5760,5788,1]));static Ol_Chiki=new k(new Uint32Array([7248,7295,1]));static Ol_Onal=new k(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new k(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new k(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new k(new Uint32Array([68224,68255,1]));static Old_Permic=new k(new Uint32Array([66384,66426,1]));static Old_Persian=new k(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new k(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new k(new Uint32Array([68192,68223,1]));static Old_Turkic=new k(new Uint32Array([68608,68680,1]));static Old_Uyghur=new k(new Uint32Array([69488,69513,1]));static Oriya=new k(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 k(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new k(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new k(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new k(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new k(new Uint32Array([72384,72440,1]));static Phags_Pa=new k(new Uint32Array([43072,43127,1]));static Phoenician=new k(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new k(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new k(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new k(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new k(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new k(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new k(new Uint32Array([70016,70111,1]));static Shavian=new k(new Uint32Array([66640,66687,1]));static Siddham=new k(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new k(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new k(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 k(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new k(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new k(new Uint32Array([72272,72354,1]));static Sundanese=new k(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new k(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new k(new Uint32Array([43008,43052,1]));static Syriac=new k(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new k(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new k(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new k(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new k(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new k(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new k(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new k(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 k(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new k(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new k(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 k(new Uint32Array([1920,1969,1]));static Thai=new k(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new k(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 k(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new k(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new k(new Uint32Array([67008,67059,1]));static Toto=new k(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new k(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 k(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new k(new Uint32Array([42240,42539,1]));static Vithkuqi=new k(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 k(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new k(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new k(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new k(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new k(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 k(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]))},ue=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(fn.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t<this.MAX_ASCII||t>=161&&t!==173:this.is(fn.Print,t)}static simpleFold(t){if(fn.CASE_ORBIT.has(t))return fn.CASE_ORBIT.get(t);let n=P.toLowerCase(t);return n!==t?n:P.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 P.CODES.get("A")<=t&&t<=P.CODES.get("Z")&&(t|=32),P.CODES.get("A")<=n&&n<=P.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}},Oe=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 P.CODES.get("0")<=t&&t<=P.CODES.get("9")||P.CODES.get("a")<=t&&t<=P.CODES.get("z")||P.CODES.get("A")<=t&&t<=P.CODES.get("Z")}static unhex(t){return P.CODES.get("0")<=t&&t<=P.CODES.get("9")?t-P.CODES.get("0"):P.CODES.get("a")<=t&&t<=P.CODES.get("f")?t-P.CODES.get("a")+10:P.CODES.get("A")<=t&&t<=P.CODES.get("F")?t-P.CODES.get("A")+10:-1}static escapeRune(t){let n="";if(ue.isPrint(t))this.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(n+="\\"),n+=String.fromCodePoint(t);else switch(t){case P.CODES.get('"'):n+='\\"';break;case P.CODES.get("\\"):n+="\\\\";break;case P.CODES.get(" "):n+="\\t";break;case P.CODES.get(`
164
+ `):n+="\\n";break;case P.CODES.get("\r"):n+="\\r";break;case P.CODES.get("\b"):n+="\\b";break;case P.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 P.CODES.get("a")<=t&&t<=P.CODES.get("z")||P.CODES.get("A")<=t&&t<=P.CODES.get("Z")||P.CODES.get("0")<=t&&t<=P.CODES.get("9")||t===P.CODES.get("_")}static emptyOpContext(t,n){let r=0;return t<0&&(r|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),t===P.CODES.get(`
165
+ `)&&(r|=this.EMPTY_BEGIN_LINE),n<0&&(r|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),n===P.CODES.get(`
166
+ `)&&(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>ue.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("")}}},ep=(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)},lr=class e{static Encoding=ep(["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}},Vi=class extends lr{constructor(t=null){super(),this.bytes=t}getEncoding(){return lr.Encoding.UTF_8}asCharSequence(){return Oe.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},el=class extends lr{constructor(t=null){super(),this.charSequence=t}getEncoding(){return lr.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(t=>t.codePointAt(0))}length(){return this.charSequence.length}},cs=class{static utf16(t){return new el(t)}static utf8(t){return Array.isArray(t)?new Vi(t):new Vi(Oe.stringToUtf8ByteArray(t))}},Un=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},tl=class extends Un{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 Un.EOF();let n=this.bytes[t++]&255;return(n&128)===0?n<<3|1:(n&224)===192?(n=n&31,t>=this.end?Un.EOF():(n=n<<6|this.bytes[t++]&63,n<<3|2)):(n&240)===224?(n=n&15,t+1>=this.end?Un.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?Un.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 Oe.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}},nl=class extends Un{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|Oe.charCount(n)}else return Un.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 Oe.emptyOpContext(n,r)}},Ye=class{static fromUTF8(t,n=0,r=t.length){return new tl(t,n,r)}static fromUTF16(t,n=0,r=t.length){return new nl(t,n,r)}},us=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},je=class extends us{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}},rl=class extends us{constructor(t){super(t),this.name="RE2JSCompileException"}},En=class extends us{constructor(t){super(t),this.name="RE2JSGroupException"}},sl=class extends us{constructor(t){super(t),this.name="RE2JSFlagsException"}},qi=class{static quoteReplacement(t,n=!1){return n?t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(r=>{let s=r.codePointAt(0);return s===P.CODES.get("\\")||s===P.CODES.get("$")?`\\${r}`:r}).join(""):t.indexOf("$")<0?t:t.split("").map(r=>r.codePointAt(0)===P.CODES.get("$")?"$$":r).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 lr?this.resetMatcherInput(n):Array.isArray(n)?this.resetMatcherInput(cs.utf8(n)):this.resetMatcherInput(cs.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 En(`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 En(`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 En(`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 En(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new En("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 En("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,G.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,G.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new En(`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,G.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()?Oe.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.appendReplacementInternalJava(t):this.appendReplacementInternalJs(t),r}appendReplacementInternalJava(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++){if(t.codePointAt(i)===P.CODES.get("\\")){r<i&&(n+=t.substring(r,i)),i++,r=i;continue}if(t.codePointAt(i)===P.CODES.get("$")){let o=t.codePointAt(i+1);if(P.CODES.get("0")<=o&&o<=P.CODES.get("9")){let a=o-P.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<P.CODES.get("0")||o>P.CODES.get("9")||a*10+o-P.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-P.CODES.get("0");if(a>this.patternGroupCount)throw new En(`n > number of groups: ${a}`);let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===P.CODES.get("{")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==P.CODES.get("}")&&t.codePointAt(a)!==P.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==P.CODES.get("}"))throw new En("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}appendReplacementInternalJs(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++)if(t.codePointAt(i)===P.CODES.get("$")){let o=t.codePointAt(i+1);if(P.CODES.get("$")===o){r<i&&(n+=t.substring(r,i)),n+="$",i++,r=i+1;continue}else if(P.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(P.CODES.get("1")<=o&&o<=P.CODES.get("9")){let a=o-P.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<P.CODES.get("0")||o>P.CODES.get("9")||a*10+o-P.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-P.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===P.CODES.get("<")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==P.CODES.get(">")&&t.codePointAt(a)!==P.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==P.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}},he=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+=Oe.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&G.FOLD_CASE)!==0?ue.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&G.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")}}},il=class{constructor(){this.inst=null,this.cap=[]}},Zi=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}},Qs=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new Zi(n.prog.numInst()),n.q1=new Zi(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?Oe.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(t){let n;return this.poolSize>0?(this.poolSize--,n=this.pool[this.poolSize]):n=new il,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===Oe.EMPTY_ALL||(r===G.ANCHOR_START||r===G.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!==Un.EOF()&&(a=t.step(n+c),u=a>>3,f=a&7);let p;for(n===0?p=Oe.emptyOpContext(-1,l):p=t.context(n);;){if(i.isEmpty()){if((s&Oe.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===G.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=n),this.add(i,this.prog.start,n,this.matchcap,p,null));let h=n+c;if(p=t.context(h),this.step(i,o,n,h,l,p,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 d=i;i=o,o=d}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 p=f.inst,h=!1;switch(p.op){case he.MATCH:if(a===G.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 he.RUNE:h=p.matchRune(i);break;case he.RUNE1:h=i===p.runes[0];break;case he.RUNE_ANY:h=!0;break;case he.RUNE_ANY_NOT_NL:h=i!==P.CODES.get(`
167
+ `);break;default:throw new Error("bad inst")}h&&(f=this.add(n,p.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 he.FAIL:break;case he.ALT:case he.ALT_MATCH:o=this.add(t,l.out,r,s,i,o),o=this.add(t,l.arg,r,s,i,o);break;case he.EMPTY_WIDTH:(l.arg&~i)===0&&(o=this.add(t,l.out,r,s,i,o));break;case he.NOP:o=this.add(t,l.out,r,s,i,o);break;case he.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 he.MATCH:case he.RUNE:case he.RUNE1:case he.RUNE_ANY:case he.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}},T3=e=>{let t=-2128831035;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return t},R3=(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},ol=class{constructor(t,n){this.nfaStates=t,this.isMatch=n,this.nextAscii=new Array(ue.MAX_ASCII+1).fill(null),this.nextMap=new Map}},al=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 he.MATCH:s=!0;break;case he.ALT:case he.ALT_MATCH:r.push(a.out),r.push(a.arg);break;case he.NOP:case he.CAPTURE:r.push(a.out);break;case he.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=T3(r),i=this.stateCache.get(s);if(i)for(let a=0;a<i.length;a++){let l=i[a];if(R3(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 ol(r,n.isMatch);return i.push(o),this.stateCount++,o}step(t,n,r){if(r===G.UNANCHORED&&n<=ue.MAX_ASCII){let o=t.nextAscii[n];if(o!==null)return o}else{let o=n+(r===G.UNANCHORED?0:ue.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);he.isRuneOp(l.op)&&l.matchRune(n)&&s.push(l.out)}r===G.UNANCHORED&&s.push(this.prog.start);let i=this.getState(s);if(r===G.UNANCHORED&&n<=ue.MAX_ASCII)t.nextAscii[n]=i;else{let o=n+(r===G.UNANCHORED?0:ue.MAX_RUNE+1);t.nextMap.set(o,i)}return i}match(t,n,r){if((r===G.ANCHOR_START||r===G.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===G.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===G.ANCHOR_BOTH){if(o+c===s)return!0}else return!0;if(i.nfaStates.length===0&&r!==G.UNANCHORED)return!1;o+=c}return!1}},_=class e{static Op=ep(["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===P.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&G.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&G.FOLD_CASE)!==0&&(t+="(?i:");for(let n of this.runes)t+=Oe.escapeRune(n);(this.flags&G.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&G.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]===ue.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+=Oe.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=Oe.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+=Oe.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=Oe.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&G.WAS_DOLLAR)!==(t.flags&G.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&G.NON_GREEDY)!==(t.flags&G.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.REPEAT:{if((this.flags&G.NON_GREEDY)!==(t.flags&G.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}},ll=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 he(t))}skipNop(t){let n=this.inst[t];for(;n.op===he.NOP||n.op===he.CAPTURE;)n=this.inst[t],t=n.out;return n}prefix(){let t="",n=this.skipNop(this.start);if(!he.isRuneOp(n.op)||n.runes.length!==1)return[n.op===he.MATCH,t];for(;he.isRuneOp(n.op)&&n.runes.length===1&&(n.arg&G.FOLD_CASE)===0;)t+=String.fromCodePoint(n.runes[0]),n=this.skipNop(n.out);return[n.op===he.MATCH,t]}startCond(){let t=0,n=this.start;e:for(;;){let r=this.inst[n];switch(r.op){case he.EMPTY_WIDTH:t|=r.arg;break;case he.FAIL:return-1;case he.CAPTURE:case he.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+=`
168
+ `}return t}},ls=class{constructor(t=0,n=0,r=!1){this.i=t,this.out=n,this.nullable=r}},cl=class e{static ANY_RUNE_NOT_NL(){return[0,P.CODES.get(`
169
+ `)-1,P.CODES.get(`
170
+ `)+1,ue.MAX_RUNE]}static ANY_RUNE(){return[0,ue.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(he.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new ll,this.newInst(he.FAIL)}newInst(t){return this.prog.addInst(t),new ls(this.prog.numInst()-1,0,!0)}nop(){let t=this.newInst(he.NOP);return t.out=t.i<<1,t}fail(){return new ls}cap(t){let n=this.newInst(he.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 ls(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(he.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(he.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(he.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 ls(t.i,this.loop(t,n).out,t.nullable)}empty(t){let n=this.newInst(he.EMPTY_WIDTH);return this.prog.getInst(n.i).arg=t,n.out=n.i<<1,n}rune(t,n){let r=this.newInst(he.RUNE);r.nullable=!1;let s=this.prog.getInst(r.i);return s.runes=t,n&=G.FOLD_CASE,(t.length!==1||ue.simpleFold(t[0])===t[0])&&(n&=-2),s.arg=n,r.out=r.i<<1,(n&G.FOLD_CASE)===0&&t.length===1||t.length===2&&t[0]===t[1]?s.op=he.RUNE1:t.length===2&&t[0]===0&&t[1]===ue.MAX_RUNE?s.op=he.RUNE_ANY:t.length===4&&t[0]===0&&t[1]===P.CODES.get(`
171
+ `)-1&&t[2]===P.CODES.get(`
172
+ `)+1&&t[3]===ue.MAX_RUNE&&(s.op=he.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case _.Op.NO_MATCH:return this.fail();case _.Op.EMPTY_MATCH:return this.nop();case _.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 _.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case _.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case _.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case _.Op.BEGIN_LINE:return this.empty(Oe.EMPTY_BEGIN_LINE);case _.Op.END_LINE:return this.empty(Oe.EMPTY_END_LINE);case _.Op.BEGIN_TEXT:return this.empty(Oe.EMPTY_BEGIN_TEXT);case _.Op.END_TEXT:return this.empty(Oe.EMPTY_END_TEXT);case _.Op.WORD_BOUNDARY:return this.empty(Oe.EMPTY_WORD_BOUNDARY);case _.Op.NO_WORD_BOUNDARY:return this.empty(Oe.EMPTY_NO_WORD_BOUNDARY);case _.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 _.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case _.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case _.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case _.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 _.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 rl("regexp: unhandled case in compile")}}},ul=class e{static simplify(t){if(t===null)return null;switch(t.op){case _.Op.CAPTURE:case _.Op.CONCAT:case _.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=_.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case _.Op.STAR:case _.Op.PLUS:case _.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case _.Op.REPEAT:{if(t.min===0&&t.max===0)return new _(_.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(_.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(_.Op.PLUS,t.flags,n,null);let s=new _(_.Op.CONCAT),i=[];for(let o=0;o<t.min-1;o++)i.push(n);return i.push(e.simplify1(_.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(_.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let o=new _(_.Op.CONCAT);o.subs=[n,s],s=e.simplify1(_.Op.QUEST,t.flags,o,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new _(_.Op.CONCAT);return s.subs=r.slice(0),s}return new _(_.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===_.Op.EMPTY_MATCH||t===r.op&&(n&G.NON_GREEDY)===(r.flags&G.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&G.NON_GREEDY)===(n&G.NON_GREEDY)&&r===s.subs[0]||(s=new _(t),s.flags=n,s.subs=[r]),s)}},$e=class{constructor(t,n){this.sign=t,this.cls=n}},_1=[48,57],F1=[9,10,12,13,32,32],L1=[48,57,65,90,95,95,97,122],M1=new Map([["\\d",new $e(1,_1)],["\\D",new $e(-1,_1)],["\\s",new $e(1,F1)],["\\S",new $e(-1,F1)],["\\w",new $e(1,L1)],["\\W",new $e(-1,L1)]]),U1=[48,57,65,90,97,122],B1=[65,90,97,122],W1=[0,127],z1=[9,9,32,32],H1=[0,31,127,127],j1=[48,57],G1=[33,126],V1=[97,122],q1=[32,126],Z1=[33,47,58,64,91,96,123,126],K1=[9,13,32,32],Q1=[65,90],X1=[48,57,65,90,95,95,97,122],Y1=[48,57,65,70,97,102],J1=new Map([["[:alnum:]",new $e(1,U1)],["[:^alnum:]",new $e(-1,U1)],["[:alpha:]",new $e(1,B1)],["[:^alpha:]",new $e(-1,B1)],["[:ascii:]",new $e(1,W1)],["[:^ascii:]",new $e(-1,W1)],["[:blank:]",new $e(1,z1)],["[:^blank:]",new $e(-1,z1)],["[:cntrl:]",new $e(1,H1)],["[:^cntrl:]",new $e(-1,H1)],["[:digit:]",new $e(1,j1)],["[:^digit:]",new $e(-1,j1)],["[:graph:]",new $e(1,G1)],["[:^graph:]",new $e(-1,G1)],["[:lower:]",new $e(1,V1)],["[:^lower:]",new $e(-1,V1)],["[:print:]",new $e(1,q1)],["[:^print:]",new $e(-1,q1)],["[:punct:]",new $e(1,Z1)],["[:^punct:]",new $e(-1,Z1)],["[:space:]",new $e(1,K1)],["[:^space:]",new $e(-1,K1)],["[:upper:]",new $e(1,Q1)],["[:^upper:]",new $e(-1,Q1)],["[:word:]",new $e(1,X1)],["[:^word:]",new $e(-1,X1)],["[:xdigit:]",new $e(1,Y1)],["[:^xdigit:]",new $e(-1,Y1)]]),Mn=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=Oe.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&G.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<=ue.MIN_FOLD&&n>=ue.MAX_FOLD)return this.appendRange(t,n);if(n<ue.MIN_FOLD||t>ue.MAX_FOLD)return this.appendRange(t,n);t<ue.MIN_FOLD&&(this.appendRange(t,ue.MIN_FOLD-1),t=ue.MIN_FOLD),n>ue.MAX_FOLD&&(this.appendRange(ue.MAX_FOLD+1,n),n=ue.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=ue.simpleFold(r);s!==r;s=ue.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<=ue.MAX_RUNE&&this.appendRange(n,ue.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<=ue.MAX_RUNE&&this.appendRange(n,ue.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<=ue.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=ue.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)}},Xs=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},fl=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+=Oe.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()}},pl=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 k(new Uint32Array([0,ue.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?Xs.of(e.ANY_TABLE,e.ANY_TABLE):fn.CATEGORIES.has(t)?Xs.of(fn.CATEGORIES.get(t),fn.FOLD_CATEGORIES.get(t)):fn.SCRIPTS.has(t)?Xs.of(fn.SCRIPTS.get(t),fn.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<ue.MIN_FOLD||t>ue.MAX_FOLD)return t;let n=t,r=t;for(t=ue.simpleFold(t);t!==r;t=ue.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===_.Op.EMPTY_MATCH)return null;if(t.op===_.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===_.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new _(_.Op.LITERAL);return r.flags=n,r.runes=Oe.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 je(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&ue.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!==P.CODES.get("_")&&!Oe.isalnum(r))return!1}return!0}static parseInt(t){let n=t.pos();for(;t.more()&&t.peek()>=P.CODES.get("0")&&t.peek()<=P.CODES.get("9");)t.skip(1);let r=t.from(n);return r.length===0||r.length>1&&r.codePointAt(0)===P.CODES.get("0")?-1:r.length>8?-2:parseFloat(r,10)}static isCharClass(t){return t.op===_.Op.LITERAL&&t.runes.length===1||t.op===_.Op.CHAR_CLASS||t.op===_.Op.ANY_CHAR_NOT_NL||t.op===_.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case _.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case _.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 _.Op.ANY_CHAR_NOT_NL:return n!==P.CODES.get(`
173
+ `);case _.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case _.Op.ANY_CHAR:break;case _.Op.ANY_CHAR_NOT_NL:e.matchRune(n,P.CODES.get(`
174
+ `))&&(t.op=_.Op.ANY_CHAR);break;case _.Op.CHAR_CLASS:n.op===_.Op.LITERAL?t.runes=new Mn(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new Mn(t.runes).appendClass(n.runes).toArray();break;case _.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=_.Op.CHAR_CLASS,t.runes=new Mn().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 je(e.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case P.CODES.get("1"):case P.CODES.get("2"):case P.CODES.get("3"):case P.CODES.get("4"):case P.CODES.get("5"):case P.CODES.get("6"):case P.CODES.get("7"):if(!t.more()||t.peek()<P.CODES.get("0")||t.peek()>P.CODES.get("7"))break;case P.CODES.get("0"):{let s=r-P.CODES.get("0");for(let i=1;i<3&&!(!t.more()||t.peek()<P.CODES.get("0")||t.peek()>P.CODES.get("7"));i++)s=s*8+t.peek()-P.CODES.get("0"),t.skip(1);return s}case P.CODES.get("x"):{if(!t.more())break;if(r=t.pop(),r===P.CODES.get("{")){let o=0,a=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===P.CODES.get("}"))break;let l=Oe.unhex(r);if(l<0||(a=a*16+l,a>ue.MAX_RUNE))break e;o++}if(o===0)break e;return a}let s=Oe.unhex(r);if(!t.more())break;r=t.pop();let i=Oe.unhex(r);if(s<0||i<0)break;return s*16+i}case P.CODES.get("a"):return P.CODES.get("\x07");case P.CODES.get("f"):return P.CODES.get("\f");case P.CODES.get("n"):return P.CODES.get(`
175
+ `);case P.CODES.get("r"):return P.CODES.get("\r");case P.CODES.get("t"):return P.CODES.get(" ");case P.CODES.get("v"):return P.CODES.get("\v");default:if(r<=ue.MAX_ASCII&&!Oe.isalnum(r))return r;break}throw new je(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new je(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 _(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 je(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===_.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 je(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 _.Op.LITERAL:{r=t.runes.length;break}case _.Op.CAPTURE:case _.Op.STAR:{r=2+this.calcSize(t.subs[0]);break}case _.Op.PLUS:case _.Op.QUEST:{r=1+this.calcSize(t.subs[0]);break}case _.Op.CONCAT:{for(let s of t.subs)r=r+this.calcSize(s);break}case _.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 _.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 je(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&&!_.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===_.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=_.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===_.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&ue.simpleFold(t.runes[0])===t.runes[2]&&ue.simpleFold(t.runes[2])===t.runes[0]||t.op===_.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&ue.simpleFold(t.runes[0])===t.runes[1]&&ue.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|G.FOLD_CASE))return null;t.op=_.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|G.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!==_.Op.LITERAL||i.op!==_.Op.LITERAL||(s.flags&G.FOLD_CASE)!==(i.flags&G.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(_.Op.LITERAL);return r.flags=n,(n&G.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&G.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=G.NON_GREEDY),o!==-1))throw new je(e.ERR_INVALID_REPEAT_OP,i.from(o));let l=this.stack.length;if(l===0)throw new je(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let c=this.stack[l-1];if(_.isPseudoOp(c.op))throw new je(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===_.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new je(e.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===_.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(_.Op.EMPTY_MATCH)):this.push(this.collapse(t,_.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(_.Op.NO_MATCH)):this.push(this.collapse(t,_.Op.ALTERNATE))}cleanAlt(t){t.op===_.Op.CHAR_CLASS&&(t.runes=new Mn(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===ue.MAX_RUNE?(t.runes=[],t.op=_.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===P.CODES.get(`
176
+ `)-1&&t.runes[2]===P.CODES.get(`
177
+ `)+1&&t.runes[3]===ue.MAX_RUNE&&(t.runes=[],t.op=_.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===_.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,p=0,h=0;if(u<r){let d=t[n+u];if(d.op===_.Op.CONCAT&&d.subs.length>0&&(d=d.subs[0]),d.op===_.Op.LITERAL&&(f=d.runes,p=d.runes.length,h=d.flags&G.FOLD_CASE),h===a){let m=0;for(;m<o&&m<p&&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 d=this.newRegexp(_.Op.LITERAL);d.flags=a,d.runes=i.slice(0,o);for(let y=l;y<u;y++)t[n+y]=this.removeLeadingString(t[n+y],o),this.checkLimits(t[n+y]);let m=this.collapse(t.slice(n+l,n+u),_.Op.ALTERNATE),g=this.newRegexp(_.Op.CONCAT);g.subs=[d,m],t[s++]=g}l=u,i=f,o=p,a=h}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===_.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 p=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 h=this.collapse(t.slice(n+l,n+u),_.Op.ALTERNATE),d=this.newRegexp(_.Op.CONCAT);d.subs=[p,h],t[s++]=d}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 h=l+1;h<u;h++){let d=t[n+f],m=t[n+h];(d.op<m.op||d.op===m.op&&(d.runes!==null?d.runes.length:0)<(m.runes!==null?m.runes.length:0))&&(f=h)}let p=t[n+l];t[n+l]=t[n+f],t[n+f]=p;for(let h=l+1;h<u;h++)e.mergeCharClass(t[n+l],t[n+h]),this.reuse(t[n+h]);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===_.Op.EMPTY_MATCH&&t[n+u+1].op===_.Op.EMPTY_MATCH||(t[s++]=t[n+u]);return r=s,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===_.Op.CONCAT&&t.subs.length>0){let r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===_.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=_.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===_.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=_.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===_.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=_.Op.EMPTY_MATCH,t.subs=_.emptySubs();break}case 1:{let r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(_.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&G.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,s=new fl(this.wholeRegexp);for(;s.more();){let o=-1;e:switch(s.peek()){case P.CODES.get("("):if((this.flags&G.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(_.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case P.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case P.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case P.CODES.get("^"):(this.flags&G.ONE_LINE)!==0?this.op(_.Op.BEGIN_TEXT):this.op(_.Op.BEGIN_LINE),s.skip(1);break;case P.CODES.get("$"):(this.flags&G.ONE_LINE)!==0?this.op(_.Op.END_TEXT).flags|=G.WAS_DOLLAR:this.op(_.Op.END_LINE),s.skip(1);break;case P.CODES.get("."):(this.flags&G.DOT_NL)!==0?this.op(_.Op.ANY_CHAR):this.op(_.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case P.CODES.get("["):this.parseClass(s);break;case P.CODES.get("*"):case P.CODES.get("+"):case P.CODES.get("?"):{o=s.pos();let a=null;switch(s.pop()){case P.CODES.get("*"):a=_.Op.STAR;break;case P.CODES.get("+"):a=_.Op.PLUS;break;case P.CODES.get("?"):a=_.Op.QUEST;break}this.repeat(a,n,r,o,s,t);break}case P.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&ue.MAX_BMP)<<16>>16,this.repeat(_.Op.REPEAT,n,r,o,s,t);break}case P.CODES.get("\\"):{let a=s.pos();if(s.skip(1),(this.flags&G.PERL_X)!==0&&s.more())switch(s.pop()){case P.CODES.get("A"):this.op(_.Op.BEGIN_TEXT);break e;case P.CODES.get("b"):this.op(_.Op.WORD_BOUNDARY);break e;case P.CODES.get("B"):this.op(_.Op.NO_WORD_BOUNDARY);break e;case P.CODES.get("C"):throw new je(e.ERR_INVALID_ESCAPE,"\\C");case P.CODES.get("Q"):{let f=s.rest(),p=f.indexOf("\\E");p>=0&&(f=f.substring(0,p)),s.skipString(f),s.skipString("\\E");let h=0;for(;h<f.length;){let d=f.codePointAt(h);this.literal(d),h+=Oe.charCount(d)}break e}case P.CODES.get("z"):this.op(_.Op.END_TEXT);break e;default:s.rewindTo(a);break}let l=this.newRegexp(_.Op.CHAR_CLASS);if(l.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){let u=new Mn;if(this.parseUnicodeClass(s,u)){l.runes=u.toArray(),this.push(l);break e}}let c=new Mn;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 je(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 je(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 je(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));let u=this.op(_.Op.LEFT_PAREN);if(u.cap=++this.numCap,this.namedGroups[c])throw new je(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 P.CODES.get("i"):s|=G.FOLD_CASE,o=!0;break;case P.CODES.get("m"):s&=-17,o=!0;break;case P.CODES.get("s"):s|=G.DOT_NL,o=!0;break;case P.CODES.get("U"):s|=G.NON_GREEDY,o=!0;break;case P.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case P.CODES.get(":"):case P.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===P.CODES.get(":")&&this.op(_.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new je(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(_.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===_.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===_.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 je(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let n=this.pop(),r=this.pop();if(r.op!==_.Op.LEFT_PAREN)throw new je(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(n):(r.op=_.Op.CAPTURE,r.subs=[n],this.push(r))}parsePerlClassEscape(t,n){let r=t.pos();if((this.flags&G.PERL_X)===0||!t.more()||t.pop()!==P.CODES.get("\\")||!t.more())return!1;t.pop();let s=t.from(r),i=M1.has(s)?M1.get(s):null;return i===null?!1:(n.appendGroup(i,(this.flags&G.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=J1.has(i)?J1.get(i):null;if(o===null)throw new je(e.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,(this.flags&G.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&G.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let s=1,i=t.pop();if(i===P.CODES.get("P")&&(s=-1),!t.more())throw t.rewindTo(r),new je(e.ERR_INVALID_CHAR_RANGE,t.rest());i=t.pop();let o;if(i!==P.CODES.get("{"))o=Oe.runeToString(i);else{let u=t.rest(),f=u.indexOf("}");if(f<0)throw t.rewindTo(r),new je(e.ERR_INVALID_CHAR_RANGE,t.rest());o=u.substring(0,f),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===P.CODES.get("^")&&(s=0-s,o=o.substring(1));let a=e.unicodeTable(o);if(a===null)throw new je(e.ERR_INVALID_CHAR_RANGE,t.from(r));let l=a.first,c=a.second;if((this.flags&G.FOLD_CASE)===0||c===null)n.appendTableWithSign(l,s);else{let u=new Mn().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(_.Op.CHAR_CLASS);r.flags=this.flags;let s=new Mn,i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),(this.flags&G.CLASS_NL)===0&&s.appendRange(P.CODES.get(`
178
+ `),P.CODES.get(`
179
+ `)));let o=!0;for(;!t.more()||t.peek()!==P.CODES.get("]")||o;){if(t.more()&&t.lookingAt("-")&&(this.flags&G.PERL_X)===0&&!o){let u=t.rest();if(u==="-"||!u.startsWith("-]"))throw t.rewindTo(n),new je(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 je(e.ERR_INVALID_CHAR_RANGE,t.from(a))}(this.flags&G.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)}},hl=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}},dl=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,G.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,G.POSIX,!0)}static compileImpl(t,n,r){let s=pl.parse(t,n),i=s.maxCap();s=ul.simplify(s);let o=cl.compileRegexp(s),a=new e(t,o,i,r),[l,c]=o.prefix();return a.prefixComplete=l,a.prefix=c,a.prefixUTF8=Oe.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 hl,this.dfa=new al(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=Qs.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=Qs.fromMachine(i),o=!0):(i=Qs.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(Ye.fromUTF16(t),0,G.UNANCHORED,0)!==null}matchWithGroup(t,n,r,s,i){return t instanceof lr||(t=cs.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()?Ye.fromUTF16(t.asCharSequence(),0,r):Ye.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(Ye.fromUTF8(t),0,G.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=Ye.fromUTF16(t),l=0;for(;i<=t.length;){let c=this.executeEngine(a,i,G.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,G.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(Ye.fromUTF8(t),0,G.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){let n=this.executeEngine(Ye.fromUTF8(t),0,G.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){let n=this.executeEngine(Ye.fromUTF16(t),0,G.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.executeEngine(Ye.fromUTF16(t),0,G.UNANCHORED,2)}findUTF8Submatch(t){let n=this.executeEngine(Ye.fromUTF8(t),0,G.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(Ye.fromUTF8(t),0,G.UNANCHORED,this.prog.numCap))}findSubmatch(t){let n=this.executeEngine(Ye.fromUTF16(t),0,G.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(Ye.fromUTF16(t),0,G.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){let r=this.allMatches(Ye.fromUTF8(t),n,s=>t.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(t,n){let r=this.allMatches(Ye.fromUTF8(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAll(t,n){let r=this.allMatches(Ye.fromUTF16(t),n,s=>t.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(t,n){let r=this.allMatches(Ye.fromUTF16(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){let r=this.allMatches(Ye.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(Ye.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){let r=this.allMatches(Ye.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(Ye.fromUTF16(t),n);return r.length===0?null:r}},ml=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}},cr=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 Oe.quoteMeta(t)}static quoteReplacement(t,n=!1){return qi.quoteReplacement(t,n)}static translateRegExp(t){return ml.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 sl("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=G.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);let i=new e(t,n);return i.re2Input=dl.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=cs.utf8(t)),new qi(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let n=Array.isArray(t)?Ye.fromUTF8(t):Ye.fromUTF16(t);return this.re2Input.executeEngine(n,0,G.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 P3(e){let t=0;return e.includes("i")&&(t|=cr.CASE_INSENSITIVE),e.includes("m")&&(t|=cr.MULTILINE),e.includes("s")&&(t|=cr.DOTALL),t}function D3(e){return cr.translateRegExp(e)}function Q(e,t=""){return new Ki(e,t)}var Ki,Jn,np=v(()=>{"use strict";tp();Ki=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;_matcher=null;_matcherInput=null;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=""){this._pattern=t,this._flags=n,this._global=n.includes("g"),this._ignoreCase=n.includes("i"),this._multiline=n.includes("m");try{let r=D3(t),s=P3(n);this._re2=cr.compile(r,s)}catch(r){if(r instanceof je){let s=r.message||"",i="";throw s.includes("(?=")||s.includes("(?!")||s.includes("(?<")||s.includes("(?<!")||t.includes("(?=")||t.includes("(?!")||t.includes("(?<=")||t.includes("(?<!")?i=" 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.":(s.includes("backreference")||/\\[1-9]/.test(t))&&(i=" 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}/: ${s}${i}`)}throw r}}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._re2.matcher(t),s=0;for(;r.find(s);){let i=r.group(0)??"";if(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 c=this._re2.matcher(t);return this._global?c.replaceAll(n,!0):c.replaceFirst(n,!0)}let r=[],s=this._re2.matcher(t),i=0,o=0,a=this._re2.groupCount(),l=this._re2.namedGroups();for(;s.find(o);){r.push(t.slice(i,s.start(0)));let c=[],u=s.group(0)??"";for(let f=1;f<=a;f++)c.push(s.group(f));if(c.push(s.start(0)),c.push(t),l&&Object.keys(l).length>0){let f=Object.create(null);for(let[p,h]of Object.entries(l))f[p]=s.group(h)??"";c.push(f)}if(r.push(n(u,...c)),i=s.end(0),o=i,s.start(0)===s.end(0)&&o++,!this._global||o>t.length)break}return r.push(t.slice(i)),r.join("")}split(t,n){return n===void 0||n<0?this._re2.split(t,-1):n===0?[]:this._re2.split(t,-1).slice(0,n)}search(t){let n=this._re2.matcher(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;for(;n.find(i);){let o=[];o.push(n.group(0)??"");for(let l=1;l<=r;l++)o.push(n.group(l));let a=o;if(a.index=n.start(0),a.input=t,s&&Object.keys(s).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(s)){let f=n.group(u);f!==null&&(l[c]=f)}a.groups=l}if(yield a,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}};Jn=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 Ze=v(()=>{"use strict";np()});function Dt(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=Ys.get(i);if(!o){if(o=F3(s,r.ignoreCase),Ys.size>=_3){let a=Ys.keys().next().value;a!==void 0&&Ys.delete(a)}Ys.set(i,o)}return o.test(e)}function F3(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+="$",Q(n,t?"i":"")}var _3,Ys,gl=v(()=>{"use strict";Ze();_3=2048,Ys=new Map});function Qi(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 rp(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 fs(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:p="--",showColumn:h=!1,vimgrep:d=!1,showByteOffset:m=!1,replace:g=null,passthru:y=!1,multiline:b=!1,kResetGroup:w,preFilter:x}=n;if(b)return L3(e,t,{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:p,showColumn:h,showByteOffset:m,replace:g,kResetGroup:w});let A=e.split(`
180
+ `),I=A.length,$=I>0&&A[I-1]===""?I-1:I;if(i||o){let T=0,N=(o||l)&&!r;for(let B=0;B<$;B++){let Z=A[B];if(!(x&&!r&&!Qi(x,Z)))if(t.lastIndex=0,N)for(let oe=t.exec(Z);oe!==null;oe=t.exec(Z))T++,oe[0].length===0&&t.lastIndex++;else t.test(Z)!==r&&T++}return{output:`${a?`${a}:${T}`:String(T)}
181
+ `,matched:T>0,matchCount:T}}if(c===0&&u===0&&!y){let T=[],N=!1,F=0,B=0;for(let Z=0;Z<$&&!(f>0&&F>=f);Z++){let oe=A[Z],ye=null;if(x&&!Qi(x,oe)||(t.lastIndex=0,ye=t.exec(oe)),ye!==null!==r)if(N=!0,F++,l)for(let H=ye;H!==null;H=t.exec(oe)){let te=w!==void 0?H[w]??"":H[0],ve=g!==null?rp(g,H):te,se=a?`${a}:`:"";m&&(se+=`${B+H.index}:`),s&&(se+=`${Z+1}:`),h&&(se+=`${H.index+1}:`),T.push(se+ve),H[0].length===0&&t.lastIndex++}else if(d)for(let H=ye;H!==null;H=t.exec(oe)){let te=a?`${a}:`:"";m&&(te+=`${B+H.index}:`),s&&(te+=`${Z+1}:`),h&&(te+=`${H.index+1}:`),T.push(te+oe),H[0].length===0&&t.lastIndex++}else{let H=ye?ye.index+1:1,te=oe;g!==null&&(t.lastIndex=0,te=t.replace(oe,(...se)=>{if(se[0].length===0)return"";let j=se,Re=se[se.length-1];return typeof Re=="object"&&Re!==null?(j.groups=Re,j.input=se[se.length-2],j.index=se[se.length-3]):(j.input=se[se.length-1],j.index=se[se.length-2]),rp(g,j)}));let ve=a?`${a}:`:"";m&&(ve+=`${B+(ye?ye.index:0)}:`),s&&(ve+=`${Z+1}:`),h&&(ve+=`${H}:`),T.push(ve+te)}B+=oe.length+1}return{output:T.length>0?`${T.join(`
182
+ `)}
183
+ `:"",matched:N,matchCount:F}}if(y){let T=[],N=!1,F=0;for(let B=0;B<$;B++){let Z=A[B],oe;x&&!Qi(x,Z)?oe=!1:(t.lastIndex=0,oe=t.test(Z));let ye=oe!==r;ye&&(N=!0,F++);let V=ye?":":"-",H=a?`${a}${V}`:"";s&&(H+=`${B+1}${V}`),T.push(H+Z)}return{output:T.length>0?`${T.join(`
184
+ `)}
185
+ `:"",matched:N,matchCount:F}}let D=[],R=0,L=new Set,C=-1,O=[];for(let T=0;T<$&&!(f>0&&R>=f);T++){let N=A[T],F;x&&!Qi(x,N)?F=!1:(t.lastIndex=0,F=t.test(N)),F!==r&&(O.push(T),R++)}for(let T of O){let N=Math.max(0,T-c);C>=0&&N>C+1&&D.push(p);for(let B=N;B<T;B++)if(!L.has(B)){L.add(B),C=B;let Z=A[B];s&&(Z=`${B+1}-${Z}`),a&&(Z=`${a}-${Z}`),D.push(Z)}if(!L.has(T)){L.add(T),C=T;let B=A[T];if(l){t.lastIndex=0;for(let Z=t.exec(B);Z!==null;Z=t.exec(B)){let oe=w!==void 0?Z[w]??"":Z[0],ye=g!==null?g:oe,V=a?`${a}:`:"";s&&(V+=`${T+1}:`),h&&(V+=`${Z.index+1}:`),D.push(V+ye),Z[0].length===0&&t.lastIndex++}}else{let Z=B;s&&(Z=`${T+1}:${Z}`),a&&(Z=`${a}:${Z}`),D.push(Z)}}let F=Math.min($-1,T+u);for(let B=T+1;B<=F;B++)if(!L.has(B)){L.add(B),C=B;let Z=A[B];s&&(Z=`${B+1}-${Z}`),a&&(Z=`${a}-${Z}`),D.push(Z)}}return{output:D.length>0?`${D.join(`
186
+ `)}
187
+ `:"",matched:R>0,matchCount:R}}function L3(e,t,n){let{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:p,showColumn:h,showByteOffset:d,replace:m,kResetGroup:g}=n,y=e.split(`
188
+ `),b=y.length,w=b>0&&y[b-1]===""?b-1:b,x=[0];for(let C=0;C<e.length;C++)e[C]===`
189
+ `&&x.push(C+1);let A=C=>{let O=0;for(let T=0;T<x.length&&!(x[T]>C);T++)O=T;return O},I=C=>{let O=A(C);return C-x[O]+1},$=[];t.lastIndex=0;for(let C=t.exec(e);C!==null&&!(f>0&&$.length>=f);C=t.exec(e)){let O=A(C.index),T=A(C.index+Math.max(0,C[0].length-1)),N=g!==void 0?C[g]??"":C[0];$.push({startLine:O,endLine:T,byteOffset:C.index,column:I(C.index),matchText:N}),C[0].length===0&&t.lastIndex++}if(i||o){let C;if(o)C=r?0:$.length;else{let T=new Set;for(let N of $)for(let F=N.startLine;F<=N.endLine;F++)T.add(F);C=r?w-T.size:T.size}return{output:`${a?`${a}:${C}`:String(C)}
190
+ `,matched:C>0,matchCount:C}}if(r){let C=new Set;for(let T of $)for(let N=T.startLine;N<=T.endLine;N++)C.add(N);let O=[];for(let T=0;T<w;T++)if(!C.has(T)){let N=y[T];s&&(N=`${T+1}:${N}`),a&&(N=`${a}:${N}`),O.push(N)}return{output:O.length>0?`${O.join(`
191
+ `)}
192
+ `:"",matched:O.length>0,matchCount:O.length}}if($.length===0)return{output:"",matched:!1,matchCount:0};let D=new Set,R=-1,L=[];for(let C of $){let O=Math.max(0,C.startLine-c),T=Math.min(w-1,C.endLine+u);R>=0&&O>R+1&&L.push(p);for(let N=O;N<C.startLine;N++)if(!D.has(N)){D.add(N),R=N;let F=y[N];s&&(F=`${N+1}-${F}`),a&&(F=`${a}-${F}`),L.push(F)}if(l){let N=m!==null?m:C.matchText,F=a?`${a}:`:"";d&&(F+=`${C.byteOffset}:`),s&&(F+=`${C.startLine+1}:`),h&&(F+=`${C.column}:`),L.push(F+N);for(let B=C.startLine;B<=C.endLine;B++)D.add(B),R=B}else for(let N=C.startLine;N<=C.endLine&&N<w;N++)if(!D.has(N)){D.add(N),R=N;let F=y[N];m!==null&&N===C.startLine&&(t.lastIndex=0,F=t.replace(F,m));let B=a?`${a}:`:"";d&&N===C.startLine&&(B+=`${C.byteOffset}:`),s&&(B+=`${N+1}:`),h&&N===C.startLine&&(B+=`${C.column}:`),L.push(B+F)}for(let N=C.endLine+1;N<=T;N++)if(!D.has(N)){D.add(N),R=N;let F=y[N];s&&(F=`${N+1}-${F}`),a&&(F=`${a}-${F}`),L.push(F)}}return{output:L.length>0?`${L.join(`
193
+ `)}
194
+ `:"",matched:!0,matchCount:$.length}}var sp=v(()=>{"use strict"});function ip(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=M3.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 Js(e,t){let n,r;switch(t.mode){case"fixed":n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(n=ip(e),n=n.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),t.mode==="perl"){n=z3(n),n=H3(n),n=j3(n);let a=Z3(n);n=a.pattern,r=a.kResetGroup}break}default:n=ip(e),n=X3(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=U3(n,t.ignoreCase??!1);return{regex:Q(n,i),kResetGroup:r,preFilter:o??void 0}}function U3(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=B3(n);if(r===null)return null;let s=[];for(let i of r){let o=W3(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 B3(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 W3(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="\\"){let s=e[n+1];if(s===void 0||/[dDwWsSbBAZzGQE0-9ckpPNXRxuU]/.test(s))return null;s==="n"?t+=`
195
+ `:s==="t"?t+=" ":s==="r"?t+="\r":s==="f"?t+="\f":s==="v"?t+="\v":t+=s,n++;continue}if(/[.*+?^${}()|[\]]/.test(r))return null;t+=r}return t}function z3(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 H3(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function j3(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=G3(e,n);if(l!==-1){let c=e.slice(a+1,l),u=V3(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 G3(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 V3(e,t,n){let r=e;return t.includes("i")&&(r=q3(r)),r}function q3(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 Z3(e){let t=K3(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),s=Q3(n);return{pattern:`(?:${n})(${r})`,kResetGroup:s+1}}function K3(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 Q3(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 yl(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 X3(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 M3,op=v(()=>{"use strict";Ze();M3=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 wl=v(()=>{"use strict";sp();op()});var Yi={};ee(Yi,{egrepCommand:()=>t8,egrepFlagsForFuzzing:()=>s8,fgrepCommand:()=>e8,fgrepFlagsForFuzzing:()=>r8,flagsForFuzzing:()=>n8,grepCommand:()=>bl});async function lp(e,t,n,r,s=0){if(s>=ap)return;let i=n.fs.resolvePath(n.cwd,e);try{if(!(await n.fs.stat(i)).isDirectory){let l=e.split("/").pop()||"";if(t){let c=t.replace(/^\//,"");Dt(l,c,{stripQuotes:!0})&&r.push(e)}return}let a=await n.fs.readdir(i);for(let l of a){let c=e==="."?l:`${e}/${l}`,u=n.fs.resolvePath(n.cwd,c);if((await n.fs.stat(u)).isDirectory)await lp(c,t,n,r,s+1);else if(t){let p=t.replace(/^\//,"");Dt(l,p,{stripQuotes:!0})&&r.push(c)}}}catch{}}async function J3(e,t){let n=[],r=e.lastIndexOf("/"),s,i;if(r===-1?(s=t.cwd,i=e):(s=e.slice(0,r)||"/",i=e.slice(r+1)),e.includes("**")){let a=[],l=e.split("**"),c=l[0].replace(/\/$/,"")||".",u=l[1]||"";return await lp(c,u,t,a),a.map(f=>({path:f}))}let o=t.fs.resolvePath(t.cwd,s);try{if(t.fs.readdirWithFileTypes){let a=await t.fs.readdirWithFileTypes(o);for(let l of a)if(Dt(l.name,i,{stripQuotes:!0})){let c=r===-1?l.name:`${s}/${l.name}`;n.push({path:c,isFile:l.isFile})}}else{let a=await t.fs.readdir(o);for(let l of a)if(Dt(l,i,{stripQuotes:!0})){let c=r===-1?l:`${s}/${l}`;n.push({path:c})}}}catch{}return n.sort((a,l)=>a.path.localeCompare(l.path))}async function Xi(e,t,n=[],r=[],s=[],i,o=0){if(o>=ap)return[];let a=t.fs.resolvePath(t.cwd,e),l=[];try{let c,u;if(i!==void 0)c=i,u=!i;else{let p=await t.fs.stat(a);c=p.isFile,u=p.isDirectory}if(c){let p=e.split("/").pop()||e;return r.length>0&&r.some(h=>Dt(p,h,{stripQuotes:!0}))?[]:n.length>0&&!n.some(h=>Dt(p,h,{stripQuotes:!0}))?[]:[{path:e,isFile:!0}]}if(!u)return[];let f=e.split("/").pop()||e;if(s.length>0&&s.some(p=>Dt(f,p,{stripQuotes:!0})))return[];if(t.fs.readdirWithFileTypes){let p=await t.fs.readdirWithFileTypes(a);for(let h of p){if(h.name.startsWith("."))continue;let d=e==="."?h.name:`${e}/${h.name}`,m=await Xi(d,t,n,r,s,h.isFile,o+1);l.push(...m)}}else{let p=await t.fs.readdir(a);for(let h of p){if(h.startsWith("."))continue;let d=e==="."?h:`${e}/${h}`,m=await Xi(d,t,n,r,s,void 0,o+1);l.push(...m)}}}catch{}return l}var Y3,bl,ap,e8,t8,n8,r8,s8,Ji=v(()=>{"use strict";ge();gl();ie();wl();Y3={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",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"," --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"]},bl={name:"grep",async execute(e,t){if(U(e))return M(Y3);let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,d=!1,m=!1,g=!1,y=0,b=0,w=0,x=[],A=[],I=[],$=null,D=[];for(let H=0;H<e.length;H++){let te=e[H];if(te.startsWith("-")&&te!=="-"){if(te==="-e"&&H+1<e.length){$=e[++H];continue}if(te.startsWith("--include=")){x.push(te.slice(10));continue}if(te.startsWith("--exclude=")){A.push(te.slice(10));continue}if(te.startsWith("--exclude-dir=")){I.push(te.slice(14));continue}if(te.startsWith("--max-count=")){y=parseInt(te.slice(12),10);continue}let ve=te.match(/^-m(\d+)$/);if(ve){y=parseInt(ve[1],10);continue}if(te==="-m"&&H+1<e.length){y=parseInt(e[++H],10);continue}let se=te.match(/^-([ABC])(\d+)$/);if(se){let j=parseInt(se[2],10);se[1]==="A"?w=j:se[1]==="B"?b=j:se[1]==="C"&&(b=j,w=j);continue}if((te==="-A"||te==="-B"||te==="-C")&&H+1<e.length){let j=parseInt(e[++H],10);te==="-A"?w=j:te==="-B"?b=j:(b=j,w=j);continue}let Pe=te.startsWith("--")?[te]:te.slice(1).split("");for(let j of Pe)if(j==="i"||j==="--ignore-case")n=!0;else if(j==="n"||j==="--line-number")r=!0;else if(j==="v"||j==="--invert-match")s=!0;else if(j==="c"||j==="--count")i=!0;else if(j==="l"||j==="--files-with-matches")o=!0;else if(j==="L"||j==="--files-without-match")a=!0;else if(j==="r"||j==="R"||j==="--recursive")l=!0;else if(j==="w"||j==="--word-regexp")c=!0;else if(j==="x"||j==="--line-regexp")u=!0;else if(j==="E"||j==="--extended-regexp")f=!0;else if(j==="P"||j==="--perl-regexp")p=!0;else if(j==="F"||j==="--fixed-strings")h=!0;else if(j==="o"||j==="--only-matching")d=!0;else if(j==="h"||j==="--no-filename")m=!0;else if(j==="q"||j==="--quiet"||j==="--silent")g=!0;else{if(j.startsWith("--"))return K("grep",j);if(j.length===1)return K("grep",`-${j}`)}}else $===null?$=te:D.push(te)}if($===null)return{stdout:"",stderr:`grep: missing pattern
196
+ `,exitCode:2};let R=h?"fixed":f?"extended":p?"perl":"basic",L,C,O;try{let H=Js($,{mode:R,ignoreCase:n,wholeWord:c,lineRegexp:u});L=H.regex,C=H.kResetGroup,O=H.preFilter}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${$}
197
+ `,exitCode:2}}if(D.length===0&&t.stdin!==void 0){let H=fs(ae(t.stdin),L,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:"",onlyMatching:d,beforeContext:b,afterContext:w,maxCount:y,kResetGroup:C,preFilter:O});return g?{stdout:"",stderr:"",exitCode:H.matched?0:1}:{stdout:H.output,stderr:"",exitCode:H.matched?0:1}}if(D.length===0)return{stdout:"",stderr:`grep: no input files
198
+ `,exitCode:2};let T="",N="",F=!1,B=!1,Z=[];for(let H of D)if(H.includes("*")||H.includes("?")||H.includes("[")){let te=await J3(H,t);if(l)for(let ve of te){let se=await Xi(ve.path,t,x,A,I,ve.isFile);Z.push(...se)}else Z.push(...te)}else if(l){let te=await Xi(H,t,x,A,I);Z.push(...te)}else Z.push({path:H});let oe=(Z.length>1||l)&&!m,ye=50;for(let H=0;H<Z.length;H+=ye){let te=Z.slice(H,H+ye),ve=await Promise.all(te.map(async se=>{let Pe=se.path,j=Pe.split("/").pop()||Pe;if(A.length>0&&!l&&A.some(Re=>Dt(j,Re,{stripQuotes:!0}))||x.length>0&&!l&&!x.some(Re=>Dt(j,Re,{stripQuotes:!0})))return null;try{let Re=t.fs.resolvePath(t.cwd,Pe),Qe=!1;if(se.isFile===void 0?Qe=(await t.fs.stat(Re)).isDirectory:Qe=!se.isFile,Qe)return l?null:{error:`grep: ${Pe}: Is a directory
199
+ `};let pt=await t.fs.readFile(Re),ht=fs(pt,L,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:oe?Pe:"",onlyMatching:d,beforeContext:b,afterContext:w,maxCount:y,kResetGroup:C,preFilter:O});return{file:Pe,result:ht}}catch{return{error:`grep: ${Pe}: No such file or directory
200
+ `}}}));for(let se of ve){if(se===null)continue;if("error"in se&&se.error){N+=se.error,se.error.includes("Is a directory")||(B=!0);continue}if(!("file"in se)||!se.result)continue;let{file:Pe,result:j}=se;if(j.matched){if(F=!0,g)return{stdout:"",stderr:"",exitCode:0};o?T+=`${Pe}
201
+ `:a||(T+=j.output)}else a?T+=`${Pe}
202
+ `:i&&!o&&(T+=j.output)}}let V;return B?V=2:a?V=T.length>0?0:1:V=F?0:1,g?{stdout:"",stderr:"",exitCode:V}:{stdout:T,stderr:N,exitCode:V}}},ap=256;e8={name:"fgrep",async execute(e,t){return bl.execute(["-F",...e],t)}},t8={name:"egrep",async execute(e,t){return bl.execute(["-E",...e],t)}},n8={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"}],stdinType:"text",needsArgs:!0},r8={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},s8={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function up(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 _e(e){return!cp.has(e)}function ze(e,t,n){up(e,"safeSet"),_e(t)&&(e[t]=n)}function Bn(e,t){return up(e,"safeHasOwn"),Object.hasOwn(e,t)}function ps(e){let t=new WeakMap,n=r=>{if(r===null||typeof r!="object"||r instanceof Date)return r;let s=t.get(r);if(s!==void 0)return s;if(Array.isArray(r)){let o=[];t.set(r,o);for(let a of r)o.push(n(a));return o}let i=Object.create(null);t.set(r,i);for(let o of Object.keys(r))i[o]=n(r[o]);return i};return n(e)}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function fp(e){return Object.assign(Object.create(null),e)}function wt(e){return Object.assign(Object.create(null),e)}function xl(...e){return Object.assign(Object.create(null),...e)}var cp,TN,An=v(()=>{"use strict";cp=new Set(["__proto__","constructor","prototype"]),TN=new Set([...cp,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function hp(){let e=[];for(let[t,n]of Object.entries(pp).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(`
203
+ `)}
204
+ `}var pp,ei,El=v(()=>{"use strict";Ze();An();pp=fp({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:[]}}),ei=class{types;constructor(){this.types=new Map(Object.entries(pp).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(Q(`^${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(Q(`^${i}$`,"i").test(t))return!0}else if(n===s.toLowerCase())return!0}return!1}}});function dp(){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:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var mp=v(()=>{"use strict"});function i8(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 o8(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
205
+ `,exitCode:1}}function gp(e){return null}function c8(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function u8(e,t,n){let r=e[t];for(let s of yp){if(r.startsWith(`--${s.long}=`)){let i=r.slice(`--${s.long}=`.length),o=eo(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=eo(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=eo(n,s,i);return o?{newIndex:t+1,error:o}:{newIndex:t+1}}}return null}function f8(e){return yp.find(t=>t.short===e)}function eo(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 p8(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 h8(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 d8(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function wp(e){let t=dp(),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=h8(e,l);if(u){let{flag:g,value:y,newIndex:b}=u;g==="A"?s=Math.max(s,y):g==="B"?i=Math.max(i,y):o=y,l=b;continue}let f=d8(c);if(f!==null){t.maxCount=f;continue}let p=u8(e,l,t);if(p){if(p.error)return{success:!1,error:p.error};l=p.newIndex;continue}let h=p8(e,l);if(h){t.sort=h.value,l=h.newIndex;continue}let d=c.startsWith("--")?[c]:c.slice(1).split(""),m=!1;for(let g of d){if(l8.has(g)){t.lineNumber=!0,a=!0;continue}if(g==="u"||g==="--unrestricted"){c8(t);continue}if(g==="P"||g==="--pcre2")return{success:!1,error:{stdout:"",stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
206
+ `,exitCode:1}};if(g.length===1){let b=f8(g);if(b){if(l+1>=e.length)return{success:!1,error:K("rg",`-${g}`)};let w=eo(t,b,e[l+1]);if(w)return{success:!1,error:w};l++,m=!0;continue}}let y=a8.get(g);if(y){y(t);continue}if(g.startsWith("--"))return{success:!1,error:K("rg",g)};if(g.length===1)return{success:!1,error:K("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 yp,a8,l8,bp=v(()=>{"use strict";ie();mp();yp=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:gp},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:gp},{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:parseInt},{long:"max-filesize",target:"maxFilesize",parse:i8,validate:o8},{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}],a8=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}]]),l8=new Set(["n","--line-number"])});function m8(e){return`'${e.replace(/'/g,"'\\''")}'`}function sn(e){return e.map(m8).join(" ")}var Rr=v(()=>{"use strict"});async function Al(e,t,n=!1,r=!1,s=[]){let i=new ni(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 ti,ni,xp=v(()=>{"use strict";Ze();ti=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
207
+ `);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+="(?:/.*)?$",Q(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}},ni=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 ti(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 ti(t);o.parse(i),this.parsers.push(o)}catch{}}}addPatternsFromContent(t,n){let r=new ti(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 g8}from"node:zlib";function y8(e){return e.length>=2&&e[0]===31&&e[1]===139}function w8(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}async function Ep(e){let{ctx:t,options:n,paths:r,explicitLineNumbers:s}=e;for(let g of n.globs){let y=g.startsWith("!")?g.slice(1):g,b=w8(y);if(b)return{stdout:"",stderr:`${b}
208
+ `,exitCode:1}}if(n.files){let g=[...n.patterns,...r];return E8(t,g,n)}let i=[...n.patterns];for(let g of n.patternFiles)try{let y;if(g==="-")y=ae(t.stdin);else{let w=t.fs.resolvePath(t.cwd,g);y=await t.fs.readFile(w)}let b=y.split(`
209
+ `).filter(w=>w.length>0);i.push(...b)}catch{return{stdout:"",stderr:`rg: ${g}: No such file or directory
210
+ `,exitCode:2}}if(i.length===0)return n.patternFiles.length>0?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`rg: no pattern given
211
+ `,exitCode:2};let o=r.length===0?["."]:r,a=b8(n,i),l,c;try{let g=x8(i,n,a);l=g.regex,c=g.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${i.join(", ")}
212
+ `,exitCode:2}}let u=null;n.noIgnore||(u=await Al(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let f=new ei;for(let g of n.typeClear)f.clearType(g);for(let g of n.typeAdd)f.addType(g);let{files:p,singleExplicitFile:h}=await Ap(t,o,n,u,f);if(p.length===0)return{stdout:"",stderr:"",exitCode:1};let d=!n.noFilename&&(n.withFilename||!h||p.length>1),m=n.lineNumber;return s||(h&&p.length===1&&(m=!1),n.onlyMatching&&(m=!1)),C8(t,p,l,n,d,m,c)}function b8(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function x8(e,t,n){let r;return e.length===1?r=e[0]:r=e.map(s=>t.fixedStrings?s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${s})`).join("|"),Js(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 Ap(e,t,n,r,s){let i=[],o=0,a=0;for(let c of t){let u=e.fs.resolvePath(e.cwd,c);try{let f=await e.fs.stat(u);if(f.isFile){if(o++,n.maxFilesize>0&&f.size>n.maxFilesize)continue;Cp(c,n,r,u,s)&&i.push(c)}else f.isDirectory&&(a++,await Sp(e,c,u,0,n,r,s,i))}catch{}}return{files:n.sort==="path"?i.sort():i,singleExplicitFile:o===1&&a===0}}async function Sp(e,t,n,r,s,i,o,a){if(!(r>=s.maxDepth)){i&&await i.loadForDirectory(n);try{let l=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(c=>({name:c,isFile:void 0}));for(let c of l){let u=c.name;if(!s.noIgnore&&ni.isCommonIgnored(u))continue;let f=u.startsWith("."),p=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,h=e.fs.resolvePath(n,u),d,m,g=!1;if(c.isFile!==void 0&&"isDirectory"in c){let w=c;if(g=w.isSymbolicLink===!0,g&&!s.followSymlinks)continue;if(g&&s.followSymlinks)try{let x=await e.fs.stat(h);d=x.isFile,m=x.isDirectory}catch{continue}else d=w.isFile,m=w.isDirectory}else try{let w=e.fs.lstat?await e.fs.lstat(h):await e.fs.stat(h);if(g=w.isSymbolicLink===!0,g&&!s.followSymlinks)continue;let x=g&&s.followSymlinks?await e.fs.stat(h):w;d=x.isFile,m=x.isDirectory}catch{continue}if(!i?.matches(h,m)&&!(f&&!s.hidden&&!i?.isWhitelisted(h,m))){if(m)await Sp(e,p,h,r+1,s,i,o,a);else if(d){if(s.maxFilesize>0)try{if((await e.fs.stat(h)).size>s.maxFilesize)continue}catch{continue}Cp(p,s,i,h,o)&&a.push(p)}}}}catch{}}}function Cp(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(Sn(i,u,o)||Sn(e,u,o)){c=!0;break}if(!c)return!1}for(let c of l)if(c.startsWith("/")){let u=c.slice(1);if(Sn(e,u,o))return!1}else if(Sn(i,c,o)||Sn(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(Sn(i,c,!0)||Sn(e,c,!0)){l=!0;break}if(!l)return!1}for(let l of a)if(l.startsWith("/")){let c=l.slice(1);if(Sn(e,c,!0))return!1}else if(Sn(i,l,!0)||Sn(e,l,!0))return!1}return!0}function Sn(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+="$",Q(r,n?"i":"").test(e)}async function E8(e,t,n){let r=null;n.noIgnore||(r=await Al(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let s=new ei;for(let c of n.typeClear)s.clearType(c);for(let c of n.typeAdd)s.addType(c);let i=t.length===0?["."]:t,{files:o}=await Ap(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":`
213
+ `;return{stdout:o.map(c=>c+a).join(""),stderr:"",exitCode:0}}function A8(e,t){if(t.length===0)return!0;for(let n of t)if(Sn(e,n,!1))return!0;return!1}async function S8(e,t,n,r){try{if(r.preprocessor&&e.exec){let o=n.split("/").pop()||n;if(A8(o,r.preprocessorGlobs)){let a=await e.exec(sn([r.preprocessor]),{cwd:e.cwd,signal:e.signal,args:[t]});if(a.exitCode===0&&a.stdout){let l=ae(a.stdout),c=l.slice(0,8192);return{content:l,isBinary:c.includes("\0")}}}}if(r.searchZip&&n.endsWith(".gz")){let o=await e.fs.readFileBuffer(t);if(y8(o))try{let a=g8(o),l=new TextDecoder().decode(a),c=l.slice(0,8192);return{content:l,isBinary:c.includes("\0")}}catch{return null}}let s=await e.fs.readFile(t),i=s.slice(0,8192);return{content:s,isBinary:i.includes("\0")}}catch{return null}}async function C8(e,t,n,r,s,i,o){let a="",l=!1,c=[],u=0,f=0,p=0,h=50;e:for(let g=0;g<t.length;g+=h){let y=t.slice(g,g+h),b=await Promise.all(y.map(async w=>{let x=e.fs.resolvePath(e.cwd,w),A=await S8(e,x,w,r);if(!A)return null;let{content:I,isBinary:$}=A;if(p+=I.length,$&&!r.searchBinary)return null;let D=s&&!r.heading?w:"",R=fs(I,n,{invertMatch:r.invertMatch,showLineNumbers:i,countOnly:r.count,countMatches:r.countMatches,filename:D,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?yl(r.replace):null,passthru:r.passthru,multiline:r.multiline,kResetGroup:o});return r.json&&R.matched?{file:w,result:R,content:I,isBinary:!1}:{file:w,result:R}}));for(let w of b){if(!w)continue;let{file:x,result:A}=w;if(A.matched){if(l=!0,f++,u+=A.matchCount,r.quiet&&!r.json)break e;if(r.json&&!r.quiet){let I=w.content||"";c.push(JSON.stringify({type:"begin",data:{path:{text:x}}}));let $=I.split(`
214
+ `);n.lastIndex=0;let D=0;for(let R=0;R<$.length;R++){let L=$[R];n.lastIndex=0;let C=[];for(let O=n.exec(L);O!==null;O=n.exec(L)){let T={match:{text:O[0]},start:O.index,end:O.index+O[0].length};r.replace!==null&&(T.replacement={text:r.replace}),C.push(T),O[0].length===0&&n.lastIndex++}if(C.length>0){let O={type:"match",data:{path:{text:x},lines:{text:`${L}
215
+ `},line_number:R+1,absolute_offset:D,submatches:C}};c.push(JSON.stringify(O))}D+=L.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:I.length,bytes_printed:0,matched_lines:A.matchCount,matches:A.matchCount}}}))}else if(r.filesWithMatches){let I=r.nullSeparator?"\0":`
216
+ `;a+=`${x}${I}`}else r.filesWithoutMatch||(r.heading&&!r.noFilename&&(a+=`${x}
217
+ `),a+=A.output)}else if(r.filesWithoutMatch){let I=r.nullSeparator?"\0":`
218
+ `;a+=`${x}${I}`}else r.includeZero&&(r.count||r.countMatches)&&(a+=A.output)}}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:p,bytes_printed:0,matched_lines:u,matches:u}}})),a=`${c.join(`
219
+ `)}
220
+ `);let d=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`,`${p} bytes searched`].join(`
221
+ `);d+=`${g}
222
+ `}let m;return r.filesWithoutMatch?m=a.length>0?0:1:m=l?0:1,{stdout:d,stderr:"",exitCode:m}}var vp=v(()=>{"use strict";ge();Rr();Ze();wl();El();xp()});var kp={};ee(kp,{flagsForFuzzing:()=>N8,rgCommand:()=>k8});var v8,k8,N8,Np=v(()=>{"use strict";ie();El();bp();vp();v8={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern.
223
+ Unlike grep, rg is recursive by default and respects .gitignore files.
224
+
225
+ EXAMPLES:
226
+ rg foo Search for 'foo' in current directory
227
+ rg foo src/ Search in src/ directory
228
+ rg -i foo Case-insensitive search
229
+ rg -w foo Match whole words only
230
+ rg -t js foo Search only JavaScript files
231
+ rg -g '*.ts' foo Search files matching glob
232
+ rg --hidden foo Include hidden files
233
+ 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"]},k8={name:"rg",async execute(e,t){if(U(e))return M(v8);if(e.includes("--type-list"))return{stdout:hp(),stderr:"",exitCode:0};let n=wp(e);return n.success?Ep({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},N8={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 it(e,t,n){if(!e||Et.isInSandboxedContext())return;let r=`${t} ${n} attempted outside defense context`;throw new de(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:Et.getCurrentExecutionId()})}async function _t(e,t,n,r){it(e,t,`${n} (pre-await)`);let s=await r();return it(e,t,`${n} (post-await)`),s}var Wn=v(()=>{"use strict";un()});function vl(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=Cl.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=Cl.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=Cl.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+=`
234
+ `,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 kl(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 Ip(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===`
235
+ `?t+=`$
236
+ `: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 Cl,$p=v(()=>{"use strict";Cl=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 Tp(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 $8(e){return typeof e=="object"&&"first"in e&&"step"in e}function O8(e){return typeof e=="object"&&"offset"in e}function hs(e,t,n,r,s){if(e==="$")return t===n;if(typeof e=="number")return t===e;if($8(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=kl(vl(i));return Q(o).test(r)}catch{return!1}return!1}function Nl(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 T8(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 hs(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=O8(a);if(u&&s){let p=Nl(e),h=s.get(p);if(h||(h={active:!1},s.set(p,h)),h.active){let d=h.startLine||t;return t>=d+a.offset&&(h.active=!1,s.set(p,h)),!0}else return hs(o,t,n,r,i)?(h.active=!0,h.startLine=t,s.set(p,h),a.offset===0&&(h.active=!1,s.set(p,h)),!0):!1}if(!l&&!c&&!u){let p=typeof o=="number"?o:o==="$"?n:1,h=typeof a=="number"?a:n;if(p<=h)return t>=p&&t<=h;if(s){let d=Nl(e),m=s.get(d);return m||(m={active:!1},s.set(d,m)),!m.completed&&t>=p?(m.completed=!0,s.set(d,m),!0):!1}return!1}if(s){let p=Nl(e),h=s.get(p);if(h||(h={active:!1},s.set(p,h)),h.active)return hs(a,t,n,r,i)&&(h.active=!1,typeof o=="number"&&(h.completed=!0),s.set(p,h)),!0;{if(h.completed)return!1;let d=!1;return typeof o=="number"?d=t>=o:d=hs(o,t,n,r,i),d?(h.active=!0,h.startLine=t,s.set(p,h),hs(a,t,n,r,i)&&(h.active=!1,typeof o=="number"&&(h.completed=!0),s.set(p,h)),!0):!1}}return hs(o,t,n,r,i)}return!0}function Pr(e,t,n,r,s,i){let o=T8(e,t,n,r,s,i);return e?.negated?!o:o}function R8(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 Il(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+=`
237
+ `,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 Op(e,t,n){if(t>0&&e.length>t)throw new X(`sed: ${n} size limit exceeded (${t} bytes)`,"string_length")}function P8(e,t,n){let{lineNumber:r,totalLines:s,patternSpace:i}=t;if(e.type==="label"){t.coverage?.hit(`sed:cmd:${e.type}`);return}if(Pr(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=kl(o.extendedRegex?l:vl(l));try{let u=Q(c,a),f=u.test(t.patternSpace);if(u.lastIndex=0,f){if(t.substitutionMade=!0,o.nthOccurrence&&o.nthOccurrence>0&&!o.global){let p=0,h=o.nthOccurrence,d=Q(c,`g${o.ignoreCase?"i":""}`);t.patternSpace=d.replace(t.patternSpace,(m,...g)=>{if(p++,p===h){let y=g.slice(0,-2);return Il(o.replacement,m,y)}return m})}else if(o.global){let p=Q(c,`g${o.ignoreCase?"i":""}`);t.patternSpace=R8(t.patternSpace,p,o.replacement,(h,d)=>Il(o.replacement,h,d))}else t.patternSpace=u.replace(t.patternSpace,(p,...h)=>{let d=h.slice(0,-2);return Il(o.replacement,p,d)});o.printOnMatch&&t.lineNumberOutput.push(t.patternSpace)}}catch{}break}case"print":t.lineNumberOutput.push(t.patternSpace);break;case"printFirstLine":{let o=t.patternSpace.indexOf(`
238
+ `);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(`
239
+ `);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+=`
240
+ ${t.patternSpace}`:t.holdSpace=t.patternSpace,Op(t.holdSpace,n?.maxStringLength??0,"hold space");break;case"get":t.patternSpace=t.holdSpace;break;case"getAppend":t.patternSpace+=`
241
+ ${t.holdSpace}`,Op(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=Ip(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}
242
+ `});break;case"writeFirstLine":{let o=t.patternSpace.indexOf(`
243
+ `),a=o!==-1?t.patternSpace.slice(0,o):t.patternSpace;t.pendingFileWrites.push({filename:e.filename,content:`${a}
244
+ `});break}case"execute":t.errorMessage="sed: e command (shell execution) is not supported in sandboxed environment",t.quit=!0;break;case"transliterate":t.patternSpace=D8(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 D8(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 $l(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??I8,o=0,a=0;for(;a<e.length;){if(o++,o>i)throw new X(`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(Pr(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(Pr(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+=`
245
+ ${c}`,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1}else{t.quit=!0;break}a++;continue}if(l.type==="branch"){let c=l;if(Pr(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(Pr(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(Pr(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(Pr(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit("sed:cmd:group"),$l(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}P8(l,t,r),a++}return t.linesConsumedInCycle}var I8,Rp=v(()=>{"use strict";Ae();Ze();$p();I8=1e4});var ne,to,Pp=v(()=>{"use strict";(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"})(ne||(ne={}));to=class{input;pos=0;line=1;column=1;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&t.push(n)}return t.push(this.makeToken(ne.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===`
246
+ `?(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+=`
247
+ `:r==="t"?n+=" ":n+=r}else{if(this.peek()===`
248
+ `)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()!==`
249
+ `;)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===`
250
+ `?(this.advance(),{type:ne.NEWLINE,value:`
251
+ `,line:t,column:n}):r===";"?(this.advance(),{type:ne.SEMICOLON,value:";",line:t,column:n}):r==="{"?(this.advance(),{type:ne.LBRACE,value:"{",line:t,column:n}):r==="}"?(this.advance(),{type:ne.RBRACE,value:"}",line:t,column:n}):r===","?(this.advance(),{type:ne.COMMA,value:",",line:t,column:n}):r==="!"?(this.advance(),{type:ne.NEGATION,value:"!",line:t,column:n}):r==="$"?(this.advance(),{type:ne.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:ne.STEP,value:`${i}~${o}`,first:i,step:o,line:t,column:n}}return{type:ne.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:ne.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()!==`
252
+ `&&(r+=this.advance());else{if(i===`
253
+ `)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:ne.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===`
254
+ `||s===";"||s==="}"||s==="{")break;r+=this.advance()}return{type:ne.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(ne.BRANCH,"b",t,n);case"t":return this.readBranch(ne.BRANCH_ON_SUBST,"t",t,n);case"T":return this.readBranch(ne.BRANCH_ON_NO_SUBST,"T",t,n);case"r":return this.readFileCommand(ne.FILE_READ,"r",t,n);case"R":return this.readFileCommand(ne.FILE_READ_LINE,"R",t,n);case"w":return this.readFileCommand(ne.FILE_WRITE,"w",t,n);case"W":return this.readFileCommand(ne.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:ne.COMMAND,value:r,line:t,column:n};case"v":return this.readVersion(t,n);default:return{type:ne.ERROR,value:r,line:t,column:n}}}readSubstitute(t,n){let r=this.advance();if(!r||r===`
255
+ `)return{type:ne.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()!==`
256
+ `?this.peek()===r&&!i?s+=this.advance():(s+="\\",s+=this.advance()):s+="\\";else{if(l===`
257
+ `)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:ne.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()===`
258
+ `?(o+=`
259
+ `,this.advance()):o+="\\"):l===`
260
+ `?(o+=`
261
+ `,this.advance()):o+=`\\${this.advance()}`}else o+="\\";else{if(this.peek()===`
262
+ `)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:ne.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===`
263
+ `)return{type:ne.ERROR,value:"y",line:t,column:n};let s=this.readEscapedString(r);if(s===null||this.peek()!==r)return{type:ne.ERROR,value:"unterminated transliteration source",line:t,column:n};this.advance();let i=this.readEscapedString(r);if(i===null||this.peek()!==r)return{type:ne.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!==`
264
+ `&&o!=="}"?{type:ne.ERROR,value:"extra text at the end of a transform command",line:t,column:n}:{type:ne.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]===`
265
+ `||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()===`
266
+ `&&this.advance();let i="";for(;this.pos<this.input.length;){let o=this.peek();if(o===`
267
+ `){if(i.endsWith("\\")){i=`${i.slice(0,-1)}
268
+ `,this.advance();continue}break}if(o==="\\"&&this.pos+1<this.input.length){let a=this.input[this.pos+1];if(a==="n"){i+=`
269
+ `,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:ne.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===`
270
+ `||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===`
271
+ `||s===";"||s==="}"||s==="{")break;r+=this.advance()}return{type:ne.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===`
272
+ `||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===`
273
+ `||s===";")break;r+=this.advance()}return{type:ne.EXECUTE,value:"e",command:r.trim()||void 0,line:t,column:n}}isDigit(t){return t>="0"&&t<="9"}}});function Dp(e,t=!1){let n=!1,r=!1,s=[];for(let l=0;l<e.length;l++){let c=e[l];if(s.length===0&&l===0){let u=c.match(/^#([nr]+)\s*(?:\n|$)/i);if(u){let f=u[1].toLowerCase();f.includes("n")&&(n=!0),f.includes("r")&&(r=!0),c=c.slice(u[0].length)}}if(s.length>0&&s[s.length-1].endsWith("\\")){let u=s[s.length-1];s[s.length-1]=`${u}
274
+ ${c}`}else s.push(c)}let i=s.join(`
275
+ `),a=new Ol([i],t||r).parse();if(!a.error&&a.commands.length>0){let l=_8(a.commands);if(l)return{commands:[],error:l,silentMode:n,extendedRegexMode:r}}return{...a,silentMode:n,extendedRegexMode:r}}function _8(e){let t=new Set;_p(e,t);let n=Fp(e,t);if(n)return`undefined label '${n}'`}function _p(e,t){for(let n of e)n.type==="label"?t.add(n.name):n.type==="group"&&_p(n.commands,t)}function Fp(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=Fp(n.commands,t);if(r)return r}}}var Ol,Lp=v(()=>{"use strict";Pp();Ol=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(t,n=!1){this.scripts=t,this.extendedRegex=n}parse(){let t=[];for(let n of this.scripts){let r=new to(n);for(this.tokens=r.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(ne.NEWLINE)||this.check(ne.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(ne.NEGATION)&&(this.advance(),n&&(n.negated=!0));this.check(ne.NEWLINE)||this.check(ne.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 ne.COMMAND:return this.parseSimpleCommand(r,n);case ne.SUBSTITUTE:return this.parseSubstituteFromToken(r,n);case ne.TRANSLITERATE:return this.parseTransliterateFromToken(r,n);case ne.LABEL_DEF:return this.advance(),{command:{type:"label",name:r.label||""}};case ne.BRANCH:return this.advance(),{command:{type:"branch",address:n,label:r.label}};case ne.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:n,label:r.label}};case ne.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:n,label:r.label}};case ne.TEXT_CMD:return this.advance(),this.parseTextCommand(r,n);case ne.FILE_READ:return this.advance(),{command:{type:"readFile",address:n,filename:r.filename||""}};case ne.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:n,filename:r.filename||""}};case ne.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:n,filename:r.filename||""}};case ne.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:n,filename:r.filename||""}};case ne.EXECUTE:return this.advance(),{command:{type:"execute",address:n,command:r.command}};case ne.VERSION:return this.advance(),{command:{type:"version",address:n,minVersion:r.label}};case ne.LBRACE:return this.parseGroup(n);case ne.RBRACE:return{command:null};case ne.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(ne.RBRACE);){if(this.check(ne.NEWLINE)||this.check(ne.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(ne.RBRACE)?(this.advance(),{command:{type:"group",address:t,commands:n}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){if(this.check(ne.COMMA))return{error:"expected context address"};let t=this.parseAddress();if(t===void 0)return;let n;if(this.check(ne.RELATIVE_OFFSET))n={offset:this.advance().offset||0};else if(this.check(ne.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 ne.NUMBER:return this.advance(),t.value;case ne.DOLLAR:return this.advance(),"$";case ne.PATTERN:return this.advance(),{pattern:t.pattern||t.value};case ne.STEP:return this.advance(),{first:t.first||0,step:t.step||0};case ne.RELATIVE_OFFSET:return this.advance(),{offset:t.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:ne.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===ne.EOF}}});var Mp={};ee(Mp,{flagsForFuzzing:()=>M8,sedCommand:()=>L8});async function Tl(e,t,n,r={}){let{limits:s,filename:i,fs:o,cwd:a,coverage:l,requireDefenseContext:c}=r;it(c,"sed","processing entry");let u=(L,C)=>_t(c,"sed",L,C),f=e.endsWith(`
276
+ `),p=e.split(`
277
+ `);p.length>0&&p[p.length-1]===""&&p.pop();let h=p.length,d="",m,g=!1,y=s?.maxStringLength??0,b=L=>{if(d+=L,y>0&&d.length>y)throw new X(`sed: output size limit exceeded (${y} bytes)`,"string_length")},w="",x,A=new Map,I=new Map,$=new Map,D=new Map,R=s?{maxIterations:s.maxSedIterations,maxStringLength:y}:void 0;for(let L=0;L<p.length;L++){let C={...Tp(h,i,A),patternSpace:p[L],holdSpace:w,lastPattern:x,lineNumber:L+1,totalLines:h,substitutionMade:!1,coverage:l},O={lines:p,currentLineIndex:L},T=0,N=1e4;C.linesConsumedInCycle=0;do{if(T++,T>N)break;if(C.restartCycle=!1,C.pendingFileReads=[],C.pendingFileWrites=[],$l(t,C,O,R),o&&a){for(let V of C.pendingFileReads){let H=o.resolvePath(a,V.filename);try{if(V.wholeFile){let te=await u("read command file",()=>o.readFile(H));C.appendBuffer.push(te.replace(/\n$/,""))}else{if(!I.has(H)){let se=await u("read command file line cache",()=>o.readFile(H));I.set(H,se.split(`
278
+ `)),$.set(H,0)}let te=I.get(H),ve=$.get(H);te&&ve!==void 0&&ve<te.length&&(C.appendBuffer.push(te[ve]),$.set(H,ve+1))}}catch(te){if(te instanceof de)throw te}}for(let V of C.pendingFileWrites){let H=o.resolvePath(a,V.filename),te=D.get(H)||"";D.set(H,te+V.content)}}}while(C.restartCycle&&!C.deleted&&!C.quit&&!C.quitSilent);if(L+=C.linesConsumedInCycle,w=C.holdSpace,x=C.lastPattern,!n)for(let V of C.nCommandOutput)b(`${V}
279
+ `);let F=C.lineNumberOutput.length>0;for(let V of C.lineNumberOutput)b(`${V}
280
+ `);let B=[],Z=[];for(let V of C.appendBuffer)V.startsWith("__INSERT__")?B.push(V.slice(10)):Z.push(V);for(let V of B)b(`${V}
281
+ `);let oe=!1;!C.deleted&&!C.quitSilent?n?C.printed&&(b(`${C.patternSpace}
282
+ `),oe=!0):(b(`${C.patternSpace}
283
+ `),oe=!0):C.changedText!==void 0&&(b(`${C.changedText}
284
+ `),oe=!0);for(let V of Z)b(`${V}
285
+ `);if(g=(F||oe)&&Z.length===0,C.quit||C.quitSilent){if(C.exitCode!==void 0&&(m=C.exitCode),C.errorMessage)return{output:"",exitCode:m||1,errorMessage:C.errorMessage};break}}if(o&&a)for(let[L,C]of D)try{await u("flush pending file writes",()=>o.writeFile(L,C))}catch(O){if(O instanceof de)throw O}return!f&&g&&d.endsWith(`
286
+ `)&&(d=d.slice(0,-1)),{output:d,exitCode:m}}var F8,L8,M8,Up=v(()=>{"use strict";ge();xn();Ae();Wn();un();ie();Rp();Lp();F8={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:
287
+ s/regexp/replacement/[flags] substitute
288
+ d delete pattern space
289
+ p print pattern space
290
+ a\\ text append text after line
291
+ i\\ text insert text before line
292
+ c\\ text change (replace) line with text
293
+ h copy pattern space to hold space
294
+ H append pattern space to hold space
295
+ g copy hold space to pattern space
296
+ G append hold space to pattern space
297
+ x exchange pattern and hold spaces
298
+ n read next line into pattern space
299
+ N append next line to pattern space
300
+ y/source/dest/ transliterate characters
301
+ = print line number
302
+ l list pattern space (escape special chars)
303
+ b [label] branch to label
304
+ t [label] branch on substitution
305
+ T [label] branch if no substitution
306
+ :label define label
307
+ q quit
308
+ Q quit without printing
309
+
310
+ Addresses:
311
+ N line number
312
+ $ last line
313
+ /regexp/ lines matching regexp
314
+ N,M range from line N to M
315
+ first~step every step-th line starting at first`};L8={name:"sed",async execute(e,t){it(t.requireDefenseContext,"sed","execution entry");let n=(m,g)=>_t(t.requireDefenseContext,"sed",m,g);if(U(e))return M(F8);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 K("sed",g);if(g==="-")l.push(g);else if(g.startsWith("-")&&g.length>1){for(let y of g.slice(1))if(y!=="n"&&y!=="e"&&y!=="f"&&y!=="i"&&y!=="E"&&y!=="r")return K("sed",`-${y}`);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 y=await n("script file read",()=>t.fs.readFile(g));for(let b of y.split(`
316
+ `)){let w=b.trim();w&&!w.startsWith("#")&&r.push(w)}}catch(y){if(y instanceof de)throw y;return{stdout:"",stderr:`sed: couldn't open file ${m}: No such file or directory
317
+ `,exitCode:1}}}if(r.length===0)return{stdout:"",stderr:`sed: no script specified
318
+ `,exitCode:1};let{commands:c,error:u,silentMode:f}=Dp(r,a);if(u)return{stdout:"",stderr:`sed: ${u}
319
+ `,exitCode:1};let p=!!(i||f);if(o){if(l.length===0)return{stdout:"",stderr:`sed: -i requires at least one file argument
320
+ `,exitCode:1};for(let m of l){if(m==="-")continue;let g=t.fs.resolvePath(t.cwd,m);try{let y=await n("in-place input read",()=>t.fs.readFile(g)),b=await n("in-place processing",()=>Tl(y,c,p,{limits:t.limits,filename:m,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));if(b.errorMessage)return{stdout:"",stderr:`${b.errorMessage}
321
+ `,exitCode:b.exitCode??1};await n("in-place output write",()=>t.fs.writeFile(g,b.output))}catch(y){if(y instanceof de)throw y;return y instanceof X?{stdout:"",stderr:`sed: ${He(y.message)}
322
+ `,exitCode:X.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory
323
+ `,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let h="";if(l.length===0){h=ae(t.stdin);try{let m=await n("stdin processing",()=>Tl(h,c,p,{limits:t.limits,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage}
324
+ `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof de)throw m;if(m instanceof X)return{stdout:"",stderr:`sed: ${He(m.message)}
325
+ `,exitCode:X.EXIT_CODE};throw m}}let d=!1;for(let m of l){let g;if(m==="-")d?g="":(g=ae(t.stdin),d=!0);else{let y=t.fs.resolvePath(t.cwd,m);try{g=await n("input file read",()=>t.fs.readFile(y))}catch(b){if(b instanceof de)throw b;return b instanceof X?{stdout:"",stderr:`sed: ${He(b.message)}
326
+ `,exitCode:X.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory
327
+ `,exitCode:1}}}h.length>0&&g.length>0&&!h.endsWith(`
328
+ `)&&(h+=`
329
+ `),h+=g}try{let m=await n("final processing",()=>Tl(h,c,p,{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}
330
+ `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof de)throw m;if(m instanceof X)return{stdout:"",stderr:`sed: ${He(m.message)}
331
+ `,exitCode:X.EXIT_CODE};throw m}}},M8={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 Ct(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function pn(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function Dr(...e){return Object.assign(Object.create(null),...e)}var er=v(()=>{"use strict"});function Rl(e={}){let{fieldSep:t=W8,maxIterations:n=U8,maxRecursionDepth:r=B8,maxOutputSize:s=0,fs:i,cwd:o,exec:a,coverage:l,requireDefenseContext:c}=e;return{FS:" ",OFS:" ",ORS:`
332
+ `,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:s,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:i,cwd:o,exec:a,coverage:l,requireDefenseContext:c}}var U8,B8,W8,Bp=v(()=>{"use strict";Ze();U8=1e4,B8=100,W8=new Jn(/\s+/)});function Wp(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 zp=v(()=>{"use strict"});function hn(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))}async function no(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 jp(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(hn(await t.evalExpr(e.index)))}`:"$0":"$0"}function Gp(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 Vp(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 z8(e,t,n){return e.length===0?t.line.length:vt(await n.evalExpr(e[0])).length}async function H8(e,t,n){if(e.length<2)return"";let r=vt(await n.evalExpr(e[0])),s=Math.floor(hn(await n.evalExpr(e[1])))-1;if(e.length>=3){let i=Math.floor(hn(await n.evalExpr(e[2])));return r.substr(Math.max(0,s),i)}return r.substr(Math.max(0,s))}async function j8(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 G8(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 l=e[2];if(l.type==="regex")o=Q(l.pattern);else{let c=vt(await n.evalExpr(l));o=c===" "?Q("\\s+"):c}}else t.FS===" "&&(o=Q("\\s+"));let a=typeof o=="string"?r.split(o):o.split(r);t.arrays[i]=Object.create(null);for(let l=0;l<a.length;l++)t.arrays[i][String(l+1)]=a[l];return a.length}async function V8(e,t,n){if(e.length<2)return 0;let r=await no(e[0],n),s=vt(await n.evalExpr(e[1])),i=await jp(e[2],n),o=Gp(i,t);try{let l=Q(r).replace(o,qp(s)),c=l!==o?1:0;return Vp(i,l,t),c}catch{return 0}}async function q8(e,t,n){if(e.length<2)return 0;let r=await no(e[0],n),s=vt(await n.evalExpr(e[1])),i=await jp(e[2],n),o=Gp(i,t);try{let a=Q(r,"g"),l=a.match(o),c=l?l.length:0,u=a.replace(o,qp(s));return Vp(i,u,t),c}catch{return 0}}function qp(e){return t=>{let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length){let s=e[r+1];s==="&"?(n+="&",r+=2):s==="\\"?(n+="\\",r+=2):(n+=e[r+1],r+=2)}else e[r]==="&"?(n+=t,r++):(n+=e[r],r++);return n}}async function Z8(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 no(e[1],n);try{let o=Q(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 K8(e,t,n){if(e.length<3)return"";let r=await no(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)return Q(r,"g").replace(o,(u,...f)=>Hp(s,u,f.slice(0,-2)));{let c=0;return Q(r,"g").replace(o,(f,...p)=>(c++,c===l?Hp(s,f,p.slice(0,-2)):f))}}catch{return o}}function Hp(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;else if(i==="0")r+=t,s+=2;else if(i>="1"&&i<="9"){let o=parseInt(i,10)-1;r+=n[o]||"",s+=2}else i==="n"?(r+=`
333
+ `,s+=2):i==="t"?(r+=" ",s+=2):(r+=i,s+=2)}else e[s]==="&"?(r+=t,s++):(r+=e[s],s++);return r}async function Q8(e,t,n){return e.length===0?"":vt(await n.evalExpr(e[0])).toLowerCase()}async function X8(e,t,n){return e.length===0?"":vt(await n.evalExpr(e[0])).toUpperCase()}async function Y8(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 ro(r,s)}async function J8(e,t,n){return e.length===0?0:Math.floor(hn(await n.evalExpr(e[0])))}async function e9(e,t,n){return e.length===0?0:Math.sqrt(hn(await n.evalExpr(e[0])))}async function t9(e,t,n){return e.length===0?0:Math.sin(hn(await n.evalExpr(e[0])))}async function n9(e,t,n){return e.length===0?0:Math.cos(hn(await n.evalExpr(e[0])))}async function r9(e,t,n){let r=e.length>0?hn(await n.evalExpr(e[0])):0,s=e.length>1?hn(await n.evalExpr(e[1])):0;return Math.atan2(r,s)}async function s9(e,t,n){return e.length===0?0:Math.log(hn(await n.evalExpr(e[0])))}async function i9(e,t,n){return e.length===0?1:Math.exp(hn(await n.evalExpr(e[0])))}function o9(e,t,n){return t.random?t.random():Math.random()}async function a9(e,t,n){let r=e.length>0?hn(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function l9(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function Pl(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}function ro(e,t){let n=0,r="",s=0;for(;s<e.length;)if(e[s]==="%"&&s+1<e.length){let i=s+1,o="",a="",l="",c,u=i;for(;i<e.length&&/\d/.test(e[i]);)i++;i>u&&e[i]==="$"?(c=parseInt(e.substring(u,i),10)-1,i++):i=u;let f=()=>{if(i<e.length){if(i+1<e.length&&(e[i]==="h"&&e[i+1]==="h"||e[i]==="l"&&e[i+1]==="l")){i+=2;return}/[lzjh]/.test(e[i])&&i++}};for(;i<e.length&&/[-+ #0]/.test(e[i]);)o+=e[i++];if(e[i]==="*"){let m=t[n++],g=m!==void 0?Math.floor(Number(m)):0;g<0?(o+="-",a=String(Math.min(-g,_r))):a=String(Math.min(g,_r)),i++}else for(;i<e.length&&/\d/.test(e[i]);)a+=e[i++];if(a&&parseInt(a,10)>_r&&(a=String(_r)),e[i]==="."){if(i++,e[i]==="*"){let m=t[n++];l=String(Math.min(m!==void 0?Math.floor(Number(m)):0,_r)),i++}else for(;i<e.length&&/\d/.test(e[i]);)l+=e[i++];l&&parseInt(l,10)>_r&&(l=String(_r))}f();let p=e[i],d=t[c!==void 0?c:n];switch(p){case"s":{let m=d!==void 0?String(d):"";if(l&&(m=m.substring(0,parseInt(l,10))),a){let g=parseInt(a,10);o.includes("-")?m=m.padEnd(g):m=m.padStart(g)}r+=m,c===void 0&&n++;break}case"d":case"i":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=m<0,y=Math.abs(m).toString();if(l){let x=parseInt(l,10);y=y.padStart(x,"0")}let b="";g?b="-":o.includes("+")?b="+":o.includes(" ")&&(b=" ");let w=b+y;if(a){let x=parseInt(a,10);o.includes("-")?w=w.padEnd(x):o.includes("0")&&!l?w=b+y.padStart(x-b.length,"0"):w=w.padStart(x)}r+=w,c===void 0&&n++;break}case"f":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m.toFixed(g);if(a){let b=parseInt(a,10);o.includes("-")?y=y.padEnd(b):y=y.padStart(b)}r+=y,c===void 0&&n++;break}case"e":case"E":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m.toExponential(g);if(p==="E"&&(y=y.toUpperCase()),a){let b=parseInt(a,10);o.includes("-")?y=y.padEnd(b):y=y.padStart(b)}r+=y,c===void 0&&n++;break}case"g":case"G":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m!==0?Math.floor(Math.log10(Math.abs(m))):0,b;if(m===0?b="0":y<-4||y>=g?(b=m.toExponential(g-1),p==="G"&&(b=b.toUpperCase())):b=m.toPrecision(g),b.includes(".")&&(b=b.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),b.includes("e")&&(b=b.replace(/\.?0+e/,"e")),a){let w=parseInt(a,10);o.includes("-")?b=b.padEnd(w):b=b.padStart(w)}r+=b,c===void 0&&n++;break}case"x":case"X":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=Math.abs(m).toString(16);if(p==="X"&&(g=g.toUpperCase()),l){let w=parseInt(l,10);g=g.padStart(w,"0")}let y=m<0?"-":"",b=y+g;if(a){let w=parseInt(a,10);o.includes("-")?b=b.padEnd(w):o.includes("0")&&!l?b=y+g.padStart(w-y.length,"0"):b=b.padStart(w)}r+=b,c===void 0&&n++;break}case"o":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=Math.abs(m).toString(8);if(l){let w=parseInt(l,10);g=g.padStart(w,"0")}let y=m<0?"-":"",b=y+g;if(a){let w=parseInt(a,10);o.includes("-")?b=b.padEnd(w):o.includes("0")&&!l?b=y+g.padStart(w-y.length,"0"):b=b.padStart(w)}r+=b,c===void 0&&n++;break}case"c":{typeof d=="number"?r+=String.fromCharCode(d):r+=String(d??"").charAt(0)||"",c===void 0&&n++;break}case"%":r+="%";break;default:r+=e.substring(s,i+1)}s=i+1}else if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];switch(i){case"n":r+=`
334
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;default:r+=i}s+=2}else r+=e[s++];return r}var _r,Zp,Dl=v(()=>{"use strict";Ze();_r=1e4;Zp=new Map([["length",z8],["substr",H8],["index",j8],["split",G8],["sub",V8],["gsub",q8],["match",Z8],["gensub",K8],["tolower",Q8],["toupper",X8],["sprintf",Y8],["int",J8],["sqrt",e9],["sin",t9],["cos",n9],["atan2",r9],["log",s9],["exp",i9],["rand",o9],["srand",a9],["system",l9("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",Pl("systime")],["mktime",Pl("mktime")],["strftime",Pl("strftime")]])});function Ft(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function tt(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Me(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function _l(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function ri(e,t){try{return Q(e).test(t)}catch{return!1}}var ds=v(()=>{"use strict";Ze()});function Kp(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function so(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Fl(e,t,n){if(t===0)e.line=Me(n),e.fields=Kp(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=Me(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function ms(e,t){e.line=t,e.fields=Kp(e,t),e.NF=e.fields.length}function Qp(e,t){if(e.FS=t,t===" ")e.fieldSep=new Jn(/\s+/);else try{e.fieldSep=Q(t)}catch{e.fieldSep=Q(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}var io=v(()=>{"use strict";Ze();ds()});function oo(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 gs(e,t,n){switch(t){case"FS":Qp(e,Me(n));return;case"OFS":e.OFS=Me(n);return;case"ORS":e.ORS=Me(n);return;case"OFMT":e.OFMT=Me(n);return;case"NR":e.NR=Math.floor(tt(n));return;case"NF":{let r=Math.floor(tt(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(tt(n));return;case"FILENAME":e.FILENAME=Me(n);return;case"RSTART":e.RSTART=Math.floor(tt(n));return;case"RLENGTH":e.RLENGTH=Math.floor(tt(n));return;case"SUBSEP":e.SUBSEP=Me(n);return}e.vars[t]=n}function si(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 ao(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=si(e,t);return e.arrays[r]?.[n]??""}function Ll(e,t,n,r){let s=si(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=r}function Xp(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=si(e,t);return e.arrays[r]?.[n]!==void 0}function Yp(e,t,n){let r=si(e,t);e.arrays[r]&&delete e.arrays[r][n]}function Jp(e,t){let n=si(e,t);delete e.arrays[n]}var Ml=v(()=>{"use strict";io();ds()});function th(e){eh=e}function jt(e,t){it(e.requireDefenseContext,"awk",t)}function Fe(e,t,n){return _t(e.requireDefenseContext,"awk",t,n)}async function fe(e,t){switch(jt(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 ri(t.pattern,e.line)?1:0;case"field":return c9(e,t);case"variable":return oo(e,t.name);case"array_access":return u9(e,t);case"binary":return f9(e,t);case"unary":return d9(e,t);case"ternary":return Ft(await Fe(e,"ternary condition evaluation",()=>fe(e,t.condition)))?await Fe(e,"ternary consequent evaluation",()=>fe(e,t.consequent)):await Fe(e,"ternary alternate evaluation",()=>fe(e,t.alternate));case"call":return m9(e,t.name,t.args);case"assignment":return y9(e,t);case"pre_increment":return w9(e,t.operand);case"pre_decrement":return b9(e,t.operand);case"post_increment":return x9(e,t.operand);case"post_decrement":return E9(e,t.operand);case"in":return A9(e,t.key,t.array);case"getline":return S9(e,t.variable,t.file,t.command);case"tuple":return k9(e,t.elements);default:return""}}async function c9(e,t){jt(e,"field reference evaluation");let n=Math.floor(tt(await Fe(e,"field index evaluation",()=>fe(e,t.index))));return so(e,n)}async function u9(e,t){jt(e,"array access evaluation");let n=Me(await Fe(e,"array key evaluation",()=>fe(e,t.key)));return ao(e,t.array,n)}async function f9(e,t){jt(e,"binary expression evaluation");let n=t.operator;if(n==="||")return Ft(await Fe(e,"logical-or left evaluation",()=>fe(e,t.left)))||Ft(await Fe(e,"logical-or right evaluation",()=>fe(e,t.right)))?1:0;if(n==="&&")return Ft(await Fe(e,"logical-and left evaluation",()=>fe(e,t.left)))&&Ft(await Fe(e,"logical-and right evaluation",()=>fe(e,t.right)))?1:0;if(n==="~"){let a=await Fe(e,"regex left evaluation",()=>fe(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Me(await Fe(e,"regex right evaluation",()=>fe(e,t.right)));try{return Q(l).test(Me(a))?1:0}catch{return 0}}if(n==="!~"){let a=await Fe(e,"negated-regex left evaluation",()=>fe(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Me(await Fe(e,"negated-regex right evaluation",()=>fe(e,t.right)));try{return Q(l).test(Me(a))?0:1}catch{return 1}}let r=await Fe(e,"binary left evaluation",()=>fe(e,t.left)),s=await Fe(e,"binary right evaluation",()=>fe(e,t.right));if(n===" "){let a=Me(r)+Me(s);if(e.maxOutputSize>0&&a.length>e.maxOutputSize)throw new X(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return a}if(p9(n))return h9(r,s,n);let i=tt(r),o=tt(s);return Wp(i,o,n)}function p9(e){return["<","<=",">",">=","==","!="].includes(e)}function h9(e,t,n){let r=_l(e),s=_l(t);if(r&&s){let a=tt(e),l=tt(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=Me(e),o=Me(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 d9(e,t){jt(e,"unary expression evaluation");let n=await Fe(e,"unary operand evaluation",()=>fe(e,t.operand));switch(t.operator){case"!":return Ft(n)?0:1;case"-":return-tt(n);case"+":return+tt(n);default:return n}}async function m9(e,t,n){jt(e,"function call evaluation");let r=Zp.get(t);if(r)return r(n,e,{evalExpr:i=>fe(e,i)});let s=e.functions.get(t);return s?g9(e,s,n):""}async function g9(e,t,n){if(jt(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new X(`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 Fe(e,"user function argument evaluation",()=>fe(e,c));e.vars[l]=u}else e.vars[l]=""}e.hasReturn=!1,e.returnValue=void 0;let i=eh;i&&await Fe(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 y9(e,t){jt(e,"assignment evaluation");let n=await Fe(e,"assignment value evaluation",()=>fe(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(tt(await Fe(e,"assignment field index",()=>fe(e,r.index))));o=so(e,c)}else if(r.type==="variable")o=oo(e,r.name);else{let c=Me(await Fe(e,"assignment array key",()=>fe(e,r.key)));o=ao(e,r.array,c)}let a=tt(o),l=tt(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(tt(await Fe(e,"assignment target field index",()=>fe(e,r.index))));Fl(e,o,i)}else if(r.type==="variable")gs(e,r.name,i);else{let o=Me(await Fe(e,"assignment target array key",()=>fe(e,r.key)));Ll(e,r.array,o,i)}return i}async function lo(e,t,n,r){jt(e,"inc/dec evaluation");let s;if(t.type==="field"){let i=Math.floor(tt(await Fe(e,"inc/dec field index",()=>fe(e,t.index))));s=tt(so(e,i)),Fl(e,i,s+n)}else if(t.type==="variable")s=tt(oo(e,t.name)),gs(e,t.name,s+n);else{let i=Me(await Fe(e,"inc/dec array key",()=>fe(e,t.key)));s=tt(ao(e,t.array,i)),Ll(e,t.array,i,s+n)}return r?s+n:s}async function w9(e,t){return lo(e,t,1,!0)}async function b9(e,t){return lo(e,t,-1,!0)}async function x9(e,t){return lo(e,t,1,!1)}async function E9(e,t){return lo(e,t,-1,!1)}async function A9(e,t,n){jt(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(Me(await Fe(e,"tuple key element evaluation",()=>fe(e,i))));r=s.join(e.SUBSEP)}else r=Me(await Fe(e,"in-expression key evaluation",()=>fe(e,t)));return Xp(e,n,r)?1:0}async function S9(e,t,n,r){if(jt(e,"getline evaluation"),r)return C9(e,t,r);if(n)return v9(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?gs(e,t,i):ms(e,i),e.NR++,e.lineIndex=s,1}async function C9(e,t,n){let r=e.exec;if(!r)return-1;jt(e,"getline command source");let s=Me(await Fe(e,"getline command expression",()=>fe(e,n))),i=`__cmd_${s}`,o=`__cmdi_${s}`,a,l;if(e.vars[i]===void 0)try{let f=await Fe(e,"getline command exec",()=>r(s));a=ae(f.stdout).split(`
335
+ `),a.length>0&&a[a.length-1]===""&&a.pop(),e.vars[i]=JSON.stringify(a),e.vars[o]=-1,l=-1}catch(f){if(f instanceof de)throw f;return-1}else a=JSON.parse(e.vars[i]),l=e.vars[o];let c=l+1;if(c>=a.length)return 0;let u=a[c];return e.vars[o]=c,t?gs(e,t,u):ms(e,u),1}async function v9(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;jt(e,"getline file source");let s=Me(await Fe(e,"getline filename evaluation",()=>fe(e,n)));if(s==="/dev/null")return 0;let i=r.resolvePath(e.cwd,s),o=`__fc_${i}`,a=`__fi_${i}`,l,c;if(e.vars[o]===void 0)try{l=(await Fe(e,"getline file read",()=>r.readFile(i))).split(`
336
+ `),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[o]=JSON.stringify(l),e.vars[a]=-1,c=-1}catch(p){if(p instanceof de)throw p;return-1}else l=JSON.parse(e.vars[o]),c=e.vars[a];let u=c+1;if(u>=l.length)return 0;let f=l[u];return e.vars[a]=u,t?gs(e,t,f):ms(e,f),1}async function k9(e,t){if(jt(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await Fe(e,"tuple intermediate element",()=>fe(e,t[n]));return Fe(e,"tuple final element",()=>fe(e,t[t.length-1]))}var eh,Ul=v(()=>{"use strict";ge();Ae();Ze();Wn();un();zp();Dl();io();ds();Ml();eh=null});function Bl(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new X(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function Cn(e,t){it(e.requireDefenseContext,"awk",t)}function Te(e,t,n){return _t(e.requireDefenseContext,"awk",t,n)}async function ys(e,t){Cn(e,"block execution");for(let n of t)if(await Te(e,"statement execution",()=>Fr(e,n)),N9(e))break}function N9(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Fr(e,t){switch(Cn(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await Te(e,"nested block statement",()=>ys(e,t.statements));break;case"expr_stmt":await Te(e,"expression statement",()=>fe(e,t.expression));break;case"print":await Te(e,"print statement",()=>I9(e,t.args,t.output));break;case"printf":await Te(e,"printf statement",()=>$9(e,t.format,t.args,t.output));break;case"if":await Te(e,"if statement",()=>O9(e,t));break;case"while":await Te(e,"while statement",()=>T9(e,t));break;case"do_while":await Te(e,"do-while statement",()=>R9(e,t));break;case"for":await Te(e,"for statement",()=>P9(e,t));break;case"for_in":await Te(e,"for-in statement",()=>D9(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(tt(await Te(e,"exit code expression",()=>fe(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await Te(e,"return expression",()=>fe(e,n)):""}break;case"delete":await Te(e,"delete statement",()=>_9(e,t.target));break}}async function I9(e,t,n){Cn(e,"print execution");let r=[];for(let i of t){let o=await Te(e,"print argument evaluation",()=>fe(e,i));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?r.push(String(o)):r.push(ro(e.OFMT,[o])):r.push(Me(o))}let s=r.join(e.OFS)+e.ORS;n?await Te(e,"print redirection write",()=>nh(e,n.redirect,n.file,s)):(e.output+=s,Bl(e))}async function $9(e,t,n,r){Cn(e,"printf execution");let s=Me(await Te(e,"printf format evaluation",()=>fe(e,t))),i=[];for(let a of n)i.push(await Te(e,"printf argument evaluation",()=>fe(e,a)));let o=ro(s,i);r?await Te(e,"printf redirection write",()=>nh(e,r.redirect,r.file,o)):(e.output+=o,Bl(e))}async function nh(e,t,n,r){Cn(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=r,Bl(e);return}let i=Me(await Te(e,"redirection filename evaluation",()=>fe(e,n))),o=s.resolvePath(e.cwd,i);t===">"?e.openedFiles.has(o)?await Te(e,"redirection append write",()=>s.appendFile(o,r)):(await Te(e,"redirection overwrite write",()=>s.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await Te(e,"redirection append mode write",()=>s.appendFile(o,r)))}async function O9(e,t){if(Cn(e,"if execution"),Ft(await Te(e,"if condition evaluation",()=>fe(e,t.condition))))await Te(e,"if consequent execution",()=>Fr(e,t.consequent));else if(t.alternate){let n=t.alternate;await Te(e,"if alternate execution",()=>Fr(e,n))}}async function T9(e,t){Cn(e,"while execution");let n=0;for(;Ft(await Te(e,"while condition evaluation",()=>fe(e,t.condition)));){if(n++,n>e.maxIterations)throw new X(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Te(e,"while body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function R9(e,t){Cn(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new X(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Te(e,"do-while body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(Ft(await Te(e,"do-while condition evaluation",()=>fe(e,t.condition))))}async function P9(e,t){Cn(e,"for execution");let n=t.init,r=t.condition,s=t.update;n&&await Te(e,"for init evaluation",()=>fe(e,n));let i=0;for(;!r||Ft(await Te(e,"for condition evaluation",()=>fe(e,r)));){if(i++,i>e.maxIterations)throw new X(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Te(e,"for body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await Te(e,"for update evaluation",()=>fe(e,s))}}async function D9(e,t){Cn(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 Te(e,"for-in body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function _9(e,t){if(Cn(e,"delete execution"),t.type==="array_access"){let n=Me(await Te(e,"delete key evaluation",()=>fe(e,t.key)));Yp(e,t.array,n)}else t.type==="variable"&&Jp(e,t.name)}var rh=v(()=>{"use strict";Ae();Wn();Dl();Ul();ds();Ml();th(ys)});var ii,sh=v(()=>{"use strict";Wn();Ul();io();rh();ds();ii=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){it(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return _t(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",()=>ys(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){ms(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",()=>ys(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",()=>ys(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 ri(r.pattern,this.ctx.line);case"expr_pattern":return Ft(await this.withDefenseContext("expression pattern evaluation",()=>fe(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 ri(t.pattern,this.ctx.line);case"expr_pattern":return Ft(await this.withDefenseContext("nested expression pattern",()=>fe(this.ctx,t.expression)));default:return!1}}}});var ih=v(()=>{"use strict";Bp();sh()});function L9(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 S,F9,M9,co,oh=v(()=>{"use strict";(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"})(S||(S={}));F9=new Map([["BEGIN",S.BEGIN],["END",S.END],["if",S.IF],["else",S.ELSE],["while",S.WHILE],["do",S.DO],["for",S.FOR],["in",S.IN],["break",S.BREAK],["continue",S.CONTINUE],["next",S.NEXT],["nextfile",S.NEXTFILE],["exit",S.EXIT],["return",S.RETURN],["delete",S.DELETE],["function",S.FUNCTION],["print",S.PRINT],["printf",S.PRINTF],["getline",S.GETLINE]]);M9=new Set([S.COMMA,S.LBRACE,S.AND,S.OR,S.QUESTION,S.COLON,S.DO,S.ELSE,S.IF,S.WHILE]),co=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(S.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===`
337
+ `?(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)===`
338
+ `)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
339
+ `;)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===`
340
+ `?(this.advance(),this.lastTokenType!==null&&M9.has(this.lastTokenType)?this.nextToken():{type:S.NEWLINE,value:`
341
+ `,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,S.NEWLINE,S.SEMICOLON,S.LBRACE,S.RBRACE,S.LPAREN,S.LBRACKET,S.COMMA,S.ASSIGN,S.PLUS_ASSIGN,S.MINUS_ASSIGN,S.STAR_ASSIGN,S.SLASH_ASSIGN,S.PERCENT_ASSIGN,S.CARET_ASSIGN,S.AND,S.OR,S.NOT,S.MATCH,S.NOT_MATCH,S.QUESTION,S.COLON,S.LT,S.GT,S.LE,S.GE,S.EQ,S.NE,S.PLUS,S.MINUS,S.STAR,S.PERCENT,S.CARET,S.PRINT,S.PRINTF,S.IF,S.WHILE,S.DO,S.FOR,S.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+=`
342
+ `;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:S.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()===`
343
+ `)break;r+=this.advance()}return this.peek()==="/"&&this.advance(),r=L9(r),{type:S.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:S.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=F9.get(r);return s!==void 0?{type:s,value:r,line:t,column:n}:{type:S.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:S.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:S.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:S.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:S.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:S.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:S.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:S.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:S.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:S.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:S.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:S.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:S.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:S.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:S.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:S.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:S.EQ,value:"==",line:t,column:n}):{type:S.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:S.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:S.NOT_MATCH,value:"!~",line:t,column:n}):{type:S.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:S.LE,value:"<=",line:t,column:n}):{type:S.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:S.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:S.APPEND,value:">>",line:t,column:n}):{type:S.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:S.AND,value:"&&",line:t,column:n}):{type:S.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:S.OR,value:"||",line:t,column:n}):{type:S.PIPE,value:"|",line:t,column:n};case"~":return{type:S.MATCH,value:"~",line:t,column:n};case"?":return{type:S.QUESTION,value:"?",line:t,column:n};case":":return{type:S.COLON,value:":",line:t,column:n};case",":return{type:S.COMMA,value:",",line:t,column:n};case";":return{type:S.SEMICOLON,value:";",line:t,column:n};case"(":return{type:S.LPAREN,value:"(",line:t,column:n};case")":return{type:S.RPAREN,value:")",line:t,column:n};case"{":return{type:S.LBRACE,value:"{",line:t,column:n};case"}":return{type:S.RBRACE,value:"}",line:t,column:n};case"[":return{type:S.LBRACKET,value:"[",line:t,column:n};case"]":return{type:S.RBRACKET,value:"]",line:t,column:n};case"$":return{type:S.DOLLAR,value:"$",line:t,column:n};default:return{type:S.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 fh(e){e.expect(Y.PRINT);let t=[];if(e.check(Y.NEWLINE)||e.check(Y.SEMICOLON)||e.check(Y.RBRACE)||e.check(Y.PIPE)||e.check(Y.GT)||e.check(Y.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(uo(e));e.check(Y.COMMA);)e.advance(),t.push(uo(e));let n;return e.check(Y.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(Y.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function uo(e){return U9(e)?Wl(e,!0):Wl(e,!1)}function Wl(e,t){let n=t?e.parseTernary():B9(e);if(e.match(Y.ASSIGN,Y.PLUS_ASSIGN,Y.MINUS_ASSIGN,Y.STAR_ASSIGN,Y.SLASH_ASSIGN,Y.PERCENT_ASSIGN,Y.CARET_ASSIGN)){let r=e.advance(),s=Wl(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 U9(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let r=e.tokens[n];if(r.type===Y.LPAREN&&t++,r.type===Y.RPAREN&&t--,r.type===Y.QUESTION&&t===0)return!0;if(r.type===Y.NEWLINE||r.type===Y.SEMICOLON||r.type===Y.RBRACE||r.type===Y.COMMA||r.type===Y.PIPE)return!1;n++}return!1}function B9(e){let t=ah(e);for(;e.check(Y.OR);){e.advance();let n=ah(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function ah(e){let t=lh(e);for(;e.check(Y.AND);){e.advance();let n=lh(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function lh(e){let t=W9(e);if(e.check(Y.IN)){e.advance();let n=String(e.expect(Y.IDENT).value);return{type:"in",key:t,array:n}}return t}function W9(e){let t=ch(e);for(;z9(e)&&!H9(e);){let n=ch(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function ch(e){let t=uh(e);for(;e.match(Y.MATCH,Y.NOT_MATCH);){let n=e.advance().type===Y.MATCH?"~":"!~",r=uh(e);t={type:"binary",operator:n,left:t,right:r}}return t}function uh(e){let t=e.parseAddSub();for(;e.match(Y.LT,Y.LE,Y.GE,Y.EQ,Y.NE);){let n=e.advance(),r=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}function z9(e){return e.match(Y.NUMBER,Y.STRING,Y.IDENT,Y.DOLLAR,Y.LPAREN,Y.NOT,Y.MINUS,Y.PLUS,Y.INCREMENT,Y.DECREMENT)}function H9(e){return e.match(Y.AND,Y.OR,Y.QUESTION,Y.ASSIGN,Y.PLUS_ASSIGN,Y.MINUS_ASSIGN,Y.STAR_ASSIGN,Y.SLASH_ASSIGN,Y.PERCENT_ASSIGN,Y.CARET_ASSIGN,Y.COMMA,Y.SEMICOLON,Y.NEWLINE,Y.RBRACE,Y.RPAREN,Y.RBRACKET,Y.COLON,Y.PIPE,Y.APPEND,Y.GT,Y.IN)}function ph(e){e.expect(Y.PRINTF);let t=e.check(Y.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():uo(e),r=[];for(;e.check(Y.COMMA);)e.advance(),t&&e.skipNewlines(),r.push(t?e.parseExpression():uo(e));t&&(e.skipNewlines(),e.expect(Y.RPAREN));let s;return e.check(Y.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(Y.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:r,output:s}}var Y,hh=v(()=>{"use strict";Y={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 fo,dh=v(()=>{"use strict";oh();hh();fo=class{tokens=[];pos=0;parse(t){let n=new co(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:S.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let 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(S.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(S.NEWLINE)||this.check(S.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(S.EOF)&&(this.skipNewlines(),!this.check(S.EOF));)this.check(S.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(S.FUNCTION);let t=this.expect(S.IDENT).value;this.expect(S.LPAREN);let n=[];if(!this.check(S.RPAREN))for(n.push(this.expect(S.IDENT).value);this.check(S.COMMA);)this.advance(),n.push(this.expect(S.IDENT).value);this.expect(S.RPAREN),this.skipNewlines();let r=this.parseBlock();return{name:t,params:n,body:r}}parseRule(){let t;if(this.check(S.BEGIN))this.advance(),t={type:"begin"};else if(this.check(S.END))this.advance(),t={type:"end"};else if(this.check(S.LBRACE))t=void 0;else if(this.check(S.REGEX)){let r=this.advance();if(this.check(S.AND)||this.check(S.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(S.COMMA)){this.advance();let i;this.check(S.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(S.COMMA)){this.advance();let i;this.check(S.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(S.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(S.LBRACE),this.skipNewlines();let t=[];for(;!this.check(S.RBRACE)&&!this.check(S.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(S.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(S.SEMICOLON)||this.check(S.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(S.LBRACE))return this.parseBlock();if(this.check(S.IF))return this.parseIf();if(this.check(S.WHILE))return this.parseWhile();if(this.check(S.DO))return this.parseDoWhile();if(this.check(S.FOR))return this.parseFor();if(this.check(S.BREAK))return this.advance(),{type:"break"};if(this.check(S.CONTINUE))return this.advance(),{type:"continue"};if(this.check(S.NEXT))return this.advance(),{type:"next"};if(this.check(S.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(S.EXIT)){this.advance();let n;return!this.check(S.NEWLINE)&&!this.check(S.SEMICOLON)&&!this.check(S.RBRACE)&&!this.check(S.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(S.RETURN)){this.advance();let n;return!this.check(S.NEWLINE)&&!this.check(S.SEMICOLON)&&!this.check(S.RBRACE)&&!this.check(S.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(S.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(S.PRINT)?fh(this):this.check(S.PRINTF)?ph(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(S.IF),this.expect(S.LPAREN);let t=this.parseExpression();this.expect(S.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let r;return this.check(S.ELSE)&&(this.advance(),this.skipNewlines(),r=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:r}}parseWhile(){this.expect(S.WHILE),this.expect(S.LPAREN);let t=this.parseExpression();this.expect(S.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(S.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(S.WHILE),this.expect(S.LPAREN);let n=this.parseExpression();return this.expect(S.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(S.FOR),this.expect(S.LPAREN),this.check(S.IDENT)){let i=this.advance();if(this.check(S.IN)){this.advance();let o=this.expect(S.IDENT).value;this.expect(S.RPAREN),this.skipNewlines();let a=this.parseStatement();return{type:"for_in",variable:i.value,array:o,body:a}}this.pos--}let t;this.check(S.SEMICOLON)||(t=this.parseExpression()),this.expect(S.SEMICOLON);let n;this.check(S.SEMICOLON)||(n=this.parseExpression()),this.expect(S.SEMICOLON);let r;this.check(S.RPAREN)||(r=this.parseExpression()),this.expect(S.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:r,body:s}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(S.ASSIGN,S.PLUS_ASSIGN,S.MINUS_ASSIGN,S.STAR_ASSIGN,S.SLASH_ASSIGN,S.PERCENT_ASSIGN,S.CARET_ASSIGN)){let n=this.advance(),r=this.parseAssignment();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(S.QUESTION)){this.advance();let n=this.parseExpression();this.expect(S.COLON);let r=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:r}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(S.PIPE)){if(this.advance(),!this.check(S.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(S.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(S.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(S.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(S.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(S.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(S.IN)){this.advance();let n=this.expect(S.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(S.MATCH,S.NOT_MATCH);){let n=this.advance().type===S.MATCH?"~":"!~",r=this.parseComparison();t={type:"binary",operator:n,left:t,right:r}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(S.LT,S.LE,S.GT,S.GE,S.EQ,S.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(S.NUMBER,S.STRING,S.IDENT,S.DOLLAR,S.LPAREN,S.NOT,S.MINUS,S.PLUS,S.INCREMENT,S.DECREMENT)}isConcatTerminator(){return this.match(S.AND,S.OR,S.QUESTION,S.ASSIGN,S.PLUS_ASSIGN,S.MINUS_ASSIGN,S.STAR_ASSIGN,S.SLASH_ASSIGN,S.PERCENT_ASSIGN,S.CARET_ASSIGN,S.COMMA,S.SEMICOLON,S.NEWLINE,S.RBRACE,S.RPAREN,S.RBRACKET,S.COLON,S.PIPE,S.APPEND,S.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(S.PLUS,S.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(S.STAR,S.SLASH,S.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(S.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(S.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(S.NOT,S.MINUS,S.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(S.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(S.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(S.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(S.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(S.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(S.NOT,S.MINUS,S.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(S.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(S.NUMBER))return{type:"number",value:this.advance().value};if(this.check(S.STRING))return{type:"string",value:this.advance().value};if(this.check(S.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(S.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(S.RPAREN),t}if(this.check(S.IDENT)){let t=this.advance().value;if(this.check(S.LPAREN)){this.advance();let n=[];if(!this.check(S.RPAREN))for(n.push(this.parseExpression());this.check(S.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(S.RPAREN),{type:"call",name:t,args:n}}if(this.check(S.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(S.COMMA)){let r=[n];for(;this.check(S.COMMA);)this.advance(),r.push(this.parseExpression());this.expect(S.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(S.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(S.NUMBER))return{type:"number",value:this.advance().value};if(this.check(S.STRING))return{type:"string",value:this.advance().value};if(this.check(S.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(S.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(S.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(S.COMMA)){let n=[t];for(;this.check(S.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(S.RPAREN),{type:"tuple",elements:n}}return this.expect(S.RPAREN),t}if(this.check(S.GETLINE)){this.advance();let t,n;return this.check(S.IDENT)&&(t=this.advance().value),this.check(S.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(S.IDENT)){let t=this.advance().value;if(this.check(S.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(S.RPAREN))for(n.push(this.parseExpression());this.check(S.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(S.RPAREN),{type:"call",name:t,args:n}}if(this.check(S.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(S.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(S.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 yh={};ee(yh,{awkCommand2:()=>G9,flagsForFuzzing:()=>V9});function zl(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
344
+ `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function mh(e){if(e===" ")return Q("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return Q(e)}catch{return Q(gh(e))}return Q(gh(e))}function gh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var j9,G9,V9,wh=v(()=>{"use strict";ge();er();Ae();Ze();Wn();un();ie();ih();dh();j9={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"]},G9={name:"awk",async execute(e,t){it(t.requireDefenseContext,"awk","execution entry");let n=(y,b)=>_t(t.requireDefenseContext,"awk",y,b);if(U(e))return M(j9);let r=new Jn(/\s+/),s=" ",i=Object.create(null),o=0;for(let y=0;y<e.length;y++){let b=e[y];if(b==="-F"&&y+1<e.length)s=zl(e[++y]),r=mh(s),o=y+1;else if(b.startsWith("-F"))s=zl(b.slice(2)),r=mh(s),o=y+1;else if(b==="-v"&&y+1<e.length){let w=e[++y],x=w.indexOf("=");if(x>0){let A=w.slice(0,x),I=zl(w.slice(x+1));i[A]=I}o=y+1}else{if(b.startsWith("--"))return K("awk",b);if(b.startsWith("-")&&b.length>1){let w=b[1];if(w!=="F"&&w!=="v")return K("awk",`-${w}`);o=y+1}else if(!b.startsWith("-")){o=y;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program
345
+ `,exitCode:1};let a=e[o],l=e.slice(o+1),c=new fo,u;try{u=c.parse(a)}catch(y){return{stdout:"",stderr:`awk: ${y instanceof Error?y.message:String(y)}
346
+ `,exitCode:1}}let f={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(y,b)=>{try{let w=await n("appendFile read",()=>t.fs.readFile(y));await n("appendFile write",()=>t.fs.writeFile(y,w+b))}catch(w){if(w instanceof de)throw w;await n("appendFile create",()=>t.fs.writeFile(y,b))}},resolvePath:t.fs.resolvePath.bind(t.fs)},p=t.exec,h=Rl({fieldSep:r,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:f,cwd:t.cwd,exec:p?y=>n("command pipe exec",()=>p(y,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});h.FS=s,h.vars=Object.assign(Object.create(null),i),h.ARGC=l.length+1,h.ARGV=Object.create(null),h.ARGV[0]="awk";for(let y=0;y<l.length;y++)h.ARGV[String(y+1)]=l[y];h.ENVIRON=Ct(t.env);let d=new ii(h);d.execute(u);let m=u.rules.some(y=>y.pattern?.type!=="begin"&&y.pattern?.type!=="end"),g=u.rules.some(y=>y.pattern?.type==="end");try{if(await n("BEGIN execution",()=>d.executeBegin()),h.shouldExit)return await n("END execution after BEGIN exit",()=>d.executeEnd()),{stdout:d.getOutput(),stderr:"",exitCode:d.getExitCode()};if(!m&&!g)return{stdout:d.getOutput(),stderr:"",exitCode:d.getExitCode()};let y=[];if(l.length>0)for(let b of l)try{let w=t.fs.resolvePath(t.cwd,b),A=(await n("input file read",()=>t.fs.readFile(w))).split(`
347
+ `);A.length>0&&A[A.length-1]===""&&A.pop(),y.push({filename:b,lines:A})}catch(w){if(w instanceof de)throw w;return{stdout:"",stderr:`awk: ${b}: No such file or directory
348
+ `,exitCode:1}}else{let b=ae(t.stdin).split(`
349
+ `);b.length>0&&b[b.length-1]===""&&b.pop(),y.push({filename:"",lines:b})}for(let b of y){for(h.FILENAME=b.filename,h.FNR=0,h.lines=b.lines,h.lineIndex=-1,h.shouldNextFile=!1;h.lineIndex<b.lines.length-1;){h.lineIndex++;let w=h.lineIndex;if(await n("line execution",()=>d.executeLine(b.lines[w])),h.shouldExit||h.shouldNextFile)break}if(h.shouldExit)break}return await n("END execution",()=>d.executeEnd()),{stdout:d.getOutput(),stderr:"",exitCode:d.getExitCode()}}catch(y){if(y instanceof de)throw y;let b=y instanceof Error?y.message:String(y),w=y instanceof X?X.EXIT_CODE:2;return{stdout:d.getOutput(),stderr:`awk: ${b}
350
+ `,exitCode:w}}}};V9={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0}});function bh(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=q9.get(s)??1;return r*i}function xh(e){let t=e.trim().toLowerCase().slice(0,3);return Z9.get(t)??0}function K9(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 Eh(e){return e.replace(/[^a-zA-Z0-9\s]/g,"")}function Hl(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 Ah(e,t,n){let r=e,s=t;if(n.dictionaryOrder&&(r=Eh(r),s=Eh(s)),n.ignoreCase&&(r=r.toLowerCase(),s=s.toLowerCase()),n.monthSort){let i=xh(r),o=xh(s);return i-o}if(n.humanNumeric){let i=bh(r),o=bh(s);return i-o}if(n.versionSort)return K9(r,s);if(n.numeric){let i=parseFloat(r)||0,o=parseFloat(s)||0;return i-o}return r.localeCompare(s)}function Sh(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(p,h)=>{let d=p,m=h;if(u&&(d=d.trimStart(),m=m.trimStart()),t.length===0){let y=Ah(d,m,{numeric:r,ignoreCase:s,humanNumeric:o,versionSort:a,dictionaryOrder:l,monthSort:c});if(y!==0)return i?-y:y;if(!f){let b=p.localeCompare(h);return i?-b:b}return 0}for(let g of t){let y=Hl(d,g,n),b=Hl(m,g,n);g.ignoreLeading&&(y=y.trimStart(),b=b.trimStart());let w={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,A=Ah(y,b,w);if(A!==0)return x?-A:A}if(!f){let g=p.localeCompare(h);return i?-g:g}return 0}}function Ch(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=Hl(s,n,t.fieldDelimiter);return(n.ignoreCase??t.ignoreCase)&&(i=i.toLowerCase()),r.has(i)?!1:(r.add(i),!0)})}var q9,Z9,vh=v(()=>{"use strict";q9=new Map([["",1],["k",1024],["m",1048576],["g",1073741824],["t",1099511627776],["p",0x4000000000000],["e",1152921504606847e3]]),Z9=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 po(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 p=parseInt(u[1],10);!Number.isNaN(p)&&p>=1&&(t.endChar=p)}}}return t}var kh=v(()=>{"use strict"});var Nh={};ee(Nh,{flagsForFuzzing:()=>Y9,sortCommand:()=>X9});var Q9,X9,Y9,Ih=v(()=>{"use strict";ge();Or();ie();vh();kh();Q9={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]]
351
+ F is a field number (1-indexed)
352
+ C is a character position within the field (1-indexed)
353
+ OPTS can be: b d f h M n r V (per-key modifiers)
354
+
355
+ Examples:
356
+ -k1 sort by first field
357
+ -k2,2 sort by second field only
358
+ -k1.3 sort by first field starting at 3rd character
359
+ -k1,2n sort by fields 1-2 numerically
360
+ -k2 -k1 sort by field 2, then by field 1`},X9={name:"sort",async execute(e,t){if(U(e))return M(Q9);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 p=po(f);p&&n.keys.push(p)}}else if(u.startsWith("-k")){let f=po(u.slice(2));f&&n.keys.push(f)}else if(u.startsWith("--key=")){let f=po(u.slice(6));f&&n.keys.push(f)}else{if(u.startsWith("--"))return K("sort",u);if(u.startsWith("-")&&!u.startsWith("--")){let f=!1;for(let p of u.slice(1))if(p==="r")n.reverse=!0;else if(p==="n")n.numeric=!0;else if(p==="u")n.unique=!0;else if(p==="f")n.ignoreCase=!0;else if(p==="h")n.humanNumeric=!0;else if(p==="V")n.versionSort=!0;else if(p==="d")n.dictionaryOrder=!0;else if(p==="M")n.monthSort=!0;else if(p==="b")n.ignoreLeadingBlanks=!0;else if(p==="s")n.stable=!0;else if(p==="c")n.checkOnly=!0;else{f=!0;break}if(f)return K("sort",u)}else r.push(u)}}let s=await ss(t,r,{cmdName:"sort"});if(!s.ok)return s.error;let o=ae(s.content).split(`
361
+ `);o.length>0&&o[o.length-1]===""&&o.pop();let a=Sh(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]}
362
+ `,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}o.sort(a),n.unique&&(o=Ch(o,n));let l=o.length>0?`${o.join(`
363
+ `)}
364
+ `:"";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}}},Y9={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 $h={};ee($h,{flagsForFuzzing:()=>nw,uniqCommand:()=>tw});var J9,ew,tw,nw,Oh=v(()=>{"use strict";ge();at();Or();ie();J9={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"]},ew={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"}},tw={name:"uniq",async execute(e,t){if(U(e))return M(J9);let n=Se("uniq",e,ew);if(!n.ok)return n.error;let{count:r,duplicatesOnly:s,uniqueOnly:i,ignoreCase:o}=n.result.flags,a=n.result.positional,l=await ss(t,a,{cmdName:"uniq"});if(!l.ok)return l.error;let u=(o?ae(l.content):l.content).split(`
365
+ `);if(u.length>0&&u[u.length-1]===""&&u.pop(),u.length===0)return{stdout:"",stderr:"",exitCode:0};let f=[],p=u[0],h=1,d=(y,b)=>o?y.toLowerCase()===b.toLowerCase():y===b;for(let y=1;y<u.length;y++)d(u[y],p)?h++:(f.push({line:p,count:h}),p=u[y],h=1);f.push({line:p,count:h});let m=f;s?m=f.filter(y=>y.count>1):i&&(m=f.filter(y=>y.count===1));let g="";for(let{line:y,count:b}of m)r?g+=`${String(b).padStart(4)} ${y}
366
+ `:g+=`${y}
367
+ `;return o?{stdout:g,stderr:"",exitCode:0}:{stdout:g,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},nw={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Th={};ee(Th,{commCommand:()=>sw,flagsForFuzzing:()=>iw});var rw,sw,iw,Rh=v(()=>{"use strict";ge();ie();rw={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"]},sw={name:"comm",async execute(e,t){if(U(e))return M(rw);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 K("comm",g);i.push(g)}if(i.length!==2)return{stdout:"",stderr:`comm: missing operand
368
+ Try 'comm --help' for more information.
369
+ `,exitCode:1};let o=async g=>{if(g==="-")return ae(t.stdin);try{let y=t.fs.resolvePath(t.cwd,g);return await t.fs.readFile(y)}catch{return null}},a=await o(i[0]);if(a===null)return{stdout:"",stderr:`comm: ${i[0]}: No such file or directory
370
+ `,exitCode:1};let l=await o(i[1]);if(l===null)return{stdout:"",stderr:`comm: ${i[1]}: No such file or directory
371
+ `,exitCode:1};let c=a.split(`
372
+ `),u=l.split(`
373
+ `);c.length>0&&c[c.length-1]===""&&c.pop(),u.length>0&&u[u.length-1]===""&&u.pop();let f=0,p=0,h="",d=n?"":" ",m=(n?"":" ")+(r?"":" ");for(;f<c.length||p<u.length;)f>=c.length?(r||(h+=`${d}${u[p]}
374
+ `),p++):p>=u.length?(n||(h+=`${c[f]}
375
+ `),f++):c[f]<u[p]?(n||(h+=`${c[f]}
376
+ `),f++):c[f]>u[p]?(r||(h+=`${d}${u[p]}
377
+ `),p++):(s||(h+=`${m}${c[f]}
378
+ `),f++,p++);return{stdout:h,stderr:"",exitCode:0}}},iw={name:"comm",flags:[{flag:"-1",type:"boolean"},{flag:"-2",type:"boolean"},{flag:"-3",type:"boolean"}],needsArgs:!0,minArgs:2}});var Ph={};ee(Ph,{cutCommand:()=>cw,flagsForFuzzing:()=>uw});function aw(e){let t=[],n=e.split(",");for(let r of n)if(r.includes("-")){let[s,i]=r.split("-");t.push({start:s?parseInt(s,10):1,end:i?parseInt(i,10):null})}else{let s=parseInt(r,10);t.push({start:s,end:s})}return t}function lw(e,t){let n=[];for(let r of t){let s=r.start-1,i=r.end===null?e.length:r.end;for(let o=s;o<i&&o<e.length;o++)o>=0&&!n.includes(e[o])&&n.push(e[o])}return n}var ow,cw,uw,Dh=v(()=>{"use strict";ge();Or();ie();ow={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"]};cw={name:"cut",async execute(e,t){if(U(e))return M(ow);let n=" ",r=null,s=null,i=!1,o=[];for(let p=0;p<e.length;p++){let h=e[p];if(h==="-d")n=e[++p]||" ";else if(h.startsWith("-d"))n=h.slice(2);else if(h==="-f")r=e[++p];else if(h.startsWith("-f"))r=h.slice(2);else if(h==="-c")s=e[++p];else if(h.startsWith("-c"))s=h.slice(2);else if(h==="-s"||h==="--only-delimited")i=!0;else{if(h.startsWith("--"))return K("cut",h);if(h.startsWith("-")){let d=!1;for(let m of h.slice(1))if(m==="s")i=!0;else if(!"dfc".includes(m)){d=!0;break}if(d)return K("cut",h)}else o.push(h)}}if(!r&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
379
+ `,exitCode:1};let a=await ss(t,o,{cmdName:"cut"});if(!a.ok)return a.error;let c=(s?ae(a.content):a.content).split(`
380
+ `);c.length>0&&c[c.length-1]===""&&c.pop();let u=aw(r||s||"1"),f="";for(let p of c)if(s){let h=Array.from(p),d=[];for(let m of u){let g=m.start-1,y=m.end===null?h.length:m.end;for(let b=g;b<y&&b<h.length;b++)b>=0&&d.push(h[b])}f+=`${d.join("")}
381
+ `}else{if(i&&!p.includes(n))continue;let h=p.split(n),d=lw(h,u);f+=`${d.join(n)}
382
+ `}return s?{stdout:f,stderr:"",exitCode:0}:{stdout:f,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},uw={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 Fh={};ee(Fh,{flagsForFuzzing:()=>dw,pasteCommand:()=>hw});function _h(e,t){if(e.length===0)return"";if(e.length===1)return e[0];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 fw,pw,hw,dw,Lh=v(()=>{"use strict";ge();at();ie();fw={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"]},pw={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},hw={name:"paste",async execute(e,t){if(U(e))return M(fw);let n=Se("paste",e,pw);if(!n.ok)return n.error;let r=n.result.flags.delimiter,s=n.result.flags.serial,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ...
383
+ `,exitCode:1};let o=ae(t.stdin),a=o?o.split(`
384
+ `):[""];a.length>0&&a[a.length-1]===""&&a.pop();let l=i.filter(p=>p==="-").length,c=[],u=0;for(let p of i)if(p==="-"){let h=[];for(let d=u;d<a.length;d+=l)h.push(a[d]);c.push(h),u++}else{let h=t.fs.resolvePath(t.cwd,p);try{let m=(await t.fs.readFile(h)).split(`
385
+ `);m.length>0&&m[m.length-1]===""&&m.pop(),c.push(m)}catch{return{stdout:"",stderr:`paste: ${p}: No such file or directory
386
+ `,exitCode:1}}}let f="";if(s)for(let p of c)p&&(f+=`${_h(p,r)}
387
+ `);else{let p=Math.max(...c.map(h=>h?.length??0));for(let h=0;h<p;h++){let d=[];for(let m of c)d.push(m?.[h]??"");f+=`${_h(d,r)}
388
+ `}}return{stdout:f,stderr:"",exitCode:0}}};dw={name:"paste",flags:[{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-s",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Uh={};ee(Uh,{flagsForFuzzing:()=>bw,trCommand:()=>ww});function Mh(e){let t="",n=0;for(;n<e.length;){if(e[n]==="["&&e[n+1]===":"){let r=!1;for(let[s,i]of gw)if(e.slice(n).startsWith(s)){t+=i,n+=s.length,r=!0;break}if(r)continue}if(e[n]==="\\"&&n+1<e.length){let r=e[n+1];r==="n"?t+=`
389
+ `:r==="t"?t+=" ":r==="r"?t+="\r":t+=r,n+=2;continue}if(n+2<e.length&&e[n+1]==="-"){let r=e.charCodeAt(n),s=e.charCodeAt(n+2);if(s-r>65536)throw new Error(`tr: character range too large: '${e[n]}-${e[n+2]}'`);for(let i=r;i<=s;i++)t+=String.fromCharCode(i);n+=3;continue}t+=e[n],n++}return t}var mw,gw,yw,ww,bw,Bh=v(()=>{"use strict";ge();xn();at();ie();mw={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:
390
+ a-z character range
391
+ [:alnum:] all letters and digits
392
+ [:alpha:] all letters
393
+ [:digit:] all digits
394
+ [:lower:] all lowercase letters
395
+ [:upper:] all uppercase letters
396
+ [:space:] all whitespace
397
+ [:blank:] horizontal whitespace
398
+ [:punct:] all punctuation
399
+ [:print:] all printable characters
400
+ [:graph:] all printable characters except space
401
+ [:cntrl:] all control characters
402
+ [:xdigit:] all hexadecimal digits
403
+ \\n, \\t, \\r escape sequences`},gw=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:]",`
404
+ \r\f\v`],["[:upper:]","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["[:xdigit:]","0123456789ABCDEFabcdef"]]);yw={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"}},ww={name:"tr",async execute(e,t){if(U(e))return M(mw);let n=Se("tr",e,yw);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
405
+ `,exitCode:1};if(!s&&!i&&o.length<2)return{stdout:"",stderr:`tr: missing operand after SET1
406
+ `,exitCode:1};let a,l;try{a=Mh(o[0]),l=o.length>1?Mh(o[1]):""}catch(p){return{stdout:"",stderr:`${He(p.message)}
407
+ `,exitCode:1}}let c=ae(t.stdin),u=p=>{let h=a.includes(p);return r?!h:h},f="";if(s)for(let p of c)u(p)||(f+=p);else if(i&&o.length===1){let p="";for(let h of c)u(h)&&h===p||(f+=h,p=h)}else{if(r){let p=l.length>0?l[l.length-1]:"";for(let h of c)a.includes(h)?f+=h:f+=p}else{let p=new Map;for(let h=0;h<a.length;h++){let d=h<l.length?l[h]:l[l.length-1];p.set(a[h],d)}for(let h of c)f+=p.get(h)??h}if(i){let p="",h="";for(let d of f)l.includes(d)&&d===h||(p+=d,h=d);f=p}}return{stdout:f,stderr:"",exitCode:0}}},bw={name:"tr",flags:[{flag:"-c",type:"boolean"},{flag:"-C",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-s",type:"boolean"}],stdinType:"text",needsArgs:!0}});var Wh={};ee(Wh,{flagsForFuzzing:()=>Sw,rev:()=>Aw});function Ew(e){return Array.from(e).reverse().join("")}var xw,Aw,Sw,zh=v(()=>{"use strict";ge();ie();xw={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"]};Aw={name:"rev",execute:async(e,t)=>{if(U(e))return M(xw);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 K("rev",i);n.push(i)}let r="",s=i=>{let o=i.split(`
408
+ `),a=i.endsWith(`
409
+ `)&&o[o.length-1]==="";return a&&o.pop(),o.map(Ew).join(`
410
+ `)+(a?`
411
+ `:"")};if(n.length===0){let i=ae(t.stdin)??"";r=s(i)}else for(let i of n)if(i==="-"){let o=ae(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
412
+ `};r+=s(a)}return{exitCode:0,stdout:r,stderr:""}}},Sw={name:"rev",flags:[],stdinType:"text",needsFiles:!0}});var jh={};ee(jh,{flagsForFuzzing:()=>Iw,nl:()=>Nw});function vw(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 kw(e,t){switch(t){case"a":return!0;case"t":return e.trim().length>0;case"n":return!1;default:return t}}function Hh(e,t,n){if(e==="")return{output:"",nextNumber:n};let r=e.split(`
413
+ `),s=[],i=n,o=e.endsWith(`
414
+ `)&&r[r.length-1]==="";o&&r.pop();for(let a of r)if(kw(a,t.bodyStyle)){let l=vw(i,t.numberFormat,t.width);s.push(`${l}${t.separator}${a}`),i+=t.increment}else{let l=" ".repeat(t.width);s.push(`${l}${t.separator}${a}`)}return{output:s.join(`
415
+ `)+(o?`
416
+ `:""),nextNumber:i}}var Cw,Nw,Iw,Gh=v(()=>{"use strict";ge();ie();Cw={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"]};Nw={name:"nl",execute:async(e,t)=>{if(U(e))return M(Cw);let n={bodyStyle:"t",numberFormat:"rn",width:6,separator:" ",startNumber:1,increment:1},r=[],s=0;for(;s<e.length;){let a=e[s];if(a==="-b"&&s+1<e.length){let l=e[s+1];if(l!=="a"&&l!=="t"&&l!=="n")return{exitCode:1,stdout:"",stderr:`nl: invalid body numbering style: '${l}'
417
+ `};n.bodyStyle=l,s+=2}else if(a.startsWith("-b")){let l=a.slice(2);if(l!=="a"&&l!=="t"&&l!=="n")return{exitCode:1,stdout:"",stderr:`nl: invalid body numbering style: '${l}'
418
+ `};n.bodyStyle=l,s++}else if(a==="-n"&&s+1<e.length){let l=e[s+1];if(l!=="ln"&&l!=="rn"&&l!=="rz")return{exitCode:1,stdout:"",stderr:`nl: invalid line numbering format: '${l}'
419
+ `};n.numberFormat=l,s+=2}else if(a.startsWith("-n")){let l=a.slice(2);if(l!=="ln"&&l!=="rn"&&l!=="rz")return{exitCode:1,stdout:"",stderr:`nl: invalid line numbering format: '${l}'
420
+ `};n.numberFormat=l,s++}else if(a==="-w"&&s+1<e.length){let l=parseInt(e[s+1],10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`nl: invalid line number field width: '${e[s+1]}'
421
+ `};n.width=l,s+=2}else if(a.startsWith("-w")){let l=parseInt(a.slice(2),10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`nl: invalid line number field width: '${a.slice(2)}'
422
+ `};n.width=l,s++}else if(a==="-s"&&s+1<e.length)n.separator=e[s+1],s+=2;else if(a.startsWith("-s"))n.separator=a.slice(2),s++;else if(a==="-v"&&s+1<e.length){let l=parseInt(e[s+1],10);if(Number.isNaN(l))return{exitCode:1,stdout:"",stderr:`nl: invalid starting line number: '${e[s+1]}'
423
+ `};n.startNumber=l,s+=2}else if(a.startsWith("-v")){let l=parseInt(a.slice(2),10);if(Number.isNaN(l))return{exitCode:1,stdout:"",stderr:`nl: invalid starting line number: '${a.slice(2)}'
424
+ `};n.startNumber=l,s++}else if(a==="-i"&&s+1<e.length){let l=parseInt(e[s+1],10);if(Number.isNaN(l))return{exitCode:1,stdout:"",stderr:`nl: invalid line number increment: '${e[s+1]}'
425
+ `};n.increment=l,s+=2}else if(a.startsWith("-i")){let l=parseInt(a.slice(2),10);if(Number.isNaN(l))return{exitCode:1,stdout:"",stderr:`nl: invalid line number increment: '${a.slice(2)}'
426
+ `};n.increment=l,s++}else if(a==="--"){r.push(...e.slice(s+1));break}else{if(a.startsWith("-")&&a!=="-")return K("nl",a);r.push(a),s++}}let i="",o=n.startNumber;if(r.length===0){let a=ae(t.stdin)??"";i=Hh(a,n,o).output}else for(let a of r){let l=t.fs.resolvePath(t.cwd,a),c=await t.fs.readFile(l);if(c===null)return{exitCode:1,stdout:i,stderr:`nl: ${a}: No such file or directory
427
+ `};let u=Hh(c,n,o);i+=u.output,o=u.nextNumber}return{exitCode:0,stdout:i,stderr:""}}},Iw={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 qh={};ee(qh,{flagsForFuzzing:()=>Pw,fold:()=>Rw});function Ow(e,t,n){return n?new TextEncoder().encode(e).length:e===" "?8-t%8:e==="\b"?-1:1}function Tw(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=0;u<e.length;u++){let f=e[u],p=Ow(f,a,s);a+p>n&&o.length>0?r&&l>=0?(i.push(o.slice(0,l+1)),o=o.slice(l+1)+f,a=a-c-1+p,l=-1,c=0):(i.push(o),o=f,a=p,l=-1,c=0):(o+=f,a+=p,(f===" "||f===" ")&&(l=o.length-1,c=a-p))}return o.length>0&&i.push(o),i.join(`
428
+ `)}function Vh(e,t){if(e==="")return"";let n=e.split(`
429
+ `),r=e.endsWith(`
430
+ `)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>Tw(i,t)).join(`
431
+ `)+(r?`
432
+ `:"")}var $w,Rw,Pw,Zh=v(()=>{"use strict";ge();ie();$w={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"]};Rw={name:"fold",execute:async(e,t)=>{if(U(e))return M($w);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]}'
433
+ `};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)}'
434
+ `};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}'
435
+ `};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]}'
436
+ `};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 K("fold",o);s++}else r.push(o),s++}let i="";if(r.length===0){let o=ae(t.stdin)??"";i=Vh(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
437
+ `};i+=Vh(l,n)}return{exitCode:0,stdout:i,stderr:""}}},Pw={name:"fold",flags:[{flag:"-w",type:"value",valueHint:"number"},{flag:"-s",type:"boolean"},{flag:"-b",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Qh={};ee(Qh,{expand:()=>Lw,flagsForFuzzing:()=>Mw});function ho(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 _w(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 Fw(e,t){let{tabStops:n,leadingOnly:r}=t,s="",i=0,o=!0;for(let a of e)if(a===" ")if(r&&!o)s+=a,i++;else{let l=_w(i,n);s+=" ".repeat(l),i+=l}else a!==" "&&a!==" "&&(o=!1),s+=a,i++;return s}function Kh(e,t){if(e==="")return"";let n=e.split(`
438
+ `),r=e.endsWith(`
439
+ `)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>Fw(i,t)).join(`
440
+ `)+(r?`
441
+ `:"")}var Dw,Lw,Mw,Xh=v(()=>{"use strict";ge();ie();Dw={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"]};Lw={name:"expand",execute:async(e,t)=>{if(U(e))return M(Dw);let n={tabStops:[8],leadingOnly:!1},r=[],s=0;for(;s<e.length;){let o=e[s];if(o==="-t"&&s+1<e.length){let a=ho(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${e[s+1]}'
442
+ `};n.tabStops=a,s+=2}else if(o.startsWith("-t")&&o.length>2){let a=ho(o.slice(2));if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${o.slice(2)}'
443
+ `};n.tabStops=a,s++}else if(o==="--tabs"&&s+1<e.length){let a=ho(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${e[s+1]}'
444
+ `};n.tabStops=a,s+=2}else if(o.startsWith("--tabs=")){let a=ho(o.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${o.slice(7)}'
445
+ `};n.tabStops=a,s++}else if(o==="-i"||o==="--initial")n.leadingOnly=!0,s++;else if(o==="--"){r.push(...e.slice(s+1));break}else{if(o.startsWith("-")&&o!=="-")return K("expand",o);r.push(o),s++}}let i="";if(r.length===0){let o=ae(t.stdin)??"";i=Kh(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:`expand: ${o}: No such file or directory
446
+ `};i+=Kh(l,n)}return{exitCode:0,stdout:i,stderr:""}}},Mw={name:"expand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}});var ed={};ee(ed,{flagsForFuzzing:()=>zw,unexpand:()=>Ww});function mo(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 Yh(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 Bw(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,p="";for(;f<u;){let d=Yh(f,n);if(d<=u&&d>f)p+=" ",f=d;else break}let h=u-f;h>0&&(p+=" ".repeat(h)),s+=p,o=""};for(let u of e)u===" "?(o.length===0&&(a=i),o+=u,i++):u===" "?(c(),s+=u,i=Yh(i,n)):(c(),s+=u,i++,l=!1);return c(),s}function Jh(e,t){if(e==="")return"";let n=e.split(`
447
+ `),r=e.endsWith(`
448
+ `)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>Bw(i,t)).join(`
449
+ `)+(r?`
450
+ `:"")}var Uw,Ww,zw,td=v(()=>{"use strict";ge();ie();Uw={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"]};Ww={name:"unexpand",execute:async(e,t)=>{if(U(e))return M(Uw);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=mo(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${e[s+1]}'
451
+ `};n.tabStops=a,s+=2}else if(o.startsWith("-t")&&o.length>2){let a=mo(o.slice(2));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${o.slice(2)}'
452
+ `};n.tabStops=a,s++}else if(o==="--tabs"&&s+1<e.length){let a=mo(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${e[s+1]}'
453
+ `};n.tabStops=a,s+=2}else if(o.startsWith("--tabs=")){let a=mo(o.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${o.slice(7)}'
454
+ `};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 K("unexpand",o);r.push(o),s++}}let i="";if(r.length===0){let o=ae(t.stdin)??"";i=Jh(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
455
+ `};i+=Jh(l,n)}return{exitCode:0,stdout:i,stderr:""}}},zw={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0}});var sd={};ee(sd,{flagsForFuzzing:()=>Vw,strings:()=>Gw});function jw(e){return e>=32&&e<=126||e===9}function nd(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 rd(e,t){let n=[],r="",s=0,i=typeof e=="string"?new TextEncoder().encode(e):e;for(let o=0;o<i.length;o++){let a=i[o];if(jw(a))r.length===0&&(s=o),r+=String.fromCharCode(a);else{if(r.length>=t.minLength){let l=nd(s,t.offsetFormat);n.push(`${l}${r}`)}r=""}}if(r.length>=t.minLength){let o=nd(s,t.offsetFormat);n.push(`${o}${r}`)}return n}var Hw,Gw,Vw,id=v(()=>{"use strict";ge();ie();Hw={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"]};Gw={name:"strings",execute:async(e,t)=>{if(U(e))return M(Hw);let n={minLength:4,offsetFormat:null},r=[],s=0;for(;s<e.length;){let a=e[s];if(a==="-n"&&s+1<e.length){let l=Number.parseInt(e[s+1],10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e[s+1]}'
456
+ `};n.minLength=l,s+=2}else if(a.match(/^-n\d+$/)){let l=Number.parseInt(a.slice(2),10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${a.slice(2)}'
457
+ `};n.minLength=l,s++}else if(a.match(/^-\d+$/)){let l=Number.parseInt(a.slice(1),10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${a.slice(1)}'
458
+ `};n.minLength=l,s++}else if(a==="-t"&&s+1<e.length){let l=e[s+1];if(l!=="o"&&l!=="x"&&l!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${l}'
459
+ `};n.offsetFormat=l,s+=2}else if(a.startsWith("-t")&&a.length===3){let l=a[2];if(l!=="o"&&l!=="x"&&l!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${l}'
460
+ `};n.offsetFormat=l,s++}else if(a==="-a"||a==="--all"||a==="-")a==="-"&&r.push(a),s++;else if(a==="-e"&&s+1<e.length){let l=e[s+1];if(l!=="s"&&l!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${l}'
461
+ `};s+=2}else if(a.startsWith("-e")&&a.length===3){let l=a[2];if(l!=="s"&&l!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${l}'
462
+ `};s++}else if(a==="--"){r.push(...e.slice(s+1));break}else{if(a.startsWith("-")&&a!=="-")return K("strings",a);r.push(a),s++}}let i="",o=()=>Uint8Array.from(t.stdin??"",a=>a.charCodeAt(0));if(r.length===0){let a=rd(o(),n);i=a.length>0?`${a.join(`
463
+ `)}
464
+ `:""}else for(let a of r){let l;if(a==="-")l=o();else{let u=t.fs.resolvePath(t.cwd,a);try{l=await t.fs.readFileBuffer(u)}catch{return{exitCode:1,stdout:i,stderr:`strings: ${a}: No such file or directory
465
+ `}}}let c=rd(l,n);c.length>0&&(i+=`${c.join(`
466
+ `)}
467
+ `)}return{exitCode:0,stdout:i,stderr:""}}},Vw={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 ld={};ee(ld,{flagsForFuzzing:()=>Jw,split:()=>Yw});function ad(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let n=Number.parseInt(t[1],10);if(Number.isNaN(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?null:n*i}function Zw(e,t,n){if(t)return e.toString().padStart(n,"0");let r="abcdefghijklmnopqrstuvwxyz",s="",i=e;for(let o=0;o<n;o++)s=r[i%26]+s,i=Math.floor(i/26);return s}function Kw(e,t){let n=e.split(`
468
+ `),r=e.endsWith(`
469
+ `)&&n[n.length-1]==="";r&&n.pop();let s=[];for(let i=0;i<n.length;i+=t){let o=n.slice(i,i+t),l=i+t>=n.length&&!r?o.join(`
470
+ `):`${o.join(`
471
+ `)}
472
+ `;s.push({content:l,hasContent:!0})}return s}function Qw(e,t){let r=new TextEncoder().encode(e),s=new TextDecoder,i=[];for(let o=0;o<r.length;o+=t){let a=r.slice(o,o+t);i.push({content:s.decode(a),hasContent:a.length>0})}return i}function Xw(e,t){let r=new TextEncoder().encode(e),s=new TextDecoder,i=[],o=Math.ceil(r.length/t);for(let a=0;a<t;a++){let l=a*o,c=Math.min(l+o,r.length),u=r.slice(l,c);i.push({content:s.decode(u),hasContent:u.length>0})}return i}var qw,od,Yw,Jw,cd=v(()=>{"use strict";ge();ie();qw={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, ..."]},od=1e5;Yw={name:"split",execute:async(e,t)=>{if(U(e))return M(qw);let n={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},r=[],s=0;for(;s<e.length;){let c=e[s];if(c==="-l"&&s+1<e.length){let u=Number.parseInt(e[s+1],10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[s+1]}'
473
+ `};n.mode="lines",n.lines=u,s+=2}else if(c.match(/^-l\d+$/)){let u=Number.parseInt(c.slice(2),10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${c.slice(2)}'
474
+ `};n.mode="lines",n.lines=u,s++}else if(c==="-b"&&s+1<e.length){let u=ad(e[s+1]);if(u===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${e[s+1]}'
475
+ `};n.mode="bytes",n.bytes=u,s+=2}else if(c.match(/^-b.+$/)){let u=ad(c.slice(2));if(u===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${c.slice(2)}'
476
+ `};n.mode="bytes",n.bytes=u,s++}else if(c==="-n"&&s+1<e.length){let u=Number.parseInt(e[s+1],10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${e[s+1]}'
477
+ `};n.mode="chunks",n.chunks=u,s+=2}else if(c.match(/^-n\d+$/)){let u=Number.parseInt(c.slice(2),10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${c.slice(2)}'
478
+ `};n.mode="chunks",n.chunks=u,s++}else if(c==="-a"&&s+1<e.length){let u=Number.parseInt(e[s+1],10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${e[s+1]}'
479
+ `};n.suffixLength=u,s+=2}else if(c.match(/^-a\d+$/)){let u=Number.parseInt(c.slice(2),10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${c.slice(2)}'
480
+ `};n.suffixLength=u,s++}else if(c==="-d"||c==="--numeric-suffixes")n.useNumericSuffix=!0,s++;else if(c.startsWith("--additional-suffix="))n.additionalSuffix=c.slice(20),s++;else if(c==="--additional-suffix"&&s+1<e.length)n.additionalSuffix=e[s+1],s+=2;else if(c==="--"){r.push(...e.slice(s+1));break}else{if(c.startsWith("-")&&c!=="-")return K("split",c);r.push(c),s++}}let i="-",o="x";r.length>=1&&(i=r[0]),r.length>=2&&(o=r[1]);let a;if(i==="-")a=t.stdin??"";else{let c=t.fs.resolvePath(t.cwd,i);try{let u=await _n(t.fs,c);a=u}catch{return{exitCode:1,stdout:"",stderr:`split: ${i}: No such file or directory
481
+ `}}}if(a==="")return{exitCode:0,stdout:"",stderr:""};let l;switch(n.mode){case"lines":l=Kw(a,n.lines);break;case"bytes":l=Qw(a,n.bytes);break;case"chunks":l=Xw(a,n.chunks);break;default:return n.mode}if(l.length>od)return{exitCode:1,stdout:"",stderr:`split: too many output files (${l.length}), limit is ${od}
482
+ `};for(let c=0;c<l.length;c++){let u=l[c];if(!u.hasContent)continue;let f=Zw(c,n.useNumericSuffix,n.suffixLength),p=`${o}${f}${n.additionalSuffix}`,h=t.fs.resolvePath(t.cwd,p);await t.fs.writeFile(h,u.content,"binary")}return{exitCode:0,stdout:"",stderr:""}}},Jw={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 fd={};ee(fd,{column:()=>ib,flagsForFuzzing:()=>ob});function ud(e,t,n){return t?n?e.split(t):e.split(t).filter(r=>r.length>0):n?e.split(/[ \t]/):e.split(/[ \t]+/).filter(r=>r.length>0)}function nb(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 rb(e,t){if(e.length===0)return"";let n=nb(e),r=[];for(let s of e){let i=[];for(let o=0;o<s.length;o++)o===s.length-1?i.push(s[o]):i.push(s[o].padEnd(n[o]));r.push(i.join(t))}return r.join(`
483
+ `)}function sb(e,t,n){if(e.length===0)return"";let r=Math.max(...e.map(c=>c.length)),s=n.length,i=r+s,o=Math.max(1,Math.floor((t+s)/i)),a=Math.ceil(e.length/o),l=[];for(let c=0;c<a;c++){let u=[];for(let f=0;f<o;f++){let p=f*a+c;p<e.length&&(f===o-1||(f+1)*a+c>=e.length?u.push(e[p]):u.push(e[p].padEnd(r)))}l.push(u.join(n))}return l.join(`
484
+ `)}var eb,tb,ib,ob,pd=v(()=>{"use strict";ge();at();ie();eb={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"]},tb={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"}};ib={name:"column",execute:async(e,t)=>{if(U(e))return M(eb);let n=Se("column",e,tb);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;if(l.length===0)u=ae(t.stdin)??"";else{let m=[];for(let g of l)if(g==="-")m.push(ae(t.stdin)??"");else{let y=t.fs.resolvePath(t.cwd,g),b=await t.fs.readFile(y);if(b===null)return{exitCode:1,stdout:"",stderr:`column: ${g}: No such file or directory
485
+ `};m.push(b)}u=m.join("")}if(u===""||u.trim()==="")return{exitCode:0,stdout:"",stderr:""};let f=u.split(`
486
+ `);u.endsWith(`
487
+ `)&&f[f.length-1]===""&&f.pop();let h=f.filter(m=>m.trim().length>0),d;if(r){let m=h.map(g=>ud(g,s,a));d=rb(m,c)}else{let m=[];for(let g of h){let y=ud(g,s,a);m.push(...y)}d=sb(m,o,c)}return d.length>0&&(d+=`
488
+ `),{exitCode:0,stdout:d,stderr:""}}},ob={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 hd={};ee(hd,{flagsForFuzzing:()=>pb,join:()=>fb});function lb(e,t){return t?e.split(t):e.split(/[ \t]+/).filter(n=>n.length>0)}function cb(e,t,n,r){let s=lb(e,t),i=s[n-1]??"";return r&&(i=i.toLowerCase()),{fields:s,joinKey:i,original:e}}function jl(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 ub(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 ab,fb,pb,dd=v(()=>{"use strict";ge();ie();ab={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"]};fb={name:"join",execute:async(e,t)=>{if(U(e))return M(ab);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 p=e[s];if(p==="-1"&&s+1<e.length){let h=Number.parseInt(e[s+1],10);if(Number.isNaN(h)||h<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${e[s+1]}'
489
+ `};n.field1=h,s+=2}else if(p==="-2"&&s+1<e.length){let h=Number.parseInt(e[s+1],10);if(Number.isNaN(h)||h<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${e[s+1]}'
490
+ `};n.field2=h,s+=2}else if((p==="-t"||p==="--field-separator")&&s+1<e.length)n.separator=e[s+1],s+=2;else if(p.startsWith("-t")&&p.length>2)n.separator=p.slice(2),s++;else if(p==="-a"&&s+1<e.length){let h=Number.parseInt(e[s+1],10);if(h!==1&&h!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${e[s+1]}'
491
+ `};n.printUnpairable.add(h),s+=2}else if(p.match(/^-a[12]$/))n.printUnpairable.add(Number.parseInt(p[2],10)),s++;else if(p==="-v"&&s+1<e.length){let h=Number.parseInt(e[s+1],10);if(h!==1&&h!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${e[s+1]}'
492
+ `};n.onlyUnpairable.add(h),s+=2}else if(p.match(/^-v[12]$/))n.onlyUnpairable.add(Number.parseInt(p[2],10)),s++;else if(p==="-e"&&s+1<e.length)n.emptyString=e[s+1],s+=2;else if(p==="-o"&&s+1<e.length){let h=ub(e[s+1]);if(!h)return{exitCode:1,stdout:"",stderr:`join: invalid field spec: '${e[s+1]}'
493
+ `};n.outputFormat=h,s+=2}else if(p==="-i"||p==="--ignore-case")n.ignoreCase=!0,s++;else if(p==="--"){r.push(...e.slice(s+1));break}else{if(p.startsWith("-")&&p!=="-")return K("join",p);r.push(p),s++}}if(r.length!==2)return{exitCode:1,stdout:"",stderr:r.length<2?`join: missing file operand
494
+ `:`join: extra operand
495
+ `};let i=[];for(let p of r)if(p==="-")i.push(ae(t.stdin)??"");else{let h=t.fs.resolvePath(t.cwd,p),d=await t.fs.readFile(h);if(d===null)return{exitCode:1,stdout:"",stderr:`join: ${p}: No such file or directory
496
+ `};i.push(d)}let o=(p,h)=>{let d=p.split(`
497
+ `);return p.endsWith(`
498
+ `)&&d[d.length-1]===""&&d.pop(),d.filter(m=>m.length>0).map(m=>cb(m,n.separator,h,n.ignoreCase))},a=o(i[0],n.field1),l=o(i[1],n.field2),c=new Map;for(let p of l){let h=c.get(p.joinKey);h?h.push(p):c.set(p.joinKey,[p])}let u=[],f=new Set;for(let p of a){let h=c.get(p.joinKey);if(h&&h.length>0){if(f.add(p.joinKey),n.onlyUnpairable.size===0)for(let d of h)u.push(jl(p,d,n))}else(n.printUnpairable.has(1)||n.onlyUnpairable.has(1))&&u.push(jl(p,null,n))}if(n.printUnpairable.has(2)||n.onlyUnpairable.has(2))for(let p of l)f.has(p.joinKey)||u.push(jl(null,p,n));return{exitCode:0,stdout:Dn(u.length>0?`${u.join(`
499
+ `)}
500
+ `:""),stderr:"",stdoutEncoding:"binary"}}},pb={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 md={};ee(md,{flagsForFuzzing:()=>gb,teeCommand:()=>mb});var hb,db,mb,gb,gd=v(()=>{"use strict";ge();at();ie();hb={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"]},db={append:{short:"a",long:"append",type:"boolean"}},mb={name:"tee",async execute(e,t){if(U(e))return M(hb);let n=Se("tee",e,db);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
501
+ `,a=1}return{stdout:i,stderr:o,exitCode:a,stdoutEncoding:"binary"}}},gb={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0}});function dn(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:Dt(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:Dt(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:Q(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let r=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=r>e.days:e.comparison==="less"?s=r<e.days:s=Math.floor(r)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let r;return e.comparison==="more"?r=t.size>n:e.comparison==="less"?r=t.size<n:e.unit==="b"?r=Math.ceil(t.size/512)===e.value:r=t.size===n,{matches:r,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,r=e.mode&511,s;return e.matchType==="exact"?s=n===r:e.matchType==="all"?s=(n&r)===r:s=(n&r)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=dn(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=dn(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=dn(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case"or":{let n=dn(e.left,t);if(n.matches)return n;let r=dn(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function oi(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return oi(e.expr);case"and":case"or":return oi(e.left)||oi(e.right)}}function ai(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return ai(e.expr);case"and":case"or":return ai(e.left)||ai(e.right);default:return!1}}function yd(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=yb(e);if(wb(e)&&n.length===1){let i=n[0].split("/").filter(o=>o.length>0);if(i.length>=2)for(let o=i.length-2;o>=0;o--){let a=i[o];if(!a.includes("*")&&!a.includes("?")&&!a.includes("[")&&a!=="."&&a!==".."){let l=i[o+1];if(l&&(l.includes("*")||l.includes("?"))){t.terminalDirName=a;let c=l.match(/^\*(\.[a-zA-Z0-9]+)$/);c&&(t.requiredExtension=c[1])}break}}}return t}function yb(e){let t=[],n=r=>{r.type==="path"?t.push(r.pattern):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right))};return n(e),t}function wb(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function wd(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 li(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return li(e.expr);case"and":case"or":return li(e.left)&&li(e.right)}}function Lr(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:Dt(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:Dt(n,i,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let i=e.ignoreCase?"i":"";return{matches:Q(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"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let i=Lr(e.expr,t,n,r,s);return{matches:!i.matches,pruned:i.pruned,printed:!1}}case"and":{let i=Lr(e.left,t,n,r,s);if(!i.matches)return{matches:!1,pruned:i.pruned,printed:!1};let o=Lr(e.right,t,n,r,s);return{matches:o.matches,pruned:i.pruned||o.pruned,printed:i.printed||o.printed}}case"or":{let i=Lr(e.left,t,n,r,s);if(i.matches)return i;let o=Lr(e.right,t,n,r,s);return{matches:o.matches,pruned:i.pruned||o.pruned,printed:o.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function ci(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return ci(e.expr);case"and":case"or":return ci(e.left)||ci(e.right);default:return!1}}function ur(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return ur(e.expr);case"and":case"or":return ur(e.left)&&ur(e.right)}}function bd(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!ur(e))return Gl(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:dn(e,n).pruned}}function Gl(e,t){switch(e.type){case"or":{if(ur(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(dn(e.left,n).pruned)return{shouldPrune:!0}}return Gl(e.right,t)}case"and":{if(ur(e.left)&&ur(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:dn(e,n).pruned}}if(ur(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 dn(e.left,n).matches?Gl(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}var xd=v(()=>{"use strict";Ze();gl()});function Ed(e,t){let n=[],r=[],s=t;for(;s<e.length;){let o=e[s];if(o==="("||o==="\\("){n.push({type:"lparen"}),s++;continue}if(o===")"||o==="\\)"){n.push({type:"rparen"}),s++;continue}if(o==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(o==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(o==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(o==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(o==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(o==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(o==="-type"&&s+1<e.length){let a=e[++s];if(a==="f"||a==="d")n.push({type:"expr",expr:{type:"type",fileType:a}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${a}
502
+ `,actions:[]}}else if(o==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(o==="-mtime"&&s+1<e.length){let a=e[++s],l="exact",c=a;a.startsWith("+")?(l="more",c=a.slice(1)):a.startsWith("-")&&(l="less",c=a.slice(1));let u=parseInt(c,10);Number.isNaN(u)||n.push({type:"expr",expr:{type:"mtime",days:u,comparison:l}})}else if(o==="-newer"&&s+1<e.length){let a=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:a}})}else if(o==="-size"&&s+1<e.length){let a=e[++s],l="exact",c=a;a.startsWith("+")?(l="more",c=a.slice(1)):a.startsWith("-")&&(l="less",c=a.slice(1));let u=c.match(/^(\d+)([ckMGb])?$/);if(u){let f=parseInt(u[1],10),p=u[2]||"b";n.push({type:"expr",expr:{type:"size",value:f,unit:p,comparison:l}})}}else if(o==="-perm"&&s+1<e.length){let a=e[++s],l="exact",c=a;a.startsWith("-")?(l="all",c=a.slice(1)):a.startsWith("/")&&(l="any",c=a.slice(1));let u=parseInt(c,8);Number.isNaN(u)||n.push({type:"expr",expr:{type:"perm",mode:u,matchType:l}})}else if(o==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(o==="-not"||o==="!")n.push({type:"not"});else if(o==="-o"||o==="-or")n.push({type:"op",op:"or"});else if(o==="-a"||o==="-and")n.push({type:"op",op:"and"});else if(o==="-maxdepth"||o==="-mindepth")s++;else if(o!=="-depth")if(o==="-exec"){let a=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)a.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let l=e[s]==="+";r.push({type:"exec",command:a,batchMode:l})}else if(o==="-print")n.push({type:"expr",expr:{type:"print"}}),r.push({type:"print"});else if(o==="-print0")r.push({type:"print0"});else if(o==="-printf"&&s+1<e.length){let a=e[++s];r.push({type:"printf",format:a})}else if(o==="-delete")r.push({type:"delete"});else{if(o.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${o}'
503
+ `,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:r};let i=bb(n);return i.error?{expr:null,pathIndex:s,error:i.error,actions:r}:{expr:i.expr,pathIndex:s,actions:r}}function bb(e){let t=0;function n(){let a=r();if(!a)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="or"){t++;let c=r();if(!c)return a;a={type:"or",left:a,right:c}}else break}return a}function r(){let a=s();if(!a)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="and"){t++;let c=s();if(!c)return a;a={type:"and",left:a,right:c}}else if(l.type==="expr"||l.type==="not"||l.type==="lparen"){let c=s();if(!c)return a;a={type:"and",left:a,right:c}}else break}return a}function s(){if(t<e.length&&e[t].type==="not"){t++;let a=s();return a?{type:"not",expr:a}:null}return i()}function i(){if(t>=e.length)return null;let a=e[t];if(a.type==="lparen"){t++;let l=n();return t<e.length&&e[t].type==="rparen"&&t++,l}return a.type==="expr"?(t++,a.expr):(a.type==="rparen",null)}return{expr:n()}}var Ad=v(()=>{"use strict"});var Cd={};ee(Cd,{findCommand:()=>Cb,flagsForFuzzing:()=>Ib});function xb(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function Eb(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 vb(e,t){let n=Bi(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]=zf(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=Ks(t.mode,t.isDirectory),s++;break;case"t":{let u=new Date(t.mtime);c=kb(u),s++;break}case"T":{if(s+1<n.length){let u=n[s+1],f=new Date(t.mtime);c=Nb(f,u),s+=2}else c="%T",s++;break}default:r+=`%${i!==0||o!==-1?`${i}.${o}`:""}${l}`,s++;continue}r+=Ui(c,i,o)}else r+=n[s],s++;return r}function kb(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 Nb(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 Sd,Ab,Sb,Cb,Ib,vd=v(()=>{"use strict";Rr();Ja();ie();Ka();xd();Ad();Sd=500;Ab={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"]},Sb=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),Cb={name:"find",async execute(e,t){if(U(e))return M(Ab);let n=[],r=null,s=null,i=!1,o=!1;for(let O=0;O<e.length;O++){let T=e[O];if(T==="-maxdepth"&&O+1<e.length)o=!0,r=parseInt(e[++O],10);else if(T==="-mindepth"&&O+1<e.length)o=!0,s=parseInt(e[++O],10);else if(T==="-depth")o=!0,i=!0;else if(T==="-exec")for(o=!0,O++;O<e.length&&e[O]!==";"&&e[O]!=="+";)O++;else!T.startsWith("-")&&T!==";"&&T!=="+"&&T!=="("&&T!==")"&&T!=="\\("&&T!=="\\)"&&T!=="!"?o||n.push(T):Sb.has(T)?(o=!0,O++):(T.startsWith("-")||T==="("||T==="\\("||T==="!")&&(o=!0)}n.length===0&&n.push(".");let{expr:a,error:l,actions:c}=Ed(e,0);if(l)return{stdout:"",stderr:l,exitCode:1};let u=c.some(O=>O.type==="print"),f=c.length===0,p=[],h=c.some(O=>O.type==="printf"),d=[],m="",g=0,y=wd(a),b=new Map;for(let O of y){let T=t.fs.resolvePath(t.cwd,O);try{let N=await t.fs.stat(T);b.set(O,N.mtime?.getTime()??Date.now())}catch{}}let w=c.some(O=>{if(O.type!=="printf")return!1;let T=O.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(T)}),x=oi(a)||w,A=ai(a),I=yd(a),$=ci(a),D=li(a),R=typeof t.fs.readdirWithFileTypes=="function";for(let O of n){let Z=function(V){let te=s===null||V.depth>=s,ve=!1;if(te&&a!==null){let Pe=Date.now(),j;if(D)j=Lr(a,V.name,V.relativePath,V.isFile,V.isDirectory);else{let Re={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:b};j=dn(a,Re)}te=j.matches,ve=u?j.printed:te,N.evalCalls++,N.evalTime+=Date.now()-Pe}else te&&(ve=!0);return ve?{print:!0,printfData:h?{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:O}:null}:{print:!1,printfData:null}};var C=Z;O.length>1&&O.endsWith("/")&&(O=O.slice(0,-1));let T=t.fs.resolvePath(t.cwd,O);try{await t.fs.stat(T)}catch{m+=`find: ${O}: No such file or directory
504
+ `,g=1;continue}let N=xb(),F=Date.now();async function B(V){let{path:H,depth:te,typeInfo:ve}=V;if(N.nodeCount++,te>(r??256))return null;let se,Pe,j;if(ve&&!x)se=ve.isFile,Pe=ve.isDirectory;else{try{let Nr=Date.now();j=await t.fs.stat(H),N.statCalls++,N.statTime+=Date.now()-Nr}catch{return null}if(!j)return null;se=j.isFile,Pe=j.isDirectory}let Re;H===T?Re=O.split("/").pop()||O:Re=H.split("/").pop()||"";let Qe=H===T?O:O==="."?`./${H.slice(T==="/"?T.length:T.length+1)}`:O+H.slice(T.length),pt=[],ht=null,ot=null,dt=!1;Pe&&$&&!i&&(dt=bd(a,{name:Re,relativePath:Qe,isFile:se,isDirectory:Pe}).shouldPrune,dt&&N.earlyPrunes++);let en=te>=(r??256),tn=I.terminalDirName!==null&&Re===I.terminalDirName,qs=!en&&!tn&&!dt;if(Pe&&((qs||A||tn)&&!dt)){let Nr=Date.now();if(R&&t.fs.readdirWithFileTypes){if(ht=await t.fs.readdirWithFileTypes(H),ot=ht.map(zt=>zt.name),N.readdirCalls++,N.readdirTime+=Date.now()-Nr,qs)pt=ht.map((zt,cn)=>({path:H==="/"?`/${zt.name}`:`${H}/${zt.name}`,depth:te+1,typeInfo:{isFile:zt.isFile,isDirectory:zt.isDirectory},resultIndex:cn}));else if(tn){let zt=I.requiredExtension;pt=ht.filter(cn=>cn.isFile&&(!zt||cn.name.endsWith(zt))).map((cn,z7)=>({path:H==="/"?`/${cn.name}`:`${H}/${cn.name}`,depth:te+1,typeInfo:{isFile:cn.isFile,isDirectory:cn.isDirectory},resultIndex:z7}))}}else ot=await t.fs.readdir(H),N.readdirCalls++,N.readdirTime+=Date.now()-Nr,qs&&(pt=ot.map((zt,cn)=>({path:H==="/"?`/${zt}`:`${H}/${zt}`,depth:te+1,resultIndex:cn})))}let Fi=se?(j?.size??0)===0:ot!==null&&ot.length===0,ts=dt;if(!i&&a!==null&&!dt&&$){let Nr=Date.now(),zt={name:Re,relativePath:Qe,isFile:se,isDirectory:Pe,isEmpty:Fi,mtime:j?.mtime?.getTime()??Date.now(),size:j?.size??0,mode:j?.mode??420,newerRefTimes:b};ts=dn(a,zt).pruned,N.evalCalls++,N.evalTime+=Date.now()-Nr}return{relativePath:Qe,name:Re,isFile:se,isDirectory:Pe,isEmpty:Fi,stat:j,depth:te,children:ts?[]:pt,pruned:ts}}async function oe(){let V={paths:[],printfData:[]};if(i){let j=function(Re){let Qe={paths:[],printfData:[]},pt=ve[Re];if(!pt)return Qe;for(let dt of pt.childIndices){let en=j(dt);Qe.paths.push(...en.paths),Qe.printfData.push(...en.printfData)}let{print:ht,printfData:ot}=Z(pt.node);return ht&&(Qe.paths.push(pt.node.relativePath),ot&&Qe.printfData.push(ot)),Qe};var H=j;let ve=[],se=[{item:{path:T,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],Pe=new Map;for(;se.length>0;){let Re=Date.now(),Qe=se.splice(0,Sd),pt=await Promise.all(Qe.map(ht=>B(ht.item)));N.batchCount++,N.batchTime+=Date.now()-Re;for(let ht=0;ht<Qe.length;ht++){let ot=pt[ht],dt=Qe[ht];if(!ot)continue;let en=ve.length;if(dt.parentIndex>=0){let tn=Pe.get(dt.parentIndex)||[];tn.push(en),Pe.set(dt.parentIndex,tn)}ve.push({node:ot,parentIndex:dt.parentIndex,childIndices:[]});for(let tn=0;tn<ot.children.length;tn++)se.push({item:ot.children[tn],parentIndex:en,childOrderInParent:tn})}}for(let[Re,Qe]of Pe)Re>=0&&Re<ve.length&&(ve[Re].childIndices=Qe);if(ve.length>0){let Re=j(0);V.paths.push(...Re.paths),V.printfData.push(...Re.printfData)}}else{let Re=function(Qe){let pt=ve.get(Qe);pt&&(V.paths.push(pt.path),pt.printfData&&V.printfData.push(pt.printfData));let ht=j.get(Qe);if(ht)for(let ot of ht)Re(ot)};var te=Re;let ve=new Map,se=0,Pe=[{item:{path:T,depth:0,resultIndex:0},orderIndex:se++}],j=new Map;for(;Pe.length>0;){let Qe=Date.now(),pt=Pe.splice(0,Sd),ht=await Promise.all(pt.map(async({item:ot,orderIndex:dt})=>{let en=await B(ot);return en?{node:en,orderIndex:dt}:null}));N.batchCount++,N.batchTime+=Date.now()-Qe;for(let ot of ht){if(!ot)continue;let{node:dt,orderIndex:en}=ot,{print:tn,printfData:qs}=Z(dt);if(tn&&ve.set(en,{path:dt.relativePath,printfData:qs}),dt.children.length>0){let ja=[];for(let Fi of dt.children){let ts=se++;ja.push(ts),Pe.push({item:Fi,orderIndex:ts})}j.set(en,ja)}}}Re(0)}return V}let ye=await oe();if(p.push(...ye.paths),d.push(...ye.printfData),t.trace){let V=Date.now()-F;Eb(t.trace,N,V),t.trace({category:"find",name:"searchPath",durationMs:V,details:{path:O,resultsFound:ye.paths.length}})}}let L="";if(c.length>0)for(let O of c)switch(O.type){case"print":L+=p.length>0?`${p.join(`
505
+ `)}
506
+ `:"";break;case"print0":L+=p.length>0?`${p.join("\0")}\0`:"";break;case"delete":{let T=[...p].sort((N,F)=>F.length-N.length);for(let N of T){let F=t.fs.resolvePath(t.cwd,N);try{await t.fs.rm(F,{recursive:!1})}catch(B){let Z=B instanceof Error?B.message:String(B);m+=`find: cannot delete '${N}': ${Z}
507
+ `,g=1}}break}case"printf":for(let T of d)L+=vb(O.format,T);break;case"exec":if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
508
+ `,exitCode:1};if(O.batchMode){let T=[];for(let F of O.command)F==="{}"?T.push(...p):T.push(F);let N=await t.exec(sn([T[0]]),{cwd:t.cwd,signal:t.signal,args:T.slice(1)});L+=N.stdout,m+=N.stderr,N.exitCode!==0&&(g=N.exitCode)}else for(let T of p){let N=O.command.map(B=>B==="{}"?T:B),F=await t.exec(sn([N[0]]),{cwd:t.cwd,signal:t.signal,args:N.slice(1)});L+=F.stdout,m+=F.stderr,F.exitCode!==0&&(g=F.exitCode)}break}else f&&(L=p.length>0?`${p.join(`
509
+ `)}
510
+ `:"");return{stdout:L,stderr:m,exitCode:g}}};Ib={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 kd={};ee(kd,{basenameCommand:()=>Ob,flagsForFuzzing:()=>Tb});var $b,Ob,Tb,Nd=v(()=>{"use strict";ie();$b={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX]
511
+ basename OPTION... NAME...`,options:["-a, --multiple support multiple arguments","-s, --suffix=SUFFIX remove a trailing SUFFIX"," --help display this help and exit"]},Ob={name:"basename",async execute(e,t){if(U(e))return M($b);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
512
+ `,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(`
513
+ `)}
514
+ `,stderr:"",exitCode:0}}},Tb={name:"basename",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"value",valueHint:"string"}],needsArgs:!0}});var Id={};ee(Id,{dirnameCommand:()=>Pb,flagsForFuzzing:()=>Db});var Rb,Pb,Db,$d=v(()=>{"use strict";ie();Rb={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},Pb={name:"dirname",async execute(e,t){if(U(e))return M(Rb);let n=e.filter(s=>!s.startsWith("-"));if(n.length===0)return{stdout:"",stderr:`dirname: missing operand
515
+ `,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(`
516
+ `)}
517
+ `,stderr:"",exitCode:0}}},Db={name:"dirname",flags:[],needsArgs:!0}});var Td={};ee(Td,{flagsForFuzzing:()=>Ub,treeCommand:()=>Lb});async function Mb(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}
518
+ `,i.fileCount=1,i}catch{return i.stderr=`tree: ${t}: No such file or directory
519
+ `,i}if(i.output=`${t}
520
+ `,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),p=await Promise.all(f.map(async h=>{let d=o==="/"?`/${h}`:`${o}/${h}`;try{let m=await e.fs.stat(d);return{name:h,isDirectory:m.isDirectory}}catch{return null}}));a.push(...p.filter(h=>h!==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}`,p=c===l.length-1,h=p?"`-- ":"|-- ",d=r+(p?" ":"| ");if(u.isDirectory){i.dirCount++;let m=n.fullPath?f:u.name;if(i.output+=`${r+h+m}
521
+ `,n.maxDepth===null||s+1<n.maxDepth){let g=await Od(e,f,n,d,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+h+m}
522
+ `}}}catch{i.stderr=`tree: ${t}: Permission denied
523
+ `}return i}async function Od(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 p=>{let h=t==="/"?`/${p}`:`${t}/${p}`;try{let d=await e.fs.stat(h);return{name:p,isDirectory:d.isDirectory}}catch{return null}}));o.push(...f.filter(p=>p!==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,p=f?"`-- ":"|-- ",h=r+(f?" ":"| ");if(c.isDirectory){i.dirCount++;let d=n.fullPath?u:c.name;i.output+=`${r+p+d}
524
+ `;let m=await Od(e,u,n,h,s+1);i.output+=m.output,i.dirCount+=m.dirCount,i.fileCount+=m.fileCount}else{i.fileCount++;let d=n.fullPath?u:c.name;i.output+=`${r+p+d}
525
+ `}}}catch{}return i}var _b,Fb,Lb,Ub,Rd=v(()=>{"use strict";at();rs();ie();_b={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"]},Fb={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},Lb={name:"tree",async execute(e,t){if(U(e))return M(_b);let n=Se("tree",e,Fb);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 Mb(t,c,r,"",0);i+=u.output,o+=u.stderr,a+=u.dirCount,l+=u.fileCount}return i+=`
526
+ ${a} director${a===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"s"}`),i+=`
527
+ `,{stdout:i,stderr:o,exitCode:o?1:0}}};Ub={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0}});var Dd={};ee(Dd,{duCommand:()=>zb,flagsForFuzzing:()=>jb});async function Pd(e,t,n,r,s){let i={output:"",totalSize:0,stderr:""};if(s>Hb)return i;try{let o=await e.fs.stat(t);if(!o.isDirectory)return i.totalSize=o.size,(r.allFiles||s===0)&&(i.output=go(o.size,r.humanReadable)+" "+n+`
528
+ `),i;let a=0,l=[];if(e.fs.readdirWithFileTypes){let f=await e.fs.readdirWithFileTypes(t),p=f.filter(d=>d.isFile),h=f.filter(d=>d.isDirectory);for(let d=0;d<p.length;d+=100){let m=p.slice(d,d+100),g=await Promise.all(m.map(async y=>{let b=t==="/"?`/${y.name}`:`${t}/${y.name}`;try{let w=await e.fs.stat(b);return{name:y.name,isDirectory:!1,size:w.size}}catch{return{name:y.name,isDirectory:!1,size:0}}}));l.push(...g)}l.push(...h.map(d=>({name:d.name,isDirectory:!0})))}else{let f=await e.fs.readdir(t);for(let p=0;p<f.length;p+=100){let h=f.slice(p,p+100),d=await Promise.all(h.map(async m=>{let g=t==="/"?`/${m}`:`${t}/${m}`;try{let y=await e.fs.stat(g);return{name:m,isDirectory:y.isDirectory,size:y.isDirectory?void 0:y.size}}catch{return{name:m,isDirectory:!1,size:0}}}));l.push(...d)}}l.sort((f,p)=>f.name.localeCompare(p.name));let c=l.filter(f=>!f.isDirectory);for(let f of c){let p=f.size??0;if(a+=p,r.allFiles&&!r.summarize){let h=n==="."?f.name:`${n}/${f.name}`;i.output+=go(p,r.humanReadable)+" "+h+`
529
+ `}}let u=l.filter(f=>f.isDirectory);for(let f=0;f<u.length;f+=100){let p=u.slice(f,f+100),h=await Promise.all(p.map(async d=>{let m=t==="/"?`/${d.name}`:`${t}/${d.name}`,g=n==="."?d.name:`${n}/${d.name}`;return{name:d.name,result:await Pd(e,m,g,r,s+1)}}));h.sort((d,m)=>d.name.localeCompare(m.name));for(let{result:d}of h)a+=d.totalSize,r.summarize||(r.maxDepth===null||s+1<=r.maxDepth)&&(i.output+=d.output)}i.totalSize=a,(r.summarize||r.maxDepth===null||s<=r.maxDepth)&&(i.output+=`${go(a,r.humanReadable)} ${n}
530
+ `)}catch{i.stderr=`du: cannot read directory '${n}': Permission denied
531
+ `}return i}function go(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 Bb,Wb,zb,Hb,jb,_d=v(()=>{"use strict";at();rs();ie();Bb={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"]},Wb={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"}},zb={name:"du",async execute(e,t){if(U(e))return M(Bb);let n=Se("du",e,Wb);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 Pd(t,c,l,r,0);i+=u.output,a+=u.totalSize,o+=u.stderr}catch{o+=`du: cannot access '${l}': No such file or directory
532
+ `}}return r.grandTotal&&s.length>0&&(i+=`${go(a,r.humanReadable)} total
533
+ `),{stdout:i,stderr:o,exitCode:o?1:0}}},Hb=1e3;jb={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 Vl={};ee(Vl,{envCommand:()=>Vb,flagsForFuzzing:()=>Kb,printenvCommand:()=>Zb,printenvFlagsForFuzzing:()=>Qb});var Gb,Vb,qb,Zb,Kb,Qb,ql=v(()=>{"use strict";ge();er();ie();Gb={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"]},Vb={name:"env",async execute(e,t){if(U(e))return M(Gb);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 K("env",c);if(c.startsWith("-")&&c!=="-"){for(let u of c.slice(1))if(u!=="i"&&u!=="u")return K("env",`-${u}`);c.includes("i")&&(n=!0)}else if(c.includes("=")&&i===-1){let u=c.indexOf("="),f=c.slice(0,u),p=c.slice(u+1);s.set(f,p)}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(`
534
+ `)+(l.length>0?`
535
+ `:""),stderr:"",exitCode:0}}if(!t.exec)return{stdout:"",stderr:`env: command execution not supported in this context
536
+ `,exitCode:1};let a=e.slice(i);return t.exec("command",{cwd:t.cwd,env:Ct(o),replaceEnv:!0,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:a})}},qb={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},Zb={name:"printenv",async execute(e,t){if(U(e))return M(qb);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(`
537
+ `)+(i.length>0?`
538
+ `:""),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(`
539
+ `)+(r.length>0?`
540
+ `:""),stderr:"",exitCode:s}}},Kb={name:"env",flags:[{flag:"-i",type:"boolean"},{flag:"-u",type:"value",valueHint:"string"}]},Qb={name:"printenv",flags:[]}});var Zl={};ee(Zl,{aliasCommand:()=>Yb,flagsForFuzzing:()=>e5,unaliasCommand:()=>Jb,unaliasFlagsForFuzzing:()=>t5});var Xb,ws,Yb,Jb,e5,t5,Kl=v(()=>{"use strict";ie();Xb={name:"alias",summary:"define or display aliases",usage:"alias [name[=value] ...]",options:[" --help display this help and exit"]},ws="BASH_ALIAS_",Yb={name:"alias",async execute(e,t){if(U(e))return M(Xb);if(e.length===0){let r="";for(let[s,i]of t.env)if(s.startsWith(ws)){let o=s.slice(ws.length);r+=`alias ${o}='${i}'
541
+ `}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=ws+r;return t.env.get(i)?{stdout:`alias ${r}='${t.env.get(i)}'
542
+ `,stderr:"",exitCode:0}:{stdout:"",stderr:`alias: ${r}: not found
543
+ `,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(ws+i,o)}}return{stdout:"",stderr:"",exitCode:0}}},Jb={name:"unalias",async execute(e,t){if(U(e))return M({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 ...]
544
+ `,exitCode:1};if(e[0]==="-a"){for(let i of t.env.keys())i.startsWith(ws)&&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=ws+i;t.env.get(o)?t.env.delete(o):(s+=`unalias: ${i}: not found
545
+ `,r=!0)}return{stdout:"",stderr:s,exitCode:r?1:0}}},e5={name:"alias",flags:[]},t5={name:"unalias",flags:[{flag:"-a",type:"boolean"}]}});var Ld={};ee(Ld,{flagsForFuzzing:()=>s5,historyCommand:()=>r5});var n5,Fd,r5,s5,Md=v(()=>{"use strict";ie();n5={name:"history",summary:"display command history",usage:"history [n]",options:["-c clear the history list"," --help display this help and exit"]},Fd="BASH_HISTORY",r5={name:"history",async execute(e,t){if(U(e))return M(n5);let n=t.env.get(Fd)||"[]",r;try{r=JSON.parse(n)}catch{r=[]}if(e[0]==="-c")return t.env.set(Fd,"[]"),{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]}
546
+ `}return{stdout:o,stderr:"",exitCode:0}}},s5={name:"history",flags:[{flag:"-c",type:"boolean"}]}});var Ud={};ee(Ud,{flagsForFuzzing:()=>a5,xargsCommand:()=>o5});var i5,o5,a5,Bd=v(()=>{"use strict";ge();Rr();ie();i5={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"]},o5={name:"xargs",async execute(e,t){if(U(e))return M(i5);let n=null,r=null,s=null,i=null,o=!1,a=!1,l=!1,c=0;for(let w=0;w<e.length;w++){let x=e[w];if(x==="-I"&&w+1<e.length)n=e[++w],c=w+1;else if(x==="-d"&&w+1<e.length)r=e[++w].replace(/\\n/g,`
547
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\0/g,"\0").replace(/\\\\/g,"\\"),c=w+1;else if(x==="-n"&&w+1<e.length)s=parseInt(e[++w],10),c=w+1;else if(x==="-P"&&w+1<e.length)i=parseInt(e[++w],10),c=w+1;else if(x==="-0"||x==="--null")o=!0,c=w+1;else if(x==="-t"||x==="--verbose")a=!0,c=w+1;else if(x==="-r"||x==="--no-run-if-empty")l=!0,c=w+1;else{if(x.startsWith("--"))return K("xargs",x);if(x.startsWith("-")&&x.length>1){for(let A of x.slice(1))if(!"0tr".includes(A))return K("xargs",`-${A}`);x.includes("0")&&(o=!0),x.includes("t")&&(a=!0),x.includes("r")&&(l=!0),c=w+1}else if(!x.startsWith("-")){c=w;break}}}let u=e.slice(c);u.length===0&&u.push("echo");let f=ae(t.stdin),p;if(o?p=f.split("\0").filter(w=>w.length>0):r!==null?p=f.replace(/\n$/,"").split(r).filter(x=>x.length>0):p=f.split(/\s+/).map(w=>w.trim()).filter(w=>w.length>0),p.length===0)return l?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let h="",d="",m=0,g=w=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(w)?`"${w.replace(/([\\"`$])/g,"\\$1")}"`:w,y=async w=>{if(a){let A=w.map(g).join(" ");d+=`${A}
548
+ `}return t.exec?t.exec(sn([w[0]]),{cwd:t.cwd,signal:t.signal,args:w.slice(1)}):{stdout:`${w.map(g).join(" ")}
549
+ `,stderr:"",exitCode:0}},b=async w=>{if(i!==null&&i>1)for(let x=0;x<w.length;x+=i){let A=w.slice(x,x+i),I=await Promise.all(A.map(y));for(let $ of I)h+=$.stdout,d+=$.stderr,$.exitCode!==0&&(m=$.exitCode)}else for(let x of w){let A=await y(x);h+=A.stdout,d+=A.stderr,A.exitCode!==0&&(m=A.exitCode)}};if(n!==null){let w=p.map(x=>u.map(A=>A.replaceAll(n,x)));await b(w)}else if(s!==null){let w=[];for(let x=0;x<p.length;x+=s){let A=p.slice(x,x+s);w.push([...u,...A])}await b(w)}else{let w=[...u,...p],x=await y(w);h+=x.stdout,d+=x.stderr,m=x.exitCode}return{stdout:h,stderr:d,exitCode:m}}},a5={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 Ql={};ee(Ql,{falseCommand:()=>c5,falseFlagsForFuzzing:()=>f5,flagsForFuzzing:()=>u5,trueCommand:()=>l5});var l5,c5,u5,f5,Xl=v(()=>{"use strict";l5={name:"true",async execute(){return{stdout:"",stderr:"",exitCode:0}}},c5={name:"false",async execute(){return{stdout:"",stderr:"",exitCode:1}}},u5={name:"true",flags:[]},f5={name:"false",flags:[]}});var Wd={};ee(Wd,{clearCommand:()=>h5,flagsForFuzzing:()=>d5});var p5,h5,d5,zd=v(()=>{"use strict";ie();p5={name:"clear",summary:"clear the terminal screen",usage:"clear [OPTIONS]",options:[" --help display this help and exit"]},h5={name:"clear",async execute(e,t){return U(e)?M(p5):{stdout:"\x1B[2J\x1B[H",stderr:"",exitCode:0}}},d5={name:"clear",flags:[]}});var Yl={};ee(Yl,{bashCommand:()=>m5,flagsForFuzzing:()=>y5,shCommand:()=>g5,shFlagsForFuzzing:()=>w5});async function bs(e,t,n,r){if(!r.exec)return{stdout:"",stderr:`bash: internal error: exec function not available
550
+ `,exitCode:1};let s=Dr(r.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((a,l)=>{s[String(l+1)]=a});let i=e;if(i.startsWith("#!")){let a=i.indexOf(`
551
+ `);a!==-1&&(i=i.slice(a+1))}return await r.exec(i,{env:s,cwd:r.cwd,stdin:r.stdin,stdinKind:"bytes",signal:r.signal})}var Hd,m5,g5,y5,w5,Jl=v(()=>{"use strict";ge();er();ie();Hd={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).']},m5={name:"bash",async execute(e,t){if(U(e))return M(Hd);if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"bash",o=e.slice(3);return bs(s,i,o,t)}if(e.length===0){let s=ae(t.stdin);return s.trim()?bs(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 bs(i,n,r,t)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
552
+ `,exitCode:127}}}},g5={name:"sh",async execute(e,t){if(U(e))return M({...Hd,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 bs(s,i,o,t)}if(e.length===0){let s=ae(t.stdin);return s.trim()?bs(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 bs(i,n,r,t)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
553
+ `,exitCode:127}}}};y5={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},w5={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function ec(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,p)=>{let h=s(f,n[0],r)[0],d=s(p,n[0],r)[0];return o(h,d)})];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 p=0,h=e.length;for(;p<h;){let d=p+h>>>1;o(e[d],f)<0?p=d+1:h=d}return p<e.length&&o(e[p],f)===0?p:-p-1})}case"unique_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let p of e){let h=s(p,n[0],r)[0],d=JSON.stringify(h);u.has(d)||u.set(d,{item:p,key:h})}let f=[...u.values()];return f.sort((p,h)=>o(p.key,h.key)),[f.map(p=>p.item)]}case"group_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let f of e){let p=JSON.stringify(s(f,n[0],r)[0]);u.has(p)||u.set(p,[]),u.get(p)?.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 p=s(u,n[0],r)[0],h=s(f,n[0],r)[0];return o(p,h)>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 p=s(u,n[0],r)[0],h=s(f,n[0],r)[0];return o(p,h)<0?u:f})];case"add":{let u=f=>{let p=f.filter(h=>h!==null);return p.length===0?null:p.every(h=>typeof h=="number")?p.reduce((h,d)=>h+d,0):p.every(h=>typeof h=="string")?p.join(""):p.every(h=>Array.isArray(h))?p.flat():p.every(h=>h&&typeof h=="object"&&!Array.isArray(h))?Dr(...p):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":return n.length===0||!Array.isArray(e)?[null]:[e.flatMap(f=>s(f,n[0],r))];case"map_values":{if(n.length===0)return[null];if(Array.isArray(e))return[e.flatMap(u=>s(u,n[0],r))];if(e&&typeof e=="object"){let u=Object.create(null);for(let[f,p]of Object.entries(e)){if(!_e(f))continue;let h=s(p,n[0],r);h.length>0&&ze(u,f,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"?[Bn(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"?[Bn(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 jd=v(()=>{"use strict";er();An()});function tc(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=Math.max(r.limits.maxIterations*100,1e6),c=d=>d.length>=l,u=s(e,n[0],r);if(n.length===1){let d=[];for(let m of u){let g=m;for(let y=0;y<g;y++)if(d.push(y),c(d))return d}return d}let f=s(e,n[1],r);if(n.length===2){let d=[];for(let m of u)for(let g of f){let y=m,b=g;for(let w=y;w<b;w++)if(d.push(w),c(d))return d}return d}let p=s(e,n[2],r),h=[];for(let d of u)for(let m of f)for(let g of p){let y=d,b=m,w=g;if(w!==0){if(w>0){for(let x=y;x<b;x+=w)if(h.push(x),c(h))return h}else for(let x=y;x>b;x+=w)if(h.push(x),c(h))return h}}return h}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(p){if(p instanceof a)throw p;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 p=s(l,n[1],r);if(p.length===0)return[l];l=p[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 h=s(c,n[1],r);if(h.length===0)break;c=h[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 p=s(c,n[0],r);if(p.length===0)break;c=p[0]}if(l.length>=u)throw new a(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var Gd=v(()=>{"use strict"});function nc(e,t,n,r,s){switch(t){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let i=new Date(e*1e3),o=i.getUTCFullYear(),a=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),p=i.getUTCDay(),h=Date.UTC(o,0,1),d=Math.floor((i.getTime()-h)/(1440*60*1e3));return[[o,a,l,c,u,f,p,d]]}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=new Date(e*1e3);else if(Array.isArray(e)){let[p,h,d,m=0,g=0,y=0]=e;if(typeof p!="number"||typeof h!="number")throw new Error("strftime/1 requires parsed datetime inputs");a=new Date(Date.UTC(p,h,d??1,m??0,g??0,y??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=(p,h=2)=>String(p).padStart(h,"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==="%Y-%m-%dT%H:%M:%SZ"){let l=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(l){let[,c,u,f,p,h,d]=l.map(Number),m=new Date(Date.UTC(c,u-1,f,p,h,d)),g=m.getUTCDay(),y=Date.UTC(c,0,1),b=Math.floor((m.getTime()-y)/(1440*60*1e3));return[[c,u-1,f,p,h,d,g,b]]}}let a=new Date(e);if(!Number.isNaN(a.getTime())){let l=a.getUTCFullYear(),c=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCHours(),p=a.getUTCMinutes(),h=a.getUTCSeconds(),d=a.getUTCDay(),m=Date.UTC(l,0,1),g=Math.floor((a.getTime()-m)/(1440*60*1e3));return[[l,c,u,f,p,h,d,g]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let i=new Date(e);if(Number.isNaN(i.getTime()))throw new Error(`date "${e}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var Vd=v(()=>{"use strict"});function mn(e){return e!==!1&&e!==null}function xs(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ui(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function rc(e,t){let n=wt(e);for(let r of Object.keys(t)){if(!_e(r))continue;let s=Bn(n,r)?Ge(n[r]):null,i=Ge(t[r]);s&&i?ze(n,r,rc(s,i)):ze(n,r,t[r])}return n}function Es(e,t=3e3){let n=0,r=e;for(;n<t;)if(Array.isArray(r)){if(r.length===0)return n+1;r=r[0],n++}else if(r!==null&&typeof r=="object"){let s=Object.keys(r);if(s.length===0)return n+1;r=r[s[0]],n++}else return n;return n}function yo(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=yo(e[a],t[a]);if(l!==0)return l}return e.length-t.length}let i=Ge(e),o=Ge(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=yo(i[c],o[c]);if(u!==0)return u}}return 0}function wo(e,t){if(xs(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=>wo(i,s)));let n=Ge(e),r=Ge(t);return n&&r?Object.keys(r).every(s=>Bn(n,s)&&wo(n[s],r[s])):!1}var bo=v(()=>{"use strict";An()});function sc(e,t,n){switch(t){case"@base64":return typeof e=="string"?typeof Buffer<"u"?[Buffer.from(e,"utf-8").toString("base64")]:[btoa(e)]:[null];case"@base64d":return typeof e=="string"?typeof Buffer<"u"?[Buffer.from(e,"base64").toString("utf-8")]:[atob(e)]:[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(`
554
+ `)||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??b5;return Es(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 b5,qd=v(()=>{"use strict";bo();b5=2e3});function ic(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 p=0;p<c;p++)if(!i(e[u+p],a[p])){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 Zd=v(()=>{"use strict"});function oc(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 Kd=v(()=>{"use strict"});function ac(e,t,n,r,s,i,o,a){switch(t){case"recurse":{if(n.length===0){let h=[],d=m=>{if(h.push(m),Array.isArray(m))for(let g of m)d(g);else if(m&&typeof m=="object")for(let g of Object.keys(m))d(m[g])};return d(e),h}let l=[],c=n.length>=2?n[1]:null,u=1e4,f=0,p=h=>{if(f++>u||c&&!s(h,c,r).some(i))return;l.push(h);let d=s(h,n[0],r);for(let m of d)m!=null&&p(m)};return p(e),l}case"recurse_down":return a(e,"recurse",n,r);case"walk":{if(n.length===0)return[e];let l=new WeakSet,c=u=>{if(u&&typeof u=="object"){if(l.has(u))return u;l.add(u)}let f;if(Array.isArray(u))f=u.map(c);else if(u&&typeof u=="object"){let h=Object.create(null);for(let[d,m]of Object.entries(u))_e(d)&&ze(h,d,c(m));f=h}else f=u;return s(f,n[0],r)[0]};return[c(e)]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let l=Math.max(...e.map(u=>Array.isArray(u)?u.length:0)),c=[];for(let u=0;u<l;u++)c.push(e.map(f=>Array.isArray(f)?f[u]:null));return[c]}case"combinations":{if(n.length>0){let f=s(e,n[0],r)[0];if(!Array.isArray(e)||f<0)return[];if(f===0)return[[]];let p=[],h=(d,m)=>{if(m===f){p.push([...d]);return}for(let g of e)d.push(g),h(d,m+1),d.pop()};return h([],0),p}if(!Array.isArray(e))return[];if(e.length===0)return[[]];for(let u of e)if(!Array.isArray(u))return[];let l=[],c=(u,f)=>{if(u===e.length){l.push([...f]);return}let p=e[u];for(let h of p)f.push(h),c(u+1,f),f.pop()};return c(0,[]),l}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 Qd=v(()=>{"use strict";An()});function lc(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[new TextEncoder().encode(e).length];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=Ge(e);return i?[Object.entries(i).map(([o,a])=>({key:o,value:a}))]:[null]}case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let o of e){let a=Ge(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);_e(u)&&ze(i,u,c)}}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];let i=Ge(e);if(i){let a=Object.entries(i).map(([c,u])=>({key:c,value:u})).flatMap(c=>s(c,n[0],r)),l=Object.create(null);for(let c of a){let u=Ge(c);if(u){let f=u.key??u.name??u.k,p=u.value??u.v;if(f!==void 0){let h=String(f);_e(h)&&ze(l,h,p)}}}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??x5;return Es(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[ps(JSON.parse(e))]}catch{throw 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=(a,l)=>{if(a===null||typeof a!="object")i.push([l,a]);else if(Array.isArray(a))if(a.length===0)i.push([l,[]]);else for(let c=0;c<a.length;c++)o(a[c],[...l,c]);else{let c=Object.keys(a);if(c.length===0)i.push([l,Object.create(null)]);else for(let u of c)o(a[u],[...l,u])}};return o(e,[]),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r),o=null;for(let a of i){if(!Array.isArray(a)||a.length===1&&Array.isArray(a[0])&&a[0].length===0||a.length!==2)continue;let[l,c]=a;if(!Array.isArray(l))continue;if(l.length===0){o=c;continue}o===null&&(o=typeof l[0]=="number"?[]:Object.create(null));let u=o;for(let p=0;p<l.length-1;p++){let h=l[p],d=l[p+1];if(Array.isArray(u)&&typeof h=="number"){for(;u.length<=h;)u.push(null);u[h]===null&&(u[h]=typeof d=="number"?[]:Object.create(null)),u=u[h]}else{let m=Ge(u);if(m){let g=String(h);if(!_e(g))continue;(m[g]===null||m[g]===void 0)&&ze(m,g,typeof d=="number"?[]:Object.create(null)),u=m[g]}}}let f=l[l.length-1];if(Array.isArray(u)&&typeof f=="number"){for(;u.length<=f;)u.push(null);u[f]=c}else{let p=Ge(u);if(p){let h=String(f);_e(h)&&ze(p,h,c)}}}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 x5,Xd=v(()=>{"use strict";An();bo();x5=2e3});function cc(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 p of u){let h=p,d=e;for(let m of h){if(d==null){d=null;break}if(Array.isArray(d)&&typeof m=="number")d=d[m];else if(typeof m=="string"){let g=Ge(d);if(!g||!Object.hasOwn(g,m)){d=null;break}d=g[m]}else{d=null;break}}f.push(d)}return f}case"setpath":{if(n.length<2)return[null];let f=s(e,n[0],r)[0],h=s(e,n[1],r)[0];return[o(e,f,h)]}case"delpaths":{if(n.length===0)return[e];let f=s(e,n[0],r)[0],p=e;for(let h of f.sort((d,m)=>m.length-d.length))p=a(p,h);return[p]}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 p of n)c(e,p,r,[],u);let f=null;for(let p of u){for(let d of p)if(typeof d=="number"&&d<0)throw new Error("Out of bounds negative array index");let h=e;for(let d of p){if(h==null)break;if(Array.isArray(h)&&typeof d=="number")h=h[d];else if(typeof d=="string"){let m=Ge(h);if(!m||!Object.hasOwn(m,d)){h=null;break}h=m[d]}else{h=null;break}}f=o(f,p,h)}return[f]}case"paths":{let u=[],f=(p,h)=>{if(p&&typeof p=="object")if(Array.isArray(p))for(let d=0;d<p.length;d++)u.push([...h,d]),f(p[d],[...h,d]);else for(let d of Object.keys(p))u.push([...h,d]),f(p[d],[...h,d])};return f(e,[]),n.length>0?u.filter(p=>{let h=e;for(let m of p)if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof m=="string"){let g=Ge(h);if(!g||!Object.hasOwn(g,m))return!1;h=g[m]}else return!1;return s(h,n[0],r).some(i)}):u}case"leaf_paths":{let u=[],f=(p,h)=>{if(p===null||typeof p!="object")u.push(h);else if(Array.isArray(p))for(let d=0;d<p.length;d++)f(p[d],[...h,d]);else for(let d of Object.keys(p))f(p[d],[...h,d])};return f(e,[]),u}default:return null}}var Yd=v(()=>{"use strict";An()});function uc(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);_e(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 p=String(f[0]);_e(p)&&ze(c,p,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]);_e(f)&&ze(a,f,u[0])}}return[a]}case"JOIN":{if(n.length<2)return[null];let o=Ge(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=Bn(o,u)?o[u]:null;a.push([l,f])}return[a]}default:return null}}var Jd=v(()=>{"use strict";An()});function fc(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 i.map(o=>e.map(a=>a===null?"":typeof a=="string"?a:String(a)).join(String(o)))}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);return[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";return Q(o,a.includes("g")?a:`${a}g`).split(e)}catch{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]):"";return[...Q(o,a.includes("g")?a:`${a}g`).matchAll(e)].map(u=>u.length>1?u.slice(1):u[0])}catch{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[Q(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=Q(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,p)=>({offset:u?.[p+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=Q(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[Q(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[Q(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":return typeof e=="string"?[Array.from(e).map(i=>i.codePointAt(0))]:[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 em=v(()=>{"use strict";Ze()});function pc(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 tm=v(()=>{"use strict"});var nm=v(()=>{"use strict";jd();Gd();Vd();qd();Zd();Kd();Qd();Xd();Yd();Jd();em();tm()});function xo(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]=xo(c[r],s,n),c}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!_e(r))return e??Object.create(null);let i=Ge(e),o=i?wt(i):Object.create(null),a=Object.hasOwn(o,r)?o[r]:void 0;return ze(o,r,xo(a,s,n)),o}function Eo(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(!_e(i))return e;let o=wt(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]=Eo(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!_e(s))return e;let i=wt(e);return Object.hasOwn(i,s)&&ze(i,s,Eo(i[s],r)),i}return e}var rm=v(()=>{"use strict";An()});function S5(e){return{vars:new Map,limits:{maxIterations:e?.limits?.maxIterations??E5,maxDepth:e?.limits?.maxDepth??om},env:e?.env,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1}}function Co(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage}}function fi(e,t,n){switch(t.type){case"var":return Co(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=fi(r,i,o);if(a===null)return null;r=a}return r}case"object":{let r=Ge(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=q(n,i.key,e);if(c.length===0)return null;o=String(c[0])}let a=Bn(r,o)?r[o]:null;i.keyVar&&(s=Co(s,i.keyVar,a));let l=fi(s,i.pattern,a);if(l===null)return null;s=l}return s}}}function C5(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=Ge(n);if(s&&typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function fr(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?fr(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?fr(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=fr(e.left);return t===null?null:hc(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 hc(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=fr(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=fr(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=hc(e,t.left);return n===null?null:hc(n,t.right)}return t.type==="Identity"?e:null}function sm(e,t,n){if(t.type==="Comma"){let r=[];try{r.push(...q(e,t.left,n))}catch(s){if(s instanceof X)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{r.push(...q(e,t.right,n))}catch(s){if(s instanceof X)throw s;return r}return r}return q(e,t,n)}function q(e,t,n){let r=n&&"vars"in n?n:S5(n);switch(r.defenseContextChecked||(it(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),r.coverage?.hit(`jq:node:${t.type}`),t.type){case"Identity":return[e];case"Field":return(t.base?q(e,t.base,r):[e]).flatMap(i=>{let o=Ge(i);if(o){if(!Object.hasOwn(o,t.name))return[null];let l=o[t.name];return[l===void 0?null:l]}if(i===null)return[null];let a=Array.isArray(i)?"array":typeof i;throw new Error(`Cannot index ${a} with string "${t.name}"`)});case"Index":return(t.base?q(e,t.base,r):[e]).flatMap(i=>q(i,t.index,r).flatMap(a=>{if(typeof a=="number"&&Array.isArray(i)){if(Number.isNaN(a))return[null];let l=Math.trunc(a),c=l<0?i.length+l:l;return c>=0&&c<i.length?[i[c]]:[null]}if(typeof a=="string"){let l=Ge(i);return!l||!Object.hasOwn(l,a)?[null]:[l[a]]}return[null]}));case"Slice":return(t.base?q(e,t.base,r):[e]).flatMap(i=>{if(i===null)return[null];if(!Array.isArray(i)&&typeof i!="string")throw new Error(`Cannot slice ${typeof i} (${JSON.stringify(i)})`);let o=i.length,a=t.start?q(e,t.start,r):[0],l=t.end?q(e,t.end,r):[o];return a.flatMap(c=>l.map(u=>{let f=c,p=u,h=Number.isNaN(f)?0:Number.isInteger(f)?f:Math.floor(f),d=Number.isNaN(p)?o:Number.isInteger(p)?p:Math.ceil(p),m=im(h,o),g=im(d,o);return Array.isArray(i),i.slice(m,g)}))});case"Iterate":return(t.base?q(e,t.base,r):[e]).flatMap(i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[]);case"Pipe":{let s=q(e,t.left,r),i=fr(t.left),o=[];for(let a of s)try{if(i!==null){let l={...r,currentPath:[...r.currentPath??[],...i]};o.push(...q(a,t.right,l))}else o.push(...q(a,t.right,r))}catch(l){throw l instanceof As?l.withPrependedResults(o):l}return o}case"Comma":{let s=q(e,t.left,r),i=q(e,t.right,r);return[...s,...i]}case"Literal":return[t.value];case"Array":return t.elements?[q(e,t.elements,r)]:[[]];case"Object":{let s=[Object.create(null)];for(let i of t.entries){let o=typeof i.key=="string"?[i.key]:q(e,i.key,r),a=q(e,i.value,r),l=[];for(let c of s)for(let u of o){if(typeof u!="string"){let f=u===null?"null":Array.isArray(u)?"array":typeof u;throw new Error(`Cannot use ${f} (${JSON.stringify(u)}) as object key`)}if(!_e(u)){for(let f of a)l.push(wt(c));continue}for(let f of a){let p=wt(c);ze(p,u,f),l.push(p)}}s.length=0,s.push(...l)}return s}case"Paren":return q(e,t.expr,r);case"BinaryOp":return N5(e,t.op,t.left,t.right,r);case"UnaryOp":return q(e,t.operand,r).map(i=>{if(t.op==="-"){if(typeof i=="number")return-i;if(typeof i=="string"){let o=a=>a.length>5?`"${a.slice(0,3)}...`:JSON.stringify(a);throw new Error(`string (${o(i)}) cannot be negated`)}return null}return t.op==="not"?!mn(i):null});case"Cond":return q(e,t.cond,r).flatMap(i=>{if(mn(i))return q(e,t.then,r);for(let o of t.elifs)if(q(e,o.cond,r).some(mn))return q(e,o.then,r);return t.else?q(e,t.else,r):[e]});case"Try":try{return q(e,t.body,r)}catch(s){if(t.catch){let i=s instanceof So?s.value:s instanceof Error?s.message:String(s);return q(i,t.catch,r)}return[]}case"Call":return am(e,t.name,t.args,r);case"VarBind":return q(e,t.value,r).flatMap(i=>{let o=null,a=[];t.pattern?a.push(t.pattern):t.name&&a.push({type:"var",name:t.name}),t.alternatives&&a.push(...t.alternatives);for(let l of a)if(o=fi(r,l,i),o!==null)break;return o===null?[]:q(e,t.body,o)});case"VarRef":{if(t.name==="$ENV")return[r.env?Ct(r.env):Object.create(null)];let s=r.vars.get(t.name);return s!==void 0?[s]:[null]}case"Recurse":{let s=[],i=new WeakSet,o=a=>{if(a&&typeof a=="object"){if(i.has(a))return;i.add(a)}if(s.push(a),Array.isArray(a))for(let l of a)o(l);else if(a&&typeof a=="object")for(let l of Object.keys(a))o(a[l])};return o(e),s}case"Optional":try{return q(e,t.expr,r)}catch{return[]}case"StringInterp":return[t.parts.map(i=>typeof i=="string"?i:q(e,i,r).map(a=>typeof a=="string"?a:JSON.stringify(a)).join("")).join("")];case"UpdateOp":return[v5(e,t.path,t.op,t.value,r)];case"Reduce":{let s=q(e,t.expr,r),i=q(e,t.init,r)[0],o=r.limits.maxDepth??om;for(let a of s){let l;if(t.pattern){if(l=fi(r,t.pattern,a),l===null)continue}else l=Co(r,t.varName,a);if(i=q(i,t.update,l)[0],Es(i,o+1)>o)return[null]}return[i]}case"Foreach":{let s=q(e,t.expr,r),i=q(e,t.init,r)[0],o=[];for(let a of s)try{let l;if(t.pattern){if(l=fi(r,t.pattern,a),l===null)continue}else l=Co(r,t.varName,a);if(i=q(i,t.update,l)[0],t.extract){let c=q(i,t.extract,l);o.push(...c)}else o.push(i)}catch(l){throw l instanceof As?l.withPrependedResults(o):l}return o}case"Label":try{return q(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(s){if(s instanceof As&&s.label===t.name)return s.partialResults;throw s}case"Break":throw new As(t.name);case"Def":{let s=new Map(r.funcs??[]),i=`${t.name}/${t.params.length}`;s.set(i,{params:t.params,body:t.funcBody,closure:new Map(r.funcs??[])});let o={...r,funcs:s};return q(e,t.body,o)}default:{let s=t;throw new Error(`Unknown AST node type: ${s.type}`)}}}function im(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function v5(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return q(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)?[...l,...c]:l&&c&&typeof l=="object"&&typeof c=="object"?xl(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(!_e(c.name))return l;if(c.base)return o(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let p=wt(f),h=Object.hasOwn(p,c.name)?p[c.name]:void 0;return ze(p,c.name,u(h)),p}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=wt(l),p=Object.hasOwn(f,c.name)?f[c.name]:void 0;return ze(f,c.name,u(p)),f}return l}case"Index":{let p=q(e,c.index,s)[0];if(typeof p=="number"&&Number.isNaN(p))throw new Error("Cannot set array element at NaN index");if(typeof p=="number"&&!Number.isInteger(p)&&(p=Math.trunc(p)),c.base)return o(l,c.base,h=>{if(typeof p=="number"&&Array.isArray(h)){let d=[...h],m=p<0?d.length+p:p;if(m>=0){for(;d.length<=m;)d.push(null);d[m]=u(d[m])}return d}if(typeof p=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!_e(p))return h;let d=wt(h),m=Object.hasOwn(d,p)?d[p]:void 0;return ze(d,p,u(m)),d}return h});if(typeof p=="number"){if(p>536870911)throw new Error("Array index too large");if(p<0&&(!l||!Array.isArray(l)))throw new Error("Out of bounds negative array index");if(Array.isArray(l)){let d=[...l],m=p<0?d.length+p:p;if(m>=0){for(;d.length<=m;)d.push(null);d[m]=u(d[m])}return d}if(l==null){let d=[];for(;d.length<=p;)d.push(null);return d[p]=u(null),d}return l}if(typeof p=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!_e(p))return l;let h=wt(l),d=Object.hasOwn(h,p)?h[p]:void 0;return ze(h,p,u(d)),h}return l}case"Iterate":{let f=p=>{if(Array.isArray(p))return p.map(h=>u(h));if(p&&typeof p=="object"){let h=Object.create(null);for(let[d,m]of Object.entries(p))_e(d)&&ze(h,d,u(m));return h}return p};return c.base?o(l,c.base,f):f(l)}case"Pipe":{let f=o(l,c.left,p=>p);return o(f,c.right,u)}default:return u(l)}}return o(e,t,l=>{if(n==="|=")return i(l,l);let c=q(e,r,s);return i(l,c[0]??null)})}function k5(e,t,n){function r(i,o,a){switch(o.type){case"Identity":return a;case"Field":{if(!_e(o.name))return i;if(o.base){let l=q(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=wt(i);return ze(l,o.name,a),l}return i}case"Index":{if(o.base){let u=q(i,o.base,n)[0],f=r(u,{type:"Index",index:o.index},a);return r(i,o.base,f)}let c=q(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(!_e(c))return i;let u=wt(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(!_e(o.name))return i;if(o.base){let l=q(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(!_e(o.name))return i;let l=wt(i);return delete l[o.name],l}return i}case"Index":{if(o.base){let u=q(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=q(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(!_e(c))return i;let u=wt(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(h,d,m){switch(d.type){case"Identity":return m;case"Field":{if(!_e(d.name))return h;if(h&&typeof h=="object"&&!Array.isArray(h)){let g=wt(h);return ze(g,d.name,m),g}return h}case"Index":{let y=q(e,d.index,n)[0];if(typeof y=="number"&&Array.isArray(h)){let b=[...h],w=y<0?b.length+y:y;return w>=0&&w<b.length&&(b[w]=m),b}if(typeof y=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!_e(y))return h;let b=wt(h);return ze(b,y,m),b}return h}case"Pipe":{let g=q(h,d.left,n)[0],y=u(g,d.right,m);return u(h,d.left,y)}default:return h}};var a=u;let l=o.left,c=o.right,f=q(i,l,n)[0];if(f==null)return i;let p=s(f,c);return u(i,l,p)}default:return i}}return s(e,t)}function N5(e,t,n,r,s){if(t==="and")return q(e,n,s).flatMap(l=>mn(l)?q(e,r,s).map(u=>mn(u)):[!1]);if(t==="or")return q(e,n,s).flatMap(l=>mn(l)?[!0]:q(e,r,s).map(u=>mn(u)));if(t==="//"){let l=q(e,n,s).filter(c=>c!=null&&c!==!1);return l.length>0?l:q(e,r,s)}let i=q(e,n,s),o=q(e,r,s);return i.flatMap(a=>o.map(l=>{switch(t){case"+":return a===null?l:l===null?a:typeof a=="number"&&typeof l=="number"||typeof a=="string"&&typeof l=="string"?a+l:Array.isArray(a)&&Array.isArray(l)?[...a,...l]:a&&l&&typeof a=="object"&&typeof l=="object"&&!Array.isArray(a)&&!Array.isArray(l)?xl(a,l):null;case"-":if(typeof a=="number"&&typeof l=="number")return a-l;if(Array.isArray(a)&&Array.isArray(l)){let c=new Set(l.map(u=>JSON.stringify(u)));return a.filter(u=>!c.has(JSON.stringify(u)))}if(typeof a=="string"&&typeof l=="string"){let c=u=>u.length>10?`"${u.slice(0,10)}...`:JSON.stringify(u);throw new Error(`string (${c(a)}) and string (${c(l)}) cannot be subtracted`)}return null;case"*":if(typeof a=="number"&&typeof l=="number")return a*l;if(typeof a=="string"&&typeof l=="number")return a.repeat(l);{let c=Ge(a),u=Ge(l);if(c&&u)return rc(c,u)}return null;case"/":if(typeof a=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${a}) and number (${l}) cannot be divided because the divisor is zero`);return a/l}return typeof a=="string"&&typeof l=="string"?a.split(l):null;case"%":if(typeof a=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${a}) and number (${l}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(a)&&!Number.isNaN(a)?!Number.isFinite(l)&&!Number.isNaN(l)&&a<0&&l>0?-1:0:a%l}return null;case"==":return xs(a,l);case"!=":return!xs(a,l);case"<":return ui(a,l)<0;case"<=":return ui(a,l)<=0;case">":return ui(a,l)>0;case">=":return ui(a,l)>=0;default:return null}}))}function am(e,t,n,r){let s=A5.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=oc(e,t,n,r,q);if(i!==null)return i;let o=fc(e,t,n,r,q);if(o!==null)return o;let a=nc(e,t,n,r,q);if(a!==null)return a;let l=sc(e,t,r.limits.maxDepth);if(l!==null)return l;let c=pc(e,t);if(c!==null)return c;let u=lc(e,t,n,r,q);if(u!==null)return u;let f=ec(e,t,n,r,q,sm,yo,mn,wo,X);if(f!==null)return f;let p=cc(e,t,n,r,q,mn,xo,Eo,k5,Ao);if(p!==null)return p;let h=ic(e,t,n,r,q,xs);if(h!==null)return h;let d=tc(e,t,n,r,q,sm,mn,X);if(d!==null)return d;let m=ac(e,t,n,r,q,mn,C5,am);if(m!==null)return m;let g=uc(e,t,n,r,q,xs);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 y=n.length>0?q(e,n[0],r)[0]:e;throw new So(y)}case"env":return[r.env?Ct(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let y=`${t}/${n.length}`,b=r.funcs?.get(y);if(b){let w=b.closure??r.funcs??new Map,x=new Map(w);x.set(y,b);for(let I=0;I<b.params.length;I++){let $=b.params[I],D=n[I];if(D){let R=q(e,D,r),L;if(R.length===0)L={type:"Call",name:"empty",args:[]};else if(R.length===1)L={type:"Literal",value:R[0]};else{L={type:"Literal",value:R[R.length-1]};for(let C=R.length-2;C>=0;C--)L={type:"Comma",left:{type:"Literal",value:R[C]},right:L}}x.set(`${$}/0`,{params:[],body:L})}}let A={...r,funcs:x};return q(e,b.body,A)}throw new Error(`Unknown function: ${t}`)}}}function Ao(e,t,n,r,s){if(t.type==="Comma"){let a=t;Ao(e,a.left,n,r,s),Ao(e,a.right,n,r,s);return}let i=fr(t);if(i!==null){s.push([...r,...i]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let a=0;a<e.length;a++)s.push([...r,a]);else if(e&&typeof e=="object")for(let a of Object.keys(e))s.push([...r,a]);return}if(t.type==="Recurse"){let a=(l,c)=>{if(s.push([...r,...c]),l&&typeof l=="object")if(Array.isArray(l))for(let u=0;u<l.length;u++)a(l[u],[...c,u]);else for(let u of Object.keys(l))a(l[u],[...c,u])};a(e,[]);return}if(t.type==="Pipe"){let a=fr(t.left);if(a!==null){let l=q(e,t.left,n);for(let c of l)Ao(c,t.right,n,[...r,...a],s);return}}q(e,t,n).length>0&&s.push(r)}var As,So,E5,om,A5,lm=v(()=>{"use strict";er();Ae();Wn();nm();rm();An();bo();As=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])}},So=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},E5=1e4,om=2e3,A5=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 um(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===`
555
+ `||u==="\r")){if(u==="#"){for(;!i()&&r()!==`
556
+ `;)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="";for(;!i()&&r()!=='"';)if(r()==="\\"){if(s(),i())break;let p=s();switch(p){case"n":f+=`
557
+ `;break;case"r":f+="\r";break;case"t":f+=" ";break;case"\\":f+="\\";break;case'"':f+='"';break;case"(":f+="\\(";break;default:f+=p}}else 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 p=cm.get(f);p?t.push({type:p,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 fm(e){let t=um(e);return new dc(t).parse()}var cm,vo,dc,pm=v(()=>{"use strict";cm=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"]]),vo=new Set(cm.values());dc=class e{tokens;pos=0;constructor(t){this.tokens=t}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()}isFieldNameAfterDot(t=0){let n=this.peek(t),r=this.peek(t+1);return r.type==="STRING"?!0:r.type==="IDENT"||vo.has(r.type)?r.pos===n.pos+1:!1}isIdentLike(){let t=this.peek().type;return t==="IDENT"||vo.has(t)}consumeFieldNameAfterDot(t){let n=this.peek();return n.type==="STRING"?this.advance().value:(n.type==="IDENT"||vo.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(){return this.parsePipe()}parsePattern(){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"||vo.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.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(){return this.match("MINUS")?{type:"UnaryOp",op:"-",operand:this.parseUnary()}:this.parsePostfix()}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.parsePostfix(),n;return this.match("CATCH")&&(n=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(){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;)t[s]==="("?i++:t[s]===")"&&i--,i>0&&(o+=t[s]),s++;let a=um(o),l=new e(a);n.push(l.parse())}else r+=t[s],s++;return r&&n.push(r),{type:"StringInterp",parts:n}}}});var hm=v(()=>{"use strict";lm();pm()});var mm={};ee(mm,{flagsForFuzzing:()=>R5,jqCommand:()=>T5});function I5(e){switch(e){case"\b":return"\\b";case"\f":return"\\f";case`
558
+ `:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`}}function $5(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+=I5(i);continue}t+=i}return t}function mc(e,t,n){return JSON.parse($5(e.slice(t,n)))}function dm(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&/\s/.test(e[n]);)n++;if(n>=r)break;let s=n,i=e[n];if(i==="{"||i==="["){let o=i,a=i==="{"?"}":"]",l=1,c=!1,u=!1;for(n++;n<r&&l>0;){let f=e[n];u?u=!1:f==="\\"?u=!0:f==='"'?c=!c:c||(f===o?l++:f===a&&l--),n++}if(l!==0)throw new Error(`Unexpected end of JSON input at position ${n} (unclosed ${o})`);t.push(ps(mc(e,s,n)))}else if(i==='"'){let o=!1;for(n++;n<r;){let a=e[n];if(o)o=!1;else if(a==="\\")o=!0;else if(a==='"'){n++;break}n++}t.push(ps(mc(e,s,n)))}else if(i==="-"||i>="0"&&i<="9"){for(;n<r&&/[\d.eE+-]/.test(e[n]);)n++;t.push(ps(mc(e,s,n)))}else if(e.slice(n,n+4)==="true")t.push(!0),n+=4;else if(e.slice(n,n+5)==="false")t.push(!1),n+=5;else if(e.slice(n,n+4)==="null")t.push(null),n+=4;else{let o=e.slice(n,n+10);throw new Error(`Invalid JSON at position ${s}: unexpected '${o.split(/\s/)[0]}'`)}}return t}function pi(e,t,n,r,s,i=0){if(e===null||e===void 0)return"null";if(typeof e=="boolean")return String(e);if(typeof e=="number")return Number.isFinite(e)?String(e):"null";if(typeof e=="string")return n?e:JSON.stringify(e);let o=s?" ":" ";if(Array.isArray(e))return e.length===0?"[]":t?`[${e.map(l=>pi(l,!0,!1,r,s)).join(",")}]`:`[
559
+ ${e.map(l=>o.repeat(i+1)+pi(l,!1,!1,r,s,i+1)).join(`,
560
+ `)}
561
+ ${o.repeat(i)}]`;if(typeof e=="object"){let a=Object.keys(e);return r&&(a=a.sort()),a.length===0?"{}":t?`{${a.map(c=>`${JSON.stringify(c)}:${pi(e[c],!0,!1,r,s)}`).join(",")}}`:`{
562
+ ${a.map(c=>{let u=pi(e[c],!1,!1,r,s,i+1);return`${o.repeat(i+1)}${JSON.stringify(c)}: ${u}`}).join(`,
563
+ `)}
564
+ ${o.repeat(i)}}`}return String(e)}var O5,T5,R5,gm=v(()=>{"use strict";ge();xn();Ae();Wn();un();Or();ie();hm();An();O5={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-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"," --help display this help and exit"]};T5={name:"jq",async execute(e,t){it(t.requireDefenseContext,"jq","execution entry");let n=(m,g)=>_t(t.requireDefenseContext,"jq",m,g);if(U(e))return M(O5);let r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=".",p=!1,h=[];for(let m=0;m<e.length;m++){let g=e[m];if(g==="-r"||g==="--raw-output")r=!0;else if(g==="-c"||g==="--compact-output")s=!0;else if(g==="-e"||g==="--exit-status")i=!0;else if(g==="-s"||g==="--slurp")o=!0;else if(g==="-n"||g==="--null-input")a=!0;else if(g==="-j"||g==="--join-output")l=!0;else if(!(g==="-a"||g==="--ascii")){if(g==="-S"||g==="--sort-keys")c=!0;else if(!(g==="-C"||g==="--color")){if(!(g==="-M"||g==="--monochrome"))if(g==="--tab")u=!0;else if(g==="-")h.push("-");else{if(g.startsWith("--"))return K("jq",g);if(g.startsWith("-")){for(let y of g.slice(1))if(y==="r")r=!0;else if(y==="c")s=!0;else if(y==="e")i=!0;else if(y==="s")o=!0;else if(y==="n")a=!0;else if(y==="j")l=!0;else if(y!=="a"){if(y==="S")c=!0;else if(y!=="C"){if(y!=="M")return K("jq",`-${y}`)}}}else p?h.push(g):(f=g,p=!0)}}}}let d=[];if(!a)if(h.length===0||h.length===1&&h[0]==="-")d.push({source:"stdin",content:ae(t.stdin)});else{let m=await n("file read",()=>$r(t,h,{cmdName:"jq",stopOnError:!0}));if(m.exitCode!==0)return{stdout:"",stderr:m.stderr,exitCode:2};d=m.files.map(g=>({source:g.filename||"stdin",content:ae(g.content)}))}try{let m=fm(f),g=[],y={limits:t.limits?{maxIterations:t.limits.maxJqIterations}:void 0,env:t.env,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext};if(a)g=q(null,m,y);else if(o){let D=[];for(let{content:R}of d){let L=R.trim();L&&D.push(...dm(L))}g=q(D,m,y)}else for(let{content:D}of d){let R=D.trim();if(!R)continue;let L=dm(R);for(let C of L)g.push(...q(C,m,y))}let b=g.map(D=>pi(D,s,r,c,u)),w=l?"":`
565
+ `,x=b.join(w),A=t.limits?.maxStringLength;if(A!==void 0&&A>0&&x.length>A)throw new X(`jq: output size limit exceeded (${A} bytes)`,"string_length");let I=i&&(g.length===0||g.every(D=>D==null||D===!1))?1:0;return{stdout:x?l?x:`${x}
566
+ `:"",stderr:"",exitCode:I}}catch(m){if(m instanceof de)throw m;if(m instanceof X)return{stdout:"",stderr:`jq: ${He(m.message)}
567
+ `,exitCode:X.EXIT_CODE};let g=He(m.message);return g.includes("Unknown function")?{stdout:"",stderr:`jq: error: ${g}
568
+ `,exitCode:3}:{stdout:"",stderr:`jq: parse error: ${g}
569
+ `,exitCode:5}}}},R5={name:"jq",flags:[{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 wm={};ee(wm,{base64Command:()=>_5,flagsForFuzzing:()=>F5});async function ym(e,t,n){if(t.length===0||t.length===1&&t[0]==="-")return{ok:!0,data:Uint8Array.from(e.stdin,a=>a.charCodeAt(0))};let r=[];for(let a of t){if(a==="-"){r.push(Uint8Array.from(e.stdin,l=>l.charCodeAt(0)));continue}try{let l=e.fs.resolvePath(e.cwd,a),c=await e.fs.readFileBuffer(l);r.push(c)}catch{return{ok:!1,error:{stdout:"",stderr:`${n}: ${a}: No such file or directory
570
+ `,exitCode:1}}}}let s=r.reduce((a,l)=>a+l.length,0),i=new Uint8Array(s),o=0;for(let a of r)i.set(a,o),o+=a.length;return{ok:!0,data:i}}var P5,D5,_5,F5,bm=v(()=>{"use strict";ge();at();ie();P5={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"]},D5={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};_5={name:"base64",async execute(e,t){if(U(e))return M(P5);let n=Se("base64",e,D5);if(!n.ok)return n.error;let r=n.result.flags.decode,s=n.result.flags.wrap,i=n.result.positional;try{if(r){let l=await ym(t,i,"base64");if(!l.ok)return l.error;if(typeof Buffer<"u"){let h=Buffer.from(l.data).toString("utf8").replace(/\s/g,"");return{stdout:Buffer.from(h,"base64").toString("latin1"),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let u=String.fromCharCode(...l.data).replace(/\s/g,"");return{stdout:atob(u),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let o=await ym(t,i,"base64");if(!o.ok)return o.error;let a;if(typeof Buffer<"u"?a=Buffer.from(o.data).toString("base64"):a=btoa(String.fromCharCode(...o.data)),s>0){let l=[];for(let c=0;c<a.length;c+=s)l.push(a.slice(c,c+s));a=l.join(`
571
+ `)+(a.length>0?`
572
+ `:"")}return{stdout:a,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`base64: invalid input
573
+ `,exitCode:1}}}},F5={name:"base64",flags:[{flag:"-d",type:"boolean"},{flag:"-w",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var Em={};ee(Em,{diffCommand:()=>U5,flagsForFuzzing:()=>B5});import*as xm from"diff";var L5,M5,U5,B5,Am=v(()=>{"use strict";ge();at();ie();L5={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"]},M5={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"}},U5={name:"diff",async execute(e,t){if(U(e))return M(L5);let n=Se("diff",e,M5);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
574
+ `,exitCode:2};let a,l,[c,u]=o;try{a=c==="-"?ae(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,c))}catch{return{stdout:"",stderr:`diff: ${c}: No such file or directory
575
+ `,exitCode:2}}try{l=u==="-"?ae(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,u))}catch{return{stdout:"",stderr:`diff: ${u}: No such file or directory
576
+ `,exitCode:2}}let f=a,p=l;return i&&(f=f.toLowerCase(),p=p.toLowerCase()),f===p?s?{stdout:`Files ${c} and ${u} are identical
577
+ `,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:r?{stdout:`Files ${c} and ${u} differ
578
+ `,stderr:"",exitCode:1}:{stdout:xm.createTwoFilesPatch(c,u,a,l,"","",{context:3}),stderr:"",exitCode:1}}},B5={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}});var Sm={};ee(Sm,{dateCommand:()=>G5,flagsForFuzzing:()=>V5});function Gt(e,t=2){return String(e).padStart(t,"0")}function ko(e,t,n){let r={Y:e.getUTCFullYear(),m:e.getUTCMonth(),D:e.getUTCDate(),H:e.getUTCHours(),M:e.getUTCMinutes(),S:e.getUTCSeconds(),w:e.getUTCDay()},s="",i=0;for(;i<t.length;){if(t[i]==="%"&&i+1<t.length){let o=t[++i];switch(o){case"%":s+="%";break;case"a":s+=z5[r.w];break;case"b":case"h":s+=H5[r.m];break;case"d":s+=Gt(r.D);break;case"e":s+=String(r.D).padStart(2," ");break;case"F":s+=`${r.Y}-${Gt(r.m+1)}-${Gt(r.D)}`;break;case"H":s+=Gt(r.H);break;case"I":s+=Gt(r.H%12||12);break;case"m":s+=Gt(r.m+1);break;case"M":s+=Gt(r.M);break;case"n":s+=`
579
+ `;break;case"p":s+=r.H<12?"AM":"PM";break;case"P":s+=r.H<12?"am":"pm";break;case"R":s+=`${Gt(r.H)}:${Gt(r.M)}`;break;case"s":s+=Math.floor(e.getTime()/1e3);break;case"S":s+=Gt(r.S);break;case"t":s+=" ";break;case"T":s+=`${Gt(r.H)}:${Gt(r.M)}:${Gt(r.S)}`;break;case"u":s+=r.w||7;break;case"w":s+=r.w;break;case"y":s+=Gt(r.Y%100);break;case"Y":s+=r.Y;break;case"z":s+="+0000";break;case"Z":s+="UTC";break;default:s+=`%${o}`}}else s+=t[i];i++}return s}function j5(e){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t;if(/^\d+$/.test(e))return new Date(Number.parseInt(e,10)*1e3);let n=e.toLowerCase();return n==="now"||n==="today"?new Date:n==="yesterday"?new Date(Date.now()-864e5):n==="tomorrow"?new Date(Date.now()+864e5):null}var W5,z5,H5,G5,V5,Cm=v(()=>{"use strict";ie();W5={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING","-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"]},z5=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],H5=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];G5={name:"date",async execute(e,t){if(U(e))return M(W5);let n=!1,r=null,s=null,i=!1,o=!1;for(let c=0;c<e.length;c++){let u=e[c];if(u==="-u"||u==="--utc")n=!0;else if(u==="-d"||u==="--date")r=e[++c]??"";else if(u.startsWith("--date="))r=u.slice(7);else if(u==="-I"||u==="--iso-8601")i=!0;else if(u==="-R"||u==="--rfc-email")o=!0;else if(u.startsWith("+"))s=u.slice(1);else{if(u.startsWith("--"))return K("date",u);if(u.startsWith("-"))for(let f of u.slice(1))if(f==="u")n=!0;else if(f==="I")i=!0;else if(f==="R")o=!0;else return K("date",`-${f}`)}}let a=r!==null?j5(r):new Date;if(!a)return{stdout:"",stderr:`date: invalid date '${r}'
580
+ `,exitCode:1};let l;return s?l=ko(a,s,n):i?l=ko(a,"%Y-%m-%dT%H:%M:%S%z",n):o?l=ko(a,"%a, %d %b %Y %H:%M:%S %z",n):l=ko(a,"%a %b %e %H:%M:%S %Z %Y",n),{stdout:`${l}
581
+ `,stderr:"",exitCode:0}}},V5={name:"date",flags:[{flag:"-d",type:"value",valueHint:"string"},{flag:"-u",type:"boolean"},{flag:"-I",type:"boolean"},{flag:"-R",type:"boolean"}]}});function No(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 gc=v(()=>{"use strict"});var km={};ee(km,{flagsForFuzzing:()=>K5,sleepCommand:()=>Z5});var q5,vm,Z5,K5,Nm=v(()=>{"use strict";Zs();gc();ie();q5={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
582
+ s - seconds (default)
583
+ m - minutes
584
+ h - hours
585
+ d - days
586
+
587
+ NUMBER may be a decimal number.`,options:[" --help display this help and exit"]},vm=36e5,Z5={name:"sleep",async execute(e,t){if(U(e))return M(q5);if(e.length===0)return{stdout:"",stderr:`sleep: missing operand
588
+ `,exitCode:1};let n=0;for(let r of e){let s=No(r);if(s===null)return{stdout:"",stderr:`sleep: invalid time interval '${r}'
589
+ `,exitCode:1};n+=s}return n>vm&&(n=vm),t.signal?.aborted?{stdout:"",stderr:"",exitCode:0}:(t.sleep?await t.sleep(n):t.signal?await new Promise(r=>{let s=()=>{ns(i),r()},i=Ir(()=>{t.signal?.removeEventListener("abort",s),r()},n);t.signal?.addEventListener("abort",s,{once:!0})}):await new Promise(r=>Ir(r,n)),{stdout:"",stderr:"",exitCode:0})}},K5={name:"sleep",flags:[],needsArgs:!0}});var Im={};ee(Im,{flagsForFuzzing:()=>Y5,timeoutCommand:()=>X5});var Q5,X5,Y5,$m=v(()=>{"use strict";ge();Rr();Zs();gc();ie();Q5={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.
590
+
591
+ DURATION is a number with optional suffix:
592
+ s - seconds (default)
593
+ m - minutes
594
+ h - hours
595
+ 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"]},X5={name:"timeout",async execute(e,t){if(U(e))return M(Q5);let n=0;for(let c=0;c<e.length;c++){let u=e[c];if(u==="--preserve-status")n=c+1;else if(u==="--foreground")n=c+1;else if(u==="-k"||u==="--kill-after")c++,n=c+1;else if(u.startsWith("--kill-after="))n=c+1;else if(u==="-s"||u==="--signal")c++,n=c+1;else if(u.startsWith("--signal="))n=c+1;else{if(u.startsWith("--")&&u!=="--")return K("timeout",u);if(u.startsWith("-")&&u.length>1&&u!=="--")if(u.startsWith("-k"))n=c+1;else if(u.startsWith("-s"))n=c+1;else return K("timeout",u);else{n=c;break}}}let r=e.slice(n);if(r.length===0)return{stdout:"",stderr:`timeout: missing operand
596
+ `,exitCode:1};let s=r[0],i=No(s);if(i===null)return{stdout:"",stderr:`timeout: invalid time interval '${s}'
597
+ `,exitCode:1};let o=r.slice(1);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
598
+ `,exitCode:1};if(!t.exec)return{stdout:"",stderr:`timeout: exec not available
599
+ `,exitCode:1};let a=new AbortController,l;try{let c=new Promise(p=>{l=Ir(()=>{a.abort(),p({timedOut:!0})},i)}),u=t.exec(sn([o[0]]),{cwd:t.cwd,signal:a.signal,stdin:t.stdin,stdinKind:"bytes",args:o.slice(1)}).then(p=>({timedOut:!1,result:p})),f=await Promise.race([c,u]);return f.timedOut?{stdout:"",stderr:"",exitCode:124}:f.result}finally{l!==void 0&&ns(l)}}},Y5={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 lR,cR,Ss,Io,hi=v(()=>{"use strict";lR=globalThis.SharedArrayBuffer,cR=globalThis.Atomics,Ss=performance.now.bind(performance),Io=globalThis.Headers});var Om={};ee(Om,{flagsForFuzzing:()=>tx,timeCommand:()=>J5});function ex(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 J5,tx,Tm=v(()=>{"use strict";ge();xn();er();Rr();hi();J5={name:"time",async execute(e,t){let n="%e %M",r=null,s=!1,i=!1,o=0;for(;o<e.length;){let d=e[o];if(d==="-f"||d==="--format"){if(o++,o>=e.length)return{stdout:"",stderr:`time: missing argument to '-f'
600
+ `,exitCode:1};n=e[o],o++}else if(d==="-o"||d==="--output"){if(o++,o>=e.length)return{stdout:"",stderr:`time: missing argument to '-o'
601
+ `,exitCode:1};r=e[o],o++}else if(d==="-a"||d==="--append")s=!0,o++;else if(d==="-v"||d==="--verbose")n=`Command being timed: %C
602
+ Elapsed (wall clock) time: %e seconds
603
+ Maximum resident set size (kbytes): %M`,o++;else if(d==="-p"||d==="--portability")i=!0,o++;else if(d==="--"){o++;break}else if(d.startsWith("-"))o++;else break}let a=e.slice(o);if(a.length===0)return{stdout:"",stderr:"",exitCode:0};let l=Ss(),c=a.join(" "),u;try{if(!t.exec)return{stdout:"",stderr:`time: exec not available
604
+ `,exitCode:1};u=await t.exec(sn([a[0]]),{env:Ct(t.env),cwd:t.cwd,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:a.slice(1)})}catch(d){u={stdout:"",stderr:`time: ${He(d.message)}
605
+ `,exitCode:127}}let p=(Ss()-l)/1e3,h;if(i?h=`real ${p.toFixed(2)}
606
+ user 0.00
607
+ sys 0.00
608
+ `:(h=n.replace(/%e/g,p.toFixed(2)).replace(/%E/g,ex(p)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,c),h.endsWith(`
609
+ `)||(h+=`
610
+ `)),r)try{let d=t.fs.resolvePath(t.cwd,r);if(s&&await t.fs.exists(d)){let m=await t.fs.readFile(d);await t.fs.writeFile(d,m+h)}else await t.fs.writeFile(d,h)}catch(d){let m=He(d.message);return{stdout:u.stdout,stderr:u.stderr+`time: cannot write to '${r}': ${m}
611
+ `,exitCode:u.exitCode}}else u={...u,stderr:u.stderr+h};return u}};tx={name:"time",flags:[{flag:"-p",type:"boolean"}],needsArgs:!0}});var Rm={};ee(Rm,{flagsForFuzzing:()=>rx,seqCommand:()=>nx});var nx,rx,Pm=v(()=>{"use strict";nx={name:"seq",async execute(e){let t=`
612
+ `,n=!1,r=[],s=0;for(;s<e.length;){let d=e[s];if(d==="-s"&&s+1<e.length){t=e[s+1],s+=2;continue}if(d==="-w"){n=!0,s++;continue}if(d==="--"){s++;break}if(d.startsWith("-")&&d!=="-"){if(d.startsWith("-s")&&d.length>2){t=d.slice(2),s++;continue}if((d==="-ws"||d==="-sw")&&(n=!0,s+1<e.length)){t=e[s+1],s+=2;continue}}r.push(d),s++}for(;s<e.length;)r.push(e[s]),s++;if(r.length===0)return{stdout:"",stderr:`seq: missing operand
613
+ `,exitCode:1};let i=1,o=1,a;if(r.length===1?a=parseFloat(r[0]):r.length===2?(i=parseFloat(r[0]),a=parseFloat(r[1])):(i=parseFloat(r[0]),o=parseFloat(r[1]),a=parseFloat(r[2])),Number.isNaN(i)||Number.isNaN(o)||Number.isNaN(a))return{stdout:"",stderr:`seq: invalid floating point argument: '${r.find(m=>Number.isNaN(parseFloat(m)))}'
614
+ `,exitCode:1};if(o===0)return{stdout:"",stderr:`seq: invalid Zero increment value: '0'
615
+ `,exitCode:1};let l=[],c=d=>{let m=String(d),g=m.indexOf(".");return g===-1?0:m.length-g-1},u=Math.max(c(i),c(o),c(a)),f=1e5,p=0;if(o>0)for(let d=i;d<=a+1e-10&&!(p++>f);d+=o)l.push(u>0?d.toFixed(u):String(Math.round(d)));else for(let d=i;d>=a-1e-10&&!(p++>f);d+=o)l.push(u>0?d.toFixed(u):String(Math.round(d)));if(n&&l.length>0){let d=Math.max(...l.map(m=>m.replace("-","").length));for(let m=0;m<l.length;m++){let g=l[m].startsWith("-"),b=(g?l[m].slice(1):l[m]).padStart(d,"0");l[m]=g?`-${b}`:b}}let h=l.join(t);return{stdout:h?`${h}
616
+ `:"",stderr:"",exitCode:0}}},rx={name:"seq",flags:[{flag:"-s",type:"value",valueHint:"string"},{flag:"-w",type:"boolean"}],needsArgs:!0}});var Dm={};ee(Dm,{exprCommand:()=>sx,flagsForFuzzing:()=>ox});function ix(e){if(e.length===1)return e[0];let t=0;function n(){let c=r();for(;t<e.length&&e[t]==="|";){t++;let u=r();if(c!=="0"&&c!=="")return c;c=u}return c}function r(){let c=s();for(;t<e.length&&e[t]==="&";){t++;let u=s();(c==="0"||c===""||u==="0"||u==="")&&(c="0")}return c}function s(){let c=i();for(;t<e.length;){let u=e[t];if(["=","!=","<",">","<=",">="].includes(u)){t++;let f=i(),p=parseInt(c,10),h=parseInt(f,10),d=!Number.isNaN(p)&&!Number.isNaN(h),m;u==="="?m=d?p===h:c===f:u==="!="?m=d?p!==h:c!==f:u==="<"?m=d?p<h:c<f:u===">"?m=d?p>h:c>f:u==="<="?m=d?p<=h:c<=f:m=d?p>=h:c>=f,c=m?"1":"0"}else break}return c}function i(){let c=o();for(;t<e.length;){let u=e[t];if(u==="+"||u==="-"){t++;let f=o(),p=parseInt(c,10),h=parseInt(f,10);if(Number.isNaN(p)||Number.isNaN(h))throw new Error("non-integer argument");c=String(u==="+"?p+h:p-h)}else break}return c}function o(){let c=a();for(;t<e.length;){let u=e[t];if(u==="*"||u==="/"||u==="%"){t++;let f=a(),p=parseInt(c,10),h=parseInt(f,10);if(Number.isNaN(p)||Number.isNaN(h))throw new Error("non-integer argument");if((u==="/"||u==="%")&&h===0)throw new Error("division by zero");u==="*"?c=String(p*h):u==="/"?c=String(Math.trunc(p/h)):c=String(p%h)}else break}return c}function a(){let c=l();for(;t<e.length&&e[t]===":";){t++;let u=l(),p=Q(`^${u}`).match(c);p?c=p[1]!==void 0?p[1]:String(p[0].length):c="0"}return c}function l(){if(t>=e.length)throw new Error("syntax error");let c=e[t];if(c==="match"){t++;let u=l(),f=l(),h=Q(f).match(u);return h?h[1]!==void 0?h[1]:String(h[0].length):"0"}if(c==="substr"){t++;let u=l(),f=parseInt(l(),10),p=parseInt(l(),10);if(Number.isNaN(f)||Number.isNaN(p))throw new Error("non-integer argument");return u.substring(f-1,f-1+p)}if(c==="index"){t++;let u=l(),f=l();for(let p=0;p<u.length;p++)if(f.includes(u[p]))return String(p+1);return"0"}if(c==="length"){t++;let u=l();return String(u.length)}if(c==="("){t++;let u=n();if(t>=e.length||e[t]!==")")throw new Error("syntax error");return t++,u}return t++,c}return n()}var sx,ox,_m=v(()=>{"use strict";xn();Ze();sx={name:"expr",async execute(e,t){if(e.length===0)return{stdout:"",stderr:`expr: missing operand
617
+ `,exitCode:2};try{let n=ix(e),r=n==="0"||n===""?1:0;return{stdout:`${n}
618
+ `,stderr:"",exitCode:r}}catch(n){return{stdout:"",stderr:`expr: ${He(n.message)}
619
+ `,exitCode:2}}}};ox={name:"expr",flags:[],needsArgs:!0}});function lx(e){function t(h,d){return h<<d|h>>>32-d}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 h=0;h<o.length;h+=64){let d=new Uint32Array(16);for(let w=0;w<16;w++)d[w]=a.getUint32(h+w*4,!0);let m=l,g=c,y=u,b=f;for(let w=0;w<64;w++){let x,A;w<16?(x=g&y|~g&b,A=w):w<32?(x=b&g|~b&y,A=(5*w+1)%16):w<48?(x=g^y^b,A=(3*w+5)%16):(x=y^(g|~b),A=7*w%16),x=x+m+n[w]+d[A]>>>0,m=b,b=y,y=g,g=g+t(x,r[w])>>>0}l=l+m>>>0,c=c+g>>>0,u=u+y>>>0,f=f+b>>>0}let p=new Uint8Array(16);return new DataView(p.buffer).setUint32(0,l,!0),new DataView(p.buffer).setUint32(4,c,!0),new DataView(p.buffer).setUint32(8,u,!0),new DataView(p.buffer).setUint32(12,f,!0),Array.from(p).map(h=>h.toString(16).padStart(2,"0")).join("")}async function Fm(e,t){if(e==="md5")return lx(t);let n=ax.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 Cs(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(U(s))return M(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 K(e,f);a.push(f)}a.length===0&&a.push("-");let l=async f=>{if(f==="-")return Uint8Array.from(i.stdin,p=>p.charCodeAt(0));try{return await i.fs.readFileBuffer(i.fs.resolvePath(i.cwd,f))}catch{return null}};if(o){let f=0,p="";for(let h of a){let d=h==="-"?ae(i.stdin):await i.fs.readFile(i.fs.resolvePath(i.cwd,h)).catch(()=>null);if(d===null)return{stdout:"",stderr:`${e}: ${h}: No such file or directory
620
+ `,exitCode:1};for(let m of d.split(`
621
+ `)){let g=m.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!g)continue;let[,y,b]=g,w=await l(b);if(w===null){p+=`${b}: FAILED open or read
622
+ `,f++;continue}let x=await Fm(t,w)===y.toLowerCase();p+=`${b}: ${x?"OK":"FAILED"}
623
+ `,x||f++}}return f>0&&(p+=`${e}: WARNING: ${f} computed checksum${f>1?"s":""} did NOT match
624
+ `),{stdout:p,stderr:"",exitCode:f>0?1:0}}let c="",u=0;for(let f of a){let p=await l(f);if(p===null){c+=`${e}: ${f}: No such file or directory
625
+ `,u=1;continue}c+=`${await Fm(t,p)} ${f}
626
+ `}return{stdout:c,stderr:"",exitCode:u}}}}var ax,$o=v(()=>{"use strict";ge();ie();ax=new Map([["sha1","SHA-1"],["sha256","SHA-256"]])});var Lm={};ee(Lm,{flagsForFuzzing:()=>ux,md5sumCommand:()=>cx});var cx,ux,Mm=v(()=>{"use strict";$o();cx=Cs("md5sum","md5","compute MD5 message digest"),ux={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Um={};ee(Um,{flagsForFuzzing:()=>px,sha1sumCommand:()=>fx});var fx,px,Bm=v(()=>{"use strict";$o();fx=Cs("sha1sum","sha1","compute SHA1 message digest"),px={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Wm={};ee(Wm,{flagsForFuzzing:()=>dx,sha256sumCommand:()=>hx});var hx,dx,zm=v(()=>{"use strict";$o();hx=Cs("sha256sum","sha256","compute SHA256 message digest"),dx={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Hm=Li(yc=>{yc.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,p=n?-1:1,h=e[t+f];for(f+=p,i=h&(1<<-u)-1,h>>=-u,u+=a;u>0;i=i*256+e[t+f],f+=p,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+f],f+=p,u-=8);if(i===0)i=1-c;else{if(i===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-c}return(h?-1:1)*o*Math.pow(2,i-r)};yc.write=function(e,t,n,r,s,i){var o,a,l,c=i*8-s-1,u=(1<<c)-1,f=u>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,d=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+=p/l:t+=p*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+h]=a&255,h+=d,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[n+h]=o&255,h+=d,o/=256,c-=8);e[n+h-d]|=m*128}});function gx(){if(!(typeof globalThis.TextDecoder>"u"))return Oo??(Oo=new globalThis.TextDecoder("utf-8"))}function Gm(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let n=gx();return n?n.decode(e):wx(e)}case"utf-16le":return bx(e);case"us-ascii":case"ascii":return xx(e);case"latin1":case"iso-8859-1":return Ex(e);case"windows-1252":return Ax(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function wc(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function gt(e,t,n){t.push(n),t.length>=vs&&wc(e,t)}function yx(e,t,n){if(n<=65535){gt(e,t,n);return}n-=65536,gt(e,t,55296+(n>>10)),gt(e,t,56320+(n&1023))}function wx(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){gt(t,n,s),r++;continue}if(s<194||s>244){gt(t,n,vn),r++;continue}if(s<=223){if(r+1>=e.length){gt(t,n,vn),r++;continue}let u=e[r+1];if((u&192)!==128){gt(t,n,vn),r++;continue}let f=(s&31)<<6|u&63;gt(t,n,f),r+=2;continue}if(s<=239){if(r+2>=e.length){gt(t,n,vn),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))){gt(t,n,vn),r++;continue}let h=(s&15)<<12|(u&63)<<6|f&63;gt(t,n,h),r+=3;continue}if(r+3>=e.length){gt(t,n,vn),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))){gt(t,n,vn),r++;continue}let c=(s&7)<<18|(i&63)<<12|(o&63)<<6|a&63;yx(t,n,c),r+=4}return wc(t,n),t.join("")}function bx(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?(gt(t,n,i),gt(t,n,o),s+=2):gt(t,n,vn)}else gt(t,n,vn);continue}if(i>=56320&&i<=57343){gt(t,n,vn);continue}gt(t,n,i)}return s<r&&gt(t,n,vn),wc(t,n),t.join("")}function xx(e){let t=[];for(let n=0;n<e.length;n+=vs){let r=Math.min(e.length,n+vs),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 Ex(e){let t=[];for(let n=0;n<e.length;n+=vs){let r=Math.min(e.length,n+vs),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 Ax(e){let t=[],n="";for(let r=0;r<e.length;r++){let s=e[r],i=s>=128&&s<=159?jm[s]:void 0;n+=i??String.fromCharCode(s),n.length>=vs&&(t.push(n),n="")}return n&&t.push(n),t.join("")}var jm,mx,Oo,vs,vn,Vm=v(()=>{jm={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"},mx={};for(let[e,t]of Object.entries(jm))mx[t]=Number.parseInt(e,10);vs=32*1024,vn=65533});function Vt(e){return new DataView(e.buffer,e.byteOffset)}var qm,Zm,rt,Mr,nt,bc,Km,Qm,qt,di=v(()=>{qm=Pf(Hm(),1);Vm();Zm={len:1,get(e,t){return Vt(e).getUint8(t)},put(e,t,n){return Vt(e).setUint8(t,n),t+1}},rt={len:2,get(e,t){return Vt(e).getUint16(t,!0)},put(e,t,n){return Vt(e).setUint16(t,n,!0),t+2}},Mr={len:2,get(e,t){return Vt(e).getUint16(t)},put(e,t,n){return Vt(e).setUint16(t,n),t+2}},nt={len:4,get(e,t){return Vt(e).getUint32(t,!0)},put(e,t,n){return Vt(e).setUint32(t,n,!0),t+4}},bc={len:4,get(e,t){return Vt(e).getUint32(t)},put(e,t,n){return Vt(e).setUint32(t,n),t+4}},Km={len:4,get(e,t){return Vt(e).getInt32(t)},put(e,t,n){return Vt(e).setInt32(t,n),t+4}},Qm={len:8,get(e,t){return Vt(e).getBigUint64(t,!0)},put(e,t,n){return Vt(e).setBigUint64(t,n,!0),t+8}},qt=class{constructor(t,n){this.len=t,this.encoding=n}get(t,n=0){let r=t.subarray(n,n+this.len);return Gm(r,this.encoding)}}});var Cx,Be,Ur,mi=v(()=>{Cx="End-Of-Stream",Be=class extends Error{constructor(){super(Cx),this.name="EndOfStreamError"}},Ur=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var Xm=v(()=>{});var Br,To=v(()=>{mi();Br=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 Be;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 Ur;let s=await this.readFromStream(t.subarray(r),n);if(s===0)break;r+=s}if(!n&&r<t.length)throw new Be;return r}}});var Ym=v(()=>{mi();Xm();To()});var Ro,Jm=v(()=>{To();Ro=class extends Br{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var gi,xc=v(()=>{Jm();gi=class extends Ro{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 ks,Ec=v(()=>{mi();To();ks=class extends Br{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 Be;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function Ac(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new ks(t):new gi(t)}catch(t){if(t instanceof TypeError)return new ks(e.getReader());throw t}}var e0=v(()=>{xc();Ec()});var Wr=v(()=>{mi();Ym();xc();Ec();e0()});var tr,yi=v(()=>{Wr();tr=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 Be;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 Be;return t.get(r,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Be;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Be;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 kx,Po,t0=v(()=>{yi();Wr();kx=256e3,Po=class extends tr{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 Be;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 Be)return 0;throw i}if(!r.mayBeLess&&s<r.length)throw new Be}return s}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");let n=Math.min(kx,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 Do,n0=v(()=>{Wr();yi();Do=class extends tr{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 Be;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 _o,r0=v(()=>{Wr();yi();_o=class extends tr{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 Be;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 s0(e,t){let n=Ac(e),r=t??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new Po(n,r)}function i0(e,t){return new Do(e,t)}function o0(e,t){return new _o(e,t)}var a0=v(()=>{Wr();t0();n0();r0();Wr();yi()});var c0=Li((mP,l0)=>{var Ns=1e3,Is=Ns*60,$s=Is*60,zr=$s*24,Ix=zr*7,$x=zr*365.25;l0.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return Ox(e);if(n==="number"&&isFinite(e))return t.long?Rx(e):Tx(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Ox(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*$x;case"weeks":case"week":case"w":return n*Ix;case"days":case"day":case"d":return n*zr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*$s;case"minutes":case"minute":case"mins":case"min":case"m":return n*Is;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ns;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Tx(e){var t=Math.abs(e);return t>=zr?Math.round(e/zr)+"d":t>=$s?Math.round(e/$s)+"h":t>=Is?Math.round(e/Is)+"m":t>=Ns?Math.round(e/Ns)+"s":e+"ms"}function Rx(e){var t=Math.abs(e);return t>=zr?Fo(e,t,zr,"day"):t>=$s?Fo(e,t,$s,"hour"):t>=Is?Fo(e,t,Is,"minute"):t>=Ns?Fo(e,t,Ns,"second"):e+" ms"}function Fo(e,t,n,r){var s=t>=n*1.5;return Math.round(e/n)+" "+r+(s?"s":"")}});var f0=Li((gP,u0)=>{function Px(e){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=s,n.enabled=a,n.humanize=c0(),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 p=0;p<u.length;p++)f=(f<<5)-f+u.charCodeAt(p),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=t;function n(u){let f,p=null,h,d;function m(...g){if(!m.enabled)return;let y=m,b=Number(new Date),w=b-(f||b);y.diff=w,y.prev=f,y.curr=b,f=b,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,(I,$)=>{if(I==="%%")return"%";x++;let D=n.formatters[$];if(typeof D=="function"){let R=g[x];I=D.call(y,R),g.splice(x,1),x--}return I}),n.formatArgs.call(y,g),(y.log||n.log).apply(y,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:()=>p!==null?p:(h!==n.namespaces&&(h=n.namespaces,d=n.enabled(u)),d),set:g=>{p=g}}),typeof n.init=="function"&&n.init(m),m}function r(u,f){let p=n(this.namespace+(typeof f>"u"?":":f)+u);return p.log=this.log,p}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 p of f)p[0]==="-"?n.skips.push(p.slice(1)):n.names.push(p)}function i(u,f){let p=0,h=0,d=-1,m=0;for(;p<u.length;)if(h<f.length&&(f[h]===u[p]||f[h]==="*"))f[h]==="*"?(d=h,m=p,h++):(p++,h++);else if(d!==-1)h=d+1,m++,p=m;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===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}u0.exports=Px});var p0=Li((Zt,Lo)=>{Zt.formatArgs=_x;Zt.save=Fx;Zt.load=Lx;Zt.useColors=Dx;Zt.storage=Mx();Zt.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`."))}})();Zt.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 Dx(){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 _x(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Lo.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)}Zt.log=console.debug||console.log||(()=>{});function Fx(e){try{e?Zt.storage.setItem("debug",e):Zt.storage.removeItem("debug")}catch{}}function Lx(){let e;try{e=Zt.storage.getItem("debug")||Zt.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Mx(){try{return localStorage}catch{}}Lo.exports=f0()(Zt);var{formatters:Ux}=Lo.exports;Ux.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Hr,Sc,h0,d0,m0,g0=v(()=>{di();Hr={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Sc={get(e){return{signature:nt.get(e,0),compressedSize:nt.get(e,8),uncompressedSize:nt.get(e,12)}},len:16},h0={get(e){let t=rt.get(e,6);return{signature:nt.get(e,0),minVersion:rt.get(e,4),dataDescriptor:!!(t&8),compressedMethod:rt.get(e,8),compressedSize:nt.get(e,18),uncompressedSize:nt.get(e,22),filenameLength:rt.get(e,26),extraFieldLength:rt.get(e,28),filename:null}},len:30},d0={get(e){return{signature:nt.get(e,0),nrOfThisDisk:rt.get(e,4),nrOfThisDiskWithTheStart:rt.get(e,6),nrOfEntriesOnThisDisk:rt.get(e,8),nrOfEntriesOfSize:rt.get(e,10),sizeOfCd:nt.get(e,12),offsetOfStartOfCd:nt.get(e,16),zipFileCommentLength:rt.get(e,20)}},len:22},m0={get(e){let t=rt.get(e,8);return{signature:nt.get(e,0),minVersion:rt.get(e,6),dataDescriptor:!!(t&8),compressedMethod:rt.get(e,10),compressedSize:nt.get(e,20),uncompressedSize:nt.get(e,24),filenameLength:rt.get(e,28),extraFieldLength:rt.get(e,30),fileCommentLength:rt.get(e,32),relativeOffsetOfLocalHeader:nt.get(e,42),filename:null}},len:46}});function w0(e){let t=new Uint8Array(nt.len);return nt.put(t,0,e),t}function Wx(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 zx(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 y0,zn,Cc,Bx,Mo,jr,b0=v(()=>{di();y0=Pf(p0(),1);g0();zn=(0,y0.default)("tokenizer:inflate"),Cc=256*1024,Bx=w0(Hr.DataDescriptor),Mo=w0(Hr.EndOfCentralDirectory),jr=class e{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Cc)}async isZip(){return await this.peekSignature()===Hr.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(nt)}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]===Mo[0]&&r[s+1]===Mo[1]&&r[s+2]===Mo[2]&&r[s+3]===Mo[3])return t.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){zn("Cannot reading central-directory without random-read support");return}zn("Reading central-directory...");let t=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){zn("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(d0,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let o=await this.tokenizer.readToken(m0);if(o.signature!==Hr.CentralFileHeader)throw new Error("Expected Central-File-Header signature");o.filename=await this.tokenizer.readToken(new qt(o.filenameLength,"utf-8")),await this.tokenizer.ignore(o.extraFieldLength),await this.tokenizer.ignore(o.fileCommentLength),s.push(o),zn(`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=Cc;zn("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===Cc;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=Wx(this.syncBuffer.subarray(0,l),Bx);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)}zn(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,zx(a),i.handler)}else i.handler?(zn(`Reading compressed-file-data: ${s.compressedSize} bytes`),o=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(s,o,i.handler)):(zn(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(zn(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(Sc)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Sc.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}`);zn(`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(nt);if(t===Hr.LocalFileHeader){let n=await this.tokenizer.readToken(h0);return n.filename=await this.tokenizer.readToken(new qt(n.filenameLength,"utf-8")),n}if(t===Hr.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var wi,x0=v(()=>{wi=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 E0=v(()=>{b0();x0()});function vc(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 kP,NP,IP,A0=v(()=>{kP={utf8:new globalThis.TextDecoder("utf8")},NP=new globalThis.TextEncoder,IP=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});function S0(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 C0(e,t=0){let n=Number.parseInt(new qt(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 v0,k0=v(()=>{di();v0={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}});var N0,I0,$0=v(()=>{N0=["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"],I0=["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 nE(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 $c(e,t,n){if(!Number.isFinite(e)||e<0||e>t)throw new nr(`${n} has invalid size ${e} (maximum ${t} bytes)`);return e}async function pr(e,t,{maximumLength:n=gn,reason:r="skip"}={}){let s=$c(t,n,r);await e.ignore(s)}async function Nc(e,t,n,{maximumLength:r=t.length,reason:s="read"}={}){let i=n?.length??t.length,o=$c(i,r,s);return e.readBuffer(t,{...n,length:o})}async function rE(e,{maximumLength:t=jn}={}){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 iE(e,t){if(e.length<Uo)return-1;let n=e.length-Uo;for(let r=0;r<=n;r++)if(nt.get(e,r)===z0&&nt.get(e,r+8)===t+r)return r;return-1}function oE(e){return(e.codePointAt(0)&32)!==0}function aE(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 lE(e,{shouldBuffer:t,maximumLength:n=jn}={}){let{syncBuffer:r}=e,{length:s}=r,i=[],o=0;for(;;){let a=await e.tokenizer.peekBuffer(r,{mayBeLess:!0}),l=iE(r.subarray(0,a),o),c=l>=0?0:a===s?Math.min(sE,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(Lt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=o),!!t)return aE(i,o)}function cE(e,t){return Lt(e.tokenizer)?Math.max(0,gn-(e.tokenizer.position-t)):Math.max(0,jn-e.knownSizeDescriptorScannedBytes)}async function uE(e,t,{shouldBuffer:n,maximumDescriptorLength:r=jn}={}){if(t.dataDescriptor&&t.compressedSize===0)return lE(e,{shouldBuffer:n,maximumLength:r});if(!n){await pr(e.tokenizer,t.compressedSize,{maximumLength:Lt(e.tokenizer)?jn:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let s=gE(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 fE(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 H0(e,t){return new Ic(t).fromBuffer(e)}function U0(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 Hn(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 pE(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):bi}function hE(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 dE(e){return Number.isFinite(e)?Math.max(0,Math.min(Hx,Math.trunc(e))):0}function mE(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function Lt(e){let t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function xi(e,t,n){return Lt(e)&&e.position-t>n}function gE(e){let t=e.fileInfo.size,n=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(n,jx)}function yE(e){if(e instanceof Be||e instanceof nr)return!0;if(!(e instanceof Error))return!1;if(Jx.has(e.message)||tE.has(e.code))return!0;for(let t of eE)if(e.message.startsWith(t))return!0;return!1}function B0(e,t=jn){let n=[e.compressedSize,e.uncompressedSize];for(let r of n)if(!Number.isFinite(r)||r<0||r>t)return!1;return!0}function wE(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function bE(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 W0(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 xE(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 bi,Hx,jn,O0,jx,gn,Bo,T0,Gx,Vx,R0,kc,P0,D0,qx,Zx,Kx,Qx,Xx,_0,F0,L0,Yx,M0,Jx,eE,tE,nr,z0,Uo,sE,Ic,LP,MP,j0=v(()=>{di();a0();E0();A0();k0();$0();bi=4100,Hx=bi-2,jn=1024*1024,O0=1024,jx=2**31-1,gn=16*1024*1024,Bo=jn,T0=jn,Gx=gn,Vx=1,R0=100,kc=gn,P0=64,D0=Bo,qx=256,Zx=512,Kx=gn,Qx=512,Xx=512,_0=256,F0=Bo,L0=Bo,Yx=Bo,M0=gn,Jx=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),eE=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],tE=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),nr=class extends Error{};z0=134695760,Uo=16,sE=Uo-1;jr.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 rE(t,{maximumLength:jn});return n(r)};jr.prototype.unzip=async function(e){let t=!1,n=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(xi(this.tokenizer,r,gn))throw new nr(`ZIP stream probing exceeds ${gn} bytes`);let s=await this.readLocalFileHeader();if(!s)break;if(n++,n>O0)throw new Error(`ZIP entry count exceeds ${O0}`);let i=e(s);t=!!i.stop,await this.tokenizer.ignore(s.extraFieldLength);let o=await uE(this,s,{shouldBuffer:!!i.handler,maximumDescriptorLength:Math.min(jn,cE(this,r))});if(i.handler&&await this.inflate(s,o,i.handler),s.dataDescriptor){let a=new Uint8Array(Uo);if(await this.tokenizer.readBuffer(a),nt.get(a,0)!==z0)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-a.length}`)}if(xi(this.tokenizer,r,gn))throw new nr(`ZIP stream probing exceeds ${gn} bytes`)}while(!t)};Ic=class e{constructor(t){let n=dE(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 nE(s0(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 Be||o instanceof nr)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(i0(n,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let n=o0(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=pE(n?.sampleSize??bi),s,i,o=t.getReader({mode:"byob"});try{let{value:c,done:u}=await hE(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 Be))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>=Vx)return{ext:"gz",mime:"application/gzip"};let n=new wi(t),r=fE(n.inflate(),Gx),s=Lt(t),i,o,a,l;if(s){let c=new AbortController;i=setTimeout(()=>{c.abort(new DOMException(`Operation timed out after ${R0} ms`,"TimeoutError"))},R0),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 Hn(this.buffer,t,n)}checkString(t,n){return this.check(S0(t,n?.encoding),n)}detectConfident=async t=>{if(this.buffer=new Uint8Array(bi),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Lt(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>=_0?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 pr(t,6,{maximumLength:6,reason:"ID3 header prefix"});let n=await t.readToken(v0),r=Lt(t);if(!Number.isFinite(n)||n<0||r&&(n>kc||t.position+n>kc))return;if(t.position+n>t.fileInfo.size)return r?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await pr(t,n,{maximumLength:r?kc:t.fileInfo.size,reason:"ID3 payload"})}catch(s){if(s instanceof Be)return;throw s}return this.detectionReentryCount>=_0?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=wE();try{await new jr(t).unzip(s=>{bE(r,s.filename);let i=s.filename==="[Content_Types].xml",o=W0(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 B0(s,T0)?{async handler(a){let l=new TextDecoder("utf-8").decode(a).trim();n=U0(l)},stop:!0}:{};case"[Content_Types].xml":return r.hasContentTypesEntry=!0,B0(s,T0)?(r.isParsingContentTypes=!0,{async handler(a){let l=new TextDecoder("utf-8").decode(a),c=xE(l);c&&(n=U0(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(!yE(s))throw s;r.isParsingContentTypes&&(r.isParsingContentTypes=!1,r.hasUnparseableContentTypes=!0)}return n??W0(r)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let n=new Uint8Array(8);return await t.readBuffer(n),Hn(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Hn(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Hn(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Hn(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Hn(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Hn(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(Zm),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let f=new Uint8Array(u+1);return await Nc(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),p=new DataView(c.buffer,c.length-u,u);return{id:vc(f),len:vc(p)}}async function s(l){let c=0;for(;l>0;){if(c++,c>qx||xi(t,o,gn))return;let u=t.position,f=await r();if(f.id===17026){if(f.len>P0)return;let p=$c(f.len,P0,"EBML DocType");return(await t.readToken(new qt(p))).replaceAll(/\00.*$/g,"")}if(Lt(t)&&(!Number.isFinite(f.len)||f.len<0||f.len>D0)||(await pr(t,f.len,{maximumLength:Lt(t)?D0: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=bc.get(this.buffer,4),r=Mr.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 qt(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 qt(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
627
+ `,"\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(Km),type:await t.readToken(new qt(4,"latin1"))}}let i=Lt(t),o=t.position,a=0,l=!1;do{if(a++,a>Zx||xi(t,o,Kx))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>F0)return l&&oE(u.type)?n:void 0;try{await pr(t,u.length+4,{maximumLength:i?F0+4:t.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!i&&(f instanceof nr||f instanceof Be))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 qt(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
628
+ `))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 Nc(t,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await t.readToken(Qm))}}await pr(t,30,{maximumLength:30,reason:"ASF header prelude"});let s=Lt(t),i=t.position,o=0;for(;t.position+24<t.fileInfo.size&&(o++,!(o>Qx||xi(t,i,gn)));){let a=t.position,l=await r(),c=l.size-24;if(!Number.isFinite(c)||c<0){n=!0;break}if(Hn(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 Nc(t,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),Hn(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(Hn(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>L0){n=!0;break}if(await pr(t,c,{maximumLength:s?L0:t.fileInfo.size,reason:"ASF header payload"}),t.position<=a){n=!0;break}}}catch(r){if(r instanceof Be||r instanceof nr)Lt(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 qt(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})&&C0(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
629
+ `,{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(bi);let n=mE(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?Mr:rt);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?Mr:rt);if(!(n>Xx)&&!(Lt(this.tokenizer)&&2+n*12>M0))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?Mr:rt).get(this.buffer,2),s=(t?bc:nt).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?Mr:rt).get(this.buffer,8),l=(t?Mr:rt).get(this.buffer,10);if(a===28&&l===254||a===31&&l===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Lt(this.tokenizer)&&s>Yx)return n;let i=Lt(this.tokenizer)?M0:this.tokenizer.fileInfo.size;try{await pr(this.tokenizer,s,{maximumLength:i,reason:"TIFF IFD offset"})}catch(a){if(a instanceof Be)return;throw a}let o;try{o=await this.readTiffIFD(t)}catch(a){if(a instanceof Be)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"}}}},LP=new Set(N0),MP=new Set(I0)});var G0={};ee(G0,{fileCommand:()=>IE,flagsForFuzzing:()=>$E});function CE(e,t){let n=SE.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 vE(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 kE(e,t){if(e.startsWith("#!")){let c=e.split(`
630
+ `)[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
631
+ `),s=e.includes("\r")&&!r,i="";r?i=", with CRLF line terminators":s&&(i=", with CR line terminators");let o=vE(t),a=o?AE.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 NE(e,t){if(t.length===0)return{description:"empty",mime:"inode/x-empty"};let n=await H0(t);if(n)return{description:CE(n.ext,n.mime),mime:n.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(t);return kE(r,e)}var EE,AE,SE,IE,$E,V0=v(()=>{"use strict";j0();ie();EE={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"]},AE=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"}]]),SE=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"]]);IE={name:"file",async execute(e,t){if(U(e))return M(EE);let n=!1,r=!1,s=[];for(let a of e)if(a.startsWith("--")){if(a==="--brief")n=!0;else if(a==="--mime"||a==="--mime-type")r=!0;else if(a!=="--dereference")return K("file",a)}else if(a.startsWith("-")&&a!=="-"){for(let l of a.slice(1))if(l==="b")n=!0;else if(l==="i")r=!0;else if(l!=="L")return K("file",`-${l}`)}else s.push(a);if(s.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
632
+ `,exitCode:1};let i="",o=0;for(let a of s)try{let l=t.fs.resolvePath(t.cwd,a);if((await t.fs.stat(l)).isDirectory){let h=r?"inode/directory":"directory";i+=n?`${h}
633
+ `:`${a}: ${h}
634
+ `;continue}let u=await t.fs.readFileBuffer(l),f=await NE(a,u),p=r?f.mime:f.description;i+=n?`${p}
635
+ `:`${a}: ${p}
636
+ `}catch{i+=n?`cannot open
637
+ `:`${a}: cannot open (No such file or directory)
638
+ `,o=1}return{stdout:i,stderr:"",exitCode:o}}},$E={name:"file",flags:[{flag:"-b",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var q0={};ee(q0,{flagsForFuzzing:()=>PE,htmlToMarkdownCommand:()=>RE});import OE from"turndown";var TE,RE,PE,Z0=v(()=>{"use strict";ge();ie();TE={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"]},RE={name:"html-to-markdown",async execute(e,t){if(U(e))return M(TE);let n="-",r="```",s="---",i="atx",o=[];for(let l=0;l<e.length;l++){let c=e[l];if(c==="-b"||c==="--bullet")n=e[++l]??"-";else if(c.startsWith("--bullet="))n=c.slice(9);else if(c==="-c"||c==="--code")r=e[++l]??"```";else if(c.startsWith("--code="))r=c.slice(7);else if(c==="-r"||c==="--hr")s=e[++l]??"---";else if(c.startsWith("--hr="))s=c.slice(5);else if(c.startsWith("--heading-style=")){let u=c.slice(16);(u==="setext"||u==="atx")&&(i=u)}else if(c==="-")o.push("-");else{if(c.startsWith("--"))return K("html-to-markdown",c);if(c.startsWith("-"))return K("html-to-markdown",c);o.push(c)}}let a;if(o.length===0||o.length===1&&o[0]==="-")a=ae(t.stdin);else try{let l=t.fs.resolvePath(t.cwd,o[0]);a=await t.fs.readFile(l)}catch{return{stdout:"",stderr:`html-to-markdown: ${o[0]}: No such file or directory
639
+ `,exitCode:1}}if(!a.trim())return{stdout:"",stderr:"",exitCode:0};try{let l=new OE({bulletListMarker:n,codeBlockStyle:"fenced",fence:r,hr:s,headingStyle:i});return l.remove(["script","style","footer"]),{stdout:`${l.turndown(a).trim()}
640
+ `,stderr:"",exitCode:0}}catch(l){return{stdout:"",stderr:`html-to-markdown: conversion error: ${l.message}
641
+ `,exitCode:1}}}},PE={name:"html-to-markdown",flags:[],stdinType:"text"}});var K0={};ee(K0,{flagsForFuzzing:()=>LE,helpCommand:()=>FE});function _E(e){let t=[],n=new Set(e);t.push(`Available commands:
642
+ `);let r=[];for(let[s,i]of DE){let o=i.filter(a=>n.has(a));if(o.length>0){t.push(` ${s}:`),t.push(` ${o.join(", ")}
643
+ `);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(", ")}
644
+ `)),t.push("Use '<command> --help' for details on a specific command."),`${t.join(`
645
+ `)}
646
+ `}var DE,FE,LE,Q0=v(()=>{"use strict";Rr();DE=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"]]]);FE={name:"help",async execute(e,t){if(e.includes("--help")||e.includes("-h"))return{stdout:`help - display available commands
647
+
648
+ Usage: help [command]
649
+
650
+ Options:
651
+ -h, --help Show this help message
652
+
653
+ If a command name is provided, shows help for that command.
654
+ Otherwise, lists all available commands.
655
+ `,stderr:"",exitCode:0};if(e.length>0&&t.exec){let r=e[0];return t.exec(sn([r]),{cwd:t.cwd,signal:t.signal,args:["--help"]})}let n=t.getRegisteredCommands?.()??[];return{stdout:_E(n),stderr:"",exitCode:0}}},LE={name:"help",flags:[]}});var X0={};ee(X0,{flagsForFuzzing:()=>WE,whichCommand:()=>BE});var ME,UE,BE,WE,Y0=v(()=>{"use strict";at();ie();ME={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"]},UE={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},BE={name:"which",async execute(e,t){if(U(e))return M(ME);let n=Se("which",e,UE);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 p of a){if(!p)continue;let h=t.fs.resolvePath(p,u);if(await t.fs.exists(h)&&(f=!0,s||(l+=`${h}
656
+ `),!r))break}f||(c=!1)}return{stdout:l,stderr:"",exitCode:c?0:1}}},WE={name:"which",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"boolean"}],needsArgs:!0}});var J0={};ee(J0,{flagsForFuzzing:()=>jE,tac:()=>HE});async function zE(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(`
657
+ `);o[o.length-1]===""&&o.pop();let a=o.reverse();return{stdout:a.length>0?`${a.join(`
658
+ `)}
659
+ `:"",stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`tac: ${e[0]}: No such file or directory
660
+ `,exitCode:1}}}let n=t.stdin.split(`
661
+ `);n[n.length-1]===""&&n.pop();let r=n.reverse();return{stdout:r.length>0?`${r.join(`
662
+ `)}
663
+ `:"",stderr:"",exitCode:0}}var HE,jE,e2=v(()=>{"use strict";ge();HE={name:"tac",execute:zE},jE={name:"tac",flags:[],stdinType:"text",needsFiles:!0}});var t2={};ee(t2,{flagsForFuzzing:()=>qE,hostname:()=>VE});async function GE(e,t){return{stdout:`localhost
664
+ `,stderr:"",exitCode:0}}var VE,qE,n2=v(()=>{"use strict";VE={name:"hostname",execute:GE},qE={name:"hostname",flags:[]}});var r2={};ee(r2,{flagsForFuzzing:()=>QE,whoami:()=>KE});async function ZE(e,t){return{stdout:`user
665
+ `,stderr:"",exitCode:0}}var KE,QE,s2=v(()=>{"use strict";KE={name:"whoami",execute:ZE},QE={name:"whoami",flags:[]}});var i2={};ee(i2,{flagsForFuzzing:()=>JE,od:()=>YE});async function XE(e,t){let n="octal",r=[],s=[];for(let h=0;h<e.length;h++){let d=e[h];if(d==="-c")r.push("char");else if(d==="-An"||d==="-A"&&e[h+1]==="n")n="none",d==="-A"&&h++;else if(d==="-t"&&e[h+1]){let m=e[++h];m==="x1"?r.push("hex"):m==="c"?r.push("char"):m.startsWith("o")&&r.push("octal")}else(!d.startsWith("-")||d==="-")&&s.push(d)}r.length===0&&r.push("octal");let i=t.stdin;if(s.length>0&&s[0]!=="-"){let h=s[0].startsWith("/")?s[0]:`${t.cwd}/${s[0]}`;try{i=await _n(t.fs,h)}catch{return{stdout:"",stderr:`od: ${s[0]}: No such file or directory
666
+ `,exitCode:1}}}let o=r.includes("char");function a(h){return h===0?" \\0":h===7?" \\a":h===8?" \\b":h===9?" \\t":h===10?" \\n":h===11?" \\v":h===12?" \\f":h===13?" \\r":h>=32&&h<127?` ${String.fromCharCode(h)}`:` ${h.toString(8).padStart(3,"0")}`}function l(h){return o?` ${h.toString(16).padStart(2,"0")}`:` ${h.toString(16).padStart(2,"0")}`}function c(h){return` ${h.toString(8).padStart(3,"0")}`}let u=[];for(let h of i)u.push(h.charCodeAt(0));let f=16,p=[];for(let h=0;h<u.length;h+=f){let d=u.slice(h,h+f);for(let m=0;m<r.length;m++){let g=r[m],y;g==="char"?y=d.map(a):g==="hex"?y=d.map(l):y=d.map(c);let b="";m===0&&n!=="none"?b=`${h.toString(8).padStart(7,"0")} `:(m>0||n==="none")&&(b=n==="none"?"":" "),p.push(b+y.join(""))}}return n!=="none"&&u.length>0&&p.push(u.length.toString(8).padStart(7,"0")),{stdout:p.length>0?`${p.join(`
667
+ `)}
668
+ `:"",stderr:"",exitCode:0}}var YE,JE,o2=v(()=>{"use strict";ge();YE={name:"od",execute:XE},JE={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 Ho={};ee(Ho,{flagsForFuzzing:()=>cA,gunzipCommand:()=>aA,gunzipFlagsForFuzzing:()=>uA,gzipCommand:()=>oA,zcatCommand:()=>lA,zcatFlagsForFuzzing:()=>fA});import{constants as Oc,gunzipSync as a2,gzipSync as l2}from"node:zlib";function c2(e){return e.best?Oc.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?Oc.Z_BEST_SPEED:Oc.Z_DEFAULT_COMPRESSION}function u2(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 f2(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 zo(e){return e.length>=2&&e[0]===31&&e[1]===139}function Wo(e){return Buffer.from(e).toString("latin1")}function p2(e){return e.limits?.maxOutputSize??0}function Tc(e,t){if(t>0){if(f2(e)>t)throw new Error(`decompressed data exceeds limit (${t} bytes)`);return a2(e,{maxOutputLength:t})}return a2(e)}async function h2(e,t,n,r,s,i){let o=n.suffix,a,l,c,u=p2(e);if(t==="-"||t==="")if(c=Uint8Array.from(e.stdin,f=>f.charCodeAt(0)),s){if(!zo(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
669
+ `,exitCode:1};try{let f=Tc(c,u);return{stdout:Wo(f),stderr:"",exitCode:0}}catch(f){let p=f instanceof Error?f.message:"unknown error";return{stdout:"",stderr:`${r}: stdin: ${p}
670
+ `,exitCode:1}}}else{let f=c2(n),p=l2(c,{level:f});return{stdout:Wo(p),stderr:"",exitCode:0}}a=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(a)).isDirectory)return n.recursive?await d2(e,a,n,r,s,i):n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: is a directory -- ignored
671
+ `,exitCode:1}}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
672
+ `,exitCode:1}}try{c=await e.fs.readFileBuffer(a)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
673
+ `,exitCode:1}}if(s){if(!t.endsWith(o))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: unknown suffix -- ignored
674
+ `,exitCode:1};if(!zo(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
675
+ `,exitCode:1};let f;try{f=Tc(c,u)}catch(p){let h=p instanceof Error?p.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${h}
676
+ `,exitCode:1}}if(i)return{stdout:Wo(f),stderr:"",exitCode:0};if(n.name){let p=u2(c);p.originalName?l=e.fs.resolvePath(e.cwd,p.originalName):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
677
+ `,exitCode:1}}catch{}if(await e.fs.writeFile(l,f),!n.keep&&!i&&await e.fs.rm(a),n.verbose){let p=c.length>0?((1-c.length/f.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${p}% -- replaced with ${l.split("/").pop()}
678
+ `,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
679
+ `,exitCode:1};let f=c2(n),p;try{p=l2(c,{level:f})}catch(h){let d=h instanceof Error?h.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${d}
680
+ `,exitCode:1}}if(i)return{stdout:Wo(p),stderr:"",exitCode:0};if(l=a+o,!n.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${r}: ${l} already exists; not overwritten
681
+ `,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-p.length/c.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${h}% -- replaced with ${l.split("/").pop()}
682
+ `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function d2(e,t,n,r,s,i){let o=await e.fs.readdir(t),a="",l="",c=0;for(let u of o){let f=e.fs.resolvePath(t,u),p=await e.fs.stat(f);if(p.isDirectory){let h=await d2(e,f,n,r,s,i);a+=h.stdout,l+=h.stderr,h.exitCode!==0&&(c=h.exitCode)}else if(p.isFile){let h=n.suffix;if(s&&!u.endsWith(h)||!s&&u.endsWith(h))continue;let d=f.startsWith(`${e.cwd}/`)?f.slice(e.cwd.length+1):f,m=await h2(e,d,n,r,s,i);a+=m.stdout,l+=m.stderr,m.exitCode!==0&&(c=m.exitCode)}}return{stdout:a,stderr:l,exitCode:c}}async function sA(e,t,n,r){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,f=>f.charCodeAt(0));else{let f=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
683
+ `,exitCode:1}}}if(!zo(s))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
684
+ `,exitCode:1};let i=s.length,o=f2(s),a=o>0?((1-i/o)*100).toFixed(1):"0.0",c=u2(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${i.toString().padStart(10)} ${o.toString().padStart(10)} ${a.padStart(5)}% ${c}
685
+ `,stderr:"",exitCode:0}}async function iA(e,t,n,r){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,i=>i.charCodeAt(0));else{let i=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(i)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
686
+ `,exitCode:1}}}if(!zo(s))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
687
+ `,exitCode:1};try{return Tc(s,p2(e)),n.verbose?{stdout:"",stderr:`${t}: OK
688
+ `,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(i){let o=i instanceof Error?i.message:"invalid";return{stdout:"",stderr:`${r}: ${t}: ${o}
689
+ `,exitCode:1}}}async function Rc(e,t,n){let r=n==="zcat"?nA:n==="gunzip"?tA:eA;if(U(e))return M(r);let s=Se(n,e,rA);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 p=` compressed uncompressed ratio uncompressed_name
690
+ `,h="",d=0;for(let m of o){let g=await sA(t,m,i,n);p+=g.stdout,h+=g.stderr,g.exitCode!==0&&(d=g.exitCode)}return{stdout:p,stderr:h,exitCode:d}}if(i.test){o.length===0&&(o=["-"]);let p="",h="",d=0;for(let m of o){let g=await iA(t,m,i,n);p+=g.stdout,h+=g.stderr,g.exitCode!==0&&(d=g.exitCode)}return{stdout:p,stderr:h,exitCode:d}}o.length===0&&(o=["-"]);let c="",u="",f=0;for(let p of o){let h=await h2(t,p,i,n,a,l);c+=h.stdout,u+=h.stderr,h.exitCode!==0&&(f=h.exitCode)}return{stdout:c,stderr:u,exitCode:f}}var eA,tA,nA,rA,oA,aA,lA,cA,uA,fA,jo=v(()=>{"use strict";ge();at();ie();eA={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
691
+
692
+ When no FILE is given, or when FILE is -, read from standard input.
693
+
694
+ 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"]},tA={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place).
695
+
696
+ 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"]},nA={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output.
697
+
698
+ 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"]},rA={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"}};oA={name:"gzip",async execute(e,t){return{...await Rc(e,t,"gzip"),stdoutEncoding:"binary"}}},aA={name:"gunzip",async execute(e,t){return{...await Rc(e,t,"gunzip"),stdoutEncoding:"binary"}}},lA={name:"zcat",async execute(e,t){return{...await Rc(e,t,"zcat"),stdoutEncoding:"binary"}}},cA={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},uA={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},fA={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0}});function Pc(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 pA.encode(e)}function Ei(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 hA.decode(e)}function Go(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var pA,hA,Dc=v(()=>{"use strict";pA=new TextEncoder,hA=new TextDecoder});function m2(e){let t=e.indexOf("=");if(t>=0){let n=e.slice(0,t),r=e.slice(t+1);return n?`${encodeURIComponent(n)}=${encodeURIComponent(r)}`:encodeURIComponent(r)}return encodeURIComponent(e)}function _c(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 g2(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
699
+ `;s.filename?(o+=`Content-Disposition: form-data; name="${s.name}"; filename="${s.filename}"\r
700
+ `,s.contentType&&(o+=`Content-Type: ${s.contentType}\r
701
+ `)):o+=`Content-Disposition: form-data; name="${s.name}"\r
702
+ `,o+=`\r
703
+ ${i}\r
704
+ `,r.push(o)}return r.push(`--${n}--\r
705
+ `),{body:r.join(""),boundary:n}}var Fc=v(()=>{"use strict"});var y2,w2=v(()=>{"use strict";y2={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)"," --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","-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 Gr(e,t,n){n.allowFile&&t.startsWith("@")?(e.dataFile={mode:n.binary?"binary":"ascii",path:t.slice(1)},e.data=void 0):(e.data=t,e.dataFile=void 0),n.binary&&(e.dataBinary=!0)}function b2(e,t){if(t.startsWith("@")){e.urlencodeFiles.push({path:t.slice(1)});return}let n=t.indexOf("@"),r=t.indexOf("=");if(n>0&&(r<0||n<r)){e.urlencodeFiles.push({name:t.slice(0,n),path:t.slice(n+1)});return}e.data=(e.data?`${e.data}&`:"")+m2(t)}function x2(e){let t={method:"GET",headers:new Io,dataBinary:!1,urlencodeFiles:[],formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1},n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(s==="-X"||s==="--request")t.method=e[++r]??"GET";else if(s.startsWith("-X"))t.method=s.slice(2);else if(s.startsWith("--request="))t.method=s.slice(10);else if(s==="-H"||s==="--header"){let i=e[++r];if(i){let o=i.indexOf(":");if(o>0){let a=i.slice(0,o).trim(),l=i.slice(o+1).trim();t.headers.append(a,l)}}}else if(s.startsWith("--header=")){let i=s.slice(9),o=i.indexOf(":");if(o>0){let a=i.slice(0,o).trim(),l=i.slice(o+1).trim();t.headers.append(a,l)}}else if(s==="-d"||s==="--data")Gr(t,e[++r]??"",{binary:!1,allowFile:!0}),n=!0;else if(s==="--data-raw")Gr(t,e[++r]??"",{binary:!1,allowFile:!1}),n=!0;else if(s.startsWith("-d"))Gr(t,s.slice(2),{binary:!1,allowFile:!0}),n=!0;else if(s.startsWith("--data="))Gr(t,s.slice(7),{binary:!1,allowFile:!0}),n=!0;else if(s.startsWith("--data-raw="))Gr(t,s.slice(11),{binary:!1,allowFile:!1}),n=!0;else if(s==="--data-binary")Gr(t,e[++r]??"",{binary:!0,allowFile:!0}),n=!0;else if(s.startsWith("--data-binary="))Gr(t,s.slice(14),{binary:!0,allowFile:!0}),n=!0;else if(s==="--data-urlencode")b2(t,e[++r]??""),n=!0;else if(s.startsWith("--data-urlencode="))b2(t,s.slice(17)),n=!0;else if(s==="-F"||s==="--form"){let i=e[++r]??"",o=_c(i);o&&t.formFields.push(o),n=!0}else if(s.startsWith("--form=")){let i=s.slice(7),o=_c(i);o&&t.formFields.push(o),n=!0}else if(s==="-u"||s==="--user")t.user=e[++r];else if(s.startsWith("-u"))t.user=s.slice(2);else if(s.startsWith("--user="))t.user=s.slice(7);else if(s==="-A"||s==="--user-agent")t.headers.set("User-Agent",e[++r]??"");else if(s.startsWith("-A"))t.headers.set("User-Agent",s.slice(2));else if(s.startsWith("--user-agent="))t.headers.set("User-Agent",s.slice(13));else if(s==="-e"||s==="--referer")t.headers.set("Referer",e[++r]??"");else if(s.startsWith("-e"))t.headers.set("Referer",s.slice(2));else if(s.startsWith("--referer="))t.headers.set("Referer",s.slice(10));else if(s==="-b"||s==="--cookie")t.headers.set("Cookie",e[++r]??"");else if(s.startsWith("-b"))t.headers.set("Cookie",s.slice(2));else if(s.startsWith("--cookie="))t.headers.set("Cookie",s.slice(9));else if(s==="-c"||s==="--cookie-jar")t.cookieJar=e[++r];else if(s.startsWith("--cookie-jar="))t.cookieJar=s.slice(13);else if(s==="-T"||s==="--upload-file")t.uploadFile=e[++r],t.method==="GET"&&(t.method="PUT");else if(s.startsWith("--upload-file="))t.uploadFile=s.slice(14),t.method==="GET"&&(t.method="PUT");else if(s==="-m"||s==="--max-time"){let i=parseFloat(e[++r]??"0");!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(s.startsWith("--max-time=")){let i=parseFloat(s.slice(11));!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(s==="--connect-timeout"){let i=parseFloat(e[++r]??"0");!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(s.startsWith("--connect-timeout=")){let i=parseFloat(s.slice(18));!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(s==="-o"||s==="--output")t.outputFile=e[++r];else if(s.startsWith("--output="))t.outputFile=s.slice(9);else if(s==="-O"||s==="--remote-name")t.useRemoteName=!0;else if(s==="-I"||s==="--head")t.headOnly=!0,t.method="HEAD";else if(s==="-i"||s==="--include")t.includeHeaders=!0;else if(s==="-s"||s==="--silent")t.silent=!0;else if(s==="-S"||s==="--show-error")t.showError=!0;else if(s==="-f"||s==="--fail")t.failSilently=!0;else if(s==="-L"||s==="--location")t.followRedirects=!0;else if(s==="--max-redirs")r++;else if(!s.startsWith("--max-redirs="))if(s==="-w"||s==="--write-out")t.writeOut=e[++r];else if(s.startsWith("--write-out="))t.writeOut=s.slice(12);else if(s==="-v"||s==="--verbose")t.verbose=!0;else{if(s.startsWith("--")&&s!=="--")return K("curl",s);if(s.startsWith("-")&&s!=="-")for(let i of s.slice(1))switch(i){case"s":t.silent=!0;break;case"S":t.showError=!0;break;case"f":t.failSilently=!0;break;case"L":t.followRedirects=!0;break;case"I":t.headOnly=!0,t.method="HEAD";break;case"i":t.includeHeaders=!0;break;case"O":t.useRemoteName=!0;break;case"v":t.verbose=!0;break;default:return K("curl",`-${i}`)}else s.startsWith("-")||(t.url=s)}}return n&&t.method==="GET"&&(t.method="POST"),t}var E2=v(()=>{"use strict";hi();ie();Fc()});function Lc(e){return Object.entries(e).map(([t,n])=>`${t}: ${n}`).join(`\r
706
+ `)}function A2(e){try{return new URL(e).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function Mc(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,`
707
+ `),n}var S2=v(()=>{"use strict"});var C2={};ee(C2,{curlCommand:()=>EA});async function dA(e,t){if(e.dataFile){let n=t.fs.resolvePath(t.cwd,e.dataFile.path),r=await t.fs.readFile(n);return e.dataFile.mode==="ascii"&&(r=r.replace(/[\r\n]/g,"")),e.data?`${r}&${e.data}`:r}return e.data}async function mA(e,t,n){if(e.urlencodeFiles.length===0)return n;let r=n?[n]:[];for(let s of e.urlencodeFiles){let i=t.fs.resolvePath(t.cwd,s.path),o=await t.fs.readFile(i),a=encodeURIComponent(o);r.push(s.name?`${encodeURIComponent(s.name)}=${a}`:a)}return r.join("&")}async function gA(e,t){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}=g2(e.formFields,r);return{body:s,contentType:`multipart/form-data; boundary=${i}`}}let n=await dA(e,t);return n=await mA(e,t,n),n!==void 0?{body:n}:{}}function yA(e,t){let n=new Io(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 wA(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 bA(e){return Ei(e,"binary")}function xA(e,t,n){let r="";if(e.verbose){r+=`> ${e.method} ${n}
708
+ `;for(let[s,i]of e.headers)r+=`> ${s}: ${i}
709
+ `;r+=`>
710
+ `,r+=`< HTTP/1.1 ${t.status} ${t.statusText}
711
+ `;for(let[s,i]of Object.entries(t.headers))r+=`< ${s}: ${i}
712
+ `;r+=`<
713
+ `}return e.includeHeaders&&!e.verbose&&(r+=`HTTP/1.1 ${t.status} ${t.statusText}\r
714
+ `,r+=Lc(t.headers),r+=`\r
715
+ \r
716
+ `),e.headOnly?e.includeHeaders||e.verbose||(r+=`HTTP/1.1 ${t.status} ${t.statusText}\r
717
+ `,r+=Lc(t.headers),r+=`\r
718
+ `):r+=bA(t.body),e.writeOut&&(r+=Mc(e.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.byteLength})),r}var EA,v2=v(()=>{"use strict";Dc();rn();hi();ie();Fc();w2();E2();S2();EA={name:"curl",async execute(e,t){if(U(e))return M(y2);let n=x2(e);if("exitCode"in n)return n;let r=n;if(!r.url)return{stdout:"",stderr:`curl: no URL specified
719
+ `,exitCode:2};if(!t.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available
720
+ `,exitCode:1};let s=r.url;s.match(/^https?:\/\//)||(s=`https://${s}`);try{let{body:i,contentType:o}=await gA(r,t),a=yA(r,o),l=await t.fetch(s,{method:r.method,headers:a,body:i,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs});if(await wA(r,l.headers,t),r.failSilently&&l.status>=400)return{stdout:"",stderr:r.showError||!r.silent?`curl: (22) The requested URL returned error: ${l.status}
721
+ `:"",exitCode:22};let c=xA(r,l,s);if(r.outputFile||r.useRemoteName){let u=r.outputFile||A2(s),f=t.fs.resolvePath(t.cwd,u);await t.fs.writeFile(f,r.headOnly?"":l.body),r.verbose||(c=""),r.writeOut&&(c=Mc(r.writeOut,{status:l.status,headers:l.headers,url:l.url,bodyLength:l.body.byteLength}))}return{stdout:c,stderr:"",exitCode:0}}catch(i){let o=Xe(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}
722
+ `:"",exitCode:a}}}}});function Bc(e){let{pid:t,ppid:n,uid:r,gid:s}=e;return`Name: bash
723
+ State: R (running)
724
+ Pid: ${t}
725
+ PPid: ${n}
726
+ Uid: ${r} ${r} ${r} ${r}
727
+ Gid: ${s} ${s} ${s} ${s}
728
+ `}var F2,L2,Wc=v(()=>{"use strict";F2="5.1.0(1)-release",L2="Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT"});function B2(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 W2(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}function UA(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function z2(e){return e===" "||e===" "||e===`
729
+ `||e===";"||e==="&"||e==="|"||e==="("||e===")"||e==="<"||e===">"}var E,mr,U2,FA,LA,MA,Qo,gr=v(()=>{"use strict";(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"})(E||(E={}));mr=class extends Error{line;column;constructor(t,n,r){super(`line ${n}: ${t}`),this.line=n,this.column=r,this.name="LexerError"}},U2=new Map([["if",E.IF],["then",E.THEN],["else",E.ELSE],["elif",E.ELIF],["fi",E.FI],["for",E.FOR],["while",E.WHILE],["until",E.UNTIL],["do",E.DO],["done",E.DONE],["case",E.CASE],["esac",E.ESAC],["in",E.IN],["function",E.FUNCTION],["select",E.SELECT],["time",E.TIME],["coproc",E.COPROC]]);FA=[[";",";","&",E.SEMI_SEMI_AND],["<","<","<",E.TLESS],["&",">",">",E.AND_DGREAT]],LA=[["[","[",E.DBRACK_START],["]","]",E.DBRACK_END],["(","(",E.DPAREN_START],[")",")",E.DPAREN_END],["&","&",E.AND_AND],["|","|",E.OR_OR],[";",";",E.DSEMI],[";","&",E.SEMI_AND],["|","&",E.PIPE_AMP],[">",">",E.DGREAT],["<","&",E.LESSAND],[">","&",E.GREATAND],["<",">",E.LESSGREAT],[">","|",E.CLOBBER],["&",">",E.AND_GREAT]],MA=new Map([["|",E.PIPE],["&",E.AMP],[";",E.SEMICOLON],["(",E.LPAREN],[")",E.RPAREN],["<",E.LESS],[">",E.GREAT]]);Qo=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];dparenDepth=0;maxHeredocSize;constructor(t,n){this.input=t,this.maxHeredocSize=n?.maxHeredocSize??10485760}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===E.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=n)break;let i=this.nextToken();i&&r.push(i)}return r.push({type:E.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]===`
730
+ `)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];if(i==="#"&&this.dparenDepth===0)return this.readComment(n,r,s);if(i===`
731
+ `)return this.pos=n+1,this.line++,this.column=1,{type:E.NEWLINE,value:`
732
+ `,start:n,end:n+1,line:r,column:s};if(i==="<"&&o==="<"&&a==="-")return this.pos=n+3,this.column=s+3,this.registerHeredocFromLookahead(!0),this.makeToken(E.DLESSDASH,"<<-",n,r,s);for(let[c,u,f,p]of FA)if(i===c&&o===u&&a===f)return this.pos=n+3,this.column=s+3,this.makeToken(p,c+u+f,n,r,s);if(i==="<"&&o==="<")return this.pos=n+2,this.column=s+2,this.registerHeredocFromLookahead(!1),this.makeToken(E.DLESS,"<<",n,r,s);if(i==="("&&o==="(")return this.dparenDepth>0?(this.pos=n+1,this.column=s+1,this.dparenDepth++,this.makeToken(E.LPAREN,"(",n,r,s)):this.looksLikeNestedSubshells(n+2)||this.dparenClosesWithSpacedParens(n+2)?(this.pos=n+1,this.column=s+1,this.makeToken(E.LPAREN,"(",n,r,s)):(this.pos=n+2,this.column=s+2,this.dparenDepth=1,this.makeToken(E.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(E.DPAREN_END,"))",n,r,s)):this.dparenDepth>1?(this.pos=n+1,this.column=s+1,this.dparenDepth--,this.makeToken(E.RPAREN,")",n,r,s)):(this.pos=n+1,this.column=s+1,this.makeToken(E.RPAREN,")",n,r,s));for(let[c,u,f]of LA)if(!(c==="("&&u==="("||c===")"&&u===")")&&!(this.dparenDepth>0&&c===";"&&(f===E.DSEMI||f===E.SEMI_AND||f===E.SEMI_SEMI_AND))&&i===c&&o===u){if(f===E.DBRACK_START||f===E.DBRACK_END){let p=t[n+2];if(p!==void 0&&p!==" "&&p!==" "&&p!==`
733
+ `&&p!==";"&&p!=="&"&&p!=="|"&&p!=="("&&p!==")"&&p!=="<"&&p!==">")break}return this.pos=n+2,this.column=s+2,this.makeToken(f,c+u,n,r,s)}if(i==="("&&this.dparenDepth>0)return this.pos=n+1,this.column=s+1,this.dparenDepth++,this.makeToken(E.LPAREN,"(",n,r,s);if(i===")"&&this.dparenDepth>1)return this.pos=n+1,this.column=s+1,this.dparenDepth--,this.makeToken(E.RPAREN,")",n,r,s);let l=MA.get(i);if(l!==void 0)return this.pos=n+1,this.column=s+1,this.makeToken(l,i,n,r,s);if(i==="{"){let c=this.scanFdVariable(n);return c!==null?(this.pos=c.end,this.column=s+(c.end-n),{type:E.FD_VARIABLE,value:c.varname,start:n,end:c.end,line:r,column:s}):o==="}"?(this.pos=n+2,this.column=s+2,{type:E.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!==`
734
+ `?this.readWord(n,r,s):(this.pos=n+1,this.column=s+1,this.makeToken(E.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(E.RBRACE,"}",n,r,s)):i==="!"?o==="="?(this.pos=n+2,this.column=s+2,this.makeToken(E.WORD,"!=",n,r,s)):(this.pos=n+1,this.column=s+1,this.makeToken(E.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===`
735
+ `||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]!==`
736
+ `;){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]!==`
737
+ `;)o++;let a=s.slice(t,o);return this.pos=o,this.column=r+(o-t),{type:E.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 w=s[o];if(w===" "||w===" "||w===`
738
+ `||w===";"||w==="&"||w==="|"||w==="("||w===")"||w==="<"||w===">"||w==="'"||w==='"'||w==="\\"||w==="$"||w==="`"||w==="{"||w==="}"||w==="~"||w==="*"||w==="?"||w==="[")break;o++}if(o>a){let w=s[o];if(!(w==="("&&o>a&&"@*+?!".includes(s[o-1]))){if(o>=i||w===" "||w===" "||w===`
739
+ `||w===";"||w==="&"||w==="|"||w==="("||w===")"||w==="<"||w===">"){let x=s.slice(a,o);this.pos=o,this.column=r+(o-a);let A=U2.get(x);if(A!==void 0)return{type:A,value:x,start:t,end:o,line:n,column:r};let I=W2(x);return I>0&&B2(x.slice(0,I))?{type:E.ASSIGNMENT_WORD,value:x,start:t,end:o,line:n,column:r}:/^[0-9]+$/.test(x)?{type:E.NUMBER,value:x,start:t,end:o,line:n,column:r}:/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(x)?{type:E.NAME,value:x,start:t,end:o,line:n,column:r,quoted:!1,singleQuoted:!1}:{type:E.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,p=!1,h=!1,d=!1,m=s[o]==='"'||s[o]==="'",g=!1,y=0;for(;o<i;){let w=s[o];if(!h&&!d){if(w==="("&&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(w==="["&&y===0){if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){let x=o+1<i?s[o+1]:"";if(x==="^"||x==="!"){u+=w,o++,l++;continue}y=1,u+=w,o++,l++;continue}}else if(w==="["&&y>0){u.length>0&&u[u.length-1]!=="\\"&&y++,u+=w,o++,l++;continue}else if(w==="]"&&y>0){u.length>0&&u[u.length-1]!=="\\"&&y--,u+=w,o++,l++;continue}if(y>0){if(w===`
740
+ `)break;u+=w,o++,l++;continue}if(w===" "||w===" "||w===`
741
+ `||w===";"||w==="&"||w==="|"||w==="("||w===")"||w==="<"||w===">")break}if(w==="$"&&o+1<i&&s[o+1]==="'"&&!h&&!d){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(w==="$"&&o+1<i&&s[o+1]==='"'&&!h&&!d){o++,l++,d=!0,f=!0,u===""&&(m=!0),o++,l++;continue}if(w==="'"&&!d){if(h)if(h=!1,!m||g)u+=w;else{let x=o+1<i?s[o+1]:"";x&&!z2(x)&&x!=="'"&&(x==='"'?(g=!0,u+=w,p=!1,f=!1):(g=!0,u+=w))}else h=!0,m&&!g?(p=!0,f=!0):u+=w;o++,l++;continue}if(w==='"'&&!h){if(d)if(d=!1,!m||g)u+=w;else{let x=o+1<i?s[o+1]:"";x&&!z2(x)&&x!=='"'&&(x==="'"?(g=!0,u+=w,p=!1,f=!1):(g=!0,u+=w))}else d=!0,m&&!g?f=!0:u+=w;o++,l++;continue}if(w==="\\"&&!h&&o+1<i){let x=s[o+1];if(x===`
742
+ `){o+=2,c++,l=1;continue}if(d){if(x==='"'||x==="\\"||x==="$"||x==="`"||x===`
743
+ `){if(x===`
744
+ `){o+=2,l=1,c++;continue}u+=w+x,o+=2,l+=2;continue}}else{x==="\\"||x==='"'||x==="'"||x==="`"||x==="*"||x==="?"||x==="["||x==="]"||x==="("||x===")"||x==="$"||x==="-"||x==="."||x==="^"||x==="+"||x==="{"||x==="}"?u+=w+x:u+=x,o+=2,l+=2;continue}}if(w==="$"&&o+1<i&&s[o+1]==="("&&!h){u+=w,o++,l++,u+=s[o],o++,l++;let x=1,A=!1,I=!1,$=0,D=!1,R="",L=s[o]==="("&&!this.dollarDparenIsSubshell(o);for(;x>0&&o<i;){let C=s[o];if(u+=C,A)C==="'"&&(A=!1);else if(I)C==="\\"&&o+1<i?(u+=s[o+1],o++,l++):C==='"'&&(I=!1);else if(C==="'")A=!0,R="";else if(C==='"')I=!0,R="";else if(C==="\\"&&o+1<i)u+=s[o+1],o++,l++,R="";else if(C==="$"&&o+1<i&&s[o+1]==="{"){o++,l++,u+=s[o],o++,l++;let O=1,T=!1,N=!1;for(;O>0&&o<i;){let F=s[o];if(F==="\\"&&o+1<i&&!T){u+=F,o++,l++,u+=s[o],o++,l++;continue}u+=F,T?F==="'"&&(T=!1):N?F==='"'&&(N=!1):F==="'"?T=!0:F==='"'?N=!0:F==="{"?O++:F==="}"&&O--,F===`
745
+ `?(c++,l=0):l++,o++}R="";continue}else if(C==="#"&&!L&&(R===""||/\s/.test(s[o-1]||""))){for(;o+1<i&&s[o+1]!==`
746
+ `;)o++,l++,u+=s[o];R=""}else/[a-zA-Z_]/.test(C)?R+=C:(R==="case"?($++,D=!1):R==="in"&&$>0?D=!0:R==="esac"&&$>0&&($--,D=!1),R="",C==="("?o>0&&s[o-1]==="$"?x++:D||x++:C===")"?D?D=!1:x--:C===";"&&$>0&&(o+1<i&&s[o+1]===";"||o+1<i&&s[o+1]==="&")&&(D=!0));C===`
747
+ `&&(c++,l=0,R=""),o++,l++}continue}if(w==="$"&&o+1<i&&s[o+1]==="["&&!h){u+=w,o++,l++,u+=s[o],o++,l++;let x=1;for(;x>0&&o<i;){let A=s[o];u+=A,A==="["?x++:A==="]"?x--:A===`
748
+ `&&(c++,l=0),o++,l++}continue}if(w==="$"&&o+1<i&&s[o+1]==="{"&&!h){u+=w,o++,l++,u+=s[o],o++,l++;let x=1,A=!1,I=!1,$=c,D=l,R=c,L=l;for(;x>0&&o<i;){let C=s[o];if(C==="\\"&&o+1<i&&s[o+1]===`
749
+ `){o+=2,c++,l=1;continue}if(C==="\\"&&o+1<i&&!A){u+=C,o++,l++,u+=s[o],o++,l++;continue}u+=C,A?C==="'"&&(A=!1):I?C==='"'&&(I=!1):C==="'"?(A=!0,$=c,D=l):C==='"'?(I=!0,R=c,L=l):C==="{"?x++:C==="}"&&x--,C===`
750
+ `&&(c++,l=0),o++,l++}if(A)throw new mr("unexpected EOF while looking for matching `''",$,D);if(I)throw new mr("unexpected EOF while looking for matching `\"'",R,L);continue}if(w==="$"&&o+1<i&&!h){let x=s[o+1];if(x==="#"||x==="?"||x==="$"||x==="!"||x==="@"||x==="*"||x==="-"||x>="0"&&x<="9"){u+=w+x,o+=2,l+=2;continue}}if(w==="`"&&!h){for(u+=w,o++,l++;o<i&&s[o]!=="`";){let x=s[o];u+=x,x==="\\"&&o+1<i&&(u+=s[o+1],o++,l++),x===`
751
+ `&&(c++,l=0),o++,l++}o<i&&(u+=s[o],o++,l++);continue}u+=w,o++,w===`
752
+ `?(c++,l=1):l++}if(this.pos=o,this.column=l,this.line=c,g&&m&&(u=s[t]+u,f=!1,p=!1),h||d){let w=h?"'":'"';throw new mr(`unexpected EOF while looking for matching \`${w}'`,n,r)}if(!m&&u.length>=2){if(u[0]==="'"&&u[u.length-1]==="'"){let w=u.slice(1,-1);!w.includes("'")&&!w.includes('"')&&(u=w,f=!0,p=!0)}else if(u[0]==='"'&&u[u.length-1]==='"'){let w=u.slice(1,-1),x=!1;for(let A=0;A<w.length;A++){if(w[A]==='"'){x=!0;break}w[A]==="\\"&&A+1<w.length&&A++}x||(u=w,f=!0,p=!1)}}if(u==="")return{type:E.WORD,value:"",start:t,end:o,line:n,column:r,quoted:f,singleQuoted:p};let b=U2.get(u);if(!f&&b!==void 0)return{type:b,value:u,start:t,end:o,line:n,column:r};if(!m){let w=W2(u);if(w>0&&B2(u.slice(0,w)))return{type:E.ASSIGNMENT_WORD,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:p}}return/^[0-9]+$/.test(u)?{type:E.NUMBER,value:u,start:t,end:o,line:n,column:r}:UA(u)?{type:E.NAME,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:p}:{type:E.WORD,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:p}}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="";for(;this.pos<this.input.length;){let o="";for(;this.pos<this.input.length&&this.input[this.pos]!==`
753
+ `;)o+=this.input[this.pos],this.pos++,this.column++;if((t.stripTabs?o.replace(/^\t+/,""):o)===t.delimiter){this.pos<this.input.length&&this.input[this.pos]===`
754
+ `&&(this.pos++,this.line++,this.column=1);break}if(i+=o,i.length>this.maxHeredocSize)throw new mr(`Heredoc size limit exceeded (${this.maxHeredocSize} bytes)`,r,s);this.pos<this.input.length&&this.input[this.pos]===`
755
+ `&&(i+=`
756
+ `,this.pos++,this.line++,this.column=1)}this.tokens.push({type:E.HEREDOC_CONTENT,value:i,start:n,end:this.pos,line:r,column:s})}}addPendingHeredoc(t,n,r){this.pendingHeredocs.push({delimiter:t,stripTabs:n,quoted:r})}registerHeredocFromLookahead(t){let n=this.pos,r=this.column;for(;this.pos<this.input.length&&(this.input[this.pos]===" "||this.input[this.pos]===" ");)this.pos++,this.column++;let s="",i=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(/[\s;<>&|()]/.test(o))break;if(o==="'"||o==='"'){i=!0;let a=o;for(this.pos++,this.column++;this.pos<this.input.length&&this.input[this.pos]!==a;)s+=this.input[this.pos],this.pos++,this.column++;this.pos<this.input.length&&this.input[this.pos]===a&&(this.pos++,this.column++)}else o==="\\"?(i=!0,this.pos++,this.column++,this.pos<this.input.length&&(s+=this.input[this.pos],this.pos++,this.column++)):(s+=o,this.pos++,this.column++)}this.pos=n,this.column=r,s&&this.pendingHeredocs.push({delimiter:s,stripTabs:t,quoted:i})}isWordCharFollowing(t){if(t>=this.input.length)return!1;let n=this.input[t];return!(n===" "||n===" "||n===`
757
+ `||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===`
758
+ `||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:E.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===`
759
+ `||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===`
760
+ `||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===`
761
+ `)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===`
762
+ `&&(l=!0),s++;continue}if(a){if(c==="\\"){s+=2;continue}c==='"'&&(a=!1),c===`
763
+ `&&(l=!0),s++;continue}if(c==="'"){o=!0,s++;continue}if(c==='"'){a=!0,s++;continue}if(c==="\\"){s+=2;continue}if(c===`
764
+ `&&(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,p=!1;for(;f<r&&(n[f]===" "||n[f]===" "||n[f]===`
765
+ `);)p=!0,f++;if(p&&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]===`
766
+ `);)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 Gc,Vc,H2,qc,j2,G2,V2,At,Vr=v(()=>{"use strict";gr();Gc=1e6,Vc=1e5,H2=1e6,qc=200,j2=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS,E.AND_GREAT,E.AND_DGREAT]),G2=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS]),V2=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS,E.AND_GREAT,E.AND_DGREAT]),At=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"}}});var J,qr=v(()=>{"use strict";J={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}},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){return{type:"HereDoc",delimiter:e,content:t,stripTabs:n,quoted:r}},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 Je(e,t){for(;t<e.length;){if(e[t]==="\\"&&e[t+1]===`
767
+ `){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}function Ai(e){if(e.includes("#")){let[n,r]=e.split("#"),s=Number.parseInt(n,10);if(s<2||s>64)return Number.NaN;if(s<=36){let o=Number.parseInt(r,s);return o>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:o}let i=0;for(let o of r){let a;if(/[0-9]/.test(o))a=o.charCodeAt(0)-48;else if(/[a-z]/.test(o))a=o.charCodeAt(0)-97+10;else if(/[A-Z]/.test(o))a=o.charCodeAt(0)-65+36;else if(o==="@")a=62;else if(o==="_")a=63;else return Number.NaN;if(a>=s)return Number.NaN;if(i=i*s+a,i>Number.MAX_SAFE_INTEGER)return Number.MAX_SAFE_INTEGER}return i}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 q2(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 Z2(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+=`
768
+ `;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 K2(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}}var Xo,Q2=v(()=>{"use strict";Xo=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="]});function BA(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 Ne(e,t){let n=BA(t),{expr:r,pos:s}=on(e,n,0),i=Je(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 Kt(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function Qt(e,t){return Je(e,t)>=e.length}function on(e,t,n){return WA(e,t,n)}function WA(e,t,n){let{expr:r,pos:s}=Si(e,t,n);for(s=Je(t,s);t[s]===",";){if(s++,Qt(t,s))return Kt(",",s);let{expr:o,pos:a}=Si(e,t,s);r={type:"ArithBinary",operator:",",left:r,right:o},s=Je(t,a)}return{expr:r,pos:s}}function Si(e,t,n){let{expr:r,pos:s}=zA(e,t,n);if(s=Je(t,s),t[s]==="?"){s++;let{expr:i,pos:o}=on(e,t,s);if(s=Je(t,o),t[s]===":"){s++;let{expr:a,pos:l}=on(e,t,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:a},pos:l}}}return{expr:r,pos:s}}function zA(e,t,n){let{expr:r,pos:s}=X2(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="||";){if(s+=2,Qt(t,s))return Kt("||",s);let{expr:o,pos:a}=X2(e,t,s);r={type:"ArithBinary",operator:"||",left:r,right:o},s=a}return{expr:r,pos:s}}function X2(e,t,n){let{expr:r,pos:s}=Y2(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="&&";){if(s+=2,Qt(t,s))return Kt("&&",s);let{expr:o,pos:a}=Y2(e,t,s);r={type:"ArithBinary",operator:"&&",left:r,right:o},s=a}return{expr:r,pos:s}}function Y2(e,t,n){let{expr:r,pos:s}=J2(e,t,n);for(;s=Je(t,s),t[s]==="|"&&t[s+1]!=="|";){if(s++,Qt(t,s))return Kt("|",s);let{expr:o,pos:a}=J2(e,t,s);r={type:"ArithBinary",operator:"|",left:r,right:o},s=a}return{expr:r,pos:s}}function J2(e,t,n){let{expr:r,pos:s}=eg(e,t,n);for(;s=Je(t,s),t[s]==="^";){if(s++,Qt(t,s))return Kt("^",s);let{expr:o,pos:a}=eg(e,t,s);r={type:"ArithBinary",operator:"^",left:r,right:o},s=a}return{expr:r,pos:s}}function eg(e,t,n){let{expr:r,pos:s}=tg(e,t,n);for(;s=Je(t,s),t[s]==="&"&&t[s+1]!=="&";){if(s++,Qt(t,s))return Kt("&",s);let{expr:o,pos:a}=tg(e,t,s);r={type:"ArithBinary",operator:"&",left:r,right:o},s=a}return{expr:r,pos:s}}function tg(e,t,n){let{expr:r,pos:s}=ng(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="=="||t.slice(s,s+2)==="!=";){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=ng(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function ng(e,t,n){let{expr:r,pos:s}=Zc(e,t,n);for(;;)if(s=Je(t,s),t.slice(s,s+2)==="<="||t.slice(s,s+2)===">="){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Zc(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++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Zc(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Zc(e,t,n){let{expr:r,pos:s}=rg(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="<<"||t.slice(s,s+2)===">>";){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=rg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function rg(e,t,n){let{expr:r,pos:s}=sg(e,t,n);for(;s=Je(t,s),(t[s]==="+"||t[s]==="-")&&t[s+1]!==t[s];){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=sg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function sg(e,t,n){let{expr:r,pos:s}=Yo(e,t,n);for(;;)if(s=Je(t,s),t[s]==="*"&&t[s+1]!=="*"){if(s++,Qt(t,s))return Kt("*",s);let{expr:o,pos:a}=Yo(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++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Yo(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Yo(e,t,n){let{expr:r,pos:s}=Kc(e,t,n),i=Je(t,s);if(t.slice(i,i+2)==="**"){if(i+=2,Qt(t,i))return Kt("**",i);let{expr:a,pos:l}=Yo(e,t,i);return{expr:{type:"ArithBinary",operator:"**",left:r,right:a},pos:l}}return{expr:r,pos:s}}function Kc(e,t,n){let r=Je(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}=Kc(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}=Kc(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}return jA(e,t,r)}function HA(e,t){let n=e[t];return n==="$"||n==="`"}function jA(e,t,n){let{expr:r,pos:s}=ig(e,t,n,!1),i=[r];for(;HA(t,s);){let{expr:a,pos:l}=ig(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}=on(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=Je(t,s),r.type==="ArithConcat"||r.type==="ArithVariable"||r.type==="ArithDynamicElement"){for(let a of Xo)if(t.slice(s,s+a.length)===a&&t.slice(s,s+a.length+1)!=="=="){s+=a.length;let{expr:l,pos:c}=Si(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 ig(e,t,n,r=!1){let s=Je(t,n),i=q2(on,e,t,s);if(i)return i;let o=Z2(t,s);if(o)return o;let a=K2(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}=on(e,t,s);return s=Je(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}=on(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 h=t[s];if(u)if(/[0-9a-zA-Z@_]/.test(h))c+=h,s++;else break;else if(h==="#")u=!0,c+=h,s++;else if(c==="0"&&(h==="x"||h==="X")&&s+1<t.length&&/[0-9a-fA-F]/.test(t[s+1]))f=!0,c+=h,s++;else if(f&&/[0-9a-fA-F]/.test(h))c+=h,s++;else if(!f&&/[0-9]/.test(h))c+=h,s++;else break}if(s<t.length&&/[a-zA-Z_]/.test(t[s])){let h=c;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)h+=t[s],s++;return{expr:{type:"ArithSyntaxError",errorToken:h,message:`${h}: value too great for base (error token is "${h}")`},pos:s}}if(t[s]==="."&&/[0-9]/.test(t[s+1]))throw new Le(`${c}.${t[s+1]}...: syntax error: invalid arithmetic operator`);if(t[s]==="["){let h=t.slice(s).trim();return{expr:{type:"ArithNumberSubscript",number:c,errorToken:h},pos:t.length}}return{expr:{type:"ArithNumber",value:Ai(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 p=t.slice(c,f),h=f+1;if(t[h]==="#"){let d=h+1;for(;d<t.length&&/[0-9a-zA-Z@_]/.test(t[d]);)d++;let m=t.slice(h+1,d);return{expr:{type:"ArithDynamicBase",baseExpr:p,value:m},pos:d}}if(/[0-9]/.test(t[h])||t[h]==="x"||t[h]==="X"){let d=h;if(t[h]==="x"||t[h]==="X")for(d++;d<t.length&&/[0-9a-fA-F]/.test(t[d]);)d++;else for(;d<t.length&&/[0-9]/.test(t[d]);)d++;let m=t.slice(h,d);return{expr:{type:"ArithDynamicNumber",prefix:p,suffix:m},pos:d}}return s=h,{expr:{type:"ArithBracedExpansion",content:p},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 p=t[s];for(s++,u="";s<t.length&&t[s]!==p;)u+=t[s],s++;t[s]===p&&s++,s=Je(t,s),t[s]==="]"&&s++}let f;if(u===void 0){let{expr:p,pos:h}=on(e,t,s);f=p,s=h,t[s]==="]"&&s++}if(s=Je(t,s),t[s]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:s};if(!r){for(let p of Xo)if(t.slice(s,s+p.length)===p&&t.slice(s,s+p.length+1)!=="=="){s+=p.length;let{expr:h,pos:d}=Si(e,t,s);return{expr:{type:"ArithAssignment",operator:p,variable:c,subscript:f,stringKey:u,value:h},pos:d}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:s}}if(s=Je(t,s),!r){for(let u of Xo)if(t.slice(s,s+u.length)===u&&t.slice(s,s+u.length+1)!=="=="){s+=u.length;let{expr:f,pos:p}=Si(e,t,s);return{expr:{type:"ArithAssignment",operator:u,variable:c,value:f},pos:p}}}return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:l},pos:s}}if(t[s]==="#"){let c=s+1;for(;c<t.length&&t[c]!==`
769
+ `;)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 Ot=v(()=>{"use strict";Ae();Q2()});function GA(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 lg(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function Qc(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 Zr(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 cg(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 ug(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=VA(t,r);o===-1?(s+=i,r++):(s+=t.slice(r,o+1),r=o+1)}else break}return{pattern:s,endIndex:r}}function VA(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 fg(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+=`
770
+ `,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+=GA(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:J.literal(r),endIndex:s}}function Xc(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:Ne(e,n)}function ag(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 pg(e,t,n,r){let s=Qc(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:ag(i).map(u=>({type:"Word",word:J.word(r(e,u,!1,!1,!1))}))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:ag(i).map(u=>({type:"Word",word:J.word([J.literal(u)])}))},endIndex:s+1}:null}function Yc(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(Yc(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 hg(e,t){return{[E.LESS]:"<",[E.GREAT]:">",[E.DGREAT]:">>",[E.LESSAND]:"<&",[E.GREATAND]:">&",[E.LESSGREAT]:"<>",[E.CLOBBER]:">|",[E.TLESS]:"<<<",[E.AND_GREAT]:"&>",[E.AND_DGREAT]:"&>>",[E.DLESS]:"<",[E.DLESSDASH]:"<"}[t]||">"}var Jc=v(()=>{"use strict";qr();Ot();gr()});function Jo(e){let t=e.current(),n=t.type;if(n===E.NUMBER){let r=e.peek(1);return t.end!==r.start?!1:G2.has(r.type)}if(n===E.FD_VARIABLE){let r=e.peek(1);return V2.has(r.type)}return j2.has(n)}function ea(e){let t=null,n;e.check(E.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(E.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),s=hg(e,r.type);if(r.type===E.DLESS||r.type===E.DLESSDASH)return qA(e,s,t,r.type===E.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return J.redirection(s,i,t,n)}function qA(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.value,o=s.quoted||!1;(i.startsWith("'")&&i.endsWith("'")||i.startsWith('"')&&i.endsWith('"'))&&(i=i.slice(1,-1));let a=J.redirection(r?"<<-":"<<",J.hereDoc(i,J.word([]),r,o),n);return e.addPendingHeredoc(a,i,r,o),a}function mg(e){let t=e.current().line,n=[],r=null,s=[],i=[];for(;e.check(E.ASSIGNMENT_WORD)||Jo(e);)e.checkIterationLimit(),e.check(E.ASSIGNMENT_WORD)?n.push(ZA(e)):i.push(ea(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(E.DBRACK_START)||e.check(E.DPAREN_START))){let a=e.advance();r=J.word([J.literal(a.value)])}for(;(!e.isStatementEnd()||e.check(E.RBRACE))&&!e.check(E.PIPE,E.PIPE_AMP);)if(e.checkIterationLimit(),Jo(e))i.push(ea(e));else if(e.check(E.RBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(E.LBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(E.DBRACK_END)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.isWord())s.push(e.parseWord());else if(e.check(E.ASSIGNMENT_WORD)){let a=e.advance(),l=a.value,c=l.endsWith("="),u=l.endsWith("=(");if((c||u)&&(u||e.check(E.LPAREN))){let f=u?l.slice(0,-2):l.slice(0,-1);u||e.expect(E.LPAREN);let p=eu(e);e.expect(E.RPAREN);let h=p.map(m=>Yc(e,m)),d=`${f}=(${h.join(" ")})`;s.push(e.parseWordFromString(d,!1,!1))}else s.push(e.parseWordFromString(l,a.quoted,a.singleQuoted))}else if(e.check(E.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=J.simpleCommand(r,s,n,i);return o.line=t,o}function ZA(e){let t=e.expect(E.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,p=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=n.slice(p,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=eu(e);e.expect(E.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return J.assignment(p,null,a,f)}if(l===""&&e.check(E.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let p=eu(e);e.expect(E.RPAREN);let h=i!==void 0?`${s}[${i}]`:s;return J.assignment(h,null,a,p)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null,u=i!==void 0?`${s}[${i}]`:s;return J.assignment(u,c,a,null)}function eu(e){let t=[];for(e.skipNewlines();!e.check(E.RPAREN,E.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):KA.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var KA,gg=v(()=>{"use strict";qr();gr();Vr();Jc();KA=new Set([E.AMP,E.PIPE,E.PIPE_AMP,E.SEMICOLON,E.AND_AND,E.OR_OR,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND])});function tu(e,t){e.expect(E.IF);let n=[],r=e.parseCompoundList();e.expect(E.THEN);let s=e.parseCompoundList();if(s.length===0){let a=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${a}'`)}for(n.push({condition:r,body:s});e.check(E.ELIF);){e.advance();let a=e.parseCompoundList();e.expect(E.THEN);let l=e.parseCompoundList();if(l.length===0){let c=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${c}'`)}n.push({condition:a,body:l})}let i=null;e.check(E.ELSE)&&(e.advance(),i=e.parseCompoundList(),i.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(E.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.ifNode(n,i,o)}function nu(e,t){let n=e.expect(E.FOR);if(e.check(E.DPAREN_START))return XA(e,t,n.line);e.isWord()||e.error("Expected variable name in for loop");let s=e.advance().value,i=null;if(e.skipNewlines(),e.check(E.IN))for(e.advance(),i=[];!e.check(E.SEMICOLON,E.NEWLINE,E.DO,E.EOF)&&e.isWord();)i.push(e.parseWord());e.check(E.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(E.DO);let o=e.parseCompoundList();e.expect(E.DONE);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.forNode(s,i,o,a)}function XA(e,t,n){e.expect(E.DPAREN_START);let r=null,s=null,i=null,o=["","",""],a=0,l=0;for(;!e.check(E.DPAREN_END,E.EOF);){let f=e.advance();if(f.type===E.SEMICOLON&&l===0){if(a++,a>2)break}else f.value==="("&&l++,f.value===")"&&l--,o[a]+=f.value}e.expect(E.DPAREN_END),o[0].trim()&&(r=Ne(e,o[0].trim())),o[1].trim()&&(s=Ne(e,o[1].trim())),o[2].trim()&&(i=Ne(e,o[2].trim())),e.skipNewlines(),e.check(E.SEMICOLON)&&e.advance(),e.skipNewlines();let c;e.check(E.LBRACE)?(e.advance(),c=e.parseCompoundList(),e.expect(E.RBRACE)):(e.expect(E.DO),c=e.parseCompoundList(),e.expect(E.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:r,condition:s,update:i,body:c,redirections:u,line:n}}function ru(e,t){e.expect(E.WHILE);let n=e.parseCompoundList();e.expect(E.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(E.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.whileNode(n,r,s)}function su(e,t){e.expect(E.UNTIL);let n=e.parseCompoundList();e.expect(E.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(E.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.untilNode(n,r,s)}function iu(e,t){e.expect(E.CASE),e.isWord()||e.error("Expected word after 'case'");let n=e.parseWord();e.skipNewlines(),e.expect(E.IN),e.skipNewlines();let r=[];for(;!e.check(E.ESAC,E.EOF);){e.checkIterationLimit();let i=e.getPos(),o=YA(e);if(o&&r.push(o),e.skipNewlines(),e.getPos()===i&&!o)break}e.expect(E.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.caseNode(n,r,s)}function YA(e){e.check(E.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(E.PIPE));)e.advance();if(t.length===0)return null;e.expect(E.RPAREN),e.skipNewlines();let n=[];for(;!e.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND,E.ESAC,E.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===E.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(E.LPAREN)&&e.peek(1).type===E.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(E.DSEMI)?(e.advance(),r=";;"):e.check(E.SEMI_AND)?(e.advance(),r=";&"):e.check(E.SEMI_SEMI_AND)&&(e.advance(),r=";;&"),J.caseItem(t,n,r)}function ou(e,t){e.expect(E.LPAREN);let n=e.parseCompoundList();e.expect(E.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.subshell(n,r)}function au(e,t){e.expect(E.LBRACE);let n=e.parseCompoundList();e.expect(E.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.group(n,r)}var yg=v(()=>{"use strict";qr();Ot();gr()});function wg(e){return e.isWord()||e.check(E.LBRACE)||e.check(E.RBRACE)||e.check(E.ASSIGNMENT_WORD)}function bg(e){if(e.check(E.BANG)&&e.peek(1).type===E.LPAREN){e.advance(),e.advance();let t=1,n="!(";for(;t>0&&!e.check(E.EOF);)if(e.check(E.LPAREN))t++,n+="(",e.advance();else if(e.check(E.RPAREN))t--,t>0&&(n+=")"),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(E.PIPE))n+="|",e.advance();else break;return n+=")",e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function cu(e){return e.skipNewlines(),nS(e)}function nS(e){let t=xg(e);for(e.skipNewlines();e.check(E.OR_OR);){e.advance(),e.skipNewlines();let n=xg(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function xg(e){let t=lu(e);for(e.skipNewlines();e.check(E.AND_AND);){e.advance(),e.skipNewlines();let n=lu(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function lu(e){return e.skipNewlines(),e.check(E.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:lu(e)}):rS(e)}function rS(e){if(e.check(E.LPAREN)){e.advance();let t=cu(e);return e.expect(E.RPAREN),{type:"CondGroup",expression:t}}if(wg(e)){let t=e.current(),n=t.value;if(eS.includes(n)&&!t.quoted){if(e.advance(),e.check(E.DBRACK_END)&&e.error(`Expected operand after ${n}`),wg(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()&&tS.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=sS(e):s==="=="||s==="!="?i=bg(e):i=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:s,left:r,right:i}}if(e.check(E.LESS)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:r,right:s}}if(e.check(E.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=bg(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function sS(e){let t=[],n=0,r=-1,s=e.getInput(),i=()=>e.check(E.DBRACK_END)||e.check(E.AND_AND)||e.check(E.OR_OR)||e.check(E.NEWLINE)||e.check(E.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(E.ASSIGNMENT_WORD)){let l=e.parseWordForRegex();t.push(...l.parts),r=e.peek(-1).end}else if(e.check(E.LPAREN)){let l=e.advance();t.push({type:"Literal",value:"("}),n++,r=l.end}else if(e.check(E.DPAREN_START)){let l=e.advance();t.push({type:"Literal",value:"(("}),n+=2,r=l.end}else if(e.check(E.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(E.RPAREN))if(n>0){let l=e.advance();t.push({type:"Literal",value:")"}),n--,r=l.end}else break;else if(e.check(E.PIPE)){let l=e.advance();t.push({type:"Literal",value:"|"}),r=l.end}else if(e.check(E.SEMICOLON))if(n>0){let l=e.advance();t.push({type:"Literal",value:";"}),r=l.end}else break;else if(n>0&&e.check(E.LESS)){let l=e.advance();t.push({type:"Literal",value:"<"}),r=l.end}else if(n>0&&e.check(E.GREAT)){let l=e.advance();t.push({type:"Literal",value:">"}),r=l.end}else if(n>0&&e.check(E.DGREAT)){let l=e.advance();t.push({type:"Literal",value:">>"}),r=l.end}else if(n>0&&e.check(E.DLESS)){let l=e.advance();t.push({type:"Literal",value:"<<"}),r=l.end}else if(n>0&&e.check(E.LESSAND)){let l=e.advance();t.push({type:"Literal",value:"<&"}),r=l.end}else if(n>0&&e.check(E.GREATAND)){let l=e.advance();t.push({type:"Literal",value:">&"}),r=l.end}else if(n>0&&e.check(E.LESSGREAT)){let l=e.advance();t.push({type:"Literal",value:"<>"}),r=l.end}else if(n>0&&e.check(E.CLOBBER)){let l=e.advance();t.push({type:"Literal",value:">|"}),r=l.end}else if(n>0&&e.check(E.TLESS)){let l=e.advance();t.push({type:"Literal",value:"<<<"}),r=l.end}else if(n>0&&e.check(E.AMP)){let l=e.advance();t.push({type:"Literal",value:"&"}),r=l.end}else if(n>0&&e.check(E.LBRACE)){let l=e.advance();t.push({type:"Literal",value:"{"}),r=l.end}else if(n>0&&e.check(E.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}}var eS,tS,Eg=v(()=>{"use strict";gr();eS=["-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"],tS=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"]});function Ci(e){return e.length>0?e:[J.literal("")]}function oS(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 aS(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:J.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:J.parameterExpansion(i),endIndex:r}}function lS(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=Qc(e,t,s,"[","]");if(a+=t.slice(s,u+1),s=u+1,t[s]==="["){let f=1,p=s;for(;p<t.length&&f>0;)t[p]==="{"?f++:t[p]==="}"&&f--,f>0&&p++;let h=t.slice(n+2,p);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:h}),endIndex:p+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 At("unexpected EOF while looking for matching '}'",0,0);let p=t.slice(n+2,f);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:p}),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=uu(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=uu(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=uu(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 p=t.slice(n,f+1);e.error(`\${${p.slice(2,-1)}}: bad substitution`)}}for(;s<t.length&&t[s]!=="}";)s++;if(s>=t.length)throw new At("unexpected EOF while looking for matching '}'",0,0);return{part:J.parameterExpansion(a,c),endIndex:s+1}}function uu(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 y=Zr(e,t,i),b=t.slice(i,y),w=yr(e,b,!1,!1,!0,!1,s,!1,!1,!0),x=J.word(Ci(w));if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:y};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:y};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:y};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:y}}i++;let c=Zr(e,t,i),u=t.slice(i,c),f=-1,p=0,h=0;for(let g=0;g<u.length;g++){let y=u[g];if(y==="("||y==="[")p++;else if(y===")"||y==="]")p--;else if(y==="?"&&p===0)h++;else if(y===":"&&p===0)if(h>0)h--;else{f=g;break}}let d=f>=0?u.slice(0,f):u,m=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:Xc(e,d),length:m!==null?Xc(e,m):null},endIndex:c}}if("-=?+".includes(o)){i++;let l=Zr(e,t,i),c=t.slice(i,l),u=yr(e,c,!1,!1,!0,!1,s,!1,!1,!0),f=J.word(Ci(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=Zr(e,t,i),f=t.slice(i,u),p=yr(e,f,!1,!1,!1);return{operation:{type:"PatternRemoval",pattern:J.word(Ci(p)),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=cg(e,t,i);let f=t.slice(i,u),p=yr(e,f,!1,!1,!1),h=J.word(Ci(p)),d=null,m=u;if(t[u]==="/"){let g=u+1,y=Zr(e,t,g),b=t.slice(g,y),w=yr(e,b,!1,!1,!1);d=J.word(Ci(w)),m=y}return{operation:{type:"PatternReplacement",pattern:h,replacement:d,all:l,anchor:c},endIndex:m}}if(o==="^"||o===","){let l=a===o,c=o==="^"?"upper":"lower";i+=l?2:1;let u=Zr(e,t,i),f=t.slice(i,u),p=f?J.word([J.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:p},endIndex:u}}return o==="@"&&/[QPaAEKkuUL]/.test(a)?{operation:{type:"Transform",operator:a},endIndex:i+2}:{operation:null,endIndex:i}}function fu(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:J.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=Ne(e,l);return{part:J.arithmeticExpansion(c),endIndex:a+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?lS(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?aS(e,t,n):{part:J.literal("$"),endIndex:s}}function Ag(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(J.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}=fu(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 cS(e,t,n){let r=[],s=n,i="",o=()=>{i&&(r.push(J.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}=fu(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:J.doubleQuoted(r),endIndex:s}}function yr(e,t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1){if(r)return[J.singleQuoted(t)];if(n){let d=Ag(e,t);return[J.doubleQuoted(d)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let d=t.slice(1,-1),m=!1;for(let g=0;g<d.length;g++){if(d[g]==='"'){m=!0;break}d[g]==="\\"&&g+1<d.length&&g++}if(!m){let g=Ag(e,d);return[J.doubleQuoted(g)]}}let u=[],f=0,p="",h=()=>{p&&(u.push(J.literal(p)),p="")};for(;f<t.length;){let d=t[f];if(d==="\\"&&f+1<t.length){let m=t[f+1];if(l){h(),u.push(J.escaped(m)),f+=2;continue}let g=i?m==="$"||m==="`"||m===`
771
+ `:m==="$"||m==="`"||m==='"'||m==="'"||m===`
772
+ `||c&&m==="}",y=o?"*?[]\\".includes(m):"*?[]\\(){}.^+".includes(m);g?p+=m:y?(h(),u.push(J.escaped(m))):p+=`\\${m}`,f+=2;continue}if(d==="'"&&!o&&!i){h();let m=t.indexOf("'",f+1);if(m===-1){p+=t.slice(f);break}u.push(J.singleQuoted(t.slice(f+1,m))),f=m+1;continue}if(d==='"'&&!i){h();let{part:m,endIndex:g}=cS(e,t,f+1);u.push(m),f=g+1;continue}if(d==="$"&&t[f+1]==="'"){h();let{part:m,endIndex:g}=fg(e,t,f+2);u.push(m),f=g;continue}if(d==="$"){h();let{part:m,endIndex:g}=fu(e,t,f);m&&u.push(m),f=g;continue}if(d==="`"){h();let{part:m,endIndex:g}=e.parseBacktickSubstitution(t,f);u.push(m),f=g;continue}if(d==="~"){let m=f>0?t[f-1]:"";if(f===0||m==="="||s&&m===":"){let y=lg(e,t,f),b=t[y];if(b===void 0||b==="/"||b===":"){h();let w=t.slice(f+1,y)||null;u.push({type:"TildeExpansion",user:w}),f=y;continue}}}if("@*+?!".includes(d)&&f+1<t.length&&t[f+1]==="("){let m=oS(t,f+1);if(m!==-1){h();let g=t.slice(f,m+1);u.push({type:"Glob",pattern:g}),f=m+1;continue}}if(d==="*"||d==="?"||d==="["){h();let{pattern:m,endIndex:g}=ug(e,t,f);u.push({type:"Glob",pattern:m}),f=g;continue}if(d==="{"&&!s&&!a&&!i){let m=pg(e,t,f,yr);if(m){h(),u.push(m.part),f=m.endIndex;continue}}p+=d,f++}return h(),u}var Sg=v(()=>{"use strict";qr();Ot();Vr();Jc()});function Cg(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 vg(e,t,n,r){let s=t+2,i=1,o=s,a=!1,l=!1,c=0,u=!1,f="";for(;o<e.length&&i>0;){let m=e[o];a?m==="'"&&(a=!1):l?m==="\\"&&o+1<e.length?o++:m==='"'&&(l=!1):m==="'"?(a=!0,f=""):m==='"'?(l=!0,f=""):m==="\\"&&o+1<e.length?(o++,f=""):/[a-zA-Z_]/.test(m)?f+=m:(f==="case"?(c++,u=!1):f==="in"&&c>0?u=!0:f==="esac"&&c>0&&(c--,u=!1),f="",m==="("?o>0&&e[o-1]==="$"?i++:u||i++:m===")"?u?u=!1:i--:m===";"&&c>0&&o+1<e.length&&e[o+1]===";"&&(u=!0)),i>0&&o++}i>0&&r("unexpected EOF while looking for matching `)'");let p=e.slice(s,o),d=n().parse(p);return{part:J.commandSubstitution(d,!1),endIndex:o+1}}function kg(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:J.commandSubstitution(c,!0),endIndex:o+1}}var Ng=v(()=>{"use strict";qr()});function kn(e,t){return new pe().parse(e,t)}var pe,ct=v(()=>{"use strict";qr();Ot();gg();yg();Eg();Sg();gr();Ng();Vr();Vr();pe=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input="";getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>H2)throw new At("Maximum parse iterations exceeded (possible infinite loop)",this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>qc)throw new At(`Maximum parser nesting depth exceeded (${qc})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(t,n){if(t.length>Gc)throw new At(`Input too large: ${t.length} bytes exceeds limit of ${Gc}`,1,1);this._input=t;let r=new Qo(t,n);if(this.tokens=r.tokenize(),this.tokens.length>Vc)throw new At(`Too many tokens: ${this.tokens.length} exceeds limit of ${Vc}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(t){return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}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}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 At(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new At(t,n.line,n.column,n)}skipNewlines(){for(;this.check(E.NEWLINE,E.COMMENT);)this.check(E.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(E.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(E.SEMICOLON,E.COMMENT)){this.advance();continue}if(t&&this.check(E.DSEMI,E.SEMI_AND,E.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(E.HEREDOC_CONTENT)){let n=this.advance(),r;t.quoted?r=J.word([J.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=J.hereDoc(t.delimiter,r,t.stripTabs,t.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(E.EOF,E.NEWLINE,E.SEMICOLON,E.AMP,E.AND_AND,E.OR_OR,E.RPAREN,E.RBRACE,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return t===E.WORD||t===E.NAME||t===E.NUMBER||t===E.ASSIGNMENT_WORD||t===E.IF||t===E.FOR||t===E.WHILE||t===E.UNTIL||t===E.CASE||t===E.LPAREN||t===E.LBRACE||t===E.DPAREN_START||t===E.DBRACK_START||t===E.FUNCTION||t===E.BANG||t===E.TIME||t===E.IN||t===E.LESS||t===E.GREAT||t===E.DLESS||t===E.DGREAT||t===E.LESSAND||t===E.GREATAND||t===E.LESSGREAT||t===E.DLESSDASH||t===E.CLOBBER||t===E.TLESS||t===E.AND_GREAT||t===E.AND_DGREAT}parseScript(){let t=[],r=0;for(this.skipNewlines();!this.check(E.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.skipSeparators(!1),this.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===i&&!this.check(E.EOF)&&this.advance()}return J.script(t)}checkUnexpectedToken(){let t=this.current().type,n=this.current().value;if((t===E.DO||t===E.DONE||t===E.THEN||t===E.ELSE||t===E.ELIF||t===E.FI||t===E.ESAC)&&this.error(`syntax error near unexpected token \`${n}'`),t===E.RBRACE||t===E.RPAREN){let r=`syntax error near unexpected token \`${n}'`;return this.advance(),J.statement([J.pipeline([J.simpleCommand(null,[],[],[])])],[],!1,{message:r,token:n})}return(t===E.DSEMI||t===E.SEMI_AND||t===E.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${n}'`),t===E.SEMICOLON&&this.error(`syntax error near unexpected token \`${n}'`),(t===E.PIPE||t===E.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(E.AND_AND,E.OR_OR);){let l=this.advance();r.push(l.type===E.AND_AND?"&&":"||"),this.skipNewlines();let c=this.parsePipeline();n.push(c)}this.check(E.AMP)&&(this.advance(),s=!0);let o=this.pos>0?this.tokens[this.pos-1].end:t,a=this._input.slice(t,o);return J.statement(n,r,s,void 0,a)}parsePipeline(){let t=!1,n=!1;this.check(E.TIME)&&(this.advance(),t=!0,this.check(E.WORD,E.NAME)&&this.current().value==="-p"&&(this.advance(),n=!0));let r=0;for(;this.check(E.BANG);)this.advance(),r++;let s=r%2===1,i=[],o=[],a=this.parseCommand();for(i.push(a);this.check(E.PIPE,E.PIPE_AMP);){let l=this.advance();this.skipNewlines(),o.push(l.type===E.PIPE_AMP);let c=this.parseCommand();i.push(c)}return J.pipeline(i,s,t,n,o.length>0?o:void 0)}parseCommand(){return this.check(E.IF)?tu(this):this.check(E.FOR)?nu(this):this.check(E.WHILE)?ru(this):this.check(E.UNTIL)?su(this):this.check(E.CASE)?iu(this):this.check(E.LPAREN)?ou(this):this.check(E.LBRACE)?au(this):this.check(E.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(E.DBRACK_START)?this.parseConditionalCommand():this.check(E.FUNCTION)?this.parseFunctionDef():this.check(E.NAME,E.WORD)&&this.peek(1).type===E.LPAREN&&this.peek(2).type===E.RPAREN?this.parseFunctionDef():mg(this)}dparenClosesWithSpacedParens(){let t=1,n=1;for(;n<this.tokens.length-this.pos;){let r=this.peek(n);if(r.type===E.EOF)return!1;if(r.type===E.DPAREN_START||r.type===E.LPAREN)t++;else if(r.type===E.DPAREN_END){if(t-=2,t<=0)return!1}else if(r.type===E.RPAREN&&(t--,t===0&&this.peek(n+1).type===E.RPAREN))return!0;n++}return!1}parseNestedSubshellsFromDparen(){this.advance();let t=this.parseCompoundList();this.expect(E.RPAREN),this.expect(E.RPAREN);let n=this.parseOptionalRedirections(),r=J.subshell(t,[]);return J.subshell([J.statement([J.pipeline([r],!1,!1,!1)])],n)}isWord(){let t=this.current().type;return t===E.WORD||t===E.NAME||t===E.NUMBER||t===E.IF||t===E.FOR||t===E.WHILE||t===E.UNTIL||t===E.CASE||t===E.FUNCTION||t===E.ELSE||t===E.ELIF||t===E.FI||t===E.THEN||t===E.DO||t===E.DONE||t===E.ESAC||t===E.IN||t===E.SELECT||t===E.TIME||t===E.COPROC||t===E.BANG}parseWord(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted)}parseWordNoBraceExpansion(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted,!1,!1,!0)}parseWordForRegex(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted,!1,!1,!0,!0)}parseWordFromString(t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1){let l=yr(this,t,n,r,s,i,!1,o,a);return J.word(l)}parseCommandSubstitution(t,n){return vg(t,n,()=>new e,r=>this.error(r))}parseBacktickSubstitution(t,n,r=!1){return kg(t,n,r,()=>new e,s=>this.error(s))}isDollarDparenSubshell(t,n){return Cg(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:J.arithmeticExpansion(l),endIndex:o+2}}parseArithmeticCommand(){let t=this.expect(E.DPAREN_START),n="",r=1,s=0,i=!1,o=!1;for(;r>0&&!this.check(E.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(E.RPAREN)){r--,o=!0,this.advance();continue}if(this.check(E.DPAREN_END)){r--,o=!0;continue}n+=")";continue}if(this.check(E.DPAREN_START))r++,n+="((",this.advance();else if(this.check(E.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(E.LPAREN))s++,n+="(",this.advance();else if(this.check(E.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(E.DPAREN_END);let a=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return J.arithmeticCommand(a,l,t.line)}parseConditionalCommand(){let t=this.expect(E.DBRACK_START),n=cu(this);this.expect(E.DBRACK_END);let r=this.parseOptionalRedirections();return J.conditionalCommand(n,r,t.line)}parseFunctionDef(){let t;if(this.check(E.FUNCTION)){if(this.advance(),this.check(E.NAME)||this.check(E.WORD))t=this.advance().value;else{let s=this.current();throw new At("Expected function name",s.line,s.column,s)}this.check(E.LPAREN)&&(this.advance(),this.expect(E.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(E.LPAREN),this.expect(E.RPAREN);this.skipNewlines();let n=this.parseCompoundCommandBody({forFunctionBody:!0}),r=this.parseOptionalRedirections();return J.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(E.LBRACE))return au(this,{skipRedirections:n});if(this.check(E.LPAREN))return ou(this,{skipRedirections:n});if(this.check(E.IF))return tu(this,{skipRedirections:n});if(this.check(E.FOR))return nu(this,{skipRedirections:n});if(this.check(E.WHILE))return ru(this,{skipRedirections:n});if(this.check(E.UNTIL))return su(this,{skipRedirections:n});if(this.check(E.CASE))return iu(this,{skipRedirections:n});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth(),n=[];for(this.skipNewlines();!this.check(E.EOF,E.FI,E.ELSE,E.ELIF,E.THEN,E.DO,E.DONE,E.ESAC,E.RPAREN,E.RBRACE,E.DSEMI,E.SEMI_AND,E.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 t(),n}parseOptionalRedirections(){let t=[];for(;Jo(this);){this.checkIterationLimit();let n=this.pos;if(t.push(ea(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return Ne(this,t)}}});function hu(e){return pS.get(e)??""}function Pg(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 Dg(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=hu(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+="$",Q(t)}function du(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 mu(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 pS,_g=v(()=>{"use strict";Ze();pS=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"]])});var Fg,wr,ta=v(()=>{"use strict";Ae();Ze();rs();_g();Fg=5,wr=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;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.maxOps=1e5;let i=r?.get("GLOBIGNORE");i!==void 0&&i!==""&&(this.hasGlobignore=!0,this.globignorePatterns=Pg(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new X(`Glob operation limit exceeded (${this.maxOps})`,"glob_operations")}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 Dg(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>Fg))throw new X(`Glob pattern has too many ** segments (max ${Fg})`,"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 p=a.some(d=>d.name==="."),h=a.some(d=>d.name==="..");p||c.push({name:".",isFile:!1,isDirectory:!0,isSymbolicLink:!1}),h||c.push({name:"..",isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let p of c)if(!(p.name.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p.name,s)){let h=t==="/"?`/${p.name}`:`${t}/${p.name}`,d;n===""?d=p.name:n==="/"?d=`/${p.name}`:d=`${n}/${p.name}`,i.length===0?l.push(Promise.resolve([d])):p.isDirectory&&l.push(this.expandSegments(h,d,i))}let f=await Promise.all(l);for(let p of f)o.push(...p)}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 p of c)if(!(p.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p,s)){let h=t==="/"?`/${p}`:`${t}/${p}`,d;n===""?d=p:n==="/"?d=`/${p}`:d=`${n}/${p}`,i.length===0?l.push(Promise.resolve([d])):l.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(h)).isDirectory)return this.expandSegments(h,d,i)}catch(m){if(m instanceof X)throw m}return[]})())}let f=await Promise.all(l);for(let p of f)o.push(...p)}}catch(a){if(a instanceof X)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}`,p=this.fs.resolvePath(this.cwd,f);try{this.checkOpsLimit(),(await this.fs.stat(p)).isDirectory&&a.push(f)}catch(h){if(h instanceof X)throw h}}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(p=>this.walkDirectoryMultiGlobstar(p,n,r)))}}}catch(i){if(i instanceof X)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 p=t==="."?f:`${t}/${f}`,h=this.fs.resolvePath(this.cwd,p);try{this.checkOpsLimit();let d=await this.fs.stat(h);return{name:f,path:p,isDirectory:d.isDirectory}}catch(d){if(d instanceof X)throw d;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 X)throw i}}matchPattern(t,n){return this.patternToRegex(n).test(t)}patternToRegex(t){let n=this.patternToRegexStr(t);return Q(`^${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=du(t,s+1);if(o!==-1){let a=t.slice(s+2,o),l=mu(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 p=l.map(d=>this.computePatternLength(d));if(p.every(d=>d!==null)&&p.every(d=>d===p[0])&&p[0]!==null){let d=p[0];if(d===0)n+="(?:.+)";else{let m=[];d>0&&m.push(`.{0,${d-1}}`),m.push(`.{${d+1},}`),m.push(`(?!(?:${u})).{${d}}`),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),p=hu(f);a+=p,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=du(t,r+1);if(o!==-1){if(i==="@"){let a=t.slice(r+2,o),c=mu(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}}});function gu(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 hS(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 Lg(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 vi(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),hS(l)&&(t=!0),(l.operation?.type==="VarNamePrefix"||l.operation?.type==="ArrayKeys")&&(o=!0),l.operation?.type==="Indirection"&&(a=!0)),l.type==="Glob"&&gu(l.pattern)&&(i=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:s,hasParamExpansion:i,hasVarNamePrefixExpansion:o,hasIndirection:a}}var na=v(()=>{"use strict"});function ut(e,t){let n=`${t}_`,r=[];for(let s of e.state.env.keys())if(s.startsWith(n)){let i=s.slice(n.length),o=Number.parseInt(i,10);!Number.isNaN(o)&&String(o)===i&&r.push(o)}return r.sort((s,i)=>s-i)}function Gn(e,t){let n=`${t}_`;for(let r of e.state.env.keys())r.startsWith(n)&&e.state.env.delete(r)}function Nn(e,t){let n=`${t}_`,r=`${t}__length`,s=[];for(let i of e.state.env.keys())if(i!==r&&i.startsWith(n)){let o=i.slice(n.length);if(o.startsWith("_length"))continue;s.push(o)}return s.sort()}function ra(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function yu(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 p=e.parts[2];if(p.type!=="Literal"||!p.value.startsWith("=")&&!p.value.startsWith("+="))return null;r=t.pattern.slice(1),s=p,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 p of n.parts)(p.type==="Literal"||p.type==="Escaped")&&(r+=p.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=ra(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 p=e.parts[f];p.type==="BraceExpansion"?l.push({type:"Literal",value:dS(p)}):l.push(p)}return{key:r,valueParts:l,append:a}}function dS(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 Rs(n.word)}).join(",")}}`}function Rs(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}`:""}`:Rs(r.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",n.user&&(t+=n.user);break}return t}var yn=v(()=>{"use strict"});function yt(e){return e.get("IFS")??`
775
+ `}function kt(e){return e.get("IFS")===""}function sa(e){let t=yt(e);if(t==="")return!0;for(let n of t)if(n!==" "&&n!==" "&&n!==`
776
+ `)return!1;return!0}function Mg(e){let t=!1,n=[];for(let r of e.split(""))r==="-"?t=!0:/[\\^$.*+?()[\]{}|]/.test(r)?n.push(`\\${r}`):r===" "?n.push("\\t"):r===`
777
+ `?n.push("\\n"):n.push(r);return t&&n.push("\\-"),n.join("")}function me(e){let t=e.get("IFS");return t===void 0?" ":t[0]||""}function gS(e){return mS.includes(e)}function wu(e){let t=new Set,n=new Set;for(let r of e)gS(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function bu(e,t,n,r){if(t==="")return e===""?{words:[],wordStarts:[]}:{words:[e],wordStarts:[0]};let{whitespace:s,nonWhitespace:i}=wu(t),o=[],a=[],l=0;for(;l<e.length&&s.has(e[l]);)l++;if(l>=e.length)return{words:[],wordStarts:[]};if(i.has(e[l]))for(o.push(""),a.push(l),l++;l<e.length&&s.has(e[l]);)l++;for(;l<e.length&&!(n!==void 0&&o.length>=n);){let c=l;for(a.push(c);l<e.length;){let u=e[l];if(!r&&u==="\\"){l++,l<e.length&&l++;continue}if(s.has(u)||i.has(u))break;l++}if(o.push(e.substring(c,l)),l>=e.length)break;for(;l<e.length&&s.has(e[l]);)l++;if(l<e.length&&i.has(e[l])){for(l++;l<e.length&&s.has(e[l]);)l++;for(;l<e.length&&i.has(e[l])&&!(n!==void 0&&o.length>=n);)for(o.push(""),a.push(l),l++;l<e.length&&s.has(e[l]);)l++}}return{words:o,wordStarts:a}}function ia(e,t){if(t==="")return{words:e?[e]:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};if(e==="")return{words:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};let{whitespace:n,nonWhitespace:r}=wu(t),s=[],i=0,o=!1,a=!1,l=i;for(;i<e.length&&n.has(e[i]);)i++;if(i>l&&(o=!0),i>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(r.has(e[i]))for(s.push(""),i++;i<e.length&&n.has(e[i]);)i++;for(;i<e.length;){let c=i;for(;i<e.length;){let f=e[i];if(n.has(f)||r.has(f))break;i++}if(s.push(e.substring(c,i)),i>=e.length){a=!1;break}let u=i;for(;i<e.length&&n.has(e[i]);)i++;if(i<e.length&&r.has(e[i])){for(i++;i<e.length&&n.has(e[i]);)i++;for(;i<e.length&&r.has(e[i]);)for(s.push(""),i++;i<e.length&&n.has(e[i]);)i++}i>=e.length&&i>u&&(a=!0)}return{words:s,hadLeadingDelimiter:o,hadTrailingDelimiter:a}}function Ve(e,t){return ia(e,t).words}function yS(e,t){for(let n of e)if(t.has(n))return!0;return!1}function Ug(e,t,n){if(t==="")return e;let{whitespace:r,nonWhitespace:s}=wu(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(!yS(a,s))return a}return o}var mS,an=v(()=>{"use strict";mS=`
778
+ `});function We(e,t){return e.state.namerefs?.has(t)??!1}function sr(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function Bg(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function Wg(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function zg(e,t){return e.state.invalidNamerefs?.has(t)??!1}function xu(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function oa(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let s=n[1],i=Array.from(e.state.env.keys()).some(a=>a.startsWith(`${s}_`)&&!a.includes("__")),o=e.state.associativeArrays?.has(s)??!1;return i||o}return Array.from(e.state.env.keys()).some(s=>s.startsWith(`${t}_`)&&!s.includes("__"))?!0:e.state.env.has(t)}function Mt(e,t,n=100){if(!We(e,t)||zg(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!We(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 Kr(e,t){if(We(e,t))return e.state.env.get(t)}function Hg(e,t,n,r=100){if(!We(e,t)||zg(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!We(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)&&oa(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o))return i;i=o}}var In=v(()=>{"use strict"});function wS(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 ce(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)?Nn(e,t).map(i=>[i,e.state.env.get(`${t}_${i}`)??""]):ut(e,t).map(s=>[s,e.state.env.get(`${t}_${s}`)??""])}function ir(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)?Nn(e,t).length>0:ut(e,t).length>0}async function Ie(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(me(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 F2;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 Rt("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 Rt("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 Rt("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new Pt(`\${${t}}`);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let o=s[1],a=s[2];if(We(e,o)){let f=Mt(e,o);if(f&&f!==o){if(f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";o=f}}if(a==="@"||a==="*"){let f=ce(e,o);if(f.length>0)return f.map(([,h])=>h).join(" ");let p=e.state.env.get(o);return p!==void 0?p:""}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 p=e.state.callLineStack?.[f];return p!==void 0?String(p):""}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=ra(a);f=wS(e,f);let p=e.state.env.get(`${o}_${f}`);if(p===void 0&&n&&e.state.options.nounset)throw new Rt(`${o}[${a}]`);return p||""}let c;if(/^-?\d+$/.test(a))c=Number.parseInt(a,10);else try{let f=new pe,p=Ne(f,a);c=await re(e,p.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=ce(e,o),p=e.state.currentLine;if(f.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${o}: bad array subscript
779
+ `,"";let d=Math.max(...f.map(([g])=>typeof g=="number"?g:0))+1+c;return d<0?(e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${o}: bad array subscript
780
+ `,""):e.state.env.get(`${o}_${d}`)||""}let u=e.state.env.get(`${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 Rt(`${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 Rt(t);return o||""}if(We(e,t)){let o=Mt(e,t);if(o===void 0)return"";if(o!==t)return await Ie(e,o,n,r);let a=e.state.env.get(t);if((a===void 0||a==="")&&n&&e.state.options.nounset)throw new Rt(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(ir(e,t)){let o=e.state.env.get(`${t}_0`);return o!==void 0?o:""}if(n&&e.state.options.nounset)throw new Rt(t);return""}async function Vn(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(We(e,s)){let l=Mt(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return ce(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=ra(i);return e.state.env.has(`${s}_${l}`)}let a;if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else try{let l=new pe,c=Ne(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=ce(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:e.state.env.has(`${s}_${u}`)}return e.state.env.has(`${s}_${a}`)}if(We(e,t)){let s=Mt(e,t);return s===void 0||s===t?e.state.env.has(t):Vn(e,s)}return!!(e.state.env.has(t)||ir(e,t))}var Xt=v(()=>{"use strict";Ot();ct();Wc();Ut();Ae();yn();an();In()});async function jg(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 Ie(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 Ie(e,i);n+=o,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await Ie(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 Ie(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 Eu(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 Ie(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 Ie(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}var Gg=v(()=>{"use strict";Xt()});function bS(e,t,n,r,s){let i=n??1;i===0&&(i=1);let o=Math.abs(i),a=[],l=0;r?.match(/^-?0\d/)&&(l=Math.max(l,r.replace(/^-/,"").length)),s?.match(/^-?0\d/)&&(l=Math.max(l,s.replace(/^-/,"").length));let c=u=>{if(l>0){let f=u<0,p=String(Math.abs(u)).padStart(l,"0");return f?`-${p}`:p}return String(u)};if(e<=t)for(let u=e,f=0;u<=t&&f<aa;u+=o,f++)a.push(c(u));else for(let u=e,f=0;u>=t&&f<aa;u-=o,f++)a.push(c(u));return a}function xS(e,t,n){let r=n??1;r===0&&(r=1);let s=e.charCodeAt(0),i=t.charCodeAt(0),o=Math.abs(r),a=e>="A"&&e<="Z",l=e>="a"&&e<="z",c=t>="A"&&t<="Z",u=t>="a"&&t<="z";if(a&&u||l&&c){let p=n!==void 0?`..${n}`:"";throw new is(`{${e}..${t}${p}}: invalid sequence`)}let f=[];if(s<=i)for(let p=s,h=0;p<=i&&h<aa;p+=o,h++)f.push(String.fromCharCode(p));else for(let p=s,h=0;p>=i&&h<aa;p-=o,h++)f.push(String.fromCharCode(p));return f}function Au(e,t,n,r,s){let i=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:bS(e,t,n,r,s),literal:`{${e}..${t}${i}}`}:typeof e=="string"&&typeof t=="string"?{expanded:xS(e,t,n),literal:`{${e}..${t}${i}}`}:{expanded:null,literal:`{${e}..${t}${i}}`}}var aa,Vg=v(()=>{"use strict";Ae();aa=1e4});function qg(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}}var Zg=v(()=>{"use strict"});function qn(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function Su(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 Yt(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function Ps(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}var Ds=v(()=>{"use strict"});function Ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var _s=v(()=>{"use strict"});function xe(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=ES(e,s+1);if(o!==-1){let a=e.slice(s+2,o),c=AS(a).map(f=>xe(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=SS(e,s);if(o===-1)r+="\\[",s++;else{let a=e.slice(s+1,o);r+=CS(a),s=o+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function ES(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 AS(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 SS(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 CS(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+=kS(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}function kS(e){return vS.get(e)??""}var vS,Fs=v(()=>{"use strict";vS=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 or(e,t,n,r){if(n==="prefix")return Q(`^${t}`,"s").replace(e,"");let s=Q(`${t}$`,"s");if(r)return s.replace(e,"");for(let i=e.length;i>=0;i--){let o=e.slice(i);if(s.test(o))return e.slice(0,i)}return e}function Ls(e,t){let n=Array.from(e.state.env.keys()),r=new Set,s=e.state.associativeArrays??new Set,i=new Set;for(let a of n){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l&&i.add(l[1]);let c=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);c&&i.add(c[1])}let o=a=>{for(let l of s){let c=`${l}_`;if(a.startsWith(c)&&a!==l)return!0}return!1};for(let a of n)if(a.startsWith(t))if(a.includes("__")){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);l?.[1].startsWith(t)&&r.add(l[1])}else if(/_\d+$/.test(a)){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l?.[1].startsWith(t)&&r.add(l[1])}else o(a)||r.add(a);return[...r].sort()}var Qr=v(()=>{"use strict";Ze()});function NS(e,t){let n=(i,o=2)=>String(i).padStart(o,"0");if(e===""){let i=n(t.getHours()),o=n(t.getMinutes()),a=n(t.getSeconds());return`${i}:${o}:${a}`}let r="",s=0;for(;s<e.length;)if(e[s]==="%"){if(s+1>=e.length){r+="%",s++;continue}let i=e[s+1];switch(i){case"H":r+=n(t.getHours());break;case"M":r+=n(t.getMinutes());break;case"S":r+=n(t.getSeconds());break;case"d":r+=n(t.getDate());break;case"m":r+=n(t.getMonth()+1);break;case"Y":r+=t.getFullYear();break;case"y":r+=n(t.getFullYear()%100);break;case"I":{let o=t.getHours()%12;o===0&&(o=12),r+=n(o);break}case"p":r+=t.getHours()<12?"AM":"PM";break;case"P":r+=t.getHours()<12?"am":"pm";break;case"%":r+="%";break;case"a":{r+=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getDay()];break}case"b":{r+=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()];break}default:r+=`%${i}`}s+=2}else r+=e[s],s++;return r}function ki(e,t){let n="",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,p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],d=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let m=t[r];if(m==="\\"){if(r+1>=t.length){n+="\\",r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let y="",b=r+1;for(;b<t.length&&b<r+4&&t[b]>="0"&&t[b]<="7";)y+=t[b],b++;let w=Number.parseInt(y,8)%256;n+=String.fromCharCode(w),r=b;continue}switch(g){case"\\":n+="\\",r+=2;break;case"a":n+="\x07",r+=2;break;case"e":n+="\x1B",r+=2;break;case"n":n+=`
781
+ `,r+=2;break;case"r":n+="\r",r+=2;break;case"$":n+="$",r+=2;break;case"[":case"]":r+=2;break;case"u":n+=s,r+=2;break;case"h":n+=o,r+=2;break;case"H":n+=i,r+=2;break;case"w":n+=c,r+=2;break;case"W":n+=u,r+=2;break;case"d":{let y=String(f.getDate()).padStart(2," ");n+=`${p[f.getDay()]} ${h[f.getMonth()]} ${y}`,r+=2;break}case"t":{let y=String(f.getHours()).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),w=String(f.getSeconds()).padStart(2,"0");n+=`${y}:${b}:${w}`,r+=2;break}case"T":{let y=f.getHours()%12;y===0&&(y=12);let b=String(y).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0"),x=String(f.getSeconds()).padStart(2,"0");n+=`${b}:${w}:${x}`,r+=2;break}case"@":{let y=f.getHours()%12;y===0&&(y=12);let b=String(y).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0"),x=f.getHours()<12?"AM":"PM";n+=`${b}:${w} ${x}`,r+=2;break}case"A":{let y=String(f.getHours()).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0");n+=`${y}:${b}`,r+=2;break}case"D":if(r+2<t.length&&t[r+2]==="{"){let y=t.indexOf("}",r+3);if(y!==-1){let b=t.slice(r+3,y);n+=NS(b,f),r=y+1}else n+="\\D",r+=2}else n+="\\D",r+=2;break;case"s":n+="bash",r+=2;break;case"v":n+="5.0",r+=2;break;case"V":n+="5.0.0",r+=2;break;case"j":n+="0",r+=2;break;case"l":n+="tty",r+=2;break;case"#":n+=d,r+=2;break;case"!":n+=d,r+=2;break;case"x":n+="\\x",r+=2;break;default:n+=`\\${g}`,r+=2}}else n+=m,r++}return n}var Cu=v(()=>{"use strict"});function br(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`
782
+ `: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}'`}var vu=v(()=>{"use strict"});function Jt(e,t){e.state.readonlyVars=e.state.readonlyVars||new Set,e.state.readonlyVars.add(t)}function Zn(e,t){return e.state.readonlyVars?.has(t)??!1}function bt(e,t,n="bash"){if(Zn(e,t)){let r=`${n}: ${t}: readonly variable
783
+ `;throw new we(1,"",r)}return null}function $n(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 la(e,t){e.state.exportedVars?.delete(t)}var xr=v(()=>{"use strict";Ae()});function Er(e,t){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return"";let n="",r=e.state.env.has(`${t}__length`)||Array.from(e.state.env.keys()).some(i=>i.startsWith(`${t}_`)&&/^[0-9]+$/.test(i.slice(t.length+1))),s=e.state.associativeArrays?.has(t)??!1;return r&&!s&&(n+="a"),s&&(n+="A"),e.state.integerVars?.has(t)&&(n+="i"),We(e,t)&&(n+="n"),Zn(e,t)&&(n+="r"),e.state.exportedVars?.has(t)&&(n+="x"),n}var ca=v(()=>{"use strict";In();xr()});async function Kg(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 Qg(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 p=new pe,h=Ne(p,c);u=await re(e,h.expression)}catch{let p=e.state.env.get(c);u=p?Number.parseInt(p,10):0}Number.isNaN(u)&&(u=0)}e.state.env.set(`${l}_${u}`,o);let f=Number.parseInt(e.state.env.get(`${l}__length`)||"0",10);u>=f&&e.state.env.set(`${l}__length`,String(u+1))}else e.state.env.set(t,o);return o}return r.effectiveValue}async function Xg(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 we(1,"",`bash: ${o}
784
+ `)}return r.effectiveValue}async function Yg(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 Jg(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_removal");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let l of n.pattern.parts)if(l.type==="Glob")i+=xe(l.pattern,n.greedy,o);else if(l.type==="Literal")i+=xe(l.value,n.greedy,o);else if(l.type==="SingleQuoted"||l.type==="Escaped")i+=Ce(l.value);else if(l.type==="DoubleQuoted"){let c=await r(e,l.parts);i+=Ce(c)}else if(l.type==="ParameterExpansion"){let c=await s(e,l);i+=xe(c,n.greedy,o)}else{let c=await s(e,l);i+=Ce(c)}if(n.side==="prefix")return Q(`^${i}`,"s").replace(t,"");let a=Q(`${i}$`,"s");if(n.greedy)return a.replace(t,"");for(let l=t.length;l>=0;l--){let c=t.slice(l);if(a.test(c))return t.slice(0,l)}return t}async function e6(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+=xe(c.pattern,!0,o);else if(c.type==="Literal")i+=xe(c.value,!0,o);else if(c.type==="SingleQuoted"||c.type==="Escaped")i+=Ce(c.value);else if(c.type==="DoubleQuoted"){let u=await r(e,c.parts);i+=Ce(u)}else if(c.type==="ParameterExpansion"){let u=await s(e,c);i+=xe(u,!0,o)}else{let u=await s(e,c);i+=Ce(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=Q(i,l);if(n.all){let u="",f=0,p=0,h=e.limits.maxStringLength,d=c.exec(t);for(;d!==null&&!(d[0].length===0&&d.index===t.length);){if(u+=t.slice(f,d.index)+a,f=d.index+d[0].length,d[0].length===0&&f++,p++,p%100===0&&u.length>h)throw new X(`pattern replacement: string length limit exceeded (${h} bytes)`,"string_length");d=c.exec(t)}return u+=t.slice(f),u}return c.replace(t,a)}catch(c){if(c instanceof X)throw c;return t}}function t6(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=ce(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)&&ir(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=e.state.env.get(`${t}_0`)||"";return String([...s].length)}return String([...n].length)}async function n6(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 d=1;d<=c;d++)u.push(e.state.env.get(String(d))||"");let f=e.state.env.get("0")||"bash",p,h;if(s<=0)if(p=[f,...u],s<0){if(h=p.length+s,h<0)return""}else h=0;else p=u,h=s-1;if(h<0||h>=p.length)return"";if(i!==void 0){let d=i<0?p.length+i:h+i;return p.slice(h,Math.max(h,d)).join(" ")}return p.slice(h).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 we(1,"",`bash: \${${c}[@]: 0: 3}: bad substitution
785
+ `);let u=ce(e,c),f=0;if(s<0){if(u.length>0){let p=u[u.length-1][0],d=(typeof p=="number"?p:0)+1+s;if(d<0||(f=u.findIndex(([m])=>typeof m=="number"&&m>=d),f<0))return""}}else if(f=u.findIndex(([p])=>typeof p=="number"&&p>=s),f<0)return"";if(i!==void 0){if(i<0)throw new Le(`${o[1]}[@]: substring expression < 0`);return u.slice(f,f+i).map(([,p])=>p).join(" ")}return u.slice(f).map(([,p])=>p).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 r6(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+=xe(f.pattern,!0,i);else if(f.type==="Literal")o+=xe(f.value,!0,i);else if(f.type==="SingleQuoted"||f.type==="Escaped")o+=Ce(f.value);else if(f.type==="DoubleQuoted"){let p=await r(e,f.parts);o+=Ce(p)}else if(f.type==="ParameterExpansion"){let p=await s(e,f);o+=xe(p,!0,i)}let a=Q(`^(?:${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 s6(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 ce(e,i[1]).map(([,c])=>br(c)).join(" ");if(i&&s.operator==="a")return Er(e,i[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&s.operator==="a")return Er(e,o[1]);switch(s.operator){case"Q":return r?"":br(n);case"P":return ki(e,n);case"a":return Er(e,t);case"A":return r?"":`${t}=${br(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`
786
+ `;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?"":br(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 i6(e,t,n,r,s,i,o=!1){if(e.coverage?.hit("bash:expansion:indirection"),We(e,t))return Kr(e,t)||"";let a=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new Pt(`\${!${t}}`)}let l=n;if(a&&(l===""||l.includes(" ")))throw new Pt(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new Pt(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,o)}return await Ie(e,l)}function o6(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=ce(e,t.array).map(([s])=>String(s));return t.star?r.join(me(e.state.env)):r.join(" ")}function a6(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=Ls(e,t.prefix);return t.star?n.join(me(e.state.env)):n.join(" ")}function l6(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=ce(e,o);if(l.length===0)return{isEmpty:!0,effectiveValue:""};if(a==="*"){let c=me(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}}var c6=v(()=>{"use strict";Ot();ct();Ze();Ut();Ae();an();In();_s();Fs();Qr();Cu();vu();Xt();ca()});function u6(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 f6(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 ua(e,t){let n=new pe,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=e.state.cwd,a=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let l=await e.executeScript(r),c=l.exitCode;return e.state.env=i,e.state.cwd=o,e.state.suppressVerbose=a,e.state.lastExitCode=c,e.state.env.set("?",String(c)),l.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+l.stderr),e.state.bashPid=s,l.stdout.replace(/\n+$/,"")}catch(l){if(e.state.env=i,e.state.cwd=o,e.state.bashPid=s,e.state.suppressVerbose=a,l instanceof X)throw l;return l instanceof we?(e.state.lastExitCode=l.exitCode,e.state.env.set("?",String(l.exitCode)),l.stdout?.replace(/\n+$/,"")??""):""}}function ku(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+=Yt(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=IS(e,a);n+=Yt(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 IS(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 p6(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+=Yt(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 $S(e,a);n+=Yt(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=f6(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await ua(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 ua(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 $S(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=f6(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await ua(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 ua(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}var h6=v(()=>{"use strict";ct();Ae();Ds()});function d6(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}var m6=v(()=>{"use strict"});async function OS(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=xe(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=xe(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=Ce(i.value);else if(i.type==="DoubleQuoted"){let o=await n(e,i.parts);s+=Ce(o)}else if(i.type==="ParameterExpansion"){let o=await r(e,i);s+=xe(o,!0,e.state.shoptOptions.extglob)}else{let o=await r(e,i);s+=Ce(o)}return s}async function g6(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=ce(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 p="";c.pattern&&(p=await OS(e,c.pattern,n,r));let h=c.replacement?await n(e,c.replacement.parts):"",d=p;c.anchor==="start"?d=`^${p}`:c.anchor==="end"&&(d=`${p}$`);let m=[];try{let g=Q(d,c.all?"g":"");for(let y of f)m.push(g.replace(y,h))}catch{m.push(...f)}if(l){let g=me(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function y6(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=ce(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 p="",h=e.state.shoptOptions.extglob;if(c.pattern)for(let m of c.pattern.parts)if(m.type==="Glob")p+=xe(m.pattern,c.greedy,h);else if(m.type==="Literal")p+=xe(m.value,c.greedy,h);else if(m.type==="SingleQuoted"||m.type==="Escaped")p+=Ce(m.value);else if(m.type==="DoubleQuoted"){let g=await n(e,m.parts);p+=Ce(g)}else if(m.type==="ParameterExpansion"){let g=await r(e,m);p+=xe(g,c.greedy,h)}else{let g=await r(e,m);p+=Ce(g)}let d=[];for(let m of f)d.push(or(m,p,c.side,c.greedy));if(l){let m=me(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,quoted:!0}}var w6=v(()=>{"use strict";Ze();an();_s();Fs();Qr();Xt()});async function b6(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=ce(e,l),u=c.length>0||e.state.env.has(l),f=c.length===0||c.length===1&&c.every(([,h])=>h===""),p=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=u&&!(p&&f):o=!u||p&&f,!o){if(c.length>0){let d=c.map(([,m])=>m);if(a){let m=me(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,quoted:!0}}let h=e.state.env.get(l);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}}else{let l=r.parameter,c=await Vn(e,l),u=await Ie(e,l),f=u==="",p=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=c&&!(p&&f):o=!c||p&&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 p=f.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(p){c=p[1],u=p[2]==="*";break}}if(c){let f=ce(e,c);if(f.length>0){let h=f.map(([,d])=>d);if(u||a){let d=me(e.state.env);return{values:[h.join(d)],quoted:!0}}return{values:h,quoted:!0}}let p=e.state.env.get(c);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}}return null}async function x6(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 y=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(y){o=m,a=y[1],l=y[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 p=ce(e,a),h=p.map(([,m])=>m);if(p.length===0){let m=e.state.env.get(a);if(m!==void 0)h=[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="",y=e.state.shoptOptions.extglob;if(m.pattern)for(let b of m.pattern.parts)if(b.type==="Glob")g+=xe(b.pattern,m.greedy,y);else if(b.type==="Literal")g+=xe(b.value,m.greedy,y);else if(b.type==="SingleQuoted"||b.type==="Escaped")g+=Ce(b.value);else if(b.type==="DoubleQuoted"){let w=await s(e,b.parts);g+=Ce(w)}else if(b.type==="ParameterExpansion"){let w=await r(e,b);g+=xe(w,m.greedy,y)}else{let w=await r(e,b);g+=Ce(w)}h=h.map(b=>or(b,g,m.side,m.greedy))}else if(c?.type==="PatternReplacement"){let m=c,g="";if(m.pattern)for(let w of m.pattern.parts)if(w.type==="Glob")g+=xe(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")g+=xe(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")g+=Ce(w.value);else if(w.type==="DoubleQuoted"){let x=await s(e,w.parts);g+=Ce(x)}else if(w.type==="ParameterExpansion"){let x=await r(e,w);g+=xe(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,w);g+=Ce(x)}let y=m.replacement?await s(e,m.replacement.parts):"",b=g;m.anchor==="start"?b=`^${g}`:m.anchor==="end"&&(b=`${g}$`);try{let w=Q(b,m.all?"g":"");h=h.map(x=>w.replace(x,y))}catch{}}if(l){let m=me(e.state.env);return{values:[u+h.join(m)+f],quoted:!0}}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 E6(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 h=0;h<s.parts.length;h++){let d=s.parts[h];if(d.type==="ParameterExpansion"&&!d.operation){let m=d.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(m){i=h,o=m[1],a=m[2]==="*";break}}}if(i===-1)return null;let l="";for(let h=0;h<i;h++)l+=await r(e,s.parts[h]);let c="";for(let h=i+1;h<s.parts.length;h++)c+=await r(e,s.parts[h]);let u=ce(e,o),f=u.map(([,h])=>h);if(u.length===0){let h=e.state.env.get(o);if(h!==void 0)return{values:[l+h+c],quoted:!0};if(a)return{values:[l+c],quoted:!0};let d=l+c;return{values:d?[d]:[],quoted:!0}}if(a){let h=me(e.state.env);return{values:[l+f.join(h)+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}}var A6=v(()=>{"use strict";Ze();an();_s();Fs();Qr();Xt()});async function S6(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 we(1,"",`bash: \${${o}[@]: 0: 3}: bad substitution
787
+ `);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=ce(e,o),p=0;if(c<0){if(f.length>0){let d=f[f.length-1][0],g=(typeof d=="number"?d:0)+1+c;if(g<0)return{values:[],quoted:!0};p=f.findIndex(([y])=>typeof y=="number"&&y>=g),p<0&&(p=f.length)}}else p=f.findIndex(([d])=>typeof d=="number"&&d>=c),p<0&&(p=f.length);let h;if(u!==void 0){if(u<0)throw new Le(`${o}[@]: substring expression < 0`);h=f.slice(p,p+u).map(([,d])=>d)}else h=f.slice(p).map(([,d])=>d);if(h.length===0)return{values:[],quoted:!0};if(a){let d=me(e.state.env);return{values:[h.join(d)],quoted:!0}}return{values:h,quoted:!0}}function C6(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=ce(e,i);if(l.length===0){let f=e.state.env.get(i);if(f!==void 0){let p;switch(a.operator){case"a":p="";break;case"P":p=ki(e,f);break;case"Q":p=br(f);break;default:p=f}return{values:[p],quoted:!0}}return o?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=Er(e,i),u;switch(a.operator){case"a":u=l.map(()=>c);break;case"P":u=l.map(([,f])=>ki(e,f));break;case"Q":u=l.map(([,f])=>br(f));break;case"u":u=l.map(([,f])=>f.charAt(0).toUpperCase()+f.slice(1));break;case"U":u=l.map(([,f])=>f.toUpperCase());break;case"L":u=l.map(([,f])=>f.toLowerCase());break;default:u=l.map(([,f])=>f)}if(o){let f=me(e.state.env);return{values:[u.join(f)],quoted:!0}}return{values:u,quoted:!0}}var v6=v(()=>{"use strict";Ae();an();Cu();vu();Xt();ca()});function k6(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(We(e,i)){let l=Kr(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let o=ce(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 N6(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)||!We(e,s))return null;let i=Kr(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=ce(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}}var I6=v(()=>{"use strict";In();Xt()});async function $6(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 Ie(e,o.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!a.innerOp&&(l==="@"||l==="*")){let d=Number.parseInt(e.state.env.get("#")||"0",10),m=[];for(let g=1;g<=d;g++)m.push(e.state.env.get(String(g))||"");return l==="*"?{values:[m.join(me(e.state.env))],quoted:!0}:{values:m,quoted:!0}}return null}let u=c[1],f=c[2]==="*",p=ce(e,u);if(a.innerOp){if(a.innerOp.type==="Substring")return TS(e,p,u,f,a.innerOp);if(a.innerOp.type==="DefaultValue"||a.innerOp.type==="UseAlternative"||a.innerOp.type==="AssignDefault"||a.innerOp.type==="ErrorIfUnset")return RS(e,p,u,f,a.innerOp,s);if(a.innerOp.type==="Transform"&&a.innerOp.operator==="a"){let m=Er(e,u),g=p.map(()=>m);return f?{values:[g.join(me(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let d=[];for(let[,m]of p){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:a.innerOp},y=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",m);try{let b=await r(e,g,!0);d.push(b)}finally{y!==void 0?e.state.env.set("_indirect_elem_",y):e.state.env.delete("_indirect_elem_")}}return f?{values:[d.join(me(e.state.env))],quoted:!0}:{values:d,quoted:!0}}if(p.length>0){let d=p.map(([,m])=>m);return f?{values:[d.join(me(e.state.env))],quoted:!0}:{values:d,quoted:!0}}let h=e.state.env.get(u);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}async function TS(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],p=(typeof u=="number"?u:0)+1+i;if(p<0)return{values:[],quoted:!0};if(a=t.findIndex(([h])=>typeof h=="number"&&h>=p),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 Le(`${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(me(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function RS(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(me(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 e.state.env.set(`${n}_0`,f),e.state.env.set(`${n}__length`,"1"),{values:[f],quoted:!0}}return r?{values:[a.join(me(e.state.env))],quoted:!0}:{values:a,quoted:!0}}return r?{values:[a.join(me(e.state.env))],quoted:!0}:{values:a,quoted:!0}}async function O6(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 Ie(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await Vn(e,n.parameter),u=await Ie(e,n.parameter)==="",f=r.checkEmpty??!1,p;if(r.type==="UseAlternative"?p=c&&!(f&&u):p=!c||f&&u,p){let h=l[1],d=l[2]==="*",m=ce(e,h);if(m.length>0){let y=m.map(([,b])=>b);return d?{values:[y.join(me(e.state.env))],quoted:!0}:{values:y,quoted:!0}}let g=e.state.env.get(h);return g!==void 0?{values:[g],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function T6(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 Ie(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await Ie(e,n.parameter),f=await Vn(e,n.parameter),p=u==="",h=s.checkEmpty??!1,d;if(s.type==="UseAlternative"?d=f&&!(h&&p):d=!f||h&&p,d){let m=c[1],g=c[2]==="*",y=ce(e,m);if(y.length>0){let w=y.map(([,x])=>x);return g?{values:[w.join(me(e.state.env))],quoted:!0}:{values:w,quoted:!0}}let b=e.state.env.get(m);return b!==void 0?{values:[b],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}var R6=v(()=>{"use strict";Ut();Ae();an();Xt();ca()});function P6(e){let t=Number.parseInt(e.state.env.get("#")||"0",10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||"");return n}async function D6(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==="Substring"){i=b,o=w.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),p=[];for(let b=1;b<=f;b++)p.push(e.state.env.get(String(b))||"");let h=e.state.env.get("0")||"bash",d;if(c<=0){let b=[h,...p],w=b.length+c;if(w<0)d=[];else{let x=c<0?w:0;if(u!==void 0){let A=u<0?b.length+u:x+u;d=b.slice(x,Math.max(x,A))}else d=b.slice(x)}}else{let b=c-1;if(b>=p.length)d=[];else if(u!==void 0){let w=u<0?p.length+u:b+u;d=p.slice(b,Math.max(b,w))}else d=p.slice(b)}let m="";for(let b=0;b<i;b++)m+=await r(e,s.parts[b]);let g="";for(let b=i+1;b<s.parts.length;b++)g+=await r(e,s.parts[b]);if(d.length===0){let b=m+g;return{values:b?[b]:[],quoted:!0}}if(o){let b=me(e.state.env);return{values:[m+d.join(b)+g],quoted:!0}}return d.length===1?{values:[m+d[0]+g],quoted:!0}:{values:[m+d[0],...d.slice(1,-1),d[d.length-1]+g],quoted:!0}}async function _6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let y=0;y<s.parts.length;y++){let b=s.parts[y];if(b.type==="ParameterExpansion"&&(b.parameter==="@"||b.parameter==="*")&&b.operation?.type==="PatternReplacement"){i=y,o=b.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=P6(e),u="";for(let y=0;y<i;y++)u+=await n(e,s.parts[y]);let f="";for(let y=i+1;y<s.parts.length;y++)f+=await n(e,s.parts[y]);if(c.length===0){let y=u+f;return{values:y?[y]:[],quoted:!0}}let p="";if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")p+=xe(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")p+=xe(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")p+=Ce(y.value);else if(y.type==="DoubleQuoted"){let b=await r(e,y.parts);p+=Ce(b)}else if(y.type==="ParameterExpansion"){let b=await n(e,y);p+=xe(b,!0,e.state.shoptOptions.extglob)}else{let b=await n(e,y);p+=Ce(b)}let h=l.replacement?await r(e,l.replacement.parts):"",d=p;l.anchor==="start"?d=`^${p}`:l.anchor==="end"&&(d=`${p}$`);let m=[];try{let y=Q(d,l.all?"g":"");for(let b of c)m.push(y.replace(b,h))}catch{m.push(...c)}if(o){let y=me(e.state.env);return{values:[u+m.join(y)+f],quoted:!0}}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 F6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let g=0;g<s.parts.length;g++){let y=s.parts[g];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){i=g,o=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=P6(e),u="";for(let g=0;g<i;g++)u+=await n(e,s.parts[g]);let f="";for(let g=i+1;g<s.parts.length;g++)f+=await n(e,s.parts[g]);if(c.length===0){let g=u+f;return{values:g?[g]:[],quoted:!0}}let p="",h=e.state.shoptOptions.extglob;if(l.pattern)for(let g of l.pattern.parts)if(g.type==="Glob")p+=xe(g.pattern,l.greedy,h);else if(g.type==="Literal")p+=xe(g.value,l.greedy,h);else if(g.type==="SingleQuoted"||g.type==="Escaped")p+=Ce(g.value);else if(g.type==="DoubleQuoted"){let y=await r(e,g.parts);p+=Ce(y)}else if(g.type==="ParameterExpansion"){let y=await n(e,g);p+=xe(y,l.greedy,h)}else{let y=await n(e,g);p+=Ce(y)}let d=[];for(let g of c)d.push(or(g,p,l.side,l.greedy));if(o){let g=me(e.state.env);return{values:[u+d.join(g)+f],quoted:!0}}return d.length===1?{values:[u+d[0]+f],quoted:!0}:{values:[u+d[0],...d.slice(1,-1),d[d.length-1]+f],quoted:!0}}async function L6(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0],s=-1,i=!1;for(let p=0;p<r.parts.length;p++){let h=r.parts[p];if(h.type==="ParameterExpansion"&&(h.parameter==="@"||h.parameter==="*")){s=p,i=h.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 p=0;p<s;p++)l+=await n(e,r.parts[p]);let c="";for(let p=s+1;p<r.parts.length;p++)c+=await n(e,r.parts[p]);if(a===0){if(i)return{values:[l+c],quoted:!0};let p=l+c;return{values:p?[p]:[],quoted:!0}}let u=[];for(let p=1;p<=a;p++)u.push(e.state.env.get(String(p))||"");if(i){let p=me(e.state.env);return{values:[l+u.join(p)+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}}var M6=v(()=>{"use strict";Ze();an();_s();Fs();Qr()});function PS(e){return new wr(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})}async function fa(e,t){if(e.state.options.noglob)return t;let n=PS(e),r=[];for(let s of t)if(qn(s,e.state.shoptOptions.extglob)){let i=await n.expand(s);if(i.length>0)r.push(...i);else{if(n.hasFailglob())throw new Fn(s);n.hasNullglob()||r.push(s)}}else r.push(s);return r}async function U6(e,t,n,r){let s=-1,i="",o=!1;for(let b=0;b<t.length;b++){let w=t[b];if(w.type==="ParameterExpansion"&&w.operation?.type==="PatternReplacement"){let x=w.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(x){s=b,i=x[1],o=x[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=ce(e,i),u=c.map(([,b])=>b);if(c.length===0){let b=e.state.env.get(i);b!==void 0&&(u=[b])}if(u.length===0)return{values:[],quoted:!1};let f="";if(l.pattern)for(let b of l.pattern.parts)if(b.type==="Glob")f+=xe(b.pattern,!0,e.state.shoptOptions.extglob);else if(b.type==="Literal")f+=xe(b.value,!0,e.state.shoptOptions.extglob);else if(b.type==="SingleQuoted"||b.type==="Escaped")f+=Ce(b.value);else if(b.type==="DoubleQuoted"){let w=await n(e,b.parts);f+=Ce(w)}else if(b.type==="ParameterExpansion"){let w=await r(e,b);f+=xe(w,!0,e.state.shoptOptions.extglob)}else{let w=await r(e,b);f+=Ce(w)}let p=l.replacement?await n(e,l.replacement.parts):"",h=f;l.anchor==="start"?h=`^${f}`:l.anchor==="end"&&(h=`${f}$`);let d=[];try{let b=Q(h,l.all?"g":"");for(let w of u)d.push(b.replace(w,p))}catch{d.push(...u)}let m=yt(e.state.env),g=kt(e.state.env);if(o){let b=me(e.state.env),w=d.join(b);return g?{values:w?[w]:[],quoted:!1}:{values:Ve(w,m),quoted:!1}}if(g)return{values:d,quoted:!1};let y=[];for(let b of d)b===""?y.push(""):y.push(...Ve(b,m));return{values:y,quoted:!1}}async function B6(e,t,n,r){let s=-1,i="",o=!1;for(let y=0;y<t.length;y++){let b=t[y];if(b.type==="ParameterExpansion"&&b.operation?.type==="PatternRemoval"){let w=b.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(w){s=y,i=w[1],o=w[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=ce(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="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")f+=xe(y.pattern,l.greedy,p);else if(y.type==="Literal")f+=xe(y.value,l.greedy,p);else if(y.type==="SingleQuoted"||y.type==="Escaped")f+=Ce(y.value);else if(y.type==="DoubleQuoted"){let b=await n(e,y.parts);f+=Ce(b)}else if(y.type==="ParameterExpansion"){let b=await r(e,y);f+=xe(b,l.greedy,p)}else{let b=await r(e,y);f+=Ce(b)}let h=[];for(let y of u)h.push(or(y,f,l.side,l.greedy));let d=yt(e.state.env),m=kt(e.state.env);if(o){let y=me(e.state.env),b=h.join(y);return m?{values:b?[b]:[],quoted:!1}:{values:Ve(b,d),quoted:!1}}if(m)return{values:h,quoted:!1};let g=[];for(let y of h)y===""?g.push(""):g.push(...Ve(y,d));return{values:g,quoted:!1}}async function W6(e,t,n,r){let s=-1,i=!1;for(let g=0;g<t.length;g++){let y=t[g];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){s=g,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 g=1;g<=l;g++)c.push(e.state.env.get(String(g))||"");if(c.length===0)return{values:[],quoted:!1};let u="",f=e.state.shoptOptions.extglob;if(a.pattern)for(let g of a.pattern.parts)if(g.type==="Glob")u+=xe(g.pattern,a.greedy,f);else if(g.type==="Literal")u+=xe(g.value,a.greedy,f);else if(g.type==="SingleQuoted"||g.type==="Escaped")u+=Ce(g.value);else if(g.type==="DoubleQuoted"){let y=await n(e,g.parts);u+=Ce(y)}else if(g.type==="ParameterExpansion"){let y=await r(e,g);u+=xe(y,a.greedy,f)}else{let y=await r(e,g);u+=Ce(y)}let p=[];for(let g of c)p.push(or(g,u,a.side,a.greedy));let h=yt(e.state.env),d=kt(e.state.env);if(i){let g=me(e.state.env),y=p.join(g);return d?{values:y?[y]:[],quoted:!1}:{values:Ve(y,h),quoted:!1}}if(d)return{values:p,quoted:!1};let m=[];for(let g of p)g===""?m.push(""):m.push(...Ve(g,h));return{values:m,quoted:!1}}async function z6(e,t,n,r){let s=-1,i=!1;for(let w=0;w<t.length;w++){let x=t[w];if(x.type==="ParameterExpansion"&&(x.parameter==="@"||x.parameter==="*")&&x.operation?.type==="Substring"){s=w,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 w=1;w<=u;w++)f.push(e.state.env.get(String(w))||"");let p=e.state.env.get("0")||"bash",h;if(l<=0){let w=[p,...f],x=w.length+l;if(x<0)h=[];else{let A=l<0?x:0;if(c!==void 0){let I=c<0?w.length+c:A+c;h=w.slice(A,Math.max(A,I))}else h=w.slice(A)}}else{let w=l-1;if(w>=f.length)h=[];else if(c!==void 0){let x=c<0?f.length+c:w+c;h=f.slice(w,Math.max(w,x))}else h=f.slice(w)}let d="";for(let w=0;w<s;w++)d+=await r(e,t[w]);let m="";for(let w=s+1;w<t.length;w++)m+=await r(e,t[w]);let g=yt(e.state.env),y=kt(e.state.env);if(h.length===0){let w=d+m;return w?y?{values:[w],quoted:!1}:{values:Ve(w,g),quoted:!1}:{values:[],quoted:!1}}let b;if(i){let w=me(e.state.env),x=d+h.join(w)+m;y?b=x?[x]:[]:b=Ve(x,g)}else if(y)h.length===1?b=[d+h[0]+m]:b=[d+h[0],...h.slice(1,-1),h[h.length-1]+m];else{b=[];for(let w=0;w<h.length;w++){let x=h[w];if(w===0&&(x=d+x),w===h.length-1&&(x=x+m),x==="")b.push("");else{let A=Ve(x,g);b.push(...A)}}}return{values:await fa(e,b),quoted:!1}}async function H6(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=yt(e.state.env),o=kt(e.state.env),a=sa(e.state.env),l;if(n)if(o)l=s.filter(c=>c!=="");else{let c=me(e.state.env),u=s.join(c);l=Ve(u,i)}else if(o)l=s.filter(c=>c!=="");else if(a){l=[];for(let c of s){if(c==="")continue;let u=Ve(c,i);l.push(...u)}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=Ve(c,i);l.push(...u)}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await fa(e,l),quoted:!1}}async function j6(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=ce(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=yt(e.state.env),l=kt(e.state.env),c=sa(e.state.env),u;if(s)if(l)u=o.filter(f=>f!=="");else{let f=me(e.state.env),p=o.join(f);u=Ve(p,a)}else if(l)u=o.filter(f=>f!=="");else if(c){u=[];for(let f of o){if(f==="")continue;let p=Ve(f,a);u.push(...p)}}else{u=[];for(let f of o)if(f==="")u.push("");else{let p=Ve(f,a);u.push(...p)}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await fa(e,u),quoted:!1}}function G6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=Ls(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=yt(e.state.env),i=kt(e.state.env),o;if(n.star)if(i)o=r;else{let a=me(e.state.env),l=r.join(a);o=Ve(l,s)}else if(i)o=r;else{o=[];for(let a of r){let l=Ve(a,s);o.push(...l)}}return{values:o,quoted:!1}}function V6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=ce(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=yt(e.state.env),o=kt(e.state.env),a;if(n.star)if(o)a=s;else{let l=me(e.state.env),c=s.join(l);a=Ve(c,i)}else if(o)a=s;else{a=[];for(let l of s){let c=Ve(l,i);a.push(...c)}}return{values:a,quoted:!1}}async function q6(e,t,n){let r=-1;for(let p=0;p<t.length;p++){let h=t[p];if(h.type==="ParameterExpansion"&&(h.parameter==="@"||h.parameter==="*")&&!h.operation){r=p;break}}if(r===-1||t.length<=1)return null;let s=Number.parseInt(e.state.env.get("#")||"0",10),i=[];for(let p=1;p<=s;p++)i.push(e.state.env.get(String(p))||"");let o="";for(let p=0;p<r;p++)o+=await n(e,t[p]);let a="";for(let p=r+1;p<t.length;p++)a+=await n(e,t[p]);let l=yt(e.state.env),c=kt(e.state.env),u=sa(e.state.env);if(s===0){let p=o+a;return{values:p?[p]:[],quoted:!1}}let f;{let p=[];for(let h=0;h<i.length;h++){let d=i[h];h===0&&(d=o+d),h===i.length-1&&(d=d+a),p.push(d)}if(c)f=p.filter(h=>h!=="");else if(u){f=[];for(let h of p){if(h==="")continue;let d=Ve(h,l);f.push(...d)}}else{f=[];for(let h of p)if(h==="")f.push("");else{let d=Ve(h,l);f.push(...d)}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await fa(e,f),quoted:!1}}var Z6=v(()=>{"use strict";Ze();ta();Ae();an();_s();Ds();Fs();Qr();Xt()});async function X6(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}=vi(r),p=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(p&&p.length>1)return DS(e,p,s);let h=await _S(e,r,a,c,u,n);if(h!==null)return h;let d=await LS(e,r,n);if(d!==null)return d;let m=await MS(e,r,n);if(m!==null)return m;let g=await BS(e,r,n.expandPart);if(g!==null)return Q6(e,g);if((i||o||l)&&!kt(e.state.env)){let b=yt(e.state.env),w=n.buildIfsCharClassPattern(b),x=await n.smartWordSplit(e,r,b,w,n.expandPart);return Q6(e,x)}let y=await n.expandWordAsync(e,t);return WS(e,t,r,y,s,n.expandWordForGlobbing)}async function DS(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&qn(s,e.state.shoptOptions.extglob)){let i=await pa(e,s);r.push(...i)}else r.push(s);return{values:r,quoted:!1}}async function _S(e,t,n,r,s,i){if(n){let o=k6(e,t);if(o!==null)return o}{let o=N6(e,t);if(o!==null)return o}{let o=await b6(e,t);if(o!==null)return o}{let o=await x6(e,t,n,i.expandPart,i.expandWordPartsAsync);if(o!==null)return o}{let o=await E6(e,t,n,i.expandPart);if(o!==null)return o}{let o=await S6(e,t,i.evaluateArithmetic);if(o!==null)return o}{let o=C6(e,t);if(o!==null)return o}{let o=await g6(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}{let o=await y6(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let o=FS(e,t);if(o!==null)return o}{let o=await $6(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(o!==null)return o}{let o=await O6(e,t);if(o!==null)return o}{let o=await T6(e,t);if(o!==null)return o}return null}function FS(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=Ls(e,r.prefix);return r.star?{values:[s.join(me(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=ce(e,r.array).map(([o])=>String(o));return r.star?{values:[i.join(me(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function LS(e,t,n){{let r=await D6(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await _6(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await F6(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await L6(e,t,n.expandPart);if(r!==null)return r}return null}async function MS(e,t,n){{let r=await U6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await B6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await W6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await z6(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await H6(e,t);if(r!==null)return r}{let r=await j6(e,t);if(r!==null)return r}{let r=G6(e,t);if(r!==null)return r}{let r=V6(e,t);if(r!==null)return r}{let r=await q6(e,t,n.expandPart);if(r!==null)return r}return null}function K6(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 US(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=ce(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=me(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 BS(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(K6(l)){r=!0;break}if(!r)return null;let s=yt(e.state.env),i=kt(e.state.env),o=[];for(let l of t){let c=K6(l);if(c&&l.type==="DoubleQuoted"){let u=await US(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=Ve(u,s);o.push(f)}}else{let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=Ve(u,s);o.push(f)}}}let a=[];for(let l of o)if(l.length!==0)if(a.length===0)a.push(...l);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 Q6(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(qn(r,e.state.shoptOptions.extglob)){let s=await pa(e,r);n.push(...s)}else n.push(r);return{values:n,quoted:!1}}async function pa(e,t){let n=new wr(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}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new Fn(t);return n.hasNullglob()?[]:[t]}async function WS(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(qn(a,e.state.shoptOptions.extglob)){let c=await pa(e,a);if(c.length>0&&c[0]!==a)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=Su(r);if(!kt(e.state.env)){let c=yt(e.state.env);return{values:Ve(l,c),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&qn(r,e.state.shoptOptions.extglob)){let a=await i(e,t);if(qn(a,e.state.shoptOptions.extglob)){let l=await pa(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=Su(r);if(!kt(e.state.env)){let l=yt(e.state.env);return{values:Ve(a,l),quoted:!1}}return{values:[a],quoted:!1}}return{values:[r],quoted:s}}var Y6=v(()=>{"use strict";ta();Ae();an();na();w6();A6();v6();I6();Ds();R6();Qr();M6();Z6();Xt()});async function ey(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 Vn(e,t.parameter),o=await Ie(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 zS(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function HS(e,t){if(t.type!=="ParameterExpansion")return null;let n=await ey(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>zS(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function jS(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?gu(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&Lg(e))}async function ty(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let p=t[0],h=await ey(e,p);if(h&&h.length>0&&h.length>1&&h.some(m=>m.type==="DoubleQuoted"||m.type==="SingleQuoted")&&h.some(m=>m.type==="Literal"||m.type==="ParameterExpansion"||m.type==="CommandSubstitution"||m.type==="ArithmeticExpansion"))return J6(e,h,n,r,s)}let i=[],o=!1;for(let p of t){let h=jS(p),d=p.type==="DoubleQuoted"||p.type==="SingleQuoted",m=h?await HS(e,p):null,g=await s(e,p);i.push({value:g,isSplittable:h,isQuoted:d,mixedDefaultParts:m??void 0}),h&&(o=!0)}if(!o){let p=i.map(h=>h.value).join("");return p?[p]:[]}let a=[],l="",c=!1,u=!1,f=!1;for(let p of i)if(!p.isSplittable)u?p.isQuoted&&p.value===""?(l!==""&&a.push(l),a.push(""),c=!0,l="",u=!1,f=!0):p.value!==""?(l!==""&&a.push(l),l=p.value,u=!1,f=!1):(l+=p.value,f=!1):(l+=p.value,f=p.isQuoted&&p.value==="");else if(p.mixedDefaultParts){let h=await J6(e,p.mixedDefaultParts,n,r,s);if(h.length!==0)if(h.length===1)l+=h[0],c=!0;else{l+=h[0],a.push(l),c=!0;for(let d=1;d<h.length-1;d++)a.push(h[d]);l=h[h.length-1]}u=!1,f=!1}else{let{words:h,hadLeadingDelimiter:d,hadTrailingDelimiter:m}=ia(p.value,n);if(f&&d&&l===""&&(a.push(""),c=!0),h.length===0)m&&(u=!0);else if(h.length===1)l+=h[0],c=!0,u=m;else{l+=h[0],a.push(l),c=!0;for(let g=1;g<h.length-1;g++)a.push(h[g]);l=h[h.length-1],u=m}f=!1}return l!==""?a.push(l):a.length===0&&c&&a.push(""),a}function GS(e,t){return e.length>0&&t.includes(e[0])}async function J6(e,t,n,r,s){let i=[];for(let u of t){let p=!(u.type==="DoubleQuoted"||u.type==="SingleQuoted"),h=await s(e,u);i.push({value:h,isSplittable:p})}let o=[],a="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(a!==""&&o.push(a),a=u.value,c=!1):a+=u.value;else{GS(u.value,n)&&a!==""&&(o.push(a),a="",l=!0);let{words:p,hadTrailingDelimiter:h}=ia(u.value,n);if(p.length===0)h&&(c=!0);else if(p.length===1)a+=p[0],l=!0,c=h;else{a+=p[0],o.push(a),l=!0;for(let d=1;d<p.length-1;d++)o.push(p[d]);a=p[p.length-1],c=h}}return a!==""?o.push(a):o.length===0&&l&&o.push(""),o}var ny=v(()=>{"use strict";Xt();an();na()});function ry(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function sy(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}var iy=v(()=>{"use strict"});var Ru={};ee(Ru,{escapeGlobChars:()=>Yt,escapeRegexChars:()=>Ps,expandRedirectTarget:()=>Ii,expandWord:()=>le,expandWordForPattern:()=>Ou,expandWordForRegex:()=>$u,expandWordWithGlob:()=>Tn,getArrayElements:()=>ce,getVariable:()=>Ie,hasQuotedMultiValueAt:()=>Ni,isArray:()=>ir,isWordFullyQuoted:()=>Iu});function Ar(e,t,n){if(e.length>t)throw new X(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}async function On(e,t,n=!1){let r=[];for(let s of t)r.push(await ln(e,s,n));return r.join("")}function VS(e){return sy(e)}function Iu(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!VS(t))return!1;return!0}function qS(e,t,n=!1){let r=ry(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 ku(e,t.pattern);default:return null}}async function le(e,t){return Tu(e,t)}async function $u(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped")n.push(`\\${r.value}`);else if(r.type==="SingleQuoted")n.push(r.value);else if(r.type==="DoubleQuoted"){let s=await On(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await ln(e,r);n.push(Ps(s))}else n.push(await ln(e,r));return n.join("")}async function Ou(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(Yt(r.value));else if(r.type==="DoubleQuoted"){let s=await On(e,r.parts);n.push(Yt(s))}else n.push(await ln(e,r));return n.join("")}async function oy(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Yt(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 On(e,r.parts);n.push(Yt(s))}else r.type==="Glob"?u6(r.pattern)?n.push(await p6(e,r.pattern)):n.push(ku(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await ln(e,r));return n.join("")}function da(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&da(t.parts))return!0;return!1}async function ay(e,t,n={count:0}){if(n.count>Nu)return[[]];let r=[[]];for(let s of t)if(s.type==="BraceExpansion"){let i=[],o=!1,a="";for(let u of s.items)if(u.type==="Range"){let f=Au(u.start,u.end,u.step,u.startStr,u.endStr);if(f.expanded)for(let p of f.expanded)n.count++,i.push(p);else{o=!0,a=f.literal;break}}else{let f=await ay(e,u.word.parts,n);for(let p of f){n.count++;let h=[];for(let d of p)typeof d=="string"?h.push(d):h.push(await ln(e,d));i.push(h.join(""))}}if(o){for(let u of r)n.count++,u.push(a);continue}if(r.length*i.length>e.limits.maxBraceExpansionResults||n.count>Nu)return r;let c=[];for(let u of r)for(let f of i){if(n.count++,n.count>Nu)return c.length>0?c:r;c.push([...u,f])}r=c}else for(let i of r)n.count++,i.push(s);return r}async function ly(e,t){let n=t.parts;if(!da(n))return[await le(e,t)];let r=await ay(e,n),s=[];for(let i of r){let o=[];for(let a of i)typeof a=="string"?o.push(a):o.push(await ln(e,a));s.push(d6(e,o.join("")))}return s}function ZS(){return{expandWordAsync:Tu,expandWordForGlobbing:oy,expandWordWithBracesAsync:ly,expandWordPartsAsync:On,expandPart:ln,expandParameterAsync:ha,hasBraceExpansion:da,evaluateArithmetic:re,buildIfsCharClassPattern:Mg,smartWordSplit:ty}}async function Tn(e,t){return X6(e,t,ZS())}function KS(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function Ni(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 Ii(e,t){if(Ni(e,t))return{error:`bash: $@: ambiguous redirect
788
+ `};let n=t.parts,{hasQuoted:r}=vi(n);if(da(n)&&(await ly(e,t)).length>1)return{error:`bash: ${n.map(h=>h.type==="Literal"?h.value:h.type==="BraceExpansion"?`{${h.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
789
+ `};let s=await Tu(e,t),{hasParamExpansion:i,hasCommandSub:o}=vi(n);if((i||o)&&!r&&!kt(e.state.env)){let f=yt(e.state.env);if(Ve(s,f).length>1)return{error:`bash: $${KS(n)}: ambiguous redirect
790
+ `}}if(r||e.state.options.noglob)return{target:s};let l=await oy(e,t);if(!qn(l,e.state.shoptOptions.extglob))return{target:s};let c=new wr(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}),u=await c.expand(l);return u.length===0?c.hasFailglob()?{error:`bash: no match: ${s}
791
+ `}:{target:s}:u.length===1?{target:u[0]}:{error:`bash: ${s}: ambiguous redirect
792
+ `}}async function Tu(e,t){let n=t.parts,r=n.length;if(r===1){let o=await ln(e,n[0]);return Ar(o,e.limits.maxStringLength,"word expansion"),o}let s=[];for(let o=0;o<r;o++)s.push(await ln(e,n[o]));let i=s.join("");return Ar(i,e.limits.maxStringLength,"word expansion"),i}async function ln(e,t,n=!1){if(t.type==="ParameterExpansion")return ha(e,t,n);let r=qS(e,t,n);if(r!==null)return r;switch(t.type){case"DoubleQuoted":{let s=[];for(let i of t.parts)s.push(await ln(e,i,!0));return s.join("")}case"CommandSubstitution":{let s=qg(t.body);if(s)try{let p=await le(e,s.target),h=p.startsWith("/")?p:`${e.state.cwd}/${p}`,d=await e.fs.readFile(h);e.state.lastExitCode=0,e.state.env.set("?","0");let m=d.replace(/\n+$/,"");return Ar(m,e.limits.maxStringLength,"command substitution"),m}catch(p){if(p instanceof X)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 X(`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=e.state.cwd,f=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let p=await e.executeScript(t.body),h=p.exitCode;e.state.env=c,e.state.cwd=u,e.state.suppressVerbose=f,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 d=p.stdout.replace(/\n+$/,"");return Ar(d,e.limits.maxStringLength,"command substitution"),d}catch(p){if(e.state.env=c,e.state.cwd=u,e.state.bashPid=l,e.substitutionDepth=a,e.state.suppressVerbose=f,p instanceof X)throw p;if(p instanceof we){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 Ar(h,e.limits.maxStringLength,"command substitution"),h}throw p}}case"ArithmeticExpansion":{let s=t.expression.originalText;if(s&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(s)){let o=await jg(e,s),a=new pe,l=Ne(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=Au(i.start,i.end,i.step,i.startStr,i.endStr);if(o.expanded)s.push(...o.expanded);else return o.literal}else s.push(await le(e,i.word));return s.join(" ")}default:return""}}async function ha(e,t,n=!1){let{parameter:r}=t,{operation:s}=t,i=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let[,p,h]=i;if(e.state.associativeArrays?.has(p)||h.includes("$(")||h.includes("`")||h.includes("${")){let m=await Eu(e,h);r=`${p}[${m}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&We(e,r)){let p=Mt(e,r);if(p&&p!==r){let h=p.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(h){let[,d,m]=h;if(e.state.associativeArrays?.has(d)||m.includes("$(")||m.includes("`")||m.includes("${")){let y=await Eu(e,m);r=`${d}[${y}]`}}}}let o=s&&(s.type==="DefaultValue"||s.type==="AssignDefault"||s.type==="UseAlternative"||s.type==="ErrorIfUnset"),a=await Ie(e,r,!o);if(!s)return a;let l=!await Vn(e,r),{isEmpty:c,effectiveValue:u}=l6(e,r,a,n),f={value:a,isUnset:l,isEmpty:c,effectiveValue:u,inDoubleQuotes:n};switch(s.type){case"DefaultValue":return Kg(e,s,f,On);case"AssignDefault":return Qg(e,r,s,f,On);case"ErrorIfUnset":return Xg(e,r,s,f,On);case"UseAlternative":return Yg(e,s,f,On);case"PatternRemoval":{let p=await Jg(e,a,s,On,ln);return Ar(p,e.limits.maxStringLength,"pattern removal"),p}case"PatternReplacement":{let p=await e6(e,a,s,On,ln);return Ar(p,e.limits.maxStringLength,"pattern replacement"),p}case"Length":return t6(e,r,a);case"LengthSliceError":throw new Pt(r);case"BadSubstitution":throw new Pt(s.text);case"Substring":return n6(e,r,a,s);case"CaseModification":{let p=await r6(e,a,s,On,ha);return Ar(p,e.limits.maxStringLength,"case modification"),p}case"Transform":return s6(e,r,a,l,s);case"Indirection":return i6(e,r,a,l,s,ha,n);case"ArrayKeys":return o6(e,s);case"VarNamePrefix":return a6(e,s);default:return a}}var Nu,Bt=v(()=>{"use strict";Ot();ct();ta();Ut();Ae();na();Gg();Vg();Zg();Ds();c6();h6();m6();Xt();Y6();ny();an();In();iy();Ds();Xt();Nu=1e5});function QS(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":if(t===0)throw new Le("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new Le("division by 0");return e%t;case"**":if(t<0)throw new Le("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 cy(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 XS(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function YS(e,t){let n=e.state.env.get(t);if(n!==void 0)return n;let r=e.state.env.get(`${t}_0`);return r!==void 0?r:await Ie(e,t)}function JS(e){if(!e)return 0;let t=Number.parseInt(e,10);if(!Number.isNaN(t)&&/^-?\d+$/.test(e.trim()))return t;let n=e.trim();if(!n)return 0;try{let r=new pe,{expr:s,pos:i}=on(r,n,0);if(i<n.length){let o=n.slice(i).trim().split(/\s+/)[0];throw new Le(`${n}: syntax error in expression (error token is "${o}")`)}return s.type==="ArithNumber"?s.value:t||0}catch(r){if(r instanceof Le)throw r;let s=n.split(/\s+/).slice(1)[0]||n;throw new Le(`${n}: syntax error in expression (error token is "${s}")`)}}async function Pu(e,t){if(!t)return 0;let n=Number.parseInt(t,10);if(!Number.isNaN(n)&&/^-?\d+$/.test(t.trim()))return n;let r=t.trim();if(!r)return 0;let s=new pe,{expr:i,pos:o}=on(s,r,0);if(o<r.length){let a=r.slice(o).trim(),l=a.split(/\s+/)[0]||a;throw new Le(`syntax error in expression (error token is "${l}")`,"","")}return await re(e,i)}async function Du(e,t,n=new Set,r=0){if(r>100)throw new Le("maximum variable indirection depth exceeded");if(n.has(t))return 0;n.add(t);let s=await YS(e,t);if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s.trim()))return i;let o=s.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o))return await Du(e,o,n,r+1);let a=new pe,{expr:l,pos:c}=on(a,o,0);if(c<o.length){let u=o.slice(c).trim(),f=u.split(/\s+/)[0]||u;throw new Le(`${o}: syntax error in expression (error token is "${f}")`)}return await re(e,l)}async function ma(e,t){if(t.startsWith("#")){let f=t.slice(1),p=f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(p){let d=p[1],m=ce(e,d);return String(m.length)}let h=e.state.env.get(f)||"";return String(h.length)}if(t.startsWith("!")){let f=t.slice(1),p=e.state.env.get(f)||"";return e.state.env.get(p)||""}let n=[":-",":=",":?",":+","-","=","?","+"],r=-1,s="";for(let f of n){let p=t.indexOf(f);p>0&&(r===-1||p<r)&&(r=p,s=f)}if(r===-1)return await Ie(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){switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new Le("value too great for base");return t.value;case"ArithVariable":return await Du(e,t.name);case"ArithSpecialVar":{let s=(await Ie(e,t.name)).trim();if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s))return i;let o=new pe,{expr:a}=on(o,s,0);return await re(e,a)}case"ArithNested":return await re(e,t.expression);case"ArithCommandSubst":{if(e.execFn){let r=await e.execFn(t.command,{signal:e.state.signal});r.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+r.stderr);let s=r.stdout.trim();return Number.parseInt(s,10)||0}return 0}case"ArithBracedExpansion":{let r=await ma(e,t.content);return Number.parseInt(r,10)||0}case"ArithDynamicBase":{let r=await ma(e,t.baseExpr),s=Number.parseInt(r,10);if(s<2||s>64)return 0;let i=`${s}#${t.value}`;return Ai(i)}case"ArithDynamicNumber":{let s=await ma(e,t.prefix)+t.suffix;return Ai(s)}case"ArithArrayElement":{let r=e.state.associativeArrays?.has(t.array),s=async i=>{let o=e.state.env.get(i);return o!==void 0?await Pu(e,o):0};if(t.stringKey!==void 0)return await s(`${t.array}_${t.stringKey}`);if(r&&t.index?.type==="ArithVariable"&&!t.index.hasDollarPrefix)return await s(`${t.array}_${t.index.name}`);if(r&&t.index?.type==="ArithVariable"&&t.index.hasDollarPrefix){let i=await Ie(e,t.index.name);return await s(`${t.array}_${i}`)}if(t.index){let i=await re(e,t.index,n);if(i<0){let l=ce(e,t.array),c=e.state.currentLine;if(l.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${t.array}: bad array subscript
793
+ `,0;let f=Math.max(...l.map(([p])=>typeof p=="number"?p:0))+1+i;if(f<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${t.array}: bad array subscript
794
+ `,0;i=f}let o=`${t.array}_${i}`,a=e.state.env.get(o);if(a!==void 0)return Pu(e,a);if(i===0){let l=e.state.env.get(t.array);if(l!==void 0)return Pu(e,l)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(c=>c===t.array||c.startsWith(`${t.array}_`)))throw new Rt(`${t.array}[${i}]`);return 0}return 0}case"ArithDoubleSubscript":throw new Le("double subscript","","");case"ArithNumberSubscript":throw new Le(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new Le(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new Le(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await re(e,t.left,n)||await re(e,t.right,n)?1:0;if(t.operator==="&&")return await re(e,t.left,n)&&await re(e,t.right,n)?1:0;let r=await re(e,t.left,n),s=await re(e,t.right,n);return QS(r,s,t.operator)}case"ArithUnary":{let r=await re(e,t.operand,n);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let s=t.operand.name,i=Number.parseInt(await Ie(e,s),10)||0,o=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(o)),t.prefix?o:i}if(t.operand.type==="ArithArrayElement"){let s=t.operand.array,i=e.state.associativeArrays?.has(s),o;if(t.operand.stringKey!==void 0)o=`${s}_${t.operand.stringKey}`;else if(i&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)o=`${s}_${t.operand.index.name}`;else if(i&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix){let c=await Ie(e,t.operand.index.name);o=`${s}_${c}`}else if(t.operand.index){let c=await re(e,t.operand.index,n);o=`${s}_${c}`}else return r;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==="ArithConcat"){let s="";for(let i of t.operand.parts)s+=await Ms(e,i,n);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,o=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(o)),t.prefix?o:i}}if(t.operand.type==="ArithDynamicElement"){let s="";if(t.operand.nameExpr.type==="ArithConcat")for(let i of t.operand.nameExpr.parts)s+=await Ms(e,i,n);else t.operand.nameExpr.type==="ArithVariable"&&(s=t.operand.nameExpr.hasDollarPrefix?await Ie(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=await re(e,t.operand.subscript,n),o=`${s}_${i}`,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}}return r}return XS(r,t.operator)}case"ArithTernary":return await re(e,t.condition,n)?await re(e,t.consequent,n):await re(e,t.alternate,n);case"ArithAssignment":{let r=t.variable,s=r;if(t.stringKey!==void 0)s=`${r}_${t.stringKey}`;else if(t.subscript){let l=e.state.associativeArrays?.has(r);if(l&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)s=`${r}_${t.subscript.name}`;else if(l&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix){let c=await Ie(e,t.subscript.name);s=`${r}_${c||"\\"}`}else if(l){let c=await re(e,t.subscript,n);s=`${r}_${c}`}else{let c=await re(e,t.subscript,n);if(c<0){let u=ce(e,r);u.length>0&&(c=Math.max(...u.map(([p])=>typeof p=="number"?p:0))+1+c)}s=`${r}_${c}`}}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,o=await re(e,t.value,n),a=cy(i,o,t.operator);return e.state.env.set(s,String(a)),a}case"ArithGroup":return await re(e,t.expression,n);case"ArithConcat":{let r="";for(let s of t.parts)r+=await Ms(e,s,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?await Du(e,r):Number.parseInt(r,10)||0}case"ArithDynamicAssignment":{let r="";if(t.target.type==="ArithConcat")for(let l of t.target.parts)r+=await Ms(e,l,n);else t.target.type==="ArithVariable"&&(r=t.target.hasDollarPrefix?await Ie(e,t.target.name):t.target.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=r;if(t.subscript){let l=await re(e,t.subscript,n);s=`${r}_${l}`}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,o=await re(e,t.value,n),a=cy(i,o,t.operator);return e.state.env.set(s,String(a)),a}case"ArithDynamicElement":{let r="";if(t.nameExpr.type==="ArithConcat")for(let a of t.nameExpr.parts)r+=await Ms(e,a,n);else t.nameExpr.type==="ArithVariable"&&(r=t.nameExpr.hasDollarPrefix?await Ie(e,t.nameExpr.name):t.nameExpr.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=await re(e,t.subscript,n),i=`${r}_${s}`,o=e.state.env.get(i);return o!==void 0?JS(o):0}default:return 0}}async function Ms(e,t,n=!1){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await re(e,t,n));case"ArithVariable":return t.hasDollarPrefix?await Ie(e,t.name):t.name;case"ArithSpecialVar":return await Ie(e,t.name);case"ArithBracedExpansion":return await ma(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let r="";for(let s of t.parts)r+=await Ms(e,s,n);return r}default:return String(await re(e,t,n))}}var Ut=v(()=>{"use strict";Ot();ct();Ae();Bt()});function C7(){throw new Error("node:dns is not available in browser environments")}var v7=v(()=>{"use strict"});Zs();un();var Uc=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(Mf(),Lf))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(Wf(),Bf))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(Qf(),Kf))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(e1(),Jf))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(n1(),t1))).mkdirCommand},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>(o1(),i1))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>(l1(),a1))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(u1(),c1))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(p1(),f1))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(d1(),h1))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(g1(),m1))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(b1(),w1))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(E1(),x1))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(S1(),A1))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(N1(),k1))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>($1(),I1))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(R1(),T1))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(D1(),P1))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(Np(),kp))).rgCommand},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(Up(),Mp))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(wh(),yh))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>(Ih(),Nh))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(Oh(),$h))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(Rh(),Th))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(Dh(),Ph))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(Lh(),Fh))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(Bh(),Uh))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(zh(),Wh))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(Gh(),jh))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(Zh(),qh))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>(Xh(),Qh))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(td(),ed))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(id(),sd))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(cd(),ld))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(pd(),fd))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(dd(),hd))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(gd(),md))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(vd(),Cd))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(Nd(),kd))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>($d(),Id))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(Rd(),Td))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(_d(),Dd))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(ql(),Vl))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(ql(),Vl))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Kl(),Zl))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Kl(),Zl))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(Md(),Ld))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(Bd(),Ud))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(Xl(),Ql))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(Xl(),Ql))).falseCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(zd(),Wd))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(Jl(),Yl))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(Jl(),Yl))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(gm(),mm))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>(bm(),wm))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>(Am(),Em))).diffCommand},{name:"date",load:async()=>(await Promise.resolve().then(()=>(Cm(),Sm))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(Nm(),km))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>($m(),Im))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(Tm(),Om))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(Pm(),Rm))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(_m(),Dm))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(Mm(),Lm))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(Bm(),Um))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(zm(),Wm))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(V0(),G0))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(Z0(),q0))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(Q0(),K0))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(Y0(),X0))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(e2(),J0))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(n2(),t2))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(s2(),r2))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(o2(),i2))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).zcatCommand}],AA=[],SA=[],N2=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(v2(),C2))).curlCommand}],k2=new Map;function Vo(e){return{name:e.name,async execute(t,n){let r=k2.get(e.name);return r||(r=await Et.runTrustedAsync(()=>e.load()),k2.set(e.name,r)),n.coverage,r.execute(t,n)}}}function CA(){return Uc.map(e=>e.name)}function vA(){return N2.map(e=>e.name)}function I2(e){return(e?Uc.filter(n=>e.includes(n.name)):Uc).map(Vo)}function $2(){return N2.map(Vo)}function O2(){return AA.map(Vo)}function T2(){return SA.map(Vo)}function R2(e){return"load"in e&&typeof e.load=="function"}function kA(e,t){return{name:e,trusted:!0,execute:t}}function P2(e){let t=null;return{name:e.name,trusted:!0,async execute(n,r){return t||(t=await e.load()),t.execute(n,r)}}}ge();ge();Dc();function ke(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 lt(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function qo(e){let t=ke(e);if(t==="/")return"/";let n=t.lastIndexOf("/");return n===0?"/":t.slice(0,n)}function Zo(e,t){if(t.startsWith("/"))return ke(t);let n=e==="/"?`/${t}`:`${e}/${t}`;return ke(n)}function hr(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Ko(e,t){if(t.startsWith("/"))return ke(t);let n=qo(e);return ke(hr(n,t))}var Os=new TextEncoder;function IA(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var rr=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[n,r]of Object.entries(t))typeof r=="function"?this.writeFileLazy(n,r):IA(r)?this.writeFileSync(n,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(n,r)}ensureParentDirs(t){let n=qo(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){lt(t,"write");let i=ke(t);this.ensureParentDirs(i);let o=Go(r),a=Pc(n,o);this.data.set(i,{type:"file",content:a,mode:s?.mode??420,mtime:s?.mtime??new Date})}writeFileLazy(t,n,r){lt(t,"write");let s=ke(t);this.ensureParentDirs(s),this.data.set(s,{type:"file",lazy:n,mode:r?.mode??420,mtime:r?.mtime??new Date})}async materializeLazy(t,n){let r=await n.lazy(),i={type:"file",content:typeof r=="string"?Os.encode(r):r,mode:n.mode,mtime:n.mtime};return this.data.set(t,i),i}async readFile(t,n){let r=await this.readFileBuffer(t),s=Go(n);return Ei(r,s)}async readFileBytes(t){let n=await this.readFileBuffer(t);return Ei(n,"binary")}async readFileBuffer(t){lt(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:Os.encode(s.content)}return r.content instanceof Uint8Array?r.content:Os.encode(r.content)}async writeFile(t,n,r){this.writeFileSync(t,n,r)}async appendFile(t,n,r){lt(t,"append");let s=ke(t),i=this.data.get(s);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=Go(r),a=Pc(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:Os.encode("content"in l?l.content:""),u=new Uint8Array(c.length+a.length);u.set(c),u.set(a,c.length),this.data.set(s,{type:"file",content:u,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){lt(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=Os.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}async lstat(t){lt(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=Os.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}resolveIntermediateSymlinks(t){let n=ke(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=Ko(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=ke(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=Ko(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){lt(t,"mkdir");let r=ke(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=qo(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){lt(t,"scandir");let n=ke(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=Ko(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){lt(t,"rm");let r=ke(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=hr(r,o);await this.rm(a,n)}}}this.data.delete(r)}async cp(t,n,r){lt(t,"cp"),lt(n,"cp");let s=ke(t),i=ke(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?new Uint8Array(o.content):o.content;this.data.set(i,{...o,content:a})}else this.data.set(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}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(s);for(let l of a){let c=hr(s,l),u=hr(i,l);await this.cp(c,u,r)}}}async mv(t,n){await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,n){return Zo(t,n)}async chmod(t,n){lt(t,"chmod");let r=ke(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){lt(n,"symlink");let r=ke(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){lt(t,"link"),lt(n,"link");let r=ke(t),s=ke(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),this.data.set(s,{type:"file",content:o.content,mode:o.mode,mtime:o.mtime})}async readlink(t){lt(t,"readlink");let n=ke(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){lt(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){lt(t,"utimes");let s=ke(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}};Wc();function $A(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function OA(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 TA(e){e.mkdirSync("/dev",{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 RA(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${L2}
795
+ `),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
796
+ `),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>Bc(t)):e.writeFileSync("/proc/self/status",Bc(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 M2(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){$A(e)&&(OA(e,t),TA(e),RA(e,n))}xn();er();Ae();var PA=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],DA=["braceexpand","hashall","interactive-comments"];function zc(e){let t=[],n=[...DA.map(r=>({name:r,enabled:!0})),...PA.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 Ts(e){e.state.env.set("SHELLOPTS",zc(e.state.options))}var _A=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Hc(e){let t=[];for(let n of _A)e[n]&&t.push(n);return t.join(":")}function jc(e){e.state.env.set("BASHOPTS",Hc(e.state.shoptOptions))}ge();er();Vr();un();ct();Vr();var fS="BASH_ALIAS_";function Ig(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function $g(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Og(e,t){return e.env.get(`${fS}${t}`)}function pu(e,t,n){if(!t.name||!Ig(t.name))return t;let r=$g(t.name);if(!r)return t;let s=Og(e,r);if(!s||n.has(r))return t;try{n.add(r);let i=new pe,o=s,a=s.endsWith(" ");if(!a)for(let f of t.args){let p=Rg(f);o+=` ${p}`}let l;try{l=i.parse(o)}catch(f){if(f instanceof At)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return Tg(t,s);let c=l.statements[0].pipelines[0].commands[0];if(c.type!=="SimpleCommand")return Tg(t,s);let u={...c,assignments:[...t.assignments,...c.assignments],redirections:[...c.redirections,...t.redirections],line:t.line};if(a&&t.args.length>0&&(u={...u,args:[...u.args,...t.args]},u.args.length>0)){let f=u.args[0];if(Ig(f)){let p=$g(f);if(p&&Og(e,p)){let h={type:"SimpleCommand",name:f,args:u.args.slice(1),assignments:[],redirections:[]},d=pu(e,h,n);d!==h&&(u={...u,name:d.name,args:[...d.args]})}}}return u}catch(i){throw n.delete(r),i}}function Tg(e,t){let n=t;for(let o of e.args){let a=Rg(o);n+=` ${a}`}let r=new pe,s=r.parseWordFromString("eval",!1,!1),i=r.parseWordFromString(`'${n.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:s,args:[i],assignments:e.assignments,redirections:e.redirections,line:e.line}}function Rg(e){let t="";for(let n of e.parts)switch(n.type){case"Literal":t+=n.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,"\\$1");break;case"SingleQuoted":t+=`'${n.value}'`;break;case"DoubleQuoted":t+=`"${n.parts.map(r=>r.type==="Literal"?r.value:`$${r.type}`).join("")}"`;break;case"ParameterExpansion":t+=`\${${n.parameter}}`;break;case"CommandSubstitution":t+="$(...)";break;case"ArithmeticExpansion":t+=`$((${n.expression}))`;break;case"Glob":t+=n.pattern;break;default:break}return t}Ut();Bt();yn();async function uy(e,t){let n=t.parts.map(u=>u.type==="Literal"?u.value:"\0").join(""),r=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!r||!n.endsWith(")"))return null;let s=r[1],i=[],o=!1,a="",l=!1;for(let u of t.parts)if(u.type==="Literal"){let f=u.value;if(!o){let p=f.indexOf("=(");p!==-1&&(o=!0,f=f.slice(p+2))}if(o){f.endsWith(")")&&(f=f.slice(0,-1));let p=f.split(/(\s+)/);for(let h of p)/^\s+$/.test(h)?(a||l)&&(i.push(a),a="",l=!1):h&&(a+=h)}}else if(o)if(u.type==="BraceExpansion")if(/^\[.+\]=/.test(a))a+=Rs({type:"Word",parts:[u]});else{(a||l)&&(i.push(a),a="",l=!1);let p=await Tn(e,{type:"Word",parts:[u]});i.push(...p.values)}else{(u.type==="SingleQuoted"||u.type==="DoubleQuoted"||u.type==="Escaped")&&(l=!0);let f=await le(e,{type:"Word",parts:[u]});a+=f}(a||l)&&i.push(a);let c=i.map(u=>/^\[.+\]=/.test(u)?u:u===""?"''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(u)&&!u.startsWith("'")&&!u.startsWith('"')?`'${u.replace(/'/g,"'\\''")}'`:u);return`${s}=(${c.join(" ")})`}async function fy(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 y=g.value.indexOf("+=");if(y!==-1){let w=g.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(w)){n=m,r=y,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(w)){n=m,r=y,s=!0;break}}let b=g.value.indexOf("=");if(b!==-1&&(b===0||g.value[b-1]!=="+")){let w=g.value.slice(0,b);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(w)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(w)){n=m,r=b;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 le(e,{type:"Word",parts:[m]});f+=l;let p={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},h=p.parts.length>0?await le(e,p):"";return`${f}${s?"+=":"="}${h}`}var eC=["tar","yq","xan","sqlite3","python3","python"];function py(e){return eC.includes(e)}ge();xn();Wn();un();Ae();Ae();var be=Object.freeze({stdout:"",stderr:"",exitCode:0});function Ee(e=""){return{stdout:e,stderr:"",exitCode:0}}function W(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function z(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function ft(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function Kn(e,t,n="",r=""){throw new X(e,t,n,r)}function Tt(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new X(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function _u(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Ln;return be}if(t.length>1)throw new we(1,"",`bash: break: too many arguments
797
+ `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new we(128,"",`bash: break: ${t[0]}: numeric argument required
798
+ `);n=r}throw new It(n)}async function Fu(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 p=f.split(":").filter(h=>h);for(let h of p){let d=h.startsWith("/")?`${h}/${n}`:`${e.state.cwd}/${h}/${n}`;try{if((await e.fs.stat(d)).isDirectory){n=d,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 W(`bash: cd: ${n}: Not a directory
799
+ `)}catch{return W(`bash: cd: ${n}: No such file or directory
800
+ `)}}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),Ee(r?`${u}
801
+ `:"")}ct();Ot();ct();Ze();Ut();Bt();yn();function Lu(e,t){return e.fs.resolvePath(e.state.cwd,t)}var tC=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function ga(e){return tC.includes(e)}async function ya(e,t,n){let r=Lu(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 nC=["-nt","-ot","-ef"];function wa(e){return nC.includes(e)}async function ba(e,t,n,r){let s=Lu(e,n),i=Lu(e,r);switch(t){case"-nt":try{let o=await e.fs.stat(s),a=await e.fs.stat(i);return o.mtime>a.mtime}catch{return!1}case"-ot":try{let o=await e.fs.stat(s),a=await e.fs.stat(i);return o.mtime<a.mtime}catch{return!1}case"-ef":try{if(!await e.fs.exists(s)||!await e.fs.exists(i))return!1;let o=e.fs.resolvePath(e.state.cwd,s),a=e.fs.resolvePath(e.state.cwd,i);return o===a}catch{return!1}default:return!1}}var rC=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function xa(e){return rC.has(e)}function Ea(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 $i(e){return e==="="||e==="=="||e==="!="}function Aa(e,t,n,r=!1,s=!1,i=!1){if(r){let a=Us(t,n,s,i);return e==="!="?!a:a}if(s){let a=t.toLowerCase()===n.toLowerCase();return e==="!="?!a:a}let o=t===n;return e==="!="?!o:o}var sC=new Set(["-z","-n"]);function Sa(e){return sC.has(e)}function Ca(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}Ot();ct();Ut();yn();async function va(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)||""),e.state.env.has(`${r}_${a}`)}let o;try{let a=new pe,l=Ne(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=ut(e,r),l=e.state.currentLine;if(a.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
802
+ `,!1;if(o=Math.max(...a)+1+o,o<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
803
+ `,!1}return e.state.env.has(`${r}_${o}`)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?Nn(e,t).length>0:ut(e,t).length>0}async function Sr(e,t){switch(t.type){case"CondBinary":{let n=await le(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 le(e,t.right);s=Ps(i)}else s=await $u(e,t.right);else $i(t.operator)&&!r?s=await Ou(e,t.right):s=await le(e,t.right);if($i(t.operator)){let i=e.state.shoptOptions.nocasematch;return Aa(t.operator,n,s,!r,i,!0)}if(xa(t.operator))return Ea(t.operator,await dy(e,n),await dy(e,s));if(wa(t.operator))return ba(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,o=lC(s),l=Q(o,i?"i":"").match(n);if(Gn(e,"BASH_REMATCH"),l)for(let c=0;c<l.length;c++)e.state.env.set(`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 le(e,t.operand);return ga(t.operator)?ya(e,t.operator,n):Sa(t.operator)?Ca(t.operator,n):t.operator==="-v"?await va(e,n):t.operator==="-o"?Uu(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await le(e,t.operand.expression.word)})`!=="":!await Sr(e,t.operand);case"CondAnd":return await Sr(e,t.left)?await Sr(e,t.right):!1;case"CondOr":return await Sr(e,t.left)?!0:await Sr(e,t.right);case"CondGroup":return await Sr(e,t.expression);case"CondWord":return await le(e,t.word)!=="";default:return!1}}async function Oi(e,t){if(t.length===0)return z("","",1);if(t.length===1)return ft(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?W(`test: '(' without matching ')'
804
+ `,2):ga(r)?ft(await ya(e,r,s)):Sa(r)?ft(Ca(r,s)):r==="!"?ft(!s):r==="-v"?ft(await va(e,s)):r==="-o"?ft(Uu(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"?W(`test: ${r}: unary operator expected
805
+ `,2):z("","",1)}if(t.length===3){let r=t[0],s=t[1],i=t[2];if($i(s))return ft(Aa(s,r,i));if(xa(s)){let o=ka(r),a=ka(i);return!o.valid||!a.valid?z("","",2):ft(Ea(s,o.value,a.value))}if(wa(s))return ft(await ba(e,s,r,i));switch(s){case"-a":return ft(r!==""&&i!=="");case"-o":return ft(r!==""||i!=="");case">":return ft(r>i);case"<":return ft(r<i)}if(r==="!"){let o=await Oi(e,[s,i]);return z("",o.stderr,o.exitCode===0?1:o.exitCode===1?0:o.exitCode)}if(r==="("&&i===")")return ft(s!=="")}if(t.length===4){if(t[0]==="!"){let r=await Oi(e,t.slice(1));return z("",r.stderr,r.exitCode===0?1:r.exitCode===1?0:r.exitCode)}if(t[0]==="("&&t[3]===")")return Oi(e,[t[1],t[2]])}let n=await gy(e,t,0);return n.pos<t.length?W(`test: too many arguments
806
+ `,2):ft(n.value)}async function gy(e,t,n){return iC(e,t,n)}async function iC(e,t,n){let{value:r,pos:s}=await hy(e,t,n);for(;t[s]==="-o";){let i=await hy(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function hy(e,t,n){let{value:r,pos:s}=await Mu(e,t,n);for(;t[s]==="-a";){let i=await Mu(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Mu(e,t,n){if(t[n]==="!"){let{value:r,pos:s}=await Mu(e,t,n+1);return{value:!r,pos:s}}return oC(e,t,n)}async function oC(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:o}=await gy(e,t,n+1);return{value:i,pos:t[o]===")"?o+1:o}}let s=t[n+1];if($i(s)){let i=r,o=t[n+2]??"";return{value:Aa(s,i,o),pos:n+3}}if(xa(s)){let i=ka(r),o=ka(t[n+2]??"0");return!i.valid||!o.valid?{value:!1,pos:n+3}:{value:Ea(s,i.value,o.value),pos:n+3}}if(wa(s)){let i=r,o=t[n+2]??"";return{value:await ba(e,s,i,o),pos:n+3}}if(ga(r)){let i=t[n+1]??"";return{value:await ya(e,r,i),pos:n+2}}if(Sa(r)){let i=t[n+1]??"";return{value:Ca(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await va(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:Uu(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function Us(e,t,n=!1,r=!1){let s=`^${yy(t,r)}$`;return Q(s,n?"is":"s").test(e)}function yy(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=wy(e,r+1);if(i!==-1){let o=e.slice(r+2,i),a=by(o),l=a.map(u=>yy(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(h=>xy(h,t));if(f.every(h=>h!==null)&&f.every(h=>h===f[0])&&f[0]!==null){let h=f[0];if(h===0)n+="(?:.+)";else{let d=[];h>0&&d.push(`.{0,${h-1}}`),d.push(`.{${h+1},}`),d.push(`(?!(?:${c})).{${h}}`),n+=`(?:${d.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 wy(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 by(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 xy(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=wy(e,r+1);if(i!==-1){if(s==="@"){let o=e.slice(r+2,i),l=by(o).map(c=>xy(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 Uu(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 dy(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 my(t);try{let n=new pe,r=Ne(n,t);return await re(e,r.expression)}catch{return my(t)}}function aC(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 my(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=aC(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 ka(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 lC(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=cC(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function cC(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+=uC(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 p=e.slice(n+2,f);o+=p,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 uC(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)??""}Bt();Ot();ct();Ut();xr();function Qn(e){let t=[],n="",r=!1,s=!1,i=!1,o=!1;for(let a of e){if(i){n+=a,i=!1,o=!0;continue}if(a==="\\"){i=!0;continue}if(a==="'"&&!s){r||(o=!0),r=!r;continue}if(a==='"'&&!r){s||(o=!0),s=!s;continue}if((a===" "||a===" "||a===`
807
+ `)&&!r&&!s){o&&(t.push(n),n="",o=!1);continue}n+=a,o=!0}return o&&t.push(n),t}function Na(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n++;if(n>=e.length)break;if(e[n]!=="["){n++;continue}n++;let r="";if(e[n]==="'"||e[n]==='"'){let i=e[n];for(n++;n<e.length&&e[n]!==i;)r+=e[n],n++;e[n]===i&&n++}else for(;n<e.length&&e[n]!=="]"&&e[n]!=="=";)r+=e[n],n++;for(;n<e.length&&e[n]!=="]";)n++;if(e[n]==="]"&&n++,e[n]!=="=")continue;n++;let s="";if(e[n]==="'"||e[n]==='"'){let i=e[n];for(n++;n<e.length&&e[n]!==i;)e[n]==="\\"&&n+1<e.length&&n++,s+=e[n],n++;e[n]===i&&n++}else for(;n<e.length&&!/\s/.test(e[n]);)s+=e[n],n++;t.push([r,s])}return t}function Ey(e){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(t)return{name:t[1],isArray:!0,arrayElements:Qn(t[2])};let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(n)return{name:n[1],isArray:!1,arrayIndex:n[2],value:n[3]};if(e.includes("=")){let r=e.indexOf("=");return{name:e.slice(0,r),isArray:!1,value:e.slice(r+1)}}return{name:e,isArray:!1}}async function fC(e,t){try{let n=new pe,r=Ne(n,t);return await re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function Ay(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=bt(e,r);if(u)return u}if(s&&i){for(let u=0;u<i.length;u++)e.state.env.set(`${r}_${u}`,i[u]);e.state.env.set(`${r}__length`,String(i.length))}else if(a!==void 0&&o!==void 0){let u=await fC(e,a);e.state.env.set(`${r}_${u}`,o);let f=parseInt(e.state.env.get(`${r}__length`)??"0",10);u>=f&&e.state.env.set(`${r}__length`,String(u+1))}else o!==void 0&&e.state.env.set(r,o);return l&&Jt(e,r),null}function Cr(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function Bs(e,t){return e.state.localVarDepth?.get(t)}function Ia(e,t){e.state.localVarDepth?.delete(t)}function Sy(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 $a(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function Cy(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)}}Ae();Bt();var Bu=new Set([":",".","break","continue","eval","exec","exit","export","readonly","return","set","shift","trap","unset"]);function vy(e){return Bu.has(e)}var Wu=new Set(["if","then","else","elif","fi","case","esac","for","select","while","until","do","done","in","function","{","}","time","[[","]]","!"]),Ws=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"]);Bt();async function Xr(e,t,n,r){try{if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
808
+ `;if(r.checkNoclobber&&e.state.options.noclobber&&!r.isClobber&&n!=="/dev/null")return`bash: ${n}: cannot overwrite existing file
809
+ `}catch{}return null}function vr(e){let n=Math.min(e.length,8192);for(let r=0;r<n;r++)if(e.charCodeAt(r)>127)return"utf8";return"binary"}function pC(e){if(!e.startsWith("__rw__:"))return null;let t=e.slice(7),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=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}async function ky(e,t){let n=new Map;for(let r=0;r<t.length;r++){let s=t[r];if(s.target.type==="HereDoc")continue;if(s.operator===">&"||s.operator==="<&"){if(Ni(e,s.target))return{targets:n,error:`bash: $@: ambiguous redirect
810
+ `};n.set(r,await le(e,s.target))}else{let o=await Ii(e,s.target);if("error"in o)return{targets:n,error:o.error};n.set(r,o.target)}}return{targets:n}}function hC(e){e.state.nextFd===void 0&&(e.state.nextFd=10);let t=e.state.nextFd,n=e.limits.maxFileDescriptors;if(t>=n)throw new Error(`bash: cannot allocate file descriptor: too many open files (max ${n})`);return e.state.nextFd++,t}async function Oa(e,t){for(let n of t){if(!n.fdVariable)continue;if(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),(n.operator===">&"||n.operator==="<&")&&n.target.type==="Word"&&await le(e,n.target)==="-"){let i=e.state.env.get(n.fdVariable);if(i!==void 0){let o=Number.parseInt(i,10);Number.isNaN(o)||e.state.fileDescriptors.delete(o)}continue}let r=hC(e);if(e.state.env.set(n.fdVariable,String(r)),n.target.type==="Word"){let s=await le(e,n.target);if(n.operator===">&"||n.operator==="<&"){let i=Number.parseInt(s,10);if(!Number.isNaN(i)){let o=e.state.fileDescriptors.get(i);o!==void 0&&(Tt(e),e.state.fileDescriptors.set(r,o));continue}}if(n.operator===">"||n.operator===">>"||n.operator===">|"||n.operator==="&>"||n.operator==="&>>"){let i=e.fs.resolvePath(e.state.cwd,s);(n.operator===">"||n.operator===">|"||n.operator==="&>")&&await e.fs.writeFile(i,"","binary"),Tt(e),e.state.fileDescriptors.set(r,`__file__:${i}`)}else if(n.operator==="<<<")Tt(e),e.state.fileDescriptors.set(r,`${s}
811
+ `);else if(n.operator==="<"||n.operator==="<>")try{let i=e.fs.resolvePath(e.state.cwd,s),o=await e.fs.readFile(i);Tt(e),e.state.fileDescriptors.set(r,o)}catch{return z("",`bash: ${s}: No such file or directory
812
+ `,1)}}}return null}async function Xn(e,t){for(let n of t){if(n.target.type==="HereDoc")continue;let r=n.operator===">&";if(n.operator!==">"&&n.operator!==">|"&&n.operator!=="&>"&&!r)continue;let s;if(r){if(s=await le(e,n.target),s==="-"||!Number.isNaN(Number.parseInt(s,10))||n.fd!=null)continue}else{let a=await Ii(e,n.target);if("error"in a)return z("",a.error,1);s=a.target}let i=e.fs.resolvePath(e.state.cwd,s),o=n.operator===">|";if(i.includes("\0"))return z("",`bash: ${s}: No such file or directory
813
+ `,1);try{let a=await e.fs.stat(i);if(a.isDirectory)return z("",`bash: ${s}: Is a directory
814
+ `,1);if(e.state.options.noclobber&&!o&&!a.isDirectory&&s!=="/dev/null")return z("",`bash: ${s}: cannot overwrite existing file
815
+ `,1)}catch{}if(s!=="/dev/null"&&s!=="/dev/stdout"&&s!=="/dev/stderr"&&s!=="/dev/full"&&await e.fs.writeFile(i,"","binary"),s==="/dev/full")return z("",`bash: /dev/full: No space left on device
816
+ `,1)}return null}async function et(e,t,n,r){let{stdout:s,stderr:i,exitCode:o}=t,l=t.stdoutKind==="bytes"||t.stdoutKind===void 0&&t.stdoutEncoding==="binary"?"binary":"utf8",c=h=>l;for(let h=0;h<n.length;h++){let d=n[h];if(d.target.type==="HereDoc")continue;let m,g=r?.get(h);if(g!==void 0)m=g;else if(d.operator===">&"||d.operator==="<&"){if(Ni(e,d.target)){i+=`bash: $@: ambiguous redirect
817
+ `,o=1,s="";continue}m=await le(e,d.target)}else{let b=await Ii(e,d.target);if("error"in b){i+=b.error,o=1,s="";continue}m=b.target}if(!d.fdVariable){if(m.includes("\0")){i+=`bash: ${m.replace(/\0/g,"")}: No such file or directory
818
+ `,o=1,s="";continue}switch(d.operator){case">":case">|":{let y=d.fd??1,b=d.operator===">|";if(y===1){if(m==="/dev/stdout")break;if(m==="/dev/stderr"){i+=s,s="";break}if(m==="/dev/full"){i+=`bash: echo: write error: No space left on device
819
+ `,o=1,s="";break}let w=e.fs.resolvePath(e.state.cwd,m),x=await Xr(e,w,m,{checkNoclobber:!0,isClobber:b});if(x){i+=x,o=1,s="";break}await e.fs.writeFile(w,s,c(s)),s=""}else if(y===2){if(m==="/dev/stderr")break;if(m==="/dev/stdout"){s+=i,i="";break}if(m==="/dev/full"){i+=`bash: echo: write error: No space left on device
820
+ `,o=1;break}if(m==="/dev/null")i="";else{let w=e.fs.resolvePath(e.state.cwd,m),x=await Xr(e,w,m,{checkNoclobber:!0,isClobber:b});if(x){i+=x,o=1;break}await e.fs.writeFile(w,i,vr(i)),i=""}}break}case">>":{let y=d.fd??1;if(y===1){if(m==="/dev/stdout")break;if(m==="/dev/stderr"){i+=s,s="";break}if(m==="/dev/full"){i+=`bash: echo: write error: No space left on device
821
+ `,o=1,s="";break}let b=e.fs.resolvePath(e.state.cwd,m),w=await Xr(e,b,m,{});if(w){i+=w,o=1,s="";break}await e.fs.appendFile(b,s,c(s)),s=""}else if(y===2){if(m==="/dev/stderr")break;if(m==="/dev/stdout"){s+=i,i="";break}if(m==="/dev/full"){i+=`bash: echo: write error: No space left on device
822
+ `,o=1;break}let b=e.fs.resolvePath(e.state.cwd,m),w=await Xr(e,b,m,{});if(w){i+=w,o=1;break}await e.fs.appendFile(b,i,vr(i)),i=""}break}case">&":case"<&":{let y=d.fd??1;if(m==="-")break;if(m.endsWith("-")){let b=m.slice(0,-1),w=Number.parseInt(b,10);if(!Number.isNaN(w)){let x=e.state.fileDescriptors?.get(w);x!==void 0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(y,x),w>=3&&e.state.fileDescriptors?.delete(w)):w===1||w===2?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(y,`__dupout__:${w}`)):w===0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(y,`__dupin__:${w}`)):w>=3&&(i+=`bash: ${w}: Bad file descriptor
823
+ `,o=1)}break}if(m==="2"||m==="&2")y===1&&(i+=s,s="");else if(m==="1"||m==="&1")s+=i,i="";else{let b=Number.parseInt(m,10);if(Number.isNaN(b)){if(d.operator===">&"){let w=e.fs.resolvePath(e.state.cwd,m),x=await Xr(e,w,m,{checkNoclobber:!0});if(x){i=x,o=1,s="";break}if(d.fd==null){let A=s+i;await e.fs.writeFile(w,A,c(A)),s="",i=""}else y===1?(await e.fs.writeFile(w,s,c(s)),s=""):y===2&&(await e.fs.writeFile(w,i,vr(i)),i="")}}else{let w=e.state.fileDescriptors?.get(b);if(w?.startsWith("__file__:")){let x=w.slice(9);y===1?(await e.fs.appendFile(x,s,c(s)),s=""):y===2&&(await e.fs.appendFile(x,i,vr(i)),i="")}else if(w?.startsWith("__rw__:")){let x=pC(w);x&&(y===1?(await e.fs.appendFile(x.path,s,c(s)),s=""):y===2&&(await e.fs.appendFile(x.path,i,vr(i)),i=""))}else if(w?.startsWith("__dupout__:")){let x=Number.parseInt(w.slice(11),10);if(x!==1)if(x===2)y===1&&(i+=s,s="");else{let A=e.state.fileDescriptors?.get(x);if(A?.startsWith("__file__:")){let I=A.slice(9);y===1?(await e.fs.appendFile(I,s,c(s)),s=""):y===2&&(await e.fs.appendFile(I,i,vr(i)),i="")}}}else w?.startsWith("__dupin__:")?(i+=`bash: ${b}: Bad file descriptor
824
+ `,o=1,s=""):b>=3&&(i+=`bash: ${b}: Bad file descriptor
825
+ `,o=1,s="")}}break}case"&>":{if(m==="/dev/full"){i=`bash: echo: write error: No space left on device
826
+ `,o=1,s="";break}let y=e.fs.resolvePath(e.state.cwd,m),b=await Xr(e,y,m,{checkNoclobber:!0});if(b){i=b,o=1,s="";break}let w=s+i;await e.fs.writeFile(y,w,c(w)),s="",i="";break}case"&>>":{if(m==="/dev/full"){i=`bash: echo: write error: No space left on device
827
+ `,o=1,s="";break}let y=e.fs.resolvePath(e.state.cwd,m),b=await Xr(e,y,m,{});if(b){i=b,o=1,s="";break}let w=s+i;await e.fs.appendFile(y,w,c(w)),s="",i="";break}}}}let u=e.state.fileDescriptors?.get(1);if(u){if(u==="__dupout__:2")i+=s,s="";else if(u.startsWith("__file__:")){let h=u.slice(9);await e.fs.appendFile(h,s,c(s)),s=""}else if(u.startsWith("__file_append__:")){let h=u.slice(16);await e.fs.appendFile(h,s,c(s)),s=""}}let f=e.state.fileDescriptors?.get(2);if(f){if(f==="__dupout__:1")s+=i,i="";else if(f.startsWith("__file__:")){let h=f.slice(9);await e.fs.appendFile(h,i,vr(i)),i=""}else if(f.startsWith("__file_append__:")){let h=f.slice(16);await e.fs.appendFile(h,i,vr(i)),i=""}}let p=z(s,i,o);return t.stdoutKind&&(p.stdoutKind=t.stdoutKind),t.stdoutEncoding==="binary"&&(p.stdoutEncoding="binary"),p}function Ny(e,t){if(e.state.options.posix&&Bu.has(t.name)){let r=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin
828
+ `;throw new we(2,"",r)}let n={...t,sourceFile:t.sourceFile??e.state.currentSource??"main"};return e.state.functions.set(t.name,n),be}async function dC(e,t){let n="";for(let r of t)if((r.operator==="<<"||r.operator==="<<-")&&r.target.type==="HereDoc"){let s=r.target,i=await le(e,s.content);s.stripTabs&&(i=i.split(`
829
+ `).map(a=>a.replace(/^\t+/,"")).join(`
830
+ `)),(r.fd??0)===0&&(n=i)}else if(r.operator==="<<<"&&r.target.type==="Word")n=`${await le(e,r.target)}
831
+ `;else if(r.operator==="<"&&r.target.type==="Word"){let s=await le(e,r.target),i=e.fs.resolvePath(e.state.cwd,s);try{n=await e.fs.readFile(i)}catch{}}return n}async function Ta(e,t,n,r="",s){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,Kn(`${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.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let i=new Map;for(let c=0;c<n.length;c++)i.set(String(c+1),e.state.env.get(String(c+1))),e.state.env.set(String(c+1),n[c]);i.set("@",e.state.env.get("@")),i.set("#",e.state.env.get("#")),e.state.env.set("@",n.join(" ")),e.state.env.set("#",String(n.length));let o=()=>{let c=e.state.localScopes.length-1,u=e.state.localScopes.pop();if(u)for(let[f,p]of u)p===void 0?e.state.env.delete(f):e.state.env.set(f,p);if(Cy(e,c),e.state.fullyUnsetLocals)for(let[f,p]of e.state.fullyUnsetLocals.entries())p===c&&e.state.fullyUnsetLocals.delete(f);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let f=e.state.localExportedVars.pop();if(f)for(let p of f)e.state.exportedVars?.delete(p)}for(let[f,p]of i)p===void 0?e.state.env.delete(f):e.state.env.set(f,p);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},{targets:a,error:l}=await ky(e,t.redirections);if(l)return o(),z("",l,1);try{let c=await dC(e,t.redirections),u=r||c,f=await e.executeCommand(t.body,u);return o(),et(e,f,t.redirections,a)}catch(c){if(o(),c instanceof St){let u=z(c.stdout,c.stderr,c.exitCode);return et(e,u,t.redirections,a)}throw c}}var $y=["!","[[","]]","case","do","done","elif","else","esac","fi","for","function","if","in","then","time","until","while","{","}"],Hu=[".",":","[","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"],mC=["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"],gC=Hu;async function ju(e,t){let n=[],r=null,s="",i="",o=null,a=!1,l=!1,c=!1,u=null,f=null,p=null,h=[],d=["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 x=0;x<t.length;x++){let A=t[x];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(x++,x>=t.length)return W(`compgen: -A: option requires an argument
832
+ `,2);let I=t[x];if(!d.includes(I))return W(`compgen: ${I}: invalid action name
833
+ `,2);n.push(I)}else if(A==="-W"){if(x++,x>=t.length)return W(`compgen: -W: option requires an argument
834
+ `,2);r=t[x]}else if(A==="-P"){if(x++,x>=t.length)return W(`compgen: -P: option requires an argument
835
+ `,2);s=t[x]}else if(A==="-S"){if(x++,x>=t.length)return W(`compgen: -S: option requires an argument
836
+ `,2);i=t[x]}else if(A==="-o"){if(x++,x>=t.length)return W(`compgen: -o: option requires an argument
837
+ `,2);let I=t[x];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 W(`compgen: ${I}: invalid option name
838
+ `,2)}else if(A==="-F"){if(x++,x>=t.length)return W(`compgen: -F: option requires an argument
839
+ `,2);f=t[x]}else if(A==="-C"){if(x++,x>=t.length)return W(`compgen: -C: option requires an argument
840
+ `,2);p=t[x]}else if(A==="-X"){if(x++,x>=t.length)return W(`compgen: -X: option requires an argument
841
+ `,2);u=t[x]}else if(A==="-G"){if(x++,x>=t.length)return W(`compgen: -G: option requires an argument
842
+ `,2)}else if(A==="--"){h.push(...t.slice(x+1));break}else A.startsWith("-")||h.push(A)}o=h[0]??null;let m=[];if(l){let x=await zu(e,o);m.push(...x)}if(c){let x=await Iy(e,o);m.push(...x)}for(let x of n)if(x==="variable"){let A=yC(e,o);m.push(...A)}else if(x==="export"){let A=wC(e,o);m.push(...A)}else if(x==="function"){let A=bC(e,o);m.push(...A)}else if(x==="builtin"){let A=xC(o);m.push(...A)}else if(x==="keyword"){let A=EC(o);m.push(...A)}else if(x==="alias"){let A=AC(e,o);m.push(...A)}else if(x==="shopt"){let A=SC(o);m.push(...A)}else if(x==="helptopic"){let A=CC(o);m.push(...A)}else if(x==="directory"){let A=await zu(e,o);m.push(...A)}else if(x==="file"){let A=await Iy(e,o);m.push(...A)}else if(x==="user"){let A=vC(o);m.push(...A)}else if(x==="command"){let A=await kC(e,o);m.push(...A)}if(r!==null)try{let x=await NC(e,r),A=IC(e,x);for(let I of A)(o===null||I.startsWith(o))&&m.push(I)}catch{return z("","",1)}if(a){let x=await zu(e,o);for(let A of x)m.includes(A)||m.push(A)}let g="";if(f!==null){let x=e.state.functions.get(f);if(x){let A=new Map;A.set("COMP_WORDS__length",e.state.env.get("COMP_WORDS__length")),e.state.env.set("COMP_WORDS__length","0"),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 I=new Map;for(let D of e.state.env.keys())(D==="COMPREPLY"||D.startsWith("COMPREPLY_")||D==="COMPREPLY__length")&&(I.set(D,e.state.env.get(D)),e.state.env.delete(D));let $=["compgen",h[0]??"",""];try{let D=await Ta(e,x,$,"");if(D.exitCode!==0)return zs(e,A),zs(e,I),z("",D.stderr,1);g=D.stdout;let R=$C(e);m.push(...R)}catch{return zs(e,A),zs(e,I),z("","",1)}zs(e,A),zs(e,I)}}if(p!==null)try{let x=kn(p),A=await e.executeScript(x);if(A.exitCode!==0)return z("",A.stderr,A.exitCode);if(A.stdout){let I=A.stdout.split(`
843
+ `);for(let $ of I)$.length>0&&m.push($)}}catch(x){if(x.name==="ParseException")return W(`compgen: -C: ${x.message}
844
+ `,2);throw x}let y=m;if(u!==null){let x=u.startsWith("!"),A=x?u.slice(1):u;y=m.filter(I=>{let $=Us(I,A,!1,!0);return x?$:!$})}if(y.length===0&&o!==null)return z(g,"",1);let b=y.map(x=>`${s}${x}${i}`).join(`
845
+ `),w=g+(b?`${b}
846
+ `:"");return Ee(w)}function yC(e,t){let n=new Set;for(let s of e.state.env.keys()){if(s.includes("_")&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(s)||s.endsWith("__length"))continue;let i=s.split("_")[0];/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?n.add(s):i&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)&&e.state.env.has(`${i}__length`)&&n.add(i)}let r=Array.from(n);return t!==null&&(r=r.filter(s=>s.startsWith(t))),r.sort()}function wC(e,t){let n=e.state.exportedVars??new Set,r=Array.from(n);return t!==null&&(r=r.filter(s=>s.startsWith(t))),r=r.filter(s=>s.includes("_")&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(s)||s.endsWith("__length")?!1:e.state.env.has(s)),r.sort()}function bC(e,t){let n=Array.from(e.state.functions.keys());return t!==null&&(n=n.filter(r=>r.startsWith(t))),n.sort()}function xC(e){let t=[...Hu];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function EC(e){let t=[...$y];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function AC(e,t){let n=[];for(let s of e.state.env.keys())if(s.startsWith("BASH_ALIAS_")){let i=s.slice(11);n.push(i)}let r=n;return t!==null&&(r=r.filter(s=>s.startsWith(t))),r.sort()}function SC(e){let t=[...mC];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function CC(e){let t=[...gC];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}async function zu(e,t){let n=[];try{let r=e.state.cwd,s=t??"";if(t){let o=t.lastIndexOf("/");if(o!==-1){let a=t.slice(0,o)||"/";s=t.slice(o+1),a.startsWith("/")?r=a:r=`${e.state.cwd}/${a}`}}let i=await e.fs.readdir(r);for(let o of i){let a=`${r}/${o}`;try{if((await e.fs.stat(a)).isDirectory&&(!s||o.startsWith(s)))if(t?.includes("/")){let c=t.lastIndexOf("/"),u=t.slice(0,c+1);n.push(u+o)}else n.push(o)}catch{}}}catch{}return n.sort()}async function Iy(e,t){let n=[];try{let r=e.state.cwd,s=t??"";if(t){let o=t.lastIndexOf("/");if(o!==-1){let a=t.slice(0,o)||"/";s=t.slice(o+1),a.startsWith("/")?r=a:r=`${e.state.cwd}/${a}`}}let i=await e.fs.readdir(r);for(let o of i)if(!s||o.startsWith(s))if(t?.includes("/")){let a=t.lastIndexOf("/"),l=t.slice(0,a+1);n.push(l+o)}else n.push(o)}catch{}return n.sort()}function vC(e){return["root","nobody"]}async function kC(e,t){let n=new Set;for(let i of Hu)n.add(i);for(let i of e.state.functions.keys())n.add(i);for(let i of e.state.env.keys())i.startsWith("BASH_ALIAS_")&&n.add(i.slice(11));for(let i of $y)n.add(i);let r=e.state.env.get("PATH")??"/usr/bin:/bin";for(let i of r.split(":"))if(i)try{let o=await e.fs.readdir(i);for(let a of o)n.add(a)}catch{}let s=Array.from(n);return t!==null&&(s=s.filter(i=>i.startsWith(t))),s.sort()}async function NC(e,t){let r=new pe().parseWordFromString(t,!1,!1);return await le(e,r)}function IC(e,t){let n=e.state.env.get("IFS")??`
847
+ `;if(n.length===0)return[t];let r=new Set(n.split("")),s=[],i="",o=0;for(;o<t.length;){let a=t[o];if(a==="\\"&&o+1<t.length){let l=t[o+1];i+=l,o+=2}else r.has(a)?(i.length>0&&(s.push(i),i=""),o++):(i+=a,o++)}return i.length>0&&s.push(i),s}function zs(e,t){for(let[n,r]of t)r===void 0?e.state.env.delete(n):e.state.env.set(n,r)}function $C(e){let t=[];if(e.state.env.get("COMPREPLY__length")!==void 0){let s=ce(e,"COMPREPLY");for(let[,i]of s)t.push(i)}else{let s=e.state.env.get("COMPREPLY");s!==void 0&&t.push(s)}return t}var OC=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function Vu(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 p=t[f];if(p==="-p")n=!0;else if(p==="-r")r=!0;else if(p==="-D")s=!0;else if(p==="-W"){if(f++,f>=t.length)return W(`complete: -W: option requires an argument
848
+ `,2);i=t[f]}else if(p==="-F"){if(f++,f>=t.length)return W(`complete: -F: option requires an argument
849
+ `,2);o=t[f]}else if(p==="-o"){if(f++,f>=t.length)return W(`complete: -o: option requires an argument
850
+ `,2);let h=t[f];if(!OC.includes(h))return W(`complete: ${h}: invalid option name
851
+ `,2);l.push(h)}else if(p==="-A"){if(f++,f>=t.length)return W(`complete: -A: option requires an argument
852
+ `,2);c.push(t[f])}else if(p==="-C"){if(f++,f>=t.length)return W(`complete: -C: option requires an argument
853
+ `,2);a=t[f]}else if(p==="-G"){if(f++,f>=t.length)return W(`complete: -G: option requires an argument
854
+ `,2)}else if(p==="-P"){if(f++,f>=t.length)return W(`complete: -P: option requires an argument
855
+ `,2)}else if(p==="-S"){if(f++,f>=t.length)return W(`complete: -S: option requires an argument
856
+ `,2)}else if(p==="-X"){if(f++,f>=t.length)return W(`complete: -X: option requires an argument
857
+ `,2)}else if(p==="--"){u.push(...t.slice(f+1));break}else p.startsWith("-")||u.push(p)}if(r){if(u.length===0)return e.state.completionSpecs.clear(),Ee("");for(let f of u)e.state.completionSpecs.delete(f);return Ee("")}if(n)return u.length===0?Gu(e):Gu(e,u);if(t.length===0||u.length===0&&!i&&!o&&!a&&l.length===0&&c.length===0&&!s)return Gu(e);if(o&&u.length===0&&!s)return W(`complete: -F: option requires a command name
858
+ `,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.completionSpecs.set("__default__",f),Ee("")}for(let f of u){let p=Object.create(null);i!==void 0&&(p.wordlist=i),o!==void 0&&(p.function=o),a!==void 0&&(p.command=a),l.length>0&&(p.options=l),c.length>0&&(p.actions=c),e.state.completionSpecs.set(f,p)}return Ee("")}function Gu(e,t){let n=e.state.completionSpecs;if(!n||n.size===0){if(t&&t.length>0){let i="";for(let o of t)i+=`complete: ${o}: no completion specification
859
+ `;return z("",i,1)}return Ee("")}let r=[],s=t||Array.from(n.keys());for(let i of s){if(i==="__default__")continue;let o=n.get(i);if(!o){if(t)return z(r.join(`
860
+ `)+(r.length>0?`
861
+ `:""),`complete: ${i}: no completion specification
862
+ `,1);continue}let a="complete";if(o.options)for(let l of o.options)a+=` -o ${l}`;if(o.actions)for(let l of o.actions)a+=` -A ${l}`;o.wordlist!==void 0&&(o.wordlist.includes(" ")||o.wordlist.includes("'")?a+=` -W '${o.wordlist}'`:a+=` -W ${o.wordlist}`),o.function!==void 0&&(a+=` -F ${o.function}`),o.isDefault&&(a+=" -D"),a+=` ${i}`,r.push(a)}return r.length===0?Ee(""):Ee(`${r.join(`
863
+ `)}
864
+ `)}var Oy=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function qu(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 W(`compopt: -o: option requires an argument
865
+ `,2);let c=t[a];if(!Oy.includes(c))return W(`compopt: ${c}: invalid option name
866
+ `,2);s.push(c)}else if(l==="+o"){if(a++,a>=t.length)return W(`compopt: +o: option requires an argument
867
+ `,2);let c=t[a];if(!Oy.includes(c))return W(`compopt: ${c}: invalid option name
868
+ `,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.completionSpecs.get("__default__")??{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.completionSpecs.set("__default__",a),Ee("")}if(r){let a=e.state.completionSpecs.get("__empty__")??{},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.completionSpecs.set("__empty__",a),Ee("")}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 Ee("")}return W(`compopt: not currently executing completion function
869
+ `,1)}Ae();function Zu(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Ln;return be}if(t.length>1)throw new we(1,"",`bash: continue: too many arguments
870
+ `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new we(1,"",`bash: continue: ${t[0]}: numeric argument required
871
+ `);n=r}throw new $t(n)}Ot();ct();Ut();yn();In();xr();function st(e,t){let n=e.state.env.get("HOME")||"/home/user";return t.split(":").map(i=>i==="~"?n:i==="~root"?"/root":i.startsWith("~/")?n+i.slice(1):i.startsWith("~root/")?`/root${i.slice(5)}`:i).join(":")}yn();In();function Ku(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!0}return!1}function Qu(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 Ra(e){return Ku(e)?Qu(e):/^[a-zA-Z0-9_/.:\-@%+,=]*$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function Yr(e){return Ku(e)?Qu(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Xu(e){return Ku(e)?Qu(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Ty(e,t){let n="";return e.state.integerVars?.has(t)&&(n+="i"),e.state.lowercaseVars?.has(t)&&(n+="l"),We(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 Yu(e){return e===""?"''":/[\s'\\]/.test(e)?`'${e.replace(/'/g,"'\\''")}'`:e}function Ry(e,t){let n="",r="",s=!1;for(let i of t){let o=Ty(e,i);if(e.state.associativeArrays?.has(i)){let u=Nn(e,i);if(u.length===0)n+=`declare -A ${i}=()
872
+ `;else{let f=u.map(p=>{let h=e.state.env.get(`${i}_${p}`)??"",d=Yu(h);return`['${p}']=${d}`});n+=`declare -A ${i}=(${f.join(" ")})
873
+ `}continue}let l=ut(e,i);if(l.length>0){let u=l.map(f=>{let p=e.state.env.get(`${i}_${f}`)??"";return`[${f}]=${Yr(p)}`});n+=`declare -a ${i}=(${u.join(" ")})
874
+ `;continue}if(e.state.env.has(`${i}__length`)){n+=`declare -a ${i}=()
875
+ `;continue}let c=e.state.env.get(i);if(c!==void 0)n+=`declare ${o} ${i}=${Xu(c)}
876
+ `;else{let u=e.state.declaredVars?.has(i),f=e.state.localVarDepth?.has(i);u||f?n+=`declare ${o} ${i}
877
+ `:(r+=`bash: declare: ${i}: not found
878
+ `,s=!0)}}return z(n,r,s?1:0)}function Py(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()){if(f.startsWith("BASH_"))continue;if(f.endsWith("__length")){let h=f.slice(0,-8);c.add(h);continue}let p=f.lastIndexOf("_");if(p>0){let h=f.slice(0,p),d=f.slice(p+1);if(/^\d+$/.test(d)||e.state.associativeArrays?.has(h)){c.add(h);continue}}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 p=Ty(e,f),h=e.state.associativeArrays?.has(f),d=ut(e,f),m=!h&&(d.length>0||e.state.env.has(`${f}__length`));if(a&&(o&&!h||i&&!m||n&&!e.state.exportedVars?.has(f)||r&&!e.state.readonlyVars?.has(f)||s&&!We(e,f)))continue;if(h){let y=Nn(e,f);if(y.length===0)l+=`declare -A ${f}=()
879
+ `;else{let b=y.map(w=>{let x=e.state.env.get(`${f}_${w}`)??"",A=Yu(x);return`['${w}']=${A}`});l+=`declare -A ${f}=(${b.join(" ")})
880
+ `}continue}if(d.length>0){let y=d.map(b=>{let w=e.state.env.get(`${f}_${b}`)??"";return`[${b}]=${Yr(w)}`});l+=`declare -a ${f}=(${y.join(" ")})
881
+ `;continue}if(e.state.env.has(`${f}__length`)){l+=`declare -a ${f}=()
882
+ `;continue}let g=e.state.env.get(f);g!==void 0&&(l+=`declare ${p} ${f}=${Xu(g)}
883
+ `)}return Ee(l)}function Dy(e){let t="",n=Array.from(e.state.associativeArrays??[]).sort();for(let r of n){let s=Nn(e,r);if(s.length===0)t+=`declare -A ${r}=()
884
+ `;else{let i=s.map(o=>{let a=e.state.env.get(`${r}_${o}`)??"",l=Yu(a);return`['${o}']=${l}`});t+=`declare -A ${r}=(${i.join(" ")})
885
+ `}}return Ee(t)}function _y(e){let t="",n=new Set;for(let s of e.state.env.keys()){if(s.startsWith("BASH_"))continue;if(s.endsWith("__length")){let o=s.slice(0,-8);e.state.associativeArrays?.has(o)||n.add(o);continue}let i=s.lastIndexOf("_");if(i>0){let o=s.slice(0,i),a=s.slice(i+1);/^\d+$/.test(a)&&(e.state.associativeArrays?.has(o)||n.add(o))}}let r=Array.from(n).sort();for(let s of r){let i=ut(e,s);if(i.length===0)t+=`declare -a ${s}=()
886
+ `;else{let o=i.map(a=>{let l=e.state.env.get(`${s}_${a}`)??"";return`[${a}]=${Yr(l)}`});t+=`declare -a ${s}=(${o.join(" ")})
887
+ `}}return Ee(t)}function Fy(e){let t="",n=new Set;for(let s of e.state.env.keys()){if(s.startsWith("BASH_"))continue;if(s.endsWith("__length")){let o=s.slice(0,-8);n.add(o);continue}let i=s.lastIndexOf("_");if(i>0){let o=s.slice(0,i),a=s.slice(i+1);if(/^\d+$/.test(a)||e.state.associativeArrays?.has(o)){n.add(o);continue}}n.add(s)}let r=Array.from(n).sort();for(let s of r){if(e.state.associativeArrays?.has(s)||ut(e,s).length>0||e.state.env.has(`${s}__length`))continue;let a=e.state.env.get(s);a!==void 0&&(t+=`${s}=${Ra(a)}
888
+ `)}return Ee(t)}function Ju(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Ti(e,t){return e.state.integerVars?.has(t)??!1}function ef(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function TC(e,t){return e.state.lowercaseVars?.has(t)??!1}function tf(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function RC(e,t){return e.state.uppercaseVars?.has(t)??!1}function Hs(e,t,n){return TC(e,t)?n.toLowerCase():RC(e,t)?n.toUpperCase():n}async function Ly(e,t){try{let n=new pe,r=Ne(n,t),s=await re(e,r.expression);return String(s)}catch{return"0"}}function PC(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 nf(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,d=!1,m=!1,g=!1,y=[];for(let R=0;R<t.length;R++){let L=t[R];if(L==="-a")n=!0;else if(L==="-A")r=!0;else if(L==="-r")s=!0;else if(L==="-x")i=!0;else if(L==="-p")o=!0;else if(L==="-n")a=!0;else if(L==="+n")l=!0;else if(L==="+a")c=!0;else if(L==="+x")u=!0;else if(L==="--"){y.push(...t.slice(R+1));break}else if(L.startsWith("+")){for(let C of L.slice(1))if(C==="n")l=!0;else if(C==="a")c=!0;else if(C==="x")u=!0;else if(C!=="r"){if(C!=="i"){if(!(C==="f"||C==="F"))return z("",`bash: typeset: +${C}: invalid option
889
+ `,2)}}}else if(L==="-i")f=!0;else if(L==="-l")p=!0;else if(L==="-u")h=!0;else if(L==="-f")d=!0;else if(L==="-F")m=!0;else if(L==="-g")g=!0;else if(L.startsWith("-"))for(let C of L.slice(1))if(C==="a")n=!0;else if(C==="A")r=!0;else if(C==="r")s=!0;else if(C==="x")i=!0;else if(C==="p")o=!0;else if(C==="n")a=!0;else if(C==="i")f=!0;else if(C==="l")p=!0;else if(C==="u")h=!0;else if(C==="f")d=!0;else if(C==="F")m=!0;else if(C==="g")g=!0;else return z("",`bash: typeset: -${C}: invalid option
890
+ `,2);else y.push(L)}let w=e.state.localScopes.length>0&&!g,x=R=>{if(!w)return;let L=e.state.localScopes[e.state.localScopes.length-1];L.has(R)||L.set(R,e.state.env.get(R))},A=R=>{if(!w)return;let L=e.state.localScopes[e.state.localScopes.length-1];L.has(R)||L.set(R,e.state.env.get(R));let C=`${R}_`;for(let T of e.state.env.keys())T.startsWith(C)&&!T.includes("__")&&(L.has(T)||L.set(T,e.state.env.get(T)));let O=`${R}__length`;e.state.env.has(O)&&!L.has(O)&&L.set(O,e.state.env.get(O))},I=R=>{w&&Cr(e,R)};if(m){if(y.length===0){let C=Array.from(e.state.functions.keys()).sort(),O="";for(let T of C)O+=`declare -f ${T}
891
+ `;return Ee(O)}let R=!0,L="";for(let C of y)e.state.functions.has(C)?L+=`${C}
892
+ `:R=!1;return z(L,"",R?0:1)}if(d){if(y.length===0){let L="",C=Array.from(e.state.functions.keys()).sort();for(let O of C)L+=`${O} ()
893
+ {
894
+ # function body
895
+ }
896
+ `;return Ee(L)}let R=!0;for(let L of y)e.state.functions.has(L)||(R=!1);return z("","",R?0:1)}if(o&&y.length>0)return Ry(e,y);if(o&&y.length===0)return Py(e,{filterExport:i,filterReadonly:s,filterNameref:a,filterIndexedArray:n,filterAssocArray:r});if(y.length===0&&r&&!o)return Dy(e);if(y.length===0&&n&&!o)return _y(e);if(y.length===0&&!o)return Fy(e);let $="",D=0;for(let R of y){let L=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(L&&!c){let N=L[1],F=L[2];if(r&&ut(e,N).length>0){$+=`bash: declare: ${N}: cannot convert indexed to associative array
897
+ `,D=1;continue}if((n||!r&&!n)&&e.state.associativeArrays?.has(N)){$+=`bash: declare: ${N}: cannot convert associative to indexed array
898
+ `,D=1;continue}if(A(N),r&&(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(N)),Gn(e,N),e.state.env.delete(N),e.state.env.delete(`${N}__length`),r&&F.includes("[")){let B=Na(F);for(let[Z,oe]of B){let ye=st(e,oe);e.state.env.set(`${N}_${Z}`,ye)}}else if(r){let B=Qn(F);for(let Z=0;Z<B.length;Z+=2){let oe=B[Z],ye=Z+1<B.length?st(e,B[Z+1]):"";e.state.env.set(`${N}_${oe}`,ye)}}else{let B=Qn(F);if(B.some(oe=>/^\[[^\]]+\]=/.test(oe))){let oe=0;for(let ye of B){let V=ye.match(/^\[([^\]]+)\]=(.*)$/);if(V){let H=V[1],te=V[2],ve=st(e,te),se;if(/^-?\d+$/.test(H))se=Number.parseInt(H,10);else try{let Pe=new pe,j=Ne(Pe,H);se=await re(e,j.expression)}catch{se=0}e.state.env.set(`${N}_${se}`,ve),oe=se+1}else{let H=st(e,ye);e.state.env.set(`${N}_${oe}`,H),oe++}}}else{for(let oe=0;oe<B.length;oe++)e.state.env.set(`${N}_${oe}`,B[oe]);e.state.env.set(`${N}__length`,String(B.length))}}I(N),s&&Jt(e,N),i&&$n(e,N);continue}if(l){let N=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(Bg(e,N),!R.includes("="))continue}if(u){let N=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(la(e,N),!R.includes("="))continue}let C=PC(R);if(C){let{name:N,indexExpr:F,value:B}=C,Z=bt(e,N);if(Z)return Z;A(N);let oe;try{let V=new pe,H=Ne(V,F);oe=await re(e,H.expression)}catch{let V=parseInt(F,10);oe=Number.isNaN(V)?0:V}e.state.env.set(`${N}_${oe}`,B);let ye=parseInt(e.state.env.get(`${N}__length`)??"0",10);oe>=ye&&e.state.env.set(`${N}__length`,String(oe+1)),I(N),s&&Jt(e,N),i&&$n(e,N);continue}let O=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(O&&!c){let N=O[1],F=O[2],B=bt(e,N);if(B)return B;A(N);let Z=Qn(F);if(e.state.associativeArrays?.has(N)){let oe=Na(F);for(let[ye,V]of oe){let H=st(e,V);e.state.env.set(`${N}_${ye}`,H)}}else{let oe=ut(e,N),ye=0,V=e.state.env.get(N);oe.length===0&&V!==void 0?(e.state.env.set(`${N}_0`,V),e.state.env.delete(N),ye=1):oe.length>0&&(ye=Math.max(...oe)+1);for(let te=0;te<Z.length;te++)e.state.env.set(`${N}_${ye+te}`,st(e,Z[te]));let H=ye+Z.length;e.state.env.set(`${N}__length`,String(H))}I(N),s&&Jt(e,N),i&&$n(e,N);continue}let T=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(T){let N=T[1],F=st(e,T[2]),B=bt(e,N);if(B)return B;x(N),f&&Ju(e,N),p&&ef(e,N),h&&tf(e,N);let oe=ut(e,N).length>0||e.state.associativeArrays?.has(N);if(Ti(e,N)){let ye=e.state.env.get(N)??"0",V=parseInt(ye,10)||0,H=parseInt(await Ly(e,F),10)||0;F=String(V+H),e.state.env.set(N,F)}else if(oe){F=Hs(e,N,F);let ye=`${N}_0`,V=e.state.env.get(ye)??"";e.state.env.set(ye,V+F)}else{F=Hs(e,N,F);let ye=e.state.env.get(N)??"";e.state.env.set(N,ye+F)}I(N),s&&Jt(e,N),i&&$n(e,N),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(N));continue}if(R.includes("=")){let N=R.indexOf("="),F=R.slice(0,N),B=R.slice(N+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(F)){$+=`bash: typeset: \`${F}': not a valid identifier
899
+ `,D=1;continue}let Z=bt(e,F);if(Z)return Z;if(x(F),a){if(B!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(B)){$+=`bash: declare: \`${B}': invalid variable name for name reference
900
+ `,D=1;continue}e.state.env.set(F,B),sr(e,F),B!==""&&oa(e,B)&&xu(e,F),I(F),s&&Jt(e,F),i&&$n(e,F);continue}if(f&&Ju(e,F),p&&ef(e,F),h&&tf(e,F),Ti(e,F)&&(B=await Ly(e,B)),B=Hs(e,F,B),We(e,F)){let oe=Mt(e,F);oe&&oe!==F?e.state.env.set(oe,B):e.state.env.set(F,B)}else e.state.env.set(F,B);I(F),s&&Jt(e,F),i&&$n(e,F),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(F))}else{let N=R;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(N)){$+=`bash: typeset: \`${N}': not a valid identifier
901
+ `,D=1;continue}if(n||r?A(N):x(N),a){sr(e,N);let B=e.state.env.get(N);B!==void 0&&B!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(B)?Wg(e,N):B&&oa(e,B)&&xu(e,N),I(N),s&&Jt(e,N),i&&$n(e,N);continue}if(f&&Ju(e,N),p&&ef(e,N),h&&tf(e,N),r){if(ut(e,N).length>0){$+=`bash: declare: ${N}: cannot convert indexed to associative array
902
+ `,D=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(N)}let F=Array.from(e.state.env.keys()).some(B=>B.startsWith(`${N}_`)&&!B.startsWith(`${N}__length`));!e.state.env.has(N)&&!F&&(n||r?e.state.env.set(`${N}__length`,"0"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(N))),I(N),s&&Jt(e,N),i&&$n(e,N)}}return z("",$,D)}async function rf(e,t){let n=!1,r=!1,s=!1,i=[];for(let o=0;o<t.length;o++){let a=t[o];if(a==="-a")n=!0;else if(a==="-A")r=!0;else if(a==="-p")s=!0;else if(a==="--"){i.push(...t.slice(o+1));break}else a.startsWith("-")||i.push(a)}if(i.length===0){let o="",a=Array.from(e.state.readonlyVars||[]).sort();for(let l of a){let c=e.state.env.get(l);if(c!==void 0){let u=c.replace(/\\/g,"\\\\").replace(/"/g,'\\"');o+=`declare -r ${l}="${u}"
903
+ `}}return Ee(o)}for(let o of i){let a=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(a){let f=a[1],p=a[2],h=bt(e,f);if(h)return h;let d=Qn(p);if(e.state.associativeArrays?.has(f)){let m=Na(p);for(let[g,y]of m){let b=st(e,y);e.state.env.set(`${f}_${g}`,b)}}else{let m=ut(e,f),g=0,y=e.state.env.get(f);m.length===0&&y!==void 0?(e.state.env.set(`${f}_0`,y),e.state.env.delete(f),g=1):m.length>0&&(g=Math.max(...m)+1);for(let w=0;w<d.length;w++)e.state.env.set(`${f}_${g+w}`,st(e,d[w]));let b=g+d.length;e.state.env.set(`${f}__length`,String(b))}Jt(e,f);continue}let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(l){let f=l[1],p=st(e,l[2]),h=bt(e,f);if(h)return h;let d=e.state.env.get(f)??"";e.state.env.set(f,d+p),Jt(e,f);continue}let c=Ey(o);if(c.value===void 0&&!c.isArray){Jt(e,c.name);continue}let u=await Ay(e,c,{makeReadonly:!0});if(u)return u}return be}function sf(e){return e.state.directoryStack??=[],e.state.directoryStack}function Ri(e,t){return t&&e===t?"~":t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function DC(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 of(e,t){let n=sf(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 W(`bash: pushd: too many arguments
904
+ `,2);r=t[a+1],a++}}else{if(l.startsWith("-")&&l!=="-")return W(`bash: pushd: ${l}: invalid option
905
+ `,2);if(r!==void 0)return W(`bash: pushd: too many arguments
906
+ `,2);r=l}}if(r===void 0){if(n.length<2)return W(`bash: pushd: no other directory
907
+ `,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=DC(s);try{if(!(await e.fs.stat(s)).isDirectory)return W(`bash: pushd: ${r}: Not a directory
908
+ `,1)}catch{return W(`bash: pushd: ${r}: No such file or directory
909
+ `,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=>Ri(a,i)).join(" ")}
910
+ `;return Ee(o)}function af(e,t){let n=sf(e);for(let o of t)if(o!=="--")return o.startsWith("-")&&o!=="-"?W(`bash: popd: ${o}: invalid option
911
+ `,2):W(`bash: popd: too many arguments
912
+ `,2);if(n.length===0)return W(`bash: popd: directory stack empty
913
+ `,1);let r=n.shift();if(!r)return W(`bash: popd: directory stack empty
914
+ `,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=>Ri(o,s)).join(" ")}
915
+ `;return Ee(i)}function lf(e,t){let n=sf(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 W(`bash: dirs: -${f}: invalid option
916
+ `,2);else return W(`bash: dirs: too many arguments
917
+ `,1);if(r)return e.state.directoryStack=[],be;let a=[e.state.cwd,...n],l=e.state.env.get("HOME")||"",c;return o?(c=a.map((u,f)=>{let p=s?u:Ri(u,l);return` ${f} ${p}`}).join(`
918
+ `),c+=`
919
+ `):i?c=a.map(u=>s?u:Ri(u,l)).join(`
920
+ `)+`
921
+ `:c=a.map(u=>s?u:Ri(u,l)).join(" ")+`
922
+ `,Ee(c)}ct();Ae();async function Pa(e,t,n){let r=t;if(r.length>0){let a=r[0];if(a==="--")r=r.slice(1);else if(a.startsWith("-")&&a!=="-"&&a.length>1)return W(`bash: eval: ${a}: invalid option
923
+ eval: usage: eval [arg ...]
924
+ `,2)}if(r.length===0)return be;let s=r.join(" ");if(s.trim()==="")return be;let i=e.state.groupStdin,o=n??e.state.groupStdin;o!==void 0&&(e.state.groupStdin=o);try{let a=kn(s);return await e.executeScript(a)}catch(a){if(a instanceof It||a instanceof $t||a instanceof St||a instanceof we)throw a;if(a.name==="ParseException")return W(`bash: eval: ${a.message}
925
+ `);throw a}finally{e.state.groupStdin=i}}Ae();function cf(e,t){let n,r="";if(t.length===0)n=e.state.lastExitCode;else{let s=t[0],i=Number.parseInt(s,10);s===""||Number.isNaN(i)||!/^-?\d+$/.test(s)?(r=`bash: exit: ${s}: numeric argument required
926
+ `,n=2):n=(i%256+256)%256}throw new we(n,"",r)}xr();function uf(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);if(u!==void 0){let f=u.replace(/\\/g,"\\\\").replace(/"/g,'\\"');o+=`declare -x ${c}="${f}"
927
+ `}}return Ee(o)}if(n){for(let o of r){let a,l;if(o.includes("=")){let c=o.indexOf("=");a=o.slice(0,c),l=st(e,o.slice(c+1)),e.state.env.set(a,l)}else a=o;la(e,a)}return be}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=st(e,u[2]),c=!0;else if(o.includes("=")){let f=o.indexOf("=");a=o.slice(0,f),l=st(e,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
928
+ `,i=1;continue}if(l!==void 0)if(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,"");$n(e,a)}return z("",s,i)}function Da(e,t){if(t.length<2)return W(`bash: getopts: usage: getopts optstring name [arg ...]
929
+ `);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,p=u[f];if(!p)return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),Da(e,t);let h=o.indexOf(p);if(h===-1){let m="";return i?e.state.env.set("OPTARG",p):m=`bash: illegal option -- ${p}
930
+ `,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(h+1<o.length&&o[h+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",p),s||e.state.env.set(r,":")):(m=`bash: option requires an argument -- ${p}
931
+ `,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,p),{exitCode:s?2:0,stdout:"",stderr:""}}async function ff(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 d=t[c];if(d==="--"){c++,l.push(...t.slice(c));break}if(d==="-r")n=!0,c++;else if(d==="-d")r=!0,c++;else if(d==="-l")s=!0,c++;else if(d==="-t")o=!0,c++;else if(d==="-p"){if(i=!0,c++,c>=t.length)return W(`bash: hash: -p: option requires an argument
932
+ `,1);a=t[c],c++}else if(d.startsWith("-")&&d.length>1){for(let m of d.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"?W(`bash: hash: -p: option requires an argument
933
+ `,1):W(`bash: hash: -${m}: invalid option
934
+ `,1);c++}else l.push(d),c++}if(n)return e.state.hashTable.clear(),be;if(r){if(l.length===0)return W(`bash: hash: -d: option requires an argument
935
+ `,1);let d=!1,m="";for(let g of l)e.state.hashTable.has(g)?e.state.hashTable.delete(g):(m+=`bash: hash: ${g}: not found
936
+ `,d=!0);return d?W(m,1):be}if(o){if(l.length===0)return W(`bash: hash: -t: option requires an argument
937
+ `,1);let d="",m=!1,g="";for(let y of l){let b=e.state.hashTable.get(y);b?l.length>1?d+=`${y} ${b}
938
+ `:d+=`${b}
939
+ `:(g+=`bash: hash: ${y}: not found
940
+ `,m=!0)}return m?{exitCode:1,stdout:d,stderr:g}:Ee(d)}if(i){if(l.length===0)return W(`bash: hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
941
+ `,1);let d=l[0];return e.state.hashTable.set(d,a),be}if(l.length===0){if(e.state.hashTable.size===0)return Ee(`hash: hash table empty
942
+ `);let d="";if(s)for(let[m,g]of e.state.hashTable)d+=`builtin hash -p ${g} ${m}
943
+ `;else{d=`hits command
944
+ `;for(let[,m]of e.state.hashTable)d+=` 1 ${m}
945
+ `}return Ee(d)}let u=!1,f="",h=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let d of l){if(d.includes("/")){f+=`bash: hash: ${d}: cannot use / in name
946
+ `,u=!0;continue}let m=!1;for(let g of h){if(!g)continue;let y=`${g}/${d}`;if(await e.fs.exists(y)){e.state.hashTable.set(d,y),m=!0;break}}m||(f+=`bash: hash: ${d}: not found
947
+ `,u=!0)}return u?W(f,1):be}Ze();var My=new Map([[":",[": [arguments]",`Null command.
948
+ No effect; the command does nothing.
949
+ Exit Status:
950
+ Always succeeds.`]],[".",[". filename [arguments]",`Execute commands from a file in the current shell.
951
+ Read and execute commands from FILENAME in the current shell.
952
+ The entries in $PATH are used to find the directory containing FILENAME.
953
+ Exit Status:
954
+ Returns the status of the last command executed in FILENAME.`]],["[",["[ arg... ]",`Evaluate conditional expression.
955
+ This is a synonym for the "test" builtin, but the last argument must
956
+ be a literal \`]', to match the opening \`['.`]],["alias",["alias [-p] [name[=value] ... ]",`Define or display aliases.
957
+ Without arguments, \`alias' prints the list of aliases in the reusable
958
+ form \`alias NAME=VALUE' on standard output.
959
+ Exit Status:
960
+ alias returns true unless a NAME is supplied for which no alias has been
961
+ defined.`]],["bg",["bg [job_spec ...]",`Move jobs to the background.
962
+ Place the jobs identified by each JOB_SPEC in the background, as if they
963
+ had been started with \`&'.`]],["break",["break [n]",`Exit for, while, or until loops.
964
+ Exit a FOR, WHILE or UNTIL loop. If N is specified, break N enclosing
965
+ loops.
966
+ Exit Status:
967
+ The exit status is 0 unless N is not greater than or equal to 1.`]],["builtin",["builtin [shell-builtin [arg ...]]",`Execute shell builtins.
968
+ Execute SHELL-BUILTIN with arguments ARGs without performing command
969
+ lookup. This is useful when you wish to reimplement a shell builtin
970
+ as a shell function, but need to execute the builtin within the function.
971
+ Exit Status:
972
+ Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
973
+ not a shell builtin.`]],["caller",["caller [expr]",`Return the context of the current subroutine call.
974
+ Without EXPR, returns "$line $filename". With EXPR, returns
975
+ "$line $subroutine $filename"; this extra information can be used to
976
+ provide a stack trace.
977
+ Exit Status:
978
+ Returns 0 unless the shell is not executing a subroutine call or
979
+ EXPR is invalid.`]],["cd",["cd [-L|-P] [dir]",`Change the shell working directory.
980
+ Change the current directory to DIR. The default DIR is the value of the
981
+ HOME shell variable.
982
+
983
+ The variable CDPATH defines the search path for the directory containing
984
+ DIR. Alternative directory names in CDPATH are separated by a colon (:).
985
+ A null directory name is the same as the current directory. If DIR begins
986
+ with a slash (/), then CDPATH is not used.
987
+
988
+ If the directory is not found, and the shell option \`cdable_vars' is set,
989
+ the word is assumed to be a variable name. If that variable has a value,
990
+ its value is used for DIR.
991
+
992
+ Options:
993
+ -L force symbolic links to be followed
994
+ -P use the physical directory structure without following symbolic
995
+ links
996
+
997
+ The default is to follow symbolic links, as if \`-L' were specified.
998
+
999
+ Exit Status:
1000
+ Returns 0 if the directory is changed; non-zero otherwise.`]],["command",["command [-pVv] command [arg ...]",`Execute a simple command or display information about commands.
1001
+ Runs COMMAND with ARGS suppressing shell function lookup, or display
1002
+ information about the specified COMMANDs.
1003
+
1004
+ Options:
1005
+ -p use a default value for PATH that is guaranteed to find all of
1006
+ the standard utilities
1007
+ -v print a description of COMMAND similar to the \`type' builtin
1008
+ -V print a more verbose description of each COMMAND
1009
+
1010
+ Exit Status:
1011
+ 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.
1012
+ Intended to be used from within a shell function generating possible
1013
+ completions. If the optional WORD argument is supplied, matches against
1014
+ WORD are generated.
1015
+ Exit Status:
1016
+ 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.
1017
+ For each NAME, specify how arguments are to be completed.
1018
+ Exit Status:
1019
+ Returns success unless an invalid option is supplied or an error occurs.`]],["continue",["continue [n]",`Resume for, while, or until loops.
1020
+ Resumes the next iteration of the enclosing FOR, WHILE or UNTIL loop.
1021
+ If N is specified, resumes the Nth enclosing loop.
1022
+ Exit Status:
1023
+ 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.
1024
+ Declare variables and give them attributes. If no NAMEs are given,
1025
+ display the attributes and values of all variables.
1026
+
1027
+ Options:
1028
+ -a to make NAMEs indexed arrays (if supported)
1029
+ -A to make NAMEs associative arrays (if supported)
1030
+ -i to make NAMEs have the \`integer' attribute
1031
+ -l to convert the value of each NAME to lower case on assignment
1032
+ -n make NAME a reference to the variable named by its value
1033
+ -r to make NAMEs readonly
1034
+ -t to make NAMEs have the \`trace' attribute
1035
+ -u to convert the value of each NAME to upper case on assignment
1036
+ -x to make NAMEs export
1037
+
1038
+ Exit Status:
1039
+ Returns success unless an invalid option is supplied or a variable
1040
+ assignment error occurs.`]],["dirs",["dirs [-clpv] [+N] [-N]",`Display directory stack.
1041
+ Display the list of currently remembered directories. Directories
1042
+ find their way onto the list with the \`pushd' command; you can get
1043
+ back up through the list with the \`popd' command.
1044
+ Exit Status:
1045
+ Returns success unless an invalid option is supplied or an error occurs.`]],["disown",["disown [-h] [-ar] [jobspec ...]",`Remove jobs from current shell.
1046
+ Without any JOBSPECs, remove the current job.`]],["echo",["echo [-neE] [arg ...]",`Write arguments to the standard output.
1047
+ Display the ARGs, separated by a single space character and followed by a
1048
+ newline, on the standard output.
1049
+
1050
+ Options:
1051
+ -n do not append a newline
1052
+ -e enable interpretation of the following backslash escapes
1053
+ -E explicitly suppress interpretation of backslash escapes
1054
+
1055
+ Exit Status:
1056
+ Returns success unless a write error occurs.`]],["enable",["enable [-a] [-dnps] [-f filename] [name ...]",`Enable and disable shell builtins.
1057
+ Enables and disables builtin shell commands.
1058
+ Exit Status:
1059
+ Returns success unless NAME is not a shell builtin or an error occurs.`]],["eval",["eval [arg ...]",`Execute arguments as a shell command.
1060
+ Combine ARGs into a single string, use the result as input to the shell,
1061
+ and execute the resulting commands.
1062
+ Exit Status:
1063
+ 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.
1064
+ Execute COMMAND, replacing this shell with the specified program.
1065
+ ARGUMENTS become the arguments to COMMAND. If COMMAND is not specified,
1066
+ any redirections take effect in the current shell.
1067
+ Exit Status:
1068
+ Returns success unless COMMAND is not found or a redirection error occurs.`]],["exit",["exit [n]",`Exit the shell.
1069
+ Exits the shell with a status of N. If N is omitted, the exit status
1070
+ is that of the last command executed.`]],["export",["export [-fn] [name[=value] ...] or export -p",`Set export attribute for shell variables.
1071
+ Marks each NAME for automatic export to the environment of subsequently
1072
+ executed commands. If VALUE is supplied, assign VALUE before exporting.
1073
+
1074
+ Options:
1075
+ -f refer to shell functions
1076
+ -n remove the export property from each NAME
1077
+ -p display a list of all exported variables and functions
1078
+
1079
+ Exit Status:
1080
+ Returns success unless an invalid option is given or NAME is invalid.`]],["false",["false",`Return an unsuccessful result.
1081
+ Exit Status:
1082
+ Always fails.`]],["fc",["fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]",`Display or execute commands from the history list.
1083
+ Exit Status:
1084
+ Returns success or status of executed command.`]],["fg",["fg [job_spec]",`Move job to the foreground.
1085
+ Place the job identified by JOB_SPEC in the foreground, making it the
1086
+ current job.`]],["getopts",["getopts optstring name [arg]",`Parse option arguments.
1087
+ Getopts is used by shell procedures to parse positional parameters
1088
+ as options.
1089
+
1090
+ OPTSTRING contains the option letters to be recognized; if a letter
1091
+ is followed by a colon, the option is expected to have an argument,
1092
+ which should be separated from it by white space.
1093
+ Exit Status:
1094
+ Returns success if an option is found; fails if the end of options is
1095
+ encountered or an error occurs.`]],["hash",["hash [-lr] [-p pathname] [-dt] [name ...]",`Remember or display program locations.
1096
+ Determine and remember the full pathname of each command NAME.
1097
+ Exit Status:
1098
+ Returns success unless NAME is not found or an invalid option is given.`]],["help",["help [-s] [pattern ...]",`Display information about builtin commands.
1099
+ Displays brief summaries of builtin commands. If PATTERN is
1100
+ specified, gives detailed help on all commands matching PATTERN,
1101
+ otherwise the list of help topics is printed.
1102
+
1103
+ Options:
1104
+ -s output only a short usage synopsis for each topic matching
1105
+ PATTERN
1106
+
1107
+ Exit Status:
1108
+ 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.
1109
+ Display the history list with line numbers, prefixing each modified
1110
+ entry with a \`*'.
1111
+ Exit Status:
1112
+ 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.
1113
+ Lists the active jobs.
1114
+ Exit Status:
1115
+ 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.
1116
+ Send the processes identified by PID or JOBSPEC the signal named by
1117
+ SIGSPEC or SIGNUM.
1118
+ Exit Status:
1119
+ Returns success unless an invalid option is given or an error occurs.`]],["let",["let arg [arg ...]",`Evaluate arithmetic expressions.
1120
+ Evaluate each ARG as an arithmetic expression. Evaluation is done in
1121
+ fixed-width integers with no check for overflow, though division by 0
1122
+ is trapped and flagged as an error.
1123
+ Exit Status:
1124
+ If the last ARG evaluates to 0, let returns 1; 0 is returned otherwise.`]],["local",["local [option] name[=value] ...",`Define local variables.
1125
+ Create a local variable called NAME, and give it VALUE. OPTION can
1126
+ be any option accepted by \`declare'.
1127
+
1128
+ Local can only be used within a function; it makes the variable NAME
1129
+ have a visible scope restricted to that function and its children.
1130
+ Exit Status:
1131
+ Returns success unless an invalid option is supplied, a variable
1132
+ assignment error occurs, or the shell is not executing a function.`]],["logout",["logout [n]",`Exit a login shell.
1133
+ Exits a login shell with exit status N. Returns an error if not executed
1134
+ 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.
1135
+ Read lines from the standard input into the indexed array variable ARRAY,
1136
+ or from file descriptor FD if the -u option is supplied.
1137
+
1138
+ Options:
1139
+ -d delim Use DELIM to terminate lines, instead of newline
1140
+ -n count Copy at most COUNT lines
1141
+ -O origin Begin assigning to ARRAY at index ORIGIN
1142
+ -s count Discard the first COUNT lines read
1143
+ -t Remove a trailing DELIM from each line read (default newline)
1144
+ -u fd Read lines from file descriptor FD instead of standard input
1145
+
1146
+ Exit Status:
1147
+ Returns success unless an invalid option is given or ARRAY is readonly.`]],["popd",["popd [-n] [+N | -N]",`Remove directories from stack.
1148
+ Removes entries from the directory stack.
1149
+ Exit Status:
1150
+ Returns success unless an invalid argument is supplied or the directory
1151
+ change fails.`]],["printf",["printf [-v var] format [arguments]",`Formats and prints ARGUMENTS under control of the FORMAT.
1152
+
1153
+ Options:
1154
+ -v var assign the output to shell variable VAR rather than
1155
+ display it on the standard output
1156
+
1157
+ FORMAT is a character string which contains three types of objects: plain
1158
+ characters, which are simply copied to standard output; character escape
1159
+ sequences, which are converted and copied to the standard output; and
1160
+ format specifications, each of which causes printing of the next successive
1161
+ argument.
1162
+ Exit Status:
1163
+ Returns success unless an invalid option is given or a write or assignment
1164
+ error occurs.`]],["pushd",["pushd [-n] [+N | -N | dir]",`Add directories to stack.
1165
+ Adds a directory to the top of the directory stack, or rotates
1166
+ the stack, making the new top of the stack the current working
1167
+ directory.
1168
+ Exit Status:
1169
+ Returns success unless an invalid argument is supplied or the directory
1170
+ change fails.`]],["pwd",["pwd [-LP]",`Print the name of the current working directory.
1171
+
1172
+ Options:
1173
+ -L print the value of $PWD if it names the current working
1174
+ directory
1175
+ -P print the physical directory, without any symbolic links
1176
+
1177
+ By default, \`pwd' behaves as if \`-L' were specified.
1178
+ Exit Status:
1179
+ Returns 0 unless an invalid option is given or the current directory
1180
+ 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.
1181
+ Reads a single line from the standard input, or from file descriptor FD
1182
+ if the -u option is supplied. The line is split into fields as with word
1183
+ splitting, and the first word is assigned to the first NAME, the second
1184
+ word to the second NAME, and so on, with any leftover words assigned to
1185
+ the last NAME.
1186
+ Exit Status:
1187
+ The return code is zero, unless end-of-file is encountered, read times out,
1188
+ 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.
1189
+ Mark each NAME as read-only; the values of these NAMEs may not be
1190
+ changed by subsequent assignment.
1191
+ Exit Status:
1192
+ Returns success unless an invalid option is given or NAME is invalid.`]],["return",["return [n]",`Return from a shell function.
1193
+ Causes a function or sourced script to exit with the return value
1194
+ specified by N. If N is omitted, the return status is that of the
1195
+ last command executed within the function or script.
1196
+ Exit Status:
1197
+ 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.
1198
+ Change the value of shell attributes and positional parameters, or
1199
+ display the names and values of shell variables.
1200
+
1201
+ Options:
1202
+ -e Exit immediately if a command exits with a non-zero status.
1203
+ -u Treat unset variables as an error when substituting.
1204
+ -x Print commands and their arguments as they are executed.
1205
+ -o option-name
1206
+ Set the variable corresponding to option-name
1207
+
1208
+ Exit Status:
1209
+ Returns success unless an invalid option is given.`]],["shift",["shift [n]",`Shift positional parameters.
1210
+ Rename the positional parameters $N+1,$N+2 ... to $1,$2 ... If N is
1211
+ not given, it is assumed to be 1.
1212
+ Exit Status:
1213
+ Returns success unless N is negative or greater than $#.`]],["shopt",["shopt [-pqsu] [-o] [optname ...]",`Set and unset shell options.
1214
+ Change the setting of each shell option OPTNAME. Without any option
1215
+ arguments, list each supplied OPTNAME, or all shell options if no
1216
+ OPTNAMEs are given, with an indication of whether or not each is set.
1217
+
1218
+ Options:
1219
+ -o restrict OPTNAMEs to those defined for use with \`set -o'
1220
+ -p print each shell option with an indication of its status
1221
+ -q suppress output
1222
+ -s enable (set) each OPTNAME
1223
+ -u disable (unset) each OPTNAME
1224
+
1225
+ Exit Status:
1226
+ Returns success if OPTNAME is enabled; fails if an invalid option is
1227
+ given or OPTNAME is disabled.`]],["source",["source filename [arguments]",`Execute commands from a file in the current shell.
1228
+ Read and execute commands from FILENAME in the current shell.
1229
+ The entries in $PATH are used to find the directory containing FILENAME.
1230
+ Exit Status:
1231
+ Returns the status of the last command executed in FILENAME.`]],["suspend",["suspend [-f]",`Suspend shell execution.
1232
+ Suspend the execution of this shell until it receives a SIGCONT signal.`]],["test",["test [expr]",`Evaluate conditional expression.
1233
+ Exits with a status of 0 (true) or 1 (false) depending on
1234
+ the evaluation of EXPR. Expressions may be unary or binary.
1235
+ Exit Status:
1236
+ Returns success if EXPR evaluates to true; fails if EXPR evaluates to
1237
+ false or an invalid argument is given.`]],["times",["times",`Display process times.
1238
+ Prints the accumulated user and system times for the shell and all of its
1239
+ child processes.
1240
+ Exit Status:
1241
+ Always succeeds.`]],["trap",["trap [-lp] [[arg] signal_spec ...]",`Trap signals and other events.
1242
+ Defines and activates handlers to be run when the shell receives signals
1243
+ or other conditions.
1244
+ Exit Status:
1245
+ Returns success unless a SIGSPEC is invalid or an invalid option is given.`]],["true",["true",`Return a successful result.
1246
+ Exit Status:
1247
+ Always succeeds.`]],["type",["type [-afptP] name [name ...]",`Display information about command type.
1248
+ For each NAME, indicate how it would be interpreted if used as a
1249
+ command name.
1250
+
1251
+ Options:
1252
+ -a display all locations containing an executable named NAME
1253
+ -f suppress shell function lookup
1254
+ -P force a PATH search for each NAME, even if it is an alias,
1255
+ builtin, or function, and returns the name of the disk file
1256
+ that would be executed
1257
+ -p returns either the name of the disk file that would be executed,
1258
+ or nothing if \`type -t NAME' would not return \`file'
1259
+ -t output a single word which is one of \`alias', \`keyword',
1260
+ \`function', \`builtin', \`file' or \`', if NAME is an alias,
1261
+ shell reserved word, shell function, shell builtin, disk file,
1262
+ or not found, respectively
1263
+
1264
+ Exit Status:
1265
+ 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.
1266
+ Provides control over the resources available to the shell and processes
1267
+ it creates, on systems that allow such control.
1268
+ Exit Status:
1269
+ Returns success unless an invalid option is supplied or an error occurs.`]],["umask",["umask [-p] [-S] [mode]",`Display or set file mode mask.
1270
+ Sets the user file-creation mask to MODE. If MODE is omitted, prints
1271
+ the current value of the mask.
1272
+ Exit Status:
1273
+ 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.
1274
+ Exit Status:
1275
+ 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.
1276
+ For each NAME, remove the corresponding variable or function.
1277
+
1278
+ Options:
1279
+ -f treat each NAME as a shell function
1280
+ -v treat each NAME as a shell variable
1281
+ -n treat each NAME as a name reference and unset the variable itself
1282
+ rather than the variable it references
1283
+
1284
+ Without options, unset first tries to unset a variable, and if that fails,
1285
+ tries to unset a function.
1286
+ Exit Status:
1287
+ 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.
1288
+ Waits for each process identified by an ID, which may be a process ID or a
1289
+ job specification, and reports its termination status.
1290
+ Exit Status:
1291
+ Returns the status of the last ID; fails if ID is invalid or an invalid
1292
+ option is given.`]]]),Uy=[...My.keys()].sort();function pf(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 W(`bash: help: -${u}: invalid option
1293
+ `,2)}s++}else r.push(l),s++}if(r.length===0)return FC();let i="",o=!1,a="";for(let l of r){let c=_C(l);if(c.length===0){a+=`bash: help: no help topics match \`${l}'. Try \`help help' or \`man -k ${l}' or \`info ${l}'.
1294
+ `,o=!0;continue}for(let u of c){let f=My.get(u);if(!f)continue;let[p,h]=f;n?i+=`${u}: ${p}
1295
+ `:i+=`${u}: ${p}
1296
+ ${h}
1297
+ `}}return{exitCode:o?1:0,stdout:i,stderr:a}}function _C(e){let t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,"."),n=Q(`^${t}$`);return Uy.filter(r=>n.test(r))}function FC(){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=Uy.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 Ee(`${e.join(`
1298
+ `)}
1299
+ `)}ct();Ut();function LC(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 hf(e,t){if(t.length===0)return W(`bash: let: expression expected
1300
+ `);let n=LC(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 W(`bash: let: ${s}: ${i.message}
1301
+ `)}return z("","",r===0?1:0)}Ot();ct();Ut();yn();In();xr();async function df(e,t){if(e.state.localScopes.length===0)return W(`bash: local: can only be used in a function
1302
+ `);let n=e.state.localScopes[e.state.localScopes.length-1],r="",s=0,i=!1,o=!1,a=!1,l=[];for(let c of t)if(c==="-n")i=!0;else if(c==="-a")o=!0;else if(c==="-p")a=!0;else if(c.startsWith("-")&&!c.includes("="))for(let u of c.slice(1))u==="n"?i=!0:u==="a"?o=!0:u==="p"&&(a=!0);else l.push(c);if(l.length===0){let c="",u=Array.from(n.keys()).filter(f=>!f.includes("_")||!f.match(/_\d+$/)).filter(f=>!f.includes("__length")).sort();for(let f of u){let p=e.state.env.get(f);p!==void 0&&(c+=`${f}=${p}
1303
+ `)}return z(c,"",0)}for(let c of l){let u,f,p=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(p){u=p[1];let y=p[2];if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
1304
+ `,s=1;continue}if(bt(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let x=`${u}_`;for(let A of e.state.env.keys())A.startsWith(x)&&!A.includes("__")&&(n.has(A)||n.set(A,e.state.env.get(A)))}let b=`${u}_`;for(let x of e.state.env.keys())x.startsWith(b)&&!x.includes("__")&&e.state.env.delete(x);let w=Qn(y);for(let x=0;x<w.length;x++)e.state.env.set(`${u}_${x}`,w[x]);e.state.env.set(`${u}__length`,String(w.length)),Cr(e,u),i&&sr(e,u);continue}let h=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(h){u=h[1];let y=h[2];if(bt(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let $=`${u}_`;for(let R of e.state.env.keys())R.startsWith($)&&!R.includes("__")&&(n.has(R)||n.set(R,e.state.env.get(R)));let D=`${u}__length`;e.state.env.has(D)&&!n.has(D)&&n.set(D,e.state.env.get(D))}let b=Qn(y),w=ut(e,u),x=0,A=e.state.env.get(u);w.length===0&&A!==void 0?(e.state.env.set(`${u}_0`,A),e.state.env.delete(u),x=1):w.length>0&&(x=Math.max(...w)+1);for(let $=0;$<b.length;$++)e.state.env.set(`${u}_${x+$}`,st(e,b[$]));let I=x+b.length;e.state.env.set(`${u}__length`,String(I)),Cr(e,u),i&&sr(e,u);continue}let d=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(d){u=d[1];let y=st(e,d[2]);bt(e,u,"bash"),n.has(u)||n.set(u,e.state.env.get(u));let b=e.state.env.get(u)??"";e.state.env.set(u,b+y),Cr(e,u),i&&sr(e,u);continue}let m=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(m){u=m[1];let y=m[2],b=st(e,m[3]);if(bt(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let A=`${u}_`;for(let $ of e.state.env.keys())$.startsWith(A)&&!$.includes("__")&&(n.has($)||n.set($,e.state.env.get($)));let I=`${u}__length`;e.state.env.has(I)&&!n.has(I)&&n.set(I,e.state.env.get(I))}let w;try{let A=new pe,I=Ne(A,y);w=await re(e,I.expression)}catch{let A=parseInt(y,10);w=Number.isNaN(A)?0:A}e.state.env.set(`${u}_${w}`,b);let x=parseInt(e.state.env.get(`${u}__length`)??"0",10);w>=x&&e.state.env.set(`${u}__length`,String(w+1)),Cr(e,u),i&&sr(e,u);continue}if(c.includes("=")){let y=c.indexOf("=");u=c.slice(0,y),f=st(e,c.slice(y+1))}else u=c;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
1305
+ `,s=1;continue}let g=n.has(u);if(f!==void 0){let y=e.state.env.get(u);if(e.state.tempEnvBindings){let b=e.state.accessedTempEnvVars?.has(u),w=e.state.mutatedTempEnvVars?.has(u);if(!b&&!w)for(let x=e.state.tempEnvBindings.length-1;x>=0;x--){let A=e.state.tempEnvBindings[x];if(A.has(u)){y=A.get(u);break}}}Sy(e,u,y)}if(!g){let y=e.state.env.get(u);if(e.state.tempEnvBindings)for(let b=e.state.tempEnvBindings.length-1;b>=0;b--){let w=e.state.tempEnvBindings[b];if(w.has(u)){y=w.get(u);break}}if(n.set(u,y),o){let b=`${u}_`;for(let x of e.state.env.keys())x.startsWith(b)&&!x.includes("__")&&(n.has(x)||n.set(x,e.state.env.get(x)));let w=`${u}__length`;e.state.env.has(w)&&!n.has(w)&&n.set(w,e.state.env.get(w))}}if(o&&f===void 0){let y=`${u}_`;for(let b of e.state.env.keys())b.startsWith(y)&&!b.includes("__")&&e.state.env.delete(b);e.state.env.set(`${u}__length`,"0")}else if(f!==void 0){if(bt(e,u,"bash"),i&&f!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(f)){r+=`bash: local: \`${f}': invalid variable name for name reference
1306
+ `,s=1;continue}e.state.env.set(u,f),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(u))}else{let y=e.state.tempEnvBindings?.some(b=>b.has(u));!g&&!y&&e.state.env.delete(u)}Cr(e,u),i&&sr(e,u)}return z("",r,s)}yn();function mf(e,t,n){let r=`
1307
+ `,s=0,i=0,o=0,a=!1,l="MAPFILE",c=0;for(;c<t.length;){let b=t[c];b==="-d"&&c+1<t.length?(r=t[c+1]===""?"\0":t[c+1]||`
1308
+ `,c+=2):b==="-n"&&c+1<t.length?(s=Number.parseInt(t[c+1],10)||0,c+=2):b==="-O"&&c+1<t.length?(i=Number.parseInt(t[c+1],10)||0,c+=2):b==="-s"&&c+1<t.length?(o=Number.parseInt(t[c+1],10)||0,c+=2):b==="-t"?(a=!0,c++):b==="-u"||b==="-C"||b==="-c"?c+=2:(b.startsWith("-")||(l=b),c++)}let u=n;!u&&e.state.groupStdin!==void 0&&(u=e.state.groupStdin);let f=[],p=u,h=0,d=0,m=e.limits?.maxArrayElements??1e5;for(;p.length>0;){let b=p.indexOf(r);if(b===-1){if(p.length>0){if(d<o)d++;else if(s===0||h<s){if(i+h>=m)return z("",`mapfile: array element limit exceeded (${m})
1309
+ `,1);let A=p,I=A.indexOf("\0");I!==-1&&(A=A.substring(0,I)),f.push(A),h++}}break}let w=p.substring(0,b),x=w.indexOf("\0");if(x!==-1&&(w=w.substring(0,x)),!a&&r!=="\0"&&(w+=r),p=p.substring(b+r.length),d<o){d++;continue}if(s>0&&h>=s)break;if(i+h>=m)return z("",`mapfile: array element limit exceeded (${m})
1310
+ `,1);f.push(w),h++}i===0&&Gn(e,l);for(let b=0;b<f.length;b++)e.state.env.set(`${l}_${i+b}`,f[b]);let g=parseInt(e.state.env.get(`${l}__length`)||"0",10),y=i+f.length;return e.state.env.set(`${l}__length`,String(Math.max(g,y))),e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=""),z("","",0)}yn();an();function MC(e){if(!e.startsWith("__rw__:"))return null;let t=e.slice(7),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=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}function UC(e,t,n){return`__rw__:${e.length}:${e}:${t}:${n}`}function gf(e,t,n,r=-1){let s=!1,i=`
1311
+ `,o="",a=-1,l=-1,c=null,u=-1,f=-1,p=[],h=0,d=!1,m=(C,O)=>{let T=1;for(;T<C.length;){let N=C[T];if(N==="r")s=!0,T++;else if(N==="s")T++;else{if(N==="d")return T+1<C.length?(i=C.substring(T+1),{nextArgIndex:O+1}):O+1<t.length?(i=t[O+1],{nextArgIndex:O+2}):{nextArgIndex:O+1};if(N==="n"){if(T+1<C.length){let F=C.substring(T+1);return a=Number.parseInt(F,10),(Number.isNaN(a)||a<0)&&(d=!0,a=0),{nextArgIndex:O+1}}else if(O+1<t.length)return a=Number.parseInt(t[O+1],10),(Number.isNaN(a)||a<0)&&(d=!0,a=0),{nextArgIndex:O+2};return{nextArgIndex:O+1}}else if(N==="N"){if(T+1<C.length){let F=C.substring(T+1);return l=Number.parseInt(F,10),(Number.isNaN(l)||l<0)&&(d=!0,l=0),{nextArgIndex:O+1}}else if(O+1<t.length)return l=Number.parseInt(t[O+1],10),(Number.isNaN(l)||l<0)&&(d=!0,l=0),{nextArgIndex:O+2};return{nextArgIndex:O+1}}else{if(N==="a")return T+1<C.length?(c=C.substring(T+1),{nextArgIndex:O+1}):O+1<t.length?(c=t[O+1],{nextArgIndex:O+2}):{nextArgIndex:O+1};if(N==="p")return T+1<C.length?(o=C.substring(T+1),{nextArgIndex:O+1}):O+1<t.length?(o=t[O+1],{nextArgIndex:O+2}):{nextArgIndex:O+1};if(N==="u"){if(T+1<C.length){let F=C.substring(T+1);return u=Number.parseInt(F,10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:O+1}}else if(O+1<t.length)return u=Number.parseInt(t[O+1],10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:O+2};return{nextArgIndex:O+1}}else if(N==="t"){if(T+1<C.length){let F=C.substring(T+1);return f=Number.parseFloat(F),Number.isNaN(f)&&(f=0),{nextArgIndex:O+1}}else if(O+1<t.length)return f=Number.parseFloat(t[O+1]),Number.isNaN(f)&&(f=0),{nextArgIndex:O+2};return{nextArgIndex:O+1}}else if(N==="e"||N==="i"||N==="P"){if(N==="i"&&O+1<t.length)return{nextArgIndex:O+2};T++}else T++}}}return{nextArgIndex:O+1}};for(;h<t.length;){let C=t[h];if(C.startsWith("-")&&C.length>1&&C!=="--"){let O=m(C,h);if(O.nextArgIndex===-1)return{stdout:"",stderr:"",exitCode:2};if(O.nextArgIndex===-2)return{stdout:"",stderr:"",exitCode:1};h=O.nextArgIndex}else if(C==="--")for(h++;h<t.length;)p.push(t[h]),h++;else p.push(C),h++}if(d)return z("","",1);if(p.length===0&&c===null&&p.push("REPLY"),f===0){if(c)Gn(e,c);else{for(let C of p)e.state.env.set(C,"");p.length===0&&e.state.env.set("REPLY","")}return z("","",0)}if(f<0&&f!==-1)return z("","",1);let g=n;u>=0?e.state.fileDescriptors?g=e.state.fileDescriptors.get(u)||"":g="":!g&&e.state.groupStdin!==void 0&&(g=e.state.groupStdin);let y=i===""?"\0":i,b="",w=0,x=!0,A=C=>{if(u>=0&&e.state.fileDescriptors)e.state.fileDescriptors.set(u,g.substring(C));else if(r>=0&&e.state.fileDescriptors){let O=e.state.fileDescriptors.get(r);if(O?.startsWith("__rw__:")){let T=MC(O);if(T){let N=T.position+C;e.state.fileDescriptors.set(r,UC(T.path,N,T.content))}}}else e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=g.substring(C))};if(l>=0){let C=Math.min(l,g.length);b=g.substring(0,C),w=C,x=C>=l,A(w);let O=p[0]||"REPLY";e.state.env.set(O,b);for(let T=1;T<p.length;T++)e.state.env.set(p[T],"");return z("","",x?0:1)}else if(a>=0){let C=0,O=0,T=!1;for(;O<g.length&&C<a;){let N=g[O];if(N===y){w=O+1,T=!0;break}if(!s&&N==="\\"&&O+1<g.length){let F=g[O+1];if(F===y&&y===`
1312
+ `){O+=2,w=O;continue}if(F===y){O+=2,C++,b+=F,w=O;continue}b+=F,O+=2,C++,w=O}else b+=N,O++,C++,w=O}x=C>=a||T,A(w)}else{w=0;let C=0;for(;C<g.length;){let O=g[C];if(O===y){w=C+y.length,x=!0;break}if(!s&&O==="\\"&&C+1<g.length){let T=g[C+1];if(T===`
1313
+ `){C+=2;continue}if(T===y){b+=T,C+=2;continue}b+=O,b+=T,C+=2;continue}b+=O,C++}if(C>=g.length&&(x=!1,w=C,b.length===0&&g.length===0)){for(let O of p)e.state.env.set(O,"");return c&&Gn(e,c),z("","",1)}A(w)}y===`
1314
+ `&&b.endsWith(`
1315
+ `)&&(b=b.slice(0,-1));let I=C=>s?C:C.replace(/\\(.)/g,"$1");if(p.length===1&&p[0]==="REPLY")return e.state.env.set("REPLY",I(b)),z("","",x?0:1);let $=yt(e.state.env);if(c){let{words:C}=bu(b,$,void 0,s),O=e.limits?.maxArrayElements??1e5;if(C.length>O)return z("",`read: array element limit exceeded (${O})
1316
+ `,1);Gn(e,c);for(let T=0;T<C.length;T++)e.state.env.set(`${c}_${T}`,I(C[T]));return z("","",x?0:1)}let D=p.length,{words:R,wordStarts:L}=bu(b,$,D,s);for(let C=0;C<p.length;C++){let O=p[C];if(C<p.length-1)e.state.env.set(O,I(R[C]??""));else if(C<L.length){let T=b.substring(L[C]);T=Ug(T,$,s),T=I(T),e.state.env.set(O,T)}else e.state.env.set(O,"")}return z("","",x?0:1)}Ae();function yf(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return W("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 W(`bash: return: ${r}: numeric argument required
1317
+ `,2);n=(s%256+256)%256}throw new St(n)}Ae();yn();var _a=`set: usage: set [-eux] [+eux] [-o option] [+o option]
1318
+ Options:
1319
+ -e Exit immediately if a command exits with non-zero status
1320
+ +e Disable -e
1321
+ -u Treat unset variables as an error when substituting
1322
+ +u Disable -u
1323
+ -x Print commands and their arguments as they are executed
1324
+ +x Disable -x
1325
+ -o errexit Same as -e
1326
+ +o errexit Disable errexit
1327
+ -o nounset Same as -u
1328
+ +o nounset Disable nounset
1329
+ -o pipefail Return status of last failing command in pipeline
1330
+ +o pipefail Disable pipefail
1331
+ -o xtrace Same as -x
1332
+ +o xtrace Disable xtrace
1333
+ `,By=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]]),Wy=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]]),zy=["errexit","nounset","pipefail","verbose","xtrace","posix","allexport","noclobber","noglob","noexec","vi","emacs"],Hy=["braceexpand","errtrace","functrace","hashall","histexpand","history","ignoreeof","interactive-comments","keyword","monitor","nolog","notify","onecmd","physical","privileged"];function jy(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,Ts(e))}function BC(e,t){return t+1<e.length&&!e[t+1].startsWith("-")&&!e[t+1].startsWith("+")}function WC(e,t){let n=ut(e,t);if(n.length===0)return`${t}=()`;let r=n.map(s=>{let i=e.state.env.get(`${t}_${s}`)??"";return`[${s}]=${Yr(i)}`});return`${t}=(${r.join(" ")})`}function zC(e){return/^[a-zA-Z0-9_]+$/.test(e)?e:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function HC(e,t){let n=Nn(e,t);if(n.length===0)return`${t}=()`;let r=n.map(s=>{let i=e.state.env.get(`${t}_${s}`)??"";return`[${zC(s)}]=${Yr(i)}`});return`${t}=(${r.join(" ")} )`}function jC(e){let t=new Set,n=e.state.associativeArrays??new Set;for(let r of e.state.env.keys()){let s=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)$/);if(s){let i=s[1];n.has(i)||t.add(i)}}return t}function GC(e){return e.state.associativeArrays??new Set}function bf(e,t){if(t.includes("--help"))return Ee(_a);if(t.length===0){let r=jC(e),s=GC(e),i=l=>{for(let c of s){let u=`${c}_`,f=`${c}__length`;if(l!==f&&l.startsWith(u)){if(l.slice(u.length).startsWith("_length"))continue;return!0}}return!1},o=[];for(let[l,c]of e.state.env){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(l)||r.has(l)||s.has(l))continue;let u=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)$/);if(u&&r.has(u[1]))continue;let f=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);f&&r.has(f[1])||i(l)||f&&s.has(f[1])||o.push([l,c])}let a=[];for(let[l,c]of o.sort(([u],[f])=>u<f?-1:u>f?1:0))a.push(`${l}=${Ra(c)}`);for(let l of[...r].sort((c,u)=>c<u?-1:c>u?1:0))a.push(WC(e,l));for(let l of[...s].sort((c,u)=>c<u?-1:c>u?1:0))a.push(HC(e,l));return a.sort((l,c)=>{let u=l.split("=")[0],f=c.split("=")[0];return u<f?-1:u>f?1:0}),Ee(a.length>0?`${a.join(`
1334
+ `)}
1335
+ `:"")}let n=0;for(;n<t.length;){let r=t[n];if((r==="-o"||r==="+o")&&BC(t,n)){let s=t[n+1];if(!Wy.has(s)){let i=`bash: set: ${s}: invalid option name
1336
+ ${_a}`;if(e.state.options.posix)throw new nn(1,"",i);return W(i)}jy(e,Wy.get(s)??null,r==="-o"),n+=2;continue}if(r==="-o"){let s=zy.map(a=>`${a.padEnd(16)}${e.state.options[a]?"on":"off"}`),i=Hy.map(a=>`${a.padEnd(16)}off`),o=[...s,...i].sort();return Ee(`${o.join(`
1337
+ `)}
1338
+ `)}if(r==="+o"){let s=zy.map(a=>`set ${e.state.options[a]?"-o":"+o"} ${a}`),i=Hy.map(a=>`set +o ${a}`),o=[...s,...i].sort();return Ee(`${o.join(`
1339
+ `)}
1340
+ `)}if(r.length>1&&(r[0]==="-"||r[0]==="+")&&r[1]!=="-"){let s=r[0]==="-";for(let i=1;i<r.length;i++){let o=r[i];if(!By.has(o)){let a=`bash: set: ${r[0]}${o}: invalid option
1341
+ ${_a}`;if(e.state.options.posix)throw new nn(1,"",a);return W(a)}jy(e,By.get(o)??null,s)}n++;continue}if(r==="--")return wf(e,t.slice(n+1)),be;if(r==="-"){if(e.state.options.xtrace=!1,e.state.options.verbose=!1,Ts(e),n+1<t.length)return wf(e,t.slice(n+1)),be;n++;continue}if(r==="+"){n++;continue}if(r.startsWith("-")||r.startsWith("+")){let s=`bash: set: ${r}: invalid option
1342
+ ${_a}`;if(e.state.options.posix)throw new nn(1,"",s);return W(s)}return wf(e,t.slice(n)),be}return be}function wf(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(" "))}Ae();function xf(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
1343
+ `;if(e.state.options.posix)throw new nn(1,"",a);return W(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
1344
+ `;if(e.state.options.posix)throw new nn(1,"",o);return W(o)}if(n===0)return be;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(" ")),be}ct();Ae();async function Ef(e,t){let n=t;if(n.length>0&&n[0]==="--"&&(n=n.slice(1)),n.length===0)return z("",`bash: source: filename argument required
1345
+ `,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 p=e.fs.resolvePath(e.state.cwd,`${f}/${r}`);try{if((await e.fs.stat(p)).isDirectory)continue;i=await e.fs.readFile(p),s=p;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 W(`bash: ${r}: No such file or directory
1346
+ `);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 X(`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 we)throw c;if(c instanceof St)return z(c.stdout,c.stderr,c.exitCode);if(c.name==="ParseException")return W(`bash: ${r}: ${c.message}
1347
+ `);throw c}}Ot();ct();Ut();Xt();Bt();In();xr();function Gy(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function VC(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}async function Vy(e,t){if(VC(t))return null;try{let n=new pe,r=Ne(n,t);return await re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}function qy(e,t){if(e.state.localVarStack?.has(t)){let r=$a(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)Ia(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,r.scopeIndex),Af(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),Ia(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||Ia(e,t),!0}}return!1}function Af(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 Zy(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 pe().parseWordFromString(n,!0,!1);return le(e,s)}if(t.includes("$")){let r=new pe().parseWordFromString(t,!1,!1);return le(e,r)}return t}async function Sf(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 p=c[1],h=c[2];if(h==="@"||h==="*"){let w=ce(e,p);for(let[x]of w)e.state.env.delete(`${p}_${x}`);e.state.env.delete(p);continue}let d=e.state.associativeArrays?.has(p);if(d){let w=await Zy(e,h);e.state.env.delete(`${p}_${w}`);continue}let m=ir(e,p),g=e.state.declaredVars?.has(p);if((e.state.env.has(p)||g)&&!m&&!d){r+=`bash: unset: ${p}: not an array variable
1348
+ `,s=1;continue}let b=await Vy(e,h);if(b===null&&m){r+=`bash: unset: ${h}: not a valid identifier
1349
+ `,s=1;continue}if(b===null)continue;if(b<0){let w=ce(e,p),x=w.length,A=e.state.currentLine;if(x===0){r+=`bash: line ${A}: unset: [${b}]: bad array subscript
1350
+ `,s=1;continue}let I=x+b;if(I<0){r+=`bash: line ${A}: unset: [${b}]: bad array subscript
1351
+ `,s=1;continue}let $=w[I][0];e.state.env.delete(`${p}_${$}`);continue}e.state.env.delete(`${p}_${b}`);continue}if(!Gy(i)){r+=`bash: unset: \`${i}': not a valid identifier
1352
+ `,s=1;continue}let u=i;if(We(e,i)){let p=Mt(e,i);p&&p!==i&&(u=p)}if(Zn(e,u)){r+=`bash: unset: ${u}: cannot unset: readonly variable
1353
+ `,s=1;continue}let f=Bs(e,u);if(f!==void 0&&f!==e.state.callDepth)qy(e,u);else if(e.state.fullyUnsetLocals?.has(u))e.state.env.delete(u);else if(f!==void 0){let p=e.state.accessedTempEnvVars?.has(u),h=e.state.mutatedTempEnvVars?.has(u);if((p||h)&&e.state.localVarStack?.has(u)){let d=$a(e,u);d?d.value===void 0?e.state.env.delete(u):e.state.env.set(u,d.value):e.state.env.delete(u)}else e.state.env.delete(u)}else Af(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(u==="@"||u==="*"){let m=ce(e,c);for(let[g]of m)e.state.env.delete(`${c}_${g}`);e.state.env.delete(c);continue}let f=e.state.associativeArrays?.has(c);if(f){let m=await Zy(e,u);e.state.env.delete(`${c}_${m}`);continue}let p=ir(e,c);if(e.state.env.has(c)&&!p&&!f){r+=`bash: unset: ${c}: not an array variable
1354
+ `,s=1;continue}let d=await Vy(e,u);if(d===null&&p){r+=`bash: unset: ${u}: not a valid identifier
1355
+ `,s=1;continue}if(d===null)continue;if(d<0){let m=ce(e,c),g=m.length,y=e.state.currentLine;if(g===0){r+=`bash: line ${y}: unset: [${d}]: bad array subscript
1356
+ `,s=1;continue}let b=g+d;if(b<0){r+=`bash: line ${y}: unset: [${d}]: bad array subscript
1357
+ `,s=1;continue}let w=m[b][0];e.state.env.delete(`${c}_${w}`);continue}e.state.env.delete(`${c}_${d}`);continue}if(!Gy(i)){r+=`bash: unset: \`${i}': not a valid identifier
1358
+ `,s=1;continue}let a=i;if(We(e,i)){let c=Mt(e,i);c&&c!==i&&(a=c)}if(Zn(e,a)){r+=`bash: unset: ${a}: cannot unset: readonly variable
1359
+ `,s=1;continue}let l=Bs(e,a);if(l!==void 0&&l!==e.state.callDepth)qy(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=$a(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 Af(e,a)||e.state.env.delete(a);e.state.exportedVars?.delete(a),e.state.functions.delete(i)}return z("",r,s)}var Cf=["extglob","dotglob","nullglob","failglob","globstar","globskipdots","nocaseglob","nocasematch","expand_aliases","lastpipe","xpg_echo"],qC=["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 Fa(e){return Cf.includes(e)}function ZC(e){return qC.includes(e)}function Ky(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=[],l=0;for(;l<t.length;){let p=t[l];if(p==="--"){l++;break}if(p.startsWith("-")&&p.length>1){for(let h=1;h<p.length;h++){let d=p[h];switch(d){case"s":n=!0;break;case"u":r=!0;break;case"p":s=!0;break;case"q":i=!0;break;case"o":o=!0;break;default:return{exitCode:2,stdout:"",stderr:`shopt: -${d}: invalid option
1360
+ `}}}l++}else break}for(;l<t.length;)a.push(t[l]),l++;if(o)return KC(e,a,n,r,s,i);if(n&&r)return{exitCode:1,stdout:"",stderr:`shopt: cannot set and unset shell options simultaneously
1361
+ `};if(a.length===0){if(n||r){let h=[];for(let d of Cf){let m=e.state.shoptOptions[d];n&&m?h.push(s?`shopt -s ${d}`:`${d} on`):r&&!m&&h.push(s?`shopt -u ${d}`:`${d} off`)}return{exitCode:0,stdout:h.length>0?`${h.join(`
1362
+ `)}
1363
+ `:"",stderr:""}}let p=[];for(let h of Cf){let d=e.state.shoptOptions[h];p.push(s?`shopt ${d?"-s":"-u"} ${h}`:`${h} ${d?"on":"off"}`)}return{exitCode:0,stdout:`${p.join(`
1364
+ `)}
1365
+ `,stderr:""}}let c=!1,u="",f=[];for(let p of a){if(!Fa(p)&&!ZC(p)){u+=`shopt: ${p}: invalid shell option name
1366
+ `,c=!0;continue}if(n)Fa(p)&&(e.state.shoptOptions[p]=!0,jc(e));else if(r)Fa(p)&&(e.state.shoptOptions[p]=!1,jc(e));else if(Fa(p)){let h=e.state.shoptOptions[p];i?h||(c=!0):s?(f.push(`shopt ${h?"-s":"-u"} ${p}`),h||(c=!0)):(f.push(`${p} ${h?"on":"off"}`),h||(c=!0))}else i?c=!0:s?(f.push(`shopt -u ${p}`),c=!0):(f.push(`${p} off`),c=!0)}return{exitCode:c?1:0,stdout:f.length>0?`${f.join(`
1367
+ `)}
1368
+ `:"",stderr:u}}function KC(e,t,n,r,s,i){let o=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"]]),a=["braceexpand","errtrace","functrace","hashall","histexpand","history","ignoreeof","interactive-comments","keyword","monitor","nolog","notify","onecmd","physical","privileged"],l=[...o.keys(),...a].sort();if(t.length===0){let p=[];for(let h of l){let d=a.includes(h),m=o.get(h),g=d||!m?!1:e.state.options[m];n&&!g||r&&g||p.push(s?`set ${g?"-o":"+o"} ${h}`:`${h} ${g?"on":"off"}`)}return{exitCode:0,stdout:p.length>0?`${p.join(`
1369
+ `)}
1370
+ `:"",stderr:""}}let c=!1,u="",f=[];for(let p of t){let h=o.has(p),d=a.includes(p);if(!h&&!d){u+=`shopt: ${p}: invalid option name
1371
+ `,c=!0;continue}if(d){n||r||(i?c=!0:s?(f.push(`set +o ${p}`),c=!0):(f.push(`${p} off`),c=!0));continue}let m=o.get(p);if(m)if(n)m==="vi"?e.state.options.emacs=!1:m==="emacs"&&(e.state.options.vi=!1),e.state.options[m]=!0,Ts(e);else if(r)e.state.options[m]=!1,Ts(e);else{let g=e.state.options[m];i?g||(c=!0):s?(f.push(`set ${g?"-o":"+o"} ${p}`),g||(c=!0)):(f.push(`${p} ${g?"on":"off"}`),g||(c=!0))}}return{exitCode:c?1:0,stdout:f.length>0?`${f.join(`
1372
+ `)}
1373
+ `:"",stderr:u}}async function Qy(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};let a=o.split("/").pop()||t,l=e.commands.get(a);try{let c=await e.fs.stat(o);return c.isDirectory?{error:"permission_denied",path:o}:l?{cmd:l,path:o}:(c.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)if(await e.fs.exists(o)){let a=e.commands.get(t);if(a)return{cmd:a,path:o};try{let l=await e.fs.stat(o);if(!l.isDirectory&&(l.mode&73)!==0)return{script:!0,path:o}}catch{}}else 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),p=o==="/bin"||o==="/usr/bin";if(f&&p)return{cmd:f,path:l};if(u){if(f&&!p)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 La(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(await e.fs.exists(a)){try{if((await e.fs.stat(a)).isDirectory)continue}catch{continue}n.push(i.startsWith("/")?a:`${i}/${t}`)}}return n}Wn();function QC(e){return e!==null&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}function Ke(e,t,n,r){return((...s)=>{it(t,n,`${r} call`);let i=e(...s);return QC(i)?i.then(o=>(it(t,n,`${r} post-await`),o),o=>{throw it(t,n,`${r} post-await`),o}):(it(t,n,`${r} return`),i)})}function XC(e,t,n){let r={readFile:Ke(e.readFile.bind(e),t,n,"fs.readFile"),...typeof e.readFileBytes=="function"?{readFileBytes:Ke(e.readFileBytes.bind(e),t,n,"fs.readFileBytes")}:Object.create(null),readFileBuffer:Ke(e.readFileBuffer.bind(e),t,n,"fs.readFileBuffer"),writeFile:Ke(e.writeFile.bind(e),t,n,"fs.writeFile"),appendFile:Ke(e.appendFile.bind(e),t,n,"fs.appendFile"),exists:Ke(e.exists.bind(e),t,n,"fs.exists"),stat:Ke(e.stat.bind(e),t,n,"fs.stat"),mkdir:Ke(e.mkdir.bind(e),t,n,"fs.mkdir"),readdir:Ke(e.readdir.bind(e),t,n,"fs.readdir"),rm:Ke(e.rm.bind(e),t,n,"fs.rm"),cp:Ke(e.cp.bind(e),t,n,"fs.cp"),mv:Ke(e.mv.bind(e),t,n,"fs.mv"),resolvePath:Ke(e.resolvePath.bind(e),t,n,"fs.resolvePath"),getAllPaths:Ke(e.getAllPaths.bind(e),t,n,"fs.getAllPaths"),chmod:Ke(e.chmod.bind(e),t,n,"fs.chmod"),symlink:Ke(e.symlink.bind(e),t,n,"fs.symlink"),link:Ke(e.link.bind(e),t,n,"fs.link"),readlink:Ke(e.readlink.bind(e),t,n,"fs.readlink"),lstat:Ke(e.lstat.bind(e),t,n,"fs.lstat"),realpath:Ke(e.realpath.bind(e),t,n,"fs.realpath"),utimes:Ke(e.utimes.bind(e),t,n,"fs.utimes")};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=Ke(e.readdirWithFileTypes.bind(e),t,n,"fs.readdirWithFileTypes")),r}function Xy(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r={...e,fs:XC(e.fs,e.requireDefenseContext,n)};return e.exec&&(r.exec=Ke(e.exec,e.requireDefenseContext,n,"exec")),e.fetch&&(r.fetch=Ke(e.fetch,e.requireDefenseContext,n,"fetch")),e.sleep&&(r.sleep=Ke(e.sleep,e.requireDefenseContext,n,"sleep")),e.getRegisteredCommands&&(r.getRegisteredCommands=Ke(e.getRegisteredCommands,e.requireDefenseContext,n,"getRegisteredCommands")),r}Ae();rn();async function t7(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="",p=0,h=!1,d=!1;for(let m of c){let g=!1;if(o){if(a){let I=await r(m);if(I.length>0){for(let $ of I)u+=`${$}
1374
+ `;h=!0,g=!0}}else{let I=await n(m);I&&(u+=`${I}
1375
+ `,h=!0,g=!0)}g||(d=!0);continue}let y=!l&&e.state.functions.has(m);if(a&&y){if(!i)if(s)u+=`function
1376
+ `;else{let I=e.state.functions.get(m),$=I?Yy(m,I):`${m} is a function
1377
+ `;u+=$}g=!0}let b=e.state.env.get(`BASH_ALIAS_${m}`);if(b!==void 0&&(a||!g)&&(i||(s?u+=`alias
1378
+ `:u+=`${m} is aliased to \`${b}'
1379
+ `),g=!0,!a)||Wu.has(m)&&(a||!g)&&(i||(s?u+=`keyword
1380
+ `:u+=`${m} is a shell keyword
1381
+ `),g=!0,!a))continue;if(!a&&y&&!g){if(!i)if(s)u+=`function
1382
+ `;else{let I=e.state.functions.get(m),$=I?Yy(m,I):`${m} is a function
1383
+ `;u+=$}g=!0;continue}if(!(Ws.has(m)&&(a||!g)&&(i||(s?u+=`builtin
1384
+ `:u+=`${m} is a shell builtin
1385
+ `),g=!0,!a))){if(a){let I=await r(m);for(let $ of I)i?u+=`${$}
1386
+ `:s?u+=`file
1387
+ `:u+=`${m} is ${$}
1388
+ `,h=!0,g=!0}else if(!g){let I=await n(m);I&&(i?u+=`${I}
1389
+ `:s?u+=`file
1390
+ `:u+=`${m} is ${I}
1391
+ `,h=!0,g=!0)}if(!g&&(d=!0,!s&&!i)){let I=!0;if(m.includes("/")){let $=e.fs.resolvePath(e.state.cwd,m);await e.fs.exists($)&&(I=!1)}I&&(f+=`bash: type: ${m}: not found
1392
+ `)}}}return i?p=d&&!h?1:0:p=d?1:0,z(u,f,p)}function Yy(e,t){let n;return t.body.type==="Group"?n=t.body.body.map(s=>Pi(s)).join("; "):n=Pi(t.body),`${e} is a function
1393
+ ${e} ()
1394
+ {
1395
+ ${n}
1396
+ }
1397
+ `}function Pi(e){if(Array.isArray(e))return e.map(t=>Pi(t)).join("; ");if(e.type==="Statement"){let t=[];for(let n=0;n<e.pipelines.length;n++){let r=e.pipelines[n];t.push(YC(r)),e.operators[n]&&t.push(e.operators[n])}return t.join(" ")}if(e.type==="SimpleCommand"){let t=e,n=[];t.name&&n.push(Jy(t.name));for(let r of t.args)n.push(Jy(r));return n.join(" ")}return e.type==="Group"?`{ ${e.body.map(r=>Pi(r)).join("; ")}; }`:"..."}function YC(e){let t=e.commands.map(n=>Pi(n));return(e.negated?"! ":"")+t.join(" | ")}function Jy(e){let t="";for(let n of e.parts)n.type==="Literal"?t+=n.value:n.type==="DoubleQuoted"?t+=`"${n.parts.map(r=>e7(r)).join("")}"`:n.type==="SingleQuoted"?t+=`'${n.value}'`:t+=e7(n);return t}function e7(e){let t=e;return t.type==="Literal"?t.value??"":t.type==="Variable"?`$${t.name}`:""}async function n7(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}"
1398
+ `:s+=`alias ${a}='${l}'
1399
+ `;else if(Wu.has(a))r?s+=`${a} is a shell keyword
1400
+ `:s+=`${a}
1401
+ `;else if(Ws.has(a))r?s+=`${a} is a shell builtin
1402
+ `:s+=`${a}
1403
+ `;else if(e.state.functions.has(a))r?s+=`${a} is a function
1404
+ `:s+=`${a}
1405
+ `;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}
1406
+ `:s+=`${a}
1407
+ `,u=!0)}catch{}u||(r&&(i+=`${a}: not found
1408
+ `),o=1)}else if(e.commands.has(a)){let u=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":"),f=null;for(let p of u){if(!p)continue;let h=`${p}/${a}`;try{let d=await e.fs.stat(h);if(!d.isDirectory&&(d.mode&73)!==0){f=h;break}}catch{}}f||(f=`/usr/bin/${a}`),r?s+=`${a} is ${f}
1409
+ `:s+=`${f}
1410
+ `}else r&&(i+=`${a}: not found
1411
+ `),o=1}return z(s,i,o)}async function r7(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{if((await e.fs.stat(o)).isDirectory)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}async function s7(e,t,n,r,s,i,o,a){let{ctx:l,runCommand:c}=e;if(l.coverage&&Ws.has(t)&&l.coverage.hit(`bash:builtin:${t}`),t==="export")return uf(l,n);if(t==="unset")return Sf(l,n);if(t==="exit")return cf(l,n);if(t==="local")return df(l,n);if(t==="set")return bf(l,n);if(t==="break")return _u(l,n);if(t==="continue")return Zu(l,n);if(t==="return")return yf(l,n);if(t==="eval"&&l.state.options.posix)return Pa(l,n,s);if(t==="shift")return xf(l,n);if(t==="getopts")return Da(l,n);if(t==="compgen")return ju(l,n);if(t==="complete")return Vu(l,n);if(t==="compopt")return qu(l,n);if(t==="pushd")return await of(l,n);if(t==="popd")return af(l,n);if(t==="dirs")return lf(l,n);if(t==="source"||t===".")return Ef(l,n);if(t==="read")return gf(l,n,s,a);if(t==="mapfile"||t==="readarray")return mf(l,n,s);if(t==="declare"||t==="typeset")return nf(l,n);if(t==="readonly")return rf(l,n);if(!i){let u=l.state.functions.get(t);if(u)return Ta(l,u,n,s)}if(t==="eval")return Pa(l,n,s);if(t==="cd")return await Fu(l,n);if(t===":"||t==="true")return be;if(t==="false")return ft(!1);if(t==="let")return hf(l,n);if(t==="command")return JC(e,n,s);if(t==="builtin")return ev(e,n,s);if(t==="shopt")return Ky(l,n);if(t==="exec"){if(n.length===0)return be;let[u,...f]=n;return c(u,f,[],s,!1,!1,-1)}if(t==="wait")return be;if(t==="type")return await t7(l,n,u=>r7(l,u),u=>La(l,u));if(t==="hash")return ff(l,n);if(t==="help")return pf(l,n);if(t==="["||t==="test"){let u=n;if(t==="["){if(n[n.length-1]!=="]")return W("[: missing `]'\n",2);u=n.slice(0,-1)}return Oi(l,u)}return null}async function JC(e,t,n){let{ctx:r,runCommand:s}=e;if(t.length===0)return be;let i=!1,o=!1,a=!1,l=t;for(;l.length>0&&l[0].startsWith("-");){let f=l[0];if(f==="--"){l=l.slice(1);break}for(let p of f.slice(1))p==="p"?i=!0:p==="V"?o=!0:p==="v"&&(a=!0);l=l.slice(1)}if(l.length===0)return be;if(a||o)return await n7(r,l,a,o);let[c,...u]=l;return s(c,u,[],n,!0,i,-1)}async function ev(e,t,n){let{runCommand:r}=e;if(t.length===0)return be;let s=t;if(s[0]==="--"&&(s=s.slice(1),s.length===0))return be;let i=s[0];if(!Ws.has(i))return W(`bash: builtin: ${i}: not a shell builtin
1412
+ `);let[,...o]=s;return r(i,o,[],n,!0,!1,-1)}async function i7(e,t,n,r,s){let{ctx:i,buildExportedEnv:o,executeUserScript:a}=e,c=await Qy(i,t,s?"/usr/bin:/bin":void 0);if(!c)return py(t)?W(`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle.
1413
+ `,127):W(`bash: ${t}: command not found
1414
+ `,127);if("error"in c)return c.error==="permission_denied"?W(`bash: ${t}: Permission denied
1415
+ `,126):W(`bash: ${t}: No such file or directory
1416
+ `,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 p=r||i.state.groupStdin||"",h=u.custom?ae(p):p,d=o(),m={fs:i.fs,cwd:i.state.cwd,env:i.state.env,exportedEnv:d,stdin:h,limits:i.limits,exec:i.execFn,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=Xy(m,t);try{let y=()=>_t(i.requireDefenseContext,"command",`${t} execution`,()=>u.execute(n,g));return u.trusted?await Et.runTrustedAsync(()=>y()):await y()}catch(y){if(y instanceof X||y instanceof de)throw y;return W(`${t}: ${He(Xe(y))}
1417
+ `)}}Ut();Ae();Bt();async function vf(e,t){let n=e.state.inCondition;e.state.inCondition=!0;let r="",s="",i=0;try{for(let o of t){let a=await e.executeStatement(o);r+=a.stdout,s+=a.stderr,i=a.exitCode}}finally{e.state.inCondition=n}return{stdout:r,stderr:s,exitCode:i}}Ae();rn();function Di(e,t,n,r){if(e instanceof It)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 $t)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(e instanceof St||e instanceof Ht||e instanceof we||e instanceof X)return e.prependOutput(t,n),{action:"rethrow",stdout:t,stderr:n,error:e};let s=Xe(e);return{action:"error",stdout:t,stderr:`${n}${s}
1418
+ `,exitCode:1}}Ae();rn();async function Ma(e,t,n="",r=""){let s=n,i=r,o=0;try{for(let a of t){let l=await e.executeStatement(a);s+=l.stdout,i+=l.stderr,o=l.exitCode}}catch(a){if(Mi(a)||a instanceof Ht||a instanceof we||a instanceof X||a instanceof Ln)throw a.prependOutput(s,i),a;return{stdout:s,stderr:`${i}${Xe(a)}
1419
+ `,exitCode:1}}return{stdout:s,stderr:i,exitCode:o}}async function o7(e,t){let n="",r="";for(let s of t.clauses){let i=await vf(e,s.condition);if(n+=i.stdout,r+=i.stderr,i.exitCode===0)return Ma(e,s.body,n,r)}return t.elseBody?Ma(e,t.elseBody,n,r):z(n,r,0)}async function a7(e,t){let n=await Xn(e,t.redirections);if(n)return n;let r="",s="",i=0,o=0;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t.variable))return W(`bash: \`${t.variable}': not a valid identifier
1420
+ `);let a=[];if(t.words===null)a=(e.state.env.get("@")||"").split(" ").filter(Boolean);else if(t.words.length===0)a=[];else try{for(let c of t.words){let u=await Tn(e,c);a.push(...u.values)}}catch(c){if(c instanceof Fn)return{stdout:"",stderr:c.stderr,exitCode:1};throw c}e.state.loopDepth++;try{for(let c of a){o++,o>e.limits.maxLoopIterations&&Kn(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r,s),e.state.env.set(t.variable,c);try{for(let u of t.body){let f=await e.executeStatement(u);r+=f.stdout,s+=f.stderr,i=f.exitCode}}catch(u){let f=Di(u,r,s,e.state.loopDepth);if(r=f.stdout,s=f.stderr,f.action==="break")break;if(f.action==="continue")continue;if(f.action==="error"){let p=z(r,s,f.exitCode??1);return et(e,p,t.redirections)}throw f.error}}}finally{e.state.loopDepth--}let l=z(r,s,i);return et(e,l,t.redirections)}async function l7(e,t){let n=await Xn(e,t.redirections);if(n)return n;let r=t.line;r!==void 0&&(e.state.currentLine=r);let s="",i="",o=0,a=0;t.init&&await re(e,t.init.expression),e.state.loopDepth++;try{for(;a++,a>e.limits.maxLoopIterations&&Kn(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s,i),!(t.condition&&(r!==void 0&&(e.state.currentLine=r),await re(e,t.condition.expression)===0));){try{for(let c of t.body){let u=await e.executeStatement(c);s+=u.stdout,i+=u.stderr,o=u.exitCode}}catch(c){let u=Di(c,s,i,e.state.loopDepth);if(s=u.stdout,i=u.stderr,u.action==="break")break;if(u.action==="continue"){t.update&&await re(e,t.update.expression);continue}if(u.action==="error"){let f=z(s,i,u.exitCode??1);return et(e,f,t.redirections)}throw u.error}t.update&&await re(e,t.update.expression)}}finally{e.state.loopDepth--}let l=z(s,i,o);return et(e,l,t.redirections)}async function c7(e,t,n=""){let r="",s="",i=0,o=0,a=n;for(let c of t.redirections)if((c.operator==="<<"||c.operator==="<<-")&&c.target.type==="HereDoc"){let u=c.target,f=await le(e,u.content);u.stripTabs&&(f=f.split(`
1421
+ `).map(p=>p.replace(/^\t+/,"")).join(`
1422
+ `)),a=f}else if(c.operator==="<<<"&&c.target.type==="Word")a=`${await le(e,c.target)}
1423
+ `;else if(c.operator==="<"&&c.target.type==="Word")try{let u=await le(e,c.target),f=e.fs.resolvePath(e.state.cwd,u);a=await e.fs.readFile(f)}catch{let u=await le(e,c.target);return W(`bash: ${u}: No such file or directory
1424
+ `)}let l=e.state.groupStdin;a&&(e.state.groupStdin=a),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&Kn(`while loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r,s);let c=0,u=!1,f=!1,p=e.state.inCondition;e.state.inCondition=!0;try{for(let h of t.condition){let d=await e.executeStatement(h);r+=d.stdout,s+=d.stderr,c=d.exitCode}}catch(h){if(h instanceof It){if(r+=h.stdout,s+=h.stderr,h.levels>1&&e.state.loopDepth>1)throw h.levels--,h.stdout=r,h.stderr=s,e.state.inCondition=p,h;u=!0}else if(h instanceof $t){if(r+=h.stdout,s+=h.stderr,h.levels>1&&e.state.loopDepth>1)throw h.levels--,h.stdout=r,h.stderr=s,e.state.inCondition=p,h;f=!0}else throw e.state.inCondition=p,h}finally{e.state.inCondition=p}if(u)break;if(!f){if(c!==0)break;try{for(let h of t.body){let d=await e.executeStatement(h);r+=d.stdout,s+=d.stderr,i=d.exitCode}}catch(h){let d=Di(h,r,s,e.state.loopDepth);if(r=d.stdout,s=d.stderr,d.action==="break")break;if(d.action==="continue")continue;if(d.action==="error")return z(r,s,d.exitCode??1);throw d.error}}}}finally{e.state.loopDepth--,e.state.groupStdin=l}return z(r,s,i)}async function u7(e,t){let n="",r="",s=0,i=0;e.state.loopDepth++;try{for(;;){i++,i>e.limits.maxLoopIterations&&Kn(`until loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",n,r);let o=await vf(e,t.condition);if(n+=o.stdout,r+=o.stderr,o.exitCode===0)break;try{for(let a of t.body){let l=await e.executeStatement(a);n+=l.stdout,r+=l.stderr,s=l.exitCode}}catch(a){let l=Di(a,n,r,e.state.loopDepth);if(n=l.stdout,r=l.stderr,l.action==="break")break;if(l.action==="continue")continue;if(l.action==="error")return z(n,r,l.exitCode??1);throw l.error}}}finally{e.state.loopDepth--}return z(n,r,s)}async function f7(e,t){let n=await Xn(e,t.redirections);if(n)return n;let r="",s="",i=0,o=await le(e,t.word),a=!1;for(let c=0;c<t.items.length;c++){let u=t.items[c],f=a;if(!a)for(let p of u.patterns){let h=await le(e,p);Iu(p)&&(h=Yt(h));let d=e.state.shoptOptions.nocasematch,m=e.state.shoptOptions.extglob;if(Us(o,h,d,m)){f=!0;break}}if(f){let p=await Ma(e,u.body,r,s);if(r=p.stdout,s=p.stderr,i=p.exitCode,u.terminator===";;")break;u.terminator===";&"?a=!0:a=!1}else a=!1}let l=z(r,s,i);return et(e,l,t.redirections)}Ae();Bt();function kf(e,t){if(e.parts.length!==1)return!1;let n=e.parts[0];return n.type!=="Literal"?!1:t.includes(n.value)}function p7(e){if(!e.startsWith("__rw__:"))return null;let t=e.slice(7),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=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}ct();Bt();var h7="+ ";async function d7(e){let t=e.state.env.get("PS4");if(t===void 0)return h7;if(t==="")return"";try{let r=new pe().parseWordFromString(t,!1,!1);return await le(e,r)}catch{return e.state.expansionStderr=`${e.state.expansionStderr||""}bash: ${t}: bad substitution
1425
+ `,t||h7}}function tv(e){return e.map(t=>nv(t)).join(" ")}function nv(e){if(e==="")return"''";if(!/[\s'"\\$`!*?[\]{}|&;<>()~#\n\t]/.test(e))return e;let n=/[\x00-\x1f\x7f]/.test(e),r=e.includes(`
1426
+ `),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===`
1427
+ `?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 m7(e,t,n){if(!e.state.options.xtrace)return"";let r=await d7(e),s=[t,...n],i=tv(s);return`${r}${i}
1428
+ `}async function g7(e,t,n){return e.state.options.xtrace?`${await d7(e)}${t}=${n}
1429
+ `:""}ge();hi();Ae();async function y7(e,t,n){let r=t.timed?Ss():0,s="",i=be,o=0,a=[],l="",c=t.commands.length>1,u=e.state.lastArg;for(let p=0;p<t.commands.length;p++){let h=t.commands[p],d=p===t.commands.length-1,m=p===0;c&&(e.state.lastArg="",m||(e.state.groupStdin=void 0));let y=c&&(!d||!e.state.shoptOptions.lastpipe)?new Map(e.state.env):null,b;try{b=await n(h,s)}catch(w){if(w instanceof Pt)b={stdout:w.stdout,stderr:w.stderr,exitCode:1};else if(w instanceof we&&t.commands.length>1)b={stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode};else if(w instanceof Ht&&t.commands.length>1)b={stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode};else throw y&&(e.state.env=y),w}y&&(e.state.env=y),a.push(b.exitCode),b.exitCode!==0&&(o=b.exitCode),d?i=b:(t.pipeStderr?.[p]??!1?s=Dn(b.stderr)+Za(b):(s=Za(b),l+=b.stderr),i={stdout:"",stderr:"",exitCode:b.exitCode})}if(l&&(i={...i,stderr:l+i.stderr}),t.commands.length>1||t.commands.length===1&&t.commands[0].type==="SimpleCommand"){for(let p of e.state.env.keys())p.startsWith("PIPESTATUS_")&&e.state.env.delete(p);for(let p=0;p<a.length;p++)e.state.env.set(`PIPESTATUS_${p}`,String(a[p]));e.state.env.set("PIPESTATUS__length",String(a.length))}if(e.state.options.pipefail&&o!==0&&(i={...i,exitCode:o}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let h=(Ss()-r)/1e3,d=Math.floor(h/60),m=h%60,g;t.timePosix?g=`real ${h.toFixed(2)}
1430
+ user 0.00
1431
+ sys 0.00
1432
+ `:g=`
1433
+ real ${`${d}m${m.toFixed(3)}s`}
1434
+ user 0m0.000s
1435
+ sys 0m0.000s
1436
+ `,i={...i,stderr:i.stderr+g}}return c&&!e.state.shoptOptions.lastpipe&&(e.state.lastArg=u),i}Ot();ct();Ut();Ae();Bt();yn();In();xr();async function w7(e,t){let n=new Map,r="";for(let s of t.assignments){let i=s.name;if(s.array){let u=await rv(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 le(e,s.value):"";if(i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:z("",`bash: ${i}: bad array subscript
1437
+ `,1)};let l=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(l){let u=await lv(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 uv(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 rv(e,t,n,r,s,i){let o="";if(/\[.+\]$/.test(n))return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: ${n}: cannot assign list to array member
1438
+ `,1)};if(We(e,n)){let u=Kr(e,n);if(u===void 0||u==="")throw new we(1,"","");let f=Mt(e,n);if(f&&/^[a-zA-Z_][a-zA-Z0-9_]*\[@\]$/.test(f))return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: ${n}: cannot assign list to array member
1439
+ `,1)}}if(Zn(e,n)){if(t.name)return o+=`bash: ${n}: readonly variable
1440
+ `,{continueToNext:!0,xtraceOutput:o};let u=bt(e,n);if(u)return{continueToNext:!1,xtraceOutput:"",error:u}}let a=e.state.associativeArrays?.has(n),l=sv(r),c=()=>{let u=`${n}_`;for(let f of e.state.env.keys())f.startsWith(u)&&!f.includes("__")&&e.state.env.delete(f);e.state.env.delete(n)};if(a&&l?await iv(e,t,n,r,s,c,u=>{o+=u}):l?await ov(e,n,r,s,c):await av(e,n,r,s,c),t.name){i.set(n,e.state.env.get(n));let f=`(${r.map(p=>Rs(p)).join(" ")})`;e.state.env.set(n,f)}return{continueToNext:!0,xtraceOutput:o}}function sv(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 iv(e,t,n,r,s,i,o){let a=[];for(let l of r){let c=yu(l);if(c){let{key:u,valueParts:f,append:p}=c,h;f.length>0?h=await le(e,{type:"Word",parts:f}):h="",h=st(e,h),a.push({type:"keyed",key:u,value:h,append:p})}else{let u=await le(e,l);a.push({type:"invalid",expandedValue:u})}}s||i();for(let l of a)if(l.type==="keyed")if(l.append){let c=e.state.env.get(`${n}_${l.key}`)??"";e.state.env.set(`${n}_${l.key}`,c+l.value)}else e.state.env.set(`${n}_${l.key}`,l.value);else{let c=t.line??e.state.currentLine??1;o(`bash: line ${c}: ${n}: ${l.expandedValue}: must use subscript when assigning associative array
1441
+ `)}}async function ov(e,t,n,r,s){let i=[];for(let a of n){let l=yu(a);if(l){let{key:c,valueParts:u,append:f}=l,p;u.length>0?p=await le(e,{type:"Word",parts:u}):p="",p=st(e,p),i.push({type:"keyed",indexExpr:c,value:p,append:f})}else{let c=await Tn(e,a);i.push({type:"non-keyed",values:c.values})}}r||s();let o=0;for(let a of i)if(a.type==="keyed"){let l;try{let c=new pe,u=Ne(c,a.indexExpr);l=await re(e,u.expression,!1)}catch{if(/^-?\d+$/.test(a.indexExpr))l=Number.parseInt(a.indexExpr,10);else{let c=e.state.env.get(a.indexExpr);l=c?Number.parseInt(c,10):0,Number.isNaN(l)&&(l=0)}}if(a.append){let c=e.state.env.get(`${t}_${l}`)??"";e.state.env.set(`${t}_${l}`,c+a.value)}else e.state.env.set(`${t}_${l}`,a.value);o=l+1}else for(let l of a.values)e.state.env.set(`${t}_${o++}`,l)}async function av(e,t,n,r,s){let i=[];for(let a of n){let l=await Tn(e,a);i.push(...l.values)}let o=0;if(r){let a=ce(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&&(e.state.env.set(`${t}_0`,l),e.state.env.delete(t),o=1)}}else s();for(let a=0;a<i.length;a++)e.state.env.set(`${t}_${o+a}`,i[a]);r||e.state.env.set(`${t}__length`,String(i.length))}async function lv(e,t,n,r,s,i,o){let a=n;if(We(e,n)){let f=Mt(e,n);if(f&&f!==n){if(f.includes("["))return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: \`${f}': not a valid identifier
1442
+ `,1)};a=f}}if(Zn(e,a)){if(t.name)return{continueToNext:!0,xtraceOutput:""};let f=bt(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let l=e.state.associativeArrays?.has(a),c;if(l)c=await b7(e,a,r);else{let f=await cv(e,a,r);if(f.error)return{continueToNext:!1,xtraceOutput:"",error:f.error};c=`${a}_${f.index}`}let u=i?(e.state.env.get(c)||"")+s:s;if(t.name)o.set(c,e.state.env.get(c)),e.state.env.set(c,u);else{let f=Bs(e,a);if(f!==void 0&&f===e.state.callDepth&&e.state.localScopes.length>0){let p=e.state.localScopes[e.state.localScopes.length-1];p.has(c)||p.set(c,e.state.env.get(c))}e.state.env.set(c,u)}return{continueToNext:!0,xtraceOutput:""}}async function b7(e,t,n){let r;if(n.startsWith("'")&&n.endsWith("'"))r=n.slice(1,-1);else if(n.startsWith('"')&&n.endsWith('"')){let s=n.slice(1,-1),o=new pe().parseWordFromString(s,!0,!1);r=await le(e,o)}else if(n.includes("$")){let i=new pe().parseWordFromString(n,!1,!1);r=await le(e,i)}else r=n;return`${t}_${r}`}async function cv(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 pe,o=Ne(i,r);s=await re(e,o.expression,!1)}catch(i){if(i instanceof Le){let l=`bash: line ${e.state.currentLine}: ${n}: ${i.message}
1443
+ `;if(i.fatal)throw new we(1,"",l);return{index:0,error:z("",l,1)}}let o=e.state.env.get(n);s=o?Number.parseInt(o,10):0}Number.isNaN(s)&&(s=0)}if(s<0){let i=ce(e,t);if(i.length===0){let a=e.state.currentLine;return{index:0,error:z("",`bash: line ${a}: ${t}[${n}]: bad array subscript
1444
+ `,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:z("",`bash: line ${a}: ${t}[${n}]: bad array subscript
1445
+ `,1)}}}return{index:s}}async function uv(e,t,n,r,s,i){let o="",a=n,l=null;if(We(e,n)){let f=Hg(e,n,r);if(f===void 0)return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: ${n}: circular name reference
1446
+ `,1)};if(f===null)return{continueToNext:!0,xtraceOutput:""};a=f;let p=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);p&&(l={arrayName:p[1],subscriptExpr:p[2]},a=p[1])}if(Zn(e,a)){if(t.name)return o+=`bash: ${a}: readonly variable
1447
+ `,{continueToNext:!0,xtraceOutput:o};let f=bt(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let c;if(Ti(e,a))try{let f=new pe;if(s){let h=`(${e.state.env.get(a)||"0"}) + (${r})`,d=Ne(f,h);c=String(await re(e,d.expression))}else{let p=Ne(f,r);c=String(await re(e,p.expression))}}catch{c="0"}else{let{isArray:f}=await Promise.resolve().then(()=>(Bt(),Ru)),p=f(e,a)?`${a}_0`:a;c=s?(e.state.env.get(p)||"")+r:r}c=Hs(e,a,c),o+=await g7(e,a,c);let u=a;if(l)u=await fv(e,l);else{let{isArray:f}=await Promise.resolve().then(()=>(Bt(),Ru));f(e,a)&&(u=`${a}_0`)}return t.name?(i.set(u,e.state.env.get(u)),e.state.env.set(u,c)):(e.state.env.set(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 fv(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return b7(e,n,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{let o=new pe,a=Ne(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=ce(e,n);o.length>0&&(i=Math.max(...o.map(l=>l[0]))+1+i)}return`${n}_${i}`}ct();Ae();Bt();rn();async function x7(e,t,n,r){let s=await Xn(e,t.redirections);if(s)return s;let i=new Map(e.state.env),o=e.state.cwd,a={...e.state.options},l=new Map(e.state.functions),c=e.state.localScopes,u=e.state.localVarStack,f=e.state.localVarDepth,p=e.state.fullyUnsetLocals;if(e.state.localScopes=c.map($=>new Map($)),u){e.state.localVarStack=new Map;for(let[$,D]of u.entries())e.state.localVarStack.set($,D.map(R=>({...R})))}f&&(e.state.localVarDepth=new Map(f)),p&&(e.state.fullyUnsetLocals=new Map(p));let h=e.state.loopDepth,d=e.state.parentHasLoopContext;e.state.parentHasLoopContext=h>0,e.state.loopDepth=0;let m=e.state.lastArg,g=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let y=e.state.groupStdin;n&&(e.state.groupStdin=n);let b="",w="",x=0,A=()=>{e.state.env=i,e.state.cwd=o,e.state.options=a,e.state.functions=l,e.state.localScopes=c,e.state.localVarStack=u,e.state.localVarDepth=f,e.state.fullyUnsetLocals=p,e.state.loopDepth=h,e.state.parentHasLoopContext=d,e.state.groupStdin=y,e.state.bashPid=g,e.state.lastArg=m};try{for(let $ of t.body){let D=await r($);b+=D.stdout,w+=D.stderr,x=D.exitCode}}catch($){if(A(),$ instanceof X)throw $;if($ instanceof Ln){b+=$.stdout,w+=$.stderr;let R=z(b,w,0);return et(e,R,t.redirections)}if($ instanceof It||$ instanceof $t){b+=$.stdout,w+=$.stderr;let R=z(b,w,0);return et(e,R,t.redirections)}if($ instanceof we){b+=$.stdout,w+=$.stderr;let R=z(b,w,$.exitCode);return et(e,R,t.redirections)}if($ instanceof St){b+=$.stdout,w+=$.stderr;let R=z(b,w,$.exitCode);return et(e,R,t.redirections)}if($ instanceof Ht){let R=z(b+$.stdout,w+$.stderr,$.exitCode);return et(e,R,t.redirections)}let D=z(b,`${w}${Xe($)}
1448
+ `,1);return et(e,D,t.redirections)}A();let I=z(b,w,x);return et(e,I,t.redirections)}async function E7(e,t,n,r){let s="",i="",o=0,a=await Oa(e,t.redirections);if(a)return a;let l=n;for(let f of t.redirections)if((f.operator==="<<"||f.operator==="<<-")&&f.target.type==="HereDoc"){let p=f.target,h=await le(e,p.content);p.stripTabs&&(h=h.split(`
1449
+ `).map(m=>m.replace(/^\t+/,"")).join(`
1450
+ `));let d=f.fd??0;d!==0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),Tt(e),e.state.fileDescriptors.set(d,h)):l=h}else if(f.operator==="<<<"&&f.target.type==="Word")l=`${await le(e,f.target)}
1451
+ `;else if(f.operator==="<"&&f.target.type==="Word")try{let p=await le(e,f.target),h=e.fs.resolvePath(e.state.cwd,p);l=await e.fs.readFile(h)}catch{let p=await le(e,f.target);return z("",`bash: ${p}: No such file or directory
1452
+ `,1)}let c=e.state.groupStdin;l&&(e.state.groupStdin=l);try{for(let f of t.body){let p=await r(f);s+=p.stdout,i+=p.stderr,o=p.exitCode}}catch(f){if(e.state.groupStdin=c,f instanceof X)throw f;if(Mi(f)||f instanceof Ht||f instanceof we)throw f.prependOutput(s,i),f;return z(s,`${i}${Xe(f)}
1453
+ `,1)}e.state.groupStdin=c;let u=z(s,i,o);return et(e,u,t.redirections)}async function A7(e,t,n,r,s){let i;try{i=await e.fs.readFile(t)}catch{return W(`bash: ${t}: No such file or directory
1454
+ `,127)}if(i.startsWith("#!")){let g=i.indexOf(`
1455
+ `);g!==-1&&(i=i.slice(g+1))}let o=new Map(e.state.env),a=e.state.cwd,l={...e.state.options},c=e.state.loopDepth,u=e.state.parentHasLoopContext,f=e.state.lastArg,p=e.state.bashPid,h=e.state.groupStdin,d=e.state.currentSource;e.state.parentHasLoopContext=c>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 g=0;g<n.length&&g<9;g++)e.state.env.set(String(g+1),n[g]);for(let g=n.length+1;g<=9;g++)e.state.env.delete(String(g));let m=()=>{e.state.env=o,e.state.cwd=a,e.state.options=l,e.state.loopDepth=c,e.state.parentHasLoopContext=u,e.state.lastArg=f,e.state.bashPid=p,e.state.groupStdin=h,e.state.currentSource=d};try{let y=new pe().parse(i),b=await s(y);return m(),b}catch(g){if(m(),g instanceof we||g instanceof X)throw g;if(g.name==="ParseException")return W(`bash: ${t}: ${g.message}
1456
+ `);throw g}}var _i=class{ctx;constructor(t,n){this.ctx={state:n,fs:t.fs,commands:t.commands,limits:t.limits,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||Et.isInSandboxedContext())return;let n=`interpreter ${t} attempted outside defense context`;throw new de(n,{timestamp:Date.now(),type:"missing_defense_context",message:n,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:Et.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="",r="",s=0,i=this.ctx.limits.maxOutputSize,o=(a,l)=>{n.length+r.length+a.length+l.length>i&&Kn(`total output size exceeded (>${i} bytes), increase executionLimits.maxOutputSize`,"output_size"),n+=a,r+=l};for(let a of t.statements)try{let l=await this.executeStatement(a);o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}catch(l){if(l instanceof we)throw l.prependOutput(n,r),l;if(l instanceof nn)return o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)};if(l instanceof X)throw l;if(l instanceof Ht)return o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)};if(l instanceof Rt)return o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)};if(l instanceof Pt)return o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)};if(l instanceof Le){o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s));continue}if(l instanceof is){o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s));continue}if(l instanceof It||l instanceof $t){if(this.ctx.state.loopDepth>0)throw l.prependOutput(n,r),l;o(l.stdout,l.stderr);continue}throw l instanceof St&&l.prependOutput(n,r),l}return{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)}}async executeUserScript(t,n,r=""){return A7(this.ctx,t,n,r,s=>this.executeScript(s))}async executeStatement(t){if(this.assertDefenseContext("statement"),this.ctx.state.signal?.aborted)throw new os;if(this.ctx.state.commandCount++,this.ctx.state.commandCount>this.ctx.limits.maxCommandCount&&Kn(`too many commands executed (>${this.ctx.limits.maxCommandCount}), increase executionLimits.maxCommandCount`,"commands"),t.deferredError)throw new At(t.deferredError.message,t.line??1,1);if(this.ctx.state.options.noexec)return be;this.ctx.state.errexitSafe=!1;let n="",r="";this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&t.sourceText&&(r+=`${t.sourceText}
1457
+ `);let s=0,i=-1,o=!1;for(let c=0;c<t.pipelines.length;c++){let u=t.pipelines[c],f=c>0?t.operators[c-1]:null;if(f==="&&"&&s!==0||f==="||"&&s===0)continue;let p=await this.executePipeline(u);n+=p.stdout,r+=p.stderr,s=p.exitCode,i=c,o=u.negated,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}let a=i<t.pipelines.length-1,l=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=a||o||l,this.ctx.state.options.errexit&&s!==0&&i===t.pipelines.length-1&&!o&&!this.ctx.state.inCondition&&!l)throw new Ht(s,n,r);return z(n,r,s)}async executePipeline(t){return y7(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n){switch(this.assertDefenseContext("command"),this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return o7(this.ctx,t);case"For":return a7(this.ctx,t);case"CStyleFor":return l7(this.ctx,t);case"While":return c7(this.ctx,t,n);case"Until":return u7(this.ctx,t);case"Case":return f7(this.ctx,t);case"Subshell":return this.executeSubshell(t,n);case"Group":return this.executeGroup(t,n);case"FunctionDef":return Ny(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return be}}async executeSimpleCommand(t,n){try{return await this.executeSimpleCommandInner(t,n)}catch(r){if(r instanceof Fn)return W(r.stderr);throw r}}async executeSimpleCommandInner(t,n){if(t.line!==void 0&&(this.ctx.state.currentLine=t.line),this.ctx.state.shoptOptions.expand_aliases&&t.name){let x=t,A=100;for(;A>0;){let I=this.expandAlias(x);if(I===x)break;x=I,A--}this.aliasExpansionStack.clear(),x!==t&&(t=x)}this.ctx.state.expansionStderr="";let r=await w7(this.ctx,t);if(r.error)return r.error;let s=r.tempAssignments,i=r.xtraceOutput;if(!t.name){if(t.redirections.length>0){let A=await Xn(this.ctx,t.redirections);if(A)return A;let I=z("",i,0);return et(this.ctx,I,t.redirections)}this.ctx.state.lastArg="";let x=(this.ctx.state.expansionStderr||"")+i;return this.ctx.state.expansionStderr="",z("",x,this.ctx.state.lastExitCode)}let o=t.name&&kf(t.name,["local","declare","typeset","export","readonly"]),a=Array.from(s.keys());if(a.length>0&&!o){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let x of a)this.ctx.state.tempExportedVars.add(x)}let l=await Oa(this.ctx,t.redirections);if(l){for(let[x,A]of s)A===void 0?this.ctx.state.env.delete(x):this.ctx.state.env.set(x,A);return l}let c=-1;for(let x of t.redirections){if((x.operator==="<<"||x.operator==="<<-")&&x.target.type==="HereDoc"){let A=x.target,I=await le(this.ctx,A.content);A.stripTabs&&(I=I.split(`
1458
+ `).map(D=>D.replace(/^\t+/,"")).join(`
1459
+ `)),I=Dn(I);let $=x.fd??0;$!==0?(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),Tt(this.ctx),this.ctx.state.fileDescriptors.set($,I)):n=I;continue}if(x.operator==="<<<"&&x.target.type==="Word"){n=Dn(`${await le(this.ctx,x.target)}
1460
+ `);continue}if(x.operator==="<"&&x.target.type==="Word")try{let A=await le(this.ctx,x.target),I=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);n=await _n(this.ctx.fs,I)}catch{let A=await le(this.ctx,x.target);for(let[I,$]of s)$===void 0?this.ctx.state.env.delete(I):this.ctx.state.env.set(I,$);return W(`bash: ${A}: No such file or directory
1461
+ `)}if(x.operator==="<&"&&x.target.type==="Word"){let A=await le(this.ctx,x.target),I=Number.parseInt(A,10);if(!Number.isNaN(I)&&this.ctx.state.fileDescriptors){let $=this.ctx.state.fileDescriptors.get(I);if($!==void 0)if($.startsWith("__rw__:")){let D=p7($);D&&(n=D.content.slice(D.position),c=I)}else $.startsWith("__file__:")||$.startsWith("__file_append__:")||(n=$)}}}let u=await le(this.ctx,t.name),f=[],p=[];if(kf(t.name,["local","declare","typeset","export","readonly"])&&(u==="local"||u==="declare"||u==="typeset"||u==="export"||u==="readonly"))for(let x of t.args){let A=await uy(this.ctx,x);if(A)f.push(A),p.push(!0);else{let I=await fy(this.ctx,x);if(I!==null)f.push(I),p.push(!0);else{let $=await Tn(this.ctx,x);for(let D of $.values)f.push(D),p.push($.quoted)}}}else for(let x of t.args){let A=await Tn(this.ctx,x);for(let I of A.values)f.push(I),p.push(A.quoted)}if(!u){if(t.name.parts.every(A=>A.type==="CommandSubstitution"||A.type==="ParameterExpansion"||A.type==="ArithmeticExpansion")){if(f.length>0){let A=f.shift();return p.shift(),await this.runCommand(A,f,p,n,!1,!1,c)}return z("","",this.ctx.state.lastExitCode)}return W(`bash: : command not found
1462
+ `,127)}if(u==="exec"&&(f.length===0||f[0]==="--")){for(let x of t.redirections){if(x.target.type==="HereDoc"||x.fdVariable)continue;let A=await le(this.ctx,x.target),I=x.fd??(x.operator==="<"||x.operator==="<>"?0:1);switch(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),x.operator){case">":case">|":{let $=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);await this.ctx.fs.writeFile($,"","utf8"),Tt(this.ctx),this.ctx.state.fileDescriptors.set(I,`__file__:${$}`);break}case">>":{let $=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);Tt(this.ctx),this.ctx.state.fileDescriptors.set(I,`__file_append__:${$}`);break}case"<":{let $=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);try{let D=await this.ctx.fs.readFile($);Tt(this.ctx),this.ctx.state.fileDescriptors.set(I,D)}catch{return W(`bash: ${A}: No such file or directory
1463
+ `)}break}case"<>":{let $=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);try{let D=await this.ctx.fs.readFile($);Tt(this.ctx),this.ctx.state.fileDescriptors.set(I,`__rw__:${$.length}:${$}:0:${D}`)}catch{await this.ctx.fs.writeFile($,"","utf8"),Tt(this.ctx),this.ctx.state.fileDescriptors.set(I,`__rw__:${$.length}:${$}:0:`)}break}case">&":{if(A==="-")this.ctx.state.fileDescriptors.delete(I);else if(A.endsWith("-")){let $=A.slice(0,-1),D=Number.parseInt($,10);if(!Number.isNaN(D)){let R=this.ctx.state.fileDescriptors.get(D);R!==void 0?this.ctx.state.fileDescriptors.set(I,R):this.ctx.state.fileDescriptors.set(I,`__dupout__:${D}`),this.ctx.state.fileDescriptors.delete(D)}}else{let $=Number.parseInt(A,10);Number.isNaN($)||(Tt(this.ctx),this.ctx.state.fileDescriptors.set(I,`__dupout__:${$}`))}break}case"<&":{if(A==="-")this.ctx.state.fileDescriptors.delete(I);else if(A.endsWith("-")){let $=A.slice(0,-1),D=Number.parseInt($,10);if(!Number.isNaN(D)){let R=this.ctx.state.fileDescriptors.get(D);R!==void 0?this.ctx.state.fileDescriptors.set(I,R):this.ctx.state.fileDescriptors.set(I,`__dupin__:${D}`),this.ctx.state.fileDescriptors.delete(D)}}else{let $=Number.parseInt(A,10);Number.isNaN($)||(Tt(this.ctx),this.ctx.state.fileDescriptors.set(I,`__dupin__:${$}`))}break}}}for(let[x,A]of s)A===void 0?this.ctx.state.env.delete(x):this.ctx.state.env.set(x,A);if(this.ctx.state.tempExportedVars)for(let x of s.keys())this.ctx.state.tempExportedVars.delete(x);return be}if(this.ctx.state.extraArgs){f.push(...this.ctx.state.extraArgs);for(let x=0;x<this.ctx.state.extraArgs.length;x++)p.push(!0);this.ctx.state.extraArgs=void 0}let d=await m7(this.ctx,u,f);s.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(s)));let m,g=null;try{m=await this.runCommand(u,f,p,n,!1,!1,c)}catch(x){if(x instanceof It||x instanceof $t)g=x,m=be;else throw x}let y=i+d;if(y&&(m={...m,stderr:y+m.stderr}),m=await et(this.ctx,m,t.redirections),g)throw g;if(f.length>0){let x=f[f.length-1];if((u==="declare"||u==="local"||u==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(x)){let A=x.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);A&&(x=A[1])}this.ctx.state.lastArg=x}else this.ctx.state.lastArg=u;let b=vy(u)&&u!=="unset"&&u!=="eval";if(!this.ctx.state.options.posix||!b)for(let[x,A]of s)this.ctx.state.fullyUnsetLocals?.has(x)||(A===void 0?this.ctx.state.env.delete(x):this.ctx.state.env.set(x,A));if(this.ctx.state.tempExportedVars)for(let x of s.keys())this.ctx.state.tempExportedVars.delete(x);return s.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(m={...m,stderr:this.ctx.state.expansionStderr+m.stderr},this.ctx.state.expansionStderr=""),m}async runCommand(t,n,r,s,i=!1,o=!1,a=-1){let l={ctx:this.ctx,runCommand:(u,f,p,h,d,m,g)=>this.runCommand(u,f,p,h,d,m,g),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(u,f,p)=>this.executeUserScript(u,f,p)},c=await s7(l,t,n,r,s,i,o,a);return c!==null?c:i7(l,t,n,s,o)}aliasExpansionStack=new Set;expandAlias(t){return pu(this.ctx.state,t,this.aliasExpansionStack)}async findCommandInPath(t){return La(this.ctx,t)}async executeSubshell(t,n=""){return x7(this.ctx,t,n,r=>this.executeStatement(r))}async executeGroup(t,n=""){return E7(this.ctx,t,n,r=>this.executeStatement(r))}async executeArithmeticCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let n=await Xn(this.ctx,t.redirections);if(n)return n;try{let r=await re(this.ctx,t.expression.expression),s=ft(r!==0);return this.ctx.state.expansionStderr&&(s={...s,stderr:this.ctx.state.expansionStderr+s.stderr},this.ctx.state.expansionStderr=""),et(this.ctx,s,t.redirections)}catch(r){let s=W(`bash: arithmetic expression: ${r.message}
1464
+ `);return et(this.ctx,s,t.redirections)}}async executeConditionalCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let n=await Xn(this.ctx,t.redirections);if(n)return n;try{let r=await Sr(this.ctx,t.expression),s=ft(r);return this.ctx.state.expansionStderr&&(s={...s,stderr:this.ctx.state.expansionStderr+s.stderr},this.ctx.state.expansionStderr=""),et(this.ctx,s,t.redirections)}catch(r){let s=r instanceof Le?1:2,i=W(`bash: conditional expression: ${r.message}
1465
+ `,s);return et(this.ctx,i,t.redirections)}}};var xt={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50,maxBraceExpansionResults:1e4,maxOutputSize:10485760,maxFileDescriptors:1024,maxSourceDepth:100};function S7(e){return e?{maxCallDepth:e.maxCallDepth??xt.maxCallDepth,maxCommandCount:e.maxCommandCount??xt.maxCommandCount,maxLoopIterations:e.maxLoopIterations??xt.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??xt.maxAwkIterations,maxSedIterations:e.maxSedIterations??xt.maxSedIterations,maxJqIterations:e.maxJqIterations??xt.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??xt.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??xt.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??xt.maxJsTimeoutMs,maxGlobOperations:e.maxGlobOperations??xt.maxGlobOperations,maxStringLength:e.maxStringLength??xt.maxStringLength,maxArrayElements:e.maxArrayElements??xt.maxArrayElements,maxHeredocSize:e.maxHeredocSize??xt.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??xt.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??xt.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??xt.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??xt.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??xt.maxSourceDepth}:{...xt}}v7();un();Zs();function Nf(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function pv(e){let t=Nf(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function k7(e){if(e.includes("\\"))return!0;let t=e.toLowerCase();return t.includes("%2f")||t.includes("%5c")}function hv(e,t){return t==="/"||t===""?!0:t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`)}function If(e,t){let n=Nf(e);if(!n)return!1;let r=pv(t);return!r||n.origin!==r.origin||r.pathPrefix!=="/"&&r.pathPrefix!==""&&k7(n.pathname)?!1:hv(n.pathname,r.pathPrefix)}function N7(e){return typeof e=="string"?e:e.url}function I7(e,t){return!t||t.length===0?!1:t.some(n=>If(e,N7(n)))}function $f(e){let t=dv(e);if(t==="localhost"||t.endsWith(".localhost"))return!0;let n=$7(t);if(n)return Ua(n);let r=gv(t);return r?yv(r):!1}function dv(e){let t=e.trim().toLowerCase();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function mv(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 $7(e){let t=e.split(".");if(t.length===0||t.length>4)return null;let n=t.map(l=>mv(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 gv(e){let t=e,n=null;if(t.includes(".")){let m=t.lastIndexOf(":");if(m<0)return null;let g=t.slice(m+1),y=$7(g);if(!y)return null;n=y,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,p=c.length+u.length+f,h=0;if(r===1){if(h=8-p,h<0)return null}else if(p!==8)return null;let d=[...c,...new Array(h).fill(0),...u];return n&&(d.push(n[0]<<8|n[1]),d.push(n[2]<<8|n[3])),d.length===8?d:null}function Ua(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 yv(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 Ua(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 Ua(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 Ua(s)}return!1}function O7(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=N7(n);if(!Nf(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!==""&&k7(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 Ba=null,Of=null,T7=!1;function wv(){if(T7||(!Ba||!Of))return;T7=!0;let e=Ba,t=Of.lookup;function n(...r){let s=r[0],i=e.getStore();if(typeof s!="string"||!i||i.hostname.toLowerCase()!==s.toLowerCase())return t.apply(this,r);let o={},a;if(r.length===2)a=r[1];else if(r.length>=3){let c=r[1];typeof c=="number"?o={family:c}:c&&typeof c=="object"&&(o=c),a=r[2]}if(typeof a!="function")return t.apply(this,r);let l=a;if(o.family!==void 0&&o.family!==0&&o.family!==i.family){let c=new Error(`ENOTFOUND ${s}`);c.code="ENOTFOUND",c.errno=-3008,c.syscall="getaddrinfo",c.hostname=s,process.nextTick(()=>l(c));return}process.nextTick(()=>{o.all?l(null,[{address:i.address,family:i.family}]):l(null,i.address,i.family)})}Object.defineProperty(Of,"lookup",{value:n,writable:!0,configurable:!0})}function R7(e,t){return wv(),Ba?Ba.run(e,t):t()}var Rn=class extends Error{constructor(t,n){let r=n??"URL not in allow-list";super(`Network access denied: ${r}: ${t}`),this.name="NetworkAccessDeniedError"}},js=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},Gs=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},Wa=class extends Error{constructor(t,n){super(`HTTP method '${t}' not allowed. Allowed methods: ${n.join(", ")}`),this.name="MethodNotAllowedError"}},Vs=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};function bv(e){return new Promise((t,n)=>{C7(e,{all:!0},(r,s)=>{r?n(r):t(s)})})}var xv=20,Ev=3e4,Av=10485760,Sv=["GET","HEAD"],Cv=new Set(["GET","HEAD","OPTIONS"]),vv=new Set([301,302,303,307,308]);function Tf(e){let t=e.allowedUrlPrefixes??[];if(!e.dangerouslyAllowFullInternetAccess){let h=O7(t);if(h.length>0)throw new Error(`Invalid network allow-list:
1466
+ ${h.join(`
1467
+ `)}`)}let n=[];for(let h of t)typeof h=="object"&&h.transform&&h.transform.length>0&&n.push(h);function r(h){if(n.length===0)return null;let d=null;for(let m of n)if(If(h,m.url)&&m.transform){d||(d=new Headers);for(let g of m.transform)for(let[y,b]of Object.entries(g.headers))d.set(y,b)}return d}let s=e.maxRedirects??xv,i=e.timeoutMs??Ev,o=e.maxResponseSize??Av,a=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??Sv,l=e.denyPrivateRanges??(typeof process<"u"&&!0),c=e._dnsResolve??bv;async function u(h){if(!e.dangerouslyAllowFullInternetAccess&&!I7(h,t))throw new Rn(h);if(l)try{let d=new URL(h);if($f(d.hostname))throw new Rn(h,"private/loopback IP address blocked");let m=d.hostname;if(/[a-zA-Z]/.test(m))try{let y=await c(m);for(let{address:w}of y)if($f(w))throw new Rn(h,"hostname resolves to private/loopback IP address");let b=y[0];if(b)return{hostname:m,address:b.address,family:b.family===6?6:4}}catch(y){if(y instanceof Rn)throw y;let b=y?.code;if(!(b==="ENOTFOUND"||b==="ENODATA"))throw new Rn(h,"DNS resolution failed for private IP check")}}catch(d){if(d instanceof Rn)throw d}return null}function f(h){if(e.dangerouslyAllowFullInternetAccess)return;let d=h.toUpperCase();if(!a.includes(d))throw new Wa(d,a)}async function p(h,d={}){let m=d.method?.toUpperCase()??"GET",g=await u(h);f(m);let y=h,b=0,w=d.followRedirects??!0,x=d.timeoutMs!==void 0?Math.min(d.timeoutMs,i):i;for(;;){let A=new AbortController,I=Ir(()=>A.abort(),x);try{let $=await Et.runTrustedAsync(()=>{let D=r(y),R=kv(d.headers,D),L={method:m,headers:R,signal:A.signal,redirect:"manual"};return d.body&&!Cv.has(m)&&(L.body=d.body),g?R7(g,()=>fetch(y,L)):fetch(y,L)});if(vv.has($.status)&&w){let D=$.headers.get("location");if(!D)return await P7($,y,o);let R=new URL(D,y).href;try{g=await u(R)}catch{throw new Gs(R)}if(b++,b>s)throw new js(s);y=R;continue}return await P7($,y,o)}finally{ns(I)}}}return p}function kv(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}async function P7(e,t,n){let r=Object.create(null);if(e.headers.forEach((i,o)=>{r[o.toLowerCase()]=i}),n>0){let i=e.headers.get("content-length");if(i){let o=parseInt(i,10);if(!Number.isNaN(o)&&o>n)throw new Vs(n)}}let s;if(n>0&&e.body){let i=e.body.getReader(),o=[],a=0;for(;;){let{done:c,value:u}=await i.read();if(c)break;if(u){if(a+=u.byteLength,a>n)throw i.cancel(),new Vs(n);o.push(u)}}s=new Uint8Array(a);let l=0;for(let c of o)s.set(c,l),l+=c.byteLength}else{let i=await e.arrayBuffer();if(n>0&&i.byteLength>n)throw new Vs(n);s=new Uint8Array(i)}return{status:e.status,statusText:e.statusText,headers:r,body:s,url:t}}gr();ct();un();function D7(e){return es(e)}function es(e){return e.statements.map(_7).join(`
1468
+ `)}function _7(e){let t=[];for(let r=0;r<e.pipelines.length;r++)t.push(Nv(e.pipelines[r])),r<e.operators.length&&t.push(e.operators[r]);let n=t.join(" ");return e.background&&(n+=" &"),n}function Nv(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(F7(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 F7(e){switch(e.type){case"SimpleCommand":return Iv(e);case"If":return Lv(e);case"For":return Mv(e);case"CStyleFor":return Uv(e);case"While":return Bv(e);case"Until":return Wv(e);case"Case":return zv(e);case"Subshell":return jv(e);case"Group":return Gv(e);case"ArithmeticCommand":return Vv(e);case"ConditionalCommand":return qv(e);case"FunctionDef":return Zv(e);default:{let t=e;throw new Error(`Unsupported command type: ${t.type}`)}}}function Iv(e){let t=[];for(let n of e.assignments)t.push($v(n));e.name&&t.push(Wt(e.name));for(let n of e.args)t.push(Wt(n));for(let n of e.redirections)t.push(U7(n));return t.join(" ")}function $v(e){let t=e.append?"+=":"=";if(e.array){let n=e.array.map(Wt).join(" ");return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${Wt(e.value)}`:`${e.name}${t}`}function Wt(e){return e.parts.map(t=>za(t,!1)).join("")}function kr(e){return e.parts.map(t=>za(t,!0)).join("")}function za(e,t){switch(e.type){case"Literal":return t?Tv(e.value):Ov(e.value);case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(n=>za(n,!0)).join("")}"`;case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return L7(e);case"CommandSubstitution":return e.legacy?`\`${es(e.body)}\``:`$(${es(e.body)})`;case"ArithmeticExpansion":return`$((${qe(e.expression.expression)}))`;case"ProcessSubstitution":return e.direction==="input"?`<(${es(e.body)})`:`>(${es(e.body)})`;case"BraceExpansion":return _v(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 Ov(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,"\\$&")}function Tv(e){return e.replace(/[$`"\\]/g,"\\$&")}function Rv(e,t){return e.parts.map(n=>Pv(n,t)).join("")}function Pv(e,t){switch(e.type){case"Literal":return t?e.value:e.value.replace(/[$`]/g,"\\$&");case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return L7(e);case"CommandSubstitution":return e.legacy?`\`${es(e.body)}\``:`$(${es(e.body)})`;case"ArithmeticExpansion":return`$((${qe(e.expression.expression)}))`;default:return za(e,!1)}}function L7(e){return e.operation?`\${${M7(e.parameter,e.operation)}}`:Dv(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function Dv(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function M7(e,t){switch(t.type){case"Length":return`#${e}`;case"LengthSliceError":return`#${e}:`;case"BadSubstitution":return t.text;case"DefaultValue":return`${e}${t.checkEmpty?":":""}-${kr(t.word)}`;case"AssignDefault":return`${e}${t.checkEmpty?":":""}=${kr(t.word)}`;case"ErrorIfUnset":return`${e}${t.checkEmpty?":":""}?${t.word?kr(t.word):""}`;case"UseAlternative":return`${e}${t.checkEmpty?":":""}+${kr(t.word)}`;case"Substring":{let n=qe(t.offset.expression);return t.length?`${e}:${n}:${qe(t.length.expression)}`:`${e}:${n}`}case"PatternRemoval":{let n=t.side==="prefix"?"#":"%",r=t.greedy?`${n}${n}`:n;return`${e}${r}${kr(t.pattern)}`}case"PatternReplacement":{let n="/";t.all?n="//":t.anchor==="start"?n="/#":t.anchor==="end"&&(n="/%");let r=t.replacement?`/${kr(t.replacement)}`:"";return`${e}${n}${kr(t.pattern)}${r}`}case"CaseModification":{let n=t.direction==="upper"?"^":",",r=t.all?`${n}${n}`:n,s=t.pattern?kr(t.pattern):"";return`${e}${r}${s}`}case"Transform":return`${e}@${t.operator}`;case"Indirection":return t.innerOp?`!${M7(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 _v(e){return`{${e.items.map(Fv).join(",")}}`}function Fv(e){if(e.type==="Word")return Wt(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 U7(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd!==null?String(e.fd):"";if(e.operator==="<<"||e.operator==="<<-"){let n=e.target,r=n.quoted?`'${n.delimiter}'`:n.delimiter,s=Rv(n.content,n.quoted);return`${t}${e.operator}${r}
1469
+ ${s}${n.delimiter}`}return e.operator==="<<<"?`${t}<<< ${Wt(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${Wt(e.target)}`:`${t}${e.operator} ${Wt(e.target)}`}function Pn(e){return e.length===0?"":` ${e.map(U7).join(" ")}`}function wn(e){return e.map(_7).join(`
1470
+ `)}function Lv(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} ${wn(r.condition)}; then
1471
+ ${wn(r.body)}`)}return e.elseBody&&t.push(`else
1472
+ ${wn(e.elseBody)}`),`${t.join(`
1473
+ `)}
1474
+ fi${Pn(e.redirections)}`}function Mv(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(Wt).join(" ");t=`for ${e.variable} in ${n}`}return`${t}; do
1475
+ ${wn(e.body)}
1476
+ done${Pn(e.redirections)}`}function Uv(e){let t=e.init?qe(e.init.expression):"",n=e.condition?qe(e.condition.expression):"",r=e.update?qe(e.update.expression):"";return`for ((${t}; ${n}; ${r})); do
1477
+ ${wn(e.body)}
1478
+ done${Pn(e.redirections)}`}function Bv(e){return`while ${wn(e.condition)}; do
1479
+ ${wn(e.body)}
1480
+ done${Pn(e.redirections)}`}function Wv(e){return`until ${wn(e.condition)}; do
1481
+ ${wn(e.body)}
1482
+ done${Pn(e.redirections)}`}function zv(e){let t=e.items.map(Hv).join(`
1483
+ `);return`case ${Wt(e.word)} in
1484
+ ${t}
1485
+ esac${Pn(e.redirections)}`}function Hv(e){let t=e.patterns.map(Wt).join(" | "),n=wn(e.body);return n?`${t})
1486
+ ${n}
1487
+ ${e.terminator}`:`${t})
1488
+ ${e.terminator}`}function jv(e){return`(${wn(e.body)})${Pn(e.redirections)}`}function Gv(e){return`{ ${wn(e.body)}; }${Pn(e.redirections)}`}function Vv(e){return`((${qe(e.expression.expression)}))${Pn(e.redirections)}`}function qv(e){return`[[ ${Jr(e.expression)} ]]${Pn(e.redirections)}`}function Zv(e){let t=F7(e.body);return`${e.name}() ${t}${Pn(e.redirections)}`}function qe(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`${qe(e.left)} ${e.operator} ${qe(e.right)}`;case"ArithUnary":return e.prefix?`${e.operator}${qe(e.operand)}`:`${qe(e.operand)}${e.operator}`;case"ArithTernary":return`${qe(e.condition)} ? ${qe(e.consequent)} : ${qe(e.alternate)}`;case"ArithAssignment":return`${e.subscript?`${e.variable}[${qe(e.subscript)}]`:e.stringKey!==void 0?`${e.variable}[${e.stringKey}]`:e.variable} ${e.operator} ${qe(e.value)}`;case"ArithDynamicAssignment":return`${e.subscript?`${qe(e.target)}[${qe(e.subscript)}]`:qe(e.target)} ${e.operator} ${qe(e.value)}`;case"ArithDynamicElement":return`${qe(e.nameExpr)}[${qe(e.subscript)}]`;case"ArithGroup":return`(${qe(e.expression)})`;case"ArithNested":return`$((${qe(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}[${qe(e.index)}]`:e.array;case"ArithDynamicBase":return`\${${e.baseExpr}}#${e.value}`;case"ArithDynamicNumber":return`\${${e.prefix}}${e.suffix}`;case"ArithConcat":return e.parts.map(qe).join("");case"ArithDoubleSubscript":return`${e.array}[${qe(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 Jr(e){switch(e.type){case"CondBinary":return`${Wt(e.left)} ${e.operator} ${Wt(e.right)}`;case"CondUnary":return`${e.operator} ${Wt(e.operand)}`;case"CondNot":return`! ${Jr(e.operand)}`;case"CondAnd":return`${Jr(e.left)} && ${Jr(e.right)}`;case"CondOr":return`${Jr(e.left)} || ${Jr(e.right)}`;case"CondGroup":return`( ${Jr(e.expression)} )`;case"CondWord":return Wt(e.word);default:{let t=e;throw new Error(`Unsupported conditional expression type: ${t.type}`)}}}var Rf=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;invokeToolFn;transformPlugins=[];state;isConstructing=!1;constructor(t={}){this.isConstructing=!0;let n=t.fs??new rr(t.files);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",`
1489
+ `],["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(this.limits=S7({...t.executionLimits,...t.maxCallDepth!==void 0&&{maxCallDepth:t.maxCallDepth},...t.maxCommandCount!==void 0&&{maxCommandCount:t.maxCommandCount},...t.maxLoopIterations!==void 0&&{maxLoopIterations:t.maxLoopIterations}}),t.fetch?this.secureFetch=t.fetch:t.network&&(this.secureFetch=Tf(t.network)),this.sleepFn=t.sleep,this.traceFn=t.trace,this.logger=t.logger,this.defenseInDepthConfig=t.defenseInDepth??!0,this.coverageWriter=t.coverage,this.state={env:s,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",zc(this.state.options)),this.state.env.set("BASHOPTS",Hc(this.state.shoptOptions)),M2(n,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),r!=="/"&&n instanceof rr)try{n.mkdirSync(r,{recursive:!0})}catch{}for(let o of I2(t.commands))this.registerCommand(o);if(t.fetch||t.network)for(let o of $2())this.registerCommand(o);if(t.python)for(let o of O2())this.registerCommand(o);let i=typeof t.javascript=="object"?t.javascript:Object.create(null);if(t.javascript||i.invokeTool){for(let o of T2())this.registerCommand(o);i.bootstrap&&(this.jsBootstrapCode=i.bootstrap),i.invokeTool&&(this.invokeToolFn=i.invokeTool)}if(t.customCommands)for(let o of t.customCommands)if(R2(o)){let a=P2(o);a.custom=!0,this.registerCommand(a)}else this.registerCommand({...o,trusted:o.trusted??!0,custom:!0});this.isConstructing=!1}registerCommand(t){this.isConstructing||(t.custom=!0),this.commands.set(t.name,t);let n=this.fs;if(typeof n.writeFileSync=="function"){let r=`#!/bin/bash
1490
+ # Built-in command: ${t.name}
1491
+ `;try{n.writeFileSync(`/bin/${t.name}`,r)}catch{}try{n.writeFileSync(`/usr/bin/${t.name}`,r)}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=W7(t.stdout),t.stderr=W7(t.stderr),t}async exec(t,n){if(this.state.callDepth===0&&(this.state.commandCount=0),this.state.commandCount++,this.state.commandCount>this.limits.maxCommandCount)return{stdout:"",stderr:`bash: maximum command count (${this.limits.maxCommandCount}) exceeded (possible infinite loop). Increase with executionLimits.maxCommandCount option.
1492
+ `,exitCode:1,env:pn(this.state.env,n?.env)};if(!t.trim())return{stdout:"",stderr:"",exitCode:0,env:pn(this.state.env,n?.env)};this.logger?.info("exec",{command:t});let r=n?.cwd??this.state.cwd,s,i=r;if(n?.cwd)if(n.env&&"PWD"in n.env)s=n.env.PWD;else if(n?.env&&!("PWD"in n.env))try{s=await this.fs.realpath(r),i=s}catch{s=r}else s=r;let o=n?.replaceEnv?new Map:new Map(this.state.env);if(n?.env)for(let[f,p]of Object.entries(n.env))o.set(f,p);s!==void 0&&o.set("PWD",s);let a={...this.state,env:o,cwd:i,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options},hashTable:this.state.hashTable,groupStdin:Qv(n?.stdin,n?.stdinKind),signal:n?.signal,extraArgs:n?.args},l=t;n?.rawScript||(l=B7(t));let c=this.defenseInDepthConfig?Et.getInstance(this.defenseInDepthConfig):null,u=c?.activate();try{let f=async()=>{let p=kn(l,{maxHeredocSize:this.limits.maxHeredocSize}),h;if(this.transformPlugins.length>0){let b=Object.create(null);for(let w of this.transformPlugins){let x=w.transform({ast:p,metadata:b});p=x.ast,x.metadata&&(b=Dr(b,x.metadata))}h=b}let d={fs:this.fs,commands:this.commands,limits:this.limits,exec:this.exec.bind(this),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn,coverage:this.coverageWriter,requireDefenseContext:c?.isEnabled()===!0,jsBootstrapCode:this.jsBootstrapCode,invokeTool:this.invokeToolFn},y=await new _i(d,a).executeScript(p);return h&&(y.metadata=h),this.logResult(y)};return u?await u.run(f):await f()}catch(f){if(f instanceof we)return this.logResult({stdout:f.stdout,stderr:f.stderr,exitCode:f.exitCode,env:pn(this.state.env,n?.env)});if(f instanceof nn)return this.logResult({stdout:f.stdout,stderr:f.stderr,exitCode:f.exitCode,env:pn(this.state.env,n?.env)});if(f instanceof Le)return this.logResult({stdout:f.stdout,stderr:f.stderr,exitCode:1,env:pn(this.state.env,n?.env)});if(f instanceof os)return this.logResult({stdout:f.stdout,stderr:f.stderr,exitCode:124,env:pn(this.state.env,n?.env)});if(f instanceof X)return this.logResult({stdout:f.stdout,stderr:He(f.stderr),exitCode:X.EXIT_CODE,env:pn(this.state.env,n?.env)});if(f instanceof de)return this.logResult({stdout:"",stderr:`bash: security violation: ${He(f.message)}
1493
+ `,exitCode:1,env:pn(this.state.env,n?.env)});if(f.name==="ParseException")return this.logResult({stdout:"",stderr:`bash: syntax error: ${He(f.message)}
1494
+ `,exitCode:2,env:pn(this.state.env,n?.env)});if(f instanceof mr)return this.logResult({stdout:"",stderr:`bash: ${He(f.message)}
1495
+ `,exitCode:2,env:pn(this.state.env,n?.env)});if(f instanceof RangeError)return this.logResult({stdout:"",stderr:`bash: ${He(f.message)}
1496
+ `,exitCode:1,env:pn(this.state.env,n?.env)});throw f}finally{u?.deactivate()}}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 Ct(this.state.env)}registerTransformPlugin(t){this.transformPlugins.push(t)}transform(t){let n=B7(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=Dr(s,o.metadata))}return{script:D7(r),ast:r,metadata:s}}};function B7(e){let t=e.split(`
1497
+ `),n=[],r=[];for(let s=0;s<t.length;s++){let i=t[s];if(r.length>0){let l=r[r.length-1];if((l.stripTabs?i.replace(/^\t+/,""):i)===l.delimiter){n.push(i.trimStart()),r.pop();continue}n.push(i);continue}let o=i.trimStart();n.push(o);let a=/<<(-?)\s*(['"]?)([\w-]+)\2/g;for(let l of o.matchAll(a)){let c=l[1]==="-",u=l[3];r.push({delimiter:u,stripTabs:c})}}return n.join(`
1498
+ `)}var Kv=new TextDecoder("utf-8",{fatal:!0});function W7(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 Kv.decode(n)}catch{return e}}function Qv(e,t){if(e!==void 0)return t==="bytes"?e:Dn(e)}ge();var Ha=class{baseFs;mounts=new Map;constructor(t){if(this.baseFs=t?.base??new rr,t?.mounts)for(let{mountPoint:n,filesystem:r}of t.mounts)this.mount(n,r)}mount(t,n){this.validateMountPath(t);let r=ke(t);this.validateMount(r),this.mounts.set(r,{mountPoint:r,filesystem:n})}unmount(t){let n=ke(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=ke(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){lt(t,"access");let n=ke(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=ke(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 _n(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=ke(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=ke(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=ke(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=ke(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=ke(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=ke(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){let s=this.routePath(t),i=this.routePath(n);return s.fs===i.fs?s.fs.cp(s.relativePath,i.relativePath,r):this.crossMountCopy(t,n,r)}async mv(t,n){let r=ke(t);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot move '${t}'`);let s=this.routePath(t),i=this.routePath(n);if(s.fs===i.fs)return s.fs.mv(s.relativePath,i.relativePath);await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}resolvePath(t,n){return Zo(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=ke(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=ke(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=hr(t,o),l=hr(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)}};export{Rf as Bash,rr as InMemoryFs,Ha as MountableFs,Rn as NetworkAccessDeniedError,Gs as RedirectNotAllowedError,js as TooManyRedirectsError,kA as defineCommand,CA as getCommandNames,vA as getNetworkCommandNames};
1499
+ /*! Bundled license information:
1500
+
1501
+ re2js/build/index.esm.js:
1502
+ (*!
1503
+ * re2js
1504
+ * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
1505
+ *
1506
+ * @version v1.4.0
1507
+ * @author Alexey Vasiliev
1508
+ * @homepage https://github.com/le0pard/re2js#readme
1509
+ * @repository github:le0pard/re2js
1510
+ * @license MIT
1511
+ *)
1512
+
1513
+ ieee754/index.js:
1514
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
1515
+ */