just-bash 2.9.4 → 2.9.6
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-PWEGD656.js +2 -0
- package/dist/bin/chunks/base64-YXBFJFHG.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/chunks/chunk-A4442AOC.js +6 -0
- package/dist/bin/chunks/chunk-BARKRZDC.js +6 -0
- 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-CHB75QIN.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/{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/sed-E4QAUCYQ.js → chunks/chunk-FEBB4TFH.js} +36 -36
- package/dist/bin/chunks/chunk-FLPVVSN5.js +5 -0
- 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-K7XSYP4L.js +21 -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-B3E7BBYK.js → chunk-LS25HZNJ.js} +41 -41
- package/dist/bin/chunks/chunk-MAVV76T4.js +2 -0
- package/dist/bin/{shell/chunks/xan-QLNZCWIG.js → chunks/chunk-MNNOATCV.js} +17 -17
- 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/{shell/chunks/rg-IZR5557M.js → chunks/chunk-Q4QFIAHB.js} +9 -9
- package/dist/bin/chunks/chunk-QEBPVWVB.js +13 -0
- 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-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-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-TL4Q62VX.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-GELILQAH.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-CXQ33VMW.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-WNL6TIIN.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-FMSZPFX4.js +2 -0
- package/dist/bin/chunks/xargs-YWPEV2QC.js +2 -0
- package/dist/bin/chunks/yq-WUJ5JNDT.js +2 -0
- package/dist/bin/just-bash.js +200 -198
- package/dist/bin/shell/chunks/alias-3GODYSFD.js +2 -0
- package/dist/bin/shell/chunks/awk2-PWEGD656.js +2 -0
- package/dist/bin/shell/chunks/base64-YXBFJFHG.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/shell/chunks/chunk-A4442AOC.js +6 -0
- package/dist/bin/shell/chunks/chunk-BARKRZDC.js +6 -0
- 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-CHB75QIN.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/{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/sed-E4QAUCYQ.js → shell/chunks/chunk-FEBB4TFH.js} +36 -36
- package/dist/bin/shell/chunks/chunk-FLPVVSN5.js +5 -0
- 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-K7XSYP4L.js +21 -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-B3E7BBYK.js → chunk-LS25HZNJ.js} +41 -41
- package/dist/bin/shell/chunks/chunk-MAVV76T4.js +2 -0
- package/dist/bin/{chunks/xan-QLNZCWIG.js → shell/chunks/chunk-MNNOATCV.js} +17 -17
- 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/{chunks/rg-IZR5557M.js → shell/chunks/chunk-Q4QFIAHB.js} +9 -9
- package/dist/bin/shell/chunks/chunk-QEBPVWVB.js +13 -0
- 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-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-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-TL4Q62VX.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-GELILQAH.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-CXQ33VMW.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-WNL6TIIN.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-FMSZPFX4.js +2 -0
- package/dist/bin/shell/chunks/xargs-YWPEV2QC.js +2 -0
- package/dist/bin/shell/chunks/yq-WUJ5JNDT.js +2 -0
- package/dist/bin/shell/shell.js +192 -190
- package/dist/bundle/browser.js +640 -638
- package/dist/bundle/chunks/alias-JE7RI5QX.js +1 -0
- package/dist/bundle/chunks/awk2-BDPR2JPZ.js +1 -0
- package/dist/bundle/chunks/base64-A3SGWC34.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-2OCD45J4.js +12 -0
- package/dist/bundle/chunks/chunk-3KWUDRIP.js +20 -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/{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-FRDGR5VK.js +5 -0
- package/dist/bundle/chunks/chunk-GCTKCWKD.js +3 -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-IBFD7QQD.js +5 -0
- package/dist/bundle/chunks/chunk-IKZ5LEGB.js +6 -0
- package/dist/bundle/chunks/{xan-EN6JZQ3T.js → chunk-JI3KJ32H.js} +17 -17
- 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-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/{chunk-RERCNF7Z.js → chunk-UJXASUXJ.js} +41 -41
- 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/chunk-VYOJP4TV.js +13 -0
- package/dist/bundle/chunks/{tar-5V4PGBFL.js → chunk-VZWXH2PZ.js} +6 -6
- package/dist/bundle/chunks/{sed-4K5HXNXE.js → chunk-WACZHM4L.js} +36 -36
- 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/{yq-JD6M7T5A.js → chunk-XMDVFEVC.js} +24 -24
- 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-L4NRX44B.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-5KOYWCUN.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-OJYNICKX.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-RXIECPPB.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-Z6KVJKEE.js +1 -0
- package/dist/bundle/chunks/xargs-OGI2NN6J.js +1 -0
- package/dist/bundle/chunks/yq-FD5F3WOJ.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/chunk-HSNUCOOQ.js +0 -6
- 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/chunk-HSNUCOOQ.js +0 -6
- 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/chunk-WQCJYUEW.js +0 -5
- 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,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{c as d}from"./chunk-4PRVMER6.js";import{a as h,b as l}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var u={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},C={name:"bash",async execute(e,t){if(l(e))return h(u);if(e[0]==="-c"&&e.length>=2){let r=e[1],s=e[2]||"bash",c=e.slice(3);return i(r,s,c,t)}if(e.length===0)return t.stdin?.trim()?i(t.stdin,"bash",[],t):{stdout:"",stderr:"",exitCode:0};let n=e[0],o=e.slice(1);try{let r=t.fs.resolvePath(t.cwd,n),s=await t.fs.readFile(r);return i(s,n,o,t)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
|
|
3
|
-
`,exitCode:127}}}},b={name:"sh",async execute(e,t){if(l(e))return h({...u,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(e[0]==="-c"&&e.length>=2){let r=e[1],s=e[2]||"sh",c=e.slice(3);return i(r,s,c,t)}if(e.length===0)return t.stdin?.trim()?i(t.stdin,"sh",[],t):{stdout:"",stderr:"",exitCode:0};let n=e[0],o=e.slice(1);try{let r=t.fs.resolvePath(t.cwd,n),s=await t.fs.readFile(r);return i(s,n,o,t)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
|
|
4
|
-
`,exitCode:127}}}};async function i(e,t,n,o){if(!o.exec)return{stdout:"",stderr:`bash: internal error: exec function not available
|
|
5
|
-
`,exitCode:1};let r=d(o.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((a,m)=>{r[String(m+1)]=a});let s=e;if(s.startsWith("#!")){let a=s.indexOf(`
|
|
6
|
-
`);a!==-1&&(s=s.slice(a+1))}return await o.exec(s,{env:r,cwd:o.cwd})}export{C as bashCommand,b as shCommand};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as p}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as d}from"./chunk-JBABAK44.js";import{a as c,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var f={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},b={number:{short:"n",long:"number",type:"boolean"}},w={name:"cat",async execute(t,r){if(m(t))return c(f);let e=d("cat",t,b);if(!e.ok)return e.error;let s=e.result.flags.number,o=e.result.positional,a=await p(r,o,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),n="",i=1;for(let{content:l}of a.files)if(s){let u=h(l,i);n+=u.content,i=u.nextLineNumber}else n+=l;return{stdout:n,stderr:a.stderr,exitCode:a.exitCode}}};function h(t,r){let e=t.split(`
|
|
3
|
-
`),s=t.endsWith(`
|
|
4
|
-
`),o=s?e.slice(0,-1):e;return{content:o.map((n,i)=>`${String(r+i).padStart(6," ")} ${n}`).join(`
|
|
5
|
-
`)+(s?`
|
|
6
|
-
`:""),nextLineNumber:r+o.length}}export{w as catCommand};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as g,b as $}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var C={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},R={name:"chmod",async execute(s,a){if($(s))return g(C);if(s.length<2)return{stdout:"",stderr:`chmod: missing operand
|
|
3
|
-
`,exitCode:1};let e=!1,c=!1,o=0;for(;o<s.length&&s[o].startsWith("-");){let t=s[o];if(t==="-R"||t==="--recursive")e=!0,o++;else if(t==="-v"||t==="--verbose")c=!0,o++;else if(t==="--"){o++;break}else{if(/^[+-]?[rwxugo]+/.test(t)||/^\d+$/.test(t))break;if(/^-[Rv]+$/.test(t)){t.includes("R")&&(e=!0),t.includes("v")&&(c=!0),o++;continue}return{stdout:"",stderr:`chmod: invalid option -- '${t.slice(1)}'
|
|
4
|
-
`,exitCode:1}}}if(s.length-o<2)return{stdout:"",stderr:`chmod: missing operand
|
|
5
|
-
`,exitCode:1};let n=s[o],d=s.slice(o+1),r=/^[0-7]+$/.test(n),i;if(r)i=parseInt(n,8);else try{p(n,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${n}'
|
|
6
|
-
`,exitCode:1}}let f="",l="",u=!1;for(let t of d){let h=a.fs.resolvePath(a.cwd,t);try{let m;if(r&&i!==void 0)m=i;else{let w=await a.fs.stat(h);m=p(n,w.mode)}if(await a.fs.chmod(h,m),c&&(f+=`mode of '${t}' changed to ${m.toString(8).padStart(4,"0")}
|
|
7
|
-
`),e&&(await a.fs.stat(h)).isDirectory){let y=await v(a,h,r?i:void 0,r?void 0:n,c);f+=y}}catch{l+=`chmod: cannot access '${t}': No such file or directory
|
|
8
|
-
`,u=!0}}return{stdout:f,stderr:l,exitCode:u?1:0}}};async function v(s,a,e,c,o){let n="",d=await s.fs.readdir(a);for(let r of d){let i=a==="/"?`/${r}`:`${a}/${r}`,f;if(e!==void 0)f=e;else if(c!==void 0){let u=await s.fs.stat(i);f=p(c,u.mode)}else f=420;await s.fs.chmod(i,f),o&&(n+=`mode of '${i}' changed to ${f.toString(8).padStart(4,"0")}
|
|
9
|
-
`),(await s.fs.stat(i)).isDirectory&&(n+=await v(s,i,e,c,o))}return n}function p(s,a=420){if(/^[0-7]+$/.test(s))return parseInt(s,8);let e=a&4095,c=s.split(",");for(let o of c){let n=o.match(/^([ugoa]*)([+\-=])([rwxXst]*)$/);if(!n)throw new Error(`Invalid mode: ${s}`);let d=n[1]||"a",r=n[2],i=n[3];(d==="a"||d==="")&&(d="ugo");let f=0;i.includes("r")&&(f|=4),i.includes("w")&&(f|=2),(i.includes("x")||i.includes("X"))&&(f|=1);let l=0;i.includes("s")&&(d.includes("u")&&(l|=2048),d.includes("g")&&(l|=1024)),i.includes("t")&&(l|=512);for(let u of d){let t=0;u==="u"?t=6:u==="g"?t=3:u==="o"&&(t=0);let h=f<<t;r==="+"?e|=h:r==="-"?e&=~h:r==="="&&(e&=~(7<<t),e|=h)}r==="+"?e|=l:r==="-"?e&=~l:r==="="&&(i.includes("s")&&(d.includes("u")&&(e&=-2049,e|=l&2048),d.includes("g")&&(e&=-1025,e|=l&1024)),i.includes("t")&&(e&=-513,e|=l&512))}return e}export{R as chmodCommand};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as b,b as g,c as N,d as k,e as G}from"./chunk-UYBH3FNE.js";import{a as q,c as ut}from"./chunk-4PRVMER6.js";import{k as P}from"./chunk-K5IXNHO5.js";import{a as S}from"./chunk-SE4C7FJY.js";function X(t,r,e,n,p,i,u,c,s,f){switch(r){case"sort":return Array.isArray(t)?[[...t].sort(u)]:[null];case"sort_by":return!Array.isArray(t)||e.length===0?[null]:[[...t].sort((h,y)=>{let a=p(h,e[0],n)[0],l=p(y,e[0],n)[0];return u(a,l)})];case"bsearch":{if(!Array.isArray(t)){let h=t===null?"null":typeof t=="object"?"object":typeof t;throw new Error(`${h} (${JSON.stringify(t)}) cannot be searched from`)}return e.length===0?[null]:p(t,e[0],n).map(h=>{let y=0,a=t.length;for(;y<a;){let l=y+a>>>1;u(t[l],h)<0?y=l+1:a=l}return y<t.length&&u(t[y],h)===0?y:-y-1})}case"unique_by":{if(!Array.isArray(t)||e.length===0)return[null];let o=new Map;for(let y of t){let a=p(y,e[0],n)[0],l=JSON.stringify(a);o.has(l)||o.set(l,{item:y,key:a})}let h=[...o.values()];return h.sort((y,a)=>u(y.key,a.key)),[h.map(y=>y.item)]}case"group_by":{if(!Array.isArray(t)||e.length===0)return[null];let o=new Map;for(let h of t){let y=JSON.stringify(p(h,e[0],n)[0]);o.has(y)||o.set(y,[]),o.get(y)?.push(h)}return[[...o.values()]]}case"max":return Array.isArray(t)&&t.length>0?[t.reduce((o,h)=>u(o,h)>0?o:h)]:[null];case"max_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((o,h)=>{let y=p(o,e[0],n)[0],a=p(h,e[0],n)[0];return u(y,a)>0?o:h})];case"min":return Array.isArray(t)&&t.length>0?[t.reduce((o,h)=>u(o,h)<0?o:h)]:[null];case"min_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((o,h)=>{let y=p(o,e[0],n)[0],a=p(h,e[0],n)[0];return u(y,a)<0?o:h})];case"add":{let o=h=>{let y=h.filter(a=>a!==null);return y.length===0?null:y.every(a=>typeof a=="number")?y.reduce((a,l)=>a+l,0):y.every(a=>typeof a=="string")?y.join(""):y.every(a=>Array.isArray(a))?y.flat():y.every(a=>a&&typeof a=="object"&&!Array.isArray(a))?ut(...y):null};if(e.length>=1){let h=p(t,e[0],n);return[o(h)]}return Array.isArray(t)?[o(t)]:[null]}case"any":{if(e.length>=2){try{let o=i(t,e[0],n);for(let h of o)if(p(h,e[1],n).some(c))return[!0]}catch(o){if(o instanceof f)throw o}return[!1]}return e.length===1?Array.isArray(t)?[t.some(o=>c(p(o,e[0],n)[0]))]:[!1]:Array.isArray(t)?[t.some(c)]:[!1]}case"all":{if(e.length>=2){try{let o=i(t,e[0],n);for(let h of o)if(!p(h,e[1],n).some(c))return[!1]}catch(o){if(o instanceof f)throw o}return[!0]}return e.length===1?Array.isArray(t)?[t.every(o=>c(p(o,e[0],n)[0]))]:[!0]:Array.isArray(t)?[t.every(c)]:[!0]}case"select":return e.length===0?[t]:p(t,e[0],n).some(c)?[t]:[];case"map":return e.length===0||!Array.isArray(t)?[null]:[t.flatMap(h=>p(h,e[0],n))];case"map_values":{if(e.length===0)return[null];if(Array.isArray(t))return[t.flatMap(o=>p(o,e[0],n))];if(t&&typeof t=="object"){let o=Object.create(null);for(let[h,y]of Object.entries(t)){if(!b(h))continue;let a=p(y,e[0],n);a.length>0&&g(o,h,a[0])}return[o]}return[null]}case"has":{if(e.length===0)return[!1];let h=p(t,e[0],n)[0];return Array.isArray(t)&&typeof h=="number"?[h>=0&&h<t.length]:t&&typeof t=="object"&&typeof h=="string"?[N(t,h)]:[!1]}case"in":{if(e.length===0)return[!1];let h=p(t,e[0],n)[0];return Array.isArray(h)&&typeof t=="number"?[t>=0&&t<h.length]:h&&typeof h=="object"&&typeof t=="string"?[N(h,t)]:[!1]}case"contains":{if(e.length===0)return[!1];let o=p(t,e[0],n);return[s(t,o[0])]}case"inside":{if(e.length===0)return[!1];let o=p(t,e[0],n);return[s(o[0],t)]}default:return null}}function W(t,r,e,n,p,i,u,c){switch(r){case"first":if(e.length>0)try{let s=i(t,e[0],n);return s.length>0?[s[0]]:[]}catch(s){if(s instanceof c)throw s;return[]}return Array.isArray(t)&&t.length>0?[t[0]]:[null];case"last":if(e.length>0){let s=p(t,e[0],n);return s.length>0?[s[s.length-1]]:[]}return Array.isArray(t)&&t.length>0?[t[t.length-1]]:[null];case"nth":{if(e.length<1)return[null];let s=p(t,e[0],n);if(e.length>1){for(let o of s)if(o<0)throw new Error("nth doesn't support negative indices");let f;try{f=i(t,e[1],n)}catch(o){if(o instanceof c)throw o;f=[]}return s.flatMap(o=>{let h=o;return h<f.length?[f[h]]:[]})}return Array.isArray(t)?s.flatMap(f=>{let o=f;if(o<0)throw new Error("nth doesn't support negative indices");return o<t.length?[t[o]]:[null]}):[null]}case"range":{if(e.length===0)return[];let s=p(t,e[0],n);if(e.length===1){let y=[];for(let a of s){let l=a;for(let m=0;m<l;m++)y.push(m)}return y}let f=p(t,e[1],n);if(e.length===2){let y=[];for(let a of s)for(let l of f){let m=a,A=l;for(let E=m;E<A;E++)y.push(E)}return y}let o=p(t,e[2],n),h=[];for(let y of s)for(let a of f)for(let l of o){let m=y,A=a,E=l;if(E!==0)if(E>0)for(let w=m;w<A;w+=E)h.push(w);else for(let w=m;w>A;w+=E)h.push(w)}return h}case"limit":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let o=f;if(o<0)throw new Error("limit doesn't support negative count");if(o===0)return[];let h;try{h=i(t,e[1],n)}catch(y){if(y instanceof c)throw y;h=[]}return h.slice(0,o)});case"isempty":{if(e.length<1)return[!0];try{return[i(t,e[0],n).length===0]}catch(s){if(s instanceof c)throw s;return[!0]}}case"isvalid":{if(e.length<1)return[!0];try{return[p(t,e[0],n).length>0]}catch(s){if(s instanceof c)throw s;return[!1]}}case"skip":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let o=f;if(o<0)throw new Error("skip doesn't support negative count");return p(t,e[1],n).slice(o)});case"until":{if(e.length<2)return[t];let s=t,f=n.limits.maxIterations;for(let o=0;o<f;o++){if(p(s,e[0],n).some(u))return[s];let y=p(s,e[1],n);if(y.length===0)return[s];s=y[0]}throw new c(`jq until: too many iterations (${f}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(e.length<2)return[t];let s=[],f=t,o=n.limits.maxIterations;for(let h=0;h<o&&p(f,e[0],n).some(u);h++){s.push(f);let a=p(f,e[1],n);if(a.length===0)break;f=a[0]}if(s.length>=o)throw new c(`jq while: too many iterations (${o}), increase executionLimits.maxJqIterations`,"iterations");return s}case"repeat":{if(e.length===0)return[t];let s=[],f=t,o=n.limits.maxIterations;for(let h=0;h<o;h++){s.push(f);let y=p(f,e[0],n);if(y.length===0)break;f=y[0]}if(s.length>=o)throw new c(`jq repeat: too many iterations (${o}), increase executionLimits.maxJqIterations`,"iterations");return s}default:return null}}function Q(t,r,e,n,p){switch(r){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof t!="number")return[null];let i=new Date(t*1e3),u=i.getUTCFullYear(),c=i.getUTCMonth(),s=i.getUTCDate(),f=i.getUTCHours(),o=i.getUTCMinutes(),h=i.getUTCSeconds(),y=i.getUTCDay(),a=Date.UTC(u,0,1),l=Math.floor((i.getTime()-a)/(1440*60*1e3));return[[u,c,s,f,o,h,y,l]]}case"mktime":{if(!Array.isArray(t))throw new Error("mktime requires parsed datetime inputs");let[i,u,c,s=0,f=0,o=0]=t;if(typeof i!="number"||typeof u!="number")throw new Error("mktime requires parsed datetime inputs");let h=Date.UTC(i,u,c??1,s??0,f??0,o??0);return[Math.floor(h/1e3)]}case"strftime":{if(e.length===0)return[null];let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strftime/1 requires a string format");let c;if(typeof t=="number")c=new Date(t*1e3);else if(Array.isArray(t)){let[y,a,l,m=0,A=0,E=0]=t;if(typeof y!="number"||typeof a!="number")throw new Error("strftime/1 requires parsed datetime inputs");c=new Date(Date.UTC(y,a,l??1,m??0,A??0,E??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=["January","February","March","April","May","June","July","August","September","October","November","December"],o=(y,a=2)=>String(y).padStart(a,"0");return[u.replace(/%Y/g,String(c.getUTCFullYear())).replace(/%m/g,o(c.getUTCMonth()+1)).replace(/%d/g,o(c.getUTCDate())).replace(/%H/g,o(c.getUTCHours())).replace(/%M/g,o(c.getUTCMinutes())).replace(/%S/g,o(c.getUTCSeconds())).replace(/%A/g,s[c.getUTCDay()]).replace(/%B/g,f[c.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(e.length===0)return[null];if(typeof t!="string")throw new Error("strptime/1 requires a string input");let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strptime/1 requires a string format");if(u==="%Y-%m-%dT%H:%M:%SZ"){let s=t.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(s){let[,f,o,h,y,a,l]=s.map(Number),m=new Date(Date.UTC(f,o-1,h,y,a,l)),A=m.getUTCDay(),E=Date.UTC(f,0,1),w=Math.floor((m.getTime()-E)/(1440*60*1e3));return[[f,o-1,h,y,a,l,A,w]]}}let c=new Date(t);if(!Number.isNaN(c.getTime())){let s=c.getUTCFullYear(),f=c.getUTCMonth(),o=c.getUTCDate(),h=c.getUTCHours(),y=c.getUTCMinutes(),a=c.getUTCSeconds(),l=c.getUTCDay(),m=Date.UTC(s,0,1),A=Math.floor((c.getTime()-m)/(1440*60*1e3));return[[s,f,o,h,y,a,l,A]]}throw new Error(`Cannot parse date: ${t}`)}case"fromdate":{if(typeof t!="string")throw new Error("fromdate requires a string input");let i=new Date(t);if(Number.isNaN(i.getTime()))throw new Error(`date "${t}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof t!="number")throw new Error("todate requires a number input");return[new Date(t*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}function O(t){return t!==!1&&t!==null}function R(t,r){return JSON.stringify(t)===JSON.stringify(r)}function D(t,r){return typeof t=="number"&&typeof r=="number"?t-r:typeof t=="string"&&typeof r=="string"?t.localeCompare(r):0}function Z(t,r){let e=k(t);for(let n of Object.keys(r))b(n)&&(N(e,n)&&e[n]&&typeof e[n]=="object"&&!Array.isArray(e[n])&&r[n]&&typeof r[n]=="object"&&!Array.isArray(r[n])?g(e,n,Z(e[n],r[n])):g(e,n,r[n]));return e}function M(t,r=3e3){let e=0,n=t;for(;e<r;)if(Array.isArray(n)){if(n.length===0)return e+1;n=n[0],e++}else if(n!==null&&typeof n=="object"){let p=Object.keys(n);if(p.length===0)return e+1;n=n[p[0]],e++}else return e;return e}function L(t,r){let e=i=>i===null?0:typeof i=="boolean"?1:typeof i=="number"?2:typeof i=="string"?3:Array.isArray(i)?4:typeof i=="object"?5:6,n=e(t),p=e(r);if(n!==p)return n-p;if(typeof t=="number"&&typeof r=="number")return t-r;if(typeof t=="string"&&typeof r=="string")return t.localeCompare(r);if(typeof t=="boolean"&&typeof r=="boolean")return(t?1:0)-(r?1:0);if(Array.isArray(t)&&Array.isArray(r)){for(let i=0;i<Math.min(t.length,r.length);i++){let u=L(t[i],r[i]);if(u!==0)return u}return t.length-r.length}if(t&&r&&typeof t=="object"&&typeof r=="object"){let i=t,u=r,c=Object.keys(i).sort(),s=Object.keys(u).sort();for(let f=0;f<Math.min(c.length,s.length);f++){let o=c[f].localeCompare(s[f]);if(o!==0)return o}if(c.length!==s.length)return c.length-s.length;for(let f of c){let o=L(i[f],u[f]);if(o!==0)return o}}return 0}function _(t,r){if(R(t,r))return!0;if(typeof t=="string"&&typeof r=="string")return t.includes(r);if(Array.isArray(t)&&Array.isArray(r))return r.every(e=>t.some(n=>_(n,e)));if(t&&r&&typeof t=="object"&&typeof r=="object"&&!Array.isArray(t)&&!Array.isArray(r)){let e=t,n=r;return Object.keys(n).every(p=>N(e,p)&&_(e[p],n[p]))}return!1}var bt=2e3;function z(t,r,e){switch(r){case"@base64":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"utf-8").toString("base64")]:[btoa(t)]:[null];case"@base64d":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"base64").toString("utf-8")]:[atob(t)]:[null];case"@uri":return typeof t=="string"?[encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof t=="string"?[decodeURIComponent(t)]:[null];case"@csv":return Array.isArray(t)?[t.map(p=>{if(p===null)return"";if(typeof p=="boolean")return p?"true":"false";if(typeof p=="number")return String(p);let i=String(p);return i.includes(",")||i.includes('"')||i.includes(`
|
|
3
|
-
`)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).join(",")]:[null];case"@tsv":return Array.isArray(t)?[t.map(n=>String(n??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let n=e??bt;return M(t,n+1)>n?[null]:[JSON.stringify(t)]}case"@html":return typeof t=="string"?[t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")]:[null];case"@sh":return typeof t=="string"?[`'${t.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof t=="string"?[t]:t==null?[""]:[String(t)];default:return null}}function v(t,r,e,n,p,i){switch(r){case"index":return e.length===0?[null]:p(t,e[0],n).map(c=>{if(typeof t=="string"&&typeof c=="string"){if(c===""&&t==="")return null;let s=t.indexOf(c);return s>=0?s:null}if(Array.isArray(t)){if(Array.isArray(c)){for(let f=0;f<=t.length-c.length;f++){let o=!0;for(let h=0;h<c.length;h++)if(!i(t[f+h],c[h])){o=!1;break}if(o)return f}return null}let s=t.findIndex(f=>i(f,c));return s>=0?s:null}return null});case"rindex":return e.length===0?[null]:p(t,e[0],n).map(c=>{if(typeof t=="string"&&typeof c=="string"){let s=t.lastIndexOf(c);return s>=0?s:null}if(Array.isArray(t)){if(Array.isArray(c)){for(let s=t.length-c.length;s>=0;s--){let f=!0;for(let o=0;o<c.length;o++)if(!i(t[s+o],c[o])){f=!1;break}if(f)return s}return null}for(let s=t.length-1;s>=0;s--)if(i(t[s],c))return s;return null}return null});case"indices":return e.length===0?[[]]:p(t,e[0],n).map(c=>{let s=[];if(typeof t=="string"&&typeof c=="string"){let f=t.indexOf(c);for(;f!==-1;)s.push(f),f=t.indexOf(c,f+1)}else if(Array.isArray(t))if(Array.isArray(c)){let f=c.length;if(f===0)for(let o=0;o<=t.length;o++)s.push(o);else for(let o=0;o<=t.length-f;o++){let h=!0;for(let y=0;y<f;y++)if(!i(t[o+y],c[y])){h=!1;break}h&&s.push(o)}}else for(let f=0;f<t.length;f++)i(t[f],c)&&s.push(f);return s});default:return null}}function tt(t,r,e,n,p){switch(r){case"fabs":case"abs":return typeof t=="number"?[Math.abs(t)]:typeof t=="string"?[t]:[null];case"exp10":return typeof t=="number"?[10**t]:[null];case"exp2":return typeof t=="number"?[2**t]:[null];case"pow":{if(e.length<2)return[null];let i=p(t,e[0],n),u=p(t,e[1],n),c=i[0],s=u[0];return typeof c!="number"||typeof s!="number"?[null]:[c**s]}case"atan2":{if(e.length<2)return[null];let i=p(t,e[0],n),u=p(t,e[1],n),c=i[0],s=u[0];return typeof c!="number"||typeof s!="number"?[null]:[Math.atan2(c,s)]}case"hypot":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.hypot(t,i)]}case"fma":{if(typeof t!="number"||e.length<2)return[null];let i=p(t,e[0],n)[0],u=p(t,e[1],n)[0];return[t*i+u]}case"copysign":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.sign(i)*Math.abs(t)]}case"drem":case"remainder":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[t-Math.round(t/i)*i]}case"fdim":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.max(0,t-i)]}case"fmax":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.max(t,i)]}case"fmin":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.min(t,i)]}case"ldexp":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[t*2**i]}case"scalbn":case"scalbln":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[t*2**i]}case"nearbyint":return typeof t=="number"?[Math.round(t)]:[null];case"logb":return typeof t=="number"?[Math.floor(Math.log2(Math.abs(t)))]:[null];case"significand":if(typeof t=="number"){let i=Math.floor(Math.log2(Math.abs(t)));return[t/2**i]}return[null];case"frexp":if(typeof t=="number"){if(t===0)return[[0,0]];let i=Math.floor(Math.log2(Math.abs(t)))+1;return[[t/2**i,i]]}return[null];case"modf":if(typeof t=="number"){let i=Math.trunc(t);return[[t-i,i]]}return[null];default:return null}}function et(t,r,e,n,p,i,u,c){switch(r){case"recurse":{if(e.length===0){let a=[],l=m=>{if(a.push(m),Array.isArray(m))for(let A of m)l(A);else if(m&&typeof m=="object")for(let A of Object.keys(m))l(m[A])};return l(t),a}let s=[],f=e.length>=2?e[1]:null,o=1e4,h=0,y=a=>{if(h++>o||f&&!p(a,f,n).some(i))return;s.push(a);let l=p(a,e[0],n);for(let m of l)m!=null&&y(m)};return y(t),s}case"recurse_down":return c(t,"recurse",e,n);case"walk":{if(e.length===0)return[t];let s=new WeakSet,f=o=>{if(o&&typeof o=="object"){if(s.has(o))return o;s.add(o)}let h;if(Array.isArray(o))h=o.map(f);else if(o&&typeof o=="object"){let a=Object.create(null);for(let[l,m]of Object.entries(o))b(l)&&g(a,l,f(m));h=a}else h=o;return p(h,e[0],n)[0]};return[f(t)]}case"transpose":{if(!Array.isArray(t))return[null];if(t.length===0)return[[]];let s=Math.max(...t.map(o=>Array.isArray(o)?o.length:0)),f=[];for(let o=0;o<s;o++)f.push(t.map(h=>Array.isArray(h)?h[o]:null));return[f]}case"combinations":{if(e.length>0){let h=p(t,e[0],n)[0];if(!Array.isArray(t)||h<0)return[];if(h===0)return[[]];let y=[],a=(l,m)=>{if(m===h){y.push([...l]);return}for(let A of t)l.push(A),a(l,m+1),l.pop()};return a([],0),y}if(!Array.isArray(t))return[];if(t.length===0)return[[]];for(let o of t)if(!Array.isArray(o))return[];let s=[],f=(o,h)=>{if(o===t.length){s.push([...h]);return}let y=t[o];for(let a of y)h.push(a),f(o+1,h),h.pop()};return f(0,[]),s}case"parent":{if(n.root===void 0||n.currentPath===void 0)return[];let s=n.currentPath;if(s.length===0)return[];let f=e.length>0?p(t,e[0],n)[0]:1;if(f>=0){if(f>s.length)return[];let o=s.slice(0,s.length-f);return[u(n.root,o)]}else{let o=-f-1;if(o>=s.length)return[t];let h=s.slice(0,o);return[u(n.root,h)]}}case"parents":{if(n.root===void 0||n.currentPath===void 0)return[[]];let s=n.currentPath,f=[];for(let o=s.length-1;o>=0;o--)f.push(u(n.root,s.slice(0,o)));return[f]}case"root":return n.root!==void 0?[n.root]:[];default:return null}}var gt=2e3;function rt(t,r,e,n,p){switch(r){case"keys":return Array.isArray(t)?[t.map((i,u)=>u)]:t&&typeof t=="object"?[Object.keys(t).sort()]:[null];case"keys_unsorted":return Array.isArray(t)?[t.map((i,u)=>u)]:t&&typeof t=="object"?[Object.keys(t)]:[null];case"length":return typeof t=="string"?[t.length]:Array.isArray(t)?[t.length]:t&&typeof t=="object"?[Object.keys(t).length]:t===null?[0]:typeof t=="number"?[Math.abs(t)]:[null];case"utf8bytelength":{if(typeof t=="string")return[new TextEncoder().encode(t).length];let i=t===null?"null":Array.isArray(t)?"array":typeof t,u=i==="array"||i==="object"?JSON.stringify(t):String(t);throw new Error(`${i} (${u}) only strings have UTF-8 byte length`)}case"to_entries":return t&&typeof t=="object"&&!Array.isArray(t)?[Object.entries(t).map(([i,u])=>({key:i,value:u}))]:[null];case"from_entries":if(Array.isArray(t)){let i=Object.create(null);for(let u of t)if(u&&typeof u=="object"){let c=u,s=c.key??c.Key??c.name??c.Name??c.k,f=c.value??c.Value??c.v;if(s!==void 0){let o=String(s);b(o)&&g(i,o,f)}}return[i]}return[null];case"with_entries":{if(e.length===0)return[t];if(t&&typeof t=="object"&&!Array.isArray(t)){let u=Object.entries(t).map(([s,f])=>({key:s,value:f})).flatMap(s=>p(s,e[0],n)),c=Object.create(null);for(let s of u)if(s&&typeof s=="object"){let f=s,o=f.key??f.name??f.k,h=f.value??f.v;if(o!==void 0){let y=String(o);b(y)&&g(c,y,h)}}return[c]}return[null]}case"reverse":return Array.isArray(t)?[[...t].reverse()]:typeof t=="string"?[t.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(t)?(e.length>0?p(t,e[0],n):[Number.POSITIVE_INFINITY]).map(u=>{let c=u;if(c<0)throw new Error("flatten depth must not be negative");return t.flat(c)}):[null];case"unique":if(Array.isArray(t)){let i=new Set,u=[];for(let c of t){let s=JSON.stringify(c);i.has(s)||(i.add(s),u.push(c))}return[u]}return[null];case"tojson":case"tojsonstream":{let i=n.limits.maxDepth??gt;return M(t,i+1)>i?[null]:[JSON.stringify(t)]}case"fromjson":{if(typeof t=="string"){let i=t.trim().toLowerCase();if(i==="nan")return[Number.NaN];if(i==="inf"||i==="infinity")return[Number.POSITIVE_INFINITY];if(i==="-inf"||i==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[JSON.parse(t)]}catch{throw new Error(`Invalid JSON: ${t}`)}}return[t]}case"tostring":return typeof t=="string"?[t]:[JSON.stringify(t)];case"tonumber":if(typeof t=="number")return[t];if(typeof t=="string"){let i=Number(t);if(Number.isNaN(i))throw new Error(`${JSON.stringify(t)} cannot be parsed as a number`);return[i]}throw new Error(`${typeof t} cannot be parsed as a number`);case"toboolean":{if(typeof t=="boolean")return[t];if(typeof t=="string"){if(t==="true")return[!0];if(t==="false")return[!1];throw new Error(`string (${JSON.stringify(t)}) cannot be parsed as a boolean`)}let i=t===null?"null":Array.isArray(t)?"array":typeof t,u=i==="array"||i==="object"?JSON.stringify(t):String(t);throw new Error(`${i} (${u}) cannot be parsed as a boolean`)}case"tostream":{let i=[],u=(c,s)=>{if(c===null||typeof c!="object")i.push([s,c]);else if(Array.isArray(c))if(c.length===0)i.push([s,[]]);else for(let f=0;f<c.length;f++)u(c[f],[...s,f]);else{let f=Object.keys(c);if(f.length===0)i.push([s,Object.create(null)]);else for(let o of f)u(c[o],[...s,o])}};return u(t,[]),i.push([[]]),i}case"fromstream":{if(e.length===0)return[t];let i=p(t,e[0],n),u=null;for(let c of i){if(!Array.isArray(c)||c.length===1&&Array.isArray(c[0])&&c[0].length===0||c.length!==2)continue;let[s,f]=c;if(!Array.isArray(s))continue;if(s.length===0){u=f;continue}u===null&&(u=typeof s[0]=="number"?[]:{});let o=u;for(let y=0;y<s.length-1;y++){let a=s[y],l=s[y+1];if(Array.isArray(o)&&typeof a=="number"){for(;o.length<=a;)o.push(null);o[a]===null&&(o[a]=typeof l=="number"?[]:{}),o=o[a]}else if(o&&typeof o=="object"&&!Array.isArray(o)){let m=String(a);if(!b(m))continue;let A=o;(A[m]===null||A[m]===void 0)&&g(A,m,typeof l=="number"?[]:{}),o=A[m]}}let h=s[s.length-1];if(Array.isArray(o)&&typeof h=="number"){for(;o.length<=h;)o.push(null);o[h]=f}else if(o&&typeof o=="object"&&!Array.isArray(o)){let y=String(h);b(y)&&g(o,y,f)}}return[u]}case"truncate_stream":{let i=typeof t=="number"?Math.floor(t):0;if(e.length===0)return[];let u=[],c=p(t,e[0],n);for(let s of c)if(Array.isArray(s)){if(s.length===1&&Array.isArray(s[0])){let f=s[0];f.length>i&&u.push([f.slice(i)]);continue}if(s.length===2&&Array.isArray(s[0])){let f=s[0],o=s[1];f.length>i&&u.push([f.slice(i),o])}}return u}default:return null}}function nt(t,r,e,n,p,i,u,c,s,f){switch(r){case"getpath":{if(e.length===0)return[null];let o=p(t,e[0],n),h=[];for(let y of o){let a=y,l=t;for(let m of a){if(l==null){l=null;break}if(Array.isArray(l)&&typeof m=="number")l=l[m];else if(typeof l=="object"&&typeof m=="string"){let A=l;if(!Object.hasOwn(A,m)){l=null;break}l=A[m]}else{l=null;break}}h.push(l)}return h}case"setpath":{if(e.length<2)return[null];let h=p(t,e[0],n)[0],a=p(t,e[1],n)[0];return[u(t,h,a)]}case"delpaths":{if(e.length===0)return[t];let h=p(t,e[0],n)[0],y=t;for(let a of h.sort((l,m)=>m.length-l.length))y=c(y,a);return[y]}case"path":{if(e.length===0)return[[]];let o=[];return f(t,e[0],n,[],o),o}case"del":return e.length===0?[t]:[s(t,e[0],n)];case"pick":{if(e.length===0)return[null];let o=[];for(let y of e)f(t,y,n,[],o);let h=null;for(let y of o){for(let l of y)if(typeof l=="number"&&l<0)throw new Error("Out of bounds negative array index");let a=t;for(let l of y){if(a==null)break;if(Array.isArray(a)&&typeof l=="number")a=a[l];else if(typeof a=="object"&&typeof l=="string"){let m=a;if(!Object.hasOwn(m,l)){a=null;break}a=m[l]}else{a=null;break}}h=u(h,y,a)}return[h]}case"paths":{let o=[],h=(y,a)=>{if(y&&typeof y=="object")if(Array.isArray(y))for(let l=0;l<y.length;l++)o.push([...a,l]),h(y[l],[...a,l]);else for(let l of Object.keys(y))o.push([...a,l]),h(y[l],[...a,l])};return h(t,[]),e.length>0?o.filter(y=>{let a=t;for(let m of y)if(Array.isArray(a)&&typeof m=="number")a=a[m];else if(a&&typeof a=="object"&&typeof m=="string"){let A=a;if(!Object.hasOwn(A,m))return!1;a=A[m]}else return!1;return p(a,e[0],n).some(i)}):o}case"leaf_paths":{let o=[],h=(y,a)=>{if(y===null||typeof y!="object")o.push(a);else if(Array.isArray(y))for(let l=0;l<y.length;l++)h(y[l],[...a,l]);else for(let l of Object.keys(y))h(y[l],[...a,l])};return h(t,[]),o}default:return null}}function st(t,r,e,n,p,i){switch(r){case"IN":{if(e.length===0)return[!1];if(e.length===1){let f=p(t,e[0],n);for(let o of f)if(i(t,o))return[!0];return[!1]}let u=p(t,e[0],n),c=p(t,e[1],n),s=new Set(c.map(f=>JSON.stringify(f)));for(let f of u)if(s.has(JSON.stringify(f)))return[!0];return[!1]}case"INDEX":{if(e.length===0)return[{}];if(e.length===1){let s=p(t,e[0],n),f=Object.create(null);for(let o of s){let h=String(o);b(h)&&g(f,h,o)}return[f]}if(e.length===2){let s=p(t,e[0],n),f=Object.create(null);for(let o of s){let h=p(o,e[1],n);if(h.length>0){let y=String(h[0]);b(y)&&g(f,y,o)}}return[f]}let u=p(t,e[0],n),c=Object.create(null);for(let s of u){let f=p(s,e[1],n),o=p(s,e[2],n);if(f.length>0&&o.length>0){let h=String(f[0]);b(h)&&g(c,h,o[0])}}return[c]}case"JOIN":{if(e.length<2)return[null];let u=p(t,e[0],n)[0];if(!u||typeof u!="object"||Array.isArray(u))return[null];let c=u;if(!Array.isArray(t))return[null];let s=[];for(let f of t){let o=p(f,e[1],n),h=o.length>0?String(o[0]):"",y=N(c,h)?c[h]:null;s.push([f,y])}return[s]}default:return null}}function it(t,r,e,n,p){switch(r){case"join":{if(!Array.isArray(t))return[null];let i=e.length>0?p(t,e[0],n):[""];for(let u of t)if(Array.isArray(u)||u!==null&&typeof u=="object")throw new Error("cannot join: contains arrays or objects");return i.map(u=>t.map(c=>c===null?"":typeof c=="string"?c:String(c)).join(String(u)))}case"split":{if(typeof t!="string"||e.length===0)return[null];let i=p(t,e[0],n),u=String(i[0]);return[t.split(u)]}case"splits":{if(typeof t!="string"||e.length===0)return[];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"g";return S(u,c.includes("g")?c:`${c}g`).split(t)}catch{return[]}}case"scan":{if(typeof t!="string"||e.length===0)return[];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"";return[...S(u,c.includes("g")?c:`${c}g`).matchAll(t)].map(o=>o.length>1?o.slice(1):o[0])}catch{return[]}}case"test":{if(typeof t!="string"||e.length===0)return[!1];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"";return[S(u,c).test(t)]}catch{return[!1]}}case"match":{if(typeof t!="string"||e.length===0)return[null];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"",f=S(u,`${c}d`).exec(t);if(!f)return[];let o=f.indices;return[{offset:f.index,length:f[0].length,string:f[0],captures:f.slice(1).map((h,y)=>({offset:o?.[y+1]?.[0]??null,length:h?.length??0,string:h??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof t!="string"||e.length===0)return[null];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"",f=S(u,c).match(t);return!f||!f.groups?[{}]:[f.groups]}catch{return[null]}}case"sub":{if(typeof t!="string"||e.length<2)return[null];let i=p(t,e[0],n),u=p(t,e[1],n),c=String(i[0]),s=String(u[0]);try{let f=e.length>2?String(p(t,e[2],n)[0]):"";return[S(c,f).replace(t,s)]}catch{return[t]}}case"gsub":{if(typeof t!="string"||e.length<2)return[null];let i=p(t,e[0],n),u=p(t,e[1],n),c=String(i[0]),s=String(u[0]);try{let f=e.length>2?String(p(t,e[2],n)[0]):"g",o=f.includes("g")?f:`${f}g`;return[S(c,o).replace(t,s)]}catch{return[t]}}case"ascii_downcase":return typeof t=="string"?[t.replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof t=="string"?[t.replace(/[a-z]/g,i=>String.fromCharCode(i.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof t!="string"||e.length===0)return[t];let i=p(t,e[0],n),u=String(i[0]);return[t.startsWith(u)?t.slice(u.length):t]}case"rtrimstr":{if(typeof t!="string"||e.length===0)return[t];let i=p(t,e[0],n),u=String(i[0]);return u===""?[t]:[t.endsWith(u)?t.slice(0,-u.length):t]}case"trimstr":{if(typeof t!="string"||e.length===0)return[t];let i=p(t,e[0],n),u=String(i[0]);if(u==="")return[t];let c=t;return c.startsWith(u)&&(c=c.slice(u.length)),c.endsWith(u)&&(c=c.slice(0,-u.length)),[c]}case"trim":if(typeof t=="string")return[t.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof t=="string")return[t.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof t=="string")return[t.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof t!="string"||e.length===0)return[!1];let i=p(t,e[0],n);return[t.startsWith(String(i[0]))]}case"endswith":{if(typeof t!="string"||e.length===0)return[!1];let i=p(t,e[0],n);return[t.endsWith(String(i[0]))]}case"ascii":return typeof t=="string"&&t.length>0?[t.charCodeAt(0)]:[null];case"explode":return typeof t=="string"?[Array.from(t).map(i=>i.codePointAt(0))]:[null];case"implode":if(!Array.isArray(t))throw new Error("implode input must be an array");return[t.map(c=>{if(typeof c=="string")throw new Error(`string (${JSON.stringify(c)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof c!="number"||Number.isNaN(c))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let s=Math.trunc(c);return s<0||s>1114111||s>=55296&&s<=57343?String.fromCodePoint(65533):String.fromCodePoint(s)}).join("")];default:return null}}function ot(t,r){switch(r){case"type":return t===null?["null"]:Array.isArray(t)?["array"]:typeof t=="boolean"?["boolean"]:typeof t=="number"?["number"]:typeof t=="string"?["string"]:typeof t=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof t=="number"&&!Number.isFinite(t)];case"isnan":return[typeof t=="number"&&Number.isNaN(t)];case"isnormal":return[typeof t=="number"&&Number.isFinite(t)&&t!==0];case"isfinite":return[typeof t=="number"&&Number.isFinite(t)];case"numbers":return typeof t=="number"?[t]:[];case"strings":return typeof t=="string"?[t]:[];case"booleans":return typeof t=="boolean"?[t]:[];case"nulls":return t===null?[t]:[];case"arrays":return Array.isArray(t)?[t]:[];case"objects":return t&&typeof t=="object"&&!Array.isArray(t)?[t]:[];case"iterables":return Array.isArray(t)||t&&typeof t=="object"&&!Array.isArray(t)?[t]:[];case"scalars":return!Array.isArray(t)&&!(t&&typeof t=="object")?[t]:[];case"values":return t===null?[]:[t];case"not":return t===!1||t===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}function $(t,r,e){if(r.length===0)return e;let[n,...p]=r;if(typeof n=="number"){if(t&&typeof t=="object"&&!Array.isArray(t))throw new Error("Cannot index object with number");if(n>536870911)throw new Error("Array index too large");if(n<0)throw new Error("Out of bounds negative array index");let s=Array.isArray(t)?[...t]:[];for(;s.length<=n;)s.push(null);return s[n]=$(s[n],p,e),s}if(Array.isArray(t))throw new Error("Cannot index array with string");if(!b(n))return t??Object.create(null);let i=t&&typeof t=="object"&&!Array.isArray(t)?k(t):Object.create(null),u=Object.hasOwn(i,n)?i[n]:void 0;return g(i,n,$(u,p,e)),i}function F(t,r){if(r.length===0)return null;if(r.length===1){let p=r[0];if(Array.isArray(t)&&typeof p=="number"){let i=[...t];return i.splice(p,1),i}if(t&&typeof t=="object"&&!Array.isArray(t)){let i=String(p);if(!b(i))return t;let u=k(t);return delete u[i],u}return t}let[e,...n]=r;if(Array.isArray(t)&&typeof e=="number"){let p=[...t];return p[e]=F(p[e],n),p}if(t&&typeof t=="object"&&!Array.isArray(t)){let p=String(e);if(!b(p))return t;let i=k(t);return Object.hasOwn(i,p)&&g(i,p,F(i[p],n)),i}return t}var I=class t extends Error{label;partialResults;constructor(r,e=[]){super(`break ${r}`),this.label=r,this.partialResults=e,this.name="BreakError"}withPrependedResults(r){return new t(this.label,[...r,...this.partialResults])}},V=class extends Error{value;constructor(r){super(typeof r=="string"?r:JSON.stringify(r)),this.value=r,this.name="JqError"}},Et=1e4,at=2e3,wt=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]]);function kt(t){return{vars:new Map,limits:{maxIterations:t?.limits?.maxIterations??Et,maxDepth:t?.limits?.maxDepth??at},env:t?.env}}function J(t,r,e){let n=new Map(t.vars);return n.set(r,e),{vars:n,limits:t.limits,env:t.env,root:t.root,currentPath:t.currentPath,funcs:t.funcs,labels:t.labels}}function B(t,r,e){switch(r.type){case"var":return J(t,r.name,e);case"array":{if(!Array.isArray(e))return null;let n=t;for(let p=0;p<r.elements.length;p++){let i=r.elements[p],u=p<e.length?e[p]:null,c=B(n,i,u);if(c===null)return null;n=c}return n}case"object":{if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,p=t;for(let i of r.fields){let u;if(typeof i.key=="string")u=i.key;else{let f=d(e,i.key,t);if(f.length===0)return null;u=String(f[0])}let c=N(n,u)?n[u]:null;i.keyVar&&(p=J(p,i.keyVar,c));let s=B(p,i.pattern,c);if(s===null)return null;p=s}return p}}}function Ot(t,r){let e=t;for(let n of r)if(e&&typeof e=="object")if(Array.isArray(e))if(typeof n=="number")e=e[n];else return;else{let p=e;if(typeof n=="string"&&Object.hasOwn(p,n))e=p[n];else return}else return;return e}function T(t){if(t.type==="Identity")return[];if(t.type==="Field"){let r=t.base?T(t.base):[];return r===null?null:[...r,t.name]}if(t.type==="Index"&&t.index.type==="Literal"){let r=t.base?T(t.base):[];if(r===null)return null;let e=t.index.value;return typeof e=="number"||typeof e=="string"?[...r,e]:null}if(t.type==="Pipe"){let r=T(t.left);return r===null?null:ft(r,t.right)}if(t.type==="Call"){if(t.name==="parent"||t.name==="root")return null;if(t.name==="first"&&t.args.length===0)return[0];if(t.name==="last"&&t.args.length===0)return[-1]}return null}function ft(t,r){if(r.type==="Call"){if(r.name==="parent"){let e=1;if(r.args.length>0&&r.args[0].type==="Literal"){let n=r.args[0].value;typeof n=="number"&&(e=n)}if(e>=0)return t.slice(0,Math.max(0,t.length-e));{let n=-e-1;return t.slice(0,Math.min(n,t.length))}}if(r.name==="root")return[]}if(r.type==="Field"){let e=T(r);if(e!==null)return[...t,...e]}if(r.type==="Index"&&r.index.type==="Literal"){let e=T(r);if(e!==null)return[...t,...e]}if(r.type==="Pipe"){let e=ft(t,r.left);return e===null?null:ft(e,r.right)}return r.type==="Identity"?t:null}function ht(t,r,e){if(r.type==="Comma"){let n=[];try{n.push(...d(t,r.left,e))}catch(p){if(p instanceof P)throw p;if(n.length>0)return n;throw new Error("evaluation failed")}try{n.push(...d(t,r.right,e))}catch(p){if(p instanceof P)throw p;return n}return n}return d(t,r,e)}function d(t,r,e){let n=e&&"vars"in e?e:kt(e);switch(n.root===void 0&&(n={...n,root:t,currentPath:[]}),r.type){case"Identity":return[t];case"Field":return(r.base?d(t,r.base,n):[t]).flatMap(i=>{if(i&&typeof i=="object"&&!Array.isArray(i)){let c=i;if(!Object.hasOwn(c,r.name))return[null];let s=c[r.name];return[s===void 0?null:s]}if(i===null)return[null];let u=Array.isArray(i)?"array":typeof i;throw new Error(`Cannot index ${u} with string "${r.name}"`)});case"Index":return(r.base?d(t,r.base,n):[t]).flatMap(i=>d(i,r.index,n).flatMap(c=>{if(typeof c=="number"&&Array.isArray(i)){if(Number.isNaN(c))return[null];let s=Math.trunc(c),f=s<0?i.length+s:s;return f>=0&&f<i.length?[i[f]]:[null]}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){let s=i;return Object.hasOwn(s,c)?[s[c]]:[null]}return[null]}));case"Slice":return(r.base?d(t,r.base,n):[t]).flatMap(i=>{if(i===null)return[null];if(!Array.isArray(i)&&typeof i!="string")throw new Error(`Cannot slice ${typeof i} (${JSON.stringify(i)})`);let u=i.length,c=r.start?d(t,r.start,n):[0],s=r.end?d(t,r.end,n):[u];return c.flatMap(f=>s.map(o=>{let h=f,y=o,a=Number.isNaN(h)?0:Number.isInteger(h)?h:Math.floor(h),l=Number.isNaN(y)?u:Number.isInteger(y)?y:Math.ceil(y),m=yt(a,u),A=yt(l,u);return Array.isArray(i),i.slice(m,A)}))});case"Iterate":return(r.base?d(t,r.base,n):[t]).flatMap(i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[]);case"Pipe":{let p=d(t,r.left,n),i=T(r.left),u=[];for(let c of p)try{if(i!==null){let s={...n,currentPath:[...n.currentPath??[],...i]};u.push(...d(c,r.right,s))}else u.push(...d(c,r.right,n))}catch(s){throw s instanceof I?s.withPrependedResults(u):s}return u}case"Comma":{let p=d(t,r.left,n),i=d(t,r.right,n);return[...p,...i]}case"Literal":return[r.value];case"Array":return r.elements?[d(t,r.elements,n)]:[[]];case"Object":{let p=[Object.create(null)];for(let i of r.entries){let u=typeof i.key=="string"?[i.key]:d(t,i.key,n),c=d(t,i.value,n),s=[];for(let f of p)for(let o of u){if(typeof o!="string"){let h=o===null?"null":Array.isArray(o)?"array":typeof o;throw new Error(`Cannot use ${h} (${JSON.stringify(o)}) as object key`)}if(!b(o)){for(let h of c)s.push(k(f));continue}for(let h of c){let y=k(f);g(y,o,h),s.push(y)}}p.length=0,p.push(...s)}return p}case"Paren":return d(t,r.expr,n);case"BinaryOp":return Tt(t,r.op,r.left,r.right,n);case"UnaryOp":return d(t,r.operand,n).map(i=>{if(r.op==="-"){if(typeof i=="number")return-i;if(typeof i=="string"){let u=c=>c.length>5?`"${c.slice(0,3)}...`:JSON.stringify(c);throw new Error(`string (${u(i)}) cannot be negated`)}return null}return r.op==="not"?!O(i):null});case"Cond":return d(t,r.cond,n).flatMap(i=>{if(O(i))return d(t,r.then,n);for(let u of r.elifs)if(d(t,u.cond,n).some(O))return d(t,u.then,n);return r.else?d(t,r.else,n):[t]});case"Try":try{return d(t,r.body,n)}catch(p){if(r.catch){let i=p instanceof V?p.value:p instanceof Error?p.message:String(p);return d(i,r.catch,n)}return[]}case"Call":return lt(t,r.name,r.args,n);case"VarBind":return d(t,r.value,n).flatMap(i=>{let u=null,c=[];r.pattern?c.push(r.pattern):r.name&&c.push({type:"var",name:r.name}),r.alternatives&&c.push(...r.alternatives);for(let s of c)if(u=B(n,s,i),u!==null)break;return u===null?[]:d(t,r.body,u)});case"VarRef":{if(r.name==="$ENV")return[n.env?q(n.env):Object.create(null)];let p=n.vars.get(r.name);return p!==void 0?[p]:[null]}case"Recurse":{let p=[],i=new WeakSet,u=c=>{if(c&&typeof c=="object"){if(i.has(c))return;i.add(c)}if(p.push(c),Array.isArray(c))for(let s of c)u(s);else if(c&&typeof c=="object")for(let s of Object.keys(c))u(c[s])};return u(t),p}case"Optional":try{return d(t,r.expr,n)}catch{return[]}case"StringInterp":return[r.parts.map(i=>typeof i=="string"?i:d(t,i,n).map(c=>typeof c=="string"?c:JSON.stringify(c)).join("")).join("")];case"UpdateOp":return[Nt(t,r.path,r.op,r.value,n)];case"Reduce":{let p=d(t,r.expr,n),i=d(t,r.init,n)[0],u=n.limits.maxDepth??at;for(let c of p){let s;if(r.pattern){if(s=B(n,r.pattern,c),s===null)continue}else s=J(n,r.varName,c);if(i=d(i,r.update,s)[0],M(i,u+1)>u)return[null]}return[i]}case"Foreach":{let p=d(t,r.expr,n),i=d(t,r.init,n)[0],u=[];for(let c of p)try{let s;if(r.pattern){if(s=B(n,r.pattern,c),s===null)continue}else s=J(n,r.varName,c);if(i=d(i,r.update,s)[0],r.extract){let f=d(i,r.extract,s);u.push(...f)}else u.push(i)}catch(s){throw s instanceof I?s.withPrependedResults(u):s}return u}case"Label":try{return d(t,r.body,{...n,labels:new Set([...n.labels??[],r.name])})}catch(p){if(p instanceof I&&p.label===r.name)return p.partialResults;throw p}case"Break":throw new I(r.name);case"Def":{let p=new Map(n.funcs??[]),i=`${r.name}/${r.params.length}`;p.set(i,{params:r.params,body:r.funcBody,closure:new Map(n.funcs??[])});let u={...n,funcs:p};return d(t,r.body,u)}default:{let p=r;throw new Error(`Unknown AST node type: ${p.type}`)}}}function yt(t,r){return t<0?Math.max(0,r+t):Math.min(t,r)}function Nt(t,r,e,n,p){function i(s,f){switch(e){case"=":return f;case"|=":return d(s,n,p)[0]??null;case"+=":return typeof s=="number"&&typeof f=="number"||typeof s=="string"&&typeof f=="string"?s+f:Array.isArray(s)&&Array.isArray(f)?[...s,...f]:s&&f&&typeof s=="object"&&typeof f=="object"?G(s,f):f;case"-=":return typeof s=="number"&&typeof f=="number"?s-f:s;case"*=":return typeof s=="number"&&typeof f=="number"?s*f:s;case"/=":return typeof s=="number"&&typeof f=="number"?s/f:s;case"%=":return typeof s=="number"&&typeof f=="number"?s%f:s;case"//=":return s===null||s===!1?f:s;default:return f}}function u(s,f,o){switch(f.type){case"Identity":return o(s);case"Field":{if(!b(f.name))return s;if(f.base)return u(s,f.base,h=>{if(h&&typeof h=="object"&&!Array.isArray(h)){let y=k(h),a=Object.hasOwn(y,f.name)?y[f.name]:void 0;return g(y,f.name,o(a)),y}return h});if(s&&typeof s=="object"&&!Array.isArray(s)){let h=k(s),y=Object.hasOwn(h,f.name)?h[f.name]:void 0;return g(h,f.name,o(y)),h}return s}case"Index":{let y=d(t,f.index,p)[0];if(typeof y=="number"&&Number.isNaN(y))throw new Error("Cannot set array element at NaN index");if(typeof y=="number"&&!Number.isInteger(y)&&(y=Math.trunc(y)),f.base)return u(s,f.base,a=>{if(typeof y=="number"&&Array.isArray(a)){let l=[...a],m=y<0?l.length+y:y;if(m>=0){for(;l.length<=m;)l.push(null);l[m]=o(l[m])}return l}if(typeof y=="string"&&a&&typeof a=="object"&&!Array.isArray(a)){if(!b(y))return a;let l=k(a),m=Object.hasOwn(l,y)?l[y]:void 0;return g(l,y,o(m)),l}return a});if(typeof y=="number"){if(y>536870911)throw new Error("Array index too large");if(y<0&&(!s||!Array.isArray(s)))throw new Error("Out of bounds negative array index");if(Array.isArray(s)){let l=[...s],m=y<0?l.length+y:y;if(m>=0){for(;l.length<=m;)l.push(null);l[m]=o(l[m])}return l}if(s==null){let l=[];for(;l.length<=y;)l.push(null);return l[y]=o(null),l}return s}if(typeof y=="string"&&s&&typeof s=="object"&&!Array.isArray(s)){if(!b(y))return s;let a=k(s),l=Object.hasOwn(a,y)?a[y]:void 0;return g(a,y,o(l)),a}return s}case"Iterate":{let h=y=>{if(Array.isArray(y))return y.map(a=>o(a));if(y&&typeof y=="object"){let a=Object.create(null);for(let[l,m]of Object.entries(y))b(l)&&g(a,l,o(m));return a}return y};return f.base?u(s,f.base,h):h(s)}case"Pipe":{let h=u(s,f.left,y=>y);return u(h,f.right,o)}default:return o(s)}}return u(t,r,s=>{if(e==="|=")return i(s,s);let f=d(t,n,p);return i(s,f[0]??null)})}function St(t,r,e){function n(i,u,c){switch(u.type){case"Identity":return c;case"Field":{if(!b(u.name))return i;if(u.base){let s=d(i,u.base,e)[0],f=n(s,{type:"Field",name:u.name},c);return n(i,u.base,f)}if(i&&typeof i=="object"&&!Array.isArray(i)){let s=k(i);return g(s,u.name,c),s}return i}case"Index":{if(u.base){let o=d(i,u.base,e)[0],h=n(o,{type:"Index",index:u.index},c);return n(i,u.base,h)}let f=d(t,u.index,e)[0];if(typeof f=="number"&&Array.isArray(i)){let o=[...i],h=f<0?o.length+f:f;return h>=0&&h<o.length&&(o[h]=c),o}if(typeof f=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!b(f))return i;let o=k(i);return g(o,f,c),o}return i}default:return i}}function p(i,u){switch(u.type){case"Identity":return null;case"Field":{if(!b(u.name))return i;if(u.base){let s=d(i,u.base,e)[0];if(s==null)return i;let f=p(s,{type:"Field",name:u.name});return n(i,u.base,f)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!b(u.name))return i;let s=k(i);return delete s[u.name],s}return i}case"Index":{if(u.base){let o=d(i,u.base,e)[0];if(o==null)return i;let h=p(o,{type:"Index",index:u.index});return n(i,u.base,h)}let f=d(t,u.index,e)[0];if(typeof f=="number"&&Array.isArray(i)){let o=[...i],h=f<0?o.length+f:f;return h>=0&&h<o.length&&o.splice(h,1),o}if(typeof f=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!b(f))return i;let o=k(i);return delete o[f],o}return i}case"Iterate":return Array.isArray(i)?[]:i&&typeof i=="object"?Object.create(null):i;case"Pipe":{let o=function(a,l,m){switch(l.type){case"Identity":return m;case"Field":{if(!b(l.name))return a;if(a&&typeof a=="object"&&!Array.isArray(a)){let A=k(a);return g(A,l.name,m),A}return a}case"Index":{let E=d(t,l.index,e)[0];if(typeof E=="number"&&Array.isArray(a)){let w=[...a],x=E<0?w.length+E:E;return x>=0&&x<w.length&&(w[x]=m),w}if(typeof E=="string"&&a&&typeof a=="object"&&!Array.isArray(a)){if(!b(E))return a;let w=k(a);return g(w,E,m),w}return a}case"Pipe":{let A=d(a,l.left,e)[0],E=o(A,l.right,m);return o(a,l.left,E)}default:return a}};var c=o;let s=u.left,f=u.right,h=d(i,s,e)[0];if(h==null)return i;let y=p(h,f);return o(i,s,y)}default:return i}}return p(t,r)}function Tt(t,r,e,n,p){if(r==="and")return d(t,e,p).flatMap(s=>O(s)?d(t,n,p).map(o=>O(o)):[!1]);if(r==="or")return d(t,e,p).flatMap(s=>O(s)?[!0]:d(t,n,p).map(o=>O(o)));if(r==="//"){let s=d(t,e,p).filter(f=>f!=null&&f!==!1);return s.length>0?s:d(t,n,p)}let i=d(t,e,p),u=d(t,n,p);return i.flatMap(c=>u.map(s=>{switch(r){case"+":return c===null?s:s===null?c:typeof c=="number"&&typeof s=="number"||typeof c=="string"&&typeof s=="string"?c+s:Array.isArray(c)&&Array.isArray(s)?[...c,...s]:c&&s&&typeof c=="object"&&typeof s=="object"&&!Array.isArray(c)&&!Array.isArray(s)?G(c,s):null;case"-":if(typeof c=="number"&&typeof s=="number")return c-s;if(Array.isArray(c)&&Array.isArray(s)){let f=new Set(s.map(o=>JSON.stringify(o)));return c.filter(o=>!f.has(JSON.stringify(o)))}if(typeof c=="string"&&typeof s=="string"){let f=o=>o.length>10?`"${o.slice(0,10)}...`:JSON.stringify(o);throw new Error(`string (${f(c)}) and string (${f(s)}) cannot be subtracted`)}return null;case"*":return typeof c=="number"&&typeof s=="number"?c*s:typeof c=="string"&&typeof s=="number"?c.repeat(s):c&&s&&typeof c=="object"&&typeof s=="object"&&!Array.isArray(c)&&!Array.isArray(s)?Z(c,s):null;case"/":if(typeof c=="number"&&typeof s=="number"){if(s===0)throw new Error(`number (${c}) and number (${s}) cannot be divided because the divisor is zero`);return c/s}return typeof c=="string"&&typeof s=="string"?c.split(s):null;case"%":if(typeof c=="number"&&typeof s=="number"){if(s===0)throw new Error(`number (${c}) and number (${s}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(c)&&!Number.isNaN(c)?!Number.isFinite(s)&&!Number.isNaN(s)&&c<0&&s>0?-1:0:c%s}return null;case"==":return R(c,s);case"!=":return!R(c,s);case"<":return D(c,s)<0;case"<=":return D(c,s)<=0;case">":return D(c,s)>0;case">=":return D(c,s)>=0;default:return null}}))}function lt(t,r,e,n){let p=wt.get(r);if(p)return typeof t=="number"?[p(t)]:[null];let i=tt(t,r,e,n,d);if(i!==null)return i;let u=it(t,r,e,n,d);if(u!==null)return u;let c=Q(t,r,e,n,d);if(c!==null)return c;let s=z(t,r,n.limits.maxDepth);if(s!==null)return s;let f=ot(t,r);if(f!==null)return f;let o=rt(t,r,e,n,d);if(o!==null)return o;let h=X(t,r,e,n,d,ht,L,O,_,P);if(h!==null)return h;let y=nt(t,r,e,n,d,O,$,F,St,K);if(y!==null)return y;let a=v(t,r,e,n,d,R);if(a!==null)return a;let l=W(t,r,e,n,d,ht,O,P);if(l!==null)return l;let m=et(t,r,e,n,d,O,Ot,lt);if(m!==null)return m;let A=st(t,r,e,n,d,R);if(A!==null)return A;switch(r){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let E=e.length>0?d(t,e[0],n)[0]:t;throw new V(E)}case"env":return[n.env?q(n.env):Object.create(null)];case"debug":return[t];case"input_line_number":return[1];default:{let E=`${r}/${e.length}`,w=n.funcs?.get(E);if(w){let x=w.closure??n.funcs??new Map,H=new Map(x);H.set(E,w);for(let U=0;U<w.params.length;U++){let At=w.params[U],pt=e[U];if(pt){let C=d(t,pt,n),j;if(C.length===0)j={type:"Call",name:"empty",args:[]};else if(C.length===1)j={type:"Literal",value:C[0]};else{j={type:"Literal",value:C[C.length-1]};for(let Y=C.length-2;Y>=0;Y--)j={type:"Comma",left:{type:"Literal",value:C[Y]},right:j}}H.set(`${At}/0`,{params:[],body:j})}}let dt={...n,funcs:H};return d(t,w.body,dt)}throw new Error(`Unknown function: ${r}`)}}}function K(t,r,e,n,p){if(r.type==="Comma"){let c=r;K(t,c.left,e,n,p),K(t,c.right,e,n,p);return}let i=T(r);if(i!==null){p.push([...n,...i]);return}if(r.type==="Iterate"){if(Array.isArray(t))for(let c=0;c<t.length;c++)p.push([...n,c]);else if(t&&typeof t=="object")for(let c of Object.keys(t))p.push([...n,c]);return}if(r.type==="Recurse"){let c=(s,f)=>{if(p.push([...n,...f]),s&&typeof s=="object")if(Array.isArray(s))for(let o=0;o<s.length;o++)c(s[o],[...f,o]);else for(let o of Object.keys(s))c(s[o],[...f,o])};c(t,[]);return}if(r.type==="Pipe"){let c=T(r.left);if(c!==null){let s=d(t,r.left,e);for(let f of s)K(f,r.right,e,[...n,...c],p);return}}d(t,r,e).length>0&&p.push(n)}var Ct=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]);function mt(t){let r=[],e=0,n=(f=0)=>t[e+f],p=()=>t[e++],i=()=>e>=t.length,u=f=>f>="0"&&f<="9",c=f=>f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_",s=f=>c(f)||u(f);for(;!i();){let f=e,o=p();if(!(o===" "||o===" "||o===`
|
|
4
|
-
`||o==="\r")){if(o==="#"){for(;!i()&&n()!==`
|
|
5
|
-
`;)p();continue}if(o==="."&&n()==="."){p(),r.push({type:"DOTDOT",pos:f});continue}if(o==="="&&n()==="="){p(),r.push({type:"EQ",pos:f});continue}if(o==="!"&&n()==="="){p(),r.push({type:"NE",pos:f});continue}if(o==="<"&&n()==="="){p(),r.push({type:"LE",pos:f});continue}if(o===">"&&n()==="="){p(),r.push({type:"GE",pos:f});continue}if(o==="/"&&n()==="/"){p(),n()==="="?(p(),r.push({type:"UPDATE_ALT",pos:f})):r.push({type:"ALT",pos:f});continue}if(o==="+"&&n()==="="){p(),r.push({type:"UPDATE_ADD",pos:f});continue}if(o==="-"&&n()==="="){p(),r.push({type:"UPDATE_SUB",pos:f});continue}if(o==="*"&&n()==="="){p(),r.push({type:"UPDATE_MUL",pos:f});continue}if(o==="/"&&n()==="="){p(),r.push({type:"UPDATE_DIV",pos:f});continue}if(o==="%"&&n()==="="){p(),r.push({type:"UPDATE_MOD",pos:f});continue}if(o==="="&&n()!=="="){r.push({type:"ASSIGN",pos:f});continue}if(o==="."){r.push({type:"DOT",pos:f});continue}if(o==="|"){n()==="="?(p(),r.push({type:"UPDATE_PIPE",pos:f})):r.push({type:"PIPE",pos:f});continue}if(o===","){r.push({type:"COMMA",pos:f});continue}if(o===":"){r.push({type:"COLON",pos:f});continue}if(o===";"){r.push({type:"SEMICOLON",pos:f});continue}if(o==="("){r.push({type:"LPAREN",pos:f});continue}if(o===")"){r.push({type:"RPAREN",pos:f});continue}if(o==="["){r.push({type:"LBRACKET",pos:f});continue}if(o==="]"){r.push({type:"RBRACKET",pos:f});continue}if(o==="{"){r.push({type:"LBRACE",pos:f});continue}if(o==="}"){r.push({type:"RBRACE",pos:f});continue}if(o==="?"){r.push({type:"QUESTION",pos:f});continue}if(o==="+"){r.push({type:"PLUS",pos:f});continue}if(o==="-"){r.push({type:"MINUS",pos:f});continue}if(o==="*"){r.push({type:"STAR",pos:f});continue}if(o==="/"){r.push({type:"SLASH",pos:f});continue}if(o==="%"){r.push({type:"PERCENT",pos:f});continue}if(o==="<"){r.push({type:"LT",pos:f});continue}if(o===">"){r.push({type:"GT",pos:f});continue}if(u(o)){let h=o;for(;!i()&&(u(n())||n()==="."||n()==="e"||n()==="E");)(n()==="e"||n()==="E")&&(t[e+1]==="+"||t[e+1]==="-")&&(h+=p()),h+=p();r.push({type:"NUMBER",value:Number(h),pos:f});continue}if(o==='"'){let h="";for(;!i()&&n()!=='"';)if(n()==="\\"){if(p(),i())break;let y=p();switch(y){case"n":h+=`
|
|
6
|
-
`;break;case"r":h+="\r";break;case"t":h+=" ";break;case"\\":h+="\\";break;case'"':h+='"';break;case"(":h+="\\(";break;default:h+=y}}else h+=p();i()||p(),r.push({type:"STRING",value:h,pos:f});continue}if(c(o)||o==="$"||o==="@"){let h=o;for(;!i()&&s(n());)h+=p();let y=Ct.get(h);y?r.push({type:y,pos:f}):r.push({type:"IDENT",value:h,pos:f});continue}throw new Error(`Unexpected character '${o}' at position ${f}`)}}return r.push({type:"EOF",pos:e}),r}var ct=class t{tokens;pos=0;constructor(r){this.tokens=r}peek(r=0){return this.tokens[this.pos+r]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(r){return this.peek().type===r}match(...r){for(let e of r)if(this.check(e))return this.advance();return null}expect(r,e){if(!this.check(r))throw new Error(`${e} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}parse(){let r=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return r}parseExpr(){return this.parsePipe()}parsePattern(){if(this.match("LBRACKET")){let n=[];if(!this.check("RBRACKET"))for(n.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)n.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:n}}if(this.match("LBRACE")){let n=[];if(!this.check("RBRACE"))for(n.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)n.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:n}}let r=this.expect("IDENT","Expected variable name in pattern"),e=r.value;if(!e.startsWith("$"))throw new Error(`Variable name must start with $ at position ${r.pos}`);return{type:"var",name:e}}parsePatternField(){if(this.match("LPAREN")){let e=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let n=this.parsePattern();return{key:e,pattern:n}}let r=this.peek();if(r.type==="IDENT"){let e=r.value;if(e.startsWith("$")){if(this.advance(),this.match("COLON")){let n=this.parsePattern();return{key:e.slice(1),pattern:n,keyVar:e}}return{key:e.slice(1),pattern:{type:"var",name:e}}}if(this.advance(),this.match("COLON")){let n=this.parsePattern();return{key:e,pattern:n}}return{key:e,pattern:{type:"var",name:`$${e}`}}}throw new Error(`Expected field name in object pattern at position ${r.pos}`)}parsePipe(){let r=this.parseComma();for(;this.match("PIPE");){let e=this.parseComma();r={type:"Pipe",left:r,right:e}}return r}parseComma(){let r=this.parseVarBind();for(;this.match("COMMA");){let e=this.parseVarBind();r={type:"Comma",left:r,right:e}}return r}parseVarBind(){let r=this.parseUpdate();if(this.match("AS")){let e=this.parsePattern(),n=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),n.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let p=this.parseExpr();return e.type==="var"&&n.length===0?{type:"VarBind",name:e.name,value:r,body:p}:{type:"VarBind",name:e.type==="var"?e.name:"",value:r,body:p,pattern:e.type!=="var"?e:void 0,alternatives:n.length>0?n:void 0}}return r}peekAhead(r){let e=this.pos+r;return e<this.tokens.length?this.tokens[e]:void 0}parseUpdate(){let r=this.parseAlt(),e=new Map([["ASSIGN","="],["UPDATE_ADD","+="],["UPDATE_SUB","-="],["UPDATE_MUL","*="],["UPDATE_DIV","/="],["UPDATE_MOD","%="],["UPDATE_ALT","//="],["UPDATE_PIPE","|="]]),n=this.match("ASSIGN","UPDATE_ADD","UPDATE_SUB","UPDATE_MUL","UPDATE_DIV","UPDATE_MOD","UPDATE_ALT","UPDATE_PIPE");if(n){let p=this.parseVarBind(),i=e.get(n.type);if(i)return{type:"UpdateOp",op:i,path:r,value:p}}return r}parseAlt(){let r=this.parseOr();for(;this.match("ALT");){let e=this.parseOr();r={type:"BinaryOp",op:"//",left:r,right:e}}return r}parseOr(){let r=this.parseAnd();for(;this.match("OR");){let e=this.parseAnd();r={type:"BinaryOp",op:"or",left:r,right:e}}return r}parseAnd(){let r=this.parseNot();for(;this.match("AND");){let e=this.parseNot();r={type:"BinaryOp",op:"and",left:r,right:e}}return r}parseNot(){return this.parseComparison()}parseComparison(){let r=this.parseAddSub(),e=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),n=this.match("EQ","NE","LT","LE","GT","GE");if(n){let p=e.get(n.type);if(p){let i=this.parseAddSub();r={type:"BinaryOp",op:p,left:r,right:i}}}return r}parseAddSub(){let r=this.parseMulDiv();for(;;)if(this.match("PLUS")){let e=this.parseMulDiv();r={type:"BinaryOp",op:"+",left:r,right:e}}else if(this.match("MINUS")){let e=this.parseMulDiv();r={type:"BinaryOp",op:"-",left:r,right:e}}else break;return r}parseMulDiv(){let r=this.parseUnary();for(;;)if(this.match("STAR")){let e=this.parseUnary();r={type:"BinaryOp",op:"*",left:r,right:e}}else if(this.match("SLASH")){let e=this.parseUnary();r={type:"BinaryOp",op:"/",left:r,right:e}}else if(this.match("PERCENT")){let e=this.parseUnary();r={type:"BinaryOp",op:"%",left:r,right:e}}else break;return r}parseUnary(){return this.match("MINUS")?{type:"UnaryOp",op:"-",operand:this.parseUnary()}:this.parsePostfix()}parsePostfix(){let r=this.parsePrimary();for(;;)if(this.match("QUESTION"))r={type:"Optional",expr:r};else if(this.check("DOT")&&(this.peek(1).type==="IDENT"||this.peek(1).type==="STRING"))this.advance(),r={type:"Field",name:this.advance().value,base:r};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))r={type:"Iterate",base:r};else if(this.check("COLON")){this.advance();let e=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),r={type:"Slice",end:e,base:r}}else{let e=this.parseExpr();if(this.match("COLON")){let n=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),r={type:"Slice",start:e,end:n,base:r}}else this.expect("RBRACKET","Expected ']'"),r={type:"Index",index:e,base:r}}else break;return r}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.match("DOT")){if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let e=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:e}}let r=this.parseExpr();if(this.match("COLON")){let e=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:r,end:e}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:r}}return this.check("IDENT")||this.check("STRING")?{type:"Field",name:this.advance().value}:{type:"Identity"}}if(this.match("TRUE"))return{type:"Literal",value:!0};if(this.match("FALSE"))return{type:"Literal",value:!1};if(this.match("NULL"))return{type:"Literal",value:null};if(this.check("NUMBER"))return{type:"Literal",value:this.advance().value};if(this.check("STRING")){let e=this.advance().value;return e.includes("\\(")?this.parseStringInterpolation(e):{type:"Literal",value:e}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let r=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:r}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let r=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:r}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let r=this.parsePostfix(),e;return this.match("CATCH")&&(e=this.parsePostfix()),{type:"Try",body:r,catch:e}}if(this.match("REDUCE")){let r=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let e=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let p=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let i=e.type==="var"?e.name:"";return{type:"Reduce",expr:r,varName:i,init:n,update:p,pattern:e.type!=="var"?e:void 0}}if(this.match("FOREACH")){let r=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let e=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let p=this.parseExpr(),i;this.match("SEMICOLON")&&(i=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let u=e.type==="var"?e.name:"";return{type:"Foreach",expr:r,varName:u,init:n,update:p,extract:i,pattern:e.type!=="var"?e:void 0}}if(this.match("LABEL")){let r=this.expect("IDENT","Expected label name (e.g., $out)"),e=r.value;if(!e.startsWith("$"))throw new Error(`Label name must start with $ at position ${r.pos}`);this.expect("PIPE","Expected '|' after label name");let n=this.parseExpr();return{type:"Label",name:e,body:n}}if(this.match("BREAK")){let r=this.expect("IDENT","Expected label name to break to"),e=r.value;if(!e.startsWith("$"))throw new Error(`Break label must start with $ at position ${r.pos}`);return{type:"Break",name:e}}if(this.match("DEF")){let e=this.expect("IDENT","Expected function name after def").value,n=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let u=this.expect("IDENT","Expected parameter name");for(n.push(u.value);this.match("SEMICOLON");){let c=this.expect("IDENT","Expected parameter name");n.push(c.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let p=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let i=this.parseExpr();return{type:"Def",name:e,params:n,funcBody:p,body:i}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let e=this.advance().value;if(e.startsWith("$"))return{type:"VarRef",name:e};if(this.match("LPAREN")){let n=[];if(!this.check("RPAREN"))for(n.push(this.parseExpr());this.match("SEMICOLON");)n.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:e,args:n}}return{type:"Call",name:e,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){let r=[];if(!this.check("RBRACE"))do{let e,n;if(this.match("LPAREN"))e=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),n=this.parseObjectValue();else if(this.check("IDENT")){let p=this.advance().value;this.match("COLON")?(e=p,n=this.parseObjectValue()):(e=p,n={type:"Field",name:p})}else if(this.check("STRING"))e=this.advance().value,this.expect("COLON","Expected ':'"),n=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);r.push({key:e,value:n})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:r}}parseObjectValue(){let r=this.parseVarBind();for(;this.match("PIPE");){let e=this.parseVarBind();r={type:"Pipe",left:r,right:e}}return r}parseIf(){let r=this.parseExpr();this.expect("THEN","Expected 'then'");let e=this.parseExpr(),n=[];for(;this.match("ELIF");){let i=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let u=this.parseExpr();n.push({cond:i,then:u})}let p;return this.match("ELSE")&&(p=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:r,then:e,elifs:n,else:p}}parseStringInterpolation(r){let e=[],n="",p=0;for(;p<r.length;)if(r[p]==="\\"&&r[p+1]==="("){n&&(e.push(n),n=""),p+=2;let i=1,u="";for(;p<r.length&&i>0;)r[p]==="("?i++:r[p]===")"&&i--,i>0&&(u+=r[p]),p++;let c=mt(u),s=new t(c);e.push(s.parse())}else n+=r[p],p++;return n&&e.push(n),{type:"StringInterp",parts:e}}};function be(t){let r=mt(t);return new ct(r).parse()}export{d as a,be as b};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as e,b as r}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var t={name:"clear",summary:"clear the terminal screen",usage:"clear [OPTIONS]",options:[" --help display this help and exit"]},s={name:"clear",async execute(a,c){return r(a)?e(t):{stdout:"\x1B[2J\x1B[H",stderr:"",exitCode:0}}};export{s as clearCommand};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as C}from"./chunk-JBABAK44.js";import{a as y,b as F}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var W={name:"column",summary:"columnate lists",usage:"column [OPTION]... [FILE]...",description:"Format input into multiple columns. By default, fills rows first. Use -t to create a table based on whitespace-delimited input.",options:["-t Create a table (determine columns from input)","-s SEP Input field delimiter (default: whitespace)","-o SEP Output field delimiter (default: two spaces)","-c WIDTH Output width for fill mode (default: 80)","-n Don't merge multiple adjacent delimiters"],examples:["ls | column # Fill columns with ls output","cat data | column -t # Format as table","column -t -s ',' file # Format CSV as table","column -c 40 file # Fill 40-char wide columns"]},j={table:{short:"t",long:"table",type:"boolean"},separator:{short:"s",type:"string"},outputSep:{short:"o",type:"string"},width:{short:"c",type:"number",default:80},noMerge:{short:"n",type:"boolean"}};function I(t,e,o){return e?o?t.split(e):t.split(e).filter(n=>n.length>0):o?t.split(/[ \t]/):t.split(/[ \t]+/).filter(n=>n.length>0)}function x(t){let e=[];for(let o of t)for(let n=0;n<o.length;n++){let l=o[n].length;(e[n]===void 0||l>e[n])&&(e[n]=l)}return e}function E(t,e){if(t.length===0)return"";let o=x(t),n=[];for(let l of t){let a=[];for(let s=0;s<l.length;s++)s===l.length-1?a.push(l[s]):a.push(l[s].padEnd(o[s]));n.push(a.join(e))}return n.join(`
|
|
3
|
-
`)}function M(t,e,o){if(t.length===0)return"";let n=Math.max(...t.map(c=>c.length)),l=o.length,a=n+l,s=Math.max(1,Math.floor((e+l)/a)),h=Math.ceil(t.length/s),p=[];for(let c=0;c<h;c++){let i=[];for(let r=0;r<s;r++){let m=r*h+c;m<t.length&&(r===s-1||(r+1)*h+c>=t.length?i.push(t[m]):i.push(t[m].padEnd(n)))}p.push(i.join(o))}return p.join(`
|
|
4
|
-
`)}var T={name:"column",execute:async(t,e)=>{if(F(t))return y(W);let o=C("column",t,j);if(!o.ok)return o.error;let{table:n,separator:l,outputSep:a,width:s,noMerge:h}=o.result.flags,p=o.result.positional,c=a??" ",i;if(p.length===0)i=e.stdin??"";else{let u=[];for(let f of p)if(f==="-")u.push(e.stdin??"");else{let w=e.fs.resolvePath(e.cwd,f),b=await e.fs.readFile(w);if(b===null)return{exitCode:1,stdout:"",stderr:`column: ${f}: No such file or directory
|
|
5
|
-
`};u.push(b)}i=u.join("")}if(i===""||i.trim()==="")return{exitCode:0,stdout:"",stderr:""};let r=i.split(`
|
|
6
|
-
`);i.endsWith(`
|
|
7
|
-
`)&&r[r.length-1]===""&&r.pop();let g=r.filter(u=>u.trim().length>0),d;if(n){let u=g.map(f=>I(f,l,h));d=E(u,c)}else{let u=[];for(let f of g){let w=I(f,l,h);u.push(...w)}d=M(u,s,c)}return d.length>0&&(d+=`
|
|
8
|
-
`),{exitCode:0,stdout:d,stderr:""}}};export{T as column};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as g,b as $,c as y}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var x={name:"comm",summary:"compare two sorted files line by line",usage:"comm [OPTION]... FILE1 FILE2",options:["-1 suppress column 1 (lines unique to FILE1)","-2 suppress column 2 (lines unique to FILE2)","-3 suppress column 3 (lines that appear in both files)"," --help display this help and exit"]},I={name:"comm",async execute(p,c){if($(p))return g(x);let o=!1,i=!1,f=!1,l=[];for(let e of p)if(e==="-1")o=!0;else if(e==="-2")i=!0;else if(e==="-3")f=!0;else if(e==="-12"||e==="-21")o=!0,i=!0;else if(e==="-13"||e==="-31")o=!0,f=!0;else if(e==="-23"||e==="-32")i=!0,f=!0;else if(e==="-123"||e==="-132"||e==="-213"||e==="-231"||e==="-312"||e==="-321")o=!0,i=!0,f=!0;else{if(e.startsWith("-")&&e!=="-")return y("comm",e);l.push(e)}if(l.length!==2)return{stdout:"",stderr:`comm: missing operand
|
|
3
|
-
Try 'comm --help' for more information.
|
|
4
|
-
`,exitCode:1};let m=async e=>{if(e==="-")return c.stdin;try{let F=c.fs.resolvePath(c.cwd,e);return await c.fs.readFile(F)}catch{return null}},a=await m(l[0]);if(a===null)return{stdout:"",stderr:`comm: ${l[0]}: No such file or directory
|
|
5
|
-
`,exitCode:1};let h=await m(l[1]);if(h===null)return{stdout:"",stderr:`comm: ${l[1]}: No such file or directory
|
|
6
|
-
`,exitCode:1};let t=a.split(`
|
|
7
|
-
`),s=h.split(`
|
|
8
|
-
`);t.length>0&&t[t.length-1]===""&&t.pop(),s.length>0&&s[s.length-1]===""&&s.pop();let n=0,r=0,u="",d=o?"":" ",w=(o?"":" ")+(i?"":" ");for(;n<t.length||r<s.length;)n>=t.length?(i||(u+=`${d}${s[r]}
|
|
9
|
-
`),r++):r>=s.length?(o||(u+=`${t[n]}
|
|
10
|
-
`),n++):t[n]<s[r]?(o||(u+=`${t[n]}
|
|
11
|
-
`),n++):t[n]>s[r]?(i||(u+=`${d}${s[r]}
|
|
12
|
-
`),r++):(f||(u+=`${w}${t[n]}
|
|
13
|
-
`),n++,r++);return{stdout:u,stderr:"",exitCode:0}}};export{I as commCommand};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as m}from"./chunk-JBABAK44.js";import{a as $}from"./chunk-4VDEBYW7.js";import{a as g,b as y}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var D={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},E={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},R={name:"cp",async execute(f,e){if(y(f))return g(D);let t=m("cp",f,E);if(!t.ok)return t.error;let u=t.result.flags.recursive||t.result.flags.recursiveUpper,w=t.result.flags.noClobber,C=t.result.flags.preserve,P=t.result.flags.verbose,a=t.result.positional;if(a.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
3
|
-
`,exitCode:1};let d=a.pop()??"",h=a,o=e.fs.resolvePath(e.cwd,d),v="",n="",l=0,p=!1;try{p=(await e.fs.stat(o)).isDirectory}catch{}if(h.length>1&&!p)return{stdout:"",stderr:`cp: target '${d}' is not a directory
|
|
4
|
-
`,exitCode:1};for(let r of h)try{let i=e.fs.resolvePath(e.cwd,r),s=await e.fs.stat(i),c=o;if(p){let b=r.split("/").pop()||r;c=o==="/"?`/${b}`:`${o}/${b}`}if(s.isDirectory&&!u){n+=`cp: -r not specified; omitting directory '${r}'
|
|
5
|
-
`,l=1;continue}if(w)try{await e.fs.stat(c);continue}catch{}await e.fs.cp(i,c,{recursive:u}),P&&(v+=`'${r}' -> '${c}'
|
|
6
|
-
`)}catch(i){let s=$(i);s.includes("ENOENT")||s.includes("no such file")?n+=`cp: cannot stat '${r}': No such file or directory
|
|
7
|
-
`:n+=`cp: cannot copy '${r}': ${s}
|
|
8
|
-
`,l=1}return{stdout:v,stderr:n,exitCode:l}}};export{R as cpCommand};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{b as x}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as y,b as I,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var W={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function k(t){let c=[],l=t.split(",");for(let n of l)if(n.includes("-")){let[s,r]=n.split("-");c.push({start:s?parseInt(s,10):1,end:r?parseInt(r,10):null})}else{let s=parseInt(n,10);c.push({start:s,end:s})}return c}function C(t,c){let l=[];for(let n of c){let s=n.start-1,r=n.end===null?t.length:n.end;for(let i=s;i<r&&i<t.length;i++)i>=0&&!l.includes(t[i])&&l.push(t[i])}return l}var E={name:"cut",async execute(t,c){if(I(t))return y(W);let l=" ",n=null,s=null,r=!1,i=[];for(let o=0;o<t.length;o++){let e=t[o];if(e==="-d")l=t[++o]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")n=t[++o];else if(e.startsWith("-f"))n=e.slice(2);else if(e==="-c")s=t[++o];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")r=!0;else{if(e.startsWith("--"))return m("cut",e);if(e.startsWith("-")){let f=!1;for(let u of e.slice(1))if(u==="s")r=!0;else if(!"dfc".includes(u)){f=!0;break}if(f)return m("cut",e)}else i.push(e)}}if(!n&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
|
|
3
|
-
`,exitCode:1};let p=await x(c,i,{cmdName:"cut"});if(!p.ok)return p.error;let a=p.content.split(`
|
|
4
|
-
`);a.length>0&&a[a.length-1]===""&&a.pop();let g=k(n||s||"1"),h="";for(let o of a)if(s){let e=o.split(""),f=[];for(let u of g){let w=u.start-1,L=u.end===null?e.length:u.end;for(let d=w;d<L&&d<e.length;d++)d>=0&&f.push(e[d])}h+=`${f.join("")}
|
|
5
|
-
`}else{if(r&&!o.includes(l))continue;let e=o.split(l),f=C(e,g);h+=`${f.join(l)}
|
|
6
|
-
`}return{stdout:h,stderr:"",exitCode:0}}};export{E as cutCommand};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as g,b as k,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var p={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]},M=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function n(t,i=2){return String(t).padStart(i,"0")}function T(t){let i=-t.getTimezoneOffset();return`${i>=0?"+":"-"}${n(Math.floor(Math.abs(i)/60))}${n(Math.abs(i)%60)}`}function d(t,i,r){let a=r?{Y:t.getUTCFullYear(),m:t.getUTCMonth(),D:t.getUTCDate(),H:t.getUTCHours(),M:t.getUTCMinutes(),S:t.getUTCSeconds(),w:t.getUTCDay()}:{Y:t.getFullYear(),m:t.getMonth(),D:t.getDate(),H:t.getHours(),M:t.getMinutes(),S:t.getSeconds(),w:t.getDay()},e="",o=0;for(;o<i.length;){if(i[o]==="%"&&o+1<i.length){let c=i[++o];switch(c){case"%":e+="%";break;case"a":e+=M[a.w];break;case"b":case"h":e+=h[a.m];break;case"d":e+=n(a.D);break;case"e":e+=String(a.D).padStart(2," ");break;case"F":e+=`${a.Y}-${n(a.m+1)}-${n(a.D)}`;break;case"H":e+=n(a.H);break;case"I":e+=n(a.H%12||12);break;case"m":e+=n(a.m+1);break;case"M":e+=n(a.M);break;case"n":e+=`
|
|
3
|
-
`;break;case"p":e+=a.H<12?"AM":"PM";break;case"P":e+=a.H<12?"am":"pm";break;case"R":e+=`${n(a.H)}:${n(a.M)}`;break;case"s":e+=Math.floor(t.getTime()/1e3);break;case"S":e+=n(a.S);break;case"t":e+=" ";break;case"T":e+=`${n(a.H)}:${n(a.M)}:${n(a.S)}`;break;case"u":e+=a.w||7;break;case"w":e+=a.w;break;case"y":e+=n(a.Y%100);break;case"Y":e+=a.Y;break;case"z":e+=r?"+0000":T(t);break;case"Z":e+=r?"UTC":Intl.DateTimeFormat().resolvedOptions().timeZone;break;default:e+=`%${c}`}}else e+=i[o];o++}return e}function S(t){let i=new Date(t);if(!Number.isNaN(i.getTime()))return i;if(/^\d+$/.test(t))return new Date(Number.parseInt(t,10)*1e3);let r=t.toLowerCase();return r==="now"||r==="today"?new Date:r==="yesterday"?new Date(Date.now()-864e5):r==="tomorrow"?new Date(Date.now()+864e5):null}var w={name:"date",async execute(t,i){if(k(t))return g(p);let r=!1,a=null,e=null,o=!1,c=!1;for(let f=0;f<t.length;f++){let s=t[f];if(s==="-u"||s==="--utc")r=!0;else if(s==="-d"||s==="--date")a=t[++f]??"";else if(s.startsWith("--date="))a=s.slice(7);else if(s==="-I"||s==="--iso-8601")o=!0;else if(s==="-R"||s==="--rfc-email")c=!0;else if(s.startsWith("+"))e=s.slice(1);else{if(s.startsWith("--"))return m("date",s);if(s.startsWith("-"))for(let b of s.slice(1))if(b==="u")r=!0;else if(b==="I")o=!0;else if(b==="R")c=!0;else return m("date",`-${b}`)}}let l=a!==null?S(a):new Date;if(!l)return{stdout:"",stderr:`date: invalid date '${a}'
|
|
4
|
-
`,exitCode:1};let u;return e?u=d(l,e,r):o?u=d(l,"%Y-%m-%dT%H:%M:%S%z",r):c?u=d(l,"%a, %d %b %Y %H:%M:%S %z",r):u=d(l,"%a %b %e %H:%M:%S %Z %Y",r),{stdout:`${u}
|
|
5
|
-
`,stderr:"",exitCode:0}}};export{w as dateCommand};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as N}from"./chunk-JBABAK44.js";import{a as S,b as E}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var v=class{diff(e,t,n={}){let s;typeof n=="function"?(s=n,n={}):"callback"in n&&(s=n.callback);let u=this.castInput(e,n),f=this.castInput(t,n),i=this.removeEmpty(this.tokenize(u,n)),a=this.removeEmpty(this.tokenize(f,n));return this.diffWithOptionsObj(i,a,n,s)}diffWithOptionsObj(e,t,n,s){var u;let f=r=>{if(r=this.postProcess(r,n),s){setTimeout(function(){s(r)},0);return}else return r},i=t.length,a=e.length,d=1,o=i+a;n.maxEditLength!=null&&(o=Math.min(o,n.maxEditLength));let g=(u=n.timeout)!==null&&u!==void 0?u:1/0,w=Date.now()+g,m=[{oldPos:-1,lastComponent:void 0}],P=this.extractCommon(m[0],t,e,0,n);if(m[0].oldPos+1>=a&&P+1>=i)return f(this.buildValues(m[0].lastComponent,t,e));let C=-1/0,x=1/0,L=()=>{for(let r=Math.max(C,-d);r<=Math.min(x,d);r+=2){let c,h=m[r-1],p=m[r+1];h&&(m[r-1]=void 0);let y=!1;if(p){let I=p.oldPos-r;y=p&&0<=I&&I<i}let b=h&&h.oldPos+1<a;if(!y&&!b){m[r]=void 0;continue}if(!b||y&&h.oldPos<p.oldPos?c=this.addToPath(p,!0,!1,0,n):c=this.addToPath(h,!1,!0,1,n),P=this.extractCommon(c,t,e,r,n),c.oldPos+1>=a&&P+1>=i)return f(this.buildValues(c.lastComponent,t,e))||!0;m[r]=c,c.oldPos+1>=a&&(x=Math.min(x,r-1)),P+1>=i&&(C=Math.max(C,r+1))}d++};if(s)(function r(){setTimeout(function(){if(d>o||Date.now()>w)return s(void 0);L()||r()},0)})();else for(;d<=o&&Date.now()<=w;){let r=L();if(r)return r}}addToPath(e,t,n,s,u){let f=e.lastComponent;return f&&!u.oneChangePerToken&&f.added===t&&f.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:f.count+1,added:t,removed:n,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:t,removed:n,previousComponent:f}}}extractCommon(e,t,n,s,u){let f=t.length,i=n.length,a=e.oldPos,d=a-s,o=0;for(;d+1<f&&a+1<i&&this.equals(n[a+1],t[d+1],u);)d++,a++,o++,u.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return o&&!u.oneChangePerToken&&(e.lastComponent={count:o,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,d}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let s=[],u;for(;e;)s.push(e),u=e.previousComponent,delete e.previousComponent,e=u;s.reverse();let f=s.length,i=0,a=0,d=0;for(;i<f;i++){let o=s[i];if(o.removed)o.value=this.join(n.slice(d,d+o.count)),d+=o.count;else{if(!o.added&&this.useLongestToken){let g=t.slice(a,a+o.count);g=g.map(function(w,m){let P=n[d+m];return P.length>w.length?P:w}),o.value=this.join(g)}else o.value=this.join(t.slice(a,a+o.count));a+=o.count,o.added||(d+=o.count)}}return s}};var T=class extends v{constructor(){super(...arguments),this.tokenize=W}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
3
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
4
|
-
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
5
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
6
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},O=new T;function D(l,e,t){return O.diff(l,e,t)}function W(l,e){e.stripTrailingCr&&(l=l.replace(/\r\n/g,`
|
|
7
|
-
`));let t=[],n=l.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let s=0;s<n.length;s++){let u=n[s];s%2&&!e.newlineIsToken?t[t.length-1]+=u:t.push(u)}return t}function j(l,e,t,n,s,u,f){let i;f?typeof f=="function"?i={callback:f}:i=f:i={},typeof i.context>"u"&&(i.context=4);let a=i.context;if(i.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(i.callback){let{callback:o}=i;D(t,n,Object.assign(Object.assign({},i),{callback:g=>{let w=d(g);o(w)}}))}else return d(D(t,n,i));function d(o){if(!o)return;o.push({value:"",lines:[]});function g(r){return r.map(function(c){return" "+c})}let w=[],m=0,P=0,C=[],x=1,L=1;for(let r=0;r<o.length;r++){let c=o[r],h=c.lines||A(c.value);if(c.lines=h,c.added||c.removed){if(!m){let p=o[r-1];m=x,P=L,p&&(C=a>0?g(p.lines.slice(-a)):[],m-=C.length,P-=C.length)}for(let p of h)C.push((c.added?"+":"-")+p);c.added?L+=h.length:x+=h.length}else{if(m)if(h.length<=a*2&&r<o.length-2)for(let p of g(h))C.push(p);else{let p=Math.min(h.length,a);for(let b of g(h.slice(0,p)))C.push(b);let y={oldStart:m,oldLines:x-m+p,newStart:P,newLines:L-P+p,lines:C};w.push(y),m=0,P=0,C=[]}x+=h.length,L+=h.length}}for(let r of w)for(let c=0;c<r.lines.length;c++)r.lines[c].endsWith(`
|
|
8
|
-
`)?r.lines[c]=r.lines[c].slice(0,-1):(r.lines.splice(c+1,0,"\"),c++);return{oldFileName:l,newFileName:e,oldHeader:s,newHeader:u,hunks:w}}}function k(l){if(Array.isArray(l))return l.map(k).join(`
|
|
9
|
-
`);let e=[];l.oldFileName==l.newFileName&&e.push("Index: "+l.oldFileName),e.push("==================================================================="),e.push("--- "+l.oldFileName+(typeof l.oldHeader>"u"?"":" "+l.oldHeader)),e.push("+++ "+l.newFileName+(typeof l.newHeader>"u"?"":" "+l.newHeader));for(let t=0;t<l.hunks.length;t++){let n=l.hunks[t];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),e.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@");for(let s of n.lines)e.push(s)}return e.join(`
|
|
10
|
-
`)+`
|
|
11
|
-
`}function F(l,e,t,n,s,u,f){if(typeof f=="function"&&(f={callback:f}),f?.callback){let{callback:i}=f;j(l,e,t,n,s,u,Object.assign(Object.assign({},f),{callback:a=>{i(a?k(a):void 0)}}))}else{let i=j(l,e,t,n,s,u,f);return i?k(i):void 0}}function A(l){let e=l.endsWith(`
|
|
12
|
-
`),t=l.split(`
|
|
13
|
-
`).map(n=>n+`
|
|
14
|
-
`);return e?t.pop():t.push(t.pop().slice(0,-1)),t}var z={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},H={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},K={name:"diff",async execute(l,e){if(E(l))return S(z);let t=N("diff",l,H);if(!t.ok)return t.error;let n=t.result.flags.brief,s=t.result.flags.reportSame,u=t.result.flags.ignoreCase,f=t.result.positional;if(t.result.flags.unified,f.length<2)return{stdout:"",stderr:`diff: missing operand
|
|
15
|
-
`,exitCode:2};let i,a,[d,o]=f;try{i=d==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,d))}catch{return{stdout:"",stderr:`diff: ${d}: No such file or directory
|
|
16
|
-
`,exitCode:2}}try{a=o==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,o))}catch{return{stdout:"",stderr:`diff: ${o}: No such file or directory
|
|
17
|
-
`,exitCode:2}}let g=i,w=a;return u&&(g=g.toLowerCase(),w=w.toLowerCase()),g===w?s?{stdout:`Files ${d} and ${o} are identical
|
|
18
|
-
`,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:n?{stdout:`Files ${d} and ${o} differ
|
|
19
|
-
`,stderr:"",exitCode:1}:{stdout:F(d,o,i,a,"","",{context:3}),stderr:"",exitCode:1}}};export{K as diffCommand};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as i,b as o}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var m={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},p={name:"dirname",async execute(t,l){if(o(t))return i(m);let a=t.filter(n=>!n.startsWith("-"));if(a.length===0)return{stdout:"",stderr:`dirname: missing operand
|
|
3
|
-
`,exitCode:1};let e=[];for(let n of a){let r=n.replace(/\/+$/,""),s=r.lastIndexOf("/");s===-1?e.push("."):s===0?e.push("/"):e.push(r.slice(0,s))}return{stdout:`${e.join(`
|
|
4
|
-
`)}
|
|
5
|
-
`,stderr:"",exitCode:0}}};export{p as dirnameCommand};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-OBH7XN5N.js";import{a as F}from"./chunk-JBABAK44.js";import{a as $,b as w}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var R={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},x={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},H={name:"du",async execute(a,s){if(w(a))return $(R);let n=F("du",a,x);if(!n.ok)return n.error;let r={allFiles:n.result.flags.allFiles,humanReadable:n.result.flags.humanReadable,summarize:n.result.flags.summarize,grandTotal:n.result.flags.grandTotal,maxDepth:n.result.flags.maxDepth??null},c=n.result.positional;c.length===0&&c.push(".");let o="",m="",h=0;for(let l of c){let z=s.fs.resolvePath(s.cwd,l);try{await s.fs.stat(z);let p=await b(s,z,l,r,0);o+=p.output,h+=p.totalSize,m+=p.stderr}catch{m+=`du: cannot access '${l}': No such file or directory
|
|
3
|
-
`}}return r.grandTotal&&c.length>0&&(o+=`${D(h,r.humanReadable)} total
|
|
4
|
-
`),{stdout:o,stderr:m,exitCode:m?1:0}}};async function b(a,s,n,r,c){let o={output:"",totalSize:0,stderr:""};try{let m=await a.fs.stat(s);if(!m.isDirectory)return o.totalSize=m.size,(r.allFiles||c===0)&&(o.output=D(m.size,r.humanReadable)+" "+n+`
|
|
5
|
-
`),o;let h=0,l=[];if(a.fs.readdirWithFileTypes){let t=await a.fs.readdirWithFileTypes(s),i=t.filter(e=>e.isFile),f=t.filter(e=>e.isDirectory);for(let e=0;e<i.length;e+=100){let u=i.slice(e,e+100),g=await Promise.all(u.map(async d=>{let T=s==="/"?`/${d.name}`:`${s}/${d.name}`;try{let S=await a.fs.stat(T);return{name:d.name,isDirectory:!1,size:S.size}}catch{return{name:d.name,isDirectory:!1,size:0}}}));l.push(...g)}l.push(...f.map(e=>({name:e.name,isDirectory:!0})))}else{let t=await a.fs.readdir(s);for(let i=0;i<t.length;i+=100){let f=t.slice(i,i+100),e=await Promise.all(f.map(async u=>{let g=s==="/"?`/${u}`:`${s}/${u}`;try{let d=await a.fs.stat(g);return{name:u,isDirectory:d.isDirectory,size:d.isDirectory?void 0:d.size}}catch{return{name:u,isDirectory:!1,size:0}}}));l.push(...e)}}l.sort((t,i)=>t.name.localeCompare(i.name));let z=l.filter(t=>!t.isDirectory);for(let t of z){let i=t.size??0;if(h+=i,r.allFiles&&!r.summarize){let f=n==="."?t.name:`${n}/${t.name}`;o.output+=D(i,r.humanReadable)+" "+f+`
|
|
6
|
-
`}}let p=l.filter(t=>t.isDirectory);for(let t=0;t<p.length;t+=100){let i=p.slice(t,t+100),f=await Promise.all(i.map(async e=>{let u=s==="/"?`/${e.name}`:`${s}/${e.name}`,g=n==="."?e.name:`${n}/${e.name}`;return{name:e.name,result:await b(a,u,g,r,c+1)}}));f.sort((e,u)=>e.name.localeCompare(u.name));for(let{result:e}of f)h+=e.totalSize,r.summarize||(r.maxDepth===null||c+1<=r.maxDepth)&&(o.output+=e.output)}o.totalSize=h,(r.summarize||r.maxDepth===null||c<=r.maxDepth)&&(o.output+=`${D(h,r.humanReadable)} ${n}
|
|
7
|
-
`)}catch{o.stderr=`du: cannot read directory '${n}': Permission denied
|
|
8
|
-
`}return o}function D(a,s){return s?a<1024?`${a}`:a<1024*1024?`${(a/1024).toFixed(1)}K`:a<1024*1024*1024?`${(a/(1024*1024)).toFixed(1)}M`:`${(a/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(a/1024)||1)}export{H as duCommand};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-KGOUQS5A.js";function c(a){let s="",e=0;for(;e<a.length;)if(a[e]==="\\"){if(e+1>=a.length){s+="\\";break}let o=a[e+1];switch(o){case"\\":s+="\\",e+=2;break;case"n":s+=`
|
|
3
|
-
`,e+=2;break;case"t":s+=" ",e+=2;break;case"r":s+="\r",e+=2;break;case"a":s+="\x07",e+=2;break;case"b":s+="\b",e+=2;break;case"f":s+="\f",e+=2;break;case"v":s+="\v",e+=2;break;case"e":case"E":s+="\x1B",e+=2;break;case"c":return{output:s,stop:!0};case"0":{let r="",t=e+2;for(;t<a.length&&t<e+5&&/[0-7]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\0";else{let l=parseInt(r,8)%256;s+=String.fromCharCode(l)}e=t;break}case"x":{let r="",t=e+2;for(;t<a.length&&t<e+4&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\x",e+=2;else{let l=parseInt(r,16);s+=String.fromCharCode(l),e=t}break}case"u":{let r="",t=e+2;for(;t<a.length&&t<e+6&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\u",e+=2;else{let l=parseInt(r,16);s+=String.fromCodePoint(l),e=t}break}case"U":{let r="",t=e+2;for(;t<a.length&&t<e+10&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\U",e+=2;else{let l=parseInt(r,16);try{s+=String.fromCodePoint(l)}catch{s+=`\\U${r}`}e=t}break}default:s+=`\\${o}`,e+=2}}else s+=a[e],e++;return{output:s,stop:!1}}var n={name:"echo",async execute(a,s){let e=!1,o=s.xpgEcho??!1,r=0;for(;r<a.length;){let l=a[r];if(l==="-n")e=!0,r++;else if(l==="-e")o=!0,r++;else if(l==="-E")o=!1,r++;else if(l==="-ne"||l==="-en")e=!0,o=!0,r++;else break}let t=a.slice(r).join(" ");if(o){let l=c(t);if(t=l.output,l.stop)return{stdout:t,stderr:"",exitCode:0}}return e||(t+=`
|
|
4
|
-
`),{stdout:t,stderr:"",exitCode:0}}};export{n as echoCommand};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as m,b as d,c as f}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var w={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},C={name:"env",async execute(o,l){if(d(o))return m(w);let a=!1,i=[],c=new Map,t=-1;for(let n=0;n<o.length;n++){let e=o[n];if(e==="-i"||e==="--ignore-environment")a=!0;else if(e==="-u"&&n+1<o.length)i.push(o[++n]);else if(e.startsWith("-u"))i.push(e.slice(2));else if(e.startsWith("--unset="))i.push(e.slice(8));else{if(e.startsWith("--")&&e!=="--")return f("env",e);if(e.startsWith("-")&&e!=="-"){for(let r of e.slice(1))if(r!=="i"&&r!=="u")return f("env",`-${r}`);e.includes("i")&&(a=!0)}else if(e.includes("=")&&t===-1){let r=e.indexOf("="),$=e.slice(0,r),g=e.slice(r+1);c.set($,g)}else{t=n;break}}}let s;if(a)s=new Map(c);else{s=new Map(l.env);for(let n of i)s.delete(n);for(let[n,e]of c)s.set(n,e)}if(t===-1){let n=[];for(let[e,r]of s)n.push(`${e}=${r}`);return{stdout:n.join(`
|
|
3
|
-
`)+(n.length>0?`
|
|
4
|
-
`:""),stderr:"",exitCode:0}}if(!l.exec)return{stdout:"",stderr:`env: command execution not supported in this context
|
|
5
|
-
`,exitCode:1};let u=o.slice(t),h=u[0],x=u.slice(1).map(n=>/[\s"'\\$`!*?[\]{}|&;<>()]/.test(n)?`'${n.replace(/'/g,"'\\''")}'`:n),p=["command",h,...x].join(" "),v=Object.entries(c).map(([n,e])=>`${n}="${e}"`).join(" "),A=v?`${v} ${p}`:p;return l.exec(A,{cwd:l.cwd})}},y={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},E={name:"printenv",async execute(o,l){if(d(o))return m(y);let a=o.filter(t=>!t.startsWith("-"));if(a.length===0){let t=[];for(let[s,u]of l.env)t.push(`${s}=${u}`);return{stdout:t.join(`
|
|
6
|
-
`)+(t.length>0?`
|
|
7
|
-
`:""),stderr:"",exitCode:0}}let i=[],c=0;for(let t of a){let s=l.env.get(t);s!==void 0?i.push(s):c=1}return{stdout:i.join(`
|
|
8
|
-
`)+(i.length>0?`
|
|
9
|
-
`:""),stderr:"",exitCode:c}}};export{C as envCommand,E as printenvCommand};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as d,b as f,c}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var h={name:"expand",summary:"convert tabs to spaces",usage:"expand [OPTION]... [FILE]...",description:"Convert TABs in each FILE to spaces, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-i Only convert leading tabs on each line"],examples:["expand file.txt # Convert all tabs to 8 spaces","expand -t 4 file.txt # Use 4-space tabs","expand -t 4,8,12 file.txt # Custom tab stops"]};function p(n){let i=n.split(",").map(o=>o.trim()),t=[];for(let o of i){let e=parseInt(o,10);if(Number.isNaN(e)||e<1)return null;t.push(e)}for(let o=1;o<t.length;o++)if(t[o]<=t[o-1])return null;return t}function x(n,i){if(i.length===1){let t=i[0];return t-n%t}for(let t of i)if(t>n)return t-n;if(i.length>=2){let t=i[i.length-1]-i[i.length-2],o=i[i.length-1],e=Math.floor((n-o)/t)+1;return o+e*t-n}return 1}function b(n,i){let{tabStops:t,leadingOnly:o}=i,e="",r=0,s=!0;for(let a of n)if(a===" ")if(o&&!s)e+=a,r++;else{let l=x(r,t);e+=" ".repeat(l),r+=l}else a!==" "&&a!==" "&&(s=!1),e+=a,r++;return e}function u(n,i){if(n==="")return"";let t=n.split(`
|
|
3
|
-
`),o=n.endsWith(`
|
|
4
|
-
`)&&t[t.length-1]==="";return o&&t.pop(),t.map(r=>b(r,i)).join(`
|
|
5
|
-
`)+(o?`
|
|
6
|
-
`:"")}var m={name:"expand",execute:async(n,i)=>{if(f(n))return d(h);let t={tabStops:[8],leadingOnly:!1},o=[],e=0;for(;e<n.length;){let s=n[e];if(s==="-t"&&e+1<n.length){let a=p(n[e+1]);if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${n[e+1]}'
|
|
7
|
-
`};t.tabStops=a,e+=2}else if(s.startsWith("-t")&&s.length>2){let a=p(s.slice(2));if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${s.slice(2)}'
|
|
8
|
-
`};t.tabStops=a,e++}else if(s==="--tabs"&&e+1<n.length){let a=p(n[e+1]);if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${n[e+1]}'
|
|
9
|
-
`};t.tabStops=a,e+=2}else if(s.startsWith("--tabs=")){let a=p(s.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${s.slice(7)}'
|
|
10
|
-
`};t.tabStops=a,e++}else if(s==="-i"||s==="--initial")t.leadingOnly=!0,e++;else if(s==="--"){o.push(...n.slice(e+1));break}else{if(s.startsWith("-")&&s!=="-")return c("expand",s);o.push(s),e++}}let r="";if(o.length===0){let s=i.stdin??"";r=u(s,t)}else for(let s of o){let a=i.fs.resolvePath(i.cwd,s),l=await i.fs.readFile(a);if(l===null)return{exitCode:1,stdout:r,stderr:`expand: ${s}: No such file or directory
|
|
11
|
-
`};r+=u(l,t)}return{exitCode:0,stdout:r,stderr:""}}};export{m as expand};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a}from"./chunk-SE4C7FJY.js";import"./chunk-KGOUQS5A.js";var w={name:"expr",async execute(s,r){if(s.length===0)return{stdout:"",stderr:`expr: missing operand
|
|
3
|
-
`,exitCode:2};try{let c=d(s),h=c==="0"||c===""?1:0;return{stdout:`${c}
|
|
4
|
-
`,stderr:"",exitCode:h}}catch(c){return{stdout:"",stderr:`expr: ${c.message}
|
|
5
|
-
`,exitCode:2}}}};function d(s){if(s.length===1)return s[0];let r=0;function c(){let e=h();for(;r<s.length&&s[r]==="|";){r++;let t=h();if(e!=="0"&&e!=="")return e;e=t}return e}function h(){let e=m();for(;r<s.length&&s[r]==="&";){r++;let t=m();(e==="0"||e===""||t==="0"||t==="")&&(e="0")}return e}function m(){let e=N();for(;r<s.length;){let t=s[r];if(["=","!=","<",">","<=",">="].includes(t)){r++;let o=N(),n=parseInt(e,10),i=parseInt(o,10),f=!Number.isNaN(n)&&!Number.isNaN(i),l;t==="="?l=f?n===i:e===o:t==="!="?l=f?n!==i:e!==o:t==="<"?l=f?n<i:e<o:t===">"?l=f?n>i:e>o:t==="<="?l=f?n<=i:e<=o:l=f?n>=i:e>=o,e=l?"1":"0"}else break}return e}function N(){let e=p();for(;r<s.length;){let t=s[r];if(t==="+"||t==="-"){r++;let o=p(),n=parseInt(e,10),i=parseInt(o,10);if(Number.isNaN(n)||Number.isNaN(i))throw new Error("non-integer argument");e=String(t==="+"?n+i:n-i)}else break}return e}function p(){let e=g();for(;r<s.length;){let t=s[r];if(t==="*"||t==="/"||t==="%"){r++;let o=g(),n=parseInt(e,10),i=parseInt(o,10);if(Number.isNaN(n)||Number.isNaN(i))throw new Error("non-integer argument");if((t==="/"||t==="%")&&i===0)throw new Error("division by zero");t==="*"?e=String(n*i):t==="/"?e=String(Math.trunc(n/i)):e=String(n%i)}else break}return e}function g(){let e=u();for(;r<s.length&&s[r]===":";){r++;let t=u(),n=a(`^${t}`).match(e);n?e=n[1]!==void 0?n[1]:String(n[0].length):e="0"}return e}function u(){if(r>=s.length)throw new Error("syntax error");let e=s[r];if(e==="match"){r++;let t=u(),o=u(),i=a(o).match(t);return i?i[1]!==void 0?i[1]:String(i[0].length):"0"}if(e==="substr"){r++;let t=u(),o=parseInt(u(),10),n=parseInt(u(),10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");return t.substring(o-1,o-1+n)}if(e==="index"){r++;let t=u(),o=u();for(let n=0;n<t.length;n++)if(o.includes(t[n]))return String(n+1);return"0"}if(e==="length"){r++;let t=u();return String(t.length)}if(e==="("){r++;let t=c();if(r>=s.length||s[r]!==")")throw new Error("syntax error");return r++,t}return r++,e}return c()}export{w as exprCommand};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as Z}from"./chunk-GIFF636B.js";import{a as te}from"./chunk-SE4C7FJY.js";import{a as le,b as oe,c as ce}from"./chunk-D5WP4CKS.js";import{a as ie,b as ae}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";function N(e,t){switch(e.type){case"name":{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let s=r[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Z(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,r=t.relativePath,s=n.split("/");for(let a=0;a<s.length-1;a++){let i=s[a];if(i&&i!=="."&&i!==".."&&!i.includes("*")&&!i.includes("?")&&!i.includes("[")){let c=`/${i}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(c.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(c))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let a=o[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(a))return{matches:!1,pruned:!1,printed:!1}}return{matches:Z(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:te(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let r=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=r>e.days:e.comparison==="less"?s=r<e.days:s=Math.floor(r)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let r;return e.comparison==="more"?r=t.size>n:e.comparison==="less"?r=t.size<n:e.unit==="b"?r=Math.ceil(t.size/512)===e.value:r=t.size===n,{matches:r,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,r=e.mode&511,s;return e.matchType==="exact"?s=n===r:e.matchType==="all"?s=(n&r)===r:s=(n&r)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=N(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=N(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=N(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case"or":{let n=N(e.left,t);if(n.matches)return n;let r=N(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function Y(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return Y(e.expr);case"and":case"or":return Y(e.left)||Y(e.right)}}function _(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right);default:return!1}}function pe(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=Ee(e);if(be(e)&&n.length===1){let o=n[0].split("/").filter(a=>a.length>0);if(o.length>=2)for(let a=o.length-2;a>=0;a--){let i=o[a];if(!i.includes("*")&&!i.includes("?")&&!i.includes("[")&&i!=="."&&i!==".."){let c=o[a+1];if(c&&(c.includes("*")||c.includes("?"))){t.terminalDirName=i;let l=c.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function Ee(e){let t=[],n=r=>{r.type==="path"?t.push(r.pattern):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right))};return n(e),t}function be(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function fe(e){let t=[],n=r=>{r&&(r.type==="newer"?t.push(r.refPath):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right)))};return n(e),t}function V(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return V(e.expr);case"and":case"or":return V(e.left)&&V(e.right)}}function O(e,t,n,r,s){switch(e.type){case"name":{let o=e.pattern,a=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(a){let i=a[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(i))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Z(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,a=o.split("/");for(let c=0;c<a.length-1;c++){let l=a[c];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let d=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(d))return{matches:!1,pruned:!1,printed:!1}}}let i=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(i){let c=i[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(c.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(c))return{matches:!1,pruned:!1,printed:!1}}return{matches:Z(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:te(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:r,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let o=O(e.expr,t,n,r,s);return{matches:!o.matches,pruned:o.pruned,printed:!1}}case"and":{let o=O(e.left,t,n,r,s);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1};let a=O(e.right,t,n,r,s);return{matches:a.matches,pruned:o.pruned||a.pruned,printed:o.printed||a.printed}}case"or":{let o=O(e.left,t,n,r,s);if(o.matches)return o;let a=O(e.right,t,n,r,s);return{matches:a.matches,pruned:o.pruned||a.pruned,printed:a.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function J(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return J(e.expr);case"and":case"or":return J(e.left)||J(e.right);default:return!1}}function z(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return z(e.expr);case"and":case"or":return z(e.left)&&z(e.right)}}function ue(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!z(e))return ne(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:N(e,n).pruned}}function ne(e,t){switch(e.type){case"or":{if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(N(e.left,n).pruned)return{shouldPrune:!0}}return ne(e.right,t)}case"and":{if(z(e.left)&&z(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:N(e,n).pruned}}if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return N(e.left,n).matches?ne(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function he(e,t){let n=[],r=[],s=t;for(;s<e.length;){let a=e[s];if(a==="("||a==="\\("){n.push({type:"lparen"}),s++;continue}if(a===")"||a==="\\)"){n.push({type:"rparen"}),s++;continue}if(a==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(a==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(a==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(a==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(a==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(a==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(a==="-type"&&s+1<e.length){let i=e[++s];if(i==="f"||i==="d")n.push({type:"expr",expr:{type:"type",fileType:i}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${i}
|
|
3
|
-
`,actions:[]}}else if(a==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(a==="-mtime"&&s+1<e.length){let i=e[++s],c="exact",l=i;i.startsWith("+")?(c="more",l=i.slice(1)):i.startsWith("-")&&(c="less",l=i.slice(1));let d=parseInt(l,10);Number.isNaN(d)||n.push({type:"expr",expr:{type:"mtime",days:d,comparison:c}})}else if(a==="-newer"&&s+1<e.length){let i=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:i}})}else if(a==="-size"&&s+1<e.length){let i=e[++s],c="exact",l=i;i.startsWith("+")?(c="more",l=i.slice(1)):i.startsWith("-")&&(c="less",l=i.slice(1));let d=l.match(/^(\d+)([ckMGb])?$/);if(d){let B=parseInt(d[1],10),F=d[2]||"b";n.push({type:"expr",expr:{type:"size",value:B,unit:F,comparison:c}})}}else if(a==="-perm"&&s+1<e.length){let i=e[++s],c="exact",l=i;i.startsWith("-")?(c="all",l=i.slice(1)):i.startsWith("/")&&(c="any",l=i.slice(1));let d=parseInt(l,8);Number.isNaN(d)||n.push({type:"expr",expr:{type:"perm",mode:d,matchType:c}})}else if(a==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(a==="-not"||a==="!")n.push({type:"not"});else if(a==="-o"||a==="-or")n.push({type:"op",op:"or"});else if(a==="-a"||a==="-and")n.push({type:"op",op:"and"});else if(a==="-maxdepth"||a==="-mindepth")s++;else if(a!=="-depth")if(a==="-exec"){let i=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)i.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let c=e[s]==="+";r.push({type:"exec",command:i,batchMode:c})}else if(a==="-print")n.push({type:"expr",expr:{type:"print"}}),r.push({type:"print"});else if(a==="-print0")r.push({type:"print0"});else if(a==="-printf"&&s+1<e.length){let i=e[++s];r.push({type:"printf",format:i})}else if(a==="-delete")r.push({type:"delete"});else{if(a.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${a}'
|
|
4
|
-
`,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:r};let o=Me(n);return o.error?{expr:null,pathIndex:s,error:o.error,actions:r}:{expr:o.expr,pathIndex:s,actions:r}}function Me(e){let t=0;function n(){let i=r();if(!i)return null;for(;t<e.length;){let c=e[t];if(c.type==="op"&&c.op==="or"){t++;let l=r();if(!l)return i;i={type:"or",left:i,right:l}}else break}return i}function r(){let i=s();if(!i)return null;for(;t<e.length;){let c=e[t];if(c.type==="op"&&c.op==="and"){t++;let l=s();if(!l)return i;i={type:"and",left:i,right:l}}else if(c.type==="expr"||c.type==="not"||c.type==="lparen"){let l=s();if(!l)return i;i={type:"and",left:i,right:l}}else break}return i}function s(){if(t<e.length&&e[t].type==="not"){t++;let i=s();return i?{type:"not",expr:i}:null}return o()}function o(){if(t>=e.length)return null;let i=e[t];if(i.type==="lparen"){t++;let c=n();return t<e.length&&e[t].type==="rparen"&&t++,c}return i.type==="expr"?(t++,i.expr):(i.type==="rparen",null)}return{expr:n()}}var de=500;function ve(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function xe(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var Ie={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},Fe=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),je={name:"find",async execute(e,t){if(ae(e))return ie(Ie);let n=[],r=null,s=null,o=!1,a=!1;for(let p=0;p<e.length;p++){let f=e[p];if(f==="-maxdepth"&&p+1<e.length)a=!0,r=parseInt(e[++p],10);else if(f==="-mindepth"&&p+1<e.length)a=!0,s=parseInt(e[++p],10);else if(f==="-depth")a=!0,o=!0;else if(f==="-exec")for(a=!0,p++;p<e.length&&e[p]!==";"&&e[p]!=="+";)p++;else!f.startsWith("-")&&f!==";"&&f!=="+"&&f!=="("&&f!==")"&&f!=="\\("&&f!=="\\)"&&f!=="!"?a||n.push(f):Fe.has(f)?(a=!0,p++):(f.startsWith("-")||f==="("||f==="\\("||f==="!")&&(a=!0)}n.length===0&&n.push(".");let{expr:i,error:c,actions:l}=he(e,0);if(c)return{stdout:"",stderr:c,exitCode:1};let d=l.some(p=>p.type==="print"),B=l.length===0,F=[],me=l.some(p=>p.type==="printf"),se=[],q="",G=0,ye=fe(i),U=new Map;for(let p of ye){let f=t.fs.resolvePath(t.cwd,p);try{let h=await t.fs.stat(f);U.set(p,h.mtime?.getTime()??Date.now())}catch{}}let ge=l.some(p=>{if(p.type!=="printf")return!1;let f=p.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),we=Y(i)||ge,De=_(i),K=pe(i),re=J(i),Te=V(i),Ce=typeof t.fs.readdirWithFileTypes=="function";for(let p of n){let W=function(u){let R=s===null||u.depth>=s,P=!1;if(R&&i!==null){let S=Date.now(),y;if(Te)y=O(i,u.name,u.relativePath,u.isFile,u.isDirectory);else{let m={name:u.name,relativePath:u.relativePath,isFile:u.isFile,isDirectory:u.isDirectory,isEmpty:u.isEmpty,mtime:u.stat?.mtime?.getTime()??Date.now(),size:u.stat?.size??0,mode:u.stat?.mode??420,newerRefTimes:U};y=N(i,m)}R=y.matches,P=d?y.printed:R,h.evalCalls++,h.evalTime+=Date.now()-S}else R&&(P=!0);return P?{print:!0,printfData:me?{path:u.relativePath,name:u.name,size:u.stat?.size??0,mtime:u.stat?.mtime?.getTime()??Date.now(),mode:u.stat?.mode??420,isDirectory:u.isDirectory,depth:u.depth,startingPoint:p}:null}:{print:!1,printfData:null}};var We=W;p.length>1&&p.endsWith("/")&&(p=p.slice(0,-1));let f=t.fs.resolvePath(t.cwd,p);try{await t.fs.stat(f)}catch{q+=`find: ${p}: No such file or directory
|
|
5
|
-
`,G=1;continue}let h=ve(),$=Date.now();async function E(u){let{path:b,depth:R,typeInfo:P}=u;if(h.nodeCount++,r!==null&&R>r)return null;let M,S,y;if(P&&!we)M=P.isFile,S=P.isDirectory;else{try{let L=Date.now();y=await t.fs.stat(b),h.statCalls++,h.statTime+=Date.now()-L}catch{return null}if(!y)return null;M=y.isFile,S=y.isDirectory}let m;b===f?m=p.split("/").pop()||p:m=b.split("/").pop()||"";let g=b===f?p:p==="."?`./${b.slice(f==="/"?f.length:f.length+1)}`:p+b.slice(f.length),T=[],C=null,w=null,D=!1;S&&re&&!o&&(D=ue(i,{name:m,relativePath:g,isFile:M,isDirectory:S}).shouldPrune,D&&h.earlyPrunes++);let x=r!==null&&R>=r,I=K.terminalDirName!==null&&m===K.terminalDirName,j=!x&&!I&&!D;if(S&&((j||De||I)&&!D)){let L=Date.now();if(Ce&&t.fs.readdirWithFileTypes){if(C=await t.fs.readdirWithFileTypes(b),w=C.map(v=>v.name),h.readdirCalls++,h.readdirTime+=Date.now()-L,j)T=C.map((v,k)=>({path:b==="/"?`/${v.name}`:`${b}/${v.name}`,depth:R+1,typeInfo:{isFile:v.isFile,isDirectory:v.isDirectory},resultIndex:k}));else if(I){let v=K.requiredExtension;T=C.filter(k=>k.isFile&&(!v||k.name.endsWith(v))).map((k,Se)=>({path:b==="/"?`/${k.name}`:`${b}/${k.name}`,depth:R+1,typeInfo:{isFile:k.isFile,isDirectory:k.isDirectory},resultIndex:Se}))}}else w=await t.fs.readdir(b),h.readdirCalls++,h.readdirTime+=Date.now()-L,j&&(T=w.map((v,k)=>({path:b==="/"?`/${v}`:`${b}/${v}`,depth:R+1,resultIndex:k})))}let Q=M?(y?.size??0)===0:w!==null&&w.length===0,H=D;if(!o&&i!==null&&!D&&re){let L=Date.now(),v={name:m,relativePath:g,isFile:M,isDirectory:S,isEmpty:Q,mtime:y?.mtime?.getTime()??Date.now(),size:y?.size??0,mode:y?.mode??420,newerRefTimes:U};H=N(i,v).pruned,h.evalCalls++,h.evalTime+=Date.now()-L}return{relativePath:g,name:m,isFile:M,isDirectory:S,isEmpty:Q,stat:y,depth:R,children:H?[]:T,pruned:H}}async function Pe(){let u={paths:[],printfData:[]};if(o){let y=function(m){let g={paths:[],printfData:[]},T=P[m];if(!T)return g;for(let D of T.childIndices){let x=y(D);g.paths.push(...x.paths),g.printfData.push(...x.printfData)}let{print:C,printfData:w}=W(T.node);return C&&(g.paths.push(T.node.relativePath),w&&g.printfData.push(w)),g};var b=y;let P=[],M=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map;for(;M.length>0;){let m=Date.now(),g=M.splice(0,de),T=await Promise.all(g.map(C=>E(C.item)));h.batchCount++,h.batchTime+=Date.now()-m;for(let C=0;C<g.length;C++){let w=T[C],D=g[C];if(!w)continue;let x=P.length;if(D.parentIndex>=0){let I=S.get(D.parentIndex)||[];I.push(x),S.set(D.parentIndex,I)}P.push({node:w,parentIndex:D.parentIndex,childIndices:[]});for(let I=0;I<w.children.length;I++)M.push({item:w.children[I],parentIndex:x,childOrderInParent:I})}}for(let[m,g]of S)m>=0&&m<P.length&&(P[m].childIndices=g);if(P.length>0){let m=y(0);u.paths.push(...m.paths),u.printfData.push(...m.printfData)}}else{let m=function(g){let T=P.get(g);T&&(u.paths.push(T.path),T.printfData&&u.printfData.push(T.printfData));let C=y.get(g);if(C)for(let w of C)m(w)};var R=m;let P=new Map,M=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:M++}],y=new Map;for(;S.length>0;){let g=Date.now(),T=S.splice(0,de),C=await Promise.all(T.map(async({item:w,orderIndex:D})=>{let x=await E(w);return x?{node:x,orderIndex:D}:null}));h.batchCount++,h.batchTime+=Date.now()-g;for(let w of C){if(!w)continue;let{node:D,orderIndex:x}=w,{print:I,printfData:j}=W(D);if(I&&P.set(x,{path:D.relativePath,printfData:j}),D.children.length>0){let ee=[];for(let Q of D.children){let H=M++;ee.push(H),S.push({item:Q,orderIndex:H})}y.set(x,ee)}}}m(0)}return u}let X=await Pe();if(F.push(...X.paths),se.push(...X.printfData),t.trace){let u=Date.now()-$;xe(t.trace,h,u),t.trace({category:"find",name:"searchPath",durationMs:u,details:{path:p,resultsFound:X.paths.length}})}}let A="";if(l.length>0)for(let p of l)switch(p.type){case"print":A+=F.length>0?`${F.join(`
|
|
6
|
-
`)}
|
|
7
|
-
`:"";break;case"print0":A+=F.length>0?`${F.join("\0")}\0`:"";break;case"delete":{let f=[...F].sort((h,$)=>$.length-h.length);for(let h of f){let $=t.fs.resolvePath(t.cwd,h);try{await t.fs.rm($,{recursive:!1})}catch(E){let W=E instanceof Error?E.message:String(E);q+=`find: cannot delete '${h}': ${W}
|
|
8
|
-
`,G=1}}break}case"printf":for(let f of se)A+=$e(p.format,f);break;case"exec":if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
|
|
9
|
-
`,exitCode:1};if(p.batchMode){let f=[];for(let E of p.command)E==="{}"?f.push(...F):f.push(E);let h=f.map(E=>`"${E}"`).join(" "),$=await t.exec(h,{cwd:t.cwd});A+=$.stdout,q+=$.stderr,$.exitCode!==0&&(G=$.exitCode)}else for(let f of F){let $=p.command.map(W=>W==="{}"?f:W).map(W=>`"${W}"`).join(" "),E=await t.exec($,{cwd:t.cwd});A+=E.stdout,q+=E.stderr,E.exitCode!==0&&(G=E.exitCode)}break}else B&&(A=F.length>0?`${F.join(`
|
|
10
|
-
`)}
|
|
11
|
-
`:"");return{stdout:A,stderr:q,exitCode:G}}};function $e(e,t){let n=ce(e),r="",s=0;for(;s<n.length;)if(n[s]==="%"&&s+1<n.length){if(s++,n[s]==="%"){r+="%",s++;continue}let[o,a,i]=oe(n,s);if(s+=i,s>=n.length){r+="%";break}let c=n[s],l;switch(c){case"f":l=t.name,s++;break;case"h":{let d=t.path.lastIndexOf("/");l=d>0?t.path.slice(0,d):".",s++;break}case"p":l=t.path,s++;break;case"P":{let d=t.startingPoint;t.path===d?l="":t.path.startsWith(`${d}/`)?l=t.path.slice(d.length+1):d==="."&&t.path.startsWith("./")?l=t.path.slice(2):l=t.path,s++;break}case"s":l=String(t.size),s++;break;case"d":l=String(t.depth),s++;break;case"m":l=(t.mode&511).toString(8),s++;break;case"M":l=Re(t.mode,t.isDirectory),s++;break;case"t":{let d=new Date(t.mtime);l=ke(d),s++;break}case"T":{if(s+1<n.length){let d=n[s+1],B=new Date(t.mtime);l=Ne(B,d),s+=2}else l="%T",s++;break}default:r+=`%${o!==0||a!==-1?`${o}.${a}`:""}${c}`,s++;continue}r+=le(l,o,a)}else r+=n[s],s++;return r}function Re(e,t){let n=e&511,r=t?"d":"-";return r+=n&256?"r":"-",r+=n&128?"w":"-",r+=n&64?"x":"-",r+=n&32?"r":"-",r+=n&16?"w":"-",r+=n&8?"x":"-",r+=n&4?"r":"-",r+=n&2?"w":"-",r+=n&1?"x":"-",r}function ke(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=t[e.getDay()],s=n[e.getMonth()],o=String(e.getDate()).padStart(2," "),a=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0"),l=e.getFullYear();return`${r} ${s} ${o} ${a}:${i}:${c} ${l}`}function Ne(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}export{je as findCommand};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as h,b as p,c as w}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var m={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]};function N(s,l,n){return n?new TextEncoder().encode(s).length:s===" "?8-l%8:s==="\b"?-1:1}function g(s,l){if(s.length===0)return s;let{width:n,breakAtSpaces:u,countBytes:i}=l,r=[],e="",t=0,o=-1,f=0;for(let a=0;a<s.length;a++){let d=s[a],c=N(d,t,i);t+c>n&&e.length>0?u&&o>=0?(r.push(e.slice(0,o+1)),e=e.slice(o+1)+d,t=t-f-1+c,o=-1,f=0):(r.push(e),e=d,t=c,o=-1,f=0):(e+=d,t+=c,(d===" "||d===" ")&&(o=e.length-1,f=t-c))}return e.length>0&&r.push(e),r.join(`
|
|
3
|
-
`)}function b(s,l){if(s==="")return"";let n=s.split(`
|
|
4
|
-
`),u=s.endsWith(`
|
|
5
|
-
`)&&n[n.length-1]==="";return u&&n.pop(),n.map(r=>g(r,l)).join(`
|
|
6
|
-
`)+(u?`
|
|
7
|
-
`:"")}var I={name:"fold",execute:async(s,l)=>{if(p(s))return h(m);let n={width:80,breakAtSpaces:!1,countBytes:!1},u=[],i=0;for(;i<s.length;){let e=s[i];if(e==="-w"&&i+1<s.length){let t=parseInt(s[i+1],10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${s[i+1]}'
|
|
8
|
-
`};n.width=t,i+=2}else if(e.startsWith("-w")&&e.length>2){let t=parseInt(e.slice(2),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e.slice(2)}'
|
|
9
|
-
`};n.width=t,i++}else if(e==="-s")n.breakAtSpaces=!0,i++;else if(e==="-b")n.countBytes=!0,i++;else if(e==="-bs"||e==="-sb")n.breakAtSpaces=!0,n.countBytes=!0,i++;else if(e.match(/^-[sb]+w\d+$/)){e.includes("s")&&(n.breakAtSpaces=!0),e.includes("b")&&(n.countBytes=!0);let t=e.replace(/^-[sb]+w/,""),o=parseInt(t,10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${t}'
|
|
10
|
-
`};n.width=o,i++}else if(e.match(/^-[sb]+w$/)&&i+1<s.length){e.includes("s")&&(n.breakAtSpaces=!0),e.includes("b")&&(n.countBytes=!0);let t=parseInt(s[i+1],10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${s[i+1]}'
|
|
11
|
-
`};n.width=t,i+=2}else if(e==="--"){u.push(...s.slice(i+1));break}else if(e.startsWith("-")&&e!=="-"){let t=e.slice(1),o=!1;for(let f of t)if(f==="s")n.breakAtSpaces=!0;else if(f==="b")n.countBytes=!0;else{o=!0;break}if(o)return w("fold",e);i++}else u.push(e),i++}let r="";if(u.length===0){let e=l.stdin??"";r=b(e,n)}else for(let e of u){let t=l.fs.resolvePath(l.cwd,e),o=await l.fs.readFile(t);if(o===null)return{exitCode:1,stdout:r,stderr:`fold: ${e}: No such file or directory
|
|
12
|
-
`};r+=b(o,n)}return{exitCode:0,stdout:r,stderr:""}}};export{I as fold};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as y}from"./chunk-GIFF636B.js";import{a as S,b as z}from"./chunk-G43H2WGH.js";import"./chunk-SE4C7FJY.js";import{a as _,b as j,c as G}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var te={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},J={name:"grep",async execute(t,s){if(j(t))return _(te);let o=!1,f=!1,c=!1,h=!1,m=!1,l=!1,i=!1,d=!1,w=!1,u=!1,p=!1,T=!1,x=!1,q=!1,B=!1,M=0,R=0,F=0,W=[],A=[],Q=[],N=null,I=[];for(let r=0;r<t.length;r++){let n=t[r];if(n.startsWith("-")&&n!=="-"){if(n==="-e"&&r+1<t.length){N=t[++r];continue}if(n.startsWith("--include=")){W.push(n.slice(10));continue}if(n.startsWith("--exclude=")){A.push(n.slice(10));continue}if(n.startsWith("--exclude-dir=")){Q.push(n.slice(14));continue}if(n.startsWith("--max-count=")){M=parseInt(n.slice(12),10);continue}let C=n.match(/^-m(\d+)$/);if(C){M=parseInt(C[1],10);continue}if(n==="-m"&&r+1<t.length){M=parseInt(t[++r],10);continue}let a=n.match(/^-([ABC])(\d+)$/);if(a){let e=parseInt(a[2],10);a[1]==="A"?F=e:a[1]==="B"?R=e:a[1]==="C"&&(R=e,F=e);continue}if((n==="-A"||n==="-B"||n==="-C")&&r+1<t.length){let e=parseInt(t[++r],10);n==="-A"?F=e:n==="-B"?R=e:(R=e,F=e);continue}let g=n.startsWith("--")?[n]:n.slice(1).split("");for(let e of g)if(e==="i"||e==="--ignore-case")o=!0;else if(e==="n"||e==="--line-number")f=!0;else if(e==="v"||e==="--invert-match")c=!0;else if(e==="c"||e==="--count")h=!0;else if(e==="l"||e==="--files-with-matches")m=!0;else if(e==="L"||e==="--files-without-match")l=!0;else if(e==="r"||e==="R"||e==="--recursive")i=!0;else if(e==="w"||e==="--word-regexp")d=!0;else if(e==="x"||e==="--line-regexp")w=!0;else if(e==="E"||e==="--extended-regexp")u=!0;else if(e==="P"||e==="--perl-regexp")p=!0;else if(e==="F"||e==="--fixed-strings")T=!0;else if(e==="o"||e==="--only-matching")x=!0;else if(e==="h"||e==="--no-filename")q=!0;else if(e==="q"||e==="--quiet"||e==="--silent")B=!0;else{if(e.startsWith("--"))return G("grep",e);if(e.length===1)return G("grep",`-${e}`)}}else N===null?N=n:I.push(n)}if(N===null)return{stdout:"",stderr:`grep: missing pattern
|
|
3
|
-
`,exitCode:2};let V=T?"fixed":u?"extended":p?"perl":"basic",U,b;try{let r=z(N,{mode:V,ignoreCase:o,wholeWord:d,lineRegexp:w});U=r.regex,b=r.kResetGroup}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${N}
|
|
4
|
-
`,exitCode:2}}if(I.length===0&&s.stdin!==void 0){let r=S(s.stdin,U,{invertMatch:c,showLineNumbers:f,countOnly:h,filename:"",onlyMatching:x,beforeContext:R,afterContext:F,maxCount:M,kResetGroup:b});return B?{stdout:"",stderr:"",exitCode:r.matched?0:1}:{stdout:r.output,stderr:"",exitCode:r.matched?0:1}}if(I.length===0)return{stdout:"",stderr:`grep: no input files
|
|
5
|
-
`,exitCode:2};let $="",D="",H=!1,k=!1,P=[];for(let r of I)if(r.includes("*")||r.includes("?")||r.includes("[")){let n=await se(r,s);if(i)for(let C of n){let a=await O(C.path,s,W,A,Q,C.isFile);P.push(...a)}else P.push(...n)}else if(i){let n=await O(r,s,W,A,Q);P.push(...n)}else P.push({path:r});let X=(P.length>1||i)&&!q,Z=50;for(let r=0;r<P.length;r+=Z){let n=P.slice(r,r+Z),C=await Promise.all(n.map(async a=>{let g=a.path,e=g.split("/").pop()||g;if(A.length>0&&!i&&A.some(v=>y(e,v,{stripQuotes:!0}))||W.length>0&&!i&&!W.some(v=>y(e,v,{stripQuotes:!0})))return null;try{let v=s.fs.resolvePath(s.cwd,g),L=!1;if(a.isFile===void 0?L=(await s.fs.stat(v)).isDirectory:L=!a.isFile,L)return i?null:{error:`grep: ${g}: Is a directory
|
|
6
|
-
`};let Y=await s.fs.readFile(v),ee=S(Y,U,{invertMatch:c,showLineNumbers:f,countOnly:h,filename:X?g:"",onlyMatching:x,beforeContext:R,afterContext:F,maxCount:M,kResetGroup:b});return{file:g,result:ee}}catch{return{error:`grep: ${g}: No such file or directory
|
|
7
|
-
`}}}));for(let a of C){if(a===null)continue;if("error"in a&&a.error){D+=a.error,a.error.includes("Is a directory")||(k=!0);continue}if(!("file"in a)||!a.result)continue;let{file:g,result:e}=a;if(e.matched){if(H=!0,B)return{stdout:"",stderr:"",exitCode:0};m?$+=`${g}
|
|
8
|
-
`:l||($+=e.output)}else l?$+=`${g}
|
|
9
|
-
`:h&&!m&&($+=e.output)}}let E;return k?E=2:l?E=$.length>0?0:1:E=H?0:1,B?{stdout:"",stderr:"",exitCode:E}:{stdout:$,stderr:D,exitCode:E}}};async function K(t,s,o,f){let c=o.fs.resolvePath(o.cwd,t);try{if(!(await o.fs.stat(c)).isDirectory){let l=t.split("/").pop()||"";if(s){let i=s.replace(/^\//,"");y(l,i,{stripQuotes:!0})&&f.push(t)}return}let m=await o.fs.readdir(c);for(let l of m){let i=t==="."?l:`${t}/${l}`,d=o.fs.resolvePath(o.cwd,i);if((await o.fs.stat(d)).isDirectory)await K(i,s,o,f);else if(s){let u=s.replace(/^\//,"");y(l,u,{stripQuotes:!0})&&f.push(i)}}}catch{}}async function se(t,s){let o=[],f=t.lastIndexOf("/"),c,h;if(f===-1?(c=s.cwd,h=t):(c=t.slice(0,f)||"/",h=t.slice(f+1)),t.includes("**")){let l=[],i=t.split("**"),d=i[0].replace(/\/$/,"")||".",w=i[1]||"";return await K(d,w,s,l),l.map(u=>({path:u}))}let m=s.fs.resolvePath(s.cwd,c);try{if(s.fs.readdirWithFileTypes){let l=await s.fs.readdirWithFileTypes(m);for(let i of l)if(y(i.name,h,{stripQuotes:!0})){let d=f===-1?i.name:`${c}/${i.name}`;o.push({path:d,isFile:i.isFile})}}else{let l=await s.fs.readdir(m);for(let i of l)if(y(i,h,{stripQuotes:!0})){let d=f===-1?i:`${c}/${i}`;o.push({path:d})}}}catch{}return o.sort((l,i)=>l.path.localeCompare(i.path))}async function O(t,s,o=[],f=[],c=[],h){let m=s.fs.resolvePath(s.cwd,t),l=[];try{let i,d;if(h!==void 0)i=h,d=!h;else{let u=await s.fs.stat(m);i=u.isFile,d=u.isDirectory}if(i){let u=t.split("/").pop()||t;return f.length>0&&f.some(p=>y(u,p,{stripQuotes:!0}))?[]:o.length>0&&!o.some(p=>y(u,p,{stripQuotes:!0}))?[]:[{path:t,isFile:!0}]}if(!d)return[];let w=t.split("/").pop()||t;if(c.length>0&&c.some(u=>y(w,u,{stripQuotes:!0})))return[];if(s.fs.readdirWithFileTypes){let u=await s.fs.readdirWithFileTypes(m);for(let p of u){if(p.name.startsWith("."))continue;let T=t==="."?p.name:`${t}/${p.name}`,x=await O(T,s,o,f,c,p.isFile);l.push(...x)}}else{let u=await s.fs.readdir(m);for(let p of u){if(p.startsWith("."))continue;let T=t==="."?p:`${t}/${p}`,x=await O(T,s,o,f,c);l.push(...x)}}}catch{}return l}var oe={name:"fgrep",async execute(t,s){return J.execute(["-F",...t],s)}},ae={name:"egrep",async execute(t,s){return J.execute(["-E",...t],s)}};export{ae as egrepCommand,oe as fgrepCommand,J as grepCommand};
|