just-bash 2.14.2 → 2.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/bin/chunks/{awk2-VTJMI54B.js → awk2-RSUCURL4.js} +1 -1
- package/dist/bin/chunks/{chunk-L2JBII6Z.js → chunk-2HVFB2TU.js} +72 -72
- package/dist/bin/{shell/chunks/chunk-ZO5PSLKR.js → chunks/chunk-ARI4VLCN.js} +1 -1
- package/dist/bin/chunks/chunk-AX6NCIX6.js +140 -0
- package/dist/bin/{shell/chunks/chunk-NLBRLRWD.js → chunks/chunk-BGGF3ELU.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-VHUYNUT7.js → chunks/chunk-DU4S5MUI.js} +1 -1
- package/dist/bin/chunks/chunk-EFPTD2CS.js +36 -0
- package/dist/bin/chunks/{chunk-SXB55JOI.js → chunk-EONWONZV.js} +1 -1
- package/dist/bin/chunks/{chunk-SDLWFYVT.js → chunk-EWDHVLQL.js} +11 -11
- package/dist/bin/{shell/chunks/chunk-SE4C7FJY.js → chunks/chunk-JDNI5HBX.js} +13 -13
- package/dist/bin/chunks/chunk-KCMUAACL.js +19 -0
- package/dist/bin/{shell/chunks/chunk-XKPFI566.js → chunks/chunk-L6XUBS6H.js} +17 -17
- package/dist/bin/{shell/chunks/chunk-A3HQTYHR.js → chunks/chunk-OXHVTSNH.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-RMQC3GS7.js → chunks/chunk-PNI5NMXP.js} +1 -1
- package/dist/bin/chunks/chunk-PXVBSPBE.js +2 -0
- package/dist/bin/{shell/chunks/chunk-YFPDB4PH.js → chunks/chunk-RA3TG4UK.js} +1 -1
- package/dist/bin/chunks/{chunk-GZHFXDDO.js → chunk-RBQGQWGV.js} +1 -1
- package/dist/bin/chunks/{chunk-THNL3XFF.js → chunk-S3QAKT3R.js} +1 -1
- package/dist/bin/chunks/{chunk-G43H2WGH.js → chunk-TTNNO45C.js} +1 -1
- package/dist/bin/chunks/chunk-UFJFAFSS.js +28 -0
- package/dist/bin/chunks/chunk-WLBA7L7U.js +23 -0
- package/dist/bin/chunks/{chunk-HJEHIH4P.js → chunk-WUYP7DID.js} +2 -2
- package/dist/bin/chunks/chunk-ZUDPEMHG.js +63 -0
- package/dist/bin/chunks/{diff-LE7GMFZD.js → diff-5NUI5BHG.js} +1 -1
- package/dist/bin/{shell/chunks/expansion-2RO5M3QC.js → chunks/expansion-QUT3FT7V.js} +1 -1
- package/dist/bin/{shell/chunks/expr-4CJYC4LY.js → chunks/expr-G4EF4POQ.js} +1 -1
- package/dist/bin/{shell/chunks/file-D5YKS5NV.js → chunks/file-MMSHRWCJ.js} +1 -1
- package/dist/bin/chunks/find-7CVMEZBO.js +2 -0
- package/dist/bin/{shell/chunks/flag-coverage-NSXW5TJP.js → chunks/flag-coverage-IK7WVGOO.js} +1 -1
- package/dist/bin/chunks/{grep-OZJTRD4D.js → grep-7BJ7HFBM.js} +1 -1
- package/dist/bin/chunks/{html-to-markdown-WVZA3MCP.js → html-to-markdown-V6PK6S5U.js} +1 -1
- package/dist/bin/{shell/chunks/jq-FIV5Q5T4.js → chunks/jq-DVZM2CEN.js} +1 -1
- package/dist/bin/{shell/chunks/js-exec-DYEFS64P.js → chunks/js-exec-RWEELTC2.js} +4 -4
- package/dist/bin/chunks/js-exec-worker.js +3 -2
- package/dist/bin/chunks/{ls-G2PXHSNX.js → ls-WONXDVOX.js} +1 -1
- package/dist/bin/chunks/{printf-P3QVL4IO.js → printf-NA7DYZBO.js} +1 -1
- package/dist/bin/chunks/{python3-3423HR2R.js → python3-V2HDKCNM.js} +2 -2
- package/dist/bin/chunks/rg-LA2FQFMS.js +2 -0
- package/dist/bin/chunks/{sed-HALRQZKY.js → sed-WWXBUNG3.js} +1 -1
- package/dist/bin/chunks/{sqlite3-CVNFMP3Z.js → sqlite3-JPU62KSL.js} +1 -1
- package/dist/bin/chunks/sqlite3-worker.js +1728 -0
- package/dist/bin/chunks/tar-GTGFEWDS.js +2 -0
- package/dist/bin/chunks/worker.js +1 -0
- package/dist/bin/chunks/{xan-MOZFJGMY.js → xan-MM3YYGD7.js} +1 -1
- package/dist/bin/chunks/xan-view-6J5MMMQB.js +2 -0
- package/dist/bin/chunks/{yq-Q47JUWL6.js → yq-CWUVVSHY.js} +1 -1
- package/dist/bin/just-bash.js +238 -238
- package/dist/bin/shell/chunks/{awk2-VTJMI54B.js → awk2-RSUCURL4.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-L2JBII6Z.js → chunk-2HVFB2TU.js} +72 -72
- package/dist/bin/{chunks/chunk-ZO5PSLKR.js → shell/chunks/chunk-ARI4VLCN.js} +1 -1
- package/dist/bin/shell/chunks/chunk-AX6NCIX6.js +140 -0
- package/dist/bin/{chunks/chunk-NLBRLRWD.js → shell/chunks/chunk-BGGF3ELU.js} +1 -1
- package/dist/bin/{chunks/chunk-VHUYNUT7.js → shell/chunks/chunk-DU4S5MUI.js} +1 -1
- package/dist/bin/shell/chunks/chunk-EFPTD2CS.js +36 -0
- package/dist/bin/shell/chunks/{chunk-SXB55JOI.js → chunk-EONWONZV.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-SDLWFYVT.js → chunk-EWDHVLQL.js} +11 -11
- package/dist/bin/shell/chunks/chunk-HC7WB764.js +2 -0
- package/dist/bin/{chunks/chunk-SE4C7FJY.js → shell/chunks/chunk-JDNI5HBX.js} +13 -13
- package/dist/bin/shell/chunks/chunk-KCMUAACL.js +19 -0
- package/dist/bin/{chunks/chunk-XKPFI566.js → shell/chunks/chunk-L6XUBS6H.js} +17 -17
- package/dist/bin/{chunks/chunk-A3HQTYHR.js → shell/chunks/chunk-OXHVTSNH.js} +1 -1
- package/dist/bin/{chunks/chunk-RMQC3GS7.js → shell/chunks/chunk-PNI5NMXP.js} +1 -1
- package/dist/bin/{chunks/chunk-YFPDB4PH.js → shell/chunks/chunk-RA3TG4UK.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-GZHFXDDO.js → chunk-RBQGQWGV.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-THNL3XFF.js → chunk-S3QAKT3R.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-G43H2WGH.js → chunk-TTNNO45C.js} +1 -1
- package/dist/bin/shell/chunks/chunk-UFJFAFSS.js +28 -0
- package/dist/bin/shell/chunks/chunk-WLBA7L7U.js +23 -0
- package/dist/bin/shell/chunks/{chunk-HJEHIH4P.js → chunk-WUYP7DID.js} +2 -2
- package/dist/bin/shell/chunks/chunk-ZUDPEMHG.js +63 -0
- package/dist/bin/shell/chunks/{diff-LE7GMFZD.js → diff-5NUI5BHG.js} +1 -1
- package/dist/bin/{chunks/expansion-2RO5M3QC.js → shell/chunks/expansion-QUT3FT7V.js} +1 -1
- package/dist/bin/{chunks/expr-4CJYC4LY.js → shell/chunks/expr-G4EF4POQ.js} +1 -1
- package/dist/bin/{chunks/file-D5YKS5NV.js → shell/chunks/file-MMSHRWCJ.js} +1 -1
- package/dist/bin/shell/chunks/find-7CVMEZBO.js +2 -0
- package/dist/bin/{chunks/flag-coverage-NSXW5TJP.js → shell/chunks/flag-coverage-IK7WVGOO.js} +1 -1
- package/dist/bin/shell/chunks/{grep-OZJTRD4D.js → grep-7BJ7HFBM.js} +1 -1
- package/dist/bin/shell/chunks/{html-to-markdown-WVZA3MCP.js → html-to-markdown-V6PK6S5U.js} +1 -1
- package/dist/bin/{chunks/jq-FIV5Q5T4.js → shell/chunks/jq-DVZM2CEN.js} +1 -1
- package/dist/bin/{chunks/js-exec-CAD5RWEY.js → shell/chunks/js-exec-AKWY6BP5.js} +4 -4
- package/dist/bin/shell/chunks/{ls-G2PXHSNX.js → ls-WONXDVOX.js} +1 -1
- package/dist/bin/shell/chunks/{printf-P3QVL4IO.js → printf-NA7DYZBO.js} +1 -1
- package/dist/bin/shell/chunks/{python3-D3QLNTTN.js → python3-TG6BXZCZ.js} +2 -2
- package/dist/bin/shell/chunks/rg-LA2FQFMS.js +2 -0
- package/dist/bin/shell/chunks/{sed-HALRQZKY.js → sed-WWXBUNG3.js} +1 -1
- package/dist/bin/shell/chunks/{sqlite3-CVNFMP3Z.js → sqlite3-JPU62KSL.js} +1 -1
- package/dist/bin/shell/chunks/tar-GTGFEWDS.js +2 -0
- package/dist/bin/shell/chunks/{xan-MOZFJGMY.js → xan-MM3YYGD7.js} +1 -1
- package/dist/bin/shell/chunks/xan-view-6J5MMMQB.js +2 -0
- package/dist/bin/shell/chunks/{yq-Q47JUWL6.js → yq-CWUVVSHY.js} +1 -1
- package/dist/bin/shell/shell.js +225 -225
- package/dist/bundle/browser.js +603 -603
- package/dist/bundle/chunks/{awk2-POPGKRAI.js → awk2-JFGEGLFP.js} +1 -1
- package/dist/bundle/chunks/{chunk-FEIOJCZD.js → chunk-43RSSTFA.js} +1 -1
- package/dist/bundle/chunks/chunk-5KI4QWT5.js +139 -0
- package/dist/bundle/chunks/{chunk-YFG2CMIF.js → chunk-5PYKJV42.js} +1 -1
- package/dist/bundle/chunks/{chunk-XORM457F.js → chunk-75FNCC7W.js} +72 -72
- package/dist/bundle/chunks/{chunk-YS3AZT3J.js → chunk-B53Y5JFV.js} +1 -1
- package/dist/bundle/chunks/{chunk-J642UCRS.js → chunk-BAQA74XA.js} +1 -1
- package/dist/bundle/chunks/{chunk-OARHFVLG.js → chunk-D6EWIDSU.js} +11 -11
- package/dist/bundle/chunks/{chunk-F55TLFGB.js → chunk-DBKNVD4L.js} +1 -1
- package/dist/bundle/chunks/{chunk-LPQPILI2.js → chunk-GJTDUJ5Q.js} +1 -1
- package/dist/bundle/chunks/chunk-HL6NGDO2.js +22 -0
- package/dist/bundle/chunks/chunk-KX3P26DQ.js +1 -0
- package/dist/bundle/chunks/{chunk-NYQYO467.js → chunk-MIMEPCXY.js} +2 -2
- package/dist/bundle/chunks/{chunk-BBXLRYSX.js → chunk-NRZWEENR.js} +1 -1
- package/dist/bundle/chunks/{chunk-VLGZJRPG.js → chunk-PYDZ2LCK.js} +1 -1
- package/dist/bundle/chunks/{chunk-YCFVLTST.js → chunk-RQ254MFG.js} +1 -1
- package/dist/bundle/chunks/{chunk-OL3S66CO.js → chunk-VBEY5J6R.js} +1 -1
- package/dist/bundle/chunks/chunk-XIZSGUXJ.js +62 -0
- package/dist/bundle/chunks/chunk-XKWWSDBF.js +35 -0
- package/dist/bundle/chunks/{chunk-YNYSPYQ5.js → chunk-YSHZL3MF.js} +13 -13
- package/dist/bundle/chunks/{expansion-ENLSRCXJ.js → expansion-UGGADTZC.js} +1 -1
- package/dist/bundle/chunks/{expr-5T3UU5KE.js → expr-DNFUYZGY.js} +1 -1
- package/dist/bundle/chunks/{file-ZIGAJ4YS.js → file-IGDTDPLG.js} +1 -1
- package/dist/bundle/chunks/find-KNMMLVJD.js +1 -0
- package/dist/bundle/chunks/{flag-coverage-QT4N2Z44.js → flag-coverage-QFOIESUP.js} +1 -1
- package/dist/bundle/chunks/{grep-3AIAIJVR.js → grep-2UMHPO7Y.js} +1 -1
- package/dist/bundle/chunks/{jq-ODXZBPLY.js → jq-LCDWFF5Y.js} +1 -1
- package/dist/bundle/chunks/{js-exec-M6UR76J5.js → js-exec-VXN6TZ7U.js} +4 -4
- package/dist/bundle/chunks/js-exec-worker.js +3 -2
- package/dist/bundle/chunks/{python3-AUFTPCU6.js → python3-DNGS4G3E.js} +2 -2
- package/dist/bundle/chunks/rg-RYV2N6B5.js +1 -0
- package/dist/bundle/chunks/{sed-VFTTATXJ.js → sed-OFX3F4FE.js} +1 -1
- package/dist/bundle/chunks/{sqlite3-56UMWEY3.js → sqlite3-TE5AIOTF.js} +1 -1
- package/dist/bundle/chunks/sqlite3-worker.js +1728 -0
- package/dist/bundle/chunks/tar-LYLTEJV3.js +1 -0
- package/dist/bundle/chunks/worker.js +1 -0
- package/dist/bundle/chunks/{xan-BXDXYEIB.js → xan-X2BIJPJV.js} +1 -1
- package/dist/bundle/chunks/xan-view-OW2TB7Z3.js +1 -0
- package/dist/bundle/chunks/{yq-MJMAR36V.js → yq-M7NFNNED.js} +1 -1
- package/dist/bundle/index.cjs +807 -807
- package/dist/bundle/index.js +174 -174
- package/dist/commands/js-exec/{worker.d.ts → js-exec-worker.d.ts} +2 -2
- package/dist/commands/sqlite3/sqlite3.d.ts +1 -0
- package/dist/commands/sqlite3/worker.js +1728 -0
- package/dist/network/dns-pin.d.ts +43 -0
- package/package.json +8 -9
- package/dist/bin/chunks/chunk-B3RU2PUI.js +0 -140
- package/dist/bin/chunks/chunk-CM4532DS.js +0 -36
- package/dist/bin/chunks/chunk-MXVNCVD6.js +0 -30
- package/dist/bin/chunks/chunk-MY5PY2PL.js +0 -2
- package/dist/bin/chunks/chunk-N5OTVT4F.js +0 -23
- package/dist/bin/chunks/chunk-P6GNZPVW.js +0 -19
- package/dist/bin/chunks/chunk-VRUXUVWB.js +0 -63
- package/dist/bin/chunks/find-GAYRV4IF.js +0 -2
- package/dist/bin/chunks/rg-C6KMBFNG.js +0 -2
- package/dist/bin/chunks/tar-DNUNEW4Z.js +0 -2
- package/dist/bin/chunks/xan-view-5SZBYPLG.js +0 -2
- package/dist/bin/shell/chunks/chunk-B3RU2PUI.js +0 -140
- package/dist/bin/shell/chunks/chunk-CM4532DS.js +0 -36
- package/dist/bin/shell/chunks/chunk-D64U2VGQ.js +0 -2
- package/dist/bin/shell/chunks/chunk-MXVNCVD6.js +0 -30
- package/dist/bin/shell/chunks/chunk-N5OTVT4F.js +0 -23
- package/dist/bin/shell/chunks/chunk-P6GNZPVW.js +0 -19
- package/dist/bin/shell/chunks/chunk-VRUXUVWB.js +0 -63
- package/dist/bin/shell/chunks/find-GAYRV4IF.js +0 -2
- package/dist/bin/shell/chunks/rg-C6KMBFNG.js +0 -2
- package/dist/bin/shell/chunks/tar-DNUNEW4Z.js +0 -2
- package/dist/bin/shell/chunks/xan-view-5SZBYPLG.js +0 -2
- package/dist/bundle/chunks/chunk-BRGMQKJV.js +0 -62
- package/dist/bundle/chunks/chunk-CR5AFCPT.js +0 -22
- package/dist/bundle/chunks/chunk-HWBSOZZR.js +0 -35
- package/dist/bundle/chunks/chunk-UNYNJIFU.js +0 -139
- package/dist/bundle/chunks/chunk-XHM67O4N.js +0 -1
- package/dist/bundle/chunks/find-TPUOAIUQ.js +0 -1
- package/dist/bundle/chunks/rg-FOQSCCX3.js +0 -1
- package/dist/bundle/chunks/tar-ANUBEFJY.js +0 -1
- package/dist/bundle/chunks/xan-view-ECQUO7AJ.js +0 -1
- /package/dist/bin/chunks/{chunk-QSDVMMYI.js → chunk-4CFAYBLV.js} +0 -0
- /package/dist/bin/chunks/{chunk-ND23BJUM.js → chunk-LCDPWJBA.js} +0 -0
- /package/dist/bin/shell/chunks/{chunk-QSDVMMYI.js → chunk-4CFAYBLV.js} +0 -0
- /package/dist/bin/shell/chunks/{chunk-ND23BJUM.js → chunk-LCDPWJBA.js} +0 -0
- /package/dist/bundle/chunks/{chunk-SYMJJMQ4.js → chunk-PXTK5WE2.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as O}from"./chunk-
|
|
2
|
+
import{a as O}from"./chunk-JDNI5HBX.js";import{e as j,f as K,g as C,h as re,i as Pe,j as It,k as L}from"./chunk-6KZRLMG3.js";function $(e,t){for(;t<e.length;){if(e[t]==="\\"&&e[t+1]===`
|
|
3
3
|
`){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}var Re=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="];function ge(e){if(e.includes("#")){let[r,s]=e.split("#"),n=Number.parseInt(r,10);if(n<2||n>64)return Number.NaN;if(n<=36){let i=Number.parseInt(s,n);return i>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:i}let a=0;for(let i of s){let l;if(/[0-9]/.test(i))l=i.charCodeAt(0)-48;else if(/[a-z]/.test(i))l=i.charCodeAt(0)-97+10;else if(/[A-Z]/.test(i))l=i.charCodeAt(0)-65+36;else if(i==="@")l=62;else if(i==="_")l=63;else return Number.NaN;if(l>=n)return Number.NaN;if(a=a*n+l,a>Number.MAX_SAFE_INTEGER)return Number.MAX_SAFE_INTEGER}return a}if(e.startsWith("0x")||e.startsWith("0X")){let r=Number.parseInt(e.slice(2),16);return r>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:r}if(e.startsWith("0")&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return Number.NaN;let r=Number.parseInt(e,8);return r>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:r}let t=Number.parseInt(e,10);return t>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t}function vt(e,t,r,s){if(r.slice(s,s+3)!=="$((")return null;let n=s+3,a=1,i=n;for(;n<r.length-1&&a>0;)r[n]==="("&&r[n+1]==="("?(a++,n+=2):r[n]===")"&&r[n+1]===")"?(a--,a>0&&(n+=2)):n++;let l=r.slice(i,n),{expr:o}=e(t,l,0);return n+=2,{expr:{type:"ArithNested",expression:o},pos:n}}function Dt(e,t){if(e.slice(t,t+2)!=="$'")return null;let r=t+2,s="";for(;r<e.length&&e[r]!=="'";)if(e[r]==="\\"&&r+1<e.length){let a=e[r+1];switch(a){case"n":s+=`
|
|
4
4
|
`;break;case"t":s+=" ";break;case"r":s+="\r";break;case"\\":s+="\\";break;case"'":s+="'";break;default:s+=a}r+=2}else s+=e[r],r++;e[r]==="'"&&r++;let n=Number.parseInt(s,10);return{expr:{type:"ArithNumber",value:Number.isNaN(n)?0:n},pos:r}}function xt(e,t){if(e.slice(t,t+2)!=='$"')return null;let r=t+2,s="";for(;r<e.length&&e[r]!=='"';)e[r]==="\\"&&r+1<e.length?(s+=e[r+1],r+=2):(s+=e[r],r++);e[r]==='"'&&r++;let n=Number.parseInt(s,10);return{expr:{type:"ArithNumber",value:Number.isNaN(n)?0:n},pos:r}}function kr(e){let t="",r=0;for(;r<e.length;)if(e[r]==='"'){for(r++;r<e.length&&e[r]!=='"';)e[r]==="\\"&&r+1<e.length?(t+=e[r+1],r+=2):(t+=e[r],r++);r<e.length&&r++}else t+=e[r],r++;return t}function M(e,t){let r=kr(t),{expr:s,pos:n}=Z(e,r,0),a=$(r,n);if(a<r.length){let i=t.slice(a).trim();if(i)return{type:"ArithmeticExpression",originalText:t,expression:{type:"ArithSyntaxError",errorToken:i,message:`${i}: syntax error: invalid arithmetic operator (error token is "${i}")`}}}return{type:"ArithmeticExpression",expression:s,originalText:t}}function F(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function z(e,t){return $(e,t)>=e.length}function Z(e,t,r){return Pr(e,t,r)}function Pr(e,t,r){let{expr:s,pos:n}=ye(e,t,r);for(n=$(t,n);t[n]===",";){if(n++,z(t,n))return F(",",n);let{expr:i,pos:l}=ye(e,t,n);s={type:"ArithBinary",operator:",",left:s,right:i},n=$(t,l)}return{expr:s,pos:n}}function ye(e,t,r){let{expr:s,pos:n}=Rr(e,t,r);if(n=$(t,n),t[n]==="?"){n++;let{expr:a,pos:i}=Z(e,t,n);if(n=$(t,i),t[n]===":"){n++;let{expr:l,pos:o}=Z(e,t,n);return{expr:{type:"ArithTernary",condition:s,consequent:a,alternate:l},pos:o}}}return{expr:s,pos:n}}function Rr(e,t,r){let{expr:s,pos:n}=_t(e,t,r);for(;n=$(t,n),t.slice(n,n+2)==="||";){if(n+=2,z(t,n))return F("||",n);let{expr:i,pos:l}=_t(e,t,n);s={type:"ArithBinary",operator:"||",left:s,right:i},n=l}return{expr:s,pos:n}}function _t(e,t,r){let{expr:s,pos:n}=$t(e,t,r);for(;n=$(t,n),t.slice(n,n+2)==="&&";){if(n+=2,z(t,n))return F("&&",n);let{expr:i,pos:l}=$t(e,t,n);s={type:"ArithBinary",operator:"&&",left:s,right:i},n=l}return{expr:s,pos:n}}function $t(e,t,r){let{expr:s,pos:n}=Ct(e,t,r);for(;n=$(t,n),t[n]==="|"&&t[n+1]!=="|";){if(n++,z(t,n))return F("|",n);let{expr:i,pos:l}=Ct(e,t,n);s={type:"ArithBinary",operator:"|",left:s,right:i},n=l}return{expr:s,pos:n}}function Ct(e,t,r){let{expr:s,pos:n}=Ot(e,t,r);for(;n=$(t,n),t[n]==="^";){if(n++,z(t,n))return F("^",n);let{expr:i,pos:l}=Ot(e,t,n);s={type:"ArithBinary",operator:"^",left:s,right:i},n=l}return{expr:s,pos:n}}function Ot(e,t,r){let{expr:s,pos:n}=Lt(e,t,r);for(;n=$(t,n),t[n]==="&"&&t[n+1]!=="&";){if(n++,z(t,n))return F("&",n);let{expr:i,pos:l}=Lt(e,t,n);s={type:"ArithBinary",operator:"&",left:s,right:i},n=l}return{expr:s,pos:n}}function Lt(e,t,r){let{expr:s,pos:n}=Wt(e,t,r);for(;n=$(t,n),t.slice(n,n+2)==="=="||t.slice(n,n+2)==="!=";){let a=t.slice(n,n+2);if(n+=2,z(t,n))return F(a,n);let{expr:i,pos:l}=Wt(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}return{expr:s,pos:n}}function Wt(e,t,r){let{expr:s,pos:n}=ze(e,t,r);for(;;)if(n=$(t,n),t.slice(n,n+2)==="<="||t.slice(n,n+2)===">="){let a=t.slice(n,n+2);if(n+=2,z(t,n))return F(a,n);let{expr:i,pos:l}=ze(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}else if(t[n]==="<"||t[n]===">"){let a=t[n];if(n++,z(t,n))return F(a,n);let{expr:i,pos:l}=ze(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}else break;return{expr:s,pos:n}}function ze(e,t,r){let{expr:s,pos:n}=Tt(e,t,r);for(;n=$(t,n),t.slice(n,n+2)==="<<"||t.slice(n,n+2)===">>";){let a=t.slice(n,n+2);if(n+=2,z(t,n))return F(a,n);let{expr:i,pos:l}=Tt(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}return{expr:s,pos:n}}function Tt(e,t,r){let{expr:s,pos:n}=Mt(e,t,r);for(;n=$(t,n),(t[n]==="+"||t[n]==="-")&&t[n+1]!==t[n];){let a=t[n];if(n++,z(t,n))return F(a,n);let{expr:i,pos:l}=Mt(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}return{expr:s,pos:n}}function Mt(e,t,r){let{expr:s,pos:n}=Ie(e,t,r);for(;;)if(n=$(t,n),t[n]==="*"&&t[n+1]!=="*"){if(n++,z(t,n))return F("*",n);let{expr:i,pos:l}=Ie(e,t,n);s={type:"ArithBinary",operator:"*",left:s,right:i},n=l}else if(t[n]==="/"||t[n]==="%"){let a=t[n];if(n++,z(t,n))return F(a,n);let{expr:i,pos:l}=Ie(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}else break;return{expr:s,pos:n}}function Ie(e,t,r){let{expr:s,pos:n}=Ge(e,t,r),a=$(t,n);if(t.slice(a,a+2)==="**"){if(a+=2,z(t,a))return F("**",a);let{expr:l,pos:o}=Ie(e,t,a);return{expr:{type:"ArithBinary",operator:"**",left:s,right:l},pos:o}}return{expr:s,pos:n}}function Ge(e,t,r){let s=$(t,r);if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let n=t.slice(s,s+2);s+=2;let{expr:a,pos:i}=Ge(e,t,s);return{expr:{type:"ArithUnary",operator:n,operand:a,prefix:!0},pos:i}}if(t[s]==="+"||t[s]==="-"||t[s]==="!"||t[s]==="~"){let n=t[s];s++;let{expr:a,pos:i}=Ge(e,t,s);return{expr:{type:"ArithUnary",operator:n,operand:a,prefix:!0},pos:i}}return vr(e,t,s)}function Ir(e,t){let r=e[t];return r==="$"||r==="`"}function vr(e,t,r){let{expr:s,pos:n}=Vt(e,t,r,!1),a=[s];for(;Ir(t,n);){let{expr:l,pos:o}=Vt(e,t,n,!0);a.push(l),n=o}a.length>1&&(s={type:"ArithConcat",parts:a});let i;if(t[n]==="["&&s.type==="ArithConcat"){n++;let{expr:l,pos:o}=Z(e,t,n);i=l,n=o,t[n]==="]"&&n++}if(i&&s.type==="ArithConcat"&&(s={type:"ArithDynamicElement",nameExpr:s,subscript:i},i=void 0),n=$(t,n),s.type==="ArithConcat"||s.type==="ArithVariable"||s.type==="ArithDynamicElement"){for(let l of Re)if(t.slice(n,n+l.length)===l&&t.slice(n,n+l.length+1)!=="=="){n+=l.length;let{expr:o,pos:c}=ye(e,t,n);return s.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:l,target:s.nameExpr,subscript:s.subscript,value:o},pos:c}:s.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:l,target:s,value:o},pos:c}:{expr:{type:"ArithAssignment",operator:l,variable:s.name,value:o},pos:c}}}if(t.slice(n,n+2)==="++"||t.slice(n,n+2)==="--"){let l=t.slice(n,n+2);return n+=2,{expr:{type:"ArithUnary",operator:l,operand:s,prefix:!1},pos:n}}return{expr:s,pos:n}}function Vt(e,t,r,s=!1){let n=$(t,r),a=vt(Z,e,t,n);if(a)return a;let i=Dt(t,n);if(i)return i;let l=xt(t,n);if(l)return l;if(t.slice(n,n+2)==="$("&&t[n+2]!=="("){n+=2;let c=1,u=n;for(;n<t.length&&c>0;)t[n]==="("?c++:t[n]===")"&&c--,c>0&&n++;let f=t.slice(u,n);return n++,{expr:{type:"ArithCommandSubst",command:f},pos:n}}if(t[n]==="`"){n++;let c=n;for(;n<t.length&&t[n]!=="`";)n++;let u=t.slice(c,n);return t[n]==="`"&&n++,{expr:{type:"ArithCommandSubst",command:u},pos:n}}if(t[n]==="("){n++;let{expr:c,pos:u}=Z(e,t,n);return n=$(t,u),t[n]===")"&&n++,{expr:{type:"ArithGroup",expression:c},pos:n}}if(t[n]==="'"){n++;let c="";for(;n<t.length&&t[n]!=="'";)c+=t[n],n++;t[n]==="'"&&n++;let u=Number.parseInt(c,10);return{expr:{type:"ArithSingleQuote",content:c,value:Number.isNaN(u)?0:u},pos:n}}if(t[n]==='"'){n++;let c="";for(;n<t.length&&t[n]!=='"';)t[n]==="\\"&&n+1<t.length?(c+=t[n+1],n+=2):(c+=t[n],n++);t[n]==='"'&&n++;let u=c.trim();if(!u)return{expr:{type:"ArithNumber",value:0},pos:n};let{expr:f}=Z(e,u,0);return{expr:f,pos:n}}if(/[0-9]/.test(t[n])){let c="",u=!1,f=!1;for(;n<t.length;){let d=t[n];if(u)if(/[0-9a-zA-Z@_]/.test(d))c+=d,n++;else break;else if(d==="#")u=!0,c+=d,n++;else if(c==="0"&&(d==="x"||d==="X")&&n+1<t.length&&/[0-9a-fA-F]/.test(t[n+1]))f=!0,c+=d,n++;else if(f&&/[0-9a-fA-F]/.test(d))c+=d,n++;else if(!f&&/[0-9]/.test(d))c+=d,n++;else break}if(n<t.length&&/[a-zA-Z_]/.test(t[n])){let d=c;for(;n<t.length&&/[a-zA-Z0-9_]/.test(t[n]);)d+=t[n],n++;return{expr:{type:"ArithSyntaxError",errorToken:d,message:`${d}: value too great for base (error token is "${d}")`},pos:n}}if(t[n]==="."&&/[0-9]/.test(t[n+1]))throw new C(`${c}.${t[n+1]}...: syntax error: invalid arithmetic operator`);if(t[n]==="["){let d=t.slice(n).trim();return{expr:{type:"ArithNumberSubscript",number:c,errorToken:d},pos:t.length}}return{expr:{type:"ArithNumber",value:ge(c)},pos:n}}if(t[n]==="$"&&t[n+1]==="{"){let c=n+2,u=1,f=c;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;let h=t.slice(c,f),d=f+1;if(t[d]==="#"){let m=d+1;for(;m<t.length&&/[0-9a-zA-Z@_]/.test(t[m]);)m++;let g=t.slice(d+1,m);return{expr:{type:"ArithDynamicBase",baseExpr:h,value:g},pos:m}}if(/[0-9]/.test(t[d])||t[d]==="x"||t[d]==="X"){let m=d;if(t[d]==="x"||t[d]==="X")for(m++;m<t.length&&/[0-9a-fA-F]/.test(t[m]);)m++;else for(;m<t.length&&/[0-9]/.test(t[m]);)m++;let g=t.slice(d,m);return{expr:{type:"ArithDynamicNumber",prefix:h,suffix:g},pos:m}}return n=d,{expr:{type:"ArithBracedExpansion",content:h},pos:n}}if(t[n]==="$"&&n+1<t.length&&/[0-9]/.test(t[n+1])){n++;let c="";for(;n<t.length&&/[0-9]/.test(t[n]);)c+=t[n],n++;return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:!0},pos:n}}if(t[n]==="$"&&n+1<t.length&&/[*@#?\-!$]/.test(t[n+1])){let c=t[n+1];return n+=2,{expr:{type:"ArithSpecialVar",name:c},pos:n}}let o=!1;if(t[n]==="$"&&n+1<t.length&&/[a-zA-Z_]/.test(t[n+1])&&(o=!0,n++),n<t.length&&/[a-zA-Z_]/.test(t[n])){let c="";for(;n<t.length&&/[a-zA-Z0-9_]/.test(t[n]);)c+=t[n],n++;if(t[n]==="["&&!s){n++;let u;if(t[n]==="'"||t[n]==='"'){let h=t[n];for(n++,u="";n<t.length&&t[n]!==h;)u+=t[n],n++;t[n]===h&&n++,n=$(t,n),t[n]==="]"&&n++}let f;if(u===void 0){let{expr:h,pos:d}=Z(e,t,n);f=h,n=d,t[n]==="]"&&n++}if(n=$(t,n),t[n]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:n};if(!s){for(let h of Re)if(t.slice(n,n+h.length)===h&&t.slice(n,n+h.length+1)!=="=="){n+=h.length;let{expr:d,pos:m}=ye(e,t,n);return{expr:{type:"ArithAssignment",operator:h,variable:c,subscript:f,stringKey:u,value:d},pos:m}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:n}}if(n=$(t,n),!s){for(let u of Re)if(t.slice(n,n+u.length)===u&&t.slice(n,n+u.length+1)!=="=="){n+=u.length;let{expr:f,pos:h}=ye(e,t,n);return{expr:{type:"ArithAssignment",operator:u,variable:c,value:f},pos:h}}}return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:o},pos:n}}if(t[n]==="#"){let c=n+1;for(;c<t.length&&t[c]!==`
|
|
5
5
|
`;)c++;let u=t.slice(n,c).trim()||"#";return{expr:{type:"ArithSyntaxError",errorToken:u,message:`${u}: syntax error: invalid arithmetic operator (error token is "${u}")`},pos:t.length}}return{expr:{type:"ArithNumber",value:0},pos:n}}var w={script(e){return{type:"Script",statements:e}},statement(e,t=[],r=!1,s,n){let a={type:"Statement",pipelines:e,operators:t,background:r};return s&&(a.deferredError=s),n!==void 0&&(a.sourceText=n),a},pipeline(e,t=!1,r=!1,s=!1,n){return{type:"Pipeline",commands:e,negated:t,timed:r,timePosix:s,pipeStderr:n}},simpleCommand(e,t=[],r=[],s=[]){return{type:"SimpleCommand",name:e,args:t,assignments:r,redirections:s}},word(e){return{type:"Word",parts:e}},literal(e){return{type:"Literal",value:e}},singleQuoted(e){return{type:"SingleQuoted",value:e}},doubleQuoted(e){return{type:"DoubleQuoted",parts:e}},escaped(e){return{type:"Escaped",value:e}},parameterExpansion(e,t=null){return{type:"ParameterExpansion",parameter:e,operation:t}},commandSubstitution(e,t=!1){return{type:"CommandSubstitution",body:e,legacy:t}},arithmeticExpansion(e){return{type:"ArithmeticExpansion",expression:e}},assignment(e,t,r=!1,s=null){return{type:"Assignment",name:e,value:t,append:r,array:s}},redirection(e,t,r=null,s){let n={type:"Redirection",fd:r,operator:e,target:t};return s&&(n.fdVariable=s),n},hereDoc(e,t,r=!1,s=!1){return{type:"HereDoc",delimiter:e,content:t,stripTabs:r,quoted:s}},ifNode(e,t=null,r=[]){return{type:"If",clauses:e,elseBody:t,redirections:r}},forNode(e,t,r,s=[]){return{type:"For",variable:e,words:t,body:r,redirections:s}},whileNode(e,t,r=[]){return{type:"While",condition:e,body:t,redirections:r}},untilNode(e,t,r=[]){return{type:"Until",condition:e,body:t,redirections:r}},caseNode(e,t,r=[]){return{type:"Case",word:e,items:t,redirections:r}},caseItem(e,t,r=";;"){return{type:"CaseItem",patterns:e,body:t,terminator:r}},subshell(e,t=[]){return{type:"Subshell",body:e,redirections:t}},group(e,t=[]){return{type:"Group",body:e,redirections:t}},functionDef(e,t,r=[],s){return{type:"FunctionDef",name:e,body:t,redirections:r,sourceFile:s}},conditionalCommand(e,t=[],r){return{type:"ConditionalCommand",expression:e,redirections:t,line:r}},arithmeticCommand(e,t=[],r){return{type:"ArithmeticCommand",expression:e,redirections:t,line:r}}};var p;(function(e){e.EOF="EOF",e.NEWLINE="NEWLINE",e.SEMICOLON="SEMICOLON",e.AMP="AMP",e.PIPE="PIPE",e.PIPE_AMP="PIPE_AMP",e.AND_AND="AND_AND",e.OR_OR="OR_OR",e.BANG="BANG",e.LESS="LESS",e.GREAT="GREAT",e.DLESS="DLESS",e.DGREAT="DGREAT",e.LESSAND="LESSAND",e.GREATAND="GREATAND",e.LESSGREAT="LESSGREAT",e.DLESSDASH="DLESSDASH",e.CLOBBER="CLOBBER",e.TLESS="TLESS",e.AND_GREAT="AND_GREAT",e.AND_DGREAT="AND_DGREAT",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.DSEMI="DSEMI",e.SEMI_AND="SEMI_AND",e.SEMI_SEMI_AND="SEMI_SEMI_AND",e.DBRACK_START="DBRACK_START",e.DBRACK_END="DBRACK_END",e.DPAREN_START="DPAREN_START",e.DPAREN_END="DPAREN_END",e.IF="IF",e.THEN="THEN",e.ELSE="ELSE",e.ELIF="ELIF",e.FI="FI",e.FOR="FOR",e.WHILE="WHILE",e.UNTIL="UNTIL",e.DO="DO",e.DONE="DONE",e.CASE="CASE",e.ESAC="ESAC",e.IN="IN",e.FUNCTION="FUNCTION",e.SELECT="SELECT",e.TIME="TIME",e.COPROC="COPROC",e.WORD="WORD",e.NAME="NAME",e.NUMBER="NUMBER",e.ASSIGNMENT_WORD="ASSIGNMENT_WORD",e.FD_VARIABLE="FD_VARIABLE",e.COMMENT="COMMENT",e.HEREDOC_CONTENT="HEREDOC_CONTENT"})(p||(p={}));var pe=class extends Error{line;column;constructor(t,r,s){super(`line ${r}: ${t}`),this.line=r,this.column=s,this.name="LexerError"}},Bt=new Map([["if",p.IF],["then",p.THEN],["else",p.ELSE],["elif",p.ELIF],["fi",p.FI],["for",p.FOR],["while",p.WHILE],["until",p.UNTIL],["do",p.DO],["done",p.DONE],["case",p.CASE],["esac",p.ESAC],["in",p.IN],["function",p.FUNCTION],["select",p.SELECT],["time",p.TIME],["coproc",p.COPROC]]);function Ft(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return!1;let r=e.slice(t[0].length);if(r===""||r==="+")return!0;if(r[0]==="["){let s=0,n=0;for(;n<r.length;n++)if(r[n]==="[")s++;else if(r[n]==="]"&&(s--,s===0))break;if(s!==0||n>=r.length)return!1;let a=r.slice(n+1);return a===""||a==="+"}return!1}function zt(e){let t=0;for(let r=0;r<e.length;r++){let s=e[r];if(s==="[")t++;else if(s==="]")t--;else{if(t===0&&s==="=")return r;if(t===0&&s==="+"&&e[r+1]==="=")return r+1}}return-1}var Dr=[[";",";","&",p.SEMI_SEMI_AND],["<","<","<",p.TLESS],["&",">",">",p.AND_DGREAT]],xr=[["[","[",p.DBRACK_START],["]","]",p.DBRACK_END],["(","(",p.DPAREN_START],[")",")",p.DPAREN_END],["&","&",p.AND_AND],["|","|",p.OR_OR],[";",";",p.DSEMI],[";","&",p.SEMI_AND],["|","&",p.PIPE_AMP],[">",">",p.DGREAT],["<","&",p.LESSAND],[">","&",p.GREATAND],["<",">",p.LESSGREAT],[">","|",p.CLOBBER],["&",">",p.AND_GREAT]],_r=new Map([["|",p.PIPE],["&",p.AMP],[";",p.SEMICOLON],["(",p.LPAREN],[")",p.RPAREN],["<",p.LESS],[">",p.GREAT]]);function $r(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function Gt(e){return e===" "||e===" "||e===`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as W,b as U}from"./chunk-MO4RPBN2.js";import{a as I}from"./chunk-YU6OGPZR.js";import{a as A}from"./chunk-
|
|
2
|
+
import{a as W,b as U}from"./chunk-MO4RPBN2.js";import{a as I}from"./chunk-YU6OGPZR.js";import{a as A}from"./chunk-JDNI5HBX.js";import{k}from"./chunk-6KZRLMG3.js";import{a as L}from"./chunk-RLNOQILG.js";import{a as ee,b as te,c as P}from"./chunk-GTNBSMZR.js";var z=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]);function H(i){let e="",t=0,n=!1;for(;t<i.length;){if(i[t]==="["&&!n){if(i[t+1]==="["&&i[t+2]===":"){let s=i.indexOf(":]]",t+3);if(s!==-1){let a=i.slice(t+3,s),r=z.get(a);if(r){e+=`[${r}]`,t=s+3;continue}}}if(i[t+1]==="^"&&i[t+2]==="["&&i[t+3]===":"){let s=i.indexOf(":]]",t+4);if(s!==-1){let a=i.slice(t+4,s),r=z.get(a);if(r){e+=`[^${r}]`,t=s+3;continue}}}e+="[",t++,n=!0,t<i.length&&i[t]==="^"&&(e+="^",t++),t<i.length&&i[t]==="]"&&(e+="\\]",t++);continue}if(n){if(i[t]==="]"){e+="]",t++,n=!1;continue}if(i[t]==="["&&i[t+1]===":"){let s=i.indexOf(":]",t+2);if(s!==-1){let a=i.slice(t+2,s),r=z.get(a);if(r){e+=r,t=s+2;continue}}}if(i[t]==="\\"&&t+1<i.length){e+=i[t]+i[t+1],t+=2;continue}e+=i[t],t++;continue}if(i[t]==="\\"&&t+1<i.length){let s=i[t+1];if(s==="+"||s==="?"||s==="|"){e+=s,t+=2;continue}if(s==="("||s===")"){e+=s,t+=2;continue}if(s==="{"||s==="}"){e+=s,t+=2;continue}if(s==="t"){e+=" ",t+=2;continue}if(s==="n"){e+=`
|
|
3
3
|
`,t+=2;continue}if(s==="r"){e+="\r",t+=2;continue}e+=i[t]+s,t+=2;continue}if(i[t]==="+"||i[t]==="?"||i[t]==="|"||i[t]==="("||i[t]===")"){e+=`\\${i[t]}`,t++;continue}if(i[t]==="^"&&!(e===""||e.endsWith("("))){e+="\\^",t++;continue}if(i[t]==="$"){let s=t===i.length-1,a=t+2<i.length&&i[t+1]==="\\"&&i[t+2]===")";if(!s&&!a){e+="\\$",t++;continue}}e+=i[t],t++}return e}function V(i){let e="",t=!1;for(let n=0;n<i.length;n++)i[n]==="["&&!t?(t=!0,e+="[",n++,n<i.length&&i[n]==="^"&&(e+="^",n++),n<i.length&&i[n]==="]"&&(e+="]",n++),n--):i[n]==="]"&&t?(t=!1,e+="]"):!t&&i[n]==="{"&&i[n+1]===","?(e+="{0,",n++):e+=i[n];return e}function ne(i){let e="";for(let t=0;t<i.length;t++){let n=i[t],s=n.charCodeAt(0);n==="\\"?e+="\\\\":n===" "?e+="\\t":n===`
|
|
4
4
|
`?e+=`$
|
|
5
5
|
`:n==="\r"?e+="\\r":n==="\x07"?e+="\\a":n==="\b"?e+="\\b":n==="\f"?e+="\\f":n==="\v"?e+="\\v":s<32||s>=127?e+=`\\${s.toString(8).padStart(3,"0")}`:e+=n}return`${e}$`}var de=1e4;function se(i,e,t){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:i,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:e,pendingFileReads:[],pendingFileWrites:[],rangeStates:t||new Map,linesConsumedInCycle:0}}function pe(i){return typeof i=="object"&&"first"in i&&"step"in i}function me(i){return typeof i=="object"&&"offset"in i}function N(i,e,t,n,s){if(i==="$")return e===t;if(typeof i=="number")return e===i;if(pe(i)){let{first:a,step:r}=i;return r===0?e===a:(e-a)%r===0&&e>=a}if(typeof i=="object"&&"pattern"in i)try{let a=i.pattern;a===""&&s?.lastPattern?a=s.lastPattern:a!==""&&s&&(s.lastPattern=a);let r=V(H(a));return A(r).test(n)}catch{return!1}return!1}function X(i){let e=t=>t===void 0?"undefined":t==="$"?"$":typeof t=="number"?String(t):"pattern"in t?`/${t.pattern}/`:"first"in t?`${t.first}~${t.step}`:"unknown";return`${e(i.start)},${e(i.end)}`}function ge(i,e,t,n,s,a){if(!i||!i.start&&!i.end)return!0;let r=i.start,l=i.end;if(r!==void 0&&l===void 0)return N(r,e,t,n,a);if(r!==void 0&&l!==void 0){let c=typeof r=="object"&&"pattern"in r,f=typeof l=="object"&&"pattern"in l,p=me(l);if(p&&s){let g=X(i),d=s.get(g);if(d||(d={active:!1},s.set(g,d)),d.active){let E=d.startLine||e;return e>=E+l.offset&&(d.active=!1,s.set(g,d)),!0}else return N(r,e,t,n,a)?(d.active=!0,d.startLine=e,s.set(g,d),l.offset===0&&(d.active=!1,s.set(g,d)),!0):!1}if(!c&&!f&&!p){let g=typeof r=="number"?r:r==="$"?t:1,d=typeof l=="number"?l:t;if(g<=d)return e>=g&&e<=d;if(s){let E=X(i),u=s.get(E);return u||(u={active:!1},s.set(E,u)),!u.completed&&e>=g?(u.completed=!0,s.set(E,u),!0):!1}return!1}if(s){let g=X(i),d=s.get(g);if(d||(d={active:!1},s.set(g,d)),d.active)return N(l,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(g,d)),!0;{if(d.completed)return!1;let E=!1;return typeof r=="number"?E=e>=r:E=N(r,e,t,n,a),E?(d.active=!0,d.startLine=e,s.set(g,d),N(l,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(g,d)),!0):!1}}return N(r,e,t,n,a)}return!0}function w(i,e,t,n,s,a){let r=ge(i,e,t,n,s,a);return i?.negated?!r:r}function be(i,e,t,n){let s="",a=0,r=!1;for(;a<=i.length;){e.lastIndex=a;let l=e.exec(i);if(!l){s+=i.slice(a);break}if(l.index!==a){s+=i.slice(a,l.index),a=l.index,r=!1;continue}let c=l[0],f=l.slice(1);if(r&&c.length===0){if(a<i.length)s+=i[a],a++;else break;r=!1;continue}if(s+=n(c,f),r=!1,c.length===0)if(a<i.length)s+=i[a],a++;else break;else a+=c.length,r=!0}return s}function G(i,e,t){let n="",s=0;for(;s<i.length;){if(i[s]==="\\"&&s+1<i.length){let a=i[s+1];if(a==="&"){n+="&",s+=2;continue}if(a==="n"){n+=`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as x}from"./chunk-
|
|
2
|
+
import{a as x}from"./chunk-EONWONZV.js";import{a as q,b as Z}from"./chunk-TTNNO45C.js";import{a as _,b as X,c as G}from"./chunk-GTNBSMZR.js";var se={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},j={name:"grep",async execute(t,s){if(X(t))return _(se);let l=!1,f=!1,c=!1,p=!1,m=!1,a=!1,n=!1,u=!1,y=!1,w=!1,h=!1,d=!1,v=!1,P=!1,B=!1,$=0,T=0,C=0,W=[],A=[],L=[],R=null,I=[];for(let r=0;r<t.length;r++){let i=t[r];if(i.startsWith("-")&&i!=="-"){if(i==="-e"&&r+1<t.length){R=t[++r];continue}if(i.startsWith("--include=")){W.push(i.slice(10));continue}if(i.startsWith("--exclude=")){A.push(i.slice(10));continue}if(i.startsWith("--exclude-dir=")){L.push(i.slice(14));continue}if(i.startsWith("--max-count=")){$=parseInt(i.slice(12),10);continue}let b=i.match(/^-m(\d+)$/);if(b){$=parseInt(b[1],10);continue}if(i==="-m"&&r+1<t.length){$=parseInt(t[++r],10);continue}let o=i.match(/^-([ABC])(\d+)$/);if(o){let e=parseInt(o[2],10);o[1]==="A"?C=e:o[1]==="B"?T=e:o[1]==="C"&&(T=e,C=e);continue}if((i==="-A"||i==="-B"||i==="-C")&&r+1<t.length){let e=parseInt(t[++r],10);i==="-A"?C=e:i==="-B"?T=e:(T=e,C=e);continue}let g=i.startsWith("--")?[i]:i.slice(1).split("");for(let e of g)if(e==="i"||e==="--ignore-case")l=!0;else if(e==="n"||e==="--line-number")f=!0;else if(e==="v"||e==="--invert-match")c=!0;else if(e==="c"||e==="--count")p=!0;else if(e==="l"||e==="--files-with-matches")m=!0;else if(e==="L"||e==="--files-without-match")a=!0;else if(e==="r"||e==="R"||e==="--recursive")n=!0;else if(e==="w"||e==="--word-regexp")u=!0;else if(e==="x"||e==="--line-regexp")y=!0;else if(e==="E"||e==="--extended-regexp")w=!0;else if(e==="P"||e==="--perl-regexp")h=!0;else if(e==="F"||e==="--fixed-strings")d=!0;else if(e==="o"||e==="--only-matching")v=!0;else if(e==="h"||e==="--no-filename")P=!0;else if(e==="q"||e==="--quiet"||e==="--silent")B=!0;else{if(e.startsWith("--"))return G("grep",e);if(e.length===1)return G("grep",`-${e}`)}}else R===null?R=i:I.push(i)}if(R===null)return{stdout:"",stderr:`grep: missing pattern
|
|
3
3
|
`,exitCode:2};let V=d?"fixed":w?"extended":h?"perl":"basic",O,Q;try{let r=Z(R,{mode:V,ignoreCase:l,wholeWord:u,lineRegexp:y});O=r.regex,Q=r.kResetGroup}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${R}
|
|
4
4
|
`,exitCode:2}}if(I.length===0&&s.stdin!==void 0){let r=q(s.stdin,O,{invertMatch:c,showLineNumbers:f,countOnly:p,filename:"",onlyMatching:v,beforeContext:T,afterContext:C,maxCount:$,kResetGroup:Q});return B?{stdout:"",stderr:"",exitCode:r.matched?0:1}:{stdout:r.output,stderr:"",exitCode:r.matched?0:1}}if(I.length===0)return{stdout:"",stderr:`grep: no input files
|
|
5
5
|
`,exitCode:2};let M="",z="",S=!1,D=!1,F=[];for(let r of I)if(r.includes("*")||r.includes("?")||r.includes("[")){let i=await ne(r,s);if(n)for(let b of i){let o=await H(b.path,s,W,A,L,b.isFile);F.push(...o)}else F.push(...i)}else if(n){let i=await H(r,s,W,A,L);F.push(...i)}else F.push({path:r});let Y=(F.length>1||n)&&!P,k=50;for(let r=0;r<F.length;r+=k){let i=F.slice(r,r+k),b=await Promise.all(i.map(async o=>{let g=o.path,e=g.split("/").pop()||g;if(A.length>0&&!n&&A.some(N=>x(e,N,{stripQuotes:!0}))||W.length>0&&!n&&!W.some(N=>x(e,N,{stripQuotes:!0})))return null;try{let N=s.fs.resolvePath(s.cwd,g),U=!1;if(o.isFile===void 0?U=(await s.fs.stat(N)).isDirectory:U=!o.isFile,U)return n?null:{error:`grep: ${g}: Is a directory
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as v}from"./chunk-
|
|
2
|
+
import{a as v}from"./chunk-4CFAYBLV.js";import{e as x}from"./chunk-KGOUQS5A.js";var w=x(v(),1);function j(){return Object.create(null)}function S(e,o,r){e[o]=r}function C(e){let o=j();for(let r of Object.keys(e)){let s=e[r];(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||s===null)&&(o[r]=s)}return o}function b(e){let o=w.default.parse(e.trim(),{header:!0,dynamicTyping:!0,skipEmptyLines:!0}),r=o.data.map(s=>C(s));return{headers:o.meta.fields||[],data:r}}function R(e,o){return o.length===0?`${e.join(",")}
|
|
3
3
|
`:`${w.default.unparse(o,{columns:e}).replace(/\r\n/g,`
|
|
4
4
|
`)}
|
|
5
5
|
`}async function g(e,o){let r=e.find(p=>!p.startsWith("-")),s;if(!r||r==="-")s=o.stdin;else try{let p=o.fs.resolvePath(o.cwd,r);s=await o.fs.readFile(p)}catch{return{headers:[],data:[],error:{stdout:"",stderr:`xan: ${r}: No such file or directory
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as fe}from"./chunk-YMMJLYIX.js";import{a as Y}from"./chunk-
|
|
2
|
+
import{a as fe}from"./chunk-YMMJLYIX.js";import{a as Y}from"./chunk-EONWONZV.js";import{a as ne}from"./chunk-4OALHZXB.js";import{a as te}from"./chunk-JDNI5HBX.js";import{a as oe,b as pe,c as ce}from"./chunk-D5WP4CKS.js";import{a as ie,b as le}from"./chunk-GTNBSMZR.js";function k(e,t){switch(e.type){case"name":{let n=e.pattern,a=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(a){let s=a[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,a=t.relativePath,s=n.split("/");for(let i=0;i<s.length-1;i++){let r=s[i];if(r&&r!=="."&&r!==".."&&!r.includes("*")&&!r.includes("?")&&!r.includes("[")){let p=`/${r}/`;if(e.ignoreCase){if(!a.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let i=o[1];if(e.ignoreCase){if(!a.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(a,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:te(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let a=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=a>e.days:e.comparison==="less"?s=a<e.days:s=Math.floor(a)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let a;return e.comparison==="more"?a=t.size>n:e.comparison==="less"?a=t.size<n:e.unit==="b"?a=Math.ceil(t.size/512)===e.value:a=t.size===n,{matches:a,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,a=e.mode&511,s;return e.matchType==="exact"?s=n===a:e.matchType==="all"?s=(n&a)===a:s=(n&a)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=k(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=k(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let a=k(e.right,t);return{matches:a.matches,pruned:n.pruned||a.pruned,printed:n.printed||a.printed}}case"or":{let n=k(e.left,t);if(n.matches)return n;let a=k(e.right,t);return{matches:a.matches,pruned:n.pruned||a.pruned,printed:a.printed}}}}function _(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right)}}function j(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return j(e.expr);case"and":case"or":return j(e.left)||j(e.right);default:return!1}}function ue(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=Ee(e);if(Me(e)&&n.length===1){let o=n[0].split("/").filter(i=>i.length>0);if(o.length>=2)for(let i=o.length-2;i>=0;i--){let r=o[i];if(!r.includes("*")&&!r.includes("?")&&!r.includes("[")&&r!=="."&&r!==".."){let p=o[i+1];if(p&&(p.includes("*")||p.includes("?"))){t.terminalDirName=r;let l=p.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function Ee(e){let t=[],n=a=>{a.type==="path"?t.push(a.pattern):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right))};return n(e),t}function Me(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function he(e){let t=[],n=a=>{a&&(a.type==="newer"?t.push(a.refPath):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function L(e,t,n,a,s){switch(e.type){case"name":{let o=e.pattern,i=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(i){let r=i[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(r.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(r))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,i=o.split("/");for(let p=0;p<i.length-1;p++){let l=i[p];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let d=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(d))return{matches:!1,pruned:!1,printed:!1}}}let r=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(r){let p=r[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(p))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:te(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:a,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let o=L(e.expr,t,n,a,s);return{matches:!o.matches,pruned:o.pruned,printed:!1}}case"and":{let o=L(e.left,t,n,a,s);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1};let i=L(e.right,t,n,a,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:o.printed||i.printed}}case"or":{let o=L(e.left,t,n,a,s);if(o.matches)return o;let i=L(e.right,t,n,a,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:i.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function V(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return V(e.expr);case"and":case"or":return V(e.left)||V(e.right);default:return!1}}function z(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return z(e.expr);case"and":case"or":return z(e.left)&&z(e.right)}}function de(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!z(e))return se(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:k(e,n).pruned}}function se(e,t){switch(e.type){case"or":{if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(k(e.left,n).pruned)return{shouldPrune:!0}}return se(e.right,t)}case"and":{if(z(e.left)&&z(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:k(e,n).pruned}}if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return k(e.left,n).matches?se(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function me(e,t){let n=[],a=[],s=t;for(;s<e.length;){let i=e[s];if(i==="("||i==="\\("){n.push({type:"lparen"}),s++;continue}if(i===")"||i==="\\)"){n.push({type:"rparen"}),s++;continue}if(i==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(i==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(i==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(i==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(i==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(i==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(i==="-type"&&s+1<e.length){let r=e[++s];if(r==="f"||r==="d")n.push({type:"expr",expr:{type:"type",fileType:r}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${r}
|
|
3
3
|
`,actions:[]}}else if(i==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(i==="-mtime"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("+")?(p="more",l=r.slice(1)):r.startsWith("-")&&(p="less",l=r.slice(1));let d=parseInt(l,10);Number.isNaN(d)||n.push({type:"expr",expr:{type:"mtime",days:d,comparison:p}})}else if(i==="-newer"&&s+1<e.length){let r=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:r}})}else if(i==="-size"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("+")?(p="more",l=r.slice(1)):r.startsWith("-")&&(p="less",l=r.slice(1));let d=l.match(/^(\d+)([ckMGb])?$/);if(d){let O=parseInt(d[1],10),x=d[2]||"b";n.push({type:"expr",expr:{type:"size",value:O,unit:x,comparison:p}})}}else if(i==="-perm"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("-")?(p="all",l=r.slice(1)):r.startsWith("/")&&(p="any",l=r.slice(1));let d=parseInt(l,8);Number.isNaN(d)||n.push({type:"expr",expr:{type:"perm",mode:d,matchType:p}})}else if(i==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(i==="-not"||i==="!")n.push({type:"not"});else if(i==="-o"||i==="-or")n.push({type:"op",op:"or"});else if(i==="-a"||i==="-and")n.push({type:"op",op:"and"});else if(i==="-maxdepth"||i==="-mindepth")s++;else if(i!=="-depth")if(i==="-exec"){let r=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)r.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let p=e[s]==="+";a.push({type:"exec",command:r,batchMode:p})}else if(i==="-print")n.push({type:"expr",expr:{type:"print"}}),a.push({type:"print"});else if(i==="-print0")a.push({type:"print0"});else if(i==="-printf"&&s+1<e.length){let r=e[++s];a.push({type:"printf",format:r})}else if(i==="-delete")a.push({type:"delete"});else{if(i.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${i}'
|
|
4
4
|
`,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:a};let o=Fe(n);return o.error?{expr:null,pathIndex:s,error:o.error,actions:a}:{expr:o.expr,pathIndex:s,actions:a}}function Fe(e){let t=0;function n(){let r=a();if(!r)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="or"){t++;let l=a();if(!l)return r;r={type:"or",left:r,right:l}}else break}return r}function a(){let r=s();if(!r)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="and"){t++;let l=s();if(!l)return r;r={type:"and",left:r,right:l}}else if(p.type==="expr"||p.type==="not"||p.type==="lparen"){let l=s();if(!l)return r;r={type:"and",left:r,right:l}}else break}return r}function s(){if(t<e.length&&e[t].type==="not"){t++;let r=s();return r?{type:"not",expr:r}:null}return o()}function o(){if(t>=e.length)return null;let r=e[t];if(r.type==="lparen"){t++;let p=n();return t<e.length&&e[t].type==="rparen"&&t++,p}return r.type==="expr"?(t++,r.expr):(r.type==="rparen",null)}return{expr:n()}}var ye=500;function Ie(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function xe(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var $e={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},Re=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),je={name:"find",async execute(e,t){if(le(e))return ie($e);let n=[],a=null,s=null,o=!1,i=!1;for(let c=0;c<e.length;c++){let f=e[c];if(f==="-maxdepth"&&c+1<e.length)i=!0,a=parseInt(e[++c],10);else if(f==="-mindepth"&&c+1<e.length)i=!0,s=parseInt(e[++c],10);else if(f==="-depth")i=!0,o=!0;else if(f==="-exec")for(i=!0,c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else!f.startsWith("-")&&f!==";"&&f!=="+"&&f!=="("&&f!==")"&&f!=="\\("&&f!=="\\)"&&f!=="!"?i||n.push(f):Re.has(f)?(i=!0,c++):(f.startsWith("-")||f==="("||f==="\\("||f==="!")&&(i=!0)}n.length===0&&n.push(".");let{expr:r,error:p,actions:l}=me(e,0);if(p)return{stdout:"",stderr:p,exitCode:1};let d=l.some(c=>c.type==="print"),O=l.length===0,x=[],ge=l.some(c=>c.type==="printf"),re=[],B="",q=0,we=he(r),U=new Map;for(let c of we){let f=t.fs.resolvePath(t.cwd,c);try{let u=await t.fs.stat(f);U.set(c,u.mtime?.getTime()??Date.now())}catch{}}let De=l.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),Te=_(r)||De,Ce=j(r),K=ue(r),ae=V(r),Pe=J(r),Se=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let G=function(h){let $=s===null||h.depth>=s,P=!1;if($&&r!==null){let S=Date.now(),y;if(Pe)y=L(r,h.name,h.relativePath,h.isFile,h.isDirectory);else{let m={name:h.name,relativePath:h.relativePath,isFile:h.isFile,isDirectory:h.isDirectory,isEmpty:h.isEmpty,mtime:h.stat?.mtime?.getTime()??Date.now(),size:h.stat?.size??0,mode:h.stat?.mode??420,newerRefTimes:U};y=k(r,m)}$=y.matches,P=d?y.printed:$,u.evalCalls++,u.evalTime+=Date.now()-S}else $&&(P=!0);return P?{print:!0,printfData:ge?{path:h.relativePath,name:h.name,size:h.stat?.size??0,mtime:h.stat?.mtime?.getTime()??Date.now(),mode:h.stat?.mode??420,isDirectory:h.isDirectory,depth:h.depth,startingPoint:c}:null}:{print:!1,printfData:null}};var We=G;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{B+=`find: ${c}: No such file or directory
|
|
5
5
|
`,q=1;continue}let u=Ie(),M=Date.now();async function N(h){let{path:b,depth:$,typeInfo:P}=h;if(u.nodeCount++,$>(a??256))return null;let v,S,y;if(P&&!Te)v=P.isFile,S=P.isDirectory;else{try{let A=Date.now();y=await t.fs.stat(b),u.statCalls++,u.statTime+=Date.now()-A}catch{return null}if(!y)return null;v=y.isFile,S=y.isDirectory}let m;b===f?m=c.split("/").pop()||c:m=b.split("/").pop()||"";let g=b===f?c:c==="."?`./${b.slice(f==="/"?f.length:f.length+1)}`:c+b.slice(f.length),T=[],C=null,w=null,D=!1;S&&ae&&!o&&(D=de(r,{name:m,relativePath:g,isFile:v,isDirectory:S}).shouldPrune,D&&u.earlyPrunes++);let F=$>=(a??256),I=K.terminalDirName!==null&&m===K.terminalDirName,Z=!F&&!I&&!D;if(S&&((Z||Ce||I)&&!D)){let A=Date.now();if(Se&&t.fs.readdirWithFileTypes){if(C=await t.fs.readdirWithFileTypes(b),w=C.map(E=>E.name),u.readdirCalls++,u.readdirTime+=Date.now()-A,Z)T=C.map((E,R)=>({path:b==="/"?`/${E.name}`:`${b}/${E.name}`,depth:$+1,typeInfo:{isFile:E.isFile,isDirectory:E.isDirectory},resultIndex:R}));else if(I){let E=K.requiredExtension;T=C.filter(R=>R.isFile&&(!E||R.name.endsWith(E))).map((R,ve)=>({path:b==="/"?`/${R.name}`:`${b}/${R.name}`,depth:$+1,typeInfo:{isFile:R.isFile,isDirectory:R.isDirectory},resultIndex:ve}))}}else w=await t.fs.readdir(b),u.readdirCalls++,u.readdirTime+=Date.now()-A,Z&&(T=w.map((E,R)=>({path:b==="/"?`/${E}`:`${b}/${E}`,depth:$+1,resultIndex:R})))}let Q=v?(y?.size??0)===0:w!==null&&w.length===0,H=D;if(!o&&r!==null&&!D&&ae){let A=Date.now(),E={name:m,relativePath:g,isFile:v,isDirectory:S,isEmpty:Q,mtime:y?.mtime?.getTime()??Date.now(),size:y?.size??0,mode:y?.mode??420,newerRefTimes:U};H=k(r,E).pruned,u.evalCalls++,u.evalTime+=Date.now()-A}return{relativePath:g,name:m,isFile:v,isDirectory:S,isEmpty:Q,stat:y,depth:$,children:H?[]:T,pruned:H}}async function be(){let h={paths:[],printfData:[]};if(o){let y=function(m){let g={paths:[],printfData:[]},T=P[m];if(!T)return g;for(let D of T.childIndices){let F=y(D);g.paths.push(...F.paths),g.printfData.push(...F.printfData)}let{print:C,printfData:w}=G(T.node);return C&&(g.paths.push(T.node.relativePath),w&&g.printfData.push(w)),g};var b=y;let P=[],v=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map;for(;v.length>0;){let m=Date.now(),g=v.splice(0,ye),T=await Promise.all(g.map(C=>N(C.item)));u.batchCount++,u.batchTime+=Date.now()-m;for(let C=0;C<g.length;C++){let w=T[C],D=g[C];if(!w)continue;let F=P.length;if(D.parentIndex>=0){let I=S.get(D.parentIndex)||[];I.push(F),S.set(D.parentIndex,I)}P.push({node:w,parentIndex:D.parentIndex,childIndices:[]});for(let I=0;I<w.children.length;I++)v.push({item:w.children[I],parentIndex:F,childOrderInParent:I})}}for(let[m,g]of S)m>=0&&m<P.length&&(P[m].childIndices=g);if(P.length>0){let m=y(0);h.paths.push(...m.paths),h.printfData.push(...m.printfData)}}else{let m=function(g){let T=P.get(g);T&&(h.paths.push(T.path),T.printfData&&h.printfData.push(T.printfData));let C=y.get(g);if(C)for(let w of C)m(w)};var $=m;let P=new Map,v=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:v++}],y=new Map;for(;S.length>0;){let g=Date.now(),T=S.splice(0,ye),C=await Promise.all(T.map(async({item:w,orderIndex:D})=>{let F=await N(w);return F?{node:F,orderIndex:D}:null}));u.batchCount++,u.batchTime+=Date.now()-g;for(let w of C){if(!w)continue;let{node:D,orderIndex:F}=w,{print:I,printfData:Z}=G(D);if(I&&P.set(F,{path:D.relativePath,printfData:Z}),D.children.length>0){let ee=[];for(let Q of D.children){let H=v++;ee.push(H),S.push({item:Q,orderIndex:H})}y.set(F,ee)}}}m(0)}return h}let X=await be();if(x.push(...X.paths),re.push(...X.printfData),t.trace){let h=Date.now()-M;xe(t.trace,u,h),t.trace({category:"find",name:"searchPath",durationMs:h,details:{path:c,resultsFound:X.paths.length}})}}let W="";if(l.length>0)for(let c of l)switch(c.type){case"print":W+=x.length>0?`${x.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as N}from"./chunk-
|
|
2
|
+
import{a as N}from"./chunk-JDNI5HBX.js";function B(n,t){return n.replace(/\$(&|\d+|<([^>]+)>)/g,(e,i,s)=>{if(i==="&")return t[0];if(s!==void 0)return t.groups?.[s]??"";let h=parseInt(i,10);return t[h]??""})}function D(n,t,e={}){let{invertMatch:i=!1,showLineNumbers:s=!1,countOnly:h=!1,countMatches:d=!1,filename:a="",onlyMatching:m=!1,beforeContext:I=0,afterContext:R=0,maxCount:S=0,contextSeparator:F="--",showColumn:O=!1,vimgrep:G=!1,showByteOffset:P=!1,replace:k=null,passthru:y=!1,multiline:j=!1,kResetGroup:A}=e;if(j)return Q(n,t,{invertMatch:i,showLineNumbers:s,countOnly:h,countMatches:d,filename:a,onlyMatching:m,beforeContext:I,afterContext:R,maxCount:S,contextSeparator:F,showColumn:O,showByteOffset:P,replace:k,kResetGroup:A});let x=n.split(`
|
|
3
3
|
`),Z=x.length,v=Z>0&&x[Z-1]===""?Z-1:Z;if(h||d){let f=0,r=(d||m)&&!i;for(let l=0;l<v;l++)if(t.lastIndex=0,r)for(let u=t.exec(x[l]);u!==null;u=t.exec(x[l]))f++,u[0].length===0&&t.lastIndex++;else t.test(x[l])!==i&&f++;return{output:`${a?`${a}:${f}`:String(f)}
|
|
4
4
|
`,matched:f>0,matchCount:f}}if(I===0&&R===0&&!y){let f=[],r=!1,o=0,l=0;for(let u=0;u<v&&!(S>0&&o>=S);u++){let L=x[u];if(t.lastIndex=0,t.test(L)!==i)if(r=!0,o++,m){t.lastIndex=0;for(let $=t.exec(L);$!==null;$=t.exec(L)){let b=A!==void 0?$[A]??"":$[0],T=k!==null?B(k,$):b,z=a?`${a}:`:"";P&&(z+=`${l+$.index}:`),s&&(z+=`${u+1}:`),O&&(z+=`${$.index+1}:`),f.push(z+T),$[0].length===0&&t.lastIndex++}}else if(G){t.lastIndex=0;for(let $=t.exec(L);$!==null;$=t.exec(L)){let b=a?`${a}:`:"";P&&(b+=`${l+$.index}:`),s&&(b+=`${u+1}:`),O&&(b+=`${$.index+1}:`),f.push(b+L),$[0].length===0&&t.lastIndex++}}else{t.lastIndex=0;let $=t.exec(L),b=$?$.index+1:1,T=L;k!==null&&(t.lastIndex=0,T=t.replace(L,(...M)=>{if(M[0].length===0)return"";let U=M,_=M[M.length-1];return typeof _=="object"&&_!==null?(U.groups=_,U.input=M[M.length-2],U.index=M[M.length-3]):(U.input=M[M.length-1],U.index=M[M.length-2]),B(k,U)}));let z=a?`${a}:`:"";P&&(z+=`${l+($?$.index:0)}:`),s&&(z+=`${u+1}:`),O&&(z+=`${b}:`),f.push(z+T)}l+=L.length+1}return{output:f.length>0?`${f.join(`
|
|
5
5
|
`)}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as I}from"./chunk-JBABAK44.js";import{a as K,b as V}from"./chunk-GTNBSMZR.js";var B=(i,t,e)=>{let s=i instanceof RegExp?Y(i,e):i,n=t instanceof RegExp?Y(t,e):t,r=s!==null&&n!=null&&Et(s,n,e);return r&&{start:r[0],end:r[1],pre:e.slice(0,r[0]),body:e.slice(r[0]+s.length,r[1]),post:e.slice(r[1]+n.length)}},Y=(i,t)=>{let e=t.match(i);return e?e[0]:null},Et=(i,t,e)=>{let s,n,r,o,l,h=e.indexOf(i),c=e.indexOf(t,h+1),g=h;if(h>=0&&c>0){if(i===t)return[h,c];for(s=[],r=e.length;g>=0&&!l;){if(g===h)s.push(g),h=e.indexOf(i,g+1);else if(s.length===1){let a=s.pop();a!==void 0&&(l=[a,c])}else n=s.pop(),n!==void 0&&n<r&&(r=n,o=c),c=e.indexOf(t,g+1);g=h<c&&h>=0?h:c}s.length&&o!==void 0&&(l=[r,o])}return l};var Q="\0SLASH"+Math.random()+"\0",tt="\0OPEN"+Math.random()+"\0",q="\0CLOSE"+Math.random()+"\0",et="\0COMMA"+Math.random()+"\0",st="\0PERIOD"+Math.random()+"\0",Mt=new RegExp(Q,"g"),At=new RegExp(tt,"g"),Pt=new RegExp(q,"g"),Tt=new RegExp(et,"g"),Nt=new RegExp(st,"g"),Rt=/\\\\/g,vt=/\\{/g,Ot=/\\}/g,zt=/\\,/g,Ct=/\\\./g,Wt=1e5;function H(i){return isNaN(i)?i.charCodeAt(0):parseInt(i,10)}function Dt(i){return i.replace(Rt,Q).replace(vt,tt).replace(Ot,q).replace(zt,et).replace(Ct,st)}function jt(i){return i.replace(Mt,"\\").replace(At,"{").replace(Pt,"}").replace(Tt,",").replace(Nt,".")}function nt(i){if(!i)return[""];let t=[],e=B("{","}",i);if(!e)return i.split(",");let{pre:s,body:n,post:r}=e,o=s.split(",");o[o.length-1]+="{"+n+"}";let l=nt(r);return r.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}function it(i,t={}){if(!i)return[];let{max:e=Wt}=t;return i.slice(0,2)==="{}"&&(i="\\{\\}"+i.slice(2)),j(Dt(i),e,!0).map(jt)}function Lt(i){return"{"+i+"}"}function kt(i){return/^-?0\d/.test(i)}function _t(i,t){return i<=t}function Gt(i,t){return i>=t}function j(i,t,e){let s=[],n=B("{","}",i);if(!n)return[i];let r=n.pre,o=n.post.length?j(n.post,t,!1):[""];if(/\$$/.test(n.pre))for(let l=0;l<o.length&&l<t;l++){let h=r+"{"+n.body+"}"+o[l];s.push(h)}else{let l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),c=l||h,g=n.body.indexOf(",")>=0;if(!c&&!g)return n.post.match(/,(?!,).*\}/)?(i=n.pre+"{"+n.body+q+n.post,j(i,t,!0)):[i];let a;if(c)a=n.body.split(/\.\./);else if(a=nt(n.body),a.length===1&&a[0]!==void 0&&(a=j(a[0],t,!1).map(Lt),a.length===1))return o.map(u=>n.pre+a[0]+u);let p;if(c&&a[0]!==void 0&&a[1]!==void 0){let u=H(a[0]),d=H(a[1]),f=Math.max(a[0].length,a[1].length),$=a.length===3&&a[2]!==void 0?Math.max(Math.abs(H(a[2])),1):1,S=_t;d<u&&($*=-1,S=Gt);let b=a.some(kt);p=[];for(let y=u;S(y,d);y+=$){let w;if(h)w=String.fromCharCode(y),w==="\\"&&(w="");else if(w=String(y),b){let E=f-w.length;if(E>0){let x=new Array(E+1).join("0");y<0?w="-"+x+w.slice(1):w=x+w}}p.push(w)}}else{p=[];for(let u=0;u<a.length;u++)p.push.apply(p,j(a[u],t,!1))}for(let u=0;u<p.length;u++)for(let d=0;d<o.length&&s.length<t;d++){let f=r+p[u]+o[d];(!e||c||f)&&s.push(f)}}return s}var L=i=>{if(typeof i!="string")throw new TypeError("invalid pattern");if(i.length>65536)throw new TypeError("pattern is too long")};var Ft={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},k=i=>i.replace(/[[\]\\-]/g,"\\$&"),Bt=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),rt=i=>i.join(""),ot=(i,t)=>{let e=t;if(i.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],n=[],r=e+1,o=!1,l=!1,h=!1,c=!1,g=e,a="";t:for(;r<i.length;){let f=i.charAt(r);if((f==="!"||f==="^")&&r===e+1){c=!0,r++;continue}if(f==="]"&&o&&!h){g=r+1;break}if(o=!0,f==="\\"&&!h){h=!0,r++;continue}if(f==="["&&!h){for(let[$,[S,m,b]]of Object.entries(Ft))if(i.startsWith($,r)){if(a)return["$.",!1,i.length-e,!0];r+=$.length,b?n.push(S):s.push(S),l=l||m;continue t}}if(h=!1,a){f>a?s.push(k(a)+"-"+k(f)):f===a&&s.push(k(f)),a="",r++;continue}if(i.startsWith("-]",r+1)){s.push(k(f+"-")),r+=2;continue}if(i.startsWith("-",r+1)){a=f,r+=2;continue}s.push(k(f)),r++}if(g<r)return["",!1,0,!1];if(!s.length&&!n.length)return["$.",!1,i.length-e,!0];if(n.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let f=s[0].length===2?s[0].slice(-1):s[0];return[Bt(f),!1,g-e,!1]}let p="["+(c?"^":"")+rt(s)+"]",u="["+(c?"":"^")+rt(n)+"]";return[s.length&&n.length?"("+p+"|"+u+")":s.length?p:u,l,g-e,!0]};var v=(i,{windowsPathsNoEscape:t=!1,magicalBraces:e=!0}={})=>e?t?i.replace(/\[([^/\\])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?i.replace(/\[([^/\\{}])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var T,Ht=new Set(["!","?","+","*","@"]),J=i=>Ht.has(i),at=i=>J(i.type),qt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Jt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ut=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),lt=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Zt="(?!(?:^|/)\\.\\.?(?:$|/))",_="(?!\\.)",Xt=new Set(["[","."]),Kt=new Set(["..","."]),Vt=new Set("().*{}+?[]^$\\!"),It=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),U="[^/]",ct=U+"*?",ht=U+"+?",Yt=0,z=class{type;#s;#n;#i=!1;#t=[];#e;#a;#c;#l=!1;#r;#o;#h=!1;id=++Yt;get depth(){return(this.#e?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#s.id,parent:this.#e?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,e,s={}){this.type=t,t&&(this.#n=!0),this.#e=e,this.#s=this.#e?this.#e.#s:this,this.#r=this.#s===this?s:this.#s.#r,this.#c=this.#s===this?[]:this.#s.#c,t==="!"&&!this.#s.#l&&this.#c.push(this),this.#a=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#y(){if(this!==this.#s)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let t;for(;t=this.#c.pop();){if(t.type!=="!")continue;let e=t,s=e.#e;for(;s;){for(let n=e.#a+1;!s.type&&n<s.#t.length;n++)for(let r of t.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#t[n])}e=s,s=e.#e}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof T&&e.#e===this))throw new Error("invalid part: "+e);this.#t.push(e)}}toJSON(){let t=this.type===null?this.#t.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#t.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#s||this.#s.#l&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#s===this)return!0;if(!this.#e?.isStart())return!1;if(this.#a===0)return!0;let t=this.#e;for(let e=0;e<this.#a;e++){let s=t.#t[e];if(!(s instanceof T&&s.type==="!"))return!1}return!0}isEnd(){if(this.#s===this||this.#e?.type==="!")return!0;if(!this.#e?.isEnd())return!1;if(!this.type)return this.#e?.isEnd();let t=this.#e?this.#e.#t.length:0;return this.#a===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new T(this.type,t);for(let s of this.#t)e.copyIn(s);return e}static#f(t,e,s,n,r){let o=n.maxExtglobRecursion??2,l=!1,h=!1,c=-1,g=!1;if(e.type===null){let f=s,$="";for(;f<t.length;){let S=t.charAt(f++);if(l||S==="\\"){l=!l,$+=S;continue}if(h){f===c+1?(S==="^"||S==="!")&&(g=!0):S==="]"&&!(f===c+2&&g)&&(h=!1),$+=S;continue}else if(S==="["){h=!0,c=f,g=!1,$+=S;continue}if(!n.noext&&J(S)&&t.charAt(f)==="("&&r<=o){e.push($),$="";let b=new T(S,e);f=T.#f(t,b,f,n,r+1),e.push(b);continue}$+=S}return e.push($),f}let a=s+1,p=new T(null,e),u=[],d="";for(;a<t.length;){let f=t.charAt(a++);if(l||f==="\\"){l=!l,d+=f;continue}if(h){a===c+1?(f==="^"||f==="!")&&(g=!0):f==="]"&&!(a===c+2&&g)&&(h=!1),d+=f;continue}else if(f==="["){h=!0,c=a,g=!1,d+=f;continue}if(!n.noext&&J(f)&&t.charAt(a)==="("&&(r<=o||e&&e.#u(f))){let S=e&&e.#u(f)?0:1;p.push(d),d="";let m=new T(f,p);p.push(m),a=T.#f(t,m,a,n,r+S);continue}if(f==="|"){p.push(d),d="",u.push(p),p=new T(null,e);continue}if(f===")")return d===""&&e.#t.length===0&&(e.#h=!0),p.push(d),d="",e.push(...u,p),a;d+=f}return e.type=null,e.#n=void 0,e.#t=[t.substring(s-1)],a}#w(t){return this.#g(t,Jt)}#g(t,e=qt){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let s=t.#t[0];return!s||typeof s!="object"||s.type===null?!1:this.#u(s.type,e)}#u(t,e=Ut){return!!e.get(this.type)?.includes(t)}#S(t,e){let s=t.#t[0],n=new T(null,s,this.options);n.#t.push(""),s.push(n),this.#d(t,e)}#d(t,e){let s=t.#t[0];this.#t.splice(e,1,...s.#t);for(let n of s.#t)typeof n=="object"&&(n.#e=this);this.#o=void 0}#$(t){return!!lt.get(this.type)?.has(t)}#b(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let e=t.#t[0];return!e||typeof e!="object"||e.type===null?!1:this.#$(e.type)}#x(t){let e=lt.get(this.type),s=t.#t[0],n=e?.get(s.type);if(!n)return!1;this.#t=s.#t;for(let r of this.#t)typeof r=="object"&&(r.#e=this);this.type=n,this.#o=void 0,this.#h=!1}static fromGlob(t,e={}){let s=new T(null,void 0,e);return T.#f(t,s,0,e,0),s}toMMPattern(){if(this!==this.#s)return this.#s.toMMPattern();let t=this.toString(),[e,s,n,r]=this.toRegExpSource();if(!(n||this.#n||this.#r.nocase&&!this.#r.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let l=(this.#r.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,l),{_src:e,_glob:t})}get options(){return this.#r}toRegExpSource(t){let e=t??!!this.#r.dot;if(this.#s===this&&(this.#p(),this.#y()),!at(this)){let h=this.isStart()&&this.isEnd()&&!this.#t.some(u=>typeof u!="string"),c=this.#t.map(u=>{let[d,f,$,S]=typeof u=="string"?T.#E(u,this.#n,h):u.toRegExpSource(t);return this.#n=this.#n||$,this.#i=this.#i||S,d}).join(""),g="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Kt.has(this.#t[0]))){let d=Xt,f=e&&d.has(c.charAt(0))||c.startsWith("\\.")&&d.has(c.charAt(2))||c.startsWith("\\.\\.")&&d.has(c.charAt(4)),$=!e&&!t&&d.has(c.charAt(0));g=f?Zt:$?_:""}let a="";return this.isEnd()&&this.#s.#l&&this.#e?.type==="!"&&(a="(?:$|\\/)"),[g+c+a,v(c),this.#n=!!this.#n,this.#i]}let s=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#m(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let h=this.toString(),c=this;return c.#t=[h],c.type=null,c.#n=void 0,[h,v(this.toString()),!1,!1]}let o=!s||t||e||!_?"":this.#m(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let l="";if(this.type==="!"&&this.#h)l=(this.isStart()&&!e?_:"")+ht;else{let h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?_:"")+ct+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=n+r+h}return[l,v(r),this.#n=!!this.#n,this.#i]}#p(){if(at(this)){let t=0,e=!1;do{e=!0;for(let s=0;s<this.#t.length;s++){let n=this.#t[s];typeof n=="object"&&(n.#p(),this.#g(n)?(e=!1,this.#d(n,s)):this.#w(n)?(e=!1,this.#S(n,s)):this.#b(n)&&(e=!1,this.#x(n)))}}while(!e&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#p();this.#o=void 0}#m(t){return this.#t.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,n,r,o]=e.toRegExpSource(t);return this.#i=this.#i||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#E(t,e,s=!1){let n=!1,r="",o=!1,l=!1;for(let h=0;h<t.length;h++){let c=t.charAt(h);if(n){n=!1,r+=(Vt.has(c)?"\\":"")+c;continue}if(c==="*"){if(l)continue;l=!0,r+=s&&/^[*]+$/.test(t)?ht:ct,e=!0;continue}else l=!1;if(c==="\\"){h===t.length-1?r+="\\\\":n=!0;continue}if(c==="["){let[g,a,p,u]=ot(t,h);if(p){r+=g,o=o||a,h+=p-1,e=e||u;continue}}if(c==="?"){r+=U,e=!0;continue}r+=It(c)}return[r,v(t),!!e,o]}};T=z;var Z=(i,{windowsPathsNoEscape:t=!1,magicalBraces:e=!1}={})=>e?t?i.replace(/[?*()[\]{}]/g,"[$&]"):i.replace(/[?*()[\]\\{}]/g,"\\$&"):t?i.replace(/[?*()[\]]/g,"[$&]"):i.replace(/[?*()[\]\\]/g,"\\$&");var M=(i,t,e={})=>(L(t),!e.nocomment&&t.charAt(0)==="#"?!1:new D(t,e).match(i)),Qt=/^\*+([^+@!?*[(]*)$/,te=i=>t=>!t.startsWith(".")&&t.endsWith(i),ee=i=>t=>t.endsWith(i),se=i=>(i=i.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(i)),ne=i=>(i=i.toLowerCase(),t=>t.toLowerCase().endsWith(i)),ie=/^\*+\.\*+$/,re=i=>!i.startsWith(".")&&i.includes("."),oe=i=>i!=="."&&i!==".."&&i.includes("."),ae=/^\.\*+$/,le=i=>i!=="."&&i!==".."&&i.startsWith("."),ce=/^\*+$/,he=i=>i.length!==0&&!i.startsWith("."),fe=i=>i.length!==0&&i!=="."&&i!=="..",ue=/^\?+([^+@!?*[(]*)?$/,pe=([i,t=""])=>{let e=pt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},ge=([i,t=""])=>{let e=gt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},de=([i,t=""])=>{let e=gt([i]);return t?s=>e(s)&&s.endsWith(t):e},me=([i,t=""])=>{let e=pt([i]);return t?s=>e(s)&&s.endsWith(t):e},pt=([i])=>{let t=i.length;return e=>e.length===t&&!e.startsWith(".")},gt=([i])=>{let t=i.length;return e=>e.length===t&&e!=="."&&e!==".."},dt=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ft={win32:{sep:"\\"},posix:{sep:"/"}},ye=dt==="win32"?ft.win32.sep:ft.posix.sep;M.sep=ye;var A=Symbol("globstar **");M.GLOBSTAR=A;var we="[^/]",Se=we+"*?",$e="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",be="(?:(?!(?:\\/|^)\\.).)*?",xe=(i,t={})=>e=>M(e,i,t);M.filter=xe;var N=(i,t={})=>Object.assign({},i,t),Ee=i=>{if(!i||typeof i!="object"||!Object.keys(i).length)return M;let t=M;return Object.assign((s,n,r={})=>t(s,n,N(i,r)),{Minimatch:class extends t.Minimatch{constructor(n,r={}){super(n,N(i,r))}static defaults(n){return t.defaults(N(i,n)).Minimatch}},AST:class extends t.AST{constructor(n,r,o={}){super(n,r,N(i,o))}static fromGlob(n,r={}){return t.AST.fromGlob(n,N(i,r))}},unescape:(s,n={})=>t.unescape(s,N(i,n)),escape:(s,n={})=>t.escape(s,N(i,n)),filter:(s,n={})=>t.filter(s,N(i,n)),defaults:s=>t.defaults(N(i,s)),makeRe:(s,n={})=>t.makeRe(s,N(i,n)),braceExpand:(s,n={})=>t.braceExpand(s,N(i,n)),match:(s,n,r={})=>t.match(s,n,N(i,r)),sep:t.sep,GLOBSTAR:A})};M.defaults=Ee;var mt=(i,t={})=>(L(i),t.nobrace||!/\{(?:(?!\{).)*\}/.test(i)?[i]:it(i,{max:t.braceExpandMax}));M.braceExpand=mt;var Me=(i,t={})=>new D(i,t).makeRe();M.makeRe=Me;var Ae=(i,t,e={})=>{let s=new D(t,e);return i=i.filter(n=>s.match(n)),s.options.nonull&&!i.length&&i.push(t),i};M.match=Ae;var ut=/[?*]|[+@!]\(.*?\)|\[|\]/,Pe=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),D=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,e={}){L(t),e=e||{},this.options=e,this.maxGlobstarRecursion=e.maxGlobstarRecursion??200,this.pattern=t,this.platform=e.platform||dt,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let n=this.globParts.map((r,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=r[0]===""&&r[1]===""&&(r[2]==="?"||!ut.test(r[2]))&&!ut.test(r[3]),c=/^[a-z]:/i.test(r[0]);if(h)return[...r.slice(0,4),...r.slice(4).map(g=>this.parse(g))];if(c)return[r[0],...r.slice(1).map(g=>this.parse(g))]}return r.map(h=>this.parse(h))});if(this.debug(this.pattern,n),this.set=n.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s of t)for(let n=0;n<s.length;n++)s[n]==="**"&&(s[n]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let n=s;for(;e[n+1]==="**";)n++;n!==s&&e.splice(s,n-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,n)=>{let r=s[s.length-1];return n==="**"&&r==="**"?s:n===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(n),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;n<t.length-1;n++){let r=t[n];n===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(n,1),n--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let n=t[s-1];n&&n!=="."&&n!==".."&&n!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(n))&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let n=-1;for(;(n=s.indexOf("**",n+1))!==-1;){let o=n;for(;s[o+1]==="**";)o++;o>n&&s.splice(n+1,o-n);let l=s[n+1],h=s[n+2],c=s[n+3];if(l!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(n,1);let g=s.slice(0);g[n]="**",t.push(g),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let l=s[o];o===1&&l===""&&s[0]===""||(l==="."||l==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let h=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...h),s.length===0&&s.push(""),r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let n=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(n){t[e]=[],t[s]=n;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let n=0,r=0,o=[],l="";for(;n<t.length&&r<e.length;)if(t[n]===e[r])o.push(l==="b"?e[r]:t[n]),n++,r++;else if(s&&t[n]==="**"&&e[r]===t[n+1])o.push(t[n]),n++;else if(s&&e[r]==="**"&&t[n]===e[r+1])o.push(e[r]),r++;else if(t[n]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(l==="b")return!1;l="a",o.push(t[n]),n++,r++}else if(e[r]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(l==="a")return!1;l="b",o.push(e[r]),n++,r++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let n=0;n<t.length&&t.charAt(n)==="!";n++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let n=0,r=0;if(this.isWindows){let l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),h=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),g=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),a=h?3:l?0:void 0,p=g?3:c?0:void 0;if(typeof a=="number"&&typeof p=="number"){let[u,d]=[t[a],e[p]];u.toLowerCase()===d.toLowerCase()&&(e[p]=u,r=p,n=a)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),e.includes(A)?this.#s(t,e,s,n,r):this.#i(t,e,s,n,r)}#s(t,e,s,n,r){let o=e.indexOf(A,r),l=e.lastIndexOf(A),[h,c,g]=s?[e.slice(r,o),e.slice(o+1),[]]:[e.slice(r,o),e.slice(o+1,l),e.slice(l+1)];if(h.length){let m=t.slice(n,n+h.length);if(!this.#i(m,h,s,0,0))return!1;n+=h.length,r+=h.length}let a=0;if(g.length){if(g.length+n>t.length)return!1;let m=t.length-g.length;if(this.#i(t,g,s,m,0))a=g.length;else{if(t[t.length-1]!==""||n+g.length===t.length||(m--,!this.#i(t,g,s,m,0)))return!1;a=g.length+1}}if(!c.length){let m=!!a;for(let b=n;b<t.length-a;b++){let y=String(t[b]);if(m=!0,y==="."||y===".."||!this.options.dot&&y.startsWith("."))return!1}return s||m}let p=[[[],0]],u=p[0],d=0,f=[0];for(let m of c)m===A?(f.push(d),u=[[],0],p.push(u)):(u[0].push(m),d++);let $=p.length-1,S=t.length-a;for(let m of p)m[1]=S-(f[$--]+m[0].length);return!!this.#n(t,p,n,0,s,0,!!a)}#n(t,e,s,n,r,o,l){let h=e[n];if(!h){for(let a=s;a<t.length;a++){l=!0;let p=t[a];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return l}let[c,g]=h;for(;s<=g;){if(this.#i(t.slice(0,s+c.length),c,r,s,0)&&o<this.maxGlobstarRecursion){let u=this.#n(t,e,s+c.length,n+1,r,o+1,l);if(u!==!1)return u}let p=t[s];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;s++}return r||null}#i(t,e,s,n,r){let o,l,h,c;for(o=n,l=r,c=t.length,h=e.length;o<c&&l<h;o++,l++){this.debug("matchOne loop");let g=e[l],a=t[o];if(this.debug(e,g,a),g===!1||g===A)return!1;let p;if(typeof g=="string"?(p=a===g,this.debug("string match",g,a,p)):(p=g.test(a),this.debug("pattern match",g,a,p)),!p)return!1}if(o===c&&l===h)return!0;if(o===c)return s;if(l===h)return o===c-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return mt(this.pattern,this.options)}parse(t){L(t);let e=this.options;if(t==="**")return A;if(t==="")return"";let s,n=null;(s=t.match(ce))?n=e.dot?fe:he:(s=t.match(Qt))?n=(e.nocase?e.dot?ne:se:e.dot?ee:te)(s[1]):(s=t.match(ue))?n=(e.nocase?e.dot?ge:pe:e.dot?de:me)(s):(s=t.match(ie))?n=e.dot?oe:re:(s=t.match(ae))&&(n=le);let r=z.fromGlob(t,this.options).toMMPattern();return n&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:n}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?Se:e.dot?$e:be,n=new Set(e.nocase?["i"]:[]),r=t.map(h=>{let c=h.map(a=>{if(a instanceof RegExp)for(let p of a.flags.split(""))n.add(p);return typeof a=="string"?Pe(a):a===A?A:a._src});c.forEach((a,p)=>{let u=c[p+1],d=c[p-1];a!==A||d===A||(d===void 0?u!==void 0&&u!==A?c[p+1]="(?:\\/|"+s+"\\/)?"+u:c[p]=s:u===void 0?c[p-1]=d+"(?:\\/|\\/"+s+")?":u!==A&&(c[p-1]=d+"(?:\\/|\\/"+s+"\\/)"+u,c[p+1]=A))});let g=c.filter(a=>a!==A);if(this.partial&&g.length>=1){let a=[];for(let p=1;p<=g.length;p++)a.push(g.slice(0,p).join("/"));return"(?:"+a.join("|")+")"}return g.join("/")}).join("|"),[o,l]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+l+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+l+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...n].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let n=this.slashSplit(t);this.debug(this.pattern,"split",n);let r=this.set;this.debug(this.pattern,"set",r);let o=n[n.length-1];if(!o)for(let l=n.length-2;!o&&l>=0;l--)o=n[l];for(let l of r){let h=n;if(s.matchBase&&l.length===1&&(h=[o]),this.matchOne(h,l,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return M.defaults(t).Minimatch}};M.AST=z;M.Minimatch=D;M.escape=Z;M.unescape=v;function G(i){if(i<1024)return String(i);if(i<1024*1024){let e=i/1024;return e<10?`${e.toFixed(1)}K`:`${Math.round(e)}K`}if(i<1024*1024*1024){let e=i/1048576;return e<10?`${e.toFixed(1)}M`:`${Math.round(e)}M`}let t=i/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function F(i){let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][i.getMonth()],s=String(i.getDate()).padStart(2," "),n=new Date,r=new Date(n.getTime()-4320*60*60*1e3);if(i>r){let l=String(i.getHours()).padStart(2,"0"),h=String(i.getMinutes()).padStart(2,"0");return`${e} ${s} ${l}:${h}`}let o=i.getFullYear();return`${e} ${s} ${o}`}function C(i){return i.isDirectory?"/":i.isSymbolicLink?"@":(i.mode&73)!==0?"*":""}var Te={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},Ne={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},es={name:"ls",async execute(i,t){if(V(i))return K(Te);let e=I("ls",i,Ne);if(!e.ok)return e.error;let s=e.result.flags.showAll,n=e.result.flags.showAlmostAll,r=e.result.flags.longFormat,o=e.result.flags.humanReadable,l=e.result.flags.recursive,h=e.result.flags.reverse,c=e.result.flags.sortBySize,g=e.result.flags.classifyFiles,a=e.result.flags.directoryOnly,p=e.result.flags.sortByTime;e.result.flags.onePerLine;let u=e.result.positional;u.length===0&&u.push(".");let d="",f="",$=0;for(let S=0;S<u.length;S++){let m=u[S];if(S>0&&d&&!d.endsWith(`
|
|
3
|
+
|
|
4
|
+
`)&&(d+=`
|
|
5
|
+
`),a){let b=t.fs.resolvePath(t.cwd,m);try{let y=await t.fs.stat(b);if(r){let w=y.isDirectory?"drwxr-xr-x":"-rw-r--r--",E=g?C(await t.fs.lstat(b)):y.isDirectory?"/":"",x=y.size??0,P=o?G(x).padStart(5):String(x).padStart(5),R=y.mtime??new Date(0),W=F(R);d+=`${w} 1 user user ${P} ${W} ${m}${E}
|
|
6
|
+
`}else{let w=g?C(await t.fs.lstat(b)):"";d+=`${m}${w}
|
|
7
|
+
`}}catch{f+=`ls: cannot access '${m}': No such file or directory
|
|
8
|
+
`,$=2}continue}if(m.includes("*")||m.includes("?")||m.includes("[")){let b=await Re(m,t,s,n,r,h,o,c,g);d+=b.stdout,f+=b.stderr,b.exitCode!==0&&($=b.exitCode)}else{let b=await yt(m,t,s,n,r,l,u.length>1,h,o,c,g);d+=b.stdout,f+=b.stderr,b.exitCode!==0&&($=b.exitCode)}}return{stdout:d,stderr:f,exitCode:$}}};async function Re(i,t,e,s,n,r=!1,o=!1,l=!1,h=!1){let c=e||s,g=t.fs.getAllPaths(),a=t.fs.resolvePath(t.cwd,"."),p=[];for(let u of g){let d=u.startsWith(a)&&u.slice(a.length+1)||u;if(M(d,i)||M(u,i)){let f=d.split("/").pop()||d;if(!c&&f.startsWith("."))continue;p.push(d||u)}}if(p.length===0)return{stdout:"",stderr:`ls: ${i}: No such file or directory
|
|
9
|
+
`,exitCode:2};if(l){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.stat(f);u.push({path:d,size:$.size??0})}catch{u.push({path:d,size:0})}}u.sort((d,f)=>f.size-d.size),p.length=0,p.push(...u.map(d=>d.path))}else p.sort();if(r&&p.reverse(),n){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.stat(f),S=$.isDirectory?"drwxr-xr-x":"-rw-r--r--",m=h?C(await t.fs.lstat(f)):$.isDirectory?"/":"",b=$.size??0,y=o?G(b).padStart(5):String(b).padStart(5),w=$.mtime??new Date(0),E=F(w);u.push(`${S} 1 user user ${y} ${E} ${d}${m}`)}catch{u.push(`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${d}`)}}return{stdout:`${u.join(`
|
|
10
|
+
`)}
|
|
11
|
+
`,stderr:"",exitCode:0}}if(h){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.lstat(f);u.push(`${d}${C($)}`)}catch{u.push(d)}}return{stdout:`${u.join(`
|
|
12
|
+
`)}
|
|
13
|
+
`,stderr:"",exitCode:0}}return{stdout:`${p.join(`
|
|
14
|
+
`)}
|
|
15
|
+
`,stderr:"",exitCode:0}}async function yt(i,t,e,s,n,r,o,l=!1,h=!1,c=!1,g=!1,a=!1){let p=e||s,u=t.fs.resolvePath(t.cwd,i);try{let d=await t.fs.stat(u);if(!d.isDirectory){let S=g?C(await t.fs.lstat(u)):"";if(n){let m=d.size??0,b=h?G(m).padStart(5):String(m).padStart(5),y=d.mtime??new Date(0),w=F(y);return{stdout:`-rw-r--r-- 1 user user ${b} ${w} ${i}${S}
|
|
16
|
+
`,stderr:"",exitCode:0}}return{stdout:`${i}${S}
|
|
17
|
+
`,stderr:"",exitCode:0}}let f=await t.fs.readdir(u);if(p||(f=f.filter(S=>!S.startsWith("."))),c){let S=[];for(let m of f){let b=u==="/"?`/${m}`:`${u}/${m}`;try{let y=await t.fs.stat(b);S.push({name:m,size:y.size??0})}catch{S.push({name:m,size:0})}}S.sort((m,b)=>b.size-m.size),f=S.map(m=>m.name)}else f.sort();e&&(f=[".","..",...f]),l&&f.reverse();let $="";if((r||o)&&($+=`${i}:
|
|
18
|
+
`),n){$+=`total ${f.length}
|
|
19
|
+
`;let S=f.filter(w=>w==="."||w===".."),m=f.filter(w=>w!=="."&&w!=="..");for(let w of S)$+=`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${w}
|
|
20
|
+
`;let b=[];for(let w=0;w<m.length;w+=100){let E=m.slice(w,w+100),x=await Promise.all(E.map(async P=>{let R=u==="/"?`/${P}`:`${u}/${P}`;try{let W=await t.fs.stat(R),wt=W.isDirectory?"drwxr-xr-x":"-rw-r--r--",St=g?C(await t.fs.lstat(R)):W.isDirectory?"/":"",X=W.size??0,$t=h?G(X).padStart(5):String(X).padStart(5),bt=W.mtime??new Date(0),xt=F(bt);return{name:P,line:`${wt} 1 user user ${$t} ${xt} ${P}${St}
|
|
21
|
+
`}}catch{return{name:P,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${P}
|
|
22
|
+
`}}}));b.push(...x)}let y=new Map(m.map((w,E)=>[w,E]));b.sort((w,E)=>(y.get(w.name)??0)-(y.get(E.name)??0));for(let{line:w}of b)$+=w}else if(g){let S=[],m=f.filter(y=>y!=="."&&y!==".."),b=f.filter(y=>y==="."||y==="..");for(let y of b)S.push(`${y}/`);for(let y=0;y<m.length;y+=100){let w=m.slice(y,y+100),E=await Promise.all(w.map(async x=>{let P=u==="/"?`/${x}`:`${u}/${x}`;try{let R=await t.fs.lstat(P);return`${x}${C(R)}`}catch{return x}}));S.push(...E)}$+=S.join(`
|
|
23
|
+
`)+(S.length?`
|
|
24
|
+
`:"")}else $+=f.join(`
|
|
25
|
+
`)+(f.length?`
|
|
26
|
+
`:"");if(r){let S=f.filter(y=>y!=="."&&y!==".."),m=[];if(t.fs.readdirWithFileTypes)m=(await t.fs.readdirWithFileTypes(u)).filter(w=>w.isDirectory&&S.includes(w.name)).map(w=>({name:w.name,isDirectory:!0}));else for(let y=0;y<S.length;y+=100){let w=S.slice(y,y+100),E=await Promise.all(w.map(async x=>{let P=u==="/"?`/${x}`:`${u}/${x}`;try{let R=await t.fs.stat(P);return{name:x,isDirectory:R.isDirectory}}catch{return{name:x,isDirectory:!1}}}));m.push(...E.filter(x=>x.isDirectory))}m.sort((y,w)=>y.name.localeCompare(w.name)),l&&m.reverse();let b=[];for(let y=0;y<m.length;y+=100){let w=m.slice(y,y+100),E=await Promise.all(w.map(async x=>{let P=i==="."?`./${x.name}`:`${i}/${x.name}`,R=await yt(P,t,e,s,n,r,!1,l,h,c,g,!0);return{name:x.name,result:R}}));b.push(...E)}b.sort((y,w)=>y.name.localeCompare(w.name)),l&&b.reverse();for(let{result:y}of b)$+=`
|
|
27
|
+
`,$+=y.stdout}return{stdout:$,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`ls: ${i}: No such file or directory
|
|
28
|
+
`,exitCode:2}}}var ss={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0};export{es as a,ss as b};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as Ue,b as Re,c as ge}from"./chunk-GTNBSMZR.js";import{a as re,c as L,e as Le}from"./chunk-KGOUQS5A.js";var _e=L(ye=>{ye.read=function(i,e,t,r,n){var o,s,a=n*8-r-1,m=(1<<a)-1,f=m>>1,c=-7,p=t?n-1:0,u=t?-1:1,d=i[e+p];for(p+=u,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=o*256+i[e+p],p+=u,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=s*256+i[e+p],p+=u,c-=8);if(o===0)o=1-f;else{if(o===m)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-f}return(d?-1:1)*s*Math.pow(2,o-r)};ye.write=function(i,e,t,r,n,o){var s,a,m,f=o*8-n-1,c=(1<<f)-1,p=c>>1,u=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,B=r?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-s))<1&&(s--,m*=2),s+p>=1?e+=u/m:e+=u*Math.pow(2,1-p),e*m>=2&&(s++,m/=2),s+p>=c?(a=0,s=c):s+p>=1?(a=(e*m-1)*Math.pow(2,n),s=s+p):(a=e*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;i[t+d]=a&255,d+=B,a/=256,n-=8);for(s=s<<n|a,f+=n;f>0;i[t+d]=s&255,d+=B,s/=256,f-=8);i[t+d-B]|=k*128}});var Je=L((cn,He)=>{var H=1e3,J=H*60,X=J*60,$=X*24,qt=$*7,Ht=$*365.25;He.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Jt(i);if(t==="number"&&isFinite(i))return e.long?Qt(i):Xt(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Jt(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Ht;case"weeks":case"week":case"w":return t*qt;case"days":case"day":case"d":return t*$;case"hours":case"hour":case"hrs":case"hr":case"h":return t*X;case"minutes":case"minute":case"mins":case"min":case"m":return t*J;case"seconds":case"second":case"secs":case"sec":case"s":return t*H;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Xt(i){var e=Math.abs(i);return e>=$?Math.round(i/$)+"d":e>=X?Math.round(i/X)+"h":e>=J?Math.round(i/J)+"m":e>=H?Math.round(i/H)+"s":i+"ms"}function Qt(i){var e=Math.abs(i);return e>=$?fe(i,e,$,"day"):e>=X?fe(i,e,X,"hour"):e>=J?fe(i,e,J,"minute"):e>=H?fe(i,e,H,"second"):i+" ms"}function fe(i,e,t,r){var n=e>=t*1.5;return Math.round(i/t)+" "+r+(n?"s":"")}});var Ce=L((fn,Xe)=>{function Yt(i){t.debug=t,t.default=t,t.coerce=m,t.disable=s,t.enable=n,t.enabled=a,t.humanize=Je(),t.destroy=f,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let p=0;for(let u=0;u<c.length;u++)p=(p<<5)-p+c.charCodeAt(u),p|=0;return t.colors[Math.abs(p)%t.colors.length]}t.selectColor=e;function t(c){let p,u=null,d,B;function k(...E){if(!k.enabled)return;let P=k,te=Number(new Date),It=te-(p||te);P.diff=It,P.prev=p,P.curr=te,p=te,E[0]=t.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let ie=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(he,Bt)=>{if(he==="%%")return"%";ie++;let Me=t.formatters[Bt];if(typeof Me=="function"){let Dt=E[ie];he=Me.call(P,Dt),E.splice(ie,1),ie--}return he}),t.formatArgs.call(P,E),(P.log||t.log).apply(P,E)}return k.namespace=c,k.useColors=t.useColors(),k.color=t.selectColor(c),k.extend=r,k.destroy=t.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(d!==t.namespaces&&(d=t.namespaces,B=t.enabled(c)),B),set:E=>{u=E}}),typeof t.init=="function"&&t.init(k),k}function r(c,p){let u=t(this.namespace+(typeof p>"u"?":":p)+c);return u.log=this.log,u}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let p=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let u of p)u[0]==="-"?t.skips.push(u.slice(1)):t.names.push(u)}function o(c,p){let u=0,d=0,B=-1,k=0;for(;u<c.length;)if(d<p.length&&(p[d]===c[u]||p[d]==="*"))p[d]==="*"?(B=d,k=u,d++):(u++,d++);else if(B!==-1)d=B+1,k++,u=k;else return!1;for(;d<p.length&&p[d]==="*";)d++;return d===p.length}function s(){let c=[...t.names,...t.skips.map(p=>"-"+p)].join(",");return t.enable(""),c}function a(c){for(let p of t.skips)if(o(c,p))return!1;for(let p of t.names)if(o(c,p))return!0;return!1}function m(c){return c instanceof Error?c.stack||c.message:c}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Xe.exports=Yt});var Qe=L((F,pe)=>{F.formatArgs=ei;F.save=ti;F.load=ii;F.useColors=Kt;F.storage=ri();F.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();F.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Kt(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ei(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+pe.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}F.log=console.debug||console.log||(()=>{});function ti(i){try{i?F.storage.setItem("debug",i):F.storage.removeItem("debug")}catch{}}function ii(){let i;try{i=F.storage.getItem("debug")||F.storage.getItem("DEBUG")}catch{}return!i&&typeof process<"u"&&"env"in process&&(i=process.env.DEBUG),i}function ri(){try{return localStorage}catch{}}pe.exports=Ce()(F);var{formatters:ni}=pe.exports;ni.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Ke=L((pn,Ye)=>{"use strict";Ye.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),n=e.indexOf("--");return r!==-1&&(n===-1||r<n)}});var it=L((mn,tt)=>{"use strict";var oi=re("os"),et=re("tty"),T=Ke(),{env:w}=process,U;T("no-color")||T("no-colors")||T("color=false")||T("color=never")?U=0:(T("color")||T("colors")||T("color=true")||T("color=always"))&&(U=1);"FORCE_COLOR"in w&&(w.FORCE_COLOR==="true"?U=1:w.FORCE_COLOR==="false"?U=0:U=w.FORCE_COLOR.length===0?1:Math.min(parseInt(w.FORCE_COLOR,10),3));function Se(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Fe(i,e){if(U===0)return 0;if(T("color=16m")||T("color=full")||T("color=truecolor"))return 3;if(T("color=256"))return 2;if(i&&!e&&U===void 0)return 0;let t=U||0;if(w.TERM==="dumb")return t;if(process.platform==="win32"){let r=oi.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in w)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in w)||w.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in w)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(w.TEAMCITY_VERSION)?1:0;if(w.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in w){let r=parseInt((w.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(w.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(w.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(w.TERM)||"COLORTERM"in w?1:t}function si(i){let e=Fe(i,i&&i.isTTY);return Se(e)}tt.exports={supportsColor:si,stdout:Se(Fe(!0,et.isatty(1))),stderr:Se(Fe(!0,et.isatty(2)))}});var nt=L((y,ue)=>{var ai=re("tty"),me=re("util");y.init=di;y.log=mi;y.formatArgs=fi;y.save=ui;y.load=li;y.useColors=ci;y.destroy=me.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");y.colors=[6,2,3,4,5,1];try{let i=it();i&&(i.stderr||i).level>=2&&(y.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}y.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,o)=>o.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function ci(){return"colors"in y.inspectOpts?!!y.inspectOpts.colors:ai.isatty(process.stderr.fd)}function fi(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),o=` ${n};1m${e} \x1B[0m`;i[0]=o+i[0].split(`
|
|
3
|
+
`).join(`
|
|
4
|
+
`+o),i.push(n+"m+"+ue.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=pi()+e+" "+i[0]}function pi(){return y.inspectOpts.hideDate?"":new Date().toISOString()+" "}function mi(...i){return process.stderr.write(me.formatWithOptions(y.inspectOpts,...i)+`
|
|
5
|
+
`)}function ui(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function li(){return process.env.DEBUG}function di(i){i.inspectOpts={};let e=Object.keys(y.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=y.inspectOpts[e[t]]}ue.exports=Ce()(y);var{formatters:rt}=ue.exports;rt.o=function(i){return this.inspectOpts.colors=this.useColors,me.inspect(i,this.inspectOpts).split(`
|
|
6
|
+
`).map(e=>e.trim()).join(" ")};rt.O=function(i){return this.inspectOpts.colors=this.useColors,me.inspect(i,this.inspectOpts)}});var ot=L((un,Ee)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ee.exports=Qe():Ee.exports=nt()});var Ot="End-Of-Stream",l=class extends Error{constructor(){super(Ot),this.name="EndOfStreamError"}},N=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var j=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0&&!t)throw new l;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let o=Math.min(n.length,t);e.set(n.subarray(0,o),r),r+=o,t-=o,o<n.length&&this.peekQueue.push(n.subarray(o))}return r}async readRemainderFromStream(e,t){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new N;let n=await this.readFromStream(e.subarray(r),t);if(n===0)break;r+=n}if(!t&&r<e.length)throw new l;return r}};var ne=class extends j{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}};var Q=class extends ne{async readFromStream(e,t){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}};var Z=class extends j{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let r=Math.min(t.length,e.length);return e.set(t.subarray(0,r)),r<t.length?this.buffer=t.subarray(r):this.buffer=null,r}async readFromStream(e,t){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){let n=await this.reader.read();if(n.done){this.endOfStream=!0;break}n.value&&(r+=this.writeChunk(e.subarray(r),n.value))}if(!t&&r===0&&this.endOfStream)throw new l;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function we(i){try{let e=i.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new Z(e):new Q(e)}catch(e){if(e instanceof TypeError)return new Z(i.getReader());throw e}}var A=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})<e.len)throw new l;return e.get(r,0)}async peekToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:t})<e.len)throw new l;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new l;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new l;return e.get(this.numBuffer,0)}async ignore(e){if(e<0)throw new RangeError("ignore length must be \u2265 0 bytes");if(this.fileInfo.size!==void 0){let t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}};var Mt=256e3,oe=class extends A{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let o=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=o,(!t||!t.mayBeLess)&&o<r.length)throw new l;return o}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=0;if(r.position){let o=r.position-this.position;if(o>0){let s=new Uint8Array(r.length+o);return n=await this.peekBuffer(s,{mayBeLess:r.mayBeLess}),e.set(s.subarray(o)),n-o}if(o<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(o){if(t?.mayBeLess&&o instanceof l)return 0;throw o}if(!r.mayBeLess&&n<r.length)throw new l}return n}async ignore(e){if(e<0)throw new RangeError("ignore length must be \u2265 0 bytes");let t=Math.min(Mt,e),r=new Uint8Array(t),n=0;for(;n<e;){let o=e-n,s=await this.readBuffer(r,{length:Math.min(t,o)});if(s<0)return s;n+=s}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}};var se=class extends A{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new l;return e.set(this.uint8Array.subarray(r.position,r.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};var ae=class extends A{constructor(e,t){super(t),this.blob=e,this.fileInfo={...t?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new l;let o=await this.blob.slice(r.position,r.position+n).arrayBuffer();return e.set(new Uint8Array(o)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};function Pe(i,e){let t=we(i),r=e??{},n=r.onClose;return r.onClose=async()=>{if(await t.close(),n)return n()},new oe(t,r)}function Ne(i,e){return new se(i,e)}function je(i,e){return new ae(i,e)}import{open as Ut}from"node:fs/promises";var V=class i extends A{static async fromFile(e){let t=await Ut(e,"r"),r=await t.stat();return new i(t,{fileInfo:{path:e,size:r.size}})}constructor(e,t){super(t),this.fileHandle=e,this.fileInfo=t.fileInfo}async readBuffer(e,t){let r=this.normalizeOptions(e,t);if(this.position=r.position,r.length===0)return 0;let n=await this.fileHandle.read(e,0,r.length,r.position);if(this.position+=n.bytesRead,n.bytesRead<r.length&&(!t||!t.mayBeLess))throw new l;return n.bytesRead}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=await this.fileHandle.read(e,0,r.length,r.position);if(!r.mayBeLess&&n.bytesRead<r.length)throw new l;return n.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(e){this.position=e}supportsRandomAccess(){return!0}};var tn=V.fromFile;var Ge=Le(_e(),1);var $e={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},Pt={};for(let[i,e]of Object.entries($e))Pt[e]=Number.parseInt(i,10);var ce;function Nt(){if(!(typeof globalThis.TextDecoder>"u"))return ce??(ce=new globalThis.TextDecoder("utf-8"))}var q=32*1024,I=65533;function We(i,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":{let t=Nt();return t?t.decode(i):_t(i)}case"utf-16le":return $t(i);case"us-ascii":case"ascii":return Wt(i);case"latin1":case"iso-8859-1":return Gt(i);case"windows-1252":return Zt(i);default:throw new RangeError(`Encoding '${e}' not supported`)}}function ke(i,e){e.length!==0&&(i.push(String.fromCharCode.apply(null,e)),e.length=0)}function g(i,e,t){e.push(t),e.length>=q&&ke(i,e)}function jt(i,e,t){if(t<=65535){g(i,e,t);return}t-=65536,g(i,e,55296+(t>>10)),g(i,e,56320+(t&1023))}function _t(i){let e=[],t=[],r=0;for(i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191&&(r=3);r<i.length;){let n=i[r];if(n<=127){g(e,t,n),r++;continue}if(n<194||n>244){g(e,t,I),r++;continue}if(n<=223){if(r+1>=i.length){g(e,t,I),r++;continue}let c=i[r+1];if((c&192)!==128){g(e,t,I),r++;continue}let p=(n&31)<<6|c&63;g(e,t,p),r+=2;continue}if(n<=239){if(r+2>=i.length){g(e,t,I),r++;continue}let c=i[r+1],p=i[r+2];if(!((c&192)===128&&(p&192)===128&&!(n===224&&c<160)&&!(n===237&&c>=160))){g(e,t,I),r++;continue}let d=(n&15)<<12|(c&63)<<6|p&63;g(e,t,d),r+=3;continue}if(r+3>=i.length){g(e,t,I),r++;continue}let o=i[r+1],s=i[r+2],a=i[r+3];if(!((o&192)===128&&(s&192)===128&&(a&192)===128&&!(n===240&&o<144)&&!(n===244&&o>143))){g(e,t,I),r++;continue}let f=(n&7)<<18|(o&63)<<12|(s&63)<<6|a&63;jt(e,t,f),r+=4}return ke(e,t),e.join("")}function $t(i){let e=[],t=[],r=i.length,n=0;for(;n+1<r;){let o=i[n]|i[n+1]<<8;if(n+=2,o>=55296&&o<=56319){if(n+1<r){let s=i[n]|i[n+1]<<8;s>=56320&&s<=57343?(g(e,t,o),g(e,t,s),n+=2):g(e,t,I)}else g(e,t,I);continue}if(o>=56320&&o<=57343){g(e,t,I);continue}g(e,t,o)}return n<r&&g(e,t,I),ke(e,t),e.join("")}function Wt(i){let e=[];for(let t=0;t<i.length;t+=q){let r=Math.min(i.length,t+q),n=new Array(r-t);for(let o=t,s=0;o<r;o++,s++)n[s]=i[o]&127;e.push(String.fromCharCode.apply(null,n))}return e.join("")}function Gt(i){let e=[];for(let t=0;t<i.length;t+=q){let r=Math.min(i.length,t+q),n=new Array(r-t);for(let o=t,s=0;o<r;o++,s++)n[s]=i[o];e.push(String.fromCharCode.apply(null,n))}return e.join("")}function Zt(i){let e=[],t="";for(let r=0;r<i.length;r++){let n=i[r],o=n>=128&&n<=159?$e[n]:void 0;t+=o??String.fromCharCode(n),t.length>=q&&(e.push(t),t="")}return t&&e.push(t),e.join("")}function C(i){return new DataView(i.buffer,i.byteOffset)}var Ze={len:1,get(i,e){return C(i).getUint8(e)},put(i,e,t){return C(i).setUint8(e,t),e+1}},h={len:2,get(i,e){return C(i).getUint16(e,!0)},put(i,e,t){return C(i).setUint16(e,t,!0),e+2}},_={len:2,get(i,e){return C(i).getUint16(e)},put(i,e,t){return C(i).setUint16(e,t),e+2}};var x={len:4,get(i,e){return C(i).getUint32(e,!0)},put(i,e,t){return C(i).setUint32(e,t,!0),e+4}},be={len:4,get(i,e){return C(i).getUint32(e)},put(i,e,t){return C(i).setUint32(e,t),e+4}};var Ve={len:4,get(i,e){return C(i).getInt32(e)},put(i,e,t){return C(i).setInt32(e,t),e+4}};var qe={len:8,get(i,e){return C(i).getBigUint64(e,!0)},put(i,e,t){return C(i).setBigUint64(e,t,!0),e+8}};var S=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){let r=e.subarray(t,t+this.len);return We(r,this.encoding)}};var ft=Le(ot(),1);var W={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Te={get(i){return{signature:x.get(i,0),compressedSize:x.get(i,8),uncompressedSize:x.get(i,12)}},len:16},st={get(i){let e=h.get(i,6);return{signature:x.get(i,0),minVersion:h.get(i,4),dataDescriptor:!!(e&8),compressedMethod:h.get(i,8),compressedSize:x.get(i,18),uncompressedSize:x.get(i,22),filenameLength:h.get(i,26),extraFieldLength:h.get(i,28),filename:null}},len:30},at={get(i){return{signature:x.get(i,0),nrOfThisDisk:h.get(i,4),nrOfThisDiskWithTheStart:h.get(i,6),nrOfEntriesOnThisDisk:h.get(i,8),nrOfEntriesOfSize:h.get(i,10),sizeOfCd:x.get(i,12),offsetOfStartOfCd:x.get(i,16),zipFileCommentLength:h.get(i,20)}},len:22},ct={get(i){let e=h.get(i,8);return{signature:x.get(i,0),minVersion:h.get(i,6),dataDescriptor:!!(e&8),compressedMethod:h.get(i,10),compressedSize:x.get(i,20),uncompressedSize:x.get(i,24),filenameLength:h.get(i,28),extraFieldLength:h.get(i,30),fileCommentLength:h.get(i,32),relativeOffsetOfLocalHeader:x.get(i,42),filename:null}},len:46};function pt(i){let e=new Uint8Array(x.len);return x.put(e,0,i),e}var D=(0,ft.default)("tokenizer:inflate"),ve=256*1024,xi=pt(W.DataDescriptor),le=pt(W.EndOfCentralDirectory),G=class i{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(ve)}async isZip(){return await this.peekSignature()===W.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(x)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,t=Math.min(16*1024,e.fileInfo.size),r=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(r,{position:e.fileInfo.size-t});for(let n=r.length-4;n>=0;n--)if(r[n]===le[0]&&r[n+1]===le[1]&&r[n+2]===le[2]&&r[n+3]===le[3])return e.fileInfo.size-t+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){D("Cannot reading central-directory without random-read support");return}D("Reading central-directory...");let e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){D("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(at,t),n=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let o=0;o<r.nrOfEntriesOfSize;++o){let s=await this.tokenizer.readToken(ct);if(s.signature!==W.CentralFileHeader)throw new Error("Expected Central-File-Header signature");s.filename=await this.tokenizer.readToken(new S(s.filenameLength,"utf-8")),await this.tokenizer.ignore(s.extraFieldLength),await this.tokenizer.ignore(s.fileCommentLength),n.push(s),D(`Add central-directory file-entry: n=${o+1}/${n.length}: filename=${n[o].filename}`)}return this.tokenizer.setPosition(e),n}this.tokenizer.setPosition(e)}async unzip(e){let t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let r=!1;do{let n=await this.readLocalFileHeader();if(!n)break;let o=e(n);r=!!o.stop;let s;if(await this.tokenizer.ignore(n.extraFieldLength),n.dataDescriptor&&n.compressedSize===0){let a=[],m=ve;D("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let f=-1;for(;f<0&&m===ve;){m=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),f=hi(this.syncBuffer.subarray(0,m),xi);let c=f>=0?f:m;if(o.handler){let p=new Uint8Array(c);await this.tokenizer.readBuffer(p),a.push(p)}else await this.tokenizer.ignore(c)}D(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),o.handler&&await this.inflate(n,gi(a),o.handler)}else o.handler?(D(`Reading compressed-file-data: ${n.compressedSize} bytes`),s=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(s),await this.inflate(n,s,o.handler)):(D(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(D(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(Te)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Te.len}`)}while(!r)}async iterateOverCentralDirectory(e,t){for(let r of e){let n=t(r);if(n.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let o=await this.readLocalFileHeader();if(o){await this.tokenizer.ignore(o.extraFieldLength);let s=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(s),await this.inflate(o,s,n.handler)}}if(n.stop)break}}async inflate(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);D(`Decompress filename=${e.filename}, compressed-size=${t.length}`);let n=await i.decompressDeflateRaw(t);return r(n)}static async decompressDeflateRaw(e){let t=new ReadableStream({start(o){o.enqueue(e),o.close()}}),r=new DecompressionStream("deflate-raw"),n=t.pipeThrough(r);try{let s=await new Response(n).arrayBuffer();return new Uint8Array(s)}catch(o){let s=o instanceof Error?`Failed to deflate ZIP entry: ${o.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(s)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(x);if(e===W.LocalFileHeader){let t=await this.tokenizer.readToken(st);return t.filename=await this.tokenizer.readToken(new S(t.filenameLength,"utf-8")),t}if(e===W.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function hi(i,e){let t=i.length,r=e.length;if(r>t)return-1;for(let n=0;n<=t-r;n++){let o=!0;for(let s=0;s<r;s++)if(i[n+s]!==e[s]){o=!1;break}if(o)return n}return-1}function gi(i){let e=i.reduce((n,o)=>n+o.length,0),t=new Uint8Array(e),r=0;for(let n of i)t.set(n,r),r+=n.length;return t}var Y=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let r=new Uint8Array(1024),n=await e.readBuffer(r,{mayBeLess:!0});if(n===0){t.close();return}t.enqueue(r.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}};var Cn={utf8:new globalThis.TextDecoder("utf8")};var Sn=new globalThis.TextEncoder;var Fn=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function Ae(i){let{byteLength:e}=i;if(e===6)return i.getUint16(0)*2**32+i.getUint32(2);if(e===5)return i.getUint8(0)*2**32+i.getUint32(1);if(e===4)return i.getUint32(0);if(e===3)return i.getUint8(0)*2**16+i.getUint16(1);if(e===2)return i.getUint16(0);if(e===1)return i.getUint8(0)}function mt(i,e){if(e==="utf-16le"){let t=[];for(let r=0;r<i.length;r++){let n=i.charCodeAt(r);t.push(n&255,n>>8&255)}return t}if(e==="utf-16be"){let t=[];for(let r=0;r<i.length;r++){let n=i.charCodeAt(r);t.push(n>>8&255,n&255)}return t}return[...i].map(t=>t.charCodeAt(0))}function ut(i,e=0){let t=Number.parseInt(new S(6).get(i,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(t))return!1;let r=256;for(let n=e;n<e+148;n++)r+=i[n];for(let n=e+156;n<e+512;n++)r+=i[n];return t===r}var lt={get:(i,e)=>i[e+3]&127|i[e+2]<<7|i[e+1]<<14|i[e]<<21,len:4};var dt=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],xt=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"];var K=4100,wi=K-2,z=1024*1024,ht=1024,yi=2**31-1,v=16*1024*1024,xe=z,gt=z,ki=v,bi=1,wt=100,Ie=v,yt=64,kt=xe,Ci=256,Si=512,Fi=v,Ei=512,Ti=512,bt=256,Ct=xe,St=xe,vi=xe,Ft=v,Ai=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),Ii=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],Bi=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),M=class extends Error{};function Di(i){let e=i?.streamReader;if(e?.constructor?.name!=="WebStreamByobReader")return i;let{reader:t}=e,r=async()=>{await t.cancel(),t.releaseLock()};return e.close=r,e.abort=async()=>{e.interrupted=!0,await r()},i}function Oe(i,e,t){if(!Number.isFinite(i)||i<0||i>e)throw new M(`${t} has invalid size ${i} (maximum ${e} bytes)`);return i}async function R(i,e,{maximumLength:t=v,reason:r="skip"}={}){let n=Oe(e,t,r);await i.ignore(n)}async function Be(i,e,t,{maximumLength:r=e.length,reason:n="read"}={}){let o=t?.length??e.length,s=Oe(o,r,n);return i.readBuffer(e,{...t,length:s})}async function Oi(i,{maximumLength:e=z}={}){let n=new ReadableStream({start(f){f.enqueue(i),f.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),o=[],s=0;try{for(;;){let{done:f,value:c}=await n.read();if(f)break;if(s+=c.length,s>e)throw await n.cancel(),new Error(`ZIP entry decompressed data exceeds ${e} bytes`);o.push(c)}}finally{n.releaseLock()}let a=new Uint8Array(s),m=0;for(let f of o)a.set(f,m),m+=f.length;return a}var At=134695760,de=16,zi=de-1;function Mi(i,e){if(i.length<de)return-1;let t=i.length-de;for(let r=0;r<=t;r++)if(x.get(i,r)===At&&x.get(i,r+8)===e+r)return r;return-1}function Li(i){return(i.codePointAt(0)&32)!==0}function Ui(i,e){let t=new Uint8Array(e),r=0;for(let n of i)t.set(n,r),r+=n.length;return t}async function Ri(i,{shouldBuffer:e,maximumLength:t=z}={}){let{syncBuffer:r}=i,{length:n}=r,o=[],s=0;for(;;){let a=await i.tokenizer.peekBuffer(r,{mayBeLess:!0}),m=Mi(r.subarray(0,a),s),f=m>=0?0:a===n?Math.min(zi,a-1):0,c=m>=0?m:a-f;if(c===0)break;if(s+=c,s>t)throw new Error(`ZIP entry compressed data exceeds ${t} bytes`);if(e){let p=new Uint8Array(c);await i.tokenizer.readBuffer(p),o.push(p)}else await i.tokenizer.ignore(c);if(m>=0)break}if(b(i.tokenizer)||(i.knownSizeDescriptorScannedBytes+=s),!!e)return Ui(o,s)}function Pi(i,e){return b(i.tokenizer)?Math.max(0,v-(i.tokenizer.position-e)):Math.max(0,z-i.knownSizeDescriptorScannedBytes)}async function Ni(i,e,{shouldBuffer:t,maximumDescriptorLength:r=z}={}){if(e.dataDescriptor&&e.compressedSize===0)return Ri(i,{shouldBuffer:t,maximumLength:r});if(!t){await R(i.tokenizer,e.compressedSize,{maximumLength:b(i.tokenizer)?z:i.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let n=Zi(i.tokenizer);if(!Number.isFinite(e.compressedSize)||e.compressedSize<0||e.compressedSize>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);let o=new Uint8Array(e.compressedSize);return await i.tokenizer.readBuffer(o),o}G.prototype.inflate=async function(i,e,t){if(i.compressedMethod===0)return t(e);if(i.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${i.compressedMethod}`);let r=await Oi(e,{maximumLength:z});return t(r)};G.prototype.unzip=async function(i){let e=!1,t=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(ee(this.tokenizer,r,v))throw new M(`ZIP stream probing exceeds ${v} bytes`);let n=await this.readLocalFileHeader();if(!n)break;if(t++,t>ht)throw new Error(`ZIP entry count exceeds ${ht}`);let o=i(n);e=!!o.stop,await this.tokenizer.ignore(n.extraFieldLength);let s=await Ni(this,n,{shouldBuffer:!!o.handler,maximumDescriptorLength:Math.min(z,Pi(this,r))});if(o.handler&&await this.inflate(n,s,o.handler),n.dataDescriptor){let a=new Uint8Array(de);if(await this.tokenizer.readBuffer(a),x.get(a,0)!==At)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-a.length}`)}if(ee(this.tokenizer,r,v))throw new M(`ZIP stream probing exceeds ${v} bytes`)}while(!e)};function ji(i,e){let t=i.getReader(),r=0,n=!1,o=!1,s=async a=>{n||o||(o=!0,await t.cancel(a))};return new ReadableStream({async pull(a){if(r>=e){a.close(),await s();return}let{done:m,value:f}=await t.read();if(m||!f){n=!0,a.close();return}let c=e-r;if(f.length>c){a.enqueue(f.subarray(0,c)),r+=c,a.close(),await s();return}a.enqueue(f),r+=f.length},async cancel(a){await s(a)}})}async function ze(i,e){return new De(e).fromBuffer(i)}function Et(i){switch(i=i.toLowerCase(),i){case"application/epub+zip":return{ext:"epub",mime:i};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:i};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:i};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:i};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:i};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:i};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:i};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:i};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:i};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:i};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:i};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:i};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:i};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:i};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:i};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:i};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function O(i,e,t){t={offset:0,...t};for(let[r,n]of e.entries())if(t.mask){if(n!==(t.mask[r]&i[r+t.offset]))return!1}else if(n!==i[r+t.offset])return!1;return!0}function _i(i){return Number.isFinite(i)?Math.max(1,Math.trunc(i)):K}function $i(i,e,t){return t===void 0?i.read(e):(t.throwIfAborted(),new Promise((r,n)=>{let o=()=>{t.removeEventListener("abort",s)},s=()=>{let a=t.reason;o(),(async()=>{try{await i.cancel(a)}catch{}})(),n(a)};t.addEventListener("abort",s,{once:!0}),(async()=>{try{let a=await i.read(e);o(),r(a)}catch(a){o(),n(a)}})()}))}function Wi(i){return Number.isFinite(i)?Math.max(0,Math.min(wi,Math.trunc(i))):0}function Gi(i){return Number.isFinite(i)?Math.max(0,i):Number.MAX_SAFE_INTEGER}function b(i){let e=i.fileInfo.size;return!Number.isFinite(e)||e===Number.MAX_SAFE_INTEGER}function ee(i,e,t){return b(i)&&i.position-e>t}function Zi(i){let e=i.fileInfo.size,t=Number.isFinite(e)?Math.max(0,e-i.position):Number.MAX_SAFE_INTEGER;return Math.min(t,yi)}function Vi(i){if(i instanceof l||i instanceof M)return!0;if(!(i instanceof Error))return!1;if(Ai.has(i.message)||Bi.has(i.code))return!0;for(let e of Ii)if(i.message.startsWith(e))return!0;return!1}function Tt(i,e=z){let t=[i.compressedSize,i.uncompressedSize];for(let r of t)if(!Number.isFinite(r)||r<0||r>e)return!1;return!0}function qi(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function Hi(i,e){e.startsWith("word/")&&(i.hasWordDirectory=!0),e.startsWith("ppt/")&&(i.hasPresentationDirectory=!0),e.startsWith("xl/")&&(i.hasSpreadsheetDirectory=!0),e.startsWith("3D/")&&e.endsWith(".model")&&(i.hasThreeDimensionalModelEntry=!0)}function vt(i){if(!(!i.hasContentTypesEntry||i.hasUnparseableContentTypes||i.isParsingContentTypes||i.hasParsedContentTypesEntry)){if(i.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(i.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(i.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(i.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function Ji(i){let e=i.indexOf('.main+xml"');if(e===-1){let n="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return i.includes(`ContentType="${n}"`)?n:void 0}let t=i.slice(0,e),r=t.lastIndexOf('"');return t.slice(r+1)}var De=class i{constructor(e){let t=Wi(e?.mpegOffsetTolerance);this.options={...e,mpegOffsetTolerance:t},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(e){return Di(Pe(e,this.getTokenizerOptions()))}async parseTokenizer(e,t=0){this.detectionReentryCount=t;let r=e.position;for(let n of this.detectors){let o;try{o=await n.detect(e)}catch(s){if(s instanceof l||s instanceof M)return;throw s}if(o)return o;if(r!==e.position)return}}async fromTokenizer(e){try{return await this.parseTokenizer(e)}finally{await e.close()}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t?.length>1)return this.fromTokenizer(Ne(t,this.getTokenizerOptions()))}async fromBlob(e){this.options.signal?.throwIfAborted();let t=je(e,this.getTokenizerOptions());return this.fromTokenizer(t)}async fromStream(e){this.options.signal?.throwIfAborted();let t=this.createTokenizerFromWebStream(e);return this.fromTokenizer(t)}async toDetectionStream(e,t){let r=_i(t?.sampleSize??K),n,o,s=e.getReader({mode:"byob"});try{let{value:f,done:c}=await $i(s,new Uint8Array(r),this.options.signal);if(o=f,!c&&f)try{n=await this.fromBuffer(f.subarray(0,r))}catch(p){if(!(p instanceof l))throw p;n=void 0}o=f}finally{s.releaseLock()}let a=new TransformStream({async start(f){f.enqueue(o)},transform(f,c){c.enqueue(f)}}),m=e.pipeThrough(a);return m.fileType=n,m}async detectGzip(e){if(this.gzipProbeDepth>=bi)return{ext:"gz",mime:"application/gzip"};let t=new Y(e),r=ji(t.inflate(),ki),n=b(e),o,s,a,m;if(n){let f=new AbortController;o=setTimeout(()=>{f.abort(new DOMException(`Operation timed out after ${wt} ms`,"TimeoutError"))},wt),s=this.options.signal===void 0?f.signal:AbortSignal.any([this.options.signal,f.signal]),a=new i({...this.options,signal:s}),a.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{m=await(a??this).fromStream(r)}catch(f){if(f?.name==="AbortError"&&s?.reason?.name!=="TimeoutError")throw f}finally{clearTimeout(o),n||this.gzipProbeDepth--}return m?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(e,t){return O(this.buffer,e,t)}checkString(e,t){return this.check(mt(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(K),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,b(e)&&(await e.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(e);if(await e.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=bt?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(e));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(e);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await R(e,6,{maximumLength:6,reason:"ID3 header prefix"});let t=await e.readToken(lt),r=b(e);if(!Number.isFinite(t)||t<0||r&&(t>Ie||e.position+t>Ie))return;if(e.position+t>e.fileInfo.size)return r?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await R(e,t,{maximumLength:r?Ie:e.fileInfo.size,reason:"ID3 payload"})}catch(n){if(n instanceof l)return;throw n}return this.detectionReentryCount>=bt?void 0:(this.detectionReentryCount++,this.parseTokenizer(e,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let t,r=qi();try{await new G(e).unzip(n=>{Hi(r,n.filename);let o=n.filename==="[Content_Types].xml",s=vt(r);if(!o&&s)return t=s,{stop:!0};switch(n.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Tt(n,gt)?{async handler(a){let m=new TextDecoder("utf-8").decode(a).trim();t=Et(m)},stop:!0}:{};case"[Content_Types].xml":return r.hasContentTypesEntry=!0,Tt(n,gt)?(r.isParsingContentTypes=!0,{async handler(a){let m=new TextDecoder("utf-8").decode(a),f=Ji(m);f&&(t=Et(f)),r.hasParsedContentTypesEntry=!0,r.isParsingContentTypes=!1},stop:!0}):(r.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(n.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(n){if(!Vi(n))throw n;r.isParsingContentTypes&&(r.isParsingContentTypes=!1,r.hasUnparseableContentTypes=!0)}return t??vt(r)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),O(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:O(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:O(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:O(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:O(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:O(t,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){let t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){let m=await e.peekNumber(Ze),f=128,c=0;for(;(m&f)===0&&f!==0;)++c,f>>=1;let p=new Uint8Array(c+1);return await Be(e,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function r(){let m=await t(),f=await t();f[0]^=128>>f.length-1;let c=Math.min(6,f.length),p=new DataView(m.buffer),u=new DataView(f.buffer,f.length-c,c);return{id:Ae(p),len:Ae(u)}}async function n(m){let f=0;for(;m>0;){if(f++,f>Ci||ee(e,s,v))return;let c=e.position,p=await r();if(p.id===17026){if(p.len>yt)return;let u=Oe(p.len,yt,"EBML DocType");return(await e.readToken(new S(u))).replaceAll(/\00.*$/g,"")}if(b(e)&&(!Number.isFinite(p.len)||p.len<0||p.len>kt)||(await R(e,p.len,{maximumLength:b(e)?kt:e.fileInfo.size,reason:"EBML payload"}),--m,e.position<=c))return}}let o=await r(),s=e.position;switch(await n(o.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let t=be.get(this.buffer,4),r=_.get(this.buffer,6);if(t>0&&t<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(r>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let t=new S(4,"latin1").get(this.buffer,2);if(t.match("^d*")&&t>=1e3&&t<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new S(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
7
|
+
`,"\r"," "," ","\0"].some(t=>this.checkString(t,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){let t={ext:"png",mime:"image/png"},r={ext:"apng",mime:"image/apng"};await e.ignore(8);async function n(){return{length:await e.readToken(Ve),type:await e.readToken(new S(4,"latin1"))}}let o=b(e),s=e.position,a=0,m=!1;do{if(a++,a>Si||ee(e,s,Fi))break;let f=e.position,c=await n();if(c.length<0)return;if(c.type==="IHDR"){if(c.length!==13)return;m=!0}switch(c.type){case"IDAT":return t;case"acTL":return r;default:if(!m&&c.type!=="CgBI")return;if(o&&c.length>Ct)return m&&Li(c.type)?t:void 0;try{await R(e,c.length+4,{maximumLength:o?Ct+4:e.fileInfo.size,reason:"PNG chunk payload"})}catch(p){if(!o&&(p instanceof M||p instanceof l))return t;throw p}}if(e.position<=f)break}while(e.position+8<e.fileInfo.size);return t}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let t=new S(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(t){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return t.startsWith("3g")?t.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
8
|
+
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let t=!1;try{async function r(){let a=new Uint8Array(16);return await Be(e,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await e.readToken(qe))}}await R(e,30,{maximumLength:30,reason:"ASF header prelude"});let n=b(e),o=e.position,s=0;for(;e.position+24<e.fileInfo.size&&(s++,!(s>Ei||ee(e,o,v)));){let a=e.position,m=await r(),f=m.size-24;if(!Number.isFinite(f)||f<0){t=!0;break}if(O(m.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let c=new Uint8Array(16);if(f-=await Be(e,c,void 0,{maximumLength:c.length,reason:"ASF stream type GUID"}),O(c,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(O(c,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(n&&f>St){t=!0;break}if(await R(e,f,{maximumLength:n?St:e.fileInfo.size,reason:"ASF header payload"}),e.position<=a){t=!0;break}}}catch(r){if(r instanceof l||r instanceof M)b(e)&&(t=!0);else throw r}return t?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new S(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let t=new DataView(this.buffer.buffer).getUint32(12,!0);if(t>12&&this.buffer.length>=t+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,t+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&ut(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let t="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:t})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:t})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
|
|
9
|
+
`,{offset:2,encoding:t})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async e=>{this.buffer=new Uint8Array(K);let t=Gi(e.fileInfo.size);if(await e.peekBuffer(this.buffer,{length:Math.min(8,t),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,t),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let r=0;r<=this.options.mpegOffsetTolerance;++r){let n=this.scanMpeg(r);if(n)return n}};async readTiffTag(e){let t=await this.tokenizer.readToken(e?_:h);switch(await this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let t=await this.tokenizer.readToken(e?_:h);if(!(t>Ti)&&!(b(this.tokenizer)&&2+t*12>Ft))for(let r=0;r<t;++r){let n=await this.readTiffTag(e);if(n)return n}}async readTiffHeader(e){let t={ext:"tif",mime:"image/tiff"},r=(e?_:h).get(this.buffer,2),n=(e?be:x).get(this.buffer,4);if(r===42){if(n>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){let a=(e?_:h).get(this.buffer,8),m=(e?_:h).get(this.buffer,10);if(a===28&&m===254||a===31&&m===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(b(this.tokenizer)&&n>vi)return t;let o=b(this.tokenizer)?Ft:this.tokenizer.fileInfo.size;try{await R(this.tokenizer,n,{maximumLength:o,reason:"TIFF IFD offset"})}catch(a){if(a instanceof l)return;throw a}let s;try{s=await this.readTiffIFD(e)}catch(a){if(a instanceof l)return;throw a}return s??t}if(r===43)return t}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:e+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},Xi=new Set(dt),Qi=new Set(xt);var Yi={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},Ki=new Map([[".js",{description:"JavaScript source",mime:"text/javascript"}],[".mjs",{description:"JavaScript module",mime:"text/javascript"}],[".cjs",{description:"CommonJS module",mime:"text/javascript"}],[".ts",{description:"TypeScript source",mime:"text/typescript"}],[".tsx",{description:"TypeScript JSX source",mime:"text/typescript"}],[".jsx",{description:"JavaScript JSX source",mime:"text/javascript"}],[".py",{description:"Python script",mime:"text/x-python"}],[".rb",{description:"Ruby script",mime:"text/x-ruby"}],[".go",{description:"Go source",mime:"text/x-go"}],[".rs",{description:"Rust source",mime:"text/x-rust"}],[".c",{description:"C source",mime:"text/x-c"}],[".h",{description:"C header",mime:"text/x-c"}],[".cpp",{description:"C++ source",mime:"text/x-c++"}],[".hpp",{description:"C++ header",mime:"text/x-c++"}],[".java",{description:"Java source",mime:"text/x-java"}],[".sh",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".bash",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".zsh",{description:"Zsh shell script",mime:"text/x-shellscript"}],[".json",{description:"JSON data",mime:"application/json"}],[".yaml",{description:"YAML data",mime:"text/yaml"}],[".yml",{description:"YAML data",mime:"text/yaml"}],[".xml",{description:"XML document",mime:"application/xml"}],[".csv",{description:"CSV text",mime:"text/csv"}],[".toml",{description:"TOML data",mime:"text/toml"}],[".html",{description:"HTML document",mime:"text/html"}],[".htm",{description:"HTML document",mime:"text/html"}],[".css",{description:"CSS stylesheet",mime:"text/css"}],[".svg",{description:"SVG image",mime:"image/svg+xml"}],[".md",{description:"Markdown document",mime:"text/markdown"}],[".markdown",{description:"Markdown document",mime:"text/markdown"}],[".txt",{description:"ASCII text",mime:"text/plain"}],[".rst",{description:"reStructuredText",mime:"text/x-rst"}],[".env",{description:"ASCII text",mime:"text/plain"}],[".gitignore",{description:"ASCII text",mime:"text/plain"}],[".dockerignore",{description:"ASCII text",mime:"text/plain"}]]),er=new Map([["jpg","JPEG image data"],["jpeg","JPEG image data"],["png","PNG image data"],["gif","GIF image data"],["webp","WebP image data"],["bmp","PC bitmap"],["ico","MS Windows icon resource"],["tif","TIFF image data"],["tiff","TIFF image data"],["psd","Adobe Photoshop Document"],["avif","AVIF image"],["heic","HEIC image"],["heif","HEIF image"],["jxl","JPEG XL image"],["icns","Mac OS X icon"],["svg","SVG Scalable Vector Graphics image"],["pdf","PDF document"],["epub","EPUB document"],["mobi","Mobipocket E-book"],["djvu","DjVu document"],["zip","Zip archive data"],["gz","gzip compressed data"],["gzip","gzip compressed data"],["bz2","bzip2 compressed data"],["xz","XZ compressed data"],["tar","POSIX tar archive"],["rar","RAR archive data"],["7z","7-zip archive data"],["lz","lzip compressed data"],["lzma","LZMA compressed data"],["zst","Zstandard compressed data"],["cab","Microsoft Cabinet archive"],["ar","Unix ar archive"],["rpm","RPM package"],["deb","Debian binary package"],["apk","Android Package"],["dmg","Apple disk image"],["iso","ISO 9660 CD-ROM filesystem data"],["vhd","Microsoft Virtual Hard Disk"],["vhdx","Microsoft Virtual Hard Disk (new format)"],["qcow2","QEMU QCOW Image"],["mp3","Audio file with ID3"],["m4a","MPEG-4 audio"],["aac","AAC audio"],["wav","RIFF (little-endian) data, WAVE audio"],["flac","FLAC audio bitstream data"],["ogg","Ogg data"],["oga","Ogg audio"],["opus","Ogg Opus audio"],["aiff","AIFF audio"],["wma","Windows Media Audio"],["amr","AMR audio"],["mid","MIDI audio"],["midi","MIDI audio"],["ape","Monkey's Audio"],["mp4","ISO Media, MPEG-4"],["m4v","MPEG-4 video"],["webm","WebM"],["avi","RIFF (little-endian) data, AVI"],["mov","ISO Media, Apple QuickTime movie"],["mkv","Matroska data"],["wmv","Windows Media Video"],["flv","Flash Video"],["3gp","3GPP multimedia"],["3g2","3GPP2 multimedia"],["ogv","Ogg video"],["mts","MPEG transport stream"],["m2ts","MPEG transport stream"],["ts","MPEG transport stream"],["mpg","MPEG video"],["mpeg","MPEG video"],["exe","PE32 executable"],["dll","PE32 DLL"],["elf","ELF executable"],["mach","Mach-O executable"],["wasm","WebAssembly (wasm) binary module"],["dex","Android Dalvik executable"],["class","Java class file"],["swf","Adobe Flash"],["doc","Microsoft Word Document"],["docx","Microsoft Word 2007+ Document"],["xls","Microsoft Excel Spreadsheet"],["xlsx","Microsoft Excel 2007+ Spreadsheet"],["ppt","Microsoft PowerPoint Presentation"],["pptx","Microsoft PowerPoint 2007+ Presentation"],["odt","OpenDocument Text"],["ods","OpenDocument Spreadsheet"],["odp","OpenDocument Presentation"],["ttf","TrueType Font"],["otf","OpenType Font"],["woff","Web Open Font Format"],["woff2","Web Open Font Format 2"],["eot","Embedded OpenType font"],["stl","Stereolithography CAD"],["obj","Wavefront 3D Object"],["gltf","GL Transmission Format"],["glb","GL Transmission Format (binary)"],["sqlite","SQLite 3.x database"],["mdb","Microsoft Access Database"],["xml","XML document"],["json","JSON data"],["macho","Mach-O binary"],["ics","iCalendar data"],["vcf","vCard data"],["msi","Microsoft Installer"],["ps","PostScript"],["ai","Adobe Illustrator"],["indd","Adobe InDesign"],["sketch","Sketch design file"],["fig","Figma design file"],["xd","Adobe XD"],["blend","Blender"],["fbx","Autodesk FBX"],["lnk","MS Windows shortcut"],["alias","Mac OS alias"],["torrent","BitTorrent file"],["pcap","pcap capture file"],["arrow","Apache Arrow"],["parquet","Apache Parquet"]]);function tr(i,e){let t=er.get(i);if(t)return t;let[r,n]=e.split("/"),o=n?.split("+")[0]?.replace(/-/g," ")||i;switch(r){case"image":return`${o.toUpperCase()} image data`;case"audio":return`${o.toUpperCase()} audio`;case"video":return`${o.toUpperCase()} video`;case"font":return`${o} font`;case"model":return`${o} 3D model`;case"application":return n?.includes("zip")||n?.includes("compressed")?`${o} archive data`:n?.includes("executable")?`${o} executable`:`${i.toUpperCase()} data`;default:return`${i.toUpperCase()} data`}}function ir(i){let e=i.split("/").pop()||i;if(e.startsWith(".")&&!e.includes(".",1))return e;let t=e.lastIndexOf(".");return t===-1||t===0?"":e.slice(t).toLowerCase()}function rr(i,e){if(i.startsWith("#!")){let f=i.split(`
|
|
10
|
+
`)[0];return f.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:f.includes("node")||f.includes("bun")||f.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:f.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:f.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:f.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:f.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let t=i.trimStart();if(t.startsWith("<?xml"))return{description:"XML document",mime:"application/xml"};if(t.startsWith("<!DOCTYPE html")||t.toLowerCase().startsWith("<html"))return{description:"HTML document",mime:"text/html"};let r=i.includes(`\r
|
|
11
|
+
`),n=i.includes("\r")&&!r,o="";r?o=", with CRLF line terminators":n&&(o=", with CR line terminators");let s=ir(e),a=s?Ki.get(s):void 0;if(a)return a.mime.startsWith("text/")&&o?{description:`${a.description}${o}`,mime:a.mime}:a;let m=!1;for(let f=0;f<Math.min(i.length,8192);f++)if(i.charCodeAt(f)>127){m=!0;break}return m?{description:`UTF-8 Unicode text${o}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${o}`,mime:"text/plain"}}async function nr(i,e){if(e.length===0)return{description:"empty",mime:"inode/x-empty"};let t=await ze(e);if(t)return{description:tr(t.ext,t.mime),mime:t.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(e);return rr(r,i)}var _n={name:"file",async execute(i,e){if(Re(i))return Ue(Yi);let t=!1,r=!1,n=[];for(let a of i)if(a.startsWith("--")){if(a==="--brief")t=!0;else if(a==="--mime"||a==="--mime-type")r=!0;else if(a!=="--dereference")return ge("file",a)}else if(a.startsWith("-")&&a!=="-"){for(let m of a.slice(1))if(m==="b")t=!0;else if(m==="i")r=!0;else if(m!=="L")return ge("file",`-${m}`)}else n.push(a);if(n.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
|
|
12
|
+
`,exitCode:1};let o="",s=0;for(let a of n)try{let m=e.fs.resolvePath(e.cwd,a);if((await e.fs.stat(m)).isDirectory){let d=r?"inode/directory":"directory";o+=t?`${d}
|
|
13
|
+
`:`${a}: ${d}
|
|
14
|
+
`;continue}let c=await e.fs.readFileBuffer(m),p=await nr(a,c),u=r?p.mime:p.description;o+=t?`${u}
|
|
15
|
+
`:`${a}: ${u}
|
|
16
|
+
`}catch{o+=t?`cannot open
|
|
17
|
+
`:`${a}: cannot open (No such file or directory)
|
|
18
|
+
`,s=1}return{stdout:o,stderr:"",exitCode:s}}},$n={name:"file",flags:[{flag:"-b",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-L",type:"boolean"}],needsArgs:!0};export{_n as a,$n as b};
|
|
19
|
+
/*! Bundled license information:
|
|
20
|
+
|
|
21
|
+
ieee754/index.js:
|
|
22
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
23
|
+
*/
|