just-binary 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/dist/AGENTS.md +1 -1
  3. package/dist/bin/chunks/{chunk-FZXGAGSU.js → chunk-4Y3GINAY.js} +10 -10
  4. package/dist/bin/{shell/chunks/chunk-PYIWPSII.js → chunks/chunk-ASU2EQWZ.js} +18 -18
  5. package/dist/bin/chunks/chunk-H7TGYILF.js +3 -0
  6. package/dist/bin/chunks/chunk-XSBNCA43.js +7 -0
  7. package/dist/bin/chunks/flag-coverage-O3TGZMW3.js +2 -0
  8. package/dist/bin/chunks/{gzip-PT23FGTW.js → gzip-AKQBQW7Y.js} +1 -1
  9. package/dist/bin/{shell/chunks/rg-D5WXPSFJ.js → chunks/rg-LTQYHOCO.js} +1 -1
  10. package/dist/bin/chunks/{seq-6C6VEGIG.js → seq-IDAAUGIL.js} +1 -1
  11. package/dist/bin/chunks/worker.js +5 -1
  12. package/dist/bin/chunks/yes-A2LPETVU.js +2 -0
  13. package/dist/bin/just-bash.js +2 -2
  14. package/dist/bin/shell/chunks/{chunk-FZXGAGSU.js → chunk-4Y3GINAY.js} +10 -10
  15. package/dist/bin/{chunks/chunk-PYIWPSII.js → shell/chunks/chunk-ASU2EQWZ.js} +18 -18
  16. package/dist/bin/shell/chunks/chunk-H7TGYILF.js +3 -0
  17. package/dist/bin/shell/chunks/chunk-XSBNCA43.js +7 -0
  18. package/dist/bin/shell/chunks/flag-coverage-O3TGZMW3.js +2 -0
  19. package/dist/bin/shell/chunks/{gzip-PT23FGTW.js → gzip-AKQBQW7Y.js} +1 -1
  20. package/dist/bin/{chunks/rg-D5WXPSFJ.js → shell/chunks/rg-LTQYHOCO.js} +1 -1
  21. package/dist/bin/shell/chunks/{seq-6C6VEGIG.js → seq-IDAAUGIL.js} +1 -1
  22. package/dist/bin/shell/chunks/yes-A2LPETVU.js +2 -0
  23. package/dist/bin/shell/shell.js +216 -216
  24. package/dist/browser.d.ts +4 -0
  25. package/dist/bundle/browser.js +636 -635
  26. package/dist/bundle/chunks/chunk-6RAG3BOS.js +2 -0
  27. package/dist/bundle/chunks/{chunk-YANZPHZ3.js → chunk-M5Z2PSET.js} +18 -18
  28. package/dist/bundle/chunks/{chunk-E7BAZEZG.js → chunk-NDPSDM3Q.js} +10 -10
  29. package/dist/bundle/chunks/chunk-R7SSLDTN.js +6 -0
  30. package/dist/bundle/chunks/flag-coverage-33IDWH3V.js +1 -0
  31. package/dist/bundle/chunks/{gzip-OUHELY5D.js → gzip-BYGAV4XY.js} +1 -1
  32. package/dist/bundle/chunks/{rg-PML6WNNK.js → rg-RA3U4BVJ.js} +1 -1
  33. package/dist/bundle/chunks/{seq-UCWX6HDA.js → seq-SXS6YKWX.js} +1 -1
  34. package/dist/bundle/chunks/worker.js +5 -1
  35. package/dist/bundle/chunks/yes-2J55KNKF.js +1 -0
  36. package/dist/bundle/index.js +2 -2
  37. package/dist/commands/registry.d.ts +1 -1
  38. package/dist/commands/seq/seq.d.ts +5 -0
  39. package/dist/commands/yes/yes.d.ts +14 -0
  40. package/package.json +1 -1
  41. package/dist/bin/chunks/chunk-HT4IVOYZ.js +0 -7
  42. package/dist/bin/chunks/flag-coverage-7AQE3UPG.js +0 -2
  43. package/dist/bin/shell/chunks/chunk-HT4IVOYZ.js +0 -7
  44. package/dist/bin/shell/chunks/flag-coverage-7AQE3UPG.js +0 -2
  45. package/dist/bundle/chunks/chunk-OYIATQ5V.js +0 -6
  46. package/dist/bundle/chunks/flag-coverage-VMMEL7EH.js +0 -1
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as ds,C as Pr,D as xr,E as me,F as je,G as ie,H as Ce,I as Tt,J as Nr,K as V,L as Tr,M as Or,N as Te,O as hs,P as Ot,Q as Ze,R as X,a as vr,b as as,c as br,d as Sr,e as xt,f as se,g as G,h as Pe,i as ae,j as xe,k as We,l as ls,m as Nt,n as Er,o as cs,p as $r,q as pe,r as Re,s as Ar,t as _r,u as us,v as fs,w as Ne,x as Cr,y as kr,z as _e}from"./chunks/chunk-YJFLWG5Q.js";import{a as wr}from"./chunks/chunk-RUESYAVK.js";import{a as Me,b as Ae}from"./chunks/chunk-CAXM2HMK.js";import{a as ft}from"./chunks/chunk-SE4C7FJY.js";import{a as ve,b as be,c as he,d as Ee,e as yr,f as Z,g as Be,h as Ct,i as kt,j as gr,k as ue,l as Fe,m as Pt,n as $e}from"./chunks/chunk-XILOLP4K.js";import"./chunks/chunk-OBH7XN5N.js";import{a as Ie}from"./chunks/chunk-4VDEBYW7.js";import{a as ct,b as w,c as te,d as de,e as x,f as Y,g as qe,h as D,i as os,j as ut}from"./chunks/chunk-RAUBS6MJ.js";import{a as _t,g as F,h as B,i as H,j as mr,k as lt,l as T,m as g}from"./chunks/chunk-463VWH7H.js";import{resolve as fi}from"node:path";var Ye=[{name:"echo",load:async()=>(await import("./chunks/echo-5EBIR54T.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-D4E4FTXJ.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-OCMANWQ5.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-SLO257WP.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-EOATYYLD.js")).mkdirCommand},{name:"rmdir",load:async()=>(await import("./chunks/rmdir-5MNK2AUK.js")).rmdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-J6X4OW3P.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-BZWDOVUX.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-7TMSGOID.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-QUAFQDCT.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-PZ7JHGH2.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-OY5CP5QF.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-PQGDLYLZ.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-F66ORZVY.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-YZQN4BHR.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-EI24LQBP.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-NNQHXBLM.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-6QXPS4BF.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-6OXCYWRV.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-6OXCYWRV.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-6OXCYWRV.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-D5WXPSFJ.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-HN3E3YFB.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-GM5WBRLU.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-FT4OVPSS.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-C3ZUQTF4.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-LMDA7QZC.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-P6LPALWP.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-6XYPZQXQ.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-2C3Q77EZ.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-67WGH7WN.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-WZC4GKMG.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-SK55D7OX.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-672ZQYZF.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-AUQHJMGI.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-7CJI5ESD.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-AXXLODUK.js")).split},{name:"column",load:async()=>(await import("./chunks/column-5CUPANJY.js")).column},{name:"join",load:async()=>(await import("./chunks/join-ZK67SMQ3.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-6TEQ3DXN.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-BXGQE44U.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-XCXGYZPS.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-3LHNBKNB.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-RLXLQJVI.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-DEYTW2KI.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-PWRJFDWL.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-PWRJFDWL.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-DRSSCAUM.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-DRSSCAUM.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-W57S3E3C.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-I7QRUR36.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-ZPDUMWHQ.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-ZPDUMWHQ.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-P5EG7Z6I.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-U2E2FSIE.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-U2E2FSIE.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-2BGA6KZ3.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-KLZ4B6VS.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-SGBANTKE.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-KYJ2OPHH.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-CPJ3WJE7.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-LPVVIBNB.js")).timeoutCommand},{name:"time",load:async()=>(await import("./chunks/time-GJWZLHLN.js")).timeCommand},{name:"seq",load:async()=>(await import("./chunks/seq-6C6VEGIG.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-SWYNZXDP.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-WYOOUOWI.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-Y2J25KOM.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-NFAAGL44.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-MIXTZ4NP.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-2AHE4ET2.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-R7JNUPU2.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-QKNHOQPQ.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-Q5VNKVXE.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-NPAYFT3O.js")).hostname},{name:"whoami",load:async()=>(await import("./chunks/whoami-KIB3RVBF.js")).whoami},{name:"od",load:async()=>(await import("./chunks/od-IMVAQQIR.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-PT23FGTW.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-PT23FGTW.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-PT23FGTW.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(Ye.push({name:"tar",load:async()=>(await import("./chunks/tar-M7QCUJ4B.js")).tarCommand}),Ye.push({name:"yq",load:async()=>(await import("./chunks/yq-W7OKSS7Z.js")).yqCommand}),Ye.push({name:"xan",load:async()=>(await import("./chunks/xan-BGDVQKRZ.js")).xanCommand}),Ye.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-DUARNSNG.js")).sqlite3Command}));var ps=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(ps.push({name:"python3",load:async()=>(await import("./chunks/python3-HNLPOBYQ.js")).python3Command}),ps.push({name:"python",load:async()=>(await import("./chunks/python3-HNLPOBYQ.js")).pythonCommand}));var yi=[{name:"curl",load:async()=>(await import("./chunks/curl-P6DHVAKR.js")).curlCommand}],Dr=new Map;function ms(e){return{name:e.name,async execute(t,s){let r=Dr.get(e.name);if(r||(r=await e.load(),Dr.set(e.name,r)),s.coverage&&(typeof __BROWSER__>"u"||!__BROWSER__)){let{emitFlagCoverage:n}=await import("./chunks/flag-coverage-7AQE3UPG.js"),{decodeArgs:i}=await import("./chunks/bytes-C34BYEMS.js");n(s.coverage,e.name,i(t))}return r.execute(t,s)}}}function Ir(e){return(e?Ye.filter(s=>e.includes(s.name)):Ye).map(ms)}function Rr(){return yi.map(ms)}function Lr(){return ps.map(ms)}function Fr(e){return"load"in e&&typeof e.load=="function"}function Mr(e){let t=null;return{name:e.name,async execute(s,r){return t||(t=await e.load()),t.execute(s,r)}}}var gi=new TextEncoder;function wi(e){return typeof e=="object"&&e!==null&&typeof e.getReader=="function"}function vi(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),s=>s.charCodeAt(0));if(t==="hex"){let s=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)s[r/2]=parseInt(e.slice(r,r+2),16);return s}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,n=>n.charCodeAt(0));let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}return gi.encode(e)}function zr(e){if(e.length===0)return[];if(e.length<=ct)return[e];let t=[];for(let s=0;s<e.length;s+=ct)t.push(e.subarray(s,Math.min(s+ct,e.length)));return t}function Xe(e,t){let s=vi(e,t);return{chunks:zr(s),size:s.length}}async function Ke(e,t){if(wi(e)){let s=[],r=0;for await(let n of ut(e))if(n.length<=ct)s.push(n),r+=n.length;else for(let i of zr(n))s.push(i),r+=i.length;return{chunks:s,size:r}}return Xe(e,t)}function Dt(e,t){if(t==="base64")return btoa(wr(Wr(e)));if(t==="hex"){let n="";for(let i of e)for(let o=0;o<i.length;o++)n+=i[o].toString(16).padStart(2,"0");return n}if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(Wr(e)).toString(t);let n=65536,i="";for(let o of e)if(o.length<=n)i+=String.fromCharCode(...o);else for(let a=0;a<o.length;a+=n){let l=o.subarray(a,a+n);i+=String.fromCharCode(...l)}return i}let s=new TextDecoder,r="";for(let n of e)n.length>0&&(r+=s.decode(n,{stream:!0}));return r+=s.decode(),r}function Wr(e){let t=0;for(let n of e)t+=n.length;if(t===0)return new Uint8Array(0);if(e.length===1)return e[0];let s=new Uint8Array(t),r=0;for(let n of e)s.set(n,r),r+=n.length;return s}function Le(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}function bi(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&!(e instanceof ReadableStream)&&"content"in e}function oe(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}var dt=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[s,r]of Object.entries(t))if(bi(r)){if(r.content instanceof ReadableStream)throw new Error("InMemoryFs: streams not supported in InitialFiles; use writeFile() after construction");this.writeFileSync(s,r.content,void 0,{mode:r.mode,mtime:r.mtime})}else{if(r instanceof ReadableStream)throw new Error("InMemoryFs: streams not supported in InitialFiles; use writeFile() after construction");this.writeFileSync(s,r)}}normalizePath(t){if(!t||t==="/")return"/";let s=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;s.startsWith("/")||(s=`/${s}`);let r=s.split("/").filter(i=>i&&i!=="."),n=[];for(let i of r)i===".."?n.pop():n.push(i);return`/${n.join("/")}`||"/"}dirname(t){let s=this.normalizePath(t);if(s==="/")return"/";let r=s.lastIndexOf("/");return r===0?"/":s.slice(0,r)}ensureParentDirs(t){let s=this.dirname(t);s!=="/"&&(this.data.has(s)||(this.ensureParentDirs(s),this.data.set(s,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,s,r,n){oe(t,"write");let i=this.normalizePath(t);this.ensureParentDirs(i);let o=Le(r),{chunks:a,size:l}=Xe(s,o);this.data.set(i,{type:"file",chunks:a,size:l,mode:n?.mode??420,mtime:n?.mtime??new Date})}async readFile(t){oe(t,"open");let s=this.resolvePathWithSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);return de(r.chunks)}async readFileText(t,s){oe(t,"open");let r=this.resolvePathWithSymlinks(t),n=this.data.get(r);if(!n)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(n.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);let i=Le(s);return Dt(n.chunks,i)}async writeFile(t,s,r){oe(t,"write");let n=this.normalizePath(t);this.ensureParentDirs(n);let i=Le(r),{chunks:o,size:a}=await Ke(s,i);this.data.set(n,{type:"file",chunks:o,size:a,mode:420,mtime:new Date})}async appendFile(t,s,r){oe(t,"append");let n=this.normalizePath(t),i=this.data.get(n);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=Le(r),{chunks:a,size:l}=await Ke(s,o);i?.type==="file"?this.data.set(n,{type:"file",chunks:[...i.chunks,...a],size:i.size+l,mode:i.mode,mtime:new Date}):(this.ensureParentDirs(n),this.data.set(n,{type:"file",chunks:a,size:l,mode:420,mtime:new Date}))}async exists(t){if(t.includes("\0"))return!1;try{let s=this.resolvePathWithSymlinks(t);return this.data.has(s)}catch{return!1}}async stat(t){oe(t,"stat");let s=this.resolvePathWithSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);let n=0;return r.type==="file"&&(n=r.size),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date}}async lstat(t){oe(t,"lstat");let s=this.resolveIntermediateSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};let n=0;return r.type==="file"&&(n=r.size),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date}}resolveSymlink(t,s){if(s.startsWith("/"))return this.normalizePath(s);let r=this.dirname(t);return this.normalizePath(r==="/"?`/${s}`:`${r}/${s}`)}resolveIntermediateSymlinks(t){let s=this.normalizePath(t);if(s==="/")return"/";let r=s.slice(1).split("/");if(r.length<=1)return s;let n="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];n=`${n}/${a}`;let l=this.data.get(n),u=0,c=40;for(;l&&l.type==="symlink"&&u<c;){if(i.has(n))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(n),n=this.resolveSymlink(n,l.target),l=this.data.get(n),u++}if(u>=c)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${n}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let s=this.normalizePath(t);if(s==="/")return"/";let r=s.slice(1).split("/"),n="",i=new Set;for(let o of r){n=`${n}/${o}`;let a=this.data.get(n),l=0,u=40;for(;a&&a.type==="symlink"&&l<u;){if(i.has(n))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(n),n=this.resolveSymlink(n,a.target),a=this.data.get(n),l++}if(l>=u)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return n}async mkdir(t,s){this.mkdirSync(t,s)}mkdirSync(t,s){oe(t,"mkdir");let r=this.normalizePath(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!s?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let n=this.dirname(r);if(n!=="/"&&!this.data.has(n))if(s?.recursive)this.mkdirSync(n,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){oe(t,"scandir");let s=this.normalizePath(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let n=new Set;for(;r&&r.type==="symlink";){if(n.has(s))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);n.add(s),s=this.resolveSymlink(s,r.target),r=this.data.get(s)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=s==="/"?"/":`${s}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==s&&a.startsWith(i)){let u=a.slice(i.length),c=u.split("/")[0];c&&!u.includes("/",c.length)&&!o.has(c)&&o.set(c,{name:c,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,s){oe(t,"rm");let r=this.normalizePath(t),n=this.data.get(r);if(!n){if(s?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(n.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!s?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let o of i){let a=r==="/"?`/${o}`:`${r}/${o}`;await this.rm(a,s)}}}this.data.delete(r)}async cp(t,s,r){oe(t,"cp"),oe(s,"cp");let n=this.normalizePath(t),i=this.normalizePath(s),o=this.data.get(n);if(!o)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(o.type==="file")this.ensureParentDirs(i),this.data.set(i,{type:"file",chunks:[...o.chunks],size:o.size,mode:o.mode,mtime:o.mtime});else if(o.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(n);for(let l of a){let u=n==="/"?`/${l}`:`${n}/${l}`,c=i==="/"?`/${l}`:`${i}/${l}`;await this.cp(u,c,r)}}}async mv(t,s){await this.cp(t,s,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,s){if(s.startsWith("/"))return this.normalizePath(s);let r=t==="/"?`/${s}`:`${t}/${s}`;return this.normalizePath(r)}async chmod(t,s){oe(t,"chmod");let r=this.normalizePath(t),n=this.data.get(r);if(!n)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);n.mode=s}async symlink(t,s){oe(s,"symlink");let r=this.normalizePath(s);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${s}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,s){oe(t,"link"),oe(s,"link");let r=this.normalizePath(t),n=this.normalizePath(s),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(n))throw new Error(`EEXIST: file already exists, link '${s}'`);this.ensureParentDirs(n),this.data.set(n,{type:"file",chunks:[...i.chunks],size:i.size,mode:i.mode,mtime:i.mtime})}async readlink(t){oe(t,"readlink");let s=this.normalizePath(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return r.target}async realpath(t){oe(t,"realpath");let s=this.resolvePathWithSymlinks(t);if(!this.data.has(s))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return s}async utimes(t,s,r){oe(t,"utimes");let n=this.normalizePath(t),i=this.resolvePathWithSymlinks(n),o=this.data.get(i);if(!o)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);o.mtime=r}};function Si(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function Ei(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function $i(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function Ai(e){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${vr}
2
+ import{A as ds,C as Pr,D as xr,E as me,F as je,G as ie,H as Ce,I as Tt,J as Nr,K as V,L as Tr,M as Or,N as Te,O as hs,P as Ot,Q as Ze,R as X,a as vr,b as as,c as br,d as Sr,e as xt,f as se,g as G,h as Pe,i as ae,j as xe,k as We,l as ls,m as Nt,n as Er,o as cs,p as $r,q as pe,r as Re,s as Ar,t as _r,u as us,v as fs,w as Ne,x as Cr,y as kr,z as _e}from"./chunks/chunk-YJFLWG5Q.js";import{a as wr}from"./chunks/chunk-RUESYAVK.js";import{a as Me,b as Ae}from"./chunks/chunk-CAXM2HMK.js";import{a as ft}from"./chunks/chunk-SE4C7FJY.js";import{a as ve,b as be,c as he,d as Ee,e as yr,f as Z,g as Be,h as Ct,i as kt,j as gr,k as ue,l as Fe,m as Pt,n as $e}from"./chunks/chunk-XILOLP4K.js";import"./chunks/chunk-OBH7XN5N.js";import{a as Ie}from"./chunks/chunk-4VDEBYW7.js";import{a as ct,b as w,c as te,d as de,e as x,f as Y,g as qe,h as D,i as os,j as ut}from"./chunks/chunk-RAUBS6MJ.js";import{a as _t,g as F,h as B,i as H,j as mr,k as lt,l as T,m as g}from"./chunks/chunk-463VWH7H.js";import{resolve as fi}from"node:path";var Ye=[{name:"echo",load:async()=>(await import("./chunks/echo-5EBIR54T.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-D4E4FTXJ.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-OCMANWQ5.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-SLO257WP.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-EOATYYLD.js")).mkdirCommand},{name:"rmdir",load:async()=>(await import("./chunks/rmdir-5MNK2AUK.js")).rmdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-J6X4OW3P.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-BZWDOVUX.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-7TMSGOID.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-QUAFQDCT.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-PZ7JHGH2.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-OY5CP5QF.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-PQGDLYLZ.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-F66ORZVY.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-YZQN4BHR.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-EI24LQBP.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-NNQHXBLM.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-6QXPS4BF.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-6OXCYWRV.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-6OXCYWRV.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-6OXCYWRV.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-LTQYHOCO.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-HN3E3YFB.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-GM5WBRLU.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-FT4OVPSS.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-C3ZUQTF4.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-LMDA7QZC.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-P6LPALWP.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-6XYPZQXQ.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-2C3Q77EZ.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-67WGH7WN.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-WZC4GKMG.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-SK55D7OX.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-672ZQYZF.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-AUQHJMGI.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-7CJI5ESD.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-AXXLODUK.js")).split},{name:"column",load:async()=>(await import("./chunks/column-5CUPANJY.js")).column},{name:"join",load:async()=>(await import("./chunks/join-ZK67SMQ3.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-6TEQ3DXN.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-BXGQE44U.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-XCXGYZPS.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-3LHNBKNB.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-RLXLQJVI.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-DEYTW2KI.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-PWRJFDWL.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-PWRJFDWL.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-DRSSCAUM.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-DRSSCAUM.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-W57S3E3C.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-I7QRUR36.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-ZPDUMWHQ.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-ZPDUMWHQ.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-P5EG7Z6I.js")).clearCommand},{name:"yes",load:async()=>(await import("./chunks/yes-A2LPETVU.js")).yesCommand},{name:"bash",load:async()=>(await import("./chunks/bash-U2E2FSIE.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-U2E2FSIE.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-2BGA6KZ3.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-KLZ4B6VS.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-SGBANTKE.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-KYJ2OPHH.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-CPJ3WJE7.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-LPVVIBNB.js")).timeoutCommand},{name:"time",load:async()=>(await import("./chunks/time-GJWZLHLN.js")).timeCommand},{name:"seq",load:async()=>(await import("./chunks/seq-IDAAUGIL.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-SWYNZXDP.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-WYOOUOWI.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-Y2J25KOM.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-NFAAGL44.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-MIXTZ4NP.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-2AHE4ET2.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-R7JNUPU2.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-QKNHOQPQ.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-Q5VNKVXE.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-NPAYFT3O.js")).hostname},{name:"whoami",load:async()=>(await import("./chunks/whoami-KIB3RVBF.js")).whoami},{name:"od",load:async()=>(await import("./chunks/od-IMVAQQIR.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-AKQBQW7Y.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-AKQBQW7Y.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-AKQBQW7Y.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(Ye.push({name:"tar",load:async()=>(await import("./chunks/tar-M7QCUJ4B.js")).tarCommand}),Ye.push({name:"yq",load:async()=>(await import("./chunks/yq-W7OKSS7Z.js")).yqCommand}),Ye.push({name:"xan",load:async()=>(await import("./chunks/xan-BGDVQKRZ.js")).xanCommand}),Ye.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-DUARNSNG.js")).sqlite3Command}));var ps=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(ps.push({name:"python3",load:async()=>(await import("./chunks/python3-HNLPOBYQ.js")).python3Command}),ps.push({name:"python",load:async()=>(await import("./chunks/python3-HNLPOBYQ.js")).pythonCommand}));var yi=[{name:"curl",load:async()=>(await import("./chunks/curl-P6DHVAKR.js")).curlCommand}],Dr=new Map;function ms(e){return{name:e.name,async execute(t,s){let r=Dr.get(e.name);if(r||(r=await e.load(),Dr.set(e.name,r)),s.coverage&&(typeof __BROWSER__>"u"||!__BROWSER__)){let{emitFlagCoverage:n}=await import("./chunks/flag-coverage-O3TGZMW3.js"),{decodeArgs:i}=await import("./chunks/bytes-C34BYEMS.js");n(s.coverage,e.name,i(t))}return r.execute(t,s)}}}function Ir(e){return(e?Ye.filter(s=>e.includes(s.name)):Ye).map(ms)}function Rr(){return yi.map(ms)}function Lr(){return ps.map(ms)}function Fr(e){return"load"in e&&typeof e.load=="function"}function Mr(e){let t=null;return{name:e.name,async execute(s,r){return t||(t=await e.load()),t.execute(s,r)}}}var gi=new TextEncoder;function wi(e){return typeof e=="object"&&e!==null&&typeof e.getReader=="function"}function vi(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),s=>s.charCodeAt(0));if(t==="hex"){let s=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)s[r/2]=parseInt(e.slice(r,r+2),16);return s}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,n=>n.charCodeAt(0));let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}return gi.encode(e)}function zr(e){if(e.length===0)return[];if(e.length<=ct)return[e];let t=[];for(let s=0;s<e.length;s+=ct)t.push(e.subarray(s,Math.min(s+ct,e.length)));return t}function Xe(e,t){let s=vi(e,t);return{chunks:zr(s),size:s.length}}async function Ke(e,t){if(wi(e)){let s=[],r=0;for await(let n of ut(e))if(n.length<=ct)s.push(n),r+=n.length;else for(let i of zr(n))s.push(i),r+=i.length;return{chunks:s,size:r}}return Xe(e,t)}function Dt(e,t){if(t==="base64")return btoa(wr(Wr(e)));if(t==="hex"){let n="";for(let i of e)for(let o=0;o<i.length;o++)n+=i[o].toString(16).padStart(2,"0");return n}if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(Wr(e)).toString(t);let n=65536,i="";for(let o of e)if(o.length<=n)i+=String.fromCharCode(...o);else for(let a=0;a<o.length;a+=n){let l=o.subarray(a,a+n);i+=String.fromCharCode(...l)}return i}let s=new TextDecoder,r="";for(let n of e)n.length>0&&(r+=s.decode(n,{stream:!0}));return r+=s.decode(),r}function Wr(e){let t=0;for(let n of e)t+=n.length;if(t===0)return new Uint8Array(0);if(e.length===1)return e[0];let s=new Uint8Array(t),r=0;for(let n of e)s.set(n,r),r+=n.length;return s}function Le(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}function bi(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&!(e instanceof ReadableStream)&&"content"in e}function oe(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}var dt=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[s,r]of Object.entries(t))if(bi(r)){if(r.content instanceof ReadableStream)throw new Error("InMemoryFs: streams not supported in InitialFiles; use writeFile() after construction");this.writeFileSync(s,r.content,void 0,{mode:r.mode,mtime:r.mtime})}else{if(r instanceof ReadableStream)throw new Error("InMemoryFs: streams not supported in InitialFiles; use writeFile() after construction");this.writeFileSync(s,r)}}normalizePath(t){if(!t||t==="/")return"/";let s=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;s.startsWith("/")||(s=`/${s}`);let r=s.split("/").filter(i=>i&&i!=="."),n=[];for(let i of r)i===".."?n.pop():n.push(i);return`/${n.join("/")}`||"/"}dirname(t){let s=this.normalizePath(t);if(s==="/")return"/";let r=s.lastIndexOf("/");return r===0?"/":s.slice(0,r)}ensureParentDirs(t){let s=this.dirname(t);s!=="/"&&(this.data.has(s)||(this.ensureParentDirs(s),this.data.set(s,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,s,r,n){oe(t,"write");let i=this.normalizePath(t);this.ensureParentDirs(i);let o=Le(r),{chunks:a,size:l}=Xe(s,o);this.data.set(i,{type:"file",chunks:a,size:l,mode:n?.mode??420,mtime:n?.mtime??new Date})}async readFile(t){oe(t,"open");let s=this.resolvePathWithSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);return de(r.chunks)}async readFileText(t,s){oe(t,"open");let r=this.resolvePathWithSymlinks(t),n=this.data.get(r);if(!n)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(n.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);let i=Le(s);return Dt(n.chunks,i)}async writeFile(t,s,r){oe(t,"write");let n=this.normalizePath(t);this.ensureParentDirs(n);let i=Le(r),{chunks:o,size:a}=await Ke(s,i);this.data.set(n,{type:"file",chunks:o,size:a,mode:420,mtime:new Date})}async appendFile(t,s,r){oe(t,"append");let n=this.normalizePath(t),i=this.data.get(n);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=Le(r),{chunks:a,size:l}=await Ke(s,o);i?.type==="file"?this.data.set(n,{type:"file",chunks:[...i.chunks,...a],size:i.size+l,mode:i.mode,mtime:new Date}):(this.ensureParentDirs(n),this.data.set(n,{type:"file",chunks:a,size:l,mode:420,mtime:new Date}))}async exists(t){if(t.includes("\0"))return!1;try{let s=this.resolvePathWithSymlinks(t);return this.data.has(s)}catch{return!1}}async stat(t){oe(t,"stat");let s=this.resolvePathWithSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);let n=0;return r.type==="file"&&(n=r.size),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date}}async lstat(t){oe(t,"lstat");let s=this.resolveIntermediateSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};let n=0;return r.type==="file"&&(n=r.size),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date}}resolveSymlink(t,s){if(s.startsWith("/"))return this.normalizePath(s);let r=this.dirname(t);return this.normalizePath(r==="/"?`/${s}`:`${r}/${s}`)}resolveIntermediateSymlinks(t){let s=this.normalizePath(t);if(s==="/")return"/";let r=s.slice(1).split("/");if(r.length<=1)return s;let n="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];n=`${n}/${a}`;let l=this.data.get(n),u=0,c=40;for(;l&&l.type==="symlink"&&u<c;){if(i.has(n))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(n),n=this.resolveSymlink(n,l.target),l=this.data.get(n),u++}if(u>=c)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${n}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let s=this.normalizePath(t);if(s==="/")return"/";let r=s.slice(1).split("/"),n="",i=new Set;for(let o of r){n=`${n}/${o}`;let a=this.data.get(n),l=0,u=40;for(;a&&a.type==="symlink"&&l<u;){if(i.has(n))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(n),n=this.resolveSymlink(n,a.target),a=this.data.get(n),l++}if(l>=u)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return n}async mkdir(t,s){this.mkdirSync(t,s)}mkdirSync(t,s){oe(t,"mkdir");let r=this.normalizePath(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!s?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let n=this.dirname(r);if(n!=="/"&&!this.data.has(n))if(s?.recursive)this.mkdirSync(n,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){oe(t,"scandir");let s=this.normalizePath(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let n=new Set;for(;r&&r.type==="symlink";){if(n.has(s))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);n.add(s),s=this.resolveSymlink(s,r.target),r=this.data.get(s)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=s==="/"?"/":`${s}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==s&&a.startsWith(i)){let u=a.slice(i.length),c=u.split("/")[0];c&&!u.includes("/",c.length)&&!o.has(c)&&o.set(c,{name:c,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,s){oe(t,"rm");let r=this.normalizePath(t),n=this.data.get(r);if(!n){if(s?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(n.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!s?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let o of i){let a=r==="/"?`/${o}`:`${r}/${o}`;await this.rm(a,s)}}}this.data.delete(r)}async cp(t,s,r){oe(t,"cp"),oe(s,"cp");let n=this.normalizePath(t),i=this.normalizePath(s),o=this.data.get(n);if(!o)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(o.type==="file")this.ensureParentDirs(i),this.data.set(i,{type:"file",chunks:[...o.chunks],size:o.size,mode:o.mode,mtime:o.mtime});else if(o.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(n);for(let l of a){let u=n==="/"?`/${l}`:`${n}/${l}`,c=i==="/"?`/${l}`:`${i}/${l}`;await this.cp(u,c,r)}}}async mv(t,s){await this.cp(t,s,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,s){if(s.startsWith("/"))return this.normalizePath(s);let r=t==="/"?`/${s}`:`${t}/${s}`;return this.normalizePath(r)}async chmod(t,s){oe(t,"chmod");let r=this.normalizePath(t),n=this.data.get(r);if(!n)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);n.mode=s}async symlink(t,s){oe(s,"symlink");let r=this.normalizePath(s);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${s}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,s){oe(t,"link"),oe(s,"link");let r=this.normalizePath(t),n=this.normalizePath(s),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(n))throw new Error(`EEXIST: file already exists, link '${s}'`);this.ensureParentDirs(n),this.data.set(n,{type:"file",chunks:[...i.chunks],size:i.size,mode:i.mode,mtime:i.mtime})}async readlink(t){oe(t,"readlink");let s=this.normalizePath(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return r.target}async realpath(t){oe(t,"realpath");let s=this.resolvePathWithSymlinks(t);if(!this.data.has(s))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return s}async utimes(t,s,r){oe(t,"utimes");let n=this.normalizePath(t),i=this.resolvePathWithSymlinks(n),o=this.data.get(i);if(!o)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);o.mtime=r}};function Si(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function Ei(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function $i(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function Ai(e){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${vr}
3
3
  `),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
4
4
  `),e.writeFileSync("/proc/self/status",br()),e.writeFileSync("/proc/self/fd/0","/dev/stdin"),e.writeFileSync("/proc/self/fd/1","/dev/stdout"),e.writeFileSync("/proc/self/fd/2","/dev/stderr")}function Vr(e,t){Si(e)&&(Ei(e,t),$i(e),Ai(e))}var _i=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],Ci=["braceexpand","hashall","interactive-comments"];function ys(e){let t=[],s=[...Ci.map(r=>({name:r,enabled:!0})),..._i.map(r=>({name:r,enabled:e[r]}))].sort((r,n)=>r.name.localeCompare(n.name));for(let r of s)r.enabled&&t.push(r.name);return t.join(":")}function Qe(e){g(e.state.env,"SHELLOPTS",ys(e.state.options))}var ki=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function gs(e){let t=[];for(let s of ki)e[s]&&t.push(s);return t.join(":")}function ws(e){g(e.state.env,"BASHOPTS",gs(e.state.shoptOptions))}var Pi="BASH_ALIAS_";function Br(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function jr(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Hr(e,t){let s=e.env.get(`${Pi}${t}`);return s!==void 0?H(s):void 0}function vs(e,t,s){if(!t.name||!Br(t.name))return t;let r=jr(t.name);if(!r)return t;let n=Hr(e,r);if(!n||s.has(r))return t;try{s.add(r);let i=new G,o=n,a=n.endsWith(" ");if(!a)for(let f of t.args){let h=Gr(f);o+=` ${h}`}let l;try{l=i.parse(o)}catch(f){if(f instanceof xt)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return Ur(t,n);let u=l.statements[0].pipelines[0].commands[0];if(u.type!=="SimpleCommand")return Ur(t,n);let c={...u,assignments:[...t.assignments,...u.assignments],redirections:[...u.redirections,...t.redirections],line:t.line};if(a&&t.args.length>0&&(c={...c,args:[...c.args,...t.args]},c.args.length>0)){let f=c.args[0];if(Br(f)){let h=jr(f);if(h&&Hr(e,h)){let d={type:"SimpleCommand",name:f,args:c.args.slice(1),assignments:[],redirections:[]},m=vs(e,d,s);m!==d&&(c={...c,name:m.name,args:[...m.args]})}}}return c}catch(i){throw s.delete(r),i}}function Ur(e,t){let s=t;for(let o of e.args){let a=Gr(o);s+=` ${a}`}let r=new G,n=r.parseWordFromString("eval",!1,!1),i=r.parseWordFromString(`'${s.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:n,args:[i],assignments:e.assignments,redirections:e.redirections,line:e.line}}function Gr(e){let t="";for(let s of e.parts)switch(s.type){case"Literal":t+=s.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,"\\$1");break;case"SingleQuoted":t+=`'${s.value}'`;break;case"DoubleQuoted":t+=`"${s.parts.map(r=>r.type==="Literal"?r.value:`$${r.type}`).join("")}"`;break;case"ParameterExpansion":t+=`\${${s.parameter}}`;break;case"CommandSubstitution":t+="$(...)";break;case"ArithmeticExpansion":t+=`$((${s.expression}))`;break;case"Glob":t+=s.pattern;break;default:break}return t}async function qr(e,t){let s=t.parts.map(c=>c.type==="Literal"?c.value:"\0").join(""),r=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!r||!s.endsWith(")"))return null;let n=r[1],i=[],o=!1,a="",l=!1;for(let c of t.parts)if(c.type==="Literal"){let f=c.value;if(!o){let h=f.indexOf("=(");h!==-1&&(o=!0,f=f.slice(h+2))}if(o){f.endsWith(")")&&(f=f.slice(0,-1));let h=f.split(/(\s+)/);for(let d of h)/^\s+$/.test(d)?(a||l)&&(i.push(a),a="",l=!1):d&&(a+=d)}}else if(o)if(c.type==="BraceExpansion")if(/^\[.+\]=/.test(a))a+=Nt({type:"Word",parts:[c]});else{(a||l)&&(i.push(a),a="",l=!1);let h=await Te(e,{type:"Word",parts:[c]});i.push(...h.values)}else{(c.type==="SingleQuoted"||c.type==="DoubleQuoted"||c.type==="Escaped")&&(l=!0);let f=await V(e,{type:"Word",parts:[c]});a+=f}(a||l)&&i.push(a);let u=i.map(c=>/^\[.+\]=/.test(c)?c:c===""?"''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(c)&&!c.startsWith("'")&&!c.startsWith('"')?`'${c.replace(/'/g,"'\\''")}'`:c);return`${n}=(${u.join(" ")})`}async function Zr(e,t){let s=-1,r=-1,n=!1;for(let p=0;p<t.parts.length;p++){let v=t.parts[p];if(v.type==="Literal"){let y=v.value.indexOf("+=");if(y!==-1){let _=v.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(_)){s=p,r=y,n=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(_)){s=p,r=y,n=!0;break}}let E=v.value.indexOf("=");if(E!==-1&&(E===0||v.value[E-1]!=="+")){let _=v.value.slice(0,E);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(_)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(_)){s=p,r=E;break}}}}if(s===-1)return null;let i=t.parts.slice(0,s),o=t.parts[s];if(o.type!=="Literal")return null;let a=n?2:1,l=o.value.slice(0,r),u=o.value.slice(r+a),c=t.parts.slice(s+1),f="";for(let p of i)f+=await V(e,{type:"Word",parts:[p]});f+=l;let h={type:"Word",parts:u!==""?[{type:"Literal",value:u},...c]:c},d=h.parts.length>0?await V(e,h):"";return`${f}${n?"+=":"="}${d}`}var xi=["tar","yq","xan","sqlite3","python3","python"];function Yr(e){return xi.includes(e)}function j(){return{stdout:w(),stderr:w(),exitCode:0}}var Je={get stdout(){return w()},get stderr(){return w()},exitCode:0};function Se(e=w()){return{stdout:e,stderr:w(),exitCode:0}}function q(e){return{stdout:x(e),stderr:w(),exitCode:0}}function C(e,t=1){return{stdout:w(),stderr:x(e),exitCode:t}}function R(e,t,s){return{stdout:e instanceof Uint8Array?te(e):e,stderr:t instanceof Uint8Array?te(t):t,exitCode:s}}function ee(e){return{stdout:w(),stderr:w(),exitCode:e?0:1}}function ke(e,t,s,r){let n=s===void 0?w():s instanceof Uint8Array?te(s):s,i=r===void 0?void 0:r instanceof Uint8Array?te(r):r;throw new ue(e,t,n,i)}function bs(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Fe;return j()}if(t.length>1)throw new Z(1,w(),x(`bash: break: too many arguments
5
5
  `));let s=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new Z(128,w(),x(`bash: break: ${t[0]}: numeric argument required
@@ -670,7 +670,7 @@ sys 0m0.000s
670
670
  `,127)}if(d==="exec"&&(m.length===0||H(m[0])==="--")){for(let $ of t.redirections){if($.target.type==="HereDoc"||$.fdVariable)continue;let A=await V(this.ctx,$.target),N=$.fd??($.operator==="<"||$.operator==="<>"?0:1);switch(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),$.operator){case">":case">|":{let P=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);await this.ctx.fs.writeFile(P,"","utf8"),this.ctx.state.fileDescriptors.set(N,`__file__:${P}`);break}case">>":{let P=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);this.ctx.state.fileDescriptors.set(N,`__file_append__:${P}`);break}case"<":{let P=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);try{let W=await this.ctx.fs.readFileText(P);this.ctx.state.fileDescriptors.set(N,W)}catch{return C(`bash: ${A}: No such file or directory
671
671
  `)}break}case"<>":{let P=this.ctx.fs.resolvePath(this.ctx.state.cwd,A);try{let W=await this.ctx.fs.readFileText(P);this.ctx.state.fileDescriptors.set(N,`__rw__:${P.length}:${P}:0:${W}`)}catch{await this.ctx.fs.writeFile(P,"","utf8"),this.ctx.state.fileDescriptors.set(N,`__rw__:${P.length}:${P}:0:`)}break}case">&":{if(A==="-")this.ctx.state.fileDescriptors.delete(N);else if(A.endsWith("-")){let P=A.slice(0,-1),W=Number.parseInt(P,10);if(!Number.isNaN(W)){let I=this.ctx.state.fileDescriptors.get(W);I!==void 0?this.ctx.state.fileDescriptors.set(N,I):this.ctx.state.fileDescriptors.set(N,`__dupout__:${W}`),this.ctx.state.fileDescriptors.delete(W)}}else{let P=Number.parseInt(A,10);Number.isNaN(P)||this.ctx.state.fileDescriptors.set(N,`__dupout__:${P}`)}break}case"<&":{if(A==="-")this.ctx.state.fileDescriptors.delete(N);else if(A.endsWith("-")){let P=A.slice(0,-1),W=Number.parseInt(P,10);if(!Number.isNaN(W)){let I=this.ctx.state.fileDescriptors.get(W);I!==void 0?this.ctx.state.fileDescriptors.set(N,I):this.ctx.state.fileDescriptors.set(N,`__dupin__:${W}`),this.ctx.state.fileDescriptors.delete(W)}}else{let P=Number.parseInt(A,10);Number.isNaN(P)||this.ctx.state.fileDescriptors.set(N,`__dupin__:${P}`)}break}}}for(let[$,A]of n)A===void 0?this.ctx.state.env.delete($):this.ctx.state.env.set($,A);if(this.ctx.state.tempExportedVars)for(let $ of n.keys())this.ctx.state.tempExportedVars.delete($);return j()}let y=await Qn(this.ctx,d,m.map($=>H($)));n.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(n)));let E,_=null;try{E=await this.runCommand(d,m,p,f??te(h),!1,!1,u)}catch($){if($ instanceof ve||$ instanceof be)_=$,E=j();else throw $}let b=i+y;if(b&&(E={...E,stderr:D(x(b),E.stderr)}),E=await K(this.ctx,E,t.redirections),_)throw _;if(m.length>0){let $=H(m[m.length-1]);if((d==="declare"||d==="local"||d==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test($)){let A=$.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);A&&($=A[1])}this.ctx.state.lastArg=B($)}else this.ctx.state.lastArg=B(d);let k=cn(d)&&d!=="unset"&&d!=="eval";if(!this.ctx.state.options.posix||!k)for(let[$,A]of n)this.ctx.state.fullyUnsetLocals?.has($)||(A===void 0?this.ctx.state.env.delete($):this.ctx.state.env.set($,A));if(this.ctx.state.tempExportedVars)for(let $ of n.keys())this.ctx.state.tempExportedVars.delete($);return n.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(E={...E,stderr:D(x(this.ctx.state.expansionStderr),E.stderr)},this.ctx.state.expansionStderr=""),E}async runCommand(t,s,r,n,i=!1,o=!1,a=-1){let l={ctx:this.ctx,runCommand:(c,f,h,d,m,p,v)=>this.runCommand(c,f,h,d,m,p,v),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(c,f,h)=>this.executeUserScript(c,f,h??w())},u=await Vn(l,t,s,r,n,i,o,a);return u!==null?u:Bn(l,t,s,n,o)}aliasExpansionStack=new Set;expandAlias(t){return vs(this.ctx.state,t,this.aliasExpansionStack)}async findCommandInPath(t){return ts(this.ctx,t)}async executeSubshell(t,s=w()){return ri(this.ctx,t,s,r=>this.executeStatement(r))}async executeGroup(t,s=w()){return ni(this.ctx,t,s,r=>this.executeStatement(r))}async executeArithmeticCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let s=await De(this.ctx,t.redirections);if(s)return s;try{let r=await X(this.ctx,t.expression.expression),n=ee(r!==0);return this.ctx.state.expansionStderr&&(n={...n,stderr:D(x(this.ctx.state.expansionStderr),n.stderr)},this.ctx.state.expansionStderr=""),K(this.ctx,n,t.redirections)}catch(r){let n=C(`bash: arithmetic expression: ${r.message}
672
672
  `);return K(this.ctx,n,t.redirections)}}async executeConditionalCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let s=await De(this.ctx,t.redirections);if(s)return s;try{let r=await ze(this.ctx,t.expression),n=ee(r);return this.ctx.state.expansionStderr&&(n={...n,stderr:D(x(this.ctx.state.expansionStderr),n.stderr)},this.ctx.state.expansionStderr=""),K(this.ctx,n,t.redirections)}catch(r){let n=r instanceof Be?1:2,i=C(`bash: conditional expression: ${r.message}
673
- `,n);return K(this.ctx,i,t.redirections)}}};var ye={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:3e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50};function oi(e){return e?{maxCallDepth:e.maxCallDepth??ye.maxCallDepth,maxCommandCount:e.maxCommandCount??ye.maxCommandCount,maxLoopIterations:e.maxLoopIterations??ye.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??ye.maxAwkIterations,maxSedIterations:e.maxSedIterations??ye.maxSedIterations,maxJqIterations:e.maxJqIterations??ye.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??ye.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??ye.maxPythonTimeoutMs,maxGlobOperations:e.maxGlobOperations??ye.maxGlobOperations,maxStringLength:e.maxStringLength??ye.maxStringLength,maxArrayElements:e.maxArrayElements??ye.maxArrayElements,maxHeredocSize:e.maxHeredocSize??ye.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??ye.maxSubstitutionDepth}:{...ye}}function ai(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function Vo(e){let t=ai(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function Bo(e,t){let s=ai(e);if(!s)return!1;let r=Vo(t);return!r||s.origin!==r.origin?!1:r.pathPrefix==="/"||r.pathPrefix===""?!0:s.pathname.startsWith(r.pathPrefix)}function fr(e,t){return!t||t.length===0?!1:t.some(s=>Bo(e,s))}var bt=class extends Error{constructor(t){super(`Network access denied: URL not in allow-list: ${t}`),this.name="NetworkAccessDeniedError"}},St=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},Et=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},rs=class extends Error{constructor(t,s){super(`HTTP method '${t}' not allowed. Allowed methods: ${s.join(", ")}`),this.name="MethodNotAllowedError"}},$t=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};var jo=20,Ho=3e4,Uo=10485760,Go=["GET","HEAD"],qo=new Set(["GET","HEAD","OPTIONS"]),Zo=new Set([301,302,303,307,308]);function dr(e){let t=e.maxRedirects??jo,s=e.timeoutMs??Ho,r=e.maxResponseSize??Uo,n=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??Go;function i(l){if(!e.dangerouslyAllowFullInternetAccess&&!fr(l,e.allowedUrlPrefixes??[]))throw new bt(l)}function o(l){if(e.dangerouslyAllowFullInternetAccess)return;let u=l.toUpperCase();if(!n.includes(u))throw new rs(u,n)}async function a(l,u={}){let c=u.method?.toUpperCase()??"GET";i(l),o(c);let f=l,h=0,d=u.followRedirects??!0,m=u.timeoutMs!==void 0?Math.min(u.timeoutMs,s):s;for(;;){let p=new AbortController,v=setTimeout(()=>p.abort(),m);try{let y={method:c,headers:u.headers,signal:p.signal,redirect:"manual"};u.body&&!qo.has(c)&&(y.body=u.body);let E=await fetch(f,y);if(Zo.has(E.status)&&d){let _=E.headers.get("location");if(!_)return await li(E,f,r);let b=new URL(_,f).href;if(!e.dangerouslyAllowFullInternetAccess&&!fr(b,e.allowedUrlPrefixes??[]))throw new Et(b);if(h++,h>t)throw new St(t);f=b;continue}return await li(E,f,r)}finally{clearTimeout(v)}}}return a}async function li(e,t,s){let r=Object.create(null);if(e.headers.forEach((i,o)=>{r[o.toLowerCase()]=i}),s>0){let i=e.headers.get("content-length");if(i){let o=parseInt(i,10);if(!Number.isNaN(o)&&o>s)throw new $t(s)}}let n;if(s>0&&e.body){let i=e.body.getReader(),o=new TextDecoder,a=[],l=0;for(;;){let{done:u,value:c}=await i.read();if(u)break;if(l+=c.byteLength,l>s)throw i.cancel(),new $t(s);a.push(o.decode(c,{stream:!0}))}a.push(o.decode()),n=a.join("")}else n=await e.text();return{status:e.status,statusText:e.statusText,headers:r,body:n,url:t}}function ci(){let e=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables"},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return e.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}})}var At=typeof __BROWSER__<"u"&&__BROWSER__;function ui(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var pr=null;if(!At)try{let{createRequire:e}=await import("node:module");pr=e(import.meta.url)("node:async_hooks").AsyncLocalStorage}catch(e){console.debug("[DefenseInDepthBox] AsyncLocalStorage not available, defense-in-depth disabled:",e instanceof Error?e.message:e)}var Yo=`
673
+ `,n);return K(this.ctx,i,t.redirections)}}};var ye={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:3e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50};function oi(e){return e?{maxCallDepth:e.maxCallDepth??ye.maxCallDepth,maxCommandCount:e.maxCommandCount??ye.maxCommandCount,maxLoopIterations:e.maxLoopIterations??ye.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??ye.maxAwkIterations,maxSedIterations:e.maxSedIterations??ye.maxSedIterations,maxJqIterations:e.maxJqIterations??ye.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??ye.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??ye.maxPythonTimeoutMs,maxGlobOperations:e.maxGlobOperations??ye.maxGlobOperations,maxStringLength:e.maxStringLength??ye.maxStringLength,maxArrayElements:e.maxArrayElements??ye.maxArrayElements,maxHeredocSize:e.maxHeredocSize??ye.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??ye.maxSubstitutionDepth}:{...ye}}function ai(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function Vo(e){let t=ai(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function Bo(e,t){let s=ai(e);if(!s)return!1;let r=Vo(t);return!r||s.origin!==r.origin?!1:r.pathPrefix==="/"||r.pathPrefix===""?!0:s.pathname.startsWith(r.pathPrefix)}function fr(e,t){return!t||t.length===0?!1:t.some(s=>Bo(e,s))}var bt=class extends Error{constructor(t){super(`Network access denied: URL not in allow-list: ${t}`),this.name="NetworkAccessDeniedError"}},St=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},Et=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},rs=class extends Error{constructor(t,s){super(`HTTP method '${t}' not allowed. Allowed methods: ${s.join(", ")}`),this.name="MethodNotAllowedError"}},$t=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};var jo=20,Ho=3e4,Uo=10485760,Go=["GET","HEAD"],qo=new Set(["GET","HEAD","OPTIONS"]),Zo=new Set([301,302,303,307,308]);function dr(e){let t=e.maxRedirects??jo,s=e.timeoutMs??Ho,r=e.maxResponseSize??Uo,n=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??Go;function i(l){if(!e.dangerouslyAllowFullInternetAccess&&!fr(l,e.allowedUrlPrefixes??[]))throw new bt(l)}function o(l){if(e.dangerouslyAllowFullInternetAccess)return;let u=l.toUpperCase();if(!n.includes(u))throw new rs(u,n)}async function a(l,u={}){let c=u.method?.toUpperCase()??"GET";i(l),o(c);let f=l,h=0,d=u.followRedirects??!0,m=u.timeoutMs!==void 0?Math.min(u.timeoutMs,s):s;for(;;){let p=new AbortController,v=setTimeout(()=>p.abort(),m);try{let y={method:c,headers:u.headers,signal:p.signal,redirect:"manual"};u.body&&!qo.has(c)&&(y.body=u.body);let E=await fetch(f,y);if(Zo.has(E.status)&&d){let _=E.headers.get("location");if(!_)return await li(E,f,r);let b=new URL(_,f).href;if(!e.dangerouslyAllowFullInternetAccess&&!fr(b,e.allowedUrlPrefixes??[]))throw new Et(b);if(h++,h>t)throw new St(t);f=b;continue}return await li(E,f,r)}finally{clearTimeout(v)}}}return a}async function li(e,t,s){let r=Object.create(null);if(e.headers.forEach((i,o)=>{r[o.toLowerCase()]=i}),s>0){let i=e.headers.get("content-length");if(i){let o=parseInt(i,10);if(!Number.isNaN(o)&&o>s)throw new $t(s)}}let n;if(s>0&&e.body){let i=e.body.getReader(),o=new TextDecoder,a=[],l=0;for(;;){let{done:u,value:c}=await i.read();if(u)break;if(l+=c.byteLength,l>s)throw i.cancel(),new $t(s);a.push(o.decode(c,{stream:!0}))}a.push(o.decode()),n=a.join("")}else n=await e.text();return{status:e.status,statusText:e.statusText,headers:r,body:n,url:t}}function ci(){let e=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables"},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return e.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}})}var At=typeof __BROWSER__<"u"&&__BROWSER__;function ui(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var pr=null;if(!At)try{let e="node:module",{createRequire:t}=await import(e);pr=t(import.meta.url)("node:async_hooks").AsyncLocalStorage}catch(e){console.debug("[DefenseInDepthBox] AsyncLocalStorage not available, defense-in-depth disabled:",e instanceof Error?e.message:e)}var Yo=`
674
674
 
675
675
  This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,fe=class extends Error{violation;constructor(t,s){super(t+Yo),this.violation=s,this.name="SecurityViolationError"}},ge=!At&&pr?new pr:null,Xo=1e3,hr={enabled:!0,auditMode:!1};function Ko(e){return e===void 0?{...hr,enabled:!1}:typeof e=="boolean"?{...hr,enabled:e}:{...hr,...e}}var ns=class e{static instance=null;config;refCount=0;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){return e.instance||(e.instance=new e(Ko(t))),e.instance}static resetInstance(){e.instance&&(e.instance.forceDeactivate(),e.instance=null)}static isInSandboxedContext(){return ge?ge?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(ge)return ge?.getStore()?.executionId}updateConfig(t){this.config={...this.config,...t}}activate(){if(At||!this.config.enabled){let s=ui();return{run:r=>r(),deactivate:()=>{},executionId:s}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let t=ui();return{run:s=>ge.run({sandboxActive:!0,executionId:t},s),deactivate:()=>{this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0)},executionId:t}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}clearViolations(){this.violations=[]}getPathForTarget(t,s){return t===globalThis?`globalThis.${s}`:t===process?`process.${s}`:t===Error?`Error.${s}`:t===Function.prototype?`Function.prototype.${s}`:t===Object.prototype?`Object.prototype.${s}`:`<object>.${s}`}shouldBlock(){return At||this.config.auditMode||!ge?!1:ge?.getStore()?.sandboxActive===!0}recordViolation(t,s,r){let n={timestamp:Date.now(),type:t,message:r,path:s,stack:new Error().stack,executionId:ge?.getStore()?.executionId};if(this.violations.length<Xo&&this.violations.push(n),this.config.onViolation)try{this.config.onViolation(n)}catch(i){console.debug("[DefenseInDepthBox] onViolation callback threw:",i instanceof Error?i.message:i)}return n}createBlockingProxy(t,s,r){let n=this;return new Proxy(t,{apply(i,o,a){if(n.shouldBlock()){let l=`${s} is blocked during script execution`,u=n.recordViolation(r,s,l);throw new fe(l,u)}return n.config.auditMode&&ge?.getStore()?.sandboxActive===!0&&n.recordViolation(r,s,`${s} called (audit mode)`),Reflect.apply(i,o,a)},construct(i,o,a){if(n.shouldBlock()){let l=`${s} constructor is blocked during script execution`,u=n.recordViolation(r,s,l);throw new fe(l,u)}return n.config.auditMode&&ge?.getStore()?.sandboxActive===!0&&n.recordViolation(r,s,`${s} constructor called (audit mode)`),Reflect.construct(i,o,a)}})}createBlockingObjectProxy(t,s,r){let n=this;return new Proxy(t,{get(i,o,a){if(n.shouldBlock()){let l=`${s}.${String(o)}`,u=`${l} is blocked during script execution`,c=n.recordViolation(r,l,u);throw new fe(u,c)}if(n.config.auditMode&&ge?.getStore()?.sandboxActive===!0){let l=`${s}.${String(o)}`;n.recordViolation(r,l,`${l} accessed (audit mode)`)}return Reflect.get(i,o,a)},set(i,o,a,l){if(n.shouldBlock()){let u=`${s}.${String(o)}`,c=`${u} modification is blocked during script execution`,f=n.recordViolation(r,u,c);throw new fe(c,f)}return Reflect.set(i,o,a,l)},ownKeys(i){if(n.shouldBlock()){let o=`${s} enumeration is blocked during script execution`,a=n.recordViolation(r,s,o);throw new fe(o,a)}return Reflect.ownKeys(i)},getOwnPropertyDescriptor(i,o){if(n.shouldBlock()){let a=`${s}.${String(o)}`,l=`${a} descriptor access is blocked during script execution`,u=n.recordViolation(r,a,l);throw new fe(l,u)}return Reflect.getOwnPropertyDescriptor(i,o)},has(i,o){if(n.shouldBlock()){let a=`${s}.${String(o)}`,l=`${a} existence check is blocked during script execution`,u=n.recordViolation(r,a,l);throw new fe(l,u)}return Reflect.has(i,o)}})}applyPatches(){let t=ci();for(let s of t)this.applyPatch(s);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectModuleLoad(),this.protectProcessMainModule()}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(t){console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(t){console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(async function*(){}).constructor,s=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&t!==s&&this.patchPrototypeConstructor(t.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(t){console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}}protectErrorPrepareStackTrace(){let t=this;try{let s=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:s});let r=s?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(n){if(t.shouldBlock()){let i="Error.prepareStackTrace modification is blocked during script execution",o=t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",i);throw new fe(i,o)}t.config.auditMode&&ge?.getStore()?.sandboxActive===!0&&t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=n},configurable:!0})}catch(s){console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",s instanceof Error?s.message:s)}}patchPrototypeConstructor(t,s,r){let n=this;try{let i=Object.getOwnPropertyDescriptor(t,"constructor");this.originalDescriptors.push({target:t,prop:"constructor",descriptor:i});let o=i?.value;Object.defineProperty(t,"constructor",{get(){if(n.shouldBlock()){let a=`${s} access is blocked during script execution`,l=n.recordViolation(r,s,a);throw new fe(a,l)}return n.config.auditMode&&ge?.getStore()?.sandboxActive===!0&&n.recordViolation(r,s,`${s} accessed (audit mode)`),o},set(a){if(n.shouldBlock()){let l=`${s} modification is blocked during script execution`,u=n.recordViolation(r,s,l);throw new fe(l,u)}Object.defineProperty(this,"constructor",{value:a,writable:!0,configurable:!0})},configurable:!0})}catch(i){console.debug(`[DefenseInDepthBox] Could not patch ${s}:`,i instanceof Error?i.message:i)}}protectProcessMainModule(){if(typeof process>"u")return;let t=this;try{let s=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:s});let r=s?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(t.shouldBlock()){let n="process.mainModule access is blocked during script execution",i=t.recordViolation("process_main_module","process.mainModule",n);throw new fe(n,i)}return t.config.auditMode&&ge?.getStore()?.sandboxActive===!0&&t.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(n){if(t.shouldBlock()){let i="process.mainModule modification is blocked during script execution",o=t.recordViolation("process_main_module","process.mainModule",i);throw new fe(i,o)}Object.defineProperty(process,"mainModule",{value:n,writable:!0,configurable:!0})},configurable:!0})}catch(s){console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",s instanceof Error?s.message:s)}}protectModuleLoad(){if(!At)try{let t=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(t=o.constructor)}if(!t&&typeof _t<"u"&&typeof _t.main<"u"&&(t=_t.main.constructor),!t||typeof t._load!="function")return;let s=t._load,r=Object.getOwnPropertyDescriptor(t,"_load");this.originalDescriptors.push({target:t,prop:"_load",descriptor:r});let i=this.createBlockingProxy(s,"Module._load","module_load");Object.defineProperty(t,"_load",{value:i,writable:!0,configurable:!0})}catch(t){console.debug("[DefenseInDepthBox] Could not protect Module._load:",t instanceof Error?t.message:t)}}applyPatch(t){let{target:s,prop:r,violationType:n,strategy:i}=t;try{let o=s[r];if(o===void 0)return;let a=Object.getOwnPropertyDescriptor(s,r);if(this.originalDescriptors.push({target:s,prop:r,descriptor:a}),i==="freeze")typeof o=="object"&&o!==null&&Object.freeze(o);else{let l=this.getPathForTarget(s,r),u=typeof o=="function"?this.createBlockingProxy(o,l,n):this.createBlockingObjectProxy(o,l,n);Object.defineProperty(s,r,{value:u,writable:!0,configurable:!0})}}catch(o){let a=this.getPathForTarget(s,r);console.debug(`[DefenseInDepthBox] Could not patch ${a}:`,o instanceof Error?o.message:o)}}restorePatches(){for(let t=this.originalDescriptors.length-1;t>=0;t--){let{target:s,prop:r,descriptor:n}=this.originalDescriptors[t];try{n?Object.defineProperty(s,r,n):delete s[r]}catch(i){let o=this.getPathForTarget(s,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,i instanceof Error?i.message:i)}}this.originalDescriptors=[]}};var is=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;state;constructor(t={}){let s=t.fs??new dt(t.files);this.fs=s,this.useDefaultLayout=!t.cwd&&!t.files;let r=t.cwd||(this.useDefaultLayout?"/home/user":"/"),n=new Map,i=[["HOME",this.useDefaultLayout?"/home/user":"/"],["PATH","/usr/bin:/bin"],["IFS",`
676
676
  `],["OSTYPE","linux-gnu"],["MACHTYPE","x86_64-pc-linux-gnu"],["HOSTTYPE","x86_64"],["HOSTNAME","localhost"],["PWD",r],["OLDPWD",r],["OPTIND","1"]];for(let[o,a]of i)g(n,o,a);for(let[o,a]of Object.entries(t.env??{}))g(n,o,a);if(this.limits=oi({...t.executionLimits,...t.maxCallDepth!==void 0&&{maxCallDepth:t.maxCallDepth},...t.maxCommandCount!==void 0&&{maxCommandCount:t.maxCommandCount},...t.maxLoopIterations!==void 0&&{maxLoopIterations:t.maxLoopIterations}}),t.network&&(this.secureFetch=dr(t.network)),this.sleepFn=t.sleep,this.traceFn=t.trace,this.logger=t.logger,this.defenseInDepthConfig=t.defenseInDepth,this.coverageWriter=t.coverage,this.state={env:n,cwd:r,previousDir:"/home/user",functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastArg:F,startTime:Date.now(),lastBackgroundPid:0,bashPid:as().pid,nextVirtualPid:as().pid+1,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1,posix:!1,allexport:!1,noclobber:!1,noglob:!1,noexec:!1,vi:!1,emacs:!1},shoptOptions:{extglob:!1,dotglob:!1,nullglob:!1,failglob:!1,globstar:!1,globskipdots:!0,nocaseglob:!1,nocasematch:!1,expand_aliases:!1,lastpipe:!1,xpg_echo:!1},inCondition:!1,loopDepth:0,exportedVars:new Set(["HOME","PATH","PWD","OLDPWD",...Object.keys(t.env||{})]),readonlyVars:new Set(["SHELLOPTS","BASHOPTS"]),hashTable:new Map},g(this.state.env,"SHELLOPTS",ys(this.state.options)),g(this.state.env,"BASHOPTS",gs(this.state.shoptOptions)),Vr(s,this.useDefaultLayout),r!=="/"&&s instanceof dt)try{s.mkdirSync(r,{recursive:!0})}catch{}for(let o of Ir(t.commands))this.registerCommand(o);if(t.network)for(let o of Rr())this.registerCommand(o);if(t.python)for(let o of Lr())this.registerCommand(o);if(t.customCommands)for(let o of t.customCommands)Fr(o)?this.registerCommand(Mr(o)):this.registerCommand(o)}registerCommand(t){this.commands.set(t.name,t);let s=this.fs;if(typeof s.writeFileSync=="function"){let r=`#!/bin/bash
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import{a as q,b as H,c as V}from"./chunk-BXOX2H2G.js";import{a as M}from"./chunk-SE4C7FJY.js";import{a as G,b as U,c as P}from"./chunk-DFAHK2EQ.js";import{b as g,e as v,f as E,g as R}from"./chunk-RAUBS6MJ.js";import{k as B}from"./chunk-463VWH7H.js";var Z={js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}},k=class{types;constructor(){this.types=new Map(Object.entries(Z).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let s=t.slice(0,n),r=t.slice(n+1);if(r.startsWith("include:")){let l=r.slice(8),i=this.types.get(l);if(i){let a=this.types.get(s)||{extensions:[],globs:[]};a.extensions.push(...i.extensions),a.globs.push(...i.globs),this.types.set(s,a)}}else{let l=this.types.get(s)||{extensions:[],globs:[]};if(r.startsWith("*.")&&!r.slice(2).includes("*")){let i=r.slice(1);l.extensions.includes(i)||l.extensions.push(i)}else l.globs.includes(r)||l.globs.push(r);this.types.set(s,l)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let s=t.toLowerCase();for(let r of n){if(r==="all"){if(this.matchesAnyType(t))return!0;continue}let l=this.types.get(r);if(l){for(let i of l.extensions)if(s.endsWith(i))return!0;for(let i of l.globs)if(i.includes("*")){let a=i.replace(/\./g,"\\.").replace(/\*/g,".*");if(M(`^${a}$`,"i").test(t))return!0}else if(s===i.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let s of this.types.values()){for(let r of s.extensions)if(n.endsWith(r))return!0;for(let r of s.globs)if(r.includes("*")){let l=r.replace(/\./g,"\\.").replace(/\*/g,".*");if(M(`^${l}$`,"i").test(t))return!0}else if(n===r.toLowerCase())return!0}return!1}};function J(){let e=[];for(let[t,n]of Object.entries(Z).sort()){let s=[];for(let r of n.extensions)s.push(`*${r}`);for(let r of n.globs)s.push(r);e.push(`${t}: ${s.join(", ")}`)}return`${e.join(`
2
+ import{a as q,b as H,c as V}from"./chunk-BXOX2H2G.js";import{a as M}from"./chunk-SE4C7FJY.js";import{a as G,b as U,c as O}from"./chunk-DFAHK2EQ.js";import{b as g,e as v,f as E,g as L}from"./chunk-RAUBS6MJ.js";import{k as B}from"./chunk-463VWH7H.js";var Z={js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}},k=class{types;constructor(){this.types=new Map(Object.entries(Z).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let s=t.slice(0,n),r=t.slice(n+1);if(r.startsWith("include:")){let l=r.slice(8),i=this.types.get(l);if(i){let a=this.types.get(s)||{extensions:[],globs:[]};a.extensions.push(...i.extensions),a.globs.push(...i.globs),this.types.set(s,a)}}else{let l=this.types.get(s)||{extensions:[],globs:[]};if(r.startsWith("*.")&&!r.slice(2).includes("*")){let i=r.slice(1);l.extensions.includes(i)||l.extensions.push(i)}else l.globs.includes(r)||l.globs.push(r);this.types.set(s,l)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let s=t.toLowerCase();for(let r of n){if(r==="all"){if(this.matchesAnyType(t))return!0;continue}let l=this.types.get(r);if(l){for(let i of l.extensions)if(s.endsWith(i))return!0;for(let i of l.globs)if(i.includes("*")){let a=i.replace(/\./g,"\\.").replace(/\*/g,".*");if(M(`^${a}$`,"i").test(t))return!0}else if(s===i.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let s of this.types.values()){for(let r of s.extensions)if(n.endsWith(r))return!0;for(let r of s.globs)if(r.includes("*")){let l=r.replace(/\./g,"\\.").replace(/\*/g,".*");if(M(`^${l}$`,"i").test(t))return!0}else if(n===r.toLowerCase())return!0}return!1}};function J(){let e=[];for(let[t,n]of Object.entries(Z).sort()){let s=[];for(let r of n.extensions)s.push(`*${r}`);for(let r of n.globs)s.push(r);e.push(`${t}: ${s.join(", ")}`)}return`${e.join(`
3
3
  `)}
4
4
  `}function Y(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:1/0,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}function re(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function ie(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:g(),stderr:v(`rg: invalid --max-filesize value: ${e}
5
- `),exitCode:1}}function K(e){return null}var X=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:K},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:K},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:parseInt},{long:"max-filesize",target:"maxFilesize",parse:re,validate:ie},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",target:"maxDepth",parse:()=>1/0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],le=new Map([["i",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["--ignore-case",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["s",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["--case-sensitive",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["S",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["--smart-case",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["F",e=>{e.fixedStrings=!0}],["--fixed-strings",e=>{e.fixedStrings=!0}],["w",e=>{e.wordRegexp=!0}],["--word-regexp",e=>{e.wordRegexp=!0}],["x",e=>{e.lineRegexp=!0}],["--line-regexp",e=>{e.lineRegexp=!0}],["v",e=>{e.invertMatch=!0}],["--invert-match",e=>{e.invertMatch=!0}],["U",e=>{e.multiline=!0}],["--multiline",e=>{e.multiline=!0}],["--multiline-dotall",e=>{e.multilineDotall=!0,e.multiline=!0}],["c",e=>{e.count=!0}],["--count",e=>{e.count=!0}],["--count-matches",e=>{e.countMatches=!0}],["l",e=>{e.filesWithMatches=!0}],["--files",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!0}],["o",e=>{e.onlyMatching=!0}],["--only-matching",e=>{e.onlyMatching=!0}],["q",e=>{e.quiet=!0}],["--quiet",e=>{e.quiet=!0}],["N",e=>{e.lineNumber=!1}],["--no-line-number",e=>{e.lineNumber=!1}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["I",e=>{e.noFilename=!0}],["--no-filename",e=>{e.noFilename=!0}],["0",e=>{e.nullSeparator=!0}],["--null",e=>{e.nullSeparator=!0}],["b",e=>{e.byteOffset=!0}],["--byte-offset",e=>{e.byteOffset=!0}],["--column",e=>{e.column=!0,e.lineNumber=!0}],["--no-column",e=>{e.column=!1}],["--vimgrep",e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],["--json",e=>{e.json=!0}],["--hidden",e=>{e.hidden=!0}],["--no-ignore",e=>{e.noIgnore=!0}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!0}],["L",e=>{e.followSymlinks=!0}],["--follow",e=>{e.followSymlinks=!0}],["z",e=>{e.searchZip=!0}],["--search-zip",e=>{e.searchZip=!0}],["a",e=>{e.searchBinary=!0}],["--text",e=>{e.searchBinary=!0}],["--heading",e=>{e.heading=!0}],["--passthru",e=>{e.passthru=!0}],["--include-zero",e=>{e.includeZero=!0}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),oe=new Set(["n","--line-number"]);function ae(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function ce(e,t,n){let s=e[t];for(let r of X){if(s.startsWith(`--${r.long}=`)){let l=s.slice(`--${r.long}=`.length),i=A(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s.startsWith(`-${r.short}`)&&s.length>2){let l=s.slice(2),i=A(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s===`-${r.short}`||s===`--${r.long}`){if(t+1>=e.length)return null;let l=e[t+1],i=A(n,r,l);return i?{newIndex:t+1,error:i}:{newIndex:t+1}}}return null}function fe(e){return X.find(t=>t.short===e)}function A(e,t,n){if(t.validate){let r=t.validate(n);if(r)return r}let s=t.parse?t.parse(n):n;t.multi?e[t.target].push(s):e[t.target]=s}function ue(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let s=e[t+1];if(s==="path"||s==="none")return{value:s,newIndex:t+1}}if(n.startsWith("--sort=")){let s=n.slice(7);if(s==="path"||s==="none")return{value:s,newIndex:t}}return null}function he(e,t){let n=e[t],s=n.match(/^-([ABC])(\d+)$/);return s?{flag:s[1],value:parseInt(s[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function ge(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function Q(e){let t=Y(),n=null,s=[],r=-1,l=-1,i=-1,a=!1;for(let c=0;c<e.length;c++){let o=e[c];if(o.startsWith("-")&&o!=="-"){let u=he(e,c);if(u){let{flag:f,value:y,newIndex:w}=u;f==="A"?r=Math.max(r,y):f==="B"?l=Math.max(l,y):i=y,c=w;continue}let x=ge(o);if(x!==null){t.maxCount=x;continue}let m=ce(e,c,t);if(m){if(m.error)return{success:!1,error:m.error};c=m.newIndex;continue}let p=ue(e,c);if(p){t.sort=p.value,c=p.newIndex;continue}let C=o.startsWith("--")?[o]:o.slice(1).split(""),d=!1;for(let f of C){if(oe.has(f)){t.lineNumber=!0,a=!0;continue}if(f==="u"||f==="--unrestricted"){ae(t);continue}if(f==="P"||f==="--pcre2")return{success:!1,error:{stdout:g(),stderr:v(`rg: PCRE2 is not supported. Use standard regex syntax instead.
6
- `),exitCode:1}};if(f.length===1){let w=fe(f);if(w){if(c+1>=e.length)return{success:!1,error:P("rg",`-${f}`)};let h=A(t,w,e[c+1]);if(h)return{success:!1,error:h};c++,d=!0;continue}}let y=le.get(f);if(y){y(t);continue}if(f.startsWith("--"))return{success:!1,error:P("rg",f)};if(f.length===1)return{success:!1,error:P("rg",`-${f}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=o:s.push(o)}return(r>=0||i>=0)&&(t.afterContext=Math.max(r>=0?r:0,i>=0?i:0)),(l>=0||i>=0)&&(t.beforeContext=Math.max(l>=0?l:0,i>=0?i:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(a=!0),{success:!0,options:t,paths:s,explicitLineNumbers:a}}import{gunzipSync as pe}from"node:zlib";var N=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
7
- `);for(let s of n){let r=s.replace(/\s+$/,"");if(!r||r.startsWith("#"))continue;let l=!1;r.startsWith("!")&&(l=!0,r=r.slice(1));let i=!1;r.endsWith("/")&&(i=!0,r=r.slice(0,-1));let a=!1;r.startsWith("/")?(a=!0,r=r.slice(1)):r.includes("/")&&!r.startsWith("**/")&&(a=!0);let c=this.patternToRegex(r,a);this.patterns.push({pattern:s,regex:c,negated:l,directoryOnly:i,rooted:a})}}patternToRegex(t,n){let s="";n?s="^":s="(?:^|/)";let r=0;for(;r<t.length;){let l=t[r];if(l==="*")t[r+1]==="*"?t[r+2]==="/"?(s+="(?:.*/)?",r+=3):(r+2>=t.length,s+=".*",r+=2):(s+="[^/]*",r++);else if(l==="?")s+="[^/]",r++;else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let a=t.slice(r,i+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),s+=a,r=i+1}else s+="\\[",r++}else l==="/"?(s+="/",r++):(s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r++)}return s+="(?:/.*)?$",M(s)}matches(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");let r=!1;for(let l of this.patterns)l.directoryOnly&&!n||l.regex.test(s)&&(r=!l.negated);return r}isWhitelisted(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");for(let r of this.patterns)if(!(r.directoryOnly&&!n)&&r.negated&&r.regex.test(s))return!0;return!1}getBasePath(){return this.basePath}},W=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,s=!1,r=!1){this.fs=t,this.skipDotIgnore=s,this.skipVcsIgnore=r}async load(t){let n=[],s=t;for(;;){n.unshift(s);let l=this.fs.resolvePath(s,"..");if(l===s)break;s=l}let r=[];this.skipVcsIgnore||r.push(".gitignore"),this.skipDotIgnore||r.push(".rgignore",".ignore");for(let l of n){this.loadedDirs.add(l);for(let i of r){let a=this.fs.resolvePath(l,i);try{let c=await this.fs.readFileText(a),o=new N(l);o.parse(c),this.parsers.push(o)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let s of n){let r=this.fs.resolvePath(t,s);try{let l=await this.fs.readFileText(r),i=new N(t);i.parse(l),this.parsers.push(i)}catch{}}}addPatternsFromContent(t,n){let s=new N(n);s.parse(t),this.parsers.push(s)}matches(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.matches(l,n))return!0}return!1}isWhitelisted(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.isWhitelisted(l,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}};async function _(e,t,n=!1,s=!1,r=[]){let l=new W(e,t,n,s);await l.load(t);for(let i of r)try{let a=e.resolvePath(t,i),c=await e.readFileText(a);l.addPatternsFromContent(c,t)}catch{}return l}function me(e){return e.length>=2&&e[0]===31&&e[1]===139}function de(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s==="["&&!t?t=!0:s==="]"&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function ee(e){let{ctx:t,options:n,paths:s,explicitLineNumbers:r}=e;for(let f of n.globs){let y=f.startsWith("!")?f.slice(1):f,w=de(y);if(w)return{stdout:g(),stderr:v(`${w}
8
- `),exitCode:1}}if(n.files){let f=[...n.patterns,...s];return be(t,f,n)}let l=[...n.patterns];for(let f of n.patternFiles)try{let y;if(f==="-")y=await R(t.stdin);else{let h=t.fs.resolvePath(t.cwd,f);y=await t.fs.readFileText(h)}let w=y.split(`
5
+ `),exitCode:1}}function K(e){return null}var X=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:K},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:K},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:parseInt},{long:"max-filesize",target:"maxFilesize",parse:re,validate:ie},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",target:"maxDepth",parse:()=>1/0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],le=new Map([["i",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["--ignore-case",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["s",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["--case-sensitive",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["S",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["--smart-case",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["F",e=>{e.fixedStrings=!0}],["--fixed-strings",e=>{e.fixedStrings=!0}],["w",e=>{e.wordRegexp=!0}],["--word-regexp",e=>{e.wordRegexp=!0}],["x",e=>{e.lineRegexp=!0}],["--line-regexp",e=>{e.lineRegexp=!0}],["v",e=>{e.invertMatch=!0}],["--invert-match",e=>{e.invertMatch=!0}],["U",e=>{e.multiline=!0}],["--multiline",e=>{e.multiline=!0}],["--multiline-dotall",e=>{e.multilineDotall=!0,e.multiline=!0}],["c",e=>{e.count=!0}],["--count",e=>{e.count=!0}],["--count-matches",e=>{e.countMatches=!0}],["l",e=>{e.filesWithMatches=!0}],["--files",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!0}],["o",e=>{e.onlyMatching=!0}],["--only-matching",e=>{e.onlyMatching=!0}],["q",e=>{e.quiet=!0}],["--quiet",e=>{e.quiet=!0}],["N",e=>{e.lineNumber=!1}],["--no-line-number",e=>{e.lineNumber=!1}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["I",e=>{e.noFilename=!0}],["--no-filename",e=>{e.noFilename=!0}],["0",e=>{e.nullSeparator=!0}],["--null",e=>{e.nullSeparator=!0}],["b",e=>{e.byteOffset=!0}],["--byte-offset",e=>{e.byteOffset=!0}],["--column",e=>{e.column=!0,e.lineNumber=!0}],["--no-column",e=>{e.column=!1}],["--vimgrep",e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],["--json",e=>{e.json=!0}],["--hidden",e=>{e.hidden=!0}],["--no-ignore",e=>{e.noIgnore=!0}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!0}],["L",e=>{e.followSymlinks=!0}],["--follow",e=>{e.followSymlinks=!0}],["z",e=>{e.searchZip=!0}],["--search-zip",e=>{e.searchZip=!0}],["a",e=>{e.searchBinary=!0}],["--text",e=>{e.searchBinary=!0}],["--heading",e=>{e.heading=!0}],["--passthru",e=>{e.passthru=!0}],["--include-zero",e=>{e.includeZero=!0}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),oe=new Set(["n","--line-number"]);function ae(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function ce(e,t,n){let s=e[t];for(let r of X){if(s.startsWith(`--${r.long}=`)){let l=s.slice(`--${r.long}=`.length),i=P(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s.startsWith(`-${r.short}`)&&s.length>2){let l=s.slice(2),i=P(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s===`-${r.short}`||s===`--${r.long}`){if(t+1>=e.length)return null;let l=e[t+1],i=P(n,r,l);return i?{newIndex:t+1,error:i}:{newIndex:t+1}}}return null}function fe(e){return X.find(t=>t.short===e)}function P(e,t,n){if(t.validate){let r=t.validate(n);if(r)return r}let s=t.parse?t.parse(n):n;t.multi?e[t.target].push(s):e[t.target]=s}function ue(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let s=e[t+1];if(s==="path"||s==="none")return{value:s,newIndex:t+1}}if(n.startsWith("--sort=")){let s=n.slice(7);if(s==="path"||s==="none")return{value:s,newIndex:t}}return null}function he(e,t){let n=e[t],s=n.match(/^-([ABC])(\d+)$/);return s?{flag:s[1],value:parseInt(s[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function ge(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function Q(e){let t=Y(),n=null,s=[],r=-1,l=-1,i=-1,a=!1;for(let c=0;c<e.length;c++){let o=e[c];if(o.startsWith("-")&&o!=="-"){let u=he(e,c);if(u){let{flag:f,value:y,newIndex:w}=u;f==="A"?r=Math.max(r,y):f==="B"?l=Math.max(l,y):i=y,c=w;continue}let x=ge(o);if(x!==null){t.maxCount=x;continue}let m=ce(e,c,t);if(m){if(m.error)return{success:!1,error:m.error};c=m.newIndex;continue}let p=ue(e,c);if(p){t.sort=p.value,c=p.newIndex;continue}let C=o.startsWith("--")?[o]:o.slice(1).split(""),d=!1;for(let f of C){if(oe.has(f)){t.lineNumber=!0,a=!0;continue}if(f==="u"||f==="--unrestricted"){ae(t);continue}if(f==="P"||f==="--pcre2")return{success:!1,error:{stdout:g(),stderr:v(`rg: PCRE2 is not supported. Use standard regex syntax instead.
6
+ `),exitCode:1}};if(f.length===1){let w=fe(f);if(w){if(c+1>=e.length)return{success:!1,error:O("rg",`-${f}`)};let h=P(t,w,e[c+1]);if(h)return{success:!1,error:h};c++,d=!0;continue}}let y=le.get(f);if(y){y(t);continue}if(f.startsWith("--"))return{success:!1,error:O("rg",f)};if(f.length===1)return{success:!1,error:O("rg",`-${f}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=o:s.push(o)}return(r>=0||i>=0)&&(t.afterContext=Math.max(r>=0?r:0,i>=0?i:0)),(l>=0||i>=0)&&(t.beforeContext=Math.max(l>=0?l:0,i>=0?i:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(a=!0),{success:!0,options:t,paths:s,explicitLineNumbers:a}}var N=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
7
+ `);for(let s of n){let r=s.replace(/\s+$/,"");if(!r||r.startsWith("#"))continue;let l=!1;r.startsWith("!")&&(l=!0,r=r.slice(1));let i=!1;r.endsWith("/")&&(i=!0,r=r.slice(0,-1));let a=!1;r.startsWith("/")?(a=!0,r=r.slice(1)):r.includes("/")&&!r.startsWith("**/")&&(a=!0);let c=this.patternToRegex(r,a);this.patterns.push({pattern:s,regex:c,negated:l,directoryOnly:i,rooted:a})}}patternToRegex(t,n){let s="";n?s="^":s="(?:^|/)";let r=0;for(;r<t.length;){let l=t[r];if(l==="*")t[r+1]==="*"?t[r+2]==="/"?(s+="(?:.*/)?",r+=3):(r+2>=t.length,s+=".*",r+=2):(s+="[^/]*",r++);else if(l==="?")s+="[^/]",r++;else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let a=t.slice(r,i+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),s+=a,r=i+1}else s+="\\[",r++}else l==="/"?(s+="/",r++):(s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r++)}return s+="(?:/.*)?$",M(s)}matches(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");let r=!1;for(let l of this.patterns)l.directoryOnly&&!n||l.regex.test(s)&&(r=!l.negated);return r}isWhitelisted(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");for(let r of this.patterns)if(!(r.directoryOnly&&!n)&&r.negated&&r.regex.test(s))return!0;return!1}getBasePath(){return this.basePath}},W=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,s=!1,r=!1){this.fs=t,this.skipDotIgnore=s,this.skipVcsIgnore=r}async load(t){let n=[],s=t;for(;;){n.unshift(s);let l=this.fs.resolvePath(s,"..");if(l===s)break;s=l}let r=[];this.skipVcsIgnore||r.push(".gitignore"),this.skipDotIgnore||r.push(".rgignore",".ignore");for(let l of n){this.loadedDirs.add(l);for(let i of r){let a=this.fs.resolvePath(l,i);try{let c=await this.fs.readFileText(a),o=new N(l);o.parse(c),this.parsers.push(o)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let s of n){let r=this.fs.resolvePath(t,s);try{let l=await this.fs.readFileText(r),i=new N(t);i.parse(l),this.parsers.push(i)}catch{}}}addPatternsFromContent(t,n){let s=new N(n);s.parse(t),this.parsers.push(s)}matches(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.matches(l,n))return!0}return!1}isWhitelisted(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.isWhitelisted(l,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}};async function R(e,t,n=!1,s=!1,r=[]){let l=new W(e,t,n,s);await l.load(t);for(let i of r)try{let a=e.resolvePath(t,i),c=await e.readFileText(a);l.addPatternsFromContent(c,t)}catch{}return l}async function pe(e){return(await import("node:zlib")).gunzipSync(e)}function me(e){return e.length>=2&&e[0]===31&&e[1]===139}function de(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s==="["&&!t?t=!0:s==="]"&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function ee(e){let{ctx:t,options:n,paths:s,explicitLineNumbers:r}=e;for(let f of n.globs){let y=f.startsWith("!")?f.slice(1):f,w=de(y);if(w)return{stdout:g(),stderr:v(`${w}
8
+ `),exitCode:1}}if(n.files){let f=[...n.patterns,...s];return be(t,f,n)}let l=[...n.patterns];for(let f of n.patternFiles)try{let y;if(f==="-")y=await L(t.stdin);else{let h=t.fs.resolvePath(t.cwd,f);y=await t.fs.readFileText(h)}let w=y.split(`
9
9
  `).filter(h=>h.length>0);l.push(...w)}catch{return{stdout:g(),stderr:v(`rg: ${f}: No such file or directory
10
10
  `),exitCode:2}}if(l.length===0)return n.patternFiles.length>0?{stdout:g(),stderr:g(),exitCode:1}:{stdout:g(),stderr:v(`rg: no pattern given
11
11
  `),exitCode:2};let i=s.length===0?["."]:s,a=xe(n,l),c,o;try{let f=ye(l,n,a);c=f.regex,o=f.kResetGroup}catch{return{stdout:g(),stderr:v(`rg: invalid regex: ${l.join(", ")}
12
- `),exitCode:2}}let u=null;n.noIgnore||(u=await _(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let x=new k;for(let f of n.typeClear)x.clearType(f);for(let f of n.typeAdd)x.addType(f);let{files:m,singleExplicitFile:p}=await te(t,i,n,u,x);if(m.length===0)return{stdout:g(),stderr:g(),exitCode:1};let C=!n.noFilename&&(n.withFilename||!p||m.length>1),d=n.lineNumber;return r||(p&&m.length===1&&(d=!1),n.onlyMatching&&(d=!1)),Ce(t,m,c,n,C,d,o)}function xe(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function ye(e,t,n){let s;return e.length===1?s=e[0]:s=e.map(r=>t.fixedStrings?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${r})`).join("|"),H(s,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function te(e,t,n,s,r){let l=[],i=0,a=0;for(let o of t){let u=e.fs.resolvePath(e.cwd,o);try{let x=await e.fs.stat(u);if(x.isFile){if(i++,n.maxFilesize>0&&x.size>n.maxFilesize)continue;ne(o,n,s,u,r)&&l.push(o)}else x.isDirectory&&(a++,await se(e,o,u,0,n,s,r,l))}catch{}}return{files:n.sort==="path"?l.sort():l,singleExplicitFile:i===1&&a===0}}async function se(e,t,n,s,r,l,i,a){if(!(s>=r.maxDepth)){l&&await l.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(o=>({name:o,isFile:void 0}));for(let o of c){let u=o.name;if(!r.noIgnore&&W.isCommonIgnored(u))continue;let x=u.startsWith("."),m=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,p=e.fs.resolvePath(n,u),C,d,f=!1;if(o.isFile!==void 0&&"isDirectory"in o){let h=o;if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;if(f&&r.followSymlinks)try{let b=await e.fs.stat(p);C=b.isFile,d=b.isDirectory}catch{continue}else C=h.isFile,d=h.isDirectory}else try{let h=e.fs.lstat?await e.fs.lstat(p):await e.fs.stat(p);if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;let b=f&&r.followSymlinks?await e.fs.stat(p):h;C=b.isFile,d=b.isDirectory}catch{continue}if(!l?.matches(p,d)&&!(x&&!r.hidden&&!l?.isWhitelisted(p,d))){if(d)await se(e,m,p,s+1,r,l,i,a);else if(C){if(r.maxFilesize>0)try{if((await e.fs.stat(p)).size>r.maxFilesize)continue}catch{continue}ne(m,r,l,p,i)&&a.push(m)}}}}catch{}}}function ne(e,t,n,s,r){let l=e.split("/").pop()||e;if(n?.matches(s,!1)||t.types.length>0&&!r.matchesType(l,t.types)||t.typesNot.length>0&&r.matchesType(l,t.typesNot))return!1;if(t.globs.length>0){let i=t.globCaseInsensitive,a=t.globs.filter(o=>!o.startsWith("!")),c=t.globs.filter(o=>o.startsWith("!")).map(o=>o.slice(1));if(a.length>0){let o=!1;for(let u of a)if(S(l,u,i)||S(e,u,i)){o=!0;break}if(!o)return!1}for(let o of c)if(o.startsWith("/")){let u=o.slice(1);if(S(e,u,i))return!1}else if(S(l,o,i)||S(e,o,i))return!1}if(t.iglobs.length>0){let i=t.iglobs.filter(c=>!c.startsWith("!")),a=t.iglobs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(i.length>0){let c=!1;for(let o of i)if(S(l,o,!0)||S(e,o,!0)){c=!0;break}if(!c)return!1}for(let c of a)if(c.startsWith("/")){let o=c.slice(1);if(S(e,o,!0))return!1}else if(S(l,c,!0)||S(e,c,!0))return!1}return!0}function S(e,t,n=!1){let s="^";for(let r=0;r<t.length;r++){let l=t[r];if(l==="*")t[r+1]==="*"?(s+=".*",r++):s+="[^/]*";else if(l==="?")s+="[^/]";else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let a=t.slice(r,i+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),s+=a,r=i}else s+="\\["}else s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return s+="$",M(s,n?"i":"").test(e)}async function be(e,t,n){let s=null;n.noIgnore||(s=await _(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let r=new k;for(let o of n.typeClear)r.clearType(o);for(let o of n.typeAdd)r.addType(o);let l=t.length===0?["."]:t,{files:i}=await te(e,l,n,s,r);if(i.length===0)return{stdout:g(),stderr:g(),exitCode:1};if(n.quiet)return{stdout:g(),stderr:g(),exitCode:0};let a=n.nullSeparator?"\0":`
13
- `,c=i.map(o=>o+a).join("");return{stdout:v(c),stderr:g(),exitCode:0}}function we(e,t){if(t.length===0)return!0;for(let n of t)if(S(e,n,!1))return!0;return!1}async function ve(e,t,n,s){try{if(s.preprocessor&&e.exec){let i=n.split("/").pop()||n;if(we(i,s.preprocessorGlobs)){let a=await e.exec(`${s.preprocessor} "${t}"`,{cwd:e.cwd});if(a.exitCode===0){let c=await R(a.stdout);if(c.length>0){let o=c.slice(0,8192);return{content:c,isBinary:o.includes("\0")}}}}}if(s.searchZip&&n.endsWith(".gz")){let i=await E(await e.fs.readFile(t));if(me(i))try{let a=pe(i),c=new TextDecoder().decode(a),o=c.slice(0,8192);return{content:c,isBinary:o.includes("\0")}}catch{return null}}let r=await e.fs.readFileText(t),l=r.slice(0,8192);return{content:r,isBinary:l.includes("\0")}}catch{return null}}async function Ce(e,t,n,s,r,l,i){let a="",c=!1,o=[],u=0,x=0,m=0,p=50;e:for(let f=0;f<t.length;f+=p){let y=t.slice(f,f+p),w=await Promise.all(y.map(async h=>{let b=e.fs.resolvePath(e.cwd,h),I=await ve(e,b,h,s);if(!I)return null;let{content:F,isBinary:j}=I;if(m+=F.length,j&&!s.searchBinary)return null;let D=r&&!s.heading?h:"",T=q(F,n,{invertMatch:s.invertMatch,showLineNumbers:l,countOnly:s.count,countMatches:s.countMatches,filename:D,onlyMatching:s.onlyMatching,beforeContext:s.beforeContext,afterContext:s.afterContext,maxCount:s.maxCount,contextSeparator:s.contextSeparator,showColumn:s.column,vimgrep:s.vimgrep,showByteOffset:s.byteOffset,replace:s.replace!==null?V(s.replace):null,passthru:s.passthru,multiline:s.multiline,kResetGroup:i});return s.json&&T.matched?{file:h,result:T,content:F,isBinary:!1}:{file:h,result:T}}));for(let h of w){if(!h)continue;let{file:b,result:I}=h;if(I.matched){if(c=!0,x++,u+=I.matchCount,s.quiet&&!s.json)break e;if(s.json&&!s.quiet){let F=h.content||"";o.push(JSON.stringify({type:"begin",data:{path:{text:b}}}));let j=F.split(`
14
- `);n.lastIndex=0;let D=0;for(let T=0;T<j.length;T++){let O=j[T];n.lastIndex=0;let L=[];for(let $=n.exec(O);$!==null;$=n.exec(O)){let z={match:{text:$[0]},start:$.index,end:$.index+$[0].length};s.replace!==null&&(z.replacement={text:s.replace}),L.push(z),$[0].length===0&&n.lastIndex++}if(L.length>0){let $={type:"match",data:{path:{text:b},lines:{text:`${O}
15
- `},line_number:T+1,absolute_offset:D,submatches:L}};o.push(JSON.stringify($))}D+=O.length+1}o.push(JSON.stringify({type:"end",data:{path:{text:b},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:F.length,bytes_printed:0,matched_lines:I.matchCount,matches:I.matchCount}}}))}else if(s.filesWithMatches){let F=s.nullSeparator?"\0":`
12
+ `),exitCode:2}}let u=null;n.noIgnore||(u=await R(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let x=new k;for(let f of n.typeClear)x.clearType(f);for(let f of n.typeAdd)x.addType(f);let{files:m,singleExplicitFile:p}=await te(t,i,n,u,x);if(m.length===0)return{stdout:g(),stderr:g(),exitCode:1};let C=!n.noFilename&&(n.withFilename||!p||m.length>1),d=n.lineNumber;return r||(p&&m.length===1&&(d=!1),n.onlyMatching&&(d=!1)),Ce(t,m,c,n,C,d,o)}function xe(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function ye(e,t,n){let s;return e.length===1?s=e[0]:s=e.map(r=>t.fixedStrings?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${r})`).join("|"),H(s,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function te(e,t,n,s,r){let l=[],i=0,a=0;for(let o of t){let u=e.fs.resolvePath(e.cwd,o);try{let x=await e.fs.stat(u);if(x.isFile){if(i++,n.maxFilesize>0&&x.size>n.maxFilesize)continue;ne(o,n,s,u,r)&&l.push(o)}else x.isDirectory&&(a++,await se(e,o,u,0,n,s,r,l))}catch{}}return{files:n.sort==="path"?l.sort():l,singleExplicitFile:i===1&&a===0}}async function se(e,t,n,s,r,l,i,a){if(!(s>=r.maxDepth)){l&&await l.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(o=>({name:o,isFile:void 0}));for(let o of c){let u=o.name;if(!r.noIgnore&&W.isCommonIgnored(u))continue;let x=u.startsWith("."),m=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,p=e.fs.resolvePath(n,u),C,d,f=!1;if(o.isFile!==void 0&&"isDirectory"in o){let h=o;if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;if(f&&r.followSymlinks)try{let b=await e.fs.stat(p);C=b.isFile,d=b.isDirectory}catch{continue}else C=h.isFile,d=h.isDirectory}else try{let h=e.fs.lstat?await e.fs.lstat(p):await e.fs.stat(p);if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;let b=f&&r.followSymlinks?await e.fs.stat(p):h;C=b.isFile,d=b.isDirectory}catch{continue}if(!l?.matches(p,d)&&!(x&&!r.hidden&&!l?.isWhitelisted(p,d))){if(d)await se(e,m,p,s+1,r,l,i,a);else if(C){if(r.maxFilesize>0)try{if((await e.fs.stat(p)).size>r.maxFilesize)continue}catch{continue}ne(m,r,l,p,i)&&a.push(m)}}}}catch{}}}function ne(e,t,n,s,r){let l=e.split("/").pop()||e;if(n?.matches(s,!1)||t.types.length>0&&!r.matchesType(l,t.types)||t.typesNot.length>0&&r.matchesType(l,t.typesNot))return!1;if(t.globs.length>0){let i=t.globCaseInsensitive,a=t.globs.filter(o=>!o.startsWith("!")),c=t.globs.filter(o=>o.startsWith("!")).map(o=>o.slice(1));if(a.length>0){let o=!1;for(let u of a)if(S(l,u,i)||S(e,u,i)){o=!0;break}if(!o)return!1}for(let o of c)if(o.startsWith("/")){let u=o.slice(1);if(S(e,u,i))return!1}else if(S(l,o,i)||S(e,o,i))return!1}if(t.iglobs.length>0){let i=t.iglobs.filter(c=>!c.startsWith("!")),a=t.iglobs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(i.length>0){let c=!1;for(let o of i)if(S(l,o,!0)||S(e,o,!0)){c=!0;break}if(!c)return!1}for(let c of a)if(c.startsWith("/")){let o=c.slice(1);if(S(e,o,!0))return!1}else if(S(l,c,!0)||S(e,c,!0))return!1}return!0}function S(e,t,n=!1){let s="^";for(let r=0;r<t.length;r++){let l=t[r];if(l==="*")t[r+1]==="*"?(s+=".*",r++):s+="[^/]*";else if(l==="?")s+="[^/]";else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let a=t.slice(r,i+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),s+=a,r=i}else s+="\\["}else s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return s+="$",M(s,n?"i":"").test(e)}async function be(e,t,n){let s=null;n.noIgnore||(s=await R(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let r=new k;for(let o of n.typeClear)r.clearType(o);for(let o of n.typeAdd)r.addType(o);let l=t.length===0?["."]:t,{files:i}=await te(e,l,n,s,r);if(i.length===0)return{stdout:g(),stderr:g(),exitCode:1};if(n.quiet)return{stdout:g(),stderr:g(),exitCode:0};let a=n.nullSeparator?"\0":`
13
+ `,c=i.map(o=>o+a).join("");return{stdout:v(c),stderr:g(),exitCode:0}}function we(e,t){if(t.length===0)return!0;for(let n of t)if(S(e,n,!1))return!0;return!1}async function ve(e,t,n,s){try{if(s.preprocessor&&e.exec){let i=n.split("/").pop()||n;if(we(i,s.preprocessorGlobs)){let a=await e.exec(`${s.preprocessor} "${t}"`,{cwd:e.cwd});if(a.exitCode===0){let c=await L(a.stdout);if(c.length>0){let o=c.slice(0,8192);return{content:c,isBinary:o.includes("\0")}}}}}if(s.searchZip&&n.endsWith(".gz")){let i=await E(await e.fs.readFile(t));if(me(i))try{let a=await pe(i),c=new TextDecoder().decode(a),o=c.slice(0,8192);return{content:c,isBinary:o.includes("\0")}}catch{return null}}let r=await e.fs.readFileText(t),l=r.slice(0,8192);return{content:r,isBinary:l.includes("\0")}}catch{return null}}async function Ce(e,t,n,s,r,l,i){let a="",c=!1,o=[],u=0,x=0,m=0,p=50;e:for(let f=0;f<t.length;f+=p){let y=t.slice(f,f+p),w=await Promise.all(y.map(async h=>{let b=e.fs.resolvePath(e.cwd,h),I=await ve(e,b,h,s);if(!I)return null;let{content:F,isBinary:j}=I;if(m+=F.length,j&&!s.searchBinary)return null;let D=r&&!s.heading?h:"",T=q(F,n,{invertMatch:s.invertMatch,showLineNumbers:l,countOnly:s.count,countMatches:s.countMatches,filename:D,onlyMatching:s.onlyMatching,beforeContext:s.beforeContext,afterContext:s.afterContext,maxCount:s.maxCount,contextSeparator:s.contextSeparator,showColumn:s.column,vimgrep:s.vimgrep,showByteOffset:s.byteOffset,replace:s.replace!==null?V(s.replace):null,passthru:s.passthru,multiline:s.multiline,kResetGroup:i});return s.json&&T.matched?{file:h,result:T,content:F,isBinary:!1}:{file:h,result:T}}));for(let h of w){if(!h)continue;let{file:b,result:I}=h;if(I.matched){if(c=!0,x++,u+=I.matchCount,s.quiet&&!s.json)break e;if(s.json&&!s.quiet){let F=h.content||"";o.push(JSON.stringify({type:"begin",data:{path:{text:b}}}));let j=F.split(`
14
+ `);n.lastIndex=0;let D=0;for(let T=0;T<j.length;T++){let z=j[T];n.lastIndex=0;let A=[];for(let $=n.exec(z);$!==null;$=n.exec(z)){let _={match:{text:$[0]},start:$.index,end:$.index+$[0].length};s.replace!==null&&(_.replacement={text:s.replace}),A.push(_),$[0].length===0&&n.lastIndex++}if(A.length>0){let $={type:"match",data:{path:{text:b},lines:{text:`${z}
15
+ `},line_number:T+1,absolute_offset:D,submatches:A}};o.push(JSON.stringify($))}D+=z.length+1}o.push(JSON.stringify({type:"end",data:{path:{text:b},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:F.length,bytes_printed:0,matched_lines:I.matchCount,matches:I.matchCount}}}))}else if(s.filesWithMatches){let F=s.nullSeparator?"\0":`
16
16
  `;a+=`${b}${F}`}else s.filesWithoutMatch||(s.heading&&!s.noFilename&&(a+=`${b}
17
17
  `),a+=I.output)}else if(s.filesWithoutMatch){let F=s.nullSeparator?"\0":`
18
18
  `;a+=`${b}${F}`}else s.includeZero&&(s.count||s.countMatches)&&(a+=I.output)}}s.json&&(o.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:x,bytes_searched:m,bytes_printed:0,matched_lines:u,matches:u}}})),a=`${o.join(`
@@ -30,4 +30,4 @@ EXAMPLES:
30
30
  rg -t js foo Search only JavaScript files
31
31
  rg -g '*.ts' foo Search files matching glob
32
32
  rg --hidden foo Include hidden files
33
- rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},qe={name:"rg",async execute(e,t){let n=B(e);if(U(n))return G(Se);if(n.includes("--type-list"))return{stdout:v(J()),stderr:g(),exitCode:0};let s=Q(n);return s.success?ee({ctx:t,options:s.options,paths:s.paths,explicitLineNumbers:s.explicitLineNumbers}):s.error}},Ve={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0};export{qe as a,Ve as b};
33
+ rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},Ue={name:"rg",async execute(e,t){let n=B(e);if(U(n))return G(Se);if(n.includes("--type-list"))return{stdout:v(J()),stderr:g(),exitCode:0};let s=Q(n);return s.success?ee({ctx:t,options:s.options,paths:s.paths,explicitLineNumbers:s.explicitLineNumbers}):s.error}},He={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0};export{Ue as a,He as b};
@@ -1,32 +1,32 @@
1
1
  #!/usr/bin/env node
2
- import{a as P}from"./chunk-7VWUKGDV.js";import{a as q,b as I}from"./chunk-DFAHK2EQ.js";import{c as v,e as C,f as b}from"./chunk-RAUBS6MJ.js";import{g as s,h as $,j as x,k}from"./chunk-463VWH7H.js";import{constants as F,gunzipSync as S,gzipSync as L}from"node:zlib";var U={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
2
+ import{a as P}from"./chunk-7VWUKGDV.js";import{a as q,b as I}from"./chunk-DFAHK2EQ.js";import{c as v,e as z,f as b}from"./chunk-RAUBS6MJ.js";import{g as s,h as S,j as x,k}from"./chunk-463VWH7H.js";var C=null;async function w(){return C||(C=await import("node:zlib"),C)}var W=9,U=1,_=-1,H={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
3
3
 
4
4
  When no FILE is given, or when FILE is -, read from standard input.
5
5
 
6
- With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},_={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place).
6
+ With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},B={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place).
7
7
 
8
- When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},H={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output.
8
+ When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},Z={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output.
9
9
 
10
- When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},B={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};function D(e){return e.best?F.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?F.Z_BEST_SPEED:F.Z_DEFAULT_COMPRESSION}function O(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],o=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let a=e[r]|e[r+1]<<8;r+=2+a}let l=null;if(t&8){let a=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(l=new TextDecoder().decode(e.slice(a,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:l,mtime:o>0?new Date(o*1e3):null,headerSize:r}}function A(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function w(e){return e.length>=2&&e[0]===31&&e[1]===139}async function T(e,t,o,r,l,a){let u=o.suffix,n,f,p;if(t==="-"||t==="")if(p=await b(e.stdin),l){if(!w(p))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: stdin: not in gzip format
11
- `,exitCode:1};try{return{stdout:S(p),stderr:"",exitCode:0}}catch(d){let i=d instanceof Error?d.message:"unknown error";return{stdout:s,stderr:`${r}: stdin: ${i}
12
- `,exitCode:1}}}else{let d=D(o);return{stdout:L(p,{level:d}),stderr:"",exitCode:0}}n=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(n)).isDirectory)return o.recursive?await W(e,n,o,r,l,a):o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: is a directory -- ignored
10
+ When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},A={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};function L(e){return e.best?W:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?U:_}function D(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],o=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let a=e[r]|e[r+1]<<8;r+=2+a}let l=null;if(t&8){let a=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(l=new TextDecoder().decode(e.slice(a,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:l,mtime:o>0?new Date(o*1e3):null,headerSize:r}}function G(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function $(e){return e.length>=2&&e[0]===31&&e[1]===139}async function O(e,t,o,r,l,a){let u=o.suffix,n,f,p;if(t==="-"||t==="")if(p=await b(e.stdin),l){if(!$(p))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: stdin: not in gzip format
11
+ `,exitCode:1};try{return{stdout:(await w()).gunzipSync(p),stderr:"",exitCode:0}}catch(d){let i=d instanceof Error?d.message:"unknown error";return{stdout:s,stderr:`${r}: stdin: ${i}
12
+ `,exitCode:1}}}else{let d=L(o);return{stdout:(await w()).gzipSync(p,{level:d}),stderr:"",exitCode:0}}n=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(n)).isDirectory)return o.recursive?await T(e,n,o,r,l,a):o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: is a directory -- ignored
13
13
  `,exitCode:1}}catch{return{stdout:s,stderr:`${r}: ${t}: No such file or directory
14
14
  `,exitCode:1}}try{p=await b(await e.fs.readFile(n))}catch{return{stdout:s,stderr:`${r}: ${t}: No such file or directory
15
15
  `,exitCode:1}}if(l){if(!t.endsWith(u))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: unknown suffix -- ignored
16
- `,exitCode:1};if(!w(p))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: not in gzip format
17
- `,exitCode:1};let d;try{d=S(p)}catch(i){let g=i instanceof Error?i.message:"unknown error";return{stdout:s,stderr:`${r}: ${t}: ${g}
18
- `,exitCode:1}}if(a)return{stdout:d,stderr:"",exitCode:0};if(o.name){let i=O(p);i.originalName?f=e.fs.resolvePath(e.cwd,i.originalName):f=n.slice(0,-u.length)}else f=n.slice(0,-u.length);if(!o.force)try{return await e.fs.stat(f),{stdout:s,stderr:`${r}: ${f} already exists; not overwritten
16
+ `,exitCode:1};if(!$(p))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: not in gzip format
17
+ `,exitCode:1};let d;try{d=(await w()).gunzipSync(p)}catch(i){let g=i instanceof Error?i.message:"unknown error";return{stdout:s,stderr:`${r}: ${t}: ${g}
18
+ `,exitCode:1}}if(a)return{stdout:d,stderr:"",exitCode:0};if(o.name){let i=D(p);i.originalName?f=e.fs.resolvePath(e.cwd,i.originalName):f=n.slice(0,-u.length)}else f=n.slice(0,-u.length);if(!o.force)try{return await e.fs.stat(f),{stdout:s,stderr:`${r}: ${f} already exists; not overwritten
19
19
  `,exitCode:1}}catch{}if(await e.fs.writeFile(f,d),!o.keep&&!a&&await e.fs.rm(n),o.verbose){let i=p.length>0?((1-p.length/d.length)*100).toFixed(1):"0.0";return{stdout:s,stderr:`${t}: ${i}% -- replaced with ${f.split("/").pop()}
20
20
  `,exitCode:0}}return{stdout:s,stderr:"",exitCode:0}}else{if(t.endsWith(u))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t} already has ${u} suffix -- unchanged
21
- `,exitCode:1};let d=D(o),i;try{i=L(p,{level:d})}catch(g){let c=g instanceof Error?g.message:"unknown error";return{stdout:s,stderr:`${r}: ${t}: ${c}
21
+ `,exitCode:1};let d=L(o),i;try{i=(await w()).gzipSync(p,{level:d})}catch(g){let c=g instanceof Error?g.message:"unknown error";return{stdout:s,stderr:`${r}: ${t}: ${c}
22
22
  `,exitCode:1}}if(a)return{stdout:i,stderr:"",exitCode:0};if(f=n+u,!o.force)try{return await e.fs.stat(f),{stdout:s,stderr:`${r}: ${f} already exists; not overwritten
23
23
  `,exitCode:1}}catch{}if(await e.fs.writeFile(f,i),!o.keep&&!a&&await e.fs.rm(n),o.verbose){let g=p.length>0?((1-i.length/p.length)*100).toFixed(1):"0.0";return{stdout:s,stderr:`${t}: ${g}% -- replaced with ${f.split("/").pop()}
24
- `,exitCode:0}}return{stdout:s,stderr:"",exitCode:0}}}async function W(e,t,o,r,l,a){let u=await e.fs.readdir(t),n=s,f="",p=0;for(let d of u){let i=e.fs.resolvePath(t,d),g=await e.fs.stat(i);if(g.isDirectory){let c=await W(e,i,o,r,l,a);n=x(n,c.stdout),f+=c.stderr,c.exitCode!==0&&(p=c.exitCode)}else if(g.isFile){let c=o.suffix;if(l&&!d.endsWith(c)||!l&&d.endsWith(c))continue;let h=i.startsWith(`${e.cwd}/`)?i.slice(e.cwd.length+1):i,y=await T(e,h,o,r,l,a);n=x(n,y.stdout),f+=y.stderr,y.exitCode!==0&&(p=y.exitCode)}}return{stdout:n,stderr:f,exitCode:p}}async function G(e,t,o,r){let l;if(t==="-"||t==="")l=await b(e.stdin);else{let i=e.fs.resolvePath(e.cwd,t);try{l=await b(await e.fs.readFile(i))}catch{return{stdout:s,stderr:`${r}: ${t}: No such file or directory
25
- `,exitCode:1}}}if(!w(l))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: not in gzip format
26
- `,exitCode:1};let a=l.length,u=A(l),n=u>0?((1-a/u)*100).toFixed(1):"0.0",p=O(l).originalName||(t==="-"?"":t.replace(/\.gz$/,"")),d=`${a.toString().padStart(10)} ${u.toString().padStart(10)} ${n.padStart(5)}% ${p}
27
- `;return{stdout:$(d),stderr:"",exitCode:0}}async function M(e,t,o,r){let l;if(t==="-"||t==="")l=await b(e.stdin);else{let a=e.fs.resolvePath(e.cwd,t);try{l=await b(await e.fs.readFile(a))}catch{return{stdout:s,stderr:`${r}: ${t}: No such file or directory
28
- `,exitCode:1}}}if(!w(l))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: not in gzip format
29
- `,exitCode:1};try{return S(l),o.verbose?{stdout:s,stderr:`${t}: OK
24
+ `,exitCode:0}}return{stdout:s,stderr:"",exitCode:0}}}async function T(e,t,o,r,l,a){let u=await e.fs.readdir(t),n=s,f="",p=0;for(let d of u){let i=e.fs.resolvePath(t,d),g=await e.fs.stat(i);if(g.isDirectory){let c=await T(e,i,o,r,l,a);n=x(n,c.stdout),f+=c.stderr,c.exitCode!==0&&(p=c.exitCode)}else if(g.isFile){let c=o.suffix;if(l&&!d.endsWith(c)||!l&&d.endsWith(c))continue;let h=i.startsWith(`${e.cwd}/`)?i.slice(e.cwd.length+1):i,y=await O(e,h,o,r,l,a);n=x(n,y.stdout),f+=y.stderr,y.exitCode!==0&&(p=y.exitCode)}}return{stdout:n,stderr:f,exitCode:p}}async function M(e,t,o,r){let l;if(t==="-"||t==="")l=await b(e.stdin);else{let i=e.fs.resolvePath(e.cwd,t);try{l=await b(await e.fs.readFile(i))}catch{return{stdout:s,stderr:`${r}: ${t}: No such file or directory
25
+ `,exitCode:1}}}if(!$(l))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: not in gzip format
26
+ `,exitCode:1};let a=l.length,u=G(l),n=u>0?((1-a/u)*100).toFixed(1):"0.0",p=D(l).originalName||(t==="-"?"":t.replace(/\.gz$/,"")),d=`${a.toString().padStart(10)} ${u.toString().padStart(10)} ${n.padStart(5)}% ${p}
27
+ `;return{stdout:S(d),stderr:"",exitCode:0}}async function R(e,t,o,r){let l;if(t==="-"||t==="")l=await b(e.stdin);else{let a=e.fs.resolvePath(e.cwd,t);try{l=await b(await e.fs.readFile(a))}catch{return{stdout:s,stderr:`${r}: ${t}: No such file or directory
28
+ `,exitCode:1}}}if(!$(l))return o.quiet?{stdout:s,stderr:"",exitCode:1}:{stdout:s,stderr:`${r}: ${t}: not in gzip format
29
+ `,exitCode:1};try{return(await w()).gunzipSync(l),o.verbose?{stdout:s,stderr:`${t}: OK
30
30
  `,exitCode:0}:{stdout:s,stderr:"",exitCode:0}}catch(a){let u=a instanceof Error?a.message:"invalid";return{stdout:s,stderr:`${r}: ${t}: ${u}
31
- `,exitCode:1}}}async function E(e,t,o){let r=k(e),l=o==="zcat"?H:o==="gunzip"?_:U;if(I(r))return q(l);let a=P(o,r,B);if(!a.ok)return a.error;let u=a.result.flags,n=a.result.positional,f=o==="gunzip"||o==="zcat"||u.decompress||u.uncompress,p=o==="zcat"||u.stdout||u.toStdout;if(u.list){n.length===0&&(n=["-"]);let c=$(` compressed uncompressed ratio uncompressed_name
32
- `),h="",y=0;for(let z of n){let m=await G(t,z,u,o);c=x(c,m.stdout),h+=m.stderr,m.exitCode!==0&&(y=m.exitCode)}return{stdout:v(c),stderr:C(h),exitCode:y}}if(u.test){n.length===0&&(n=["-"]);let c=s,h="",y=0;for(let z of n){let m=await M(t,z,u,o);c=x(c,m.stdout),h+=m.stderr,m.exitCode!==0&&(y=m.exitCode)}return{stdout:v(c),stderr:C(h),exitCode:y}}n.length===0&&(n=["-"]);let d=s,i="",g=0;for(let c of n){let h=await T(t,c,u,o,f,p);d=x(d,h.stdout),i+=h.stderr,h.exitCode!==0&&(g=h.exitCode)}return{stdout:v(d),stderr:C(i),exitCode:g}}var j={name:"gzip",async execute(e,t){return E(e,t,"gzip")}},J={name:"gunzip",async execute(e,t){return E(e,t,"gunzip")}},Q={name:"zcat",async execute(e,t){return E(e,t,"zcat")}},X={name:"gzip",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-1",type:"boolean"},{flag:"-9",type:"boolean"}],stdinType:"binary",needsFiles:!0},N={name:"gunzip",flags:[{flag:"-c",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0},ee={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0};export{j as a,J as b,Q as c,X as d,N as e,ee as f};
31
+ `,exitCode:1}}}async function E(e,t,o){let r=k(e),l=o==="zcat"?Z:o==="gunzip"?B:H;if(I(r))return q(l);let a=P(o,r,A);if(!a.ok)return a.error;let u=a.result.flags,n=a.result.positional,f=o==="gunzip"||o==="zcat"||u.decompress||u.uncompress,p=o==="zcat"||u.stdout||u.toStdout;if(u.list){n.length===0&&(n=["-"]);let c=S(` compressed uncompressed ratio uncompressed_name
32
+ `),h="",y=0;for(let F of n){let m=await M(t,F,u,o);c=x(c,m.stdout),h+=m.stderr,m.exitCode!==0&&(y=m.exitCode)}return{stdout:v(c),stderr:z(h),exitCode:y}}if(u.test){n.length===0&&(n=["-"]);let c=s,h="",y=0;for(let F of n){let m=await R(t,F,u,o);c=x(c,m.stdout),h+=m.stderr,m.exitCode!==0&&(y=m.exitCode)}return{stdout:v(c),stderr:z(h),exitCode:y}}n.length===0&&(n=["-"]);let d=s,i="",g=0;for(let c of n){let h=await O(t,c,u,o,f,p);d=x(d,h.stdout),i+=h.stderr,h.exitCode!==0&&(g=h.exitCode)}return{stdout:v(d),stderr:z(i),exitCode:g}}var J={name:"gzip",async execute(e,t){return E(e,t,"gzip")}},Q={name:"gunzip",async execute(e,t){return E(e,t,"gunzip")}},V={name:"zcat",async execute(e,t){return E(e,t,"zcat")}},N={name:"gzip",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-1",type:"boolean"},{flag:"-9",type:"boolean"}],stdinType:"binary",needsFiles:!0},ee={name:"gunzip",flags:[{flag:"-c",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0},te={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0};export{J as a,Q as b,V as c,N as d,ee as e,te as f};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{b as c}from"./chunk-RAUBS6MJ.js";import{k as r}from"./chunk-463VWH7H.js";var h={name:"yes",async execute(a){let n=r(a),d=`${n.length===0?"y":n.join(" ")}
3
+ `,t=new TextEncoder().encode(d),l=16*1024,o=Math.max(1,Math.floor(l/t.length)),m=t.length*o,s=new Uint8Array(m);for(let e=0;e<o;e++)s.set(t,e*t.length);return{stdout:new ReadableStream({pull(e){e.enqueue(s)}}),stderr:c(),exitCode:0}}},p={name:"yes",flags:[]};export{h as a,p as b};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import{b as a,e as g}from"./chunk-RAUBS6MJ.js";import{k as v}from"./chunk-463VWH7H.js";var V={name:"seq",async execute(u){let s=v(u),l=`
3
+ `,f=!1,r=[],t=0;for(;t<s.length;){let e=s[t];if(e==="-s"&&t+1<s.length){l=s[t+1],t+=2;continue}if(e==="-w"){f=!0,t++;continue}if(e==="--"){t++;break}if(e.startsWith("-")&&e!=="-"){if(e.startsWith("-s")&&e.length>2){l=e.slice(2),t++;continue}if((e==="-ws"||e==="-sw")&&(f=!0,t+1<s.length)){l=s[t+1],t+=2;continue}}r.push(e),t++}for(;t<s.length;)r.push(s[t]),t++;if(r.length===0)return{stdout:a(),stderr:g(`seq: missing operand
4
+ `),exitCode:1};let o=1,d=1,i;if(r.length===1?i=parseFloat(r[0]):r.length===2?(o=parseFloat(r[0]),i=parseFloat(r[1])):(o=parseFloat(r[0]),d=parseFloat(r[1]),i=parseFloat(r[2])),Number.isNaN(o)||Number.isNaN(d)||Number.isNaN(i)){let e=r.find(n=>Number.isNaN(parseFloat(n)));return{stdout:a(),stderr:g(`seq: invalid floating point argument: '${e}'
5
+ `),exitCode:1}}if(d===0)return{stdout:a(),stderr:g(`seq: invalid Zero increment value: '0'
6
+ `),exitCode:1};let m=Math.max(b(o),b(d),b(i)),q=0;if(f){let e=w(o,m).replace(/^-/,""),n=w(i,m).replace(/^-/,"");q=Math.max(e.length,n.length)}let y=e=>{let n=w(e,m);if(!f)return n;let N=n.startsWith("-"),C=(N?n.slice(1):n).padStart(q,"0");return N?`-${C}`:C},h=d>0;if(h&&o>i)return{stdout:a(),stderr:a(),exitCode:0};if(!h&&o<i)return{stdout:a(),stderr:a(),exitCode:0};let S=16*1024,c=o,p=!0,x=!1,W=new TextEncoder;return{stdout:new ReadableStream({pull(e){if(x){e.close();return}let n="";for(;n.length<S;){if(h?c>i+1e-10:c<i-1e-10){x=!0,p||(n+=`
7
+ `);break}let F=y(c);p?(n+=F,p=!1):n+=l+F,c+=d}n.length>0?e.enqueue(W.encode(n)):x&&e.close()}}),stderr:a(),exitCode:0}}};function b(u){let s=String(u),l=s.indexOf(".");return l===-1?0:s.length-l-1}function w(u,s){return s>0?u.toFixed(s):String(Math.round(u))}var A={name:"seq",flags:[{flag:"-s",type:"value",valueHint:"string"},{flag:"-w",type:"boolean"}],needsArgs:!0};export{V as a,A as b};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{b as yr}from"./chunk-YG67AAKF.js";import{d as Ir,e as Mr,f as jr}from"./chunk-ASU2EQWZ.js";import{b as Ar}from"./chunk-4W52T6KS.js";import{b as $r}from"./chunk-23CC4423.js";import{b as Sr}from"./chunk-7YOACDUK.js";import"./chunk-23EV7RYO.js";import"./chunk-TACNCKUC.js";import{b as Tr}from"./chunk-EHJW6FCX.js";import{b as hr}from"./chunk-GUZJZK5O.js";import{b as wr}from"./chunk-SDTTNNEH.js";import{b as xr}from"./chunk-5KQNIOZS.js";import{b as vr}from"./chunk-Z73LISDU.js";import{b as kr}from"./chunk-5IL5CXJC.js";import{b as qr}from"./chunk-V3N6H3L5.js";import{b as Cr}from"./chunk-KAWPUEQM.js";import{b as br}from"./chunk-PRQYRYWV.js";import{b as nr}from"./chunk-ECBMSCPX.js";import{b as tr}from"./chunk-HY6WUGWS.js";import{b as lr}from"./chunk-7J7OY2YE.js";import{b as ur}from"./chunk-HEO6EBJ2.js";import{b as pr}from"./chunk-XSBNCA43.js";import{b as er}from"./chunk-WXI44VNZ.js";import{b as dr}from"./chunk-NNVWOCET.js";import{b as cr}from"./chunk-YER5PEKD.js";import"./chunk-I2N72LXH.js";import{b as rr}from"./chunk-3VDZW42W.js";import{c as or,d as ar}from"./chunk-SZM4GZ4H.js";import{b as sr}from"./chunk-VWJBSJYM.js";import{b as ir}from"./chunk-H7TGYILF.js";import{c as gr,d as mr}from"./chunk-RFIBBYTO.js";import{b as Fr}from"./chunk-YGAHXCGB.js";import"./chunk-N7P3SUNH.js";import"./chunk-UYBH3FNE.js";import{b as zr}from"./chunk-D44C6YVE.js";import{b as fr}from"./chunk-RIV3HSPK.js";import{b as Q}from"./chunk-QXOUI5BS.js";import{b as R}from"./chunk-44ROJVH3.js";import{b as U}from"./chunk-UAZICDKU.js";import{b as V}from"./chunk-AN2KBMAK.js";import{b as W}from"./chunk-444WPTN5.js";import{c as X,d as Y}from"./chunk-67SBKZZD.js";import{c as Z,d as _}from"./chunk-D34QBGQ3.js";import{b as N}from"./chunk-XB426ZI7.js";import{b as E}from"./chunk-2IOUIOWE.js";import{b as G}from"./chunk-U4LP6WPJ.js";import{b as H}from"./chunk-Q2BKN6MV.js";import{b as J}from"./chunk-AZQ66C5R.js";import{b as K}from"./chunk-6U6CK6V4.js";import{b as L}from"./chunk-IAUA3FL7.js";import{b as O}from"./chunk-ZZPPBMHW.js";import{b as P}from"./chunk-SL4D2YES.js";import{b as M}from"./chunk-GIVPKQT5.js";import{b as j}from"./chunk-LVSKOXVG.js";import{b as A}from"./chunk-X7PEK6W7.js";import{b as $}from"./chunk-MPX22C7Y.js";import{b as S}from"./chunk-4VVLCPRH.js";import{b as T}from"./chunk-B4GXMUCA.js";import{b as B}from"./chunk-RUNWFUUE.js";import{b as D}from"./chunk-JU5KTPFP.js";import{b as h}from"./chunk-IQY3I4OH.js";import{b as w}from"./chunk-66PXNTAV.js";import"./chunk-RZ6FAJ25.js";import{b as x}from"./chunk-DMTOGHTU.js";import{b as v}from"./chunk-RX4PT2U7.js";import{d as k,e as q,f as C}from"./chunk-CE2ILL65.js";import"./chunk-GIFF636B.js";import{b}from"./chunk-4Y3GINAY.js";import"./chunk-BXOX2H2G.js";import{b as y}from"./chunk-EXCMJ23H.js";import{b as I}from"./chunk-FVFLR7NF.js";import{b as n}from"./chunk-XRZNW2KP.js";import{b as t}from"./chunk-NSSLXYEG.js";import{b as l}from"./chunk-HZM5PBQF.js";import{b as u}from"./chunk-CD3NCHIB.js";import{b as p}from"./chunk-QKQUVK53.js";import{b as e}from"./chunk-446TXLPR.js";import{b as d}from"./chunk-OH3VVXF7.js";import{b as c}from"./chunk-QFPJQSDK.js";import"./chunk-RUESYAVK.js";import"./chunk-CAXM2HMK.js";import"./chunk-SE4C7FJY.js";import{b as i}from"./chunk-PZ46XEZ4.js";import{b as g}from"./chunk-PKKBPSVJ.js";import"./chunk-Z72PSRMX.js";import{b as m}from"./chunk-L2KFCEBW.js";import"./chunk-K2K4KPOQ.js";import"./chunk-XILOLP4K.js";import{b as F}from"./chunk-RMG637UR.js";import"./chunk-OBH7XN5N.js";import{b as z}from"./chunk-RAL2LVDX.js";import{b as f}from"./chunk-IPWJZ22H.js";import"./chunk-4VDEBYW7.js";import"./chunk-7VWUKGDV.js";import"./chunk-DFAHK2EQ.js";import"./chunk-RAUBS6MJ.js";import"./chunk-463VWH7H.js";var Gr=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,y,I,M,j,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,yr,Ir,Mr,jr,Ar,$r,ir,Sr,Tr];function Br(){return Gr}var Dr=new Map;for(let r of Br())Dr.set(r.name,new Set(r.flags.map(o=>o.flag)));function fa(r,o,Er){let a=Dr.get(o);if(!(!a||a.size===0))for(let s of Er)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{fa as emitFlagCoverage};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b,c,d,e,f}from"./chunk-PYIWPSII.js";import"./chunk-7VWUKGDV.js";import"./chunk-DFAHK2EQ.js";import"./chunk-RAUBS6MJ.js";import"./chunk-463VWH7H.js";export{d as flagsForFuzzing,b as gunzipCommand,e as gunzipFlagsForFuzzing,a as gzipCommand,c as zcatCommand,f as zcatFlagsForFuzzing};
2
+ import{a,b,c,d,e,f}from"./chunk-ASU2EQWZ.js";import"./chunk-7VWUKGDV.js";import"./chunk-DFAHK2EQ.js";import"./chunk-RAUBS6MJ.js";import"./chunk-463VWH7H.js";export{d as flagsForFuzzing,b as gunzipCommand,e as gunzipFlagsForFuzzing,a as gzipCommand,c as zcatCommand,f as zcatFlagsForFuzzing};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b}from"./chunk-FZXGAGSU.js";import"./chunk-BXOX2H2G.js";import"./chunk-SE4C7FJY.js";import"./chunk-DFAHK2EQ.js";import"./chunk-RAUBS6MJ.js";import"./chunk-463VWH7H.js";export{b as flagsForFuzzing,a as rgCommand};
2
+ import{a,b}from"./chunk-4Y3GINAY.js";import"./chunk-BXOX2H2G.js";import"./chunk-SE4C7FJY.js";import"./chunk-DFAHK2EQ.js";import"./chunk-RAUBS6MJ.js";import"./chunk-463VWH7H.js";export{b as flagsForFuzzing,a as rgCommand};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b}from"./chunk-HT4IVOYZ.js";import"./chunk-RAUBS6MJ.js";import"./chunk-463VWH7H.js";export{b as flagsForFuzzing,a as seqCommand};
2
+ import{a,b}from"./chunk-XSBNCA43.js";import"./chunk-RAUBS6MJ.js";import"./chunk-463VWH7H.js";export{b as flagsForFuzzing,a as seqCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a,b}from"./chunk-H7TGYILF.js";import"./chunk-RAUBS6MJ.js";import"./chunk-463VWH7H.js";export{b as flagsForFuzzing,a as yesCommand};