just-bash 2.9.4 → 2.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AGENTS.md +31 -2
- package/dist/Bash.d.ts +7 -1
- package/dist/bin/chunks/alias-3GODYSFD.js +2 -0
- package/dist/bin/chunks/awk2-JBWRWZZH.js +2 -0
- package/dist/bin/chunks/base64-OHU2WTUF.js +2 -0
- package/dist/bin/chunks/basename-KBUKWB2E.js +2 -0
- package/dist/bin/chunks/bash-RJTQJAKW.js +2 -0
- package/dist/bin/chunks/cat-3J7U3HHI.js +2 -0
- package/dist/bin/chunks/chmod-4O2C4V42.js +2 -0
- package/dist/bin/chunks/chunk-26NO42TF.js +14 -0
- package/dist/bin/chunks/chunk-2SIXTZCJ.js +5 -0
- package/dist/bin/chunks/chunk-3MBAUIBB.js +7 -0
- package/dist/bin/chunks/chunk-3Y32LPNT.js +2 -0
- package/dist/bin/chunks/chunk-4E3LY6YK.js +10 -0
- package/dist/bin/chunks/chunk-4P5OA25Z.js +26 -0
- package/dist/bin/chunks/chunk-4PS5JJDT.js +8 -0
- package/dist/bin/chunks/chunk-5G2VOPPJ.js +7 -0
- package/dist/bin/chunks/chunk-5U7Q4GUC.js +6 -0
- package/dist/bin/chunks/chunk-5VFN7VVJ.js +9 -0
- package/dist/bin/chunks/chunk-6VUEI2GS.js +9 -0
- package/dist/bin/chunks/chunk-7BORMNPQ.js +2 -0
- package/dist/bin/chunks/chunk-7ECKLAVW.js +11 -0
- package/dist/bin/{shell/chunks/sed-E4QAUCYQ.js → chunks/chunk-7FTB27TY.js} +36 -36
- package/dist/bin/chunks/{tr-IAUNBQKH.js → chunk-BDSRLH5T.js} +5 -5
- package/dist/bin/chunks/chunk-BYDV4VEF.js +3 -0
- package/dist/bin/{shell/chunks/yq-XD7UYY5C.js → chunks/chunk-CHQBMS62.js} +24 -24
- package/dist/bin/chunks/chunk-D2GFNFUN.js +7 -0
- package/dist/bin/chunks/chunk-DAGNL3F2.js +32 -0
- package/dist/bin/chunks/chunk-DSNA7727.js +13 -0
- package/dist/bin/chunks/{tar-CLEBMI4R.js → chunk-EFX3F2HZ.js} +6 -6
- package/dist/bin/chunks/{rmdir-OEMA5ZTD.js → chunk-EJQKHROT.js} +3 -3
- package/dist/bin/chunks/chunk-EUXCM6C4.js +12 -0
- package/dist/bin/{shell/chunks/xan-QLNZCWIG.js → chunks/chunk-F26OLHG5.js} +17 -17
- package/dist/bin/chunks/chunk-FLPVVSN5.js +5 -0
- package/dist/bin/chunks/{chunk-HSNUCOOQ.js → chunk-FZNYF2PQ.js} +2 -2
- package/dist/bin/chunks/chunk-ITA43A73.js +7 -0
- package/dist/bin/chunks/chunk-IY3BUFJK.js +5 -0
- package/dist/bin/chunks/chunk-JLX6YWGA.js +3 -0
- package/dist/bin/chunks/chunk-JQBC3FXE.js +8 -0
- package/dist/bin/chunks/chunk-JTF74J6E.js +2 -0
- package/dist/bin/chunks/chunk-JXC25GVQ.js +5 -0
- package/dist/bin/chunks/chunk-K47SEEPI.js +6 -0
- package/dist/bin/chunks/chunk-KLMOJKL4.js +16 -0
- package/dist/bin/chunks/chunk-KWLLB7S3.js +7 -0
- package/dist/bin/chunks/chunk-LJKIWB5F.js +4 -0
- package/dist/bin/chunks/chunk-LMK6G2HH.js +8 -0
- package/dist/bin/chunks/chunk-MAVV76T4.js +2 -0
- package/dist/bin/chunks/chunk-N43DJTSI.js +2 -0
- package/dist/bin/chunks/{file-MWSA2WYI.js → chunk-N5OTVT4F.js} +1 -1
- package/dist/bin/chunks/{time-F4NVQOJH.js → chunk-N73TVRMN.js} +5 -5
- package/dist/bin/chunks/chunk-NEQEZ32M.js +5 -0
- package/dist/bin/chunks/{sleep-O5BOTJGJ.js → chunk-NFZDITRV.js} +4 -4
- package/dist/bin/chunks/chunk-NSUMEERA.js +12 -0
- package/dist/bin/chunks/chunk-OIKCUTTB.js +6 -0
- package/dist/bin/chunks/chunk-P6GNZPVW.js +19 -0
- package/dist/bin/chunks/chunk-P7UCWJ33.js +12 -0
- package/dist/bin/chunks/{sqlite3-CUDCXXK3.js → chunk-PDVXLMUU.js} +9 -9
- package/dist/bin/chunks/chunk-PPBQJBC2.js +5 -0
- package/dist/bin/chunks/chunk-PQNTKMH3.js +6 -0
- package/dist/bin/chunks/chunk-PS4LOXE5.js +8 -0
- package/dist/bin/chunks/{chunk-B3E7BBYK.js → chunk-Q4AUWUII.js} +41 -41
- package/dist/bin/{shell/chunks/rg-IZR5557M.js → chunks/chunk-Q4QFIAHB.js} +9 -9
- package/dist/bin/chunks/chunk-QXB5WI2V.js +16 -0
- package/dist/bin/chunks/chunk-RJSAGJQJ.js +11 -0
- package/dist/bin/chunks/chunk-ROJPSS6N.js +3 -0
- package/dist/bin/chunks/chunk-RT7TRQVZ.js +3 -0
- package/dist/bin/chunks/chunk-S7OHMN3F.js +6 -0
- package/dist/bin/chunks/{nl-DSM3NUGM.js → chunk-SGA7Y45Z.js} +7 -7
- package/dist/bin/chunks/chunk-STU6KQN4.js +6 -0
- package/dist/bin/chunks/chunk-SXRVLCZ4.js +2 -0
- package/dist/bin/chunks/chunk-TEFXEYX3.js +3 -0
- package/dist/bin/chunks/chunk-THALLNXT.js +7 -0
- package/dist/bin/chunks/chunk-THLAHQXV.js +16 -0
- package/dist/bin/chunks/chunk-TIDZOIPX.js +3 -0
- package/dist/bin/chunks/chunk-VNER2XXL.js +7 -0
- package/dist/bin/chunks/chunk-W2FKF3MM.js +9 -0
- package/dist/bin/chunks/chunk-WT2HWDDA.js +9 -0
- package/dist/bin/chunks/chunk-X2I3PJTX.js +15 -0
- package/dist/bin/chunks/chunk-XAL6VWGA.js +9 -0
- package/dist/bin/chunks/{html-to-markdown-EPEXKI4B.js → chunk-XKPFI566.js} +9 -9
- package/dist/bin/chunks/chunk-YEKSVVRC.js +11 -0
- package/dist/bin/chunks/chunk-YLE2OYY6.js +2 -0
- package/dist/bin/chunks/chunk-YYQ22ZRL.js +8 -0
- package/dist/bin/chunks/chunk-ZA4HUKJ3.js +13 -0
- package/dist/bin/chunks/chunk-ZJSZ2BE5.js +21 -0
- package/dist/bin/chunks/chunk-ZKC5HQYO.js +14 -0
- package/dist/bin/chunks/clear-KRGKPFOI.js +2 -0
- package/dist/bin/chunks/column-XGV32UPN.js +2 -0
- package/dist/bin/chunks/comm-R3F3Z5DX.js +2 -0
- package/dist/bin/chunks/cp-XH2ZB7WT.js +2 -0
- package/dist/bin/chunks/cut-HDHQDWRG.js +2 -0
- package/dist/bin/chunks/date-6VDN5QZ5.js +2 -0
- package/dist/bin/chunks/diff-LE7GMFZD.js +2 -0
- package/dist/bin/chunks/dirname-5FAOMLBL.js +2 -0
- package/dist/bin/chunks/du-66BNA4IN.js +2 -0
- package/dist/bin/chunks/echo-2MUAOGUE.js +2 -0
- package/dist/bin/chunks/env-EVLPSWFF.js +2 -0
- package/dist/bin/chunks/expand-26XPP5KB.js +2 -0
- package/dist/bin/{shell/chunks/expansion-LR5H7O2U.js → chunks/expansion-HIAVHGBZ.js} +1 -1
- package/dist/bin/chunks/expr-MLHUWFYI.js +2 -0
- package/dist/bin/chunks/file-D5YKS5NV.js +2 -0
- package/dist/bin/chunks/find-K777TRNA.js +2 -0
- package/dist/bin/chunks/flag-coverage-FNEHS7AY.js +2 -0
- package/dist/bin/chunks/fold-XSVNTAWH.js +2 -0
- package/dist/bin/chunks/grep-FRIPZKKT.js +2 -0
- package/dist/bin/chunks/gzip-EENEW6WQ.js +2 -0
- package/dist/bin/chunks/head-YMNRW3F3.js +2 -0
- package/dist/bin/chunks/help-JF5TTAKQ.js +2 -0
- package/dist/bin/chunks/history-UUKG55YW.js +2 -0
- package/dist/bin/chunks/hostname-WY6RKE32.js +2 -0
- package/dist/bin/chunks/html-to-markdown-WVZA3MCP.js +2 -0
- package/dist/bin/chunks/join-Y4Q5WVVE.js +2 -0
- package/dist/bin/chunks/jq-3VHS7DR6.js +2 -0
- package/dist/bin/chunks/ln-5TCJXDGY.js +2 -0
- package/dist/bin/chunks/ls-ZXYOL67L.js +2 -0
- package/dist/bin/chunks/md5sum-NCLXV2S3.js +2 -0
- package/dist/bin/chunks/mkdir-6OKMS3KO.js +2 -0
- package/dist/bin/chunks/mv-OY7X62QC.js +2 -0
- package/dist/bin/chunks/nl-XH3L75DR.js +2 -0
- package/dist/bin/chunks/od-52FBC34W.js +2 -0
- package/dist/bin/chunks/paste-3UVLMQ2K.js +2 -0
- package/dist/bin/chunks/printf-TZC5BRAY.js +2 -0
- package/dist/bin/chunks/pwd-6VBAPL3Y.js +2 -0
- package/dist/bin/chunks/readlink-YNOUXNUY.js +2 -0
- package/dist/bin/chunks/rev-UHEPS2UL.js +2 -0
- package/dist/bin/chunks/rg-3R5G2XL4.js +2 -0
- package/dist/bin/chunks/rm-5QIBTLJG.js +2 -0
- package/dist/bin/chunks/rmdir-5KLM4EA6.js +2 -0
- package/dist/bin/chunks/sed-XP3QCHIB.js +2 -0
- package/dist/bin/chunks/seq-V7KBLSQ7.js +2 -0
- package/dist/bin/chunks/sha1sum-BHNJ5ALF.js +2 -0
- package/dist/bin/chunks/sha256sum-HJJ3NJ5L.js +2 -0
- package/dist/bin/chunks/sleep-PICQVS6Q.js +2 -0
- package/dist/bin/chunks/sort-NZSEYCI6.js +2 -0
- package/dist/bin/chunks/split-NOZ7FFXW.js +2 -0
- package/dist/bin/chunks/sqlite3-4SEIR46P.js +2 -0
- package/dist/bin/chunks/stat-XH7E4E2C.js +2 -0
- package/dist/bin/chunks/strings-XXKZCWY5.js +2 -0
- package/dist/bin/chunks/tac-TZBNTR4K.js +2 -0
- package/dist/bin/chunks/tail-V537TDFR.js +2 -0
- package/dist/bin/chunks/tar-7B5KH3QG.js +2 -0
- package/dist/bin/chunks/tee-HK2SYCAR.js +2 -0
- package/dist/bin/chunks/time-4C3A4THJ.js +2 -0
- package/dist/bin/chunks/timeout-RS7REDYT.js +2 -0
- package/dist/bin/chunks/touch-DWKSZGOQ.js +2 -0
- package/dist/bin/chunks/tr-GDDRKGRB.js +2 -0
- package/dist/bin/chunks/tree-HEKABARE.js +2 -0
- package/dist/bin/chunks/true-DP5UZP52.js +2 -0
- package/dist/bin/chunks/unexpand-OYZ7KOYR.js +2 -0
- package/dist/bin/chunks/uniq-FZWFZEN5.js +2 -0
- package/dist/bin/chunks/wc-ZIV3TFVG.js +2 -0
- package/dist/bin/chunks/which-67WZ6OMV.js +2 -0
- package/dist/bin/chunks/whoami-E7PN2UWC.js +2 -0
- package/dist/bin/chunks/xan-EBI2W7YX.js +2 -0
- package/dist/bin/chunks/xargs-YWPEV2QC.js +2 -0
- package/dist/bin/chunks/yq-O56CEX4T.js +2 -0
- package/dist/bin/just-bash.js +190 -188
- package/dist/bin/shell/chunks/alias-3GODYSFD.js +2 -0
- package/dist/bin/shell/chunks/awk2-JBWRWZZH.js +2 -0
- package/dist/bin/shell/chunks/base64-OHU2WTUF.js +2 -0
- package/dist/bin/shell/chunks/basename-KBUKWB2E.js +2 -0
- package/dist/bin/shell/chunks/bash-RJTQJAKW.js +2 -0
- package/dist/bin/shell/chunks/cat-3J7U3HHI.js +2 -0
- package/dist/bin/shell/chunks/chmod-4O2C4V42.js +2 -0
- package/dist/bin/shell/chunks/chunk-26NO42TF.js +14 -0
- package/dist/bin/shell/chunks/chunk-2SIXTZCJ.js +5 -0
- package/dist/bin/shell/chunks/chunk-3MBAUIBB.js +7 -0
- package/dist/bin/shell/chunks/chunk-3Y32LPNT.js +2 -0
- package/dist/bin/shell/chunks/chunk-4E3LY6YK.js +10 -0
- package/dist/bin/shell/chunks/chunk-4P5OA25Z.js +26 -0
- package/dist/bin/shell/chunks/chunk-4PS5JJDT.js +8 -0
- package/dist/bin/shell/chunks/chunk-5G2VOPPJ.js +7 -0
- package/dist/bin/shell/chunks/chunk-5U7Q4GUC.js +6 -0
- package/dist/bin/shell/chunks/chunk-5VFN7VVJ.js +9 -0
- package/dist/bin/shell/chunks/chunk-6VUEI2GS.js +9 -0
- package/dist/bin/shell/chunks/chunk-7BORMNPQ.js +2 -0
- package/dist/bin/shell/chunks/chunk-7ECKLAVW.js +11 -0
- package/dist/bin/{chunks/sed-E4QAUCYQ.js → shell/chunks/chunk-7FTB27TY.js} +36 -36
- package/dist/bin/shell/chunks/{tr-IAUNBQKH.js → chunk-BDSRLH5T.js} +5 -5
- package/dist/bin/shell/chunks/chunk-BYDV4VEF.js +3 -0
- package/dist/bin/{chunks/yq-XD7UYY5C.js → shell/chunks/chunk-CHQBMS62.js} +24 -24
- package/dist/bin/shell/chunks/chunk-D2GFNFUN.js +7 -0
- package/dist/bin/shell/chunks/chunk-DAGNL3F2.js +32 -0
- package/dist/bin/shell/chunks/chunk-DSNA7727.js +13 -0
- package/dist/bin/shell/chunks/{tar-CLEBMI4R.js → chunk-EFX3F2HZ.js} +6 -6
- package/dist/bin/shell/chunks/{rmdir-OEMA5ZTD.js → chunk-EJQKHROT.js} +3 -3
- package/dist/bin/shell/chunks/chunk-EUXCM6C4.js +12 -0
- package/dist/bin/{chunks/xan-QLNZCWIG.js → shell/chunks/chunk-F26OLHG5.js} +17 -17
- package/dist/bin/shell/chunks/chunk-FLPVVSN5.js +5 -0
- package/dist/bin/shell/chunks/{chunk-HSNUCOOQ.js → chunk-FZNYF2PQ.js} +2 -2
- package/dist/bin/shell/chunks/chunk-ITA43A73.js +7 -0
- package/dist/bin/shell/chunks/chunk-IY3BUFJK.js +5 -0
- package/dist/bin/shell/chunks/chunk-JLX6YWGA.js +3 -0
- package/dist/bin/shell/chunks/chunk-JQBC3FXE.js +8 -0
- package/dist/bin/shell/chunks/chunk-JTF74J6E.js +2 -0
- package/dist/bin/shell/chunks/chunk-JXC25GVQ.js +5 -0
- package/dist/bin/shell/chunks/chunk-K47SEEPI.js +6 -0
- package/dist/bin/shell/chunks/chunk-KLMOJKL4.js +16 -0
- package/dist/bin/shell/chunks/chunk-KWLLB7S3.js +7 -0
- package/dist/bin/shell/chunks/chunk-LJKIWB5F.js +4 -0
- package/dist/bin/shell/chunks/chunk-LMK6G2HH.js +8 -0
- package/dist/bin/shell/chunks/chunk-MAVV76T4.js +2 -0
- package/dist/bin/shell/chunks/chunk-N43DJTSI.js +2 -0
- package/dist/bin/shell/chunks/{file-MWSA2WYI.js → chunk-N5OTVT4F.js} +1 -1
- package/dist/bin/shell/chunks/{time-F4NVQOJH.js → chunk-N73TVRMN.js} +5 -5
- package/dist/bin/shell/chunks/chunk-NEQEZ32M.js +5 -0
- package/dist/bin/shell/chunks/{sleep-O5BOTJGJ.js → chunk-NFZDITRV.js} +4 -4
- package/dist/bin/shell/chunks/chunk-NSUMEERA.js +12 -0
- package/dist/bin/shell/chunks/chunk-OIKCUTTB.js +6 -0
- package/dist/bin/shell/chunks/chunk-P6GNZPVW.js +19 -0
- package/dist/bin/shell/chunks/chunk-P7UCWJ33.js +12 -0
- package/dist/bin/shell/chunks/{sqlite3-CUDCXXK3.js → chunk-PDVXLMUU.js} +9 -9
- package/dist/bin/shell/chunks/chunk-PPBQJBC2.js +5 -0
- package/dist/bin/shell/chunks/chunk-PQNTKMH3.js +6 -0
- package/dist/bin/shell/chunks/chunk-PS4LOXE5.js +8 -0
- package/dist/bin/shell/chunks/{chunk-B3E7BBYK.js → chunk-Q4AUWUII.js} +41 -41
- package/dist/bin/{chunks/rg-IZR5557M.js → shell/chunks/chunk-Q4QFIAHB.js} +9 -9
- package/dist/bin/shell/chunks/chunk-QXB5WI2V.js +16 -0
- package/dist/bin/shell/chunks/chunk-RJSAGJQJ.js +11 -0
- package/dist/bin/shell/chunks/chunk-ROJPSS6N.js +3 -0
- package/dist/bin/shell/chunks/chunk-RT7TRQVZ.js +3 -0
- package/dist/bin/shell/chunks/chunk-S7OHMN3F.js +6 -0
- package/dist/bin/shell/chunks/{nl-DSM3NUGM.js → chunk-SGA7Y45Z.js} +7 -7
- package/dist/bin/shell/chunks/chunk-STU6KQN4.js +6 -0
- package/dist/bin/shell/chunks/chunk-SXRVLCZ4.js +2 -0
- package/dist/bin/shell/chunks/chunk-TEFXEYX3.js +3 -0
- package/dist/bin/shell/chunks/chunk-THALLNXT.js +7 -0
- package/dist/bin/shell/chunks/chunk-THLAHQXV.js +16 -0
- package/dist/bin/shell/chunks/chunk-TIDZOIPX.js +3 -0
- package/dist/bin/shell/chunks/chunk-VNER2XXL.js +7 -0
- package/dist/bin/shell/chunks/chunk-W2FKF3MM.js +9 -0
- package/dist/bin/shell/chunks/chunk-WT2HWDDA.js +9 -0
- package/dist/bin/shell/chunks/chunk-X2I3PJTX.js +15 -0
- package/dist/bin/shell/chunks/chunk-XAL6VWGA.js +9 -0
- package/dist/bin/shell/chunks/{html-to-markdown-EPEXKI4B.js → chunk-XKPFI566.js} +9 -9
- package/dist/bin/shell/chunks/chunk-YEKSVVRC.js +11 -0
- package/dist/bin/shell/chunks/chunk-YLE2OYY6.js +2 -0
- package/dist/bin/shell/chunks/chunk-YYQ22ZRL.js +8 -0
- package/dist/bin/shell/chunks/chunk-ZA4HUKJ3.js +13 -0
- package/dist/bin/shell/chunks/chunk-ZJSZ2BE5.js +21 -0
- package/dist/bin/shell/chunks/chunk-ZKC5HQYO.js +14 -0
- package/dist/bin/shell/chunks/clear-KRGKPFOI.js +2 -0
- package/dist/bin/shell/chunks/column-XGV32UPN.js +2 -0
- package/dist/bin/shell/chunks/comm-R3F3Z5DX.js +2 -0
- package/dist/bin/shell/chunks/cp-XH2ZB7WT.js +2 -0
- package/dist/bin/shell/chunks/cut-HDHQDWRG.js +2 -0
- package/dist/bin/shell/chunks/date-6VDN5QZ5.js +2 -0
- package/dist/bin/shell/chunks/diff-LE7GMFZD.js +2 -0
- package/dist/bin/shell/chunks/dirname-5FAOMLBL.js +2 -0
- package/dist/bin/shell/chunks/du-66BNA4IN.js +2 -0
- package/dist/bin/shell/chunks/echo-2MUAOGUE.js +2 -0
- package/dist/bin/shell/chunks/env-EVLPSWFF.js +2 -0
- package/dist/bin/shell/chunks/expand-26XPP5KB.js +2 -0
- package/dist/bin/{chunks/expansion-LR5H7O2U.js → shell/chunks/expansion-HIAVHGBZ.js} +1 -1
- package/dist/bin/shell/chunks/expr-MLHUWFYI.js +2 -0
- package/dist/bin/shell/chunks/file-D5YKS5NV.js +2 -0
- package/dist/bin/shell/chunks/find-K777TRNA.js +2 -0
- package/dist/bin/shell/chunks/flag-coverage-FNEHS7AY.js +2 -0
- package/dist/bin/shell/chunks/fold-XSVNTAWH.js +2 -0
- package/dist/bin/shell/chunks/grep-FRIPZKKT.js +2 -0
- package/dist/bin/shell/chunks/gzip-EENEW6WQ.js +2 -0
- package/dist/bin/shell/chunks/head-YMNRW3F3.js +2 -0
- package/dist/bin/shell/chunks/help-JF5TTAKQ.js +2 -0
- package/dist/bin/shell/chunks/history-UUKG55YW.js +2 -0
- package/dist/bin/shell/chunks/hostname-WY6RKE32.js +2 -0
- package/dist/bin/shell/chunks/html-to-markdown-WVZA3MCP.js +2 -0
- package/dist/bin/shell/chunks/join-Y4Q5WVVE.js +2 -0
- package/dist/bin/shell/chunks/jq-3VHS7DR6.js +2 -0
- package/dist/bin/shell/chunks/ln-5TCJXDGY.js +2 -0
- package/dist/bin/shell/chunks/ls-ZXYOL67L.js +2 -0
- package/dist/bin/shell/chunks/md5sum-NCLXV2S3.js +2 -0
- package/dist/bin/shell/chunks/mkdir-6OKMS3KO.js +2 -0
- package/dist/bin/shell/chunks/mv-OY7X62QC.js +2 -0
- package/dist/bin/shell/chunks/nl-XH3L75DR.js +2 -0
- package/dist/bin/shell/chunks/od-52FBC34W.js +2 -0
- package/dist/bin/shell/chunks/paste-3UVLMQ2K.js +2 -0
- package/dist/bin/shell/chunks/printf-TZC5BRAY.js +2 -0
- package/dist/bin/shell/chunks/pwd-6VBAPL3Y.js +2 -0
- package/dist/bin/shell/chunks/readlink-YNOUXNUY.js +2 -0
- package/dist/bin/shell/chunks/rev-UHEPS2UL.js +2 -0
- package/dist/bin/shell/chunks/rg-3R5G2XL4.js +2 -0
- package/dist/bin/shell/chunks/rm-5QIBTLJG.js +2 -0
- package/dist/bin/shell/chunks/rmdir-5KLM4EA6.js +2 -0
- package/dist/bin/shell/chunks/sed-XP3QCHIB.js +2 -0
- package/dist/bin/shell/chunks/seq-V7KBLSQ7.js +2 -0
- package/dist/bin/shell/chunks/sha1sum-BHNJ5ALF.js +2 -0
- package/dist/bin/shell/chunks/sha256sum-HJJ3NJ5L.js +2 -0
- package/dist/bin/shell/chunks/sleep-PICQVS6Q.js +2 -0
- package/dist/bin/shell/chunks/sort-NZSEYCI6.js +2 -0
- package/dist/bin/shell/chunks/split-NOZ7FFXW.js +2 -0
- package/dist/bin/shell/chunks/sqlite3-4SEIR46P.js +2 -0
- package/dist/bin/shell/chunks/stat-XH7E4E2C.js +2 -0
- package/dist/bin/shell/chunks/strings-XXKZCWY5.js +2 -0
- package/dist/bin/shell/chunks/tac-TZBNTR4K.js +2 -0
- package/dist/bin/shell/chunks/tail-V537TDFR.js +2 -0
- package/dist/bin/shell/chunks/tar-7B5KH3QG.js +2 -0
- package/dist/bin/shell/chunks/tee-HK2SYCAR.js +2 -0
- package/dist/bin/shell/chunks/time-4C3A4THJ.js +2 -0
- package/dist/bin/shell/chunks/timeout-RS7REDYT.js +2 -0
- package/dist/bin/shell/chunks/touch-DWKSZGOQ.js +2 -0
- package/dist/bin/shell/chunks/tr-GDDRKGRB.js +2 -0
- package/dist/bin/shell/chunks/tree-HEKABARE.js +2 -0
- package/dist/bin/shell/chunks/true-DP5UZP52.js +2 -0
- package/dist/bin/shell/chunks/unexpand-OYZ7KOYR.js +2 -0
- package/dist/bin/shell/chunks/uniq-FZWFZEN5.js +2 -0
- package/dist/bin/shell/chunks/wc-ZIV3TFVG.js +2 -0
- package/dist/bin/shell/chunks/which-67WZ6OMV.js +2 -0
- package/dist/bin/shell/chunks/whoami-E7PN2UWC.js +2 -0
- package/dist/bin/shell/chunks/xan-EBI2W7YX.js +2 -0
- package/dist/bin/shell/chunks/xargs-YWPEV2QC.js +2 -0
- package/dist/bin/shell/chunks/yq-O56CEX4T.js +2 -0
- package/dist/bin/shell/shell.js +192 -190
- package/dist/bundle/browser.js +773 -771
- package/dist/bundle/chunks/alias-JE7RI5QX.js +1 -0
- package/dist/bundle/chunks/awk2-M5NFQRYA.js +1 -0
- package/dist/bundle/chunks/base64-HYOQ5I2F.js +1 -0
- package/dist/bundle/chunks/basename-AA2KJYZQ.js +1 -0
- package/dist/bundle/chunks/bash-OVBCDR7G.js +1 -0
- package/dist/bundle/chunks/cat-C2OBLGHA.js +1 -0
- package/dist/bundle/chunks/chmod-MIKE3OIT.js +1 -0
- package/dist/bundle/chunks/chunk-27LMNKBP.js +7 -0
- package/dist/bundle/chunks/chunk-4HHKTUW3.js +2 -0
- package/dist/bundle/chunks/chunk-4Q4SM6WR.js +4 -0
- package/dist/bundle/chunks/chunk-55VFSPNA.js +2 -0
- package/dist/bundle/chunks/chunk-5V6VZH6T.js +1 -0
- package/dist/bundle/chunks/chunk-64BAICW3.js +1 -0
- package/dist/bundle/chunks/chunk-6NY2AP72.js +5 -0
- package/dist/bundle/chunks/chunk-7C6RBHP3.js +4 -0
- package/dist/bundle/chunks/chunk-7DBA735O.js +5 -0
- package/dist/bundle/chunks/chunk-A4HU7SVR.js +2 -0
- package/dist/bundle/chunks/chunk-A4JSPFCI.js +6 -0
- package/dist/bundle/chunks/chunk-A7A2DBEE.js +6 -0
- package/dist/bundle/chunks/chunk-A7ICOL4V.js +13 -0
- package/dist/bundle/chunks/chunk-ALLTKNUZ.js +5 -0
- package/dist/bundle/chunks/chunk-APT7OOP2.js +1 -0
- package/dist/bundle/chunks/{chunk-RERCNF7Z.js → chunk-CCL4U6Q4.js} +41 -41
- package/dist/bundle/chunks/{file-APPTAFMI.js → chunk-CR5AFCPT.js} +1 -1
- package/dist/bundle/chunks/{time-EGF4KTWV.js → chunk-CSBFBYLD.js} +5 -5
- package/dist/bundle/chunks/chunk-D4J545R4.js +11 -0
- package/dist/bundle/chunks/chunk-DCAAORBQ.js +1 -0
- package/dist/bundle/chunks/chunk-DZ33S2U7.js +31 -0
- package/dist/bundle/chunks/{nl-KWQGFZH5.js → chunk-F23WWYKW.js} +7 -7
- package/dist/bundle/chunks/chunk-GCTKCWKD.js +3 -0
- package/dist/bundle/chunks/{yq-JD6M7T5A.js → chunk-GOBUJIHS.js} +24 -24
- package/dist/bundle/chunks/chunk-GQ7SJRUH.js +12 -0
- package/dist/bundle/chunks/chunk-GXVXFKBA.js +5 -0
- package/dist/bundle/chunks/chunk-GZ2N3SXD.js +8 -0
- package/dist/bundle/chunks/{sqlite3-DK5YHTWU.js → chunk-HDZ4QEVJ.js} +9 -9
- package/dist/bundle/chunks/chunk-HJQJAYMS.js +2 -0
- package/dist/bundle/chunks/chunk-HXILPMCG.js +5 -0
- package/dist/bundle/chunks/chunk-IKZ5LEGB.js +6 -0
- package/dist/bundle/chunks/chunk-JSZMK2JZ.js +5 -0
- package/dist/bundle/chunks/chunk-JVPRLUMK.js +7 -0
- package/dist/bundle/chunks/chunk-K3PAWJ7V.js +7 -0
- package/dist/bundle/chunks/chunk-KAEMRWOH.js +15 -0
- package/dist/bundle/chunks/chunk-KTGH7NTP.js +15 -0
- package/dist/bundle/chunks/chunk-KY5VPZXG.js +23 -0
- package/dist/bundle/chunks/{printf-4U5V2VHK.js → chunk-L4KW73FJ.js} +11 -11
- package/dist/bundle/chunks/chunk-LL3S3NLB.js +1 -0
- package/dist/bundle/chunks/chunk-LWEGUNWT.js +7 -0
- package/dist/bundle/chunks/chunk-MDLLFABN.js +4 -0
- package/dist/bundle/chunks/chunk-NCNPKYJZ.js +2 -0
- package/dist/bundle/chunks/chunk-NQOQ2Q77.js +8 -0
- package/dist/bundle/chunks/chunk-NUYSJFDK.js +7 -0
- package/dist/bundle/chunks/chunk-OCK72LWW.js +4 -0
- package/dist/bundle/chunks/chunk-OCLXQMOG.js +6 -0
- package/dist/bundle/chunks/{rmdir-DU6C7ZEO.js → chunk-OCS6LSEM.js} +3 -3
- package/dist/bundle/chunks/chunk-OFJTSXN6.js +8 -0
- package/dist/bundle/chunks/chunk-OGDTSM2Q.js +8 -0
- package/dist/bundle/chunks/chunk-PP6PSHAB.js +4 -0
- package/dist/bundle/chunks/chunk-PYSFUGCK.js +10 -0
- package/dist/bundle/chunks/chunk-QCDB2VPH.js +6 -0
- package/dist/bundle/chunks/{rg-JNKRPEYR.js → chunk-QOENL5UZ.js} +9 -9
- package/dist/bundle/chunks/chunk-R6QSAL5T.js +1 -0
- package/dist/bundle/chunks/{chunk-WQCJYUEW.js → chunk-RSXSWZBQ.js} +2 -2
- package/dist/bundle/chunks/chunk-S6BBC45K.js +8 -0
- package/dist/bundle/chunks/chunk-SL4FN3A5.js +9 -0
- package/dist/bundle/chunks/chunk-SXR3EI72.js +4 -0
- package/dist/bundle/chunks/chunk-TLSUDHID.js +6 -0
- package/dist/bundle/chunks/chunk-U7QI5ZS5.js +4 -0
- package/dist/bundle/chunks/{xan-EN6JZQ3T.js → chunk-UAHZJD43.js} +17 -17
- package/dist/bundle/chunks/chunk-UYGR3CFC.js +2 -0
- package/dist/bundle/chunks/chunk-VJFXDYWH.js +10 -0
- package/dist/bundle/chunks/chunk-VOBGTVA6.js +6 -0
- package/dist/bundle/chunks/{sed-4K5HXNXE.js → chunk-VTHR2H5Q.js} +36 -36
- package/dist/bundle/chunks/chunk-VYOJP4TV.js +13 -0
- package/dist/bundle/chunks/{tar-5V4PGBFL.js → chunk-VZWXH2PZ.js} +6 -6
- package/dist/bundle/chunks/chunk-WEIVGBP5.js +20 -0
- package/dist/bundle/chunks/chunk-WMLBQOWO.js +9 -0
- package/dist/bundle/chunks/{tr-UJSEBPIQ.js → chunk-X6JMGGW2.js} +5 -5
- package/dist/bundle/chunks/chunk-XKQRETAK.js +1 -0
- package/dist/bundle/chunks/chunk-XNL7YAHW.js +11 -0
- package/dist/bundle/chunks/chunk-XVDPCNWR.js +11 -0
- package/dist/bundle/chunks/chunk-XZ3MZS57.js +6 -0
- package/dist/bundle/chunks/chunk-YYB54I7F.js +10 -0
- package/dist/bundle/chunks/chunk-Z7JVV2SM.js +12 -0
- package/dist/bundle/chunks/chunk-ZKLK6C7H.js +15 -0
- package/dist/bundle/chunks/clear-5CZ5X4YR.js +1 -0
- package/dist/bundle/chunks/column-WLPMMSTS.js +1 -0
- package/dist/bundle/chunks/comm-5SLSESQG.js +1 -0
- package/dist/bundle/chunks/cp-XOYR4ABJ.js +1 -0
- package/dist/bundle/chunks/cut-LO6YYY5P.js +1 -0
- package/dist/bundle/chunks/date-FT2P5UCQ.js +1 -0
- package/dist/bundle/chunks/diff-HJF2MPDN.js +1 -0
- package/dist/bundle/chunks/dirname-LEMTZZFS.js +1 -0
- package/dist/bundle/chunks/du-DM4QX4XA.js +1 -0
- package/dist/bundle/chunks/echo-O45JWWI2.js +1 -0
- package/dist/bundle/chunks/env-S547XMN7.js +1 -0
- package/dist/bundle/chunks/expand-DTNXU4LQ.js +1 -0
- package/dist/bundle/chunks/{expansion-OFFC2R4K.js → expansion-R2VVQUSY.js} +1 -1
- package/dist/bundle/chunks/expr-3572LAOT.js +1 -0
- package/dist/bundle/chunks/file-ZIGAJ4YS.js +1 -0
- package/dist/bundle/chunks/find-74OP3M7S.js +1 -0
- package/dist/bundle/chunks/flag-coverage-KDDXWVDJ.js +1 -0
- package/dist/bundle/chunks/fold-LDSORVYE.js +1 -0
- package/dist/bundle/chunks/grep-BPEMMINR.js +1 -0
- package/dist/bundle/chunks/gzip-UTSGNF5Z.js +1 -0
- package/dist/bundle/chunks/head-HT2B6D2J.js +1 -0
- package/dist/bundle/chunks/help-T2NGLTSG.js +1 -0
- package/dist/bundle/chunks/history-J4QRNGRO.js +1 -0
- package/dist/bundle/chunks/hostname-BK6HG2DE.js +1 -0
- package/dist/bundle/chunks/html-to-markdown-TFCECAGV.js +1 -0
- package/dist/bundle/chunks/join-GG2LDHE5.js +1 -0
- package/dist/bundle/chunks/jq-HA6MN2H5.js +1 -0
- package/dist/bundle/chunks/ln-YAIFIHCT.js +1 -0
- package/dist/bundle/chunks/ls-OTONBH2E.js +1 -0
- package/dist/bundle/chunks/md5sum-INMIK4DX.js +1 -0
- package/dist/bundle/chunks/mkdir-QWGXDWUS.js +1 -0
- package/dist/bundle/chunks/mv-Z6MORUFL.js +1 -0
- package/dist/bundle/chunks/nl-U5YJDM32.js +1 -0
- package/dist/bundle/chunks/od-VJEF2UR5.js +1 -0
- package/dist/bundle/chunks/paste-7N6AFSDS.js +1 -0
- package/dist/bundle/chunks/printf-KGN6BDCY.js +1 -0
- package/dist/bundle/chunks/pwd-D4OZ7N27.js +1 -0
- package/dist/bundle/chunks/readlink-IEQO24KU.js +1 -0
- package/dist/bundle/chunks/rev-XOSYPP45.js +1 -0
- package/dist/bundle/chunks/rg-ORQK4GVH.js +1 -0
- package/dist/bundle/chunks/rm-KPTLPKPH.js +1 -0
- package/dist/bundle/chunks/rmdir-XTQXT7RK.js +1 -0
- package/dist/bundle/chunks/sed-MUVA7R2C.js +1 -0
- package/dist/bundle/chunks/seq-RN5ZUASB.js +1 -0
- package/dist/bundle/chunks/sha1sum-VJPNLNU6.js +1 -0
- package/dist/bundle/chunks/sha256sum-PI32XWXY.js +1 -0
- package/dist/bundle/chunks/sleep-JHK4I472.js +1 -0
- package/dist/bundle/chunks/sort-T7TNLWXL.js +1 -0
- package/dist/bundle/chunks/split-EZOC5IIZ.js +1 -0
- package/dist/bundle/chunks/sqlite3-Z2IGWYCE.js +1 -0
- package/dist/bundle/chunks/stat-74KBZFAX.js +1 -0
- package/dist/bundle/chunks/strings-7PLOGTPD.js +1 -0
- package/dist/bundle/chunks/tac-T7YAU2Y6.js +1 -0
- package/dist/bundle/chunks/tail-S5ULNTJU.js +1 -0
- package/dist/bundle/chunks/tar-K7K7BL55.js +1 -0
- package/dist/bundle/chunks/tee-O7VXZDCO.js +1 -0
- package/dist/bundle/chunks/time-BPT76IHZ.js +1 -0
- package/dist/bundle/chunks/timeout-5UJUQXOE.js +1 -0
- package/dist/bundle/chunks/touch-DX2IJOQ4.js +1 -0
- package/dist/bundle/chunks/tr-RYO2EDCA.js +1 -0
- package/dist/bundle/chunks/tree-LYXBS7DC.js +1 -0
- package/dist/bundle/chunks/true-WHJNXCHG.js +1 -0
- package/dist/bundle/chunks/unexpand-RGTMIGZM.js +1 -0
- package/dist/bundle/chunks/uniq-ZXE4O5XB.js +1 -0
- package/dist/bundle/chunks/wc-TQB3VNOX.js +1 -0
- package/dist/bundle/chunks/which-NCIYTMAT.js +1 -0
- package/dist/bundle/chunks/whoami-DGKU3D2X.js +1 -0
- package/dist/bundle/chunks/xan-6DLWA2BW.js +1 -0
- package/dist/bundle/chunks/xargs-OGI2NN6J.js +1 -0
- package/dist/bundle/chunks/yq-LO2NVDTD.js +1 -0
- package/dist/bundle/index.js +157 -155
- package/dist/commands/alias/alias.d.ts +3 -0
- package/dist/commands/awk/awk2.d.ts +2 -0
- package/dist/commands/awk/interpreter/context.d.ts +5 -0
- package/dist/commands/base64/base64.d.ts +2 -0
- package/dist/commands/basename/basename.d.ts +2 -0
- package/dist/commands/bash/bash.d.ts +3 -0
- package/dist/commands/cat/cat.d.ts +2 -0
- package/dist/commands/chmod/chmod.d.ts +2 -0
- package/dist/commands/clear/clear.d.ts +2 -0
- package/dist/commands/column/column.d.ts +2 -0
- package/dist/commands/comm/comm.d.ts +2 -0
- package/dist/commands/cp/cp.d.ts +2 -0
- package/dist/commands/cut/cut.d.ts +2 -0
- package/dist/commands/date/date.d.ts +2 -0
- package/dist/commands/diff/diff.d.ts +2 -0
- package/dist/commands/dirname/dirname.d.ts +2 -0
- package/dist/commands/du/du.d.ts +2 -0
- package/dist/commands/echo/echo.d.ts +2 -0
- package/dist/commands/env/env.d.ts +3 -0
- package/dist/commands/expand/expand.d.ts +2 -0
- package/dist/commands/expand/unexpand.d.ts +2 -0
- package/dist/commands/expr/expr.d.ts +2 -0
- package/dist/commands/file/file.d.ts +2 -0
- package/dist/commands/find/find.d.ts +2 -0
- package/dist/commands/flag-coverage.d.ts +2 -0
- package/dist/commands/fold/fold.d.ts +2 -0
- package/dist/commands/fuzz-flags-types.d.ts +17 -0
- package/dist/commands/fuzz-flags.d.ts +8 -0
- package/dist/commands/grep/grep.d.ts +4 -0
- package/dist/commands/gzip/gzip.d.ts +4 -0
- package/dist/commands/head/head.d.ts +2 -0
- package/dist/commands/help/help.d.ts +2 -0
- package/dist/commands/history/history.d.ts +2 -0
- package/dist/commands/hostname/hostname.d.ts +2 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +2 -0
- package/dist/commands/join/join.d.ts +2 -0
- package/dist/commands/jq/jq.d.ts +2 -0
- package/dist/commands/ln/ln.d.ts +2 -0
- package/dist/commands/ls/ls.d.ts +2 -0
- package/dist/commands/md5sum/md5sum.d.ts +2 -0
- package/dist/commands/md5sum/sha1sum.d.ts +2 -0
- package/dist/commands/md5sum/sha256sum.d.ts +2 -0
- package/dist/commands/mkdir/mkdir.d.ts +2 -0
- package/dist/commands/mv/mv.d.ts +2 -0
- package/dist/commands/nl/nl.d.ts +2 -0
- package/dist/commands/od/od.d.ts +2 -0
- package/dist/commands/paste/paste.d.ts +2 -0
- package/dist/commands/printf/printf.d.ts +2 -0
- package/dist/commands/pwd/pwd.d.ts +2 -0
- package/dist/commands/query-engine/evaluator.d.ts +4 -0
- package/dist/commands/readlink/readlink.d.ts +2 -0
- package/dist/commands/rev/rev.d.ts +2 -0
- package/dist/commands/rg/rg.d.ts +2 -0
- package/dist/commands/rm/rm.d.ts +2 -0
- package/dist/commands/rmdir/rmdir.d.ts +2 -0
- package/dist/commands/sed/sed.d.ts +2 -0
- package/dist/commands/sed/types.d.ts +2 -0
- package/dist/commands/seq/seq.d.ts +2 -0
- package/dist/commands/sleep/sleep.d.ts +2 -0
- package/dist/commands/sort/sort.d.ts +2 -0
- package/dist/commands/split/split.d.ts +2 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +2 -0
- package/dist/commands/stat/stat.d.ts +2 -0
- package/dist/commands/strings/strings.d.ts +2 -0
- package/dist/commands/tac/tac.d.ts +2 -0
- package/dist/commands/tail/tail.d.ts +2 -0
- package/dist/commands/tar/tar.d.ts +2 -0
- package/dist/commands/tee/tee.d.ts +2 -0
- package/dist/commands/time/time.d.ts +2 -0
- package/dist/commands/timeout/timeout.d.ts +2 -0
- package/dist/commands/touch/touch.d.ts +2 -0
- package/dist/commands/tr/tr.d.ts +2 -0
- package/dist/commands/tree/tree.d.ts +2 -0
- package/dist/commands/true/true.d.ts +3 -0
- package/dist/commands/uniq/uniq.d.ts +2 -0
- package/dist/commands/wc/wc.d.ts +2 -0
- package/dist/commands/which/which.d.ts +2 -0
- package/dist/commands/whoami/whoami.d.ts +2 -0
- package/dist/commands/xan/xan.d.ts +2 -0
- package/dist/commands/xargs/xargs.d.ts +2 -0
- package/dist/commands/yq/yq.d.ts +2 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +7 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +7 -0
- package/dist/interpreter/interpreter.d.ts +3 -1
- package/dist/interpreter/types.d.ts +3 -1
- package/dist/network/types.d.ts +11 -0
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
- package/dist/bin/chunks/alias-MGDOL4KG.js +0 -7
- package/dist/bin/chunks/awk2-OKD2P6CM.js +0 -21
- package/dist/bin/chunks/base64-43KPK6TL.js +0 -6
- package/dist/bin/chunks/basename-SO5MVUEX.js +0 -6
- package/dist/bin/chunks/bash-OAUBNRSG.js +0 -6
- package/dist/bin/chunks/cat-HNXE2ES2.js +0 -6
- package/dist/bin/chunks/chmod-TYLTHXFR.js +0 -9
- package/dist/bin/chunks/clear-CI7A5IXQ.js +0 -2
- package/dist/bin/chunks/column-HQ4AK5DM.js +0 -8
- package/dist/bin/chunks/comm-CPIFQTKY.js +0 -13
- package/dist/bin/chunks/cp-VFXCUKXO.js +0 -8
- package/dist/bin/chunks/cut-IHF6BEOO.js +0 -6
- package/dist/bin/chunks/date-IQLPMFYI.js +0 -5
- package/dist/bin/chunks/diff-ZGXLP3DN.js +0 -19
- package/dist/bin/chunks/dirname-EES7TR26.js +0 -5
- package/dist/bin/chunks/du-PECPOFQT.js +0 -8
- package/dist/bin/chunks/echo-7I42V66Q.js +0 -4
- package/dist/bin/chunks/env-W6IMQ43Y.js +0 -9
- package/dist/bin/chunks/expand-77K5HH2M.js +0 -11
- package/dist/bin/chunks/expr-433HIVAI.js +0 -5
- package/dist/bin/chunks/find-KHOYETRP.js +0 -11
- package/dist/bin/chunks/fold-452R4I2C.js +0 -12
- package/dist/bin/chunks/grep-BD56656Z.js +0 -9
- package/dist/bin/chunks/gzip-5ILPB46W.js +0 -32
- package/dist/bin/chunks/head-TJHLLIMR.js +0 -2
- package/dist/bin/chunks/help-L43ENI4H.js +0 -16
- package/dist/bin/chunks/history-56DL6SXU.js +0 -3
- package/dist/bin/chunks/hostname-WXDKRL2Z.js +0 -3
- package/dist/bin/chunks/join-3IXMEGNA.js +0 -14
- package/dist/bin/chunks/jq-EIPK4SZA.js +0 -13
- package/dist/bin/chunks/ln-EFFNQ3RY.js +0 -10
- package/dist/bin/chunks/ls-5LN47VHU.js +0 -26
- package/dist/bin/chunks/md5sum-VHPDBIVV.js +0 -2
- package/dist/bin/chunks/mkdir-XMSNS6S5.js +0 -7
- package/dist/bin/chunks/mv-P4KHB27X.js +0 -7
- package/dist/bin/chunks/od-KRKGC2U3.js +0 -5
- package/dist/bin/chunks/paste-UCH462KK.js +0 -8
- package/dist/bin/chunks/printf-4W7NDLLV.js +0 -15
- package/dist/bin/chunks/pwd-L26WH2K4.js +0 -3
- package/dist/bin/chunks/readlink-VL3R4LAM.js +0 -7
- package/dist/bin/chunks/rev-VP42N2JN.js +0 -7
- package/dist/bin/chunks/rm-S7ASVG34.js +0 -8
- package/dist/bin/chunks/seq-AVK43XM2.js +0 -7
- package/dist/bin/chunks/sha1sum-4SVNPPXZ.js +0 -2
- package/dist/bin/chunks/sha256sum-BM3AFTIE.js +0 -2
- package/dist/bin/chunks/sort-QF3YLXRW.js +0 -16
- package/dist/bin/chunks/split-7UP7EATZ.js +0 -16
- package/dist/bin/chunks/stat-ZZVPXHLF.js +0 -9
- package/dist/bin/chunks/strings-ZEKN6D4Q.js +0 -14
- package/dist/bin/chunks/tac-KNRFDAY7.js +0 -9
- package/dist/bin/chunks/tail-YAUIERGN.js +0 -2
- package/dist/bin/chunks/tee-XSKPK43X.js +0 -3
- package/dist/bin/chunks/timeout-JED4EKFH.js +0 -12
- package/dist/bin/chunks/touch-IBPHJBM3.js +0 -7
- package/dist/bin/chunks/tree-WC3AXFHC.js +0 -12
- package/dist/bin/chunks/true-OVATH2SQ.js +0 -2
- package/dist/bin/chunks/unexpand-BFVYAPOU.js +0 -11
- package/dist/bin/chunks/uniq-NNXAFO6D.js +0 -5
- package/dist/bin/chunks/wc-CZ2TD6T6.js +0 -6
- package/dist/bin/chunks/which-5QEJAXNR.js +0 -3
- package/dist/bin/chunks/whoami-JVLUNKSG.js +0 -3
- package/dist/bin/chunks/xargs-IWT2HHEA.js +0 -5
- package/dist/bin/shell/chunks/alias-MGDOL4KG.js +0 -7
- package/dist/bin/shell/chunks/awk2-OKD2P6CM.js +0 -21
- package/dist/bin/shell/chunks/base64-43KPK6TL.js +0 -6
- package/dist/bin/shell/chunks/basename-SO5MVUEX.js +0 -6
- package/dist/bin/shell/chunks/bash-OAUBNRSG.js +0 -6
- package/dist/bin/shell/chunks/cat-HNXE2ES2.js +0 -6
- package/dist/bin/shell/chunks/chmod-TYLTHXFR.js +0 -9
- package/dist/bin/shell/chunks/clear-CI7A5IXQ.js +0 -2
- package/dist/bin/shell/chunks/column-HQ4AK5DM.js +0 -8
- package/dist/bin/shell/chunks/comm-CPIFQTKY.js +0 -13
- package/dist/bin/shell/chunks/cp-VFXCUKXO.js +0 -8
- package/dist/bin/shell/chunks/cut-IHF6BEOO.js +0 -6
- package/dist/bin/shell/chunks/date-IQLPMFYI.js +0 -5
- package/dist/bin/shell/chunks/diff-ZGXLP3DN.js +0 -19
- package/dist/bin/shell/chunks/dirname-EES7TR26.js +0 -5
- package/dist/bin/shell/chunks/du-PECPOFQT.js +0 -8
- package/dist/bin/shell/chunks/echo-7I42V66Q.js +0 -4
- package/dist/bin/shell/chunks/env-W6IMQ43Y.js +0 -9
- package/dist/bin/shell/chunks/expand-77K5HH2M.js +0 -11
- package/dist/bin/shell/chunks/expr-433HIVAI.js +0 -5
- package/dist/bin/shell/chunks/find-KHOYETRP.js +0 -11
- package/dist/bin/shell/chunks/fold-452R4I2C.js +0 -12
- package/dist/bin/shell/chunks/grep-BD56656Z.js +0 -9
- package/dist/bin/shell/chunks/gzip-5ILPB46W.js +0 -32
- package/dist/bin/shell/chunks/head-TJHLLIMR.js +0 -2
- package/dist/bin/shell/chunks/help-L43ENI4H.js +0 -16
- package/dist/bin/shell/chunks/history-56DL6SXU.js +0 -3
- package/dist/bin/shell/chunks/hostname-WXDKRL2Z.js +0 -3
- package/dist/bin/shell/chunks/join-3IXMEGNA.js +0 -14
- package/dist/bin/shell/chunks/jq-EIPK4SZA.js +0 -13
- package/dist/bin/shell/chunks/ln-EFFNQ3RY.js +0 -10
- package/dist/bin/shell/chunks/ls-5LN47VHU.js +0 -26
- package/dist/bin/shell/chunks/md5sum-VHPDBIVV.js +0 -2
- package/dist/bin/shell/chunks/mkdir-XMSNS6S5.js +0 -7
- package/dist/bin/shell/chunks/mv-P4KHB27X.js +0 -7
- package/dist/bin/shell/chunks/od-KRKGC2U3.js +0 -5
- package/dist/bin/shell/chunks/paste-UCH462KK.js +0 -8
- package/dist/bin/shell/chunks/printf-4W7NDLLV.js +0 -15
- package/dist/bin/shell/chunks/pwd-L26WH2K4.js +0 -3
- package/dist/bin/shell/chunks/readlink-VL3R4LAM.js +0 -7
- package/dist/bin/shell/chunks/rev-VP42N2JN.js +0 -7
- package/dist/bin/shell/chunks/rm-S7ASVG34.js +0 -8
- package/dist/bin/shell/chunks/seq-AVK43XM2.js +0 -7
- package/dist/bin/shell/chunks/sha1sum-4SVNPPXZ.js +0 -2
- package/dist/bin/shell/chunks/sha256sum-BM3AFTIE.js +0 -2
- package/dist/bin/shell/chunks/sort-QF3YLXRW.js +0 -16
- package/dist/bin/shell/chunks/split-7UP7EATZ.js +0 -16
- package/dist/bin/shell/chunks/stat-ZZVPXHLF.js +0 -9
- package/dist/bin/shell/chunks/strings-ZEKN6D4Q.js +0 -14
- package/dist/bin/shell/chunks/tac-KNRFDAY7.js +0 -9
- package/dist/bin/shell/chunks/tail-YAUIERGN.js +0 -2
- package/dist/bin/shell/chunks/tee-XSKPK43X.js +0 -3
- package/dist/bin/shell/chunks/timeout-JED4EKFH.js +0 -12
- package/dist/bin/shell/chunks/touch-IBPHJBM3.js +0 -7
- package/dist/bin/shell/chunks/tree-WC3AXFHC.js +0 -12
- package/dist/bin/shell/chunks/true-OVATH2SQ.js +0 -2
- package/dist/bin/shell/chunks/unexpand-BFVYAPOU.js +0 -11
- package/dist/bin/shell/chunks/uniq-NNXAFO6D.js +0 -5
- package/dist/bin/shell/chunks/wc-CZ2TD6T6.js +0 -6
- package/dist/bin/shell/chunks/which-5QEJAXNR.js +0 -3
- package/dist/bin/shell/chunks/whoami-JVLUNKSG.js +0 -3
- package/dist/bin/shell/chunks/xargs-IWT2HHEA.js +0 -5
- package/dist/bundle/chunks/alias-YGOORMWI.js +0 -6
- package/dist/bundle/chunks/awk2-YNEKUV4T.js +0 -20
- package/dist/bundle/chunks/base64-2JFR3HGT.js +0 -5
- package/dist/bundle/chunks/basename-CFA5ZIGT.js +0 -5
- package/dist/bundle/chunks/bash-BYWM5OPC.js +0 -5
- package/dist/bundle/chunks/cat-GPKR7D6K.js +0 -5
- package/dist/bundle/chunks/chmod-ODWUR7E6.js +0 -8
- package/dist/bundle/chunks/clear-VT2LJIDX.js +0 -1
- package/dist/bundle/chunks/column-R6OLMEUA.js +0 -7
- package/dist/bundle/chunks/comm-AXQM7FFF.js +0 -12
- package/dist/bundle/chunks/cp-NJSENVKC.js +0 -7
- package/dist/bundle/chunks/cut-NVKWEAZF.js +0 -5
- package/dist/bundle/chunks/date-PN3CMG7K.js +0 -4
- package/dist/bundle/chunks/diff-ELUS3RW7.js +0 -6
- package/dist/bundle/chunks/dirname-YPJLCQYA.js +0 -4
- package/dist/bundle/chunks/du-T4JUAAB2.js +0 -7
- package/dist/bundle/chunks/echo-6S7WE7XB.js +0 -3
- package/dist/bundle/chunks/env-M3AXY56V.js +0 -8
- package/dist/bundle/chunks/expand-VSTNOVF5.js +0 -10
- package/dist/bundle/chunks/expr-YSFDPKPV.js +0 -4
- package/dist/bundle/chunks/find-WTVSUXL3.js +0 -10
- package/dist/bundle/chunks/fold-6CFXIPYZ.js +0 -11
- package/dist/bundle/chunks/grep-UTH3KDWL.js +0 -8
- package/dist/bundle/chunks/gzip-4P4KGYT5.js +0 -31
- package/dist/bundle/chunks/head-SA7P5NJ7.js +0 -1
- package/dist/bundle/chunks/help-UD3E73G5.js +0 -15
- package/dist/bundle/chunks/history-TMBGOQO6.js +0 -2
- package/dist/bundle/chunks/hostname-NWR32CGF.js +0 -2
- package/dist/bundle/chunks/html-to-markdown-ZK6GQVSL.js +0 -4
- package/dist/bundle/chunks/join-X3QYPZUA.js +0 -13
- package/dist/bundle/chunks/jq-6U2TPE6U.js +0 -12
- package/dist/bundle/chunks/ln-Y7YB677N.js +0 -9
- package/dist/bundle/chunks/ls-PUJHEPXS.js +0 -23
- package/dist/bundle/chunks/md5sum-TGZPGVOK.js +0 -1
- package/dist/bundle/chunks/mkdir-SF2UE4KB.js +0 -6
- package/dist/bundle/chunks/mv-JPBZPM4O.js +0 -6
- package/dist/bundle/chunks/od-3FPDPLWJ.js +0 -4
- package/dist/bundle/chunks/paste-QAP6Y75J.js +0 -7
- package/dist/bundle/chunks/pwd-S4NVAMC4.js +0 -2
- package/dist/bundle/chunks/readlink-EM4O3U4P.js +0 -6
- package/dist/bundle/chunks/rev-FKUV5GH5.js +0 -6
- package/dist/bundle/chunks/rm-MJFRIDNT.js +0 -7
- package/dist/bundle/chunks/seq-5VRIVQYP.js +0 -6
- package/dist/bundle/chunks/sha1sum-37LOTSQP.js +0 -1
- package/dist/bundle/chunks/sha256sum-I4J5BPZA.js +0 -1
- package/dist/bundle/chunks/sleep-AK4QE4WR.js +0 -9
- package/dist/bundle/chunks/sort-LT2PE47K.js +0 -15
- package/dist/bundle/chunks/split-LGSGJHV5.js +0 -15
- package/dist/bundle/chunks/stat-IOLJTP7U.js +0 -8
- package/dist/bundle/chunks/strings-LRU5XCFP.js +0 -13
- package/dist/bundle/chunks/tac-2X4JLF4W.js +0 -8
- package/dist/bundle/chunks/tail-52LRAWXT.js +0 -1
- package/dist/bundle/chunks/tee-4KHTWVWB.js +0 -2
- package/dist/bundle/chunks/timeout-X3X3N6IE.js +0 -11
- package/dist/bundle/chunks/touch-TDTEBHHI.js +0 -6
- package/dist/bundle/chunks/tree-UFVZH4SS.js +0 -11
- package/dist/bundle/chunks/true-CNJ54NE6.js +0 -1
- package/dist/bundle/chunks/unexpand-I7A2VXFD.js +0 -10
- package/dist/bundle/chunks/uniq-XBP4SJA3.js +0 -4
- package/dist/bundle/chunks/wc-VDPK3LVS.js +0 -5
- package/dist/bundle/chunks/which-GF77XMJD.js +0 -2
- package/dist/bundle/chunks/whoami-YUDAIS32.js +0 -2
- package/dist/bundle/chunks/xargs-4FRA6OJ7.js +0 -4
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`,t+=2;continue}if(s==="r"){e+="\r",t+=2;continue}e+=i[t]+s,t+=2;continue}if(i[t]==="+"||i[t]==="?"||i[t]==="|"||i[t]==="("||i[t]===")"){e+=`\\${i[t]}`,t++;continue}if(i[t]==="^"&&!(e===""||e.endsWith("("))){e+="\\^",t++;continue}if(i[t]==="$"){let s=t===i.length-1,r=t+2<i.length&&i[t+1]==="\\"&&i[t+2]===")";if(!s&&!r){e+="\\$",t++;continue}}e+=i[t],t++}return e}function
|
|
1
|
+
import{a as N}from"./chunk-YNYSPYQ5.js";import{k as x}from"./chunk-PSW6BMXW.js";import{a as G,b as j,c as T}from"./chunk-74CEPOFO.js";var B=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 P(i){let e="",t=0,n=!1;for(;t<i.length;){if(i[t]==="["&&!n){if(i[t+1]==="["&&i[t+2]===":"){let s=i.indexOf(":]]",t+3);if(s!==-1){let r=i.slice(t+3,s),a=B.get(r);if(a){e+=`[${a}]`,t=s+3;continue}}}if(i[t+1]==="^"&&i[t+2]==="["&&i[t+3]===":"){let s=i.indexOf(":]]",t+4);if(s!==-1){let r=i.slice(t+4,s),a=B.get(r);if(a){e+=`[^${a}]`,t=s+3;continue}}}e+="[",t++,n=!0,t<i.length&&i[t]==="^"&&(e+="^",t++),t<i.length&&i[t]==="]"&&(e+="\\]",t++);continue}if(n){if(i[t]==="]"){e+="]",t++,n=!1;continue}if(i[t]==="["&&i[t+1]===":"){let s=i.indexOf(":]",t+2);if(s!==-1){let r=i.slice(t+2,s),a=B.get(r);if(a){e+=a,t=s+2;continue}}}if(i[t]==="\\"&&t+1<i.length){e+=i[t]+i[t+1],t+=2;continue}e+=i[t],t++;continue}if(i[t]==="\\"&&t+1<i.length){let s=i[t+1];if(s==="+"||s==="?"||s==="|"){e+=s,t+=2;continue}if(s==="("||s===")"){e+=s,t+=2;continue}if(s==="{"||s==="}"){e+=s,t+=2;continue}if(s==="t"){e+=" ",t+=2;continue}if(s==="n"){e+=`
|
|
2
|
+
`,t+=2;continue}if(s==="r"){e+="\r",t+=2;continue}e+=i[t]+s,t+=2;continue}if(i[t]==="+"||i[t]==="?"||i[t]==="|"||i[t]==="("||i[t]===")"){e+=`\\${i[t]}`,t++;continue}if(i[t]==="^"&&!(e===""||e.endsWith("("))){e+="\\^",t++;continue}if(i[t]==="$"){let s=t===i.length-1,r=t+2<i.length&&i[t+1]==="\\"&&i[t+2]===")";if(!s&&!r){e+="\\$",t++;continue}}e+=i[t],t++}return e}function D(i){let e="",t=!1;for(let n=0;n<i.length;n++)i[n]==="["&&!t?(t=!0,e+="[",n++,n<i.length&&i[n]==="^"&&(e+="^",n++),n<i.length&&i[n]==="]"&&(e+="]",n++),n--):i[n]==="]"&&t?(t=!1,e+="]"):!t&&i[n]==="{"&&i[n+1]===","?(e+="{0,",n++):e+=i[n];return e}function Z(i){let e="";for(let t=0;t<i.length;t++){let n=i[t],s=n.charCodeAt(0);n==="\\"?e+="\\\\":n===" "?e+="\\t":n===`
|
|
3
3
|
`?e+=`$
|
|
4
|
-
`:n==="\r"?e+="\\r":n==="\x07"?e+="\\a":n==="\b"?e+="\\b":n==="\f"?e+="\\f":n==="\v"?e+="\\v":s<32||s>=127?e+=`\\${s.toString(8).padStart(3,"0")}`:e+=n}return`${e}$`}var
|
|
5
|
-
`,s+=2;continue}if(r==="t"){n+=" ",s+=2;continue}if(r==="r"){n+="\r",s+=2;continue}let a=parseInt(r,10);if(a===0){n+=e,s+=2;continue}if(a>=1&&a<=9){n+=t[a-1]||"",s+=2;continue}n+=r,s+=2;continue}if(i[s]==="&"){n+=e,s++;continue}n+=i[s],s++}return n}function
|
|
4
|
+
`:n==="\r"?e+="\\r":n==="\x07"?e+="\\a":n==="\b"?e+="\\b":n==="\f"?e+="\\f":n==="\v"?e+="\\v":s<32||s>=127?e+=`\\${s.toString(8).padStart(3,"0")}`:e+=n}return`${e}$`}var ae=1e4;function K(i,e,t){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:i,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:e,pendingFileReads:[],pendingFileWrites:[],pendingExecute:void 0,rangeStates:t||new Map,linesConsumedInCycle:0}}function ce(i){return typeof i=="object"&&"first"in i&&"step"in i}function le(i){return typeof i=="object"&&"offset"in i}function O(i,e,t,n,s){if(i==="$")return e===t;if(typeof i=="number")return e===i;if(ce(i)){let{first:r,step:a}=i;return a===0?e===r:(e-r)%a===0&&e>=r}if(typeof i=="object"&&"pattern"in i)try{let r=i.pattern;r===""&&s?.lastPattern?r=s.lastPattern:r!==""&&s&&(s.lastPattern=r);let a=D(P(r));return N(a).test(n)}catch{return!1}return!1}function W(i){let e=t=>t===void 0?"undefined":t==="$"?"$":typeof t=="number"?String(t):"pattern"in t?`/${t.pattern}/`:"first"in t?`${t.first}~${t.step}`:"unknown";return`${e(i.start)},${e(i.end)}`}function oe(i,e,t,n,s,r){if(!i||!i.start&&!i.end)return!0;let a=i.start,c=i.end;if(a!==void 0&&c===void 0)return O(a,e,t,n,r);if(a!==void 0&&c!==void 0){let o=typeof a=="object"&&"pattern"in a,f=typeof c=="object"&&"pattern"in c,p=le(c);if(p&&s){let m=W(i),d=s.get(m);if(d||(d={active:!1},s.set(m,d)),d.active){let u=d.startLine||e;return e>=u+c.offset&&(d.active=!1,s.set(m,d)),!0}else return O(a,e,t,n,r)?(d.active=!0,d.startLine=e,s.set(m,d),c.offset===0&&(d.active=!1,s.set(m,d)),!0):!1}if(!o&&!f&&!p){let m=typeof a=="number"?a:a==="$"?t:1,d=typeof c=="number"?c:t;if(m<=d)return e>=m&&e<=d;if(s){let u=W(i),h=s.get(u);return h||(h={active:!1},s.set(u,h)),!h.completed&&e>=m?(h.completed=!0,s.set(u,h),!0):!1}return!1}if(s){let m=W(i),d=s.get(m);if(d||(d={active:!1},s.set(m,d)),d.active)return O(c,e,t,n,r)&&(d.active=!1,typeof a=="number"&&(d.completed=!0),s.set(m,d)),!0;{if(d.completed)return!1;let u=!1;return typeof a=="number"?u=e>=a:u=O(a,e,t,n,r),u?(d.active=!0,d.startLine=e,s.set(m,d),O(c,e,t,n,r)&&(d.active=!1,typeof a=="number"&&(d.completed=!0),s.set(m,d)),!0):!1}}return O(a,e,t,n,r)}return!0}function I(i,e,t,n,s,r){let a=oe(i,e,t,n,s,r);return i?.negated?!a:a}function ue(i,e,t,n){let s="",r=0,a=!1;for(;r<=i.length;){e.lastIndex=r;let c=e.exec(i);if(!c){s+=i.slice(r);break}if(c.index!==r){s+=i.slice(r,c.index),r=c.index,a=!1;continue}let o=c[0],f=c.slice(1);if(a&&o.length===0){if(r<i.length)s+=i[r],r++;else break;a=!1;continue}if(s+=n(o,f),a=!1,o.length===0)if(r<i.length)s+=i[r],r++;else break;else r+=o.length,a=!0}return s}function q(i,e,t){let n="",s=0;for(;s<i.length;){if(i[s]==="\\"&&s+1<i.length){let r=i[s+1];if(r==="&"){n+="&",s+=2;continue}if(r==="n"){n+=`
|
|
5
|
+
`,s+=2;continue}if(r==="t"){n+=" ",s+=2;continue}if(r==="r"){n+="\r",s+=2;continue}let a=parseInt(r,10);if(a===0){n+=e,s+=2;continue}if(a>=1&&a<=9){n+=t[a-1]||"",s+=2;continue}n+=r,s+=2;continue}if(i[s]==="&"){n+=e,s++;continue}n+=i[s],s++}return n}function he(i,e){let{lineNumber:t,totalLines:n,patternSpace:s}=e;if(i.type!=="label"&&I(i.address,t,n,s,e.rangeStates,e))switch(e.coverage?.hit(`sed:cmd:${i.type}`),i.type){case"substitute":{let r=i,a="";r.global&&(a+="g"),r.ignoreCase&&(a+="i");let c=r.pattern;c===""&&e.lastPattern?c=e.lastPattern:c!==""&&(e.lastPattern=c);let o=D(r.extendedRegex?c:P(c));try{let f=N(o,a),p=f.test(e.patternSpace);if(f.lastIndex=0,p){if(e.substitutionMade=!0,r.nthOccurrence&&r.nthOccurrence>0&&!r.global){let E=0,m=r.nthOccurrence,d=N(o,`g${r.ignoreCase?"i":""}`);e.patternSpace=d.replace(e.patternSpace,(u,...h)=>{if(E++,E===m){let b=h.slice(0,-2);return q(r.replacement,u,b)}return u})}else if(r.global){let E=N(o,`g${r.ignoreCase?"i":""}`);e.patternSpace=ue(e.patternSpace,E,r.replacement,(m,d)=>q(r.replacement,m,d))}else e.patternSpace=f.replace(e.patternSpace,(E,...m)=>{let d=m.slice(0,-2);return q(r.replacement,E,d)});r.printOnMatch&&e.lineNumberOutput.push(e.patternSpace)}}catch{}break}case"print":e.lineNumberOutput.push(e.patternSpace);break;case"printFirstLine":{let r=e.patternSpace.indexOf(`
|
|
6
6
|
`);r!==-1?e.lineNumberOutput.push(e.patternSpace.slice(0,r)):e.lineNumberOutput.push(e.patternSpace);break}case"delete":e.deleted=!0;break;case"deleteFirstLine":{let r=e.patternSpace.indexOf(`
|
|
7
7
|
`);r!==-1?(e.patternSpace=e.patternSpace.slice(r+1),e.restartCycle=!0,e.inDRestartedCycle=!0):e.deleted=!0;break}case"zap":e.patternSpace="";break;case"append":e.appendBuffer.push(i.text);break;case"insert":e.appendBuffer.unshift(`__INSERT__${i.text}`);break;case"change":e.deleted=!0,e.changedText=i.text;break;case"hold":e.holdSpace=e.patternSpace;break;case"holdAppend":e.holdSpace?e.holdSpace+=`
|
|
8
8
|
${e.patternSpace}`:e.holdSpace=e.patternSpace;break;case"get":e.patternSpace=e.holdSpace;break;case"getAppend":e.patternSpace+=`
|
|
9
|
-
${e.holdSpace}`;break;case"exchange":{let r=e.patternSpace;e.patternSpace=e.holdSpace,e.holdSpace=r;break}case"next":e.printed=!0;break;case"quit":e.quit=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"quitSilent":e.quit=!0,e.quitSilent=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"list":{let r=
|
|
9
|
+
${e.holdSpace}`;break;case"exchange":{let r=e.patternSpace;e.patternSpace=e.holdSpace,e.holdSpace=r;break}case"next":e.printed=!0;break;case"quit":e.quit=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"quitSilent":e.quit=!0,e.quitSilent=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"list":{let r=Z(e.patternSpace);e.lineNumberOutput.push(r);break}case"printFilename":e.currentFilename&&e.lineNumberOutput.push(e.currentFilename);break;case"version":{let r=[4,8,0];if(i.minVersion){let a=i.minVersion.split("."),c=[],o=!1;for(let f of a){let p=parseInt(f,10);if(Number.isNaN(p)||p<0){e.quit=!0,e.exitCode=1,e.errorMessage=`sed: invalid version string: ${i.minVersion}`,o=!0;break}c.push(p)}if(!o){for(;c.length<3;)c.push(0);for(let f=0;f<3;f++){if(c[f]>r[f]){e.quit=!0,e.exitCode=1,e.errorMessage=`sed: this is not GNU sed version ${i.minVersion}`;break}if(c[f]<r[f])break}}}break}case"readFile":e.pendingFileReads.push({filename:i.filename,wholeFile:!0});break;case"readFileLine":e.pendingFileReads.push({filename:i.filename,wholeFile:!1});break;case"writeFile":e.pendingFileWrites.push({filename:i.filename,content:`${e.patternSpace}
|
|
10
10
|
`});break;case"writeFirstLine":{let r=e.patternSpace.indexOf(`
|
|
11
11
|
`),a=r!==-1?e.patternSpace.slice(0,r):e.patternSpace;e.pendingFileWrites.push({filename:i.filename,content:`${a}
|
|
12
|
-
`});break}case"execute":i.command?e.pendingExecute={command:i.command,replacePattern:!1}:e.pendingExecute={command:e.patternSpace,replacePattern:!0};break;case"transliterate":e.patternSpace=
|
|
13
|
-
${
|
|
12
|
+
`});break}case"execute":i.command?e.pendingExecute={command:i.command,replacePattern:!1}:e.pendingExecute={command:e.patternSpace,replacePattern:!0};break;case"transliterate":e.patternSpace=fe(e.patternSpace,i);break;case"lineNumber":e.lineNumberOutput.push(String(e.lineNumber));break;case"branch":break;case"branchOnSubst":break;case"branchOnNoSubst":break;case"group":break}}function fe(i,e){let t="";for(let n of i){let s=e.source.indexOf(n);s!==-1?t+=e.dest[s]:t+=n}return t}function U(i,e,t,n){let s=new Map;for(let o=0;o<i.length;o++){let f=i[o];f.type==="label"&&s.set(f.name,o)}let r=n?.maxIterations??ae,a=0,c=0;for(;c<i.length;){if(a++,a>r)throw new x(`sed: command execution exceeded maximum iterations (${r})`,"iterations");if(e.deleted||e.quit||e.quitSilent||e.restartCycle)break;let o=i[c];if(o.type==="next"){if(I(o.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e))if(e.nCommandOutput.push(e.patternSpace),t&&t.currentLineIndex+e.linesConsumedInCycle+1<t.lines.length){e.linesConsumedInCycle++;let f=t.lines[t.currentLineIndex+e.linesConsumedInCycle];e.patternSpace=f,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1,e.substitutionMade=!1}else{e.quit=!0,e.deleted=!0;break}c++;continue}if(o.type==="nextAppend"){if(I(o.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e))if(t&&t.currentLineIndex+e.linesConsumedInCycle+1<t.lines.length){e.linesConsumedInCycle++;let f=t.lines[t.currentLineIndex+e.linesConsumedInCycle];e.patternSpace+=`
|
|
13
|
+
${f}`,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1}else{e.quit=!0;break}c++;continue}if(o.type==="branch"){let f=o;if(I(f.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)){if(f.label){let p=s.get(f.label);if(p!==void 0){c=p;continue}e.branchRequest=f.label;break}break}c++;continue}if(o.type==="branchOnSubst"){let f=o;if(I(f.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&e.substitutionMade){if(e.substitutionMade=!1,f.label){let p=s.get(f.label);if(p!==void 0){c=p;continue}e.branchRequest=f.label;break}break}c++;continue}if(o.type==="branchOnNoSubst"){let f=o;if(I(f.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&!e.substitutionMade){if(f.label){let p=s.get(f.label);if(p!==void 0){c=p;continue}e.branchRequest=f.label;break}break}c++;continue}if(o.type==="group"){let f=o;if(I(f.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&(U(f.commands,e,t,n),e.branchRequest)){let p=s.get(e.branchRequest);if(p!==void 0){e.branchRequest=void 0,c=p;continue}break}c++;continue}he(o,e),c++}return e.linesConsumedInCycle}var l;(function(i){i.NUMBER="NUMBER",i.DOLLAR="DOLLAR",i.PATTERN="PATTERN",i.STEP="STEP",i.RELATIVE_OFFSET="RELATIVE_OFFSET",i.LBRACE="LBRACE",i.RBRACE="RBRACE",i.SEMICOLON="SEMICOLON",i.NEWLINE="NEWLINE",i.COMMA="COMMA",i.NEGATION="NEGATION",i.COMMAND="COMMAND",i.SUBSTITUTE="SUBSTITUTE",i.TRANSLITERATE="TRANSLITERATE",i.LABEL_DEF="LABEL_DEF",i.BRANCH="BRANCH",i.BRANCH_ON_SUBST="BRANCH_ON_SUBST",i.BRANCH_ON_NO_SUBST="BRANCH_ON_NO_SUBST",i.TEXT_CMD="TEXT_CMD",i.FILE_READ="FILE_READ",i.FILE_READ_LINE="FILE_READ_LINE",i.FILE_WRITE="FILE_WRITE",i.FILE_WRITE_LINE="FILE_WRITE_LINE",i.EXECUTE="EXECUTE",i.VERSION="VERSION",i.EOF="EOF",i.ERROR="ERROR"})(l||(l={}));var A=class{input;pos=0;line=1;column=1;constructor(e){this.input=e}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.nextToken();t&&e.push(t)}return e.push(this.makeToken(l.EOF,"")),e}makeToken(e,t,n){return{type:e,value:t,line:this.line,column:this.column,...n}}peek(e=0){return this.input[this.pos+e]||""}advance(){let e=this.input[this.pos++]||"";return e===`
|
|
14
14
|
`?(this.line++,this.column=1):this.column++,e}readEscapedString(e){let t="";for(;this.pos<this.input.length&&this.peek()!==e;)if(this.peek()==="\\"){this.advance();let n=this.advance();n==="n"?t+=`
|
|
15
15
|
`:n==="t"?t+=" ":t+=n}else{if(this.peek()===`
|
|
16
16
|
`)return null;t+=this.advance()}return t}skipWhitespace(){for(;this.pos<this.input.length;){let e=this.peek();if(e===" "||e===" "||e==="\r")this.advance();else if(e==="#")for(;this.pos<this.input.length&&this.peek()!==`
|
|
@@ -38,9 +38,9 @@ ${u}`,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1}else{e.quit=!0;br
|
|
|
38
38
|
`||a===";"||a==="}"||a==="{")break;r+=this.advance()}return{type:e,value:t,label:r||void 0,line:n,column:s}}readVersion(e,t){for(;this.peek()===" "||this.peek()===" ";)this.advance();let n="";for(;this.pos<this.input.length;){let s=this.peek();if(s===" "||s===" "||s===`
|
|
39
39
|
`||s===";"||s==="}"||s==="{")break;n+=this.advance()}return{type:l.VERSION,value:"v",label:n||void 0,line:e,column:t}}readFileCommand(e,t,n,s){for(;this.peek()===" "||this.peek()===" ";)this.advance();let r="";for(;this.pos<this.input.length;){let a=this.peek();if(a===`
|
|
40
40
|
`||a===";")break;r+=this.advance()}return{type:e,value:t,filename:r.trim(),line:n,column:s}}readExecute(e,t){for(;this.peek()===" "||this.peek()===" ";)this.advance();let n="";for(;this.pos<this.input.length;){let s=this.peek();if(s===`
|
|
41
|
-
`||s===";")break;n+=this.advance()}return{type:l.EXECUTE,value:"e",command:n.trim()||void 0,line:e,column:t}}isDigit(e){return e>="0"&&e<="9"}};var
|
|
42
|
-
${
|
|
43
|
-
`),c=new
|
|
41
|
+
`||s===";")break;n+=this.advance()}return{type:l.EXECUTE,value:"e",command:n.trim()||void 0,line:e,column:t}}isDigit(e){return e>="0"&&e<="9"}};var H=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(e,t=!1){this.scripts=e,this.extendedRegex=t}parse(){let e=[];for(let t of this.scripts){let n=new A(t);for(this.tokens=n.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(l.NEWLINE)||this.check(l.SEMICOLON)){this.advance();continue}let s=this.parseCommand();if(s.error)return{commands:[],error:s.error};s.command&&e.push(s.command)}}return{commands:e}}parseCommand(){let e=this.parseAddressRange();if(e?.error)return{command:null,error:e.error};let t=e?.address;for(this.check(l.NEGATION)&&(this.advance(),t&&(t.negated=!0));this.check(l.NEWLINE)||this.check(l.SEMICOLON);)this.advance();if(this.isAtEnd())return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null};let n=this.peek();switch(n.type){case l.COMMAND:return this.parseSimpleCommand(n,t);case l.SUBSTITUTE:return this.parseSubstituteFromToken(n,t);case l.TRANSLITERATE:return this.parseTransliterateFromToken(n,t);case l.LABEL_DEF:return this.advance(),{command:{type:"label",name:n.label||""}};case l.BRANCH:return this.advance(),{command:{type:"branch",address:t,label:n.label}};case l.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:t,label:n.label}};case l.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:t,label:n.label}};case l.TEXT_CMD:return this.advance(),this.parseTextCommand(n,t);case l.FILE_READ:return this.advance(),{command:{type:"readFile",address:t,filename:n.filename||""}};case l.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:t,filename:n.filename||""}};case l.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:t,filename:n.filename||""}};case l.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:t,filename:n.filename||""}};case l.EXECUTE:return this.advance(),{command:{type:"execute",address:t,command:n.command}};case l.VERSION:return this.advance(),{command:{type:"version",address:t,minVersion:n.label}};case l.LBRACE:return this.parseGroup(t);case l.RBRACE:return{command:null};case l.ERROR:return{command:null,error:`invalid command: ${n.value}`};default:return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null}}}parseSimpleCommand(e,t){this.advance();let n=e.value;switch(n){case"p":return{command:{type:"print",address:t}};case"P":return{command:{type:"printFirstLine",address:t}};case"d":return{command:{type:"delete",address:t}};case"D":return{command:{type:"deleteFirstLine",address:t}};case"h":return{command:{type:"hold",address:t}};case"H":return{command:{type:"holdAppend",address:t}};case"g":return{command:{type:"get",address:t}};case"G":return{command:{type:"getAppend",address:t}};case"x":return{command:{type:"exchange",address:t}};case"n":return{command:{type:"next",address:t}};case"N":return{command:{type:"nextAppend",address:t}};case"q":return{command:{type:"quit",address:t}};case"Q":return{command:{type:"quitSilent",address:t}};case"z":return{command:{type:"zap",address:t}};case"=":return{command:{type:"lineNumber",address:t}};case"l":return{command:{type:"list",address:t}};case"F":return{command:{type:"printFilename",address:t}};default:return{command:null,error:`unknown command: ${n}`}}}parseSubstituteFromToken(e,t){this.advance();let n=e.flags||"",s,r=n.match(/(\d+)/);return r&&(s=parseInt(r[1],10)),{command:{type:"substitute",address:t,pattern:e.pattern||"",replacement:e.replacement||"",global:n.includes("g"),ignoreCase:n.includes("i")||n.includes("I"),printOnMatch:n.includes("p"),nthOccurrence:s,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(e,t){this.advance();let n=e.source||"",s=e.dest||"";return n.length!==s.length?{command:null,error:"transliteration sets must have same length"}:{command:{type:"transliterate",address:t,source:n,dest:s}}}parseTextCommand(e,t){let n=e.value,s=e.text||"";switch(n){case"a":return{command:{type:"append",address:t,text:s}};case"i":return{command:{type:"insert",address:t,text:s}};case"c":return{command:{type:"change",address:t,text:s}};default:return{command:null,error:`unknown text command: ${n}`}}}parseGroup(e){this.advance();let t=[];for(;!this.isAtEnd()&&!this.check(l.RBRACE);){if(this.check(l.NEWLINE)||this.check(l.SEMICOLON)){this.advance();continue}let n=this.parseCommand();if(n.error)return{command:null,error:n.error};n.command&&t.push(n.command)}return this.check(l.RBRACE)?(this.advance(),{command:{type:"group",address:e,commands:t}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){let e=this.parseAddress();if(e===void 0)return;let t;if(this.check(l.RELATIVE_OFFSET))t={offset:this.advance().offset||0};else if(this.check(l.COMMA)&&(this.advance(),t=this.parseAddress(),t===void 0))return{error:"expected context address"};return{address:{start:e,end:t}}}parseAddress(){let e=this.peek();switch(e.type){case l.NUMBER:return this.advance(),e.value;case l.DOLLAR:return this.advance(),"$";case l.PATTERN:return this.advance(),{pattern:e.pattern||e.value};case l.STEP:return this.advance(),{first:e.first||0,step:e.step||0};case l.RELATIVE_OFFSET:return this.advance(),{offset:e.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:l.EOF,value:"",line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(e){return this.peek().type===e}isAtEnd(){return this.peek().type===l.EOF}};function Q(i,e=!1){let t=!1,n=!1,s=[];for(let o=0;o<i.length;o++){let f=i[o];if(s.length===0&&o===0){let p=f.match(/^#([nr]+)\s*(?:\n|$)/i);if(p){let E=p[1].toLowerCase();E.includes("n")&&(t=!0),E.includes("r")&&(n=!0),f=f.slice(p[0].length)}}if(s.length>0&&s[s.length-1].endsWith("\\")){let p=s[s.length-1];s[s.length-1]=`${p}
|
|
42
|
+
${f}`}else s.push(f)}let r=s.join(`
|
|
43
|
+
`),c=new H([r],e||n).parse();if(!c.error&&c.commands.length>0){let o=de(c.commands);if(o)return{commands:[],error:o,silentMode:t,extendedRegexMode:n}}return{...c,silentMode:t,extendedRegexMode:n}}function de(i){let e=new Set;J(i,e);let t=Y(i,e);if(t)return`undefined label '${t}'`}function J(i,e){for(let t of i)t.type==="label"?e.add(t.name):t.type==="group"&&J(t.commands,e)}function Y(i,e){for(let t of i){if((t.type==="branch"||t.type==="branchOnSubst"||t.type==="branchOnNoSubst")&&t.label&&!e.has(t.label))return t.label;if(t.type==="group"){let n=Y(t.commands,e);if(n)return n}}}var pe={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:
|
|
44
44
|
s/regexp/replacement/[flags] substitute
|
|
45
45
|
d delete pattern space
|
|
46
46
|
p print pattern space
|
|
@@ -69,31 +69,31 @@ Addresses:
|
|
|
69
69
|
$ last line
|
|
70
70
|
/regexp/ lines matching regexp
|
|
71
71
|
N,M range from line N to M
|
|
72
|
-
first~step every step-th line starting at first`};async function
|
|
73
|
-
`),
|
|
74
|
-
`);
|
|
75
|
-
`))
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
`)&&(
|
|
84
|
-
`)){let
|
|
72
|
+
first~step every step-th line starting at first`};async function z(i,e,t,n={}){let{limits:s,filename:r,fs:a,cwd:c,coverage:o}=n,f=i.endsWith(`
|
|
73
|
+
`),p=i.split(`
|
|
74
|
+
`);p.length>0&&p[p.length-1]===""&&p.pop();let E=p.length,m="",d,u=!1,h=s?.maxStringLength??0,b=k=>{if(m+=k,h>0&&m.length>h)throw new x(`sed: output size limit exceeded (${h} bytes)`,"string_length")},C="",y,ee=new Map,F=new Map,$=new Map,_=new Map,te=s?{maxIterations:s.maxSedIterations}:void 0;for(let k=0;k<p.length;k++){let g={...K(E,r,ee),patternSpace:p[k],holdSpace:C,lastPattern:y,lineNumber:k+1,totalLines:E,substitutionMade:!1,coverage:o},ne={lines:p,currentLineIndex:k},V=0,ie=1e4;g.linesConsumedInCycle=0;do{if(V++,V>ie)break;if(g.restartCycle=!1,g.pendingFileReads=[],g.pendingFileWrites=[],U(e,g,ne,te),a&&c){for(let v of g.pendingFileReads){let R=a.resolvePath(c,v.filename);try{if(v.wholeFile){let S=await a.readFile(R);g.appendBuffer.push(S.replace(/\n$/,""))}else{if(!F.has(R)){let re=await a.readFile(R);F.set(R,re.split(`
|
|
75
|
+
`)),$.set(R,0)}let S=F.get(R),w=$.get(R);S&&w!==void 0&&w<S.length&&(g.appendBuffer.push(S[w]),$.set(R,w+1))}}catch{}}for(let v of g.pendingFileWrites){let R=a.resolvePath(c,v.filename),S=_.get(R)||"";_.set(R,S+v.content)}}}while(g.restartCycle&&!g.deleted&&!g.quit&&!g.quitSilent);if(k+=g.linesConsumedInCycle,C=g.holdSpace,y=g.lastPattern,!t)for(let v of g.nCommandOutput)b(`${v}
|
|
76
|
+
`);let se=g.lineNumberOutput.length>0;for(let v of g.lineNumberOutput)b(`${v}
|
|
77
|
+
`);let X=[],M=[];for(let v of g.appendBuffer)v.startsWith("__INSERT__")?X.push(v.slice(10)):M.push(v);for(let v of X)b(`${v}
|
|
78
|
+
`);let L=!1;!g.deleted&&!g.quitSilent?t?g.printed&&(b(`${g.patternSpace}
|
|
79
|
+
`),L=!0):(b(`${g.patternSpace}
|
|
80
|
+
`),L=!0):g.changedText!==void 0&&(b(`${g.changedText}
|
|
81
|
+
`),L=!0);for(let v of M)b(`${v}
|
|
82
|
+
`);if(u=(se||L)&&M.length===0,g.quit||g.quitSilent){if(g.exitCode!==void 0&&(d=g.exitCode),g.errorMessage)return{output:"",exitCode:d||1,errorMessage:g.errorMessage};break}}if(a&&c)for(let[k,g]of _)try{await a.writeFile(k,g)}catch{}return!f&&u&&m.endsWith(`
|
|
83
|
+
`)&&(m=m.slice(0,-1)),{output:m,exitCode:d}}var Ne={name:"sed",async execute(i,e){if(j(i))return G(pe);let t=[],n=[],s=!1,r=!1,a=!1,c=[];for(let u=0;u<i.length;u++){let h=i[u];if(h==="-n"||h==="--quiet"||h==="--silent")s=!0;else if(h==="-i"||h==="--in-place")r=!0;else if(h.startsWith("-i"))r=!0;else if(h==="-E"||h==="-r"||h==="--regexp-extended")a=!0;else if(h==="-e")u+1<i.length&&t.push(i[++u]);else if(h==="-f")u+1<i.length&&n.push(i[++u]);else{if(h.startsWith("--"))return T("sed",h);if(h==="-")c.push(h);else if(h.startsWith("-")&&h.length>1){for(let b of h.slice(1))if(b!=="n"&&b!=="e"&&b!=="f"&&b!=="i"&&b!=="E"&&b!=="r")return T("sed",`-${b}`);h.includes("n")&&(s=!0),h.includes("i")&&(r=!0),(h.includes("E")||h.includes("r"))&&(a=!0),h.includes("e")&&!h.includes("n")&&!h.includes("i")&&u+1<i.length&&t.push(i[++u]),h.includes("f")&&!h.includes("e")&&u+1<i.length&&n.push(i[++u])}else!h.startsWith("-")&&t.length===0&&n.length===0?t.push(h):h.startsWith("-")||c.push(h)}}for(let u of n){let h=e.fs.resolvePath(e.cwd,u);try{let b=await e.fs.readFile(h);for(let C of b.split(`
|
|
84
|
+
`)){let y=C.trim();y&&!y.startsWith("#")&&t.push(y)}}catch{return{stdout:"",stderr:`sed: couldn't open file ${u}: No such file or directory
|
|
85
85
|
`,exitCode:1}}}if(t.length===0)return{stdout:"",stderr:`sed: no script specified
|
|
86
|
-
`,exitCode:1};let{commands:o,error:
|
|
87
|
-
`,exitCode:1};let
|
|
88
|
-
`,exitCode:1};for(let
|
|
89
|
-
`,exitCode:C.exitCode??1};await e.fs.writeFile(
|
|
90
|
-
`,exitCode:
|
|
91
|
-
`,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let m="";if(c.length===0){m=e.stdin;try{let
|
|
92
|
-
`:"",exitCode:
|
|
93
|
-
`,exitCode:
|
|
94
|
-
`,exitCode:
|
|
95
|
-
`,exitCode:1}}}m.length>0&&
|
|
86
|
+
`,exitCode:1};let{commands:o,error:f,silentMode:p}=Q(t,a);if(f)return{stdout:"",stderr:`sed: ${f}
|
|
87
|
+
`,exitCode:1};let E=!!(s||p);if(r){if(c.length===0)return{stdout:"",stderr:`sed: -i requires at least one file argument
|
|
88
|
+
`,exitCode:1};for(let u of c){if(u==="-")continue;let h=e.fs.resolvePath(e.cwd,u);try{let b=await e.fs.readFile(h),C=await z(b,o,E,{limits:e.limits,filename:u,fs:e.fs,cwd:e.cwd,coverage:e.coverage});if(C.errorMessage)return{stdout:"",stderr:`${C.errorMessage}
|
|
89
|
+
`,exitCode:C.exitCode??1};await e.fs.writeFile(h,C.output)}catch(b){return b instanceof x?{stdout:"",stderr:`sed: ${b.message}
|
|
90
|
+
`,exitCode:x.EXIT_CODE}:{stdout:"",stderr:`sed: ${u}: No such file or directory
|
|
91
|
+
`,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let m="";if(c.length===0){m=e.stdin;try{let u=await z(m,o,E,{limits:e.limits,fs:e.fs,cwd:e.cwd,coverage:e.coverage});return{stdout:u.output,stderr:u.errorMessage?`${u.errorMessage}
|
|
92
|
+
`:"",exitCode:u.exitCode??0}}catch(u){if(u instanceof x)return{stdout:"",stderr:`sed: ${u.message}
|
|
93
|
+
`,exitCode:x.EXIT_CODE};throw u}}let d=!1;for(let u of c){let h;if(u==="-")d?h="":(h=e.stdin,d=!0);else{let b=e.fs.resolvePath(e.cwd,u);try{h=await e.fs.readFile(b)}catch(C){return C instanceof x?{stdout:"",stderr:`sed: ${C.message}
|
|
94
|
+
`,exitCode:x.EXIT_CODE}:{stdout:"",stderr:`sed: ${u}: No such file or directory
|
|
95
|
+
`,exitCode:1}}}m.length>0&&h.length>0&&!m.endsWith(`
|
|
96
96
|
`)&&(m+=`
|
|
97
|
-
`),m+=
|
|
98
|
-
`:"",exitCode:
|
|
99
|
-
`,exitCode:
|
|
97
|
+
`),m+=h}try{let u=await z(m,o,E,{limits:e.limits,filename:c.length===1?c[0]:void 0,fs:e.fs,cwd:e.cwd,coverage:e.coverage});return{stdout:u.output,stderr:u.errorMessage?`${u.errorMessage}
|
|
98
|
+
`:"",exitCode:u.exitCode??0}}catch(u){if(u instanceof x)return{stdout:"",stderr:`sed: ${u.message}
|
|
99
|
+
`,exitCode:x.EXIT_CODE};throw u}}},Le={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};export{Ne as a,Le as b};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{a as f,b as c,c as u}from"./chunk-74CEPOFO.js";var m={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"]};function p(n){return n>=32&&n<=126||n===9}function d(n,s){if(s===null)return"";switch(s){case"o":return`${n.toString(8).padStart(7," ")} `;case"x":return`${n.toString(16).padStart(7," ")} `;case"d":return`${n.toString(10).padStart(7," ")} `;default:return s}}function g(n,s){let o=[],r="",i=0,l=typeof n=="string"?new TextEncoder().encode(n):n;for(let e=0;e<l.length;e++){let t=l[e];if(p(t))r.length===0&&(i=e),r+=String.fromCharCode(t);else{if(r.length>=s.minLength){let a=d(i,s.offsetFormat);o.push(`${a}${r}`)}r=""}}if(r.length>=s.minLength){let e=d(i,s.offsetFormat);o.push(`${e}${r}`)}return o}var b={name:"strings",execute:async(n,s)=>{if(c(n))return f(m);let o={minLength:4,offsetFormat:null},r=[],i=0;for(;i<n.length;){let e=n[i];if(e==="-n"&&i+1<n.length){let t=Number.parseInt(n[i+1],10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${n[i+1]}'
|
|
2
|
+
`};o.minLength=t,i+=2}else if(e.match(/^-n\d+$/)){let t=Number.parseInt(e.slice(2),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e.slice(2)}'
|
|
3
|
+
`};o.minLength=t,i++}else if(e.match(/^-\d+$/)){let t=Number.parseInt(e.slice(1),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e.slice(1)}'
|
|
4
|
+
`};o.minLength=t,i++}else if(e==="-t"&&i+1<n.length){let t=n[i+1];if(t!=="o"&&t!=="x"&&t!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${t}'
|
|
5
|
+
`};o.offsetFormat=t,i+=2}else if(e.startsWith("-t")&&e.length===3){let t=e[2];if(t!=="o"&&t!=="x"&&t!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${t}'
|
|
6
|
+
`};o.offsetFormat=t,i++}else if(e==="-a"||e==="--all"||e==="-")e==="-"&&r.push(e),i++;else if(e==="-e"&&i+1<n.length){let t=n[i+1];if(t!=="s"&&t!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${t}'
|
|
7
|
+
`};i+=2}else if(e.startsWith("-e")&&e.length===3){let t=e[2];if(t!=="s"&&t!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${t}'
|
|
8
|
+
`};i++}else if(e==="--"){r.push(...n.slice(i+1));break}else{if(e.startsWith("-")&&e!=="-")return u("strings",e);r.push(e),i++}}let l="";if(r.length===0){let e=s.stdin??"",t=g(e,o);l=t.length>0?`${t.join(`
|
|
9
|
+
`)}
|
|
10
|
+
`:""}else for(let e of r){let t;if(e==="-")t=s.stdin??"";else{let h=s.fs.resolvePath(s.cwd,e);if(t=await s.fs.readFile(h),t===null)return{exitCode:1,stdout:l,stderr:`strings: ${e}: No such file or directory
|
|
11
|
+
`}}let a=g(t,o);a.length>0&&(l+=`${a.join(`
|
|
12
|
+
`)}
|
|
13
|
+
`)}return{exitCode:0,stdout:l,stderr:""}}},N={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};export{b as a,N as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as x}from"./chunk-YNYSPYQ5.js";import{a as ne,b as ie,c as K}from"./chunk-74CEPOFO.js";import
|
|
2
|
-
`,a=U.encode(o).length+1,c=a+String(a).length;return c=a+String(c).length,`${c} ${o}`}).join(""));return{paxHeader:me({name:le.decode(U.encode(`PaxHeader/${e.name}`).slice(0,100)),size:r.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:r}}function de(e){if(e.length<=100)return null;let t=e.length-100-1,i=e.lastIndexOf("/",155);return i>0&&i>=t?{prefix:e.slice(0,i),name:e.slice(i+1)}:null}function me(e){let t=new Uint8Array(512),i=k(e)?0:e.size??0,r=e.name,n="";if(!e.pax?.path){let s=de(r);s&&(r=s.name,n=s.prefix)}return T(t,0,100,r),F(t,100,8,e.mode??(e.type===M?493:420)),F(t,108,8,e.uid??0),F(t,116,8,e.gid??0),F(t,124,12,i),F(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),T(t,156,1,be[e.type??H]),T(t,157,100,e.linkname),T(t,257,6,"ustar\0"),T(t,263,2,"00"),T(t,265,32,e.uname),T(t,297,32,e.gname),T(t,345,155,n),De(t),t}function Le(e,t){if(t&&!Be(e))throw new Error("Invalid tar header checksum.");let i=A(e,156,1),r={name:A(e,0,100),mode:W(e,100,8),uid:v(e,108,8),gid:v(e,116,8),size:v(e,124,12),mtime:new Date(v(e,136,12)*1e3),type:Me[i]||H,linkname:A(e,157,100)},n=A(e,257,6);return n.trim()==="ustar"&&(r.uname=A(e,265,32),r.gname=A(e,297,32)),n==="ustar"&&(r.prefix=A(e,345,155)),r}var Ke={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>parseInt(e,10)],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function Pe(e){let t=new TextDecoder("utf-8"),i={},r={},n=0;for(;n<e.length;){let s=e.indexOf(32,n);if(s===-1)break;let o=parseInt(t.decode(e.subarray(n,s)),10);if(Number.isNaN(o)||o===0)break;let a=n+o,[c,l]=t.decode(e.subarray(s+1,a-1)).split("=",2);if(c&&l!==void 0){r[c]=l;let d=Ke[c];if(d){let[u,g]=d,p=g(l);(typeof p=="string"||!Number.isNaN(p))&&(i[u]=p)}}n=a}return Object.keys(r).length>0&&(i.pax=r),i}function se(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function Ge(e){switch(e){case"pax-global-header":case"pax-header":return Pe;case"gnu-long-name":return t=>({name:A(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:A(t,0,t.length)});default:return}}function He(e){let t=me(e),i=Ne(e);if(!i)return[t];let r=-i.paxBody.length&511,n=r>0?[$e.subarray(0,r)]:[];return[i.paxHeader,i.paxBody,...n,t]}var We=new Uint8Array(512*2);function pe(e,t,i){let r=null,n=0,s=!1;return{add(o){if(s){let a=new Error("No new tar entries after finalize.");throw t(a),a}if(r!==null){let a=new Error("Previous entry must be completed before adding a new one");throw t(a),a}try{let a=k(o)?0:o.size??0,c=He({...o,size:a});for(let l of c)e(l);r={...o,size:a},n=0}catch(a){t(a)}},write(o){if(!r){let c=new Error("No active tar entry.");throw t(c),c}if(s){let c=new Error("Cannot write data after finalize.");throw t(c),c}let a=n+o.length;if(a>r.size){let c=new Error(`"${r.name}" exceeds given size of ${r.size} bytes.`);throw t(c),c}try{n=a,e(o)}catch(c){t(c)}},endEntry(){if(!r){let o=new Error("No active entry to end.");throw t(o),o}if(s){let o=new Error("Cannot end entry after finalize.");throw t(o),o}try{if(n!==r.size){let a=new Error(`Size mismatch for "${r.name}".`);throw t(a),a}let o=-r.size&511;o>0&&e(new Uint8Array(o)),r=null,n=0}catch(o){throw t(o),o}},finalize(){if(s){let o=new Error("Archive has already been finalized");throw t(o),o}if(r!==null){let o=new Error("Cannot finalize while an entry is still active");throw t(o),o}try{e(We),s=!0,i&&i()}catch(o){t(o)}}}}var R=256;function Xe(){let e=new Array(R),t=e.length-1,i=0,r=0,n=0,s=a=>{let c=e[i];a===c.length?(e[i]=b,i=i+1&t):e[i]=c.subarray(a),n-=a,n===0&&e.length>R&&(e=new Array(R),t=R-1,i=0,r=0)};function o(a,c){if(c){let p=0,f=Math.min(a,n);for(;f>0;){let h=e[i],m=Math.min(f,h.length),S=m===h.length?h:h.subarray(0,m);if(s(m),f-=m,p+=m,!c(S))break}return p}if(n<a)return null;if(a===0)return b;let l=e[i];if(l.length>=a){let p=l.length===a?l:l.subarray(0,a);return s(a),p}let d=new Uint8Array(a),u=0,g=a;for(;g>0;){let p=e[i],f=Math.min(g,p.length);d.set(f===p.length?p:p.subarray(0,f),u),u+=f,g-=f,s(f)}return d}return{push:a=>{if(a.length===0)return;let c=r+1&t;if(c===i){let l=e.length,d=l*2,u=new Array(d),g=r-i+l&l-1;if(i<r)for(let p=0;p<g;p++)u[p]=e[i+p];else if(g>0){let p=l-i;for(let f=0;f<p;f++)u[f]=e[i+f];for(let f=0;f<r;f++)u[p+f]=e[f]}e=u,t=d-1,i=0,r=g,c=r+1&t}e[r]=a,r=c,n+=a.length},available:()=>n,peek:a=>{if(n<a)return null;if(a===0)return b;let c=e[i];if(c.length>=a)return c.length===a?c:c.subarray(0,a);let l=new Uint8Array(a),d=0,u=i;for(;d<a;){let g=e[u],p=Math.min(a-d,g.length);p===g.length?l.set(g,d):l.set(g.subarray(0,p),d),d+=p,u=u+1&t}return l},discard:a=>{if(a>n)throw new Error("Too many bytes consumed");if(a===0)return;let c=a;for(;c>0;){let l=e[i],d=Math.min(c,l.length);s(d),c-=d}},pull:o}}var P=0,z=1,O=new Error("Tar archive is truncated.");function he(e={}){let t=e.strict??!1,{available:i,peek:r,push:n,discard:s,pull:o}=Xe(),a=P,c=!1,l=!1,d=!1,u=null,g={},p={},f={isEntryActive:()=>a===z,isBodyComplete:()=>!u||u.remaining===0,write(h){if(c)throw new Error("Archive already ended.");n(h)},end(){c=!0},readHeader(){if(a!==P)throw new Error("Cannot read header while an entry is active");if(!l)for(;!l;){if(i()<512){if(c){if(i()>0&&t)throw O;l=!0;return}return null}let h=r(512);if(ae(h)){if(i()<512*2){if(c){if(t)throw O;l=!0;return}return null}if(ae(r(512*2).subarray(512))){s(512*2),l=!0,d=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let m;try{m=Le(h,t)}catch(w){if(t)throw w;s(512);continue}let S=Ge(m.type);if(S){let w=m.size+511&-512;if(i()<512+w){if(c&&t)throw O;return null}s(512);let I=S(o(w).subarray(0,m.size)),Oe=m.type==="pax-global-header"?g:p;for(let re in I)Oe[re]=I[re];continue}s(512);let E=m;return m.prefix&&(E.name=`${m.prefix}/${E.name}`),se(E,g),se(E,p),p={},u={header:E,remaining:E.size,padding:-E.size&511},a=z,E}},streamBody(h){if(a!==z||!u||u.remaining===0)return 0;let m=Math.min(u.remaining,i());if(m===0)return 0;let S=o(m,h);return u.remaining-=S,S},skipPadding(){if(a!==z||!u)return!0;if(u.remaining>0)throw new Error("Body not fully consumed");return i()<u.padding?!1:(s(u.padding),u=null,a=P,!0)},skipEntry(){if(a!==z||!u)return!0;let h=Math.min(u.remaining,i());return h>0&&(s(h),u.remaining-=h),u.remaining>0?!1:f.skipPadding()},validateEOF(){if(t){if(!d)throw O;if(i()>0&&o(i()).some(h=>h!==0))throw new Error("Invalid EOF.")}}};return f}function ae(e){if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let i=0;i<t.length;i++)if(t[i]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}function Se(){return new CompressionStream("gzip")}function Ee(){return new DecompressionStream("gzip")}function je(){let e,t;return{readable:new ReadableStream({start(i){e=i,t=pe(i.enqueue.bind(i),i.error.bind(i),i.close.bind(i))}}),controller:{add(i){let r=k(i),n={...i};return r&&(n.size=0),t.add(n),r&&t.endEntry(),new WritableStream({write(s){t.write(s)},close(){r||t.endEntry()},abort(s){e.error(s)}})},finalize(){t.finalize()},error(i){e.error(i)}}}}async function we(e){let t=[],i=e.getReader(),r=0;try{for(;;){let{done:o,value:a}=await i.read();if(o)break;t.push(a),r+=a.length}let n=new Uint8Array(r),s=0;for(let o of t)n.set(o,s),s+=o.length;return n}finally{i.releaseLock()}}var ge=e=>e.pipeTo(new WritableStream);function qe(e={}){let t=he(e),i=null,r=!1,n=s=>{if(!r){r=!0;try{for(;;)if(t.isEntryActive()){if(i){if(t.streamBody(o=>(i.enqueue(o),!0))===0&&!t.isBodyComplete())break}else if(!t.skipEntry())break;if(t.isBodyComplete()){try{i?.close()}catch{}if(i=null,!t.skipPadding())break}}else{let o=t.readHeader();if(o==null)break;s.enqueue({header:o,body:new ReadableStream({start(a){o.size===0?a.close():i=a},pull:()=>n(s),cancel(){i=null,n(s)}})})}}catch(o){try{i?.error(o)}catch{}throw i=null,o}finally{r=!1}}};return new TransformStream({transform(s,o){try{t.write(s),n(o)}catch(a){try{i?.error(a)}catch{}throw a}},flush(s){try{if(t.end(),n(s),t.validateEOF(),t.isEntryActive()&&!t.isBodyComplete())try{i?.close()}catch{}}catch(o){try{i?.error(o)}catch{}throw o}}},void 0,{highWaterMark:1})}async function ye(e){let{readable:t,controller:i}=je();return await(async()=>{for(let r of e){let n=i.add(r.header),s="body"in r?r.body:r.data;if(!s){await n.close();continue}if(s instanceof ReadableStream)await s.pipeTo(n);else if(s instanceof Blob)await s.stream().pipeTo(n);else try{let o=await ue(s);if(o.length>0){let a=n.getWriter();await a.write(o),await a.close()}else await n.close()}catch{throw new TypeError(`Unsupported content type for entry "${r.header.name}".`)}}})().then(()=>i.finalize()).catch(r=>i.error(r)),new Uint8Array(await we(t))}async function Ae(e,t={}){let i=e instanceof ReadableStream?e:new ReadableStream({start(s){s.enqueue(e instanceof Uint8Array?e:new Uint8Array(e)),s.close()}}),r=[],n=i.pipeThrough(qe(t));for await(let s of n){let o;try{o=fe(s.header,t)}catch(a){throw await s.body.cancel(),a}if(o===null){await ge(s.body);continue}k(o)?(await ge(s.body),r.push({header:o})):r.push({header:o,data:await we(s.body)})}return r}var $=null,Z=null;async function Ce(){if($)return $;if(Z)throw Z;try{return $=await import("node-liblzma"),$}catch{throw Z=new Error("xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies."),Z}}var B=null,D=null;async function xe(){if(B)return B;if(D)throw D;try{return B=await import("@mongodb-js/zstd"),B}catch{throw D=new Error("zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd"),D}}var y=100*1024*1024,_e=1e4;function Ye(e){let t="file";e.isDirectory?t="directory":e.isSymlink&&(t="symlink");let i=e.name;e.isDirectory&&!i.endsWith("/")&&(i+="/");let r;e.content!==void 0&&(typeof e.content=="string"?r=new TextEncoder().encode(e.content):r=e.content);let n=e.isDirectory||e.isSymlink?0:r?.length??0;return{header:{name:i,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:n,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??"",uname:"user",gname:"user"},body:r}}async function C(e){let t=e.map(Ye);return ye(t)}async function Ue(e){let t=await C(e),n=new ReadableStream({start(l){l.enqueue(t),l.close()}}).pipeThrough(Se()).getReader(),s=[];for(;;){let{done:l,value:d}=await n.read();if(l)break;s.push(d)}let o=s.reduce((l,d)=>l+d.length,0),a=new Uint8Array(o),c=0;for(let l of s)a.set(l,c),c+=l.length;return a}async function _(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let t=await Ae(e),i=[];for(let r of t){if(i.length>=_e)return{entries:i,error:`Too many entries (max ${_e})`};let n="file";switch(r.header.type){case"directory":n="directory";break;case"symlink":n="symlink";break;case"link":n="hardlink";break;case"file":n="file";break;default:n="other"}i.push({name:r.header.name,mode:r.header.mode??420,uid:r.header.uid??0,gid:r.header.gid??0,size:r.header.size,mtime:r.header.mtime??new Date,type:n,linkTarget:r.header.linkname||void 0,content:r.data??new Uint8Array(0)})}return{entries:i}}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function X(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let r=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(Ee()).getReader(),n=[];for(;;){let{done:c,value:l}=await r.read();if(c)break;n.push(l)}let s=n.reduce((c,l)=>c+l.length,0),o=new Uint8Array(s),a=0;for(let c of n)o.set(c,a),a+=c.length;return _(o)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:`Decompression failed: ${i}`}}}function j(e){return e.length>=2&&e[0]===31&&e[1]===139}function q(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function Y(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function Ve(e){let i=Te.Bzip2.decompressFile(Array.from(e));return new Uint8Array(i)}async function Je(e){let t=Te.Bzip2,i=[];return t.compressFile(Array.from(e),i,9),new Uint8Array(i)}async function Qe(e){let i=(await Ce()).unxzSync(Buffer.from(e));return new Uint8Array(i)}async function et(e){let i=(await Ce()).xzSync(Buffer.from(e));return new Uint8Array(i)}async function Ie(e){let t=await C(e);return Je(t)}async function Fe(e){let t=await C(e);return et(t)}async function V(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let t=await Ve(e);return _(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function J(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let t=await Qe(e);return _(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}function Q(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function tt(e){let i=await(await xe()).compress(Buffer.from(e),3);return new Uint8Array(i)}async function rt(e){let i=await(await xe()).decompress(Buffer.from(e));return new Uint8Array(i)}async function ze(e){let t=await C(e);return tt(t)}async function ee(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let t=await rt(e);return _(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}function ke(e){let t={create:!1,append:!1,update:!1,extract:!1,list:!1,file:"",autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:"",preserve:!1,strip:0,exclude:[],filesFrom:"",excludeFrom:"",wildcards:!1},i=[],r=0;for(;r<e.length;){let n=e[r];if(n.startsWith("-")&&!n.startsWith("--")&&n.length>2){if(/^-\d+$/.test(n)){i.push(n),r++;continue}for(let s=1;s<n.length;s++){let o=n[s];switch(o){case"c":t.create=!0;break;case"r":t.append=!0;break;case"u":t.update=!0;break;case"x":t.extract=!0;break;case"t":t.list=!0;break;case"a":t.autoCompress=!0;break;case"z":t.gzip=!0;break;case"j":t.bzip2=!0;break;case"J":t.xz=!0;break;case"v":t.verbose=!0;break;case"O":t.toStdout=!0;break;case"k":t.keepOldFiles=!0;break;case"m":t.touch=!0;break;case"p":t.preserve=!0;break;case"f":if(s<n.length-1)t.file=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
1
|
+
import{a as x}from"./chunk-YNYSPYQ5.js";import{a as ne,b as ie,c as K}from"./chunk-74CEPOFO.js";import Te from"compressjs";var H="file",oe="link",ce="symlink",M="directory",be={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},Me={0:H,1:oe,2:ce,3:"character-device",4:"block-device",5:M,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},$e=new Uint8Array(512),b=new Uint8Array(0),U=new TextEncoder,le=new TextDecoder;function T(e,t,i,r){r&&U.encodeInto(r,e.subarray(t,t+i))}function F(e,t,i,r){if(r===void 0)return;let n=r.toString(8).padStart(i-1,"0");U.encodeInto(n,e.subarray(t,t+i-1))}function A(e,t,i){let r=e.indexOf(0,t),n=r===-1||r>t+i?t+i:r;return le.decode(e.subarray(t,n))}function W(e,t,i){let r=0,n=t+i;for(let s=t;s<n;s++){let o=e[s];if(o===0)break;o!==32&&(r=r*8+(o-48))}return r}function k(e,t,i){if(e[t]&128){let r=0;r=e[t]&127;for(let n=1;n<i;n++)r=r*256+e[t+n];if(!Number.isSafeInteger(r))throw new Error("TAR number too large");return r}return W(e,t,i)}var z=e=>e.type===M||e.type===ce||e.type===oe;async function ue(e){if(e==null)return b;if(e instanceof Uint8Array)return e;if(typeof e=="string")return U.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}function fe(e,t){let{strip:i,filter:r,map:n}=t;if(!i&&!r&&!n)return e;let s={...e};if(i&&i>0){let a=s.name.split("/").filter(Boolean);if(i>=a.length)return null;let c=a.slice(i).join("/");if(s.name=s.type===M&&!c.endsWith("/")?`${c}/`:c,s.linkname?.startsWith("/")){let l=s.linkname.split("/").filter(Boolean);s.linkname=i>=l.length?"/":`/${l.slice(i).join("/")}`}}if(r?.(s)===!1)return null;let o=n?n(s):s;return o&&(!o.name||!o.name.trim()||o.name==="."||o.name==="/")?null:o}var G=32,Ze=48;function Be(e){let t=W(e,148,8),i=0;for(let r=0;r<e.length;r++)r>=148&&r<156?i+=G:i+=e[r];return t===i}function De(e){e.fill(G,148,156);let t=0;for(let i of e)t+=i;for(let i=153;i>=148;i--)e[i]=(t&7)+Ze,t>>=3;e[154]=0,e[155]=G}function Ne(e){let t={};e.name.length>100&&de(e.name)===null&&(t.path=e.name),e.linkname&&e.linkname.length>100&&(t.linkpath=e.linkname),e.uname&&e.uname.length>32&&(t.uname=e.uname),e.gname&&e.gname.length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let i=Object.entries(t);if(i.length===0)return null;let r=U.encode(i.map(([n,s])=>{let o=`${n}=${s}
|
|
2
|
+
`,a=U.encode(o).length+1,c=a+String(a).length;return c=a+String(c).length,`${c} ${o}`}).join(""));return{paxHeader:me({name:le.decode(U.encode(`PaxHeader/${e.name}`).slice(0,100)),size:r.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:r}}function de(e){if(e.length<=100)return null;let t=e.length-100-1,i=e.lastIndexOf("/",155);return i>0&&i>=t?{prefix:e.slice(0,i),name:e.slice(i+1)}:null}function me(e){let t=new Uint8Array(512),i=z(e)?0:e.size??0,r=e.name,n="";if(!e.pax?.path){let s=de(r);s&&(r=s.name,n=s.prefix)}return T(t,0,100,r),F(t,100,8,e.mode??(e.type===M?493:420)),F(t,108,8,e.uid??0),F(t,116,8,e.gid??0),F(t,124,12,i),F(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),T(t,156,1,be[e.type??H]),T(t,157,100,e.linkname),T(t,257,6,"ustar\0"),T(t,263,2,"00"),T(t,265,32,e.uname),T(t,297,32,e.gname),T(t,345,155,n),De(t),t}function Le(e,t){if(t&&!Be(e))throw new Error("Invalid tar header checksum.");let i=A(e,156,1),r={name:A(e,0,100),mode:W(e,100,8),uid:k(e,108,8),gid:k(e,116,8),size:k(e,124,12),mtime:new Date(k(e,136,12)*1e3),type:Me[i]||H,linkname:A(e,157,100)},n=A(e,257,6);return n.trim()==="ustar"&&(r.uname=A(e,265,32),r.gname=A(e,297,32)),n==="ustar"&&(r.prefix=A(e,345,155)),r}var Ke={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>parseInt(e,10)],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function Pe(e){let t=new TextDecoder("utf-8"),i={},r={},n=0;for(;n<e.length;){let s=e.indexOf(32,n);if(s===-1)break;let o=parseInt(t.decode(e.subarray(n,s)),10);if(Number.isNaN(o)||o===0)break;let a=n+o,[c,l]=t.decode(e.subarray(s+1,a-1)).split("=",2);if(c&&l!==void 0){r[c]=l;let d=Ke[c];if(d){let[u,g]=d,p=g(l);(typeof p=="string"||!Number.isNaN(p))&&(i[u]=p)}}n=a}return Object.keys(r).length>0&&(i.pax=r),i}function se(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function Ge(e){switch(e){case"pax-global-header":case"pax-header":return Pe;case"gnu-long-name":return t=>({name:A(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:A(t,0,t.length)});default:return}}function He(e){let t=me(e),i=Ne(e);if(!i)return[t];let r=-i.paxBody.length&511,n=r>0?[$e.subarray(0,r)]:[];return[i.paxHeader,i.paxBody,...n,t]}var We=new Uint8Array(512*2);function pe(e,t,i){let r=null,n=0,s=!1;return{add(o){if(s){let a=new Error("No new tar entries after finalize.");throw t(a),a}if(r!==null){let a=new Error("Previous entry must be completed before adding a new one");throw t(a),a}try{let a=z(o)?0:o.size??0,c=He({...o,size:a});for(let l of c)e(l);r={...o,size:a},n=0}catch(a){t(a)}},write(o){if(!r){let c=new Error("No active tar entry.");throw t(c),c}if(s){let c=new Error("Cannot write data after finalize.");throw t(c),c}let a=n+o.length;if(a>r.size){let c=new Error(`"${r.name}" exceeds given size of ${r.size} bytes.`);throw t(c),c}try{n=a,e(o)}catch(c){t(c)}},endEntry(){if(!r){let o=new Error("No active entry to end.");throw t(o),o}if(s){let o=new Error("Cannot end entry after finalize.");throw t(o),o}try{if(n!==r.size){let a=new Error(`Size mismatch for "${r.name}".`);throw t(a),a}let o=-r.size&511;o>0&&e(new Uint8Array(o)),r=null,n=0}catch(o){throw t(o),o}},finalize(){if(s){let o=new Error("Archive has already been finalized");throw t(o),o}if(r!==null){let o=new Error("Cannot finalize while an entry is still active");throw t(o),o}try{e(We),s=!0,i&&i()}catch(o){t(o)}}}}var R=256;function Xe(){let e=new Array(R),t=e.length-1,i=0,r=0,n=0,s=a=>{let c=e[i];a===c.length?(e[i]=b,i=i+1&t):e[i]=c.subarray(a),n-=a,n===0&&e.length>R&&(e=new Array(R),t=R-1,i=0,r=0)};function o(a,c){if(c){let p=0,f=Math.min(a,n);for(;f>0;){let h=e[i],m=Math.min(f,h.length),S=m===h.length?h:h.subarray(0,m);if(s(m),f-=m,p+=m,!c(S))break}return p}if(n<a)return null;if(a===0)return b;let l=e[i];if(l.length>=a){let p=l.length===a?l:l.subarray(0,a);return s(a),p}let d=new Uint8Array(a),u=0,g=a;for(;g>0;){let p=e[i],f=Math.min(g,p.length);d.set(f===p.length?p:p.subarray(0,f),u),u+=f,g-=f,s(f)}return d}return{push:a=>{if(a.length===0)return;let c=r+1&t;if(c===i){let l=e.length,d=l*2,u=new Array(d),g=r-i+l&l-1;if(i<r)for(let p=0;p<g;p++)u[p]=e[i+p];else if(g>0){let p=l-i;for(let f=0;f<p;f++)u[f]=e[i+f];for(let f=0;f<r;f++)u[p+f]=e[f]}e=u,t=d-1,i=0,r=g,c=r+1&t}e[r]=a,r=c,n+=a.length},available:()=>n,peek:a=>{if(n<a)return null;if(a===0)return b;let c=e[i];if(c.length>=a)return c.length===a?c:c.subarray(0,a);let l=new Uint8Array(a),d=0,u=i;for(;d<a;){let g=e[u],p=Math.min(a-d,g.length);p===g.length?l.set(g,d):l.set(g.subarray(0,p),d),d+=p,u=u+1&t}return l},discard:a=>{if(a>n)throw new Error("Too many bytes consumed");if(a===0)return;let c=a;for(;c>0;){let l=e[i],d=Math.min(c,l.length);s(d),c-=d}},pull:o}}var P=0,v=1,O=new Error("Tar archive is truncated.");function he(e={}){let t=e.strict??!1,{available:i,peek:r,push:n,discard:s,pull:o}=Xe(),a=P,c=!1,l=!1,d=!1,u=null,g={},p={},f={isEntryActive:()=>a===v,isBodyComplete:()=>!u||u.remaining===0,write(h){if(c)throw new Error("Archive already ended.");n(h)},end(){c=!0},readHeader(){if(a!==P)throw new Error("Cannot read header while an entry is active");if(!l)for(;!l;){if(i()<512){if(c){if(i()>0&&t)throw O;l=!0;return}return null}let h=r(512);if(ae(h)){if(i()<512*2){if(c){if(t)throw O;l=!0;return}return null}if(ae(r(512*2).subarray(512))){s(512*2),l=!0,d=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let m;try{m=Le(h,t)}catch(w){if(t)throw w;s(512);continue}let S=Ge(m.type);if(S){let w=m.size+511&-512;if(i()<512+w){if(c&&t)throw O;return null}s(512);let I=S(o(w).subarray(0,m.size)),Oe=m.type==="pax-global-header"?g:p;for(let re in I)Oe[re]=I[re];continue}s(512);let E=m;return m.prefix&&(E.name=`${m.prefix}/${E.name}`),se(E,g),se(E,p),p={},u={header:E,remaining:E.size,padding:-E.size&511},a=v,E}},streamBody(h){if(a!==v||!u||u.remaining===0)return 0;let m=Math.min(u.remaining,i());if(m===0)return 0;let S=o(m,h);return u.remaining-=S,S},skipPadding(){if(a!==v||!u)return!0;if(u.remaining>0)throw new Error("Body not fully consumed");return i()<u.padding?!1:(s(u.padding),u=null,a=P,!0)},skipEntry(){if(a!==v||!u)return!0;let h=Math.min(u.remaining,i());return h>0&&(s(h),u.remaining-=h),u.remaining>0?!1:f.skipPadding()},validateEOF(){if(t){if(!d)throw O;if(i()>0&&o(i()).some(h=>h!==0))throw new Error("Invalid EOF.")}}};return f}function ae(e){if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let i=0;i<t.length;i++)if(t[i]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}function Se(){return new CompressionStream("gzip")}function Ee(){return new DecompressionStream("gzip")}function je(){let e,t;return{readable:new ReadableStream({start(i){e=i,t=pe(i.enqueue.bind(i),i.error.bind(i),i.close.bind(i))}}),controller:{add(i){let r=z(i),n={...i};return r&&(n.size=0),t.add(n),r&&t.endEntry(),new WritableStream({write(s){t.write(s)},close(){r||t.endEntry()},abort(s){e.error(s)}})},finalize(){t.finalize()},error(i){e.error(i)}}}}async function we(e){let t=[],i=e.getReader(),r=0;try{for(;;){let{done:o,value:a}=await i.read();if(o)break;t.push(a),r+=a.length}let n=new Uint8Array(r),s=0;for(let o of t)n.set(o,s),s+=o.length;return n}finally{i.releaseLock()}}var ge=e=>e.pipeTo(new WritableStream);function qe(e={}){let t=he(e),i=null,r=!1,n=s=>{if(!r){r=!0;try{for(;;)if(t.isEntryActive()){if(i){if(t.streamBody(o=>(i.enqueue(o),!0))===0&&!t.isBodyComplete())break}else if(!t.skipEntry())break;if(t.isBodyComplete()){try{i?.close()}catch{}if(i=null,!t.skipPadding())break}}else{let o=t.readHeader();if(o==null)break;s.enqueue({header:o,body:new ReadableStream({start(a){o.size===0?a.close():i=a},pull:()=>n(s),cancel(){i=null,n(s)}})})}}catch(o){try{i?.error(o)}catch{}throw i=null,o}finally{r=!1}}};return new TransformStream({transform(s,o){try{t.write(s),n(o)}catch(a){try{i?.error(a)}catch{}throw a}},flush(s){try{if(t.end(),n(s),t.validateEOF(),t.isEntryActive()&&!t.isBodyComplete())try{i?.close()}catch{}}catch(o){try{i?.error(o)}catch{}throw o}}},void 0,{highWaterMark:1})}async function ye(e){let{readable:t,controller:i}=je();return await(async()=>{for(let r of e){let n=i.add(r.header),s="body"in r?r.body:r.data;if(!s){await n.close();continue}if(s instanceof ReadableStream)await s.pipeTo(n);else if(s instanceof Blob)await s.stream().pipeTo(n);else try{let o=await ue(s);if(o.length>0){let a=n.getWriter();await a.write(o),await a.close()}else await n.close()}catch{throw new TypeError(`Unsupported content type for entry "${r.header.name}".`)}}})().then(()=>i.finalize()).catch(r=>i.error(r)),new Uint8Array(await we(t))}async function Ae(e,t={}){let i=e instanceof ReadableStream?e:new ReadableStream({start(s){s.enqueue(e instanceof Uint8Array?e:new Uint8Array(e)),s.close()}}),r=[],n=i.pipeThrough(qe(t));for await(let s of n){let o;try{o=fe(s.header,t)}catch(a){throw await s.body.cancel(),a}if(o===null){await ge(s.body);continue}z(o)?(await ge(s.body),r.push({header:o})):r.push({header:o,data:await we(s.body)})}return r}var $=null,Z=null;async function Ce(){if($)return $;if(Z)throw Z;try{return $=await import("node-liblzma"),$}catch{throw Z=new Error("xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies."),Z}}var B=null,D=null;async function xe(){if(B)return B;if(D)throw D;try{return B=await import("@mongodb-js/zstd"),B}catch{throw D=new Error("zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd"),D}}var y=100*1024*1024,_e=1e4;function Ye(e){let t="file";e.isDirectory?t="directory":e.isSymlink&&(t="symlink");let i=e.name;e.isDirectory&&!i.endsWith("/")&&(i+="/");let r;e.content!==void 0&&(typeof e.content=="string"?r=new TextEncoder().encode(e.content):r=e.content);let n=e.isDirectory||e.isSymlink?0:r?.length??0;return{header:{name:i,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:n,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??"",uname:"user",gname:"user"},body:r}}async function C(e){let t=e.map(Ye);return ye(t)}async function Ue(e){let t=await C(e),n=new ReadableStream({start(l){l.enqueue(t),l.close()}}).pipeThrough(Se()).getReader(),s=[];for(;;){let{done:l,value:d}=await n.read();if(l)break;s.push(d)}let o=s.reduce((l,d)=>l+d.length,0),a=new Uint8Array(o),c=0;for(let l of s)a.set(l,c),c+=l.length;return a}async function _(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let t=await Ae(e),i=[];for(let r of t){if(i.length>=_e)return{entries:i,error:`Too many entries (max ${_e})`};let n="file";switch(r.header.type){case"directory":n="directory";break;case"symlink":n="symlink";break;case"link":n="hardlink";break;case"file":n="file";break;default:n="other"}i.push({name:r.header.name,mode:r.header.mode??420,uid:r.header.uid??0,gid:r.header.gid??0,size:r.header.size,mtime:r.header.mtime??new Date,type:n,linkTarget:r.header.linkname||void 0,content:r.data??new Uint8Array(0)})}return{entries:i}}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function X(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let r=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(Ee()).getReader(),n=[];for(;;){let{done:c,value:l}=await r.read();if(c)break;n.push(l)}let s=n.reduce((c,l)=>c+l.length,0),o=new Uint8Array(s),a=0;for(let c of n)o.set(c,a),a+=c.length;return _(o)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:`Decompression failed: ${i}`}}}function j(e){return e.length>=2&&e[0]===31&&e[1]===139}function q(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function Y(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function Ve(e){let i=Te.Bzip2.decompressFile(Array.from(e));return new Uint8Array(i)}async function Je(e){let t=Te.Bzip2,i=[];return t.compressFile(Array.from(e),i,9),new Uint8Array(i)}async function Qe(e){let i=(await Ce()).unxzSync(Buffer.from(e));return new Uint8Array(i)}async function et(e){let i=(await Ce()).xzSync(Buffer.from(e));return new Uint8Array(i)}async function Ie(e){let t=await C(e);return Je(t)}async function Fe(e){let t=await C(e);return et(t)}async function V(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let t=await Ve(e);return _(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function J(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let t=await Qe(e);return _(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}function Q(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function tt(e){let i=await(await xe()).compress(Buffer.from(e),3);return new Uint8Array(i)}async function rt(e){let i=await(await xe()).decompress(Buffer.from(e));return new Uint8Array(i)}async function ve(e){let t=await C(e);return tt(t)}async function ee(e){if(e.length>y)return{entries:[],error:`Archive too large (max ${y} bytes)`};try{let t=await rt(e);return _(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}function ze(e){let t={create:!1,append:!1,update:!1,extract:!1,list:!1,file:"",autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:"",preserve:!1,strip:0,exclude:[],filesFrom:"",excludeFrom:"",wildcards:!1},i=[],r=0;for(;r<e.length;){let n=e[r];if(n.startsWith("-")&&!n.startsWith("--")&&n.length>2){if(/^-\d+$/.test(n)){i.push(n),r++;continue}for(let s=1;s<n.length;s++){let o=n[s];switch(o){case"c":t.create=!0;break;case"r":t.append=!0;break;case"u":t.update=!0;break;case"x":t.extract=!0;break;case"t":t.list=!0;break;case"a":t.autoCompress=!0;break;case"z":t.gzip=!0;break;case"j":t.bzip2=!0;break;case"J":t.xz=!0;break;case"v":t.verbose=!0;break;case"O":t.toStdout=!0;break;case"k":t.keepOldFiles=!0;break;case"m":t.touch=!0;break;case"p":t.preserve=!0;break;case"f":if(s<n.length-1)t.file=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
3
3
|
`,exitCode:2}};t.file=e[r]}break;case"C":if(s<n.length-1)t.directory=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
4
4
|
`,exitCode:2}};t.directory=e[r]}break;case"T":if(s<n.length-1)t.filesFrom=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
5
5
|
`,exitCode:2}};t.filesFrom=e[r]}break;case"X":if(s<n.length-1)t.excludeFrom=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
@@ -9,11 +9,11 @@ import{a as x}from"./chunk-YNYSPYQ5.js";import{a as ne,b as ie,c as K}from"./chu
|
|
|
9
9
|
`,exitCode:2}};t.strip=o}else if(n.startsWith("--exclude="))t.exclude.push(n.substring(10));else if(n==="--exclude"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option '--exclude' requires an argument
|
|
10
10
|
`,exitCode:2}};t.exclude.push(e[r])}else if(n==="-T"||n==="--files-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
11
11
|
`,exitCode:2}};t.filesFrom=e[r]}else if(n.startsWith("--files-from="))t.filesFrom=n.substring(13);else if(n==="-X"||n==="--exclude-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
12
|
-
`,exitCode:2}};t.excludeFrom=e[r]}else if(n.startsWith("--exclude-from="))t.excludeFrom=n.substring(15);else if(n==="--"){i.push(...e.slice(r+1));break}else{if(n.startsWith("-"))return{ok:!1,error:K("tar",n)};i.push(n)}r++}return{ok:!0,options:t,files:i}}var
|
|
12
|
+
`,exitCode:2}};t.excludeFrom=e[r]}else if(n.startsWith("--exclude-from="))t.excludeFrom=n.substring(15);else if(n==="--"){i.push(...e.slice(r+1));break}else{if(n.startsWith("-"))return{ok:!1,error:K("tar",n)};i.push(n)}r++}return{ok:!0,options:t,files:i}}var ke=100,nt={name:"tar",summary:"manipulate tape archives",usage:"tar [options] [file...]",description:["Create, extract, or list contents of tar archives.","","One of -c, -r, -u, -x, or -t is required to specify the operation."],options:["-c, --create create a new archive","-r, --append append files to the end of an archive","-u, --update only append files newer than copy in archive","-x, --extract extract files from an archive","-t, --list list contents of an archive","-f, --file=ARCHIVE use archive file ARCHIVE","-a, --auto-compress use archive suffix to determine compression","-z, --gzip filter archive through gzip","-j, --bzip2 filter archive through bzip2","-J, --xz filter archive through xz","--zstd filter archive through zstd","-v, --verbose verbosely list files processed","-O, --to-stdout extract files to standard output","-k, --keep-old-files don't replace existing files when extracting","-m, --touch don't extract file modified time","-C, --directory=DIR change to directory DIR before performing operations","-p, --preserve preserve permissions","-T, --files-from=FILE read files to extract/create from FILE","-X, --exclude-from=FILE read exclude patterns from FILE","--strip=N strip N leading path components on extraction","--exclude=PATTERN exclude files matching PATTERN","--wildcards use wildcards for pattern matching"," --help display this help and exit"],examples:["tar -cvf archive.tar file1 file2 Create archive from files","tar -czvf archive.tar.gz dir/ Create gzip-compressed archive","tar -cjvf archive.tar.bz2 dir/ Create bzip2-compressed archive","tar -rf archive.tar newfile.txt Append file to archive","tar -uf archive.tar dir/ Update archive with newer files","tar -xvf archive.tar Extract archive","tar -xvf archive.tar -C /tmp Extract to /tmp","tar -tvf archive.tar List archive contents","tar -xzf archive.tar.gz Extract gzip archive","tar -xf archive.tar file1.txt Extract specific file","tar -xOf archive.tar file.txt Extract file to stdout","tar -xf archive.tar --wildcards '*.txt' Extract matching files"]};function te(e,t){let i=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;for(let r of t){let n=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,".");if(x(`^${n}$`).test(e)||x(`^${n}/`).test(e)||!r.includes("/")&&x(`^${n}$`).test(i))return!0}return!1}function N(e,t){let i=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,"."),r=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;return x(`^${i}$`).test(e)||x(`^${i}$`).test(r)}function Re(e,t){if(t<=0)return e;let i=e.split("/").filter(r=>r!=="");return i.length<=t?"":i.slice(t).join("/")}function it(e,t){let i=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":"-"].join("");return i+r}function st(e){let i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=e.getDate().toString().padStart(2," "),n=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0");return`${i} ${r} ${n}:${s}`}async function L(e,t,i,r){let n=[],s=[],o=e.fs.resolvePath(t,i);try{let a=await e.fs.stat(o);if(te(i,r))return{entries:n,errors:s};if(a.isDirectory){n.push({name:i,isDirectory:!0,mode:a.mode,mtime:a.mtime});let c=await e.fs.readdir(o);for(let l=0;l<c.length;l+=ke){let d=c.slice(l,l+ke),u=await Promise.all(d.map(g=>L(e,t,i?`${i}/${g}`:g,r)));for(let g of u)n.push(...g.entries),s.push(...g.errors)}}else if(a.isFile){let c=await e.fs.readFileBuffer(o);n.push({name:i,content:c,mode:a.mode,mtime:a.mtime})}else if(a.isSymbolicLink){let c=await e.fs.readlink(o);n.push({name:i,isSymlink:!0,linkTarget:c,mode:a.mode,mtime:a.mtime})}}catch(a){let c=a instanceof Error?a.message:"unknown error";s.push(`tar: ${i}: ${c}`)}return{entries:n,errors:s}}async function at(e,t,i){if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to create an empty archive
|
|
13
13
|
`,exitCode:2};let r=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,n=[],s=[],o="";for(let d of i){let{entries:u,errors:g}=await L(e,r,d,t.exclude);if(n.push(...u),s.push(...g),t.verbose)for(let p of u)o+=`${p.name}${p.isDirectory?"/":""}
|
|
14
14
|
`}if(n.length===0&&s.length>0)return{stdout:"",stderr:`${s.join(`
|
|
15
15
|
`)}
|
|
16
|
-
`,exitCode:2};let a;try{t.gzip?a=await Ue(n):t.bzip2?a=await Ie(n):t.xz?a=await Fe(n):t.zstd?a=await
|
|
16
|
+
`,exitCode:2};let a;try{t.gzip?a=await Ue(n):t.bzip2?a=await Ie(n):t.xz?a=await Fe(n):t.zstd?a=await ve(n):a=await C(n)}catch(d){return{stdout:"",stderr:`tar: error creating archive: ${d instanceof Error?d.message:"unknown error"}
|
|
17
17
|
`,exitCode:2}}let c="";if(t.file&&t.file!=="-"){let d=e.fs.resolvePath(e.cwd,t.file);try{await e.fs.writeFile(d,a)}catch(u){let g=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${g}
|
|
18
18
|
`,exitCode:2}}}else c=String.fromCharCode(...a);let l=o;return s.length>0&&(l+=`${s.join(`
|
|
19
19
|
`)}
|
|
@@ -51,7 +51,7 @@ import{a as x}from"./chunk-YNYSPYQ5.js";import{a as ne,b as ie,c as K}from"./chu
|
|
|
51
51
|
`,exitCode:2}}}else r=Uint8Array.from(e.stdin,d=>d.charCodeAt(0));let n,s=t.gzip||j(r),o=t.bzip2||q(r),a=t.xz||Y(r),c=t.zstd||Q(r);if(s?n=await X(r):o?n=await V(r):a?n=await J(r):c?n=await ee(r):n=await _(r),n.error)return{stdout:"",stderr:`tar: ${n.error}
|
|
52
52
|
`,exitCode:2};let l="";for(let d of n.entries){let u=Re(d.name,t.strip);if(!u)continue;let g=u.endsWith("/")?u.slice(0,-1):u;if(i.length>0){let p;if(t.wildcards?p=i.some(f=>N(u,f)||N(g,f)||u.startsWith(`${f}/`)):p=i.some(f=>u===f||u.startsWith(`${f}/`)||g===f),!p)continue}if(!te(u,t.exclude))if(t.verbose){let p=d.type==="directory",f=it(d.mode,p),h=`${d.uid}/${d.gid}`,m=d.size.toString().padStart(8," "),S=st(d.mtime),E=`${f} ${h.padEnd(10)} ${m} ${S} ${u}`;d.type==="symlink"&&d.linkTarget&&(E+=` -> ${d.linkTarget}`),l+=`${E}
|
|
53
53
|
`}else l+=`${u}
|
|
54
|
-
`}return{stdout:l,stderr:"",exitCode:0}}var Tt={name:"tar",async execute(e,t){if(ie(e))return ne(nt);let i=
|
|
54
|
+
`}return{stdout:l,stderr:"",exitCode:0}}var Tt={name:"tar",async execute(e,t){if(ie(e))return ne(nt);let i=ze(e);if(!i.ok)return i.error;let{options:r,files:n}=i,s=[r.create,r.append,r.update,r.extract,r.list].filter(Boolean).length;if(s===0)return{stdout:"",stderr:`tar: You must specify one of -c, -r, -u, -x, or -t
|
|
55
55
|
`,exitCode:2};if(s>1)return{stdout:"",stderr:`tar: You may not specify more than one of -c, -r, -u, -x, or -t
|
|
56
56
|
`,exitCode:2};if(r.autoCompress&&r.file&&r.create){let c=r.file.toLowerCase();c.endsWith(".tar.gz")||c.endsWith(".tgz")?r.gzip=!0:c.endsWith(".tar.bz2")||c.endsWith(".tbz2")?r.bzip2=!0:c.endsWith(".tar.xz")||c.endsWith(".txz")?r.xz=!0:(c.endsWith(".tar.zst")||c.endsWith(".tzst"))&&(r.zstd=!0)}let o=[r.gzip,r.bzip2,r.xz,r.zstd].filter(Boolean).length;if(o>1)return{stdout:"",stderr:`tar: You may not specify more than one compression option
|
|
57
57
|
`,exitCode:2};if((r.append||r.update)&&o>0)return{stdout:"",stderr:`tar: Cannot append/update compressed archives - decompress first
|
|
@@ -59,4 +59,4 @@ import{a as x}from"./chunk-YNYSPYQ5.js";import{a as ne,b as ie,c as K}from"./chu
|
|
|
59
59
|
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));a=[...n,...d]}catch{return{stdout:"",stderr:`tar: ${r.filesFrom}: Cannot open: No such file or directory
|
|
60
60
|
`,exitCode:2}}}if(r.excludeFrom){let c=t.fs.resolvePath(t.cwd,r.excludeFrom);try{let d=(await t.fs.readFile(c)).split(`
|
|
61
61
|
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));r.exclude.push(...d)}catch{return{stdout:"",stderr:`tar: ${r.excludeFrom}: Cannot open: No such file or directory
|
|
62
|
-
`,exitCode:2}}}return r.create?at(t,r,a):r.append?ot(t,r,a):r.update?ct(t,r,a):r.extract?lt(t,r,a):ut(t,r,a)}};export{Tt as
|
|
62
|
+
`,exitCode:2}}}return r.create?at(t,r,a):r.append?ot(t,r,a):r.update?ct(t,r,a):r.extract?lt(t,r,a):ut(t,r,a)}},Ct={name:"tar",flags:[{flag:"-c",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-f",type:"value",valueHint:"path"},{flag:"-z",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-C",type:"value",valueHint:"path"},{flag:"--strip-components",type:"value",valueHint:"number"},{flag:"--exclude",type:"value",valueHint:"pattern"}],needsArgs:!0};export{Tt as a,Ct as b};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{a as oe}from"./chunk-OJDRYQWQ.js";import{a as A,b as P}from"./chunk-YNYSPYQ5.js";import{k as O}from"./chunk-PSW6BMXW.js";import{a as se,b as ae,c as z}from"./chunk-74CEPOFO.js";var Le=1e4,Me=100,Pe=new P(/\s+/);function Q(e={}){let{fieldSep:t=Pe,maxIterations:n=Le,maxRecursionDepth:i=Me,maxOutputSize:a=0,fs:s,cwd:o,exec:l,coverage:u}=e;return{FS:" ",OFS:" ",ORS:`
|
|
2
|
+
`,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:i,maxOutputSize:a,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:s,cwd:o,exec:l,coverage:u}}function ce(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}function C(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function g(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function x(e,t){if(e.type==="regex")return e.pattern;let n=g(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function ue(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(C(await t.evalExpr(e.index)))}`:"$0":"$0"}function he(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return g(t.vars[e]??"")}function pe(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let i=parseInt(e.slice(1),10)-1;for(;n.fields.length<=i;)n.fields.push("");n.fields[i]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function Te(e,t,n){return e.length===0?t.line.length:g(await n.evalExpr(e[0])).length}async function Fe(e,t,n){if(e.length<2)return"";let i=g(await n.evalExpr(e[0])),a=Math.floor(C(await n.evalExpr(e[1])))-1;if(e.length>=3){let s=Math.floor(C(await n.evalExpr(e[2])));return i.substr(Math.max(0,a),s)}return i.substr(Math.max(0,a))}async function _e(e,t,n){if(e.length<2)return 0;let i=g(await n.evalExpr(e[0])),a=g(await n.evalExpr(e[1])),s=i.indexOf(a);return s===-1?0:s+1}async function Ge(e,t,n){if(e.length<2)return 0;let i=g(await n.evalExpr(e[0])),a=e[1];if(a.type!=="variable")return 0;let s=a.name,o=t.FS;if(e.length>=3){let u=e[2];if(u.type==="regex")o=A(u.pattern);else{let N=g(await n.evalExpr(u));o=N===" "?A("\\s+"):N}}else t.FS===" "&&(o=A("\\s+"));let l=typeof o=="string"?i.split(o):o.split(i);t.arrays[s]=Object.create(null);for(let u=0;u<l.length;u++)t.arrays[s][String(u+1)]=l[u];return l.length}async function De(e,t,n){if(e.length<2)return 0;let i=await x(e[0],n),a=g(await n.evalExpr(e[1])),s=await ue(e[2],n),o=he(s,t);try{let u=A(i).replace(o,fe(a)),N=u!==o?1:0;return pe(s,u,t),N}catch{return 0}}async function Ue(e,t,n){if(e.length<2)return 0;let i=await x(e[0],n),a=g(await n.evalExpr(e[1])),s=await ue(e[2],n),o=he(s,t);try{let l=A(i,"g"),u=l.match(o),N=u?u.length:0,k=l.replace(o,fe(a));return pe(s,k,t),N}catch{return 0}}function fe(e){return t=>{let n="",i=0;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length){let a=e[i+1];a==="&"?(n+="&",i+=2):a==="\\"?(n+="\\",i+=2):(n+=e[i+1],i+=2)}else e[i]==="&"?(n+=t,i++):(n+=e[i],i++);return n}}async function xe(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let i=g(await n.evalExpr(e[0])),a=await x(e[1],n);try{let o=A(a).exec(i);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function Be(e,t,n){if(e.length<3)return"";let i=await x(e[0],n),a=g(await n.evalExpr(e[1])),s=g(await n.evalExpr(e[2])),o=e.length>=4?g(await n.evalExpr(e[3])):t.line;try{let l=s.toLowerCase()==="g",u=l?0:parseInt(s,10)||1;if(l)return A(i,"g").replace(o,(k,...y)=>le(a,k,y.slice(0,-2)));{let N=0;return A(i,"g").replace(o,(y,...w)=>(N++,N===u?le(a,y,w.slice(0,-2)):y))}}catch{return o}}function le(e,t,n){let i="",a=0;for(;a<e.length;)if(e[a]==="\\"&&a+1<e.length){let s=e[a+1];if(s==="&")i+="&",a+=2;else if(s==="0")i+=t,a+=2;else if(s>="1"&&s<="9"){let o=parseInt(s,10)-1;i+=n[o]||"",a+=2}else s==="n"?(i+=`
|
|
3
|
+
`,a+=2):s==="t"?(i+=" ",a+=2):(i+=s,a+=2)}else e[a]==="&"?(i+=t,a++):(i+=e[a],a++);return i}async function He(e,t,n){return e.length===0?"":g(await n.evalExpr(e[0])).toLowerCase()}async function $e(e,t,n){return e.length===0?"":g(await n.evalExpr(e[0])).toUpperCase()}async function We(e,t,n){if(e.length===0)return"";let i=g(await n.evalExpr(e[0])),a=[];for(let s=1;s<e.length;s++)a.push(await n.evalExpr(e[s]));return B(i,a)}async function Ve(e,t,n){return e.length===0?0:Math.floor(C(await n.evalExpr(e[0])))}async function Ke(e,t,n){return e.length===0?0:Math.sqrt(C(await n.evalExpr(e[0])))}async function Xe(e,t,n){return e.length===0?0:Math.sin(C(await n.evalExpr(e[0])))}async function je(e,t,n){return e.length===0?0:Math.cos(C(await n.evalExpr(e[0])))}async function ze(e,t,n){let i=e.length>0?C(await n.evalExpr(e[0])):0,a=e.length>1?C(await n.evalExpr(e[1])):0;return Math.atan2(i,a)}async function Qe(e,t,n){return e.length===0?0:Math.log(C(await n.evalExpr(e[0])))}async function qe(e,t,n){return e.length===0?1:Math.exp(C(await n.evalExpr(e[0])))}function Je(e,t,n){return t.random?t.random():Math.random()}async function Ze(e,t,n){let i=e.length>0?C(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=i,i}function Ye(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function q(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var L=1e4;function B(e,t){let n=0,i="",a=0;for(;a<e.length;)if(e[a]==="%"&&a+1<e.length){let s=a+1,o="",l="",u="",N,k=s;for(;s<e.length&&/\d/.test(e[s]);)s++;s>k&&e[s]==="$"?(N=parseInt(e.substring(k,s),10)-1,s++):s=k;let y=()=>{if(s<e.length){if(s+1<e.length&&(e[s]==="h"&&e[s+1]==="h"||e[s]==="l"&&e[s+1]==="l")){s+=2;return}/[lzjh]/.test(e[s])&&s++}};for(;s<e.length&&/[-+ #0]/.test(e[s]);)o+=e[s++];if(e[s]==="*"){let c=t[n++],p=c!==void 0?Math.floor(Number(c)):0;p<0?(o+="-",l=String(Math.min(-p,L))):l=String(Math.min(p,L)),s++}else for(;s<e.length&&/\d/.test(e[s]);)l+=e[s++];if(l&&parseInt(l,10)>L&&(l=String(L)),e[s]==="."){if(s++,e[s]==="*"){let c=t[n++];u=String(Math.min(c!==void 0?Math.floor(Number(c)):0,L)),s++}else for(;s<e.length&&/\d/.test(e[s]);)u+=e[s++];u&&parseInt(u,10)>L&&(u=String(L))}y();let w=e[s],I=t[N!==void 0?N:n];switch(w){case"s":{let c=I!==void 0?String(I):"";if(u&&(c=c.substring(0,parseInt(u,10))),l){let p=parseInt(l,10);o.includes("-")?c=c.padEnd(p):c=c.padStart(p)}i+=c,N===void 0&&n++;break}case"d":case"i":{let c=I!==void 0?Math.floor(Number(I)):0;Number.isNaN(c)&&(c=0);let p=c<0,E=Math.abs(c).toString();if(u){let b=parseInt(u,10);E=E.padStart(b,"0")}let d="";p?d="-":o.includes("+")?d="+":o.includes(" ")&&(d=" ");let R=d+E;if(l){let b=parseInt(l,10);o.includes("-")?R=R.padEnd(b):o.includes("0")&&!u?R=d+E.padStart(b-d.length,"0"):R=R.padStart(b)}i+=R,N===void 0&&n++;break}case"f":{let c=I!==void 0?Number(I):0;Number.isNaN(c)&&(c=0);let p=u?parseInt(u,10):6,E=c.toFixed(p);if(l){let d=parseInt(l,10);o.includes("-")?E=E.padEnd(d):E=E.padStart(d)}i+=E,N===void 0&&n++;break}case"e":case"E":{let c=I!==void 0?Number(I):0;Number.isNaN(c)&&(c=0);let p=u?parseInt(u,10):6,E=c.toExponential(p);if(w==="E"&&(E=E.toUpperCase()),l){let d=parseInt(l,10);o.includes("-")?E=E.padEnd(d):E=E.padStart(d)}i+=E,N===void 0&&n++;break}case"g":case"G":{let c=I!==void 0?Number(I):0;Number.isNaN(c)&&(c=0);let p=u?parseInt(u,10):6,E=c!==0?Math.floor(Math.log10(Math.abs(c))):0,d;if(c===0?d="0":E<-4||E>=p?(d=c.toExponential(p-1),w==="G"&&(d=d.toUpperCase())):d=c.toPrecision(p),d.includes(".")&&(d=d.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),d.includes("e")&&(d=d.replace(/\.?0+e/,"e")),l){let R=parseInt(l,10);o.includes("-")?d=d.padEnd(R):d=d.padStart(R)}i+=d,N===void 0&&n++;break}case"x":case"X":{let c=I!==void 0?Math.floor(Number(I)):0;Number.isNaN(c)&&(c=0);let p=Math.abs(c).toString(16);if(w==="X"&&(p=p.toUpperCase()),u){let R=parseInt(u,10);p=p.padStart(R,"0")}let E=c<0?"-":"",d=E+p;if(l){let R=parseInt(l,10);o.includes("-")?d=d.padEnd(R):o.includes("0")&&!u?d=E+p.padStart(R-E.length,"0"):d=d.padStart(R)}i+=d,N===void 0&&n++;break}case"o":{let c=I!==void 0?Math.floor(Number(I)):0;Number.isNaN(c)&&(c=0);let p=Math.abs(c).toString(8);if(u){let R=parseInt(u,10);p=p.padStart(R,"0")}let E=c<0?"-":"",d=E+p;if(l){let R=parseInt(l,10);o.includes("-")?d=d.padEnd(R):o.includes("0")&&!u?d=E+p.padStart(R-E.length,"0"):d=d.padStart(R)}i+=d,N===void 0&&n++;break}case"c":{typeof I=="number"?i+=String.fromCharCode(I):i+=String(I??"").charAt(0)||"",N===void 0&&n++;break}case"%":i+="%";break;default:i+=e.substring(a,s+1)}a=s+1}else if(e[a]==="\\"&&a+1<e.length){let s=e[a+1];switch(s){case"n":i+=`
|
|
4
|
+
`;break;case"t":i+=" ";break;case"r":i+="\r";break;case"\\":i+="\\";break;default:i+=s}a+=2}else i+=e[a++];return i}var de=new Map([["length",Te],["substr",Fe],["index",_e],["split",Ge],["sub",De],["gsub",Ue],["match",xe],["gensub",Be],["tolower",He],["toupper",$e],["sprintf",We],["int",Ve],["sqrt",Ke],["sin",Xe],["cos",je],["atan2",ze],["log",Qe],["exp",qe],["rand",Je],["srand",Ze],["system",Ye("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",q("systime")],["mktime",q("mktime")],["strftime",q("strftime")]]);function v(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function m(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function S(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function J(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function G(e,t){try{return A(e).test(t)}catch{return!1}}function Ee(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function H(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Z(e,t,n){if(t===0)e.line=S(n),e.fields=Ee(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=S(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function T(e,t){e.line=t,e.fields=Ee(e,t),e.NF=e.fields.length}function Ne(e,t){if(e.FS=t,t===" ")e.fieldSep=new P(/\s+/);else try{e.fieldSep=A(t)}catch{e.fieldSep=A(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function $(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 F(e,t,n){switch(t){case"FS":Ne(e,S(n));return;case"OFS":e.OFS=S(n);return;case"ORS":e.ORS=S(n);return;case"OFMT":e.OFMT=S(n);return;case"NR":e.NR=Math.floor(m(n));return;case"NF":{let i=Math.floor(m(n));if(i<e.NF)e.fields=e.fields.slice(0,i),e.line=e.fields.join(e.OFS);else if(i>e.NF){for(;e.fields.length<i;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=i;return}case"FNR":e.FNR=Math.floor(m(n));return;case"FILENAME":e.FILENAME=S(n);return;case"RSTART":e.RSTART=Math.floor(m(n));return;case"RLENGTH":e.RLENGTH=Math.floor(m(n));return;case"SUBSEP":e.SUBSEP=S(n);return}e.vars[t]=n}function D(e,t){let n=t,i=new Set,a=e.arrayAliases.get(n);for(;a!==void 0&&!i.has(n);)i.add(n),n=a,a=e.arrayAliases.get(n);return n}function W(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let i=D(e,t);return e.arrays[i]?.[n]??""}function Y(e,t,n,i){let a=D(e,t);e.arrays[a]||(e.arrays[a]=Object.create(null)),e.arrays[a][n]=i}function Se(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let i=D(e,t);return e.arrays[i]?.[n]!==void 0}function ye(e,t,n){let i=D(e,t);e.arrays[i]&&delete e.arrays[i][n]}function Re(e,t){let n=D(e,t);delete e.arrays[n]}var ee=null;function me(e){ee=e}async function f(e,t){switch(e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return G(t.pattern,e.line)?1:0;case"field":return et(e,t);case"variable":return $(e,t.name);case"array_access":return tt(e,t);case"binary":return nt(e,t);case"unary":return st(e,t);case"ternary":return v(await f(e,t.condition))?await f(e,t.consequent):await f(e,t.alternate);case"call":return at(e,t.name,t.args);case"assignment":return ct(e,t);case"pre_increment":return lt(e,t.operand);case"pre_decrement":return ut(e,t.operand);case"post_increment":return ht(e,t.operand);case"post_decrement":return pt(e,t.operand);case"in":return ft(e,t.key,t.array);case"getline":return dt(e,t.variable,t.file,t.command);case"tuple":return St(e,t.elements);default:return""}}async function et(e,t){let n=Math.floor(m(await f(e,t.index)));return H(e,n)}async function tt(e,t){let n=S(await f(e,t.key));return W(e,t.array,n)}async function nt(e,t){let n=t.operator;if(n==="||")return v(await f(e,t.left))||v(await f(e,t.right))?1:0;if(n==="&&")return v(await f(e,t.left))&&v(await f(e,t.right))?1:0;if(n==="~"){let l=await f(e,t.left),u=t.right.type==="regex"?t.right.pattern:S(await f(e,t.right));try{return A(u).test(S(l))?1:0}catch{return 0}}if(n==="!~"){let l=await f(e,t.left),u=t.right.type==="regex"?t.right.pattern:S(await f(e,t.right));try{return A(u).test(S(l))?0:1}catch{return 1}}let i=await f(e,t.left),a=await f(e,t.right);if(n===" "){let l=S(i)+S(a);if(e.maxOutputSize>0&&l.length>e.maxOutputSize)throw new O(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return l}if(rt(n))return it(i,a,n);let s=m(i),o=m(a);return ce(s,o,n)}function rt(e){return["<","<=",">",">=","==","!="].includes(e)}function it(e,t,n){let i=J(e),a=J(t);if(i&&a){let l=m(e),u=m(t);switch(n){case"<":return l<u?1:0;case"<=":return l<=u?1:0;case">":return l>u?1:0;case">=":return l>=u?1:0;case"==":return l===u?1:0;case"!=":return l!==u?1:0}}let s=S(e),o=S(t);switch(n){case"<":return s<o?1:0;case"<=":return s<=o?1:0;case">":return s>o?1:0;case">=":return s>=o?1:0;case"==":return s===o?1:0;case"!=":return s!==o?1:0}return 0}async function st(e,t){let n=await f(e,t.operand);switch(t.operator){case"!":return v(n)?0:1;case"-":return-m(n);case"+":return+m(n);default:return n}}async function at(e,t,n){let i=de.get(t);if(i)return i(n,e,{evalExpr:s=>f(e,s)});let a=e.functions.get(t);return a?ot(e,a,n):""}async function ot(e,t,n){if(e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new O(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let i=Object.create(null);for(let o of t.params)i[o]=e.vars[o];let a=[];for(let o=0;o<t.params.length;o++){let l=t.params[o];if(o<n.length){let u=n[o];u.type==="variable"&&(e.arrayAliases.set(l,u.name),a.push(l));let N=await f(e,u);e.vars[l]=N}else e.vars[l]=""}e.hasReturn=!1,e.returnValue=void 0,ee&&await ee(e,t.body.statements);let s=e.returnValue??"";for(let o of t.params)i[o]!==void 0?e.vars[o]=i[o]:delete e.vars[o];for(let o of a)e.arrayAliases.delete(o);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,s}async function ct(e,t){let n=await f(e,t.value),i=t.target,a=t.operator,s;if(a==="=")s=n;else{let o;if(i.type==="field"){let N=Math.floor(m(await f(e,i.index)));o=H(e,N)}else if(i.type==="variable")o=$(e,i.name);else{let N=S(await f(e,i.key));o=W(e,i.array,N)}let l=m(o),u=m(n);switch(a){case"+=":s=l+u;break;case"-=":s=l-u;break;case"*=":s=l*u;break;case"/=":s=u!==0?l/u:0;break;case"%=":s=u!==0?l%u:0;break;case"^=":s=l**u;break;default:s=n}}if(i.type==="field"){let o=Math.floor(m(await f(e,i.index)));Z(e,o,s)}else if(i.type==="variable")F(e,i.name,s);else{let o=S(await f(e,i.key));Y(e,i.array,o,s)}return s}async function V(e,t,n,i){let a;if(t.type==="field"){let s=Math.floor(m(await f(e,t.index)));a=m(H(e,s)),Z(e,s,a+n)}else if(t.type==="variable")a=m($(e,t.name)),F(e,t.name,a+n);else{let s=S(await f(e,t.key));a=m(W(e,t.array,s)),Y(e,t.array,s,a+n)}return i?a+n:a}async function lt(e,t){return V(e,t,1,!0)}async function ut(e,t){return V(e,t,-1,!0)}async function ht(e,t){return V(e,t,1,!1)}async function pt(e,t){return V(e,t,-1,!1)}async function ft(e,t,n){let i;if(t.type==="tuple"){let a=[];for(let s of t.elements)a.push(S(await f(e,s)));i=a.join(e.SUBSEP)}else i=S(await f(e,t));return Se(e,n,i)?1:0}async function dt(e,t,n,i){if(i)return Et(e,t,i);if(n)return Nt(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let a=e.lineIndex+1;if(a>=e.lines.length)return 0;let s=e.lines[a];return t?F(e,t,s):T(e,s),e.NR++,e.lineIndex=a,1}async function Et(e,t,n){if(!e.exec)return-1;let i=S(await f(e,n)),a=`__cmd_${i}`,s=`__cmdi_${i}`,o,l;if(e.vars[a]===void 0)try{o=(await e.exec(i)).stdout.split(`
|
|
5
|
+
`),o.length>0&&o[o.length-1]===""&&o.pop(),e.vars[a]=JSON.stringify(o),e.vars[s]=-1,l=-1}catch{return-1}else o=JSON.parse(e.vars[a]),l=e.vars[s];let u=l+1;if(u>=o.length)return 0;let N=o[u];return e.vars[s]=u,t?F(e,t,N):T(e,N),1}async function Nt(e,t,n){if(!e.fs||!e.cwd)return-1;let i=S(await f(e,n));if(i==="/dev/null")return 0;let a=e.fs.resolvePath(e.cwd,i),s=`__fc_${a}`,o=`__fi_${a}`,l,u;if(e.vars[s]===void 0)try{l=(await e.fs.readFile(a)).split(`
|
|
6
|
+
`),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[s]=JSON.stringify(l),e.vars[o]=-1,u=-1}catch{return-1}else l=JSON.parse(e.vars[s]),u=e.vars[o];let N=u+1;if(N>=l.length)return 0;let k=l[N];return e.vars[o]=N,t?F(e,t,k):T(e,k),1}async function St(e,t){if(t.length===0)return"";for(let n=0;n<t.length-1;n++)await f(e,t[n]);return f(e,t[t.length-1])}me(_);function te(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new O(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}async function _(e,t){for(let n of t)if(await M(e,n),yt(e))break}function yt(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function M(e,t){switch(e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await _(e,t.statements);break;case"expr_stmt":await f(e,t.expression);break;case"print":await Rt(e,t.args,t.output);break;case"printf":await mt(e,t.format,t.args,t.output);break;case"if":await At(e,t);break;case"while":await wt(e,t);break;case"do_while":await It(e,t);break;case"for":await gt(e,t);break;case"for_in":await vt(e,t);break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0,e.exitCode=t.code?Math.floor(m(await f(e,t.code))):0;break;case"return":e.hasReturn=!0,e.returnValue=t.value?await f(e,t.value):"";break;case"delete":await kt(e,t.target);break}}async function Rt(e,t,n){let i=[];for(let s of t){let o=await f(e,s);typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?i.push(String(o)):i.push(B(e.OFMT,[o])):i.push(S(o))}let a=i.join(e.OFS)+e.ORS;n?await Ae(e,n.redirect,n.file,a):(e.output+=a,te(e))}async function mt(e,t,n,i){let a=S(await f(e,t)),s=[];for(let l of n)s.push(await f(e,l));let o=B(a,s);i?await Ae(e,i.redirect,i.file,o):(e.output+=o,te(e))}async function Ae(e,t,n,i){if(!e.fs||!e.cwd){e.output+=i,te(e);return}let a=S(await f(e,n)),s=e.fs.resolvePath(e.cwd,a);t===">"?e.openedFiles.has(s)?await e.fs.appendFile(s,i):(await e.fs.writeFile(s,i),e.openedFiles.add(s)):(e.openedFiles.has(s)||e.openedFiles.add(s),await e.fs.appendFile(s,i))}async function At(e,t){v(await f(e,t.condition))?await M(e,t.consequent):t.alternate&&await M(e,t.alternate)}async function wt(e,t){let n=0;for(;v(await f(e,t.condition));){if(n++,n>e.maxIterations)throw new O(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await M(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function It(e,t){let n=0;do{if(n++,n>e.maxIterations)throw new O(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await M(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(v(await f(e,t.condition)))}async function gt(e,t){t.init&&await f(e,t.init);let n=0;for(;!t.condition||v(await f(e,t.condition));){if(n++,n>e.maxIterations)throw new O(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await M(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;t.update&&await f(e,t.update)}}async function vt(e,t){let n=e.arrays[t.array];if(n)for(let i of Object.keys(n)){if(e.vars[t.variable]=i,e.loopContinue=!1,await M(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function kt(e,t){if(t.type==="array_access"){let n=S(await f(e,t.key));ye(e,t.array,n)}else t.type==="variable"&&Re(e,t.name)}var U=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}execute(t){this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await _(this.ctx,t.action.statements),this.ctx.shouldExit))break}}async executeLine(t){if(!(!this.program||this.ctx.shouldExit)){T(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let i=this.program.rules[n];i.pattern?.type==="begin"||i.pattern?.type==="end"||await this.matchesRule(i,n)&&await _(this.ctx,i.action.statements)}}}async executeEnd(){if(this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await _(this.ctx,t.action.statements),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){let i=t.pattern;if(!i)return!0;switch(i.type){case"begin":case"end":return!1;case"regex_pattern":return G(i.pattern,this.ctx.line);case"expr_pattern":return v(await f(this.ctx,i.expression));case"range":{let a=await this.matchPattern(i.start),s=await this.matchPattern(i.end);return this.rangeStates[n]?(s&&(this.rangeStates[n]=!1),!0):a?(this.rangeStates[n]=!0,s&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(t.type){case"regex_pattern":return G(t.pattern,this.ctx.line);case"expr_pattern":return v(await f(this.ctx,t.expression));default:return!1}}};var r;(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(r||(r={}));var Ct=new Map([["BEGIN",r.BEGIN],["END",r.END],["if",r.IF],["else",r.ELSE],["while",r.WHILE],["do",r.DO],["for",r.FOR],["in",r.IN],["break",r.BREAK],["continue",r.CONTINUE],["next",r.NEXT],["nextfile",r.NEXTFILE],["exit",r.EXIT],["return",r.RETURN],["delete",r.DELETE],["function",r.FUNCTION],["print",r.PRINT],["printf",r.PRINTF],["getline",r.GETLINE]]);function Ot(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var K=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(r.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
|
|
7
|
+
`?(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)===`
|
|
8
|
+
`)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
|
|
9
|
+
`;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,i=this.peek();return i===`
|
|
10
|
+
`?(this.advance(),{type:r.NEWLINE,value:`
|
|
11
|
+
`,line:t,column:n}):i==='"'?this.readString():i==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(i)||i==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(i)||i==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,r.NEWLINE,r.SEMICOLON,r.LBRACE,r.RBRACE,r.LPAREN,r.LBRACKET,r.COMMA,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.AND,r.OR,r.NOT,r.MATCH,r.NOT_MATCH,r.QUESTION,r.COLON,r.LT,r.GT,r.LE,r.GE,r.EQ,r.NE,r.PLUS,r.MINUS,r.STAR,r.PERCENT,r.CARET,r.PRINT,r.PRINTF,r.IF,r.WHILE,r.DO,r.FOR,r.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let a=this.advance();switch(a){case"n":i+=`
|
|
12
|
+
`;break;case"t":i+=" ";break;case"r":i+="\r";break;case"f":i+="\f";break;case"b":i+="\b";break;case"v":i+="\v";break;case"a":i+="\x07";break;case"\\":i+="\\";break;case'"':i+='"';break;case"/":i+="/";break;case"x":{let s="";for(;s.length<2&&/[0-9a-fA-F]/.test(this.peek());)s+=this.advance();s.length>0?i+=String.fromCharCode(parseInt(s,16)):i+="x";break}default:if(/[0-7]/.test(a)){let s=a;for(;s.length<3&&/[0-7]/.test(this.peek());)s+=this.advance();i+=String.fromCharCode(parseInt(s,8))}else i+=a}}else i+=this.advance();return this.peek()==='"'&&this.advance(),{type:r.STRING,value:i,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")i+=this.advance(),this.pos<this.input.length&&(i+=this.advance());else{if(this.peek()===`
|
|
13
|
+
`)break;i+=this.advance()}return this.peek()==="/"&&this.advance(),i=Ot(i),{type:r.REGEX,value:i,line:t,column:n}}readNumber(){let t=this.line,n=this.column,i="";for(;this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(i+=this.advance();this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(i+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(i+=this.advance());this.isDigit(this.peek());)i+=this.advance();return{type:r.NUMBER,value:parseFloat(i),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,i="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)i+=this.advance();let a=Ct.get(i);return a!==void 0?{type:a,value:i,line:t,column:n}:{type:r.IDENT,value:i,line:t,column:n}}readOperator(){let t=this.line,n=this.column,i=this.advance(),a=this.peek();switch(i){case"+":return a==="+"?(this.advance(),{type:r.INCREMENT,value:"++",line:t,column:n}):a==="="?(this.advance(),{type:r.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:r.PLUS,value:"+",line:t,column:n};case"-":return a==="-"?(this.advance(),{type:r.DECREMENT,value:"--",line:t,column:n}):a==="="?(this.advance(),{type:r.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:r.MINUS,value:"-",line:t,column:n};case"*":return a==="*"?(this.advance(),{type:r.CARET,value:"**",line:t,column:n}):a==="="?(this.advance(),{type:r.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:r.STAR,value:"*",line:t,column:n};case"/":return a==="="?(this.advance(),{type:r.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:r.SLASH,value:"/",line:t,column:n};case"%":return a==="="?(this.advance(),{type:r.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:r.PERCENT,value:"%",line:t,column:n};case"^":return a==="="?(this.advance(),{type:r.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:r.CARET,value:"^",line:t,column:n};case"=":return a==="="?(this.advance(),{type:r.EQ,value:"==",line:t,column:n}):{type:r.ASSIGN,value:"=",line:t,column:n};case"!":return a==="="?(this.advance(),{type:r.NE,value:"!=",line:t,column:n}):a==="~"?(this.advance(),{type:r.NOT_MATCH,value:"!~",line:t,column:n}):{type:r.NOT,value:"!",line:t,column:n};case"<":return a==="="?(this.advance(),{type:r.LE,value:"<=",line:t,column:n}):{type:r.LT,value:"<",line:t,column:n};case">":return a==="="?(this.advance(),{type:r.GE,value:">=",line:t,column:n}):a===">"?(this.advance(),{type:r.APPEND,value:">>",line:t,column:n}):{type:r.GT,value:">",line:t,column:n};case"&":return a==="&"?(this.advance(),{type:r.AND,value:"&&",line:t,column:n}):{type:r.IDENT,value:"&",line:t,column:n};case"|":return a==="|"?(this.advance(),{type:r.OR,value:"||",line:t,column:n}):{type:r.PIPE,value:"|",line:t,column:n};case"~":return{type:r.MATCH,value:"~",line:t,column:n};case"?":return{type:r.QUESTION,value:"?",line:t,column:n};case":":return{type:r.COLON,value:":",line:t,column:n};case",":return{type:r.COMMA,value:",",line:t,column:n};case";":return{type:r.SEMICOLON,value:";",line:t,column:n};case"(":return{type:r.LPAREN,value:"(",line:t,column:n};case")":return{type:r.RPAREN,value:")",line:t,column:n};case"{":return{type:r.LBRACE,value:"{",line:t,column:n};case"}":return{type:r.RBRACE,value:"}",line:t,column:n};case"[":return{type:r.LBRACKET,value:"[",line:t,column:n};case"]":return{type:r.RBRACKET,value:"]",line:t,column:n};case"$":return{type:r.DOLLAR,value:"$",line:t,column:n};default:return{type:r.IDENT,value:i,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}};var h={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"};function ke(e){e.expect(h.PRINT);let t=[];if(e.check(h.NEWLINE)||e.check(h.SEMICOLON)||e.check(h.RBRACE)||e.check(h.PIPE)||e.check(h.GT)||e.check(h.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(X(e));e.check(h.COMMA);)e.advance(),t.push(X(e));let n;return e.check(h.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(h.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function X(e){return bt(e)?ne(e,!0):ne(e,!1)}function ne(e,t){let n=t?e.parseTernary():Lt(e);if(e.match(h.ASSIGN,h.PLUS_ASSIGN,h.MINUS_ASSIGN,h.STAR_ASSIGN,h.SLASH_ASSIGN,h.PERCENT_ASSIGN,h.CARET_ASSIGN)){let i=e.advance(),a=ne(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(i.value)??"=",target:n,value:a}}return n}function bt(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let i=e.tokens[n];if(i.type===h.LPAREN&&t++,i.type===h.RPAREN&&t--,i.type===h.QUESTION&&t===0)return!0;if(i.type===h.NEWLINE||i.type===h.SEMICOLON||i.type===h.RBRACE||i.type===h.COMMA||i.type===h.PIPE)return!1;n++}return!1}function Lt(e){let t=we(e);for(;e.check(h.OR);){e.advance();let n=we(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function we(e){let t=Ie(e);for(;e.check(h.AND);){e.advance();let n=Ie(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function Ie(e){let t=Mt(e);if(e.check(h.IN)){e.advance();let n=String(e.expect(h.IDENT).value);return{type:"in",key:t,array:n}}return t}function Mt(e){let t=ge(e);for(;Pt(e)&&!Tt(e);){let n=ge(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function ge(e){let t=ve(e);for(;e.match(h.MATCH,h.NOT_MATCH);){let n=e.advance().type===h.MATCH?"~":"!~",i=ve(e);t={type:"binary",operator:n,left:t,right:i}}return t}function ve(e){let t=e.parseAddSub();for(;e.match(h.LT,h.LE,h.GE,h.EQ,h.NE);){let n=e.advance(),i=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}function Pt(e){return e.match(h.NUMBER,h.STRING,h.IDENT,h.DOLLAR,h.LPAREN,h.NOT,h.MINUS,h.PLUS,h.INCREMENT,h.DECREMENT)}function Tt(e){return e.match(h.AND,h.OR,h.QUESTION,h.ASSIGN,h.PLUS_ASSIGN,h.MINUS_ASSIGN,h.STAR_ASSIGN,h.SLASH_ASSIGN,h.PERCENT_ASSIGN,h.CARET_ASSIGN,h.COMMA,h.SEMICOLON,h.NEWLINE,h.RBRACE,h.RPAREN,h.RBRACKET,h.COLON,h.PIPE,h.APPEND,h.GT,h.IN)}function Ce(e){e.expect(h.PRINTF);let t=e.check(h.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():X(e),i=[];for(;e.check(h.COMMA);)e.advance(),t&&e.skipNewlines(),i.push(t?e.parseExpression():X(e));t&&(e.skipNewlines(),e.expect(h.RPAREN));let a;return e.check(h.GT)?(e.advance(),a={redirect:">",file:e.parsePrimary()}):e.check(h.APPEND)&&(e.advance(),a={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:i,output:a}}var j=class{tokens=[];pos=0;parse(t){let n=new K(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:r.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let i=this.current();throw new Error(n||`Expected ${t}, got ${i.type} at line ${i.line}:${i.column}`)}return this.advance()}skipNewlines(){for(;this.check(r.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(r.NEWLINE)||this.check(r.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(r.EOF)&&(this.skipNewlines(),!this.check(r.EOF));)this.check(r.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(r.FUNCTION);let t=this.expect(r.IDENT).value;this.expect(r.LPAREN);let n=[];if(!this.check(r.RPAREN))for(n.push(this.expect(r.IDENT).value);this.check(r.COMMA);)this.advance(),n.push(this.expect(r.IDENT).value);this.expect(r.RPAREN),this.skipNewlines();let i=this.parseBlock();return{name:t,params:n,body:i}}parseRule(){let t;if(this.check(r.BEGIN))this.advance(),t={type:"begin"};else if(this.check(r.END))this.advance(),t={type:"end"};else if(this.check(r.LBRACE))t=void 0;else if(this.check(r.REGEX)){let i=this.advance();if(this.check(r.AND)||this.check(r.OR)){let a={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:i.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(a)}}else{let a={type:"regex_pattern",pattern:i.value};if(this.check(r.COMMA)){this.advance();let s;this.check(r.REGEX)?s={type:"regex_pattern",pattern:this.advance().value}:s={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:a,end:s}}else t=a}}else{let a={type:"expr_pattern",expression:this.parseExpression()};if(this.check(r.COMMA)){this.advance();let s;this.check(r.REGEX)?s={type:"regex_pattern",pattern:this.advance().value}:s={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:a,end:s}}else t=a}this.skipNewlines();let n;return this.check(r.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(r.LBRACE),this.skipNewlines();let t=[];for(;!this.check(r.RBRACE)&&!this.check(r.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(r.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(r.SEMICOLON)||this.check(r.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(r.LBRACE))return this.parseBlock();if(this.check(r.IF))return this.parseIf();if(this.check(r.WHILE))return this.parseWhile();if(this.check(r.DO))return this.parseDoWhile();if(this.check(r.FOR))return this.parseFor();if(this.check(r.BREAK))return this.advance(),{type:"break"};if(this.check(r.CONTINUE))return this.advance(),{type:"continue"};if(this.check(r.NEXT))return this.advance(),{type:"next"};if(this.check(r.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(r.EXIT)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(r.RETURN)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(r.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(r.PRINT)?ke(this):this.check(r.PRINTF)?Ce(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(r.IF),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let i;return this.check(r.ELSE)&&(this.advance(),this.skipNewlines(),i=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:i}}parseWhile(){this.expect(r.WHILE),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(r.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(r.WHILE),this.expect(r.LPAREN);let n=this.parseExpression();return this.expect(r.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(r.FOR),this.expect(r.LPAREN),this.check(r.IDENT)){let s=this.advance();if(this.check(r.IN)){this.advance();let o=this.expect(r.IDENT).value;this.expect(r.RPAREN),this.skipNewlines();let l=this.parseStatement();return{type:"for_in",variable:s.value,array:o,body:l}}this.pos--}let t;this.check(r.SEMICOLON)||(t=this.parseExpression()),this.expect(r.SEMICOLON);let n;this.check(r.SEMICOLON)||(n=this.parseExpression()),this.expect(r.SEMICOLON);let i;this.check(r.RPAREN)||(i=this.parseExpression()),this.expect(r.RPAREN),this.skipNewlines();let a=this.parseStatement();return{type:"for",init:t,condition:n,update:i,body:a}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN)){let n=this.advance(),i=this.parseAssignment();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:{"=":"=","+=":"+=","-=":"-=","*=":"*=","/=":"/=","%=":"%=","^=":"^="}[n.value],target:t,value:i}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(r.QUESTION)){this.advance();let n=this.parseExpression();this.expect(r.COLON);let i=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:i}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(r.PIPE)){if(this.advance(),!this.check(r.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(r.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(r.IN)){this.advance();let n=this.expect(r.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(r.MATCH,r.NOT_MATCH);){let n=this.advance().type===r.MATCH?"~":"!~",i=this.parseComparison();t={type:"binary",operator:n,left:t,right:i}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(r.LT,r.LE,r.GT,r.GE,r.EQ,r.NE);){let n=this.advance(),i=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}canStartExpression(){return this.match(r.NUMBER,r.STRING,r.IDENT,r.DOLLAR,r.LPAREN,r.NOT,r.MINUS,r.PLUS,r.INCREMENT,r.DECREMENT)}isConcatTerminator(){return this.match(r.AND,r.OR,r.QUESTION,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.COMMA,r.SEMICOLON,r.NEWLINE,r.RBRACE,r.RPAREN,r.RBRACKET,r.COLON,r.PIPE,r.APPEND,r.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(r.PLUS,r.MINUS);){let n=this.advance().value,i=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:i}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(r.STAR,r.SLASH,r.PERCENT);){let n=this.advance(),i=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:i}}return t}parseUnary(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(r.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(r.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(r.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(r.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(r.RPAREN),t}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(r.COMMA)){let i=[n];for(;this.check(r.COMMA);)this.advance(),i.push(this.parseExpression());this.expect(r.RBRACKET);let a=i.reduce((s,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:s,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:a}}return this.expect(r.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(r.COMMA)){let n=[t];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"tuple",elements:n}}return this.expect(r.RPAREN),t}if(this.check(r.GETLINE)){this.advance();let t,n;return this.check(r.IDENT)&&(t=this.advance().value),this.check(r.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(r.RBRACKET);let i;if(n.length===1)i=n[0];else{i=n[0];for(let a=1;a<n.length;a++)i={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:n[a]}}return{type:"array_access",array:t,key:i}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}};var Ft={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"]},On={name:"awk",async execute(e,t){if(ae(e))return se(Ft);let n=new P(/\s+/),i=" ",a=Object.create(null),s=0;for(let c=0;c<e.length;c++){let p=e[c];if(p==="-F"&&c+1<e.length)i=re(e[++c]),n=Oe(i),s=c+1;else if(p.startsWith("-F"))i=re(p.slice(2)),n=Oe(i),s=c+1;else if(p==="-v"&&c+1<e.length){let E=e[++c],d=E.indexOf("=");if(d>0){let R=E.slice(0,d),b=re(E.slice(d+1));a[R]=b}s=c+1}else{if(p.startsWith("--"))return z("awk",p);if(p.startsWith("-")&&p.length>1){let E=p[1];if(E!=="F"&&E!=="v")return z("awk",`-${E}`);s=c+1}else if(!p.startsWith("-")){s=c;break}}}if(s>=e.length)return{stdout:"",stderr:`awk: missing program
|
|
14
|
+
`,exitCode:1};let o=e[s],l=e.slice(s+1),u=new j,N;try{N=u.parse(o)}catch(c){return{stdout:"",stderr:`awk: ${c instanceof Error?c.message:String(c)}
|
|
15
|
+
`,exitCode:1}}let k={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(c,p)=>{try{let E=await t.fs.readFile(c);await t.fs.writeFile(c,E+p)}catch{await t.fs.writeFile(c,p)}},resolvePath:t.fs.resolvePath.bind(t.fs)},y=Q({fieldSep:n,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:k,cwd:t.cwd,exec:t.exec?c=>t.exec(c,{cwd:t.cwd}):void 0,coverage:t.coverage});y.FS=i,y.vars=Object.assign(Object.create(null),a),y.ARGC=l.length+1,y.ARGV=Object.create(null),y.ARGV[0]="awk";for(let c=0;c<l.length;c++)y.ARGV[String(c+1)]=l[c];y.ENVIRON=oe(t.env);let w=new U(y);w.execute(N);let ie=N.rules.some(c=>c.pattern?.type!=="begin"&&c.pattern?.type!=="end"),I=N.rules.some(c=>c.pattern?.type==="end");try{if(await w.executeBegin(),y.shouldExit)return await w.executeEnd(),{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()};if(!ie&&!I)return{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()};let c=[];if(l.length>0)for(let p of l)try{let E=t.fs.resolvePath(t.cwd,p),R=(await t.fs.readFile(E)).split(`
|
|
16
|
+
`);R.length>0&&R[R.length-1]===""&&R.pop(),c.push({filename:p,lines:R})}catch{return{stdout:"",stderr:`awk: ${p}: No such file or directory
|
|
17
|
+
`,exitCode:1}}else{let p=t.stdin.split(`
|
|
18
|
+
`);p.length>0&&p[p.length-1]===""&&p.pop(),c.push({filename:"",lines:p})}for(let p of c){for(y.FILENAME=p.filename,y.FNR=0,y.lines=p.lines,y.lineIndex=-1,y.shouldNextFile=!1;y.lineIndex<p.lines.length-1&&(y.lineIndex++,await w.executeLine(p.lines[y.lineIndex]),!(y.shouldExit||y.shouldNextFile)););if(y.shouldExit)break}return await w.executeEnd(),{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()}}catch(c){let p=c instanceof Error?c.message:String(c),E=c instanceof O?O.EXIT_CODE:2;return{stdout:w.getOutput(),stderr:`awk: ${p}
|
|
19
|
+
`,exitCode:E}}}};function re(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
|
|
20
|
+
`).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function Oe(e){if(e===" ")return A("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return A(e)}catch{return A(be(e))}return A(be(e))}function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var bn={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{On as a,bn as b};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{a,b as o}from"./chunk-74CEPOFO.js";var l={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
|
|
2
|
+
s - seconds (default)
|
|
3
|
+
m - minutes
|
|
4
|
+
h - hours
|
|
5
|
+
d - days
|
|
6
|
+
|
|
7
|
+
NUMBER may be a decimal number.`,options:[" --help display this help and exit"]};function i(t){let s=t.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!s)return null;let e=parseFloat(s[1]);switch(s[2]||"s"){case"s":return e*1e3;case"m":return e*60*1e3;case"h":return e*60*60*1e3;case"d":return e*24*60*60*1e3;default:return null}}var d={name:"sleep",async execute(t,s){if(o(t))return a(l);if(t.length===0)return{stdout:"",stderr:`sleep: missing operand
|
|
8
|
+
`,exitCode:1};let e=0;for(let n of t){let r=i(n);if(r===null)return{stdout:"",stderr:`sleep: invalid time interval '${n}'
|
|
9
|
+
`,exitCode:1};e+=r}return s.sleep?await s.sleep(e):await new Promise(n=>setTimeout(n,e)),{stdout:"",stderr:"",exitCode:0}}},m={name:"sleep",flags:[],needsArgs:!0};export{d as a,m as b};
|