@easbot/gateway 0.1.15 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/chunk-2DDZUOLB.cjs +2 -0
- package/dist/chunks/chunk-5RLC2FW2.mjs +2 -0
- package/dist/chunks/{chunk-CTTZF7B6.cjs → chunk-NJHJCACX.cjs} +1 -1
- package/dist/chunks/{chunk-YAKKDECJ.mjs → chunk-O3U6QY4W.mjs} +1 -1
- package/dist/chunks/chunk-OSZ6KMPF.cjs +1 -0
- package/dist/chunks/chunk-P3MN336E.cjs +8 -0
- package/dist/chunks/chunk-SSKI3TXN.mjs +8 -0
- package/dist/chunks/chunk-UCF5C44I.mjs +1 -0
- package/dist/chunks/{global-K4U25JQK.cjs → global-BCWJXCJA.cjs} +1 -1
- package/dist/chunks/{global-KXPT44QD.mjs → global-C2YB6FKX.mjs} +1 -1
- package/dist/chunks/package-HISKEB3S.cjs +1 -0
- package/dist/chunks/package-VYOXRMBW.mjs +1 -0
- package/dist/chunks/server-5P63VGLE.mjs +1 -0
- package/dist/chunks/server-EFOLB7OJ.cjs +1 -0
- package/dist/cli.cjs +8 -8
- package/dist/cli.mjs +7 -7
- package/dist/index.cjs +8 -8
- package/dist/index.mjs +1 -1
- package/package.json +23 -25
- package/dist/chunks/chunk-BOHNPDOJ.cjs +0 -2
- package/dist/chunks/chunk-EKLLH53Y.cjs +0 -9
- package/dist/chunks/chunk-EOLBEWUW.cjs +0 -1
- package/dist/chunks/chunk-ETYFY7SI.mjs +0 -9
- package/dist/chunks/chunk-J2DSTELL.mjs +0 -1
- package/dist/chunks/chunk-VVZG6LF6.mjs +0 -2
- package/dist/chunks/package-2UGUDLKV.cjs +0 -1
- package/dist/chunks/package-UZJDAOIA.mjs +0 -1
- package/dist/chunks/server-3CBE5XNJ.cjs +0 -1
- package/dist/chunks/server-GVEVKN4C.mjs +0 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-SJNPXLNN.mjs';import {g,e,h,f as f$1,i,j as j$1}from'./chunk-TY6W6O7O.mjs';import is,{win32,posix}from'path';import Mn,{realpath,readlink,readdir,lstat}from'fs/promises';import*as pa from'fs';import {realpathSync,createWriteStream,readlinkSync,readdirSync,readdir as readdir$1,lstatSync,existsSync}from'fs';import f from'zod';import {fileURLToPath}from'url';import {EventEmitter}from'events';import cn from'stream';import {StringDecoder}from'string_decoder';import {initLog,formatLogTime}from'@easbot/utils';a();a();var Hr=(e,t,i)=>{let s=e instanceof RegExp?Xs(e,i):e,n=t instanceof RegExp?Xs(t,i):t,o=s!==null&&n!=null&&Xn(s,n,i);return o&&{start:o[0],end:o[1],pre:i.slice(0,o[0]),body:i.slice(o[0]+s.length,o[1]),post:i.slice(o[1]+n.length)}},Xs=(e,t)=>{let i=t.match(e);return i?i[0]:null},Xn=(e,t,i)=>{let s,n,o,a,h,l=i.indexOf(e),u=i.indexOf(t,l+1),g=l;if(l>=0&&u>0){if(e===t)return [l,u];for(s=[],o=i.length;g>=0&&!h;){if(g===l)s.push(g),l=i.indexOf(e,g+1);else if(s.length===1){let d=s.pop();d!==void 0&&(h=[d,u]);}else n=s.pop(),n!==void 0&&n<o&&(o=n,a=u),u=i.indexOf(t,g+1);g=l<u&&l>=0?l:u;}s.length&&a!==void 0&&(h=[o,a]);}return h},Kr="\0SLASH"+Math.random()+"\0",Qr="\0OPEN"+Math.random()+"\0",Us="\0CLOSE"+Math.random()+"\0",qr="\0COMMA"+Math.random()+"\0",Jr="\0PERIOD"+Math.random()+"\0",to=new RegExp(Kr,"g"),eo=new RegExp(Qr,"g"),io=new RegExp(Us,"g"),so=new RegExp(qr,"g"),ro=new RegExp(Jr,"g"),no=/\\\\/g,oo=/\\{/g,ao=/\\}/g,ho=/\\,/g,lo=/\\./g,co=1e5;function Ss(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function fo(e){return e.replace(no,Kr).replace(oo,Qr).replace(ao,Us).replace(ho,qr).replace(lo,Jr)}function uo(e){return e.replace(to,"\\").replace(eo,"{").replace(io,"}").replace(so,",").replace(ro,".")}function Vr(e){if(!e)return [""];let t=[],i=Hr("{","}",e);if(!i)return e.split(",");let{pre:s,body:n,post:o}=i,a=s.split(",");a[a.length-1]+="{"+n+"}";let h=Vr(o);return o.length&&(a[a.length-1]+=h.shift(),a.push.apply(a,h)),t.push.apply(t,a),t}function po(e,t={}){if(!e)return [];let{max:i=co}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Ye(fo(e),i,true).map(uo)}function go(e){return "{"+e+"}"}function mo(e){return /^-?0\d/.test(e)}function yo(e,t){return e<=t}function wo(e,t){return e>=t}function Ye(e,t,i){let s=[],n=Hr("{","}",e);if(!n)return [e];let o=n.pre,a=n.post.length?Ye(n.post,t,false):[""];if(/\$$/.test(n.pre))for(let h=0;h<a.length&&h<t;h++){let l=o+"{"+n.body+"}"+a[h];s.push(l);}else {let h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),u=h||l,g=n.body.indexOf(",")>=0;if(!u&&!g)return n.post.match(/,(?!,).*\}/)?(e=n.pre+"{"+n.body+Us+n.post,Ye(e,t,true)):[e];let d;if(u)d=n.body.split(/\.\./);else if(d=Vr(n.body),d.length===1&&d[0]!==void 0&&(d=Ye(d[0],t,false).map(go),d.length===1))return a.map(S=>n.pre+d[0]+S);let w;if(u&&d[0]!==void 0&&d[1]!==void 0){let S=Ss(d[0]),x=Ss(d[1]),C=Math.max(d[0].length,d[1].length),E=d.length===3&&d[2]!==void 0?Math.abs(Ss(d[2])):1,v=yo;x<S&&(E*=-1,v=wo);let T=d.some(mo);w=[];for(let F=S;v(F,x);F+=E){let P;if(l)P=String.fromCharCode(F),P==="\\"&&(P="");else if(P=String(F),T){let A=C-P.length;if(A>0){let L=new Array(A+1).join("0");F<0?P="-"+L+P.slice(1):P=L+P;}}w.push(P);}}else {w=[];for(let S=0;S<d.length;S++)w.push.apply(w,Ye(d[S],t,false));}for(let S=0;S<w.length;S++)for(let x=0;x<a.length&&s.length<t;x++){let C=o+w[S]+a[x];(!i||u||C)&&s.push(C);}}return s}var Ji=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},bo={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",true],"[:alpha:]":["\\p{L}\\p{Nl}",true],"[:ascii:]":["\\x00-\\x7f",false],"[:blank:]":["\\p{Zs}\\t",true],"[:cntrl:]":["\\p{Cc}",true],"[:digit:]":["\\p{Nd}",true],"[:graph:]":["\\p{Z}\\p{C}",true,true],"[:lower:]":["\\p{Ll}",true],"[:print:]":["\\p{C}",true],"[:punct:]":["\\p{P}",true],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",true],"[:upper:]":["\\p{Lu}",true],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",true],"[:xdigit:]":["A-Fa-f0-9",false]},Ke=e=>e.replace(/[[\]\\-]/g,"\\$&"),Co=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),tr=e=>e.join(""),So=(e,t)=>{let i=t;if(e.charAt(i)!=="[")throw new Error("not in a brace expression");let s=[],n=[],o=i+1,a=false,h=false,l=false,u=false,g=i,d="";t:for(;o<e.length;){let x=e.charAt(o);if((x==="!"||x==="^")&&o===i+1){u=true,o++;continue}if(x==="]"&&a&&!l){g=o+1;break}if(a=true,x==="\\"&&!l){l=true,o++;continue}if(x==="["&&!l){for(let[C,[E,v,T]]of Object.entries(bo))if(e.startsWith(C,o)){if(d)return ["$.",false,e.length-i,true];o+=C.length,T?n.push(E):s.push(E),h=h||v;continue t}}if(l=false,d){x>d?s.push(Ke(d)+"-"+Ke(x)):x===d&&s.push(Ke(x)),d="",o++;continue}if(e.startsWith("-]",o+1)){s.push(Ke(x+"-")),o+=2;continue}if(e.startsWith("-",o+1)){d=x,o+=2;continue}s.push(Ke(x)),o++;}if(g<o)return ["",false,0,false];if(!s.length&&!n.length)return ["$.",false,e.length-i,true];if(n.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!u){let x=s[0].length===2?s[0].slice(-1):s[0];return [Co(x),false,g-i,false]}let w="["+(u?"^":"")+tr(s)+"]",S="["+(u?"":"^")+tr(n)+"]";return [s.length&&n.length?"("+w+"|"+S+")":s.length?w:S,h,g-i,true]},Pe=(e,{windowsPathsNoEscape:t=false,magicalBraces:i=true}={})=>i?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),vo=new Set(["!","?","+","*","@"]),er=e=>vo.has(e),xo="(?!(?:^|/)\\.\\.?(?:$|/))",Ni="(?!\\.)",Eo=new Set(["[","."]),Ao=new Set(["..","."]),ko=new Set("().*{}+?[]^$\\!"),To=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$s="[^/]",ir=$s+"*?",sr=$s+"+?",z,V,Bt,G,j,se,me,re,Wt,ye,ni,ke,Yr,ce,X,zi,Os,Xr,Zr=(X=class{constructor(t,i,s={}){g(this,ke);e(this,"type");g(this,z);g(this,V);g(this,Bt,false);g(this,G,[]);g(this,j);g(this,se);g(this,me);g(this,re,false);g(this,Wt);g(this,ye);g(this,ni,false);this.type=t,t&&h(this,V,true),h(this,j,i),h(this,z,f$1(this,j)?f$1(f$1(this,j),z):this),h(this,Wt,f$1(this,z)===this?s:f$1(f$1(this,z),Wt)),h(this,me,f$1(this,z)===this?[]:f$1(f$1(this,z),me)),t==="!"&&!f$1(f$1(this,z),re)&&f$1(this,me).push(this),h(this,se,f$1(this,j)?f$1(f$1(this,j),G).length:0);}get hasMagic(){if(f$1(this,V)!==void 0)return f$1(this,V);for(let t of f$1(this,G))if(typeof t!="string"&&(t.type||t.hasMagic))return h(this,V,true);return f$1(this,V)}toString(){return f$1(this,ye)!==void 0?f$1(this,ye):this.type?h(this,ye,this.type+"("+f$1(this,G).map(t=>String(t)).join("|")+")"):h(this,ye,f$1(this,G).map(t=>String(t)).join(""))}push(...t){for(let i of t)if(i!==""){if(typeof i!="string"&&!(i instanceof X&&f$1(i,j)===this))throw new Error("invalid part: "+i);f$1(this,G).push(i);}}toJSON(){let t=this.type===null?f$1(this,G).slice().map(i=>typeof i=="string"?i:i.toJSON()):[this.type,...f$1(this,G).map(i=>i.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===f$1(this,z)||f$1(f$1(this,z),re)&&f$1(this,j)?.type==="!")&&t.push({}),t}isStart(){if(f$1(this,z)===this)return true;if(!f$1(this,j)?.isStart())return false;if(f$1(this,se)===0)return true;let t=f$1(this,j);for(let i=0;i<f$1(this,se);i++){let s=f$1(t,G)[i];if(!(s instanceof X&&s.type==="!"))return false}return true}isEnd(){if(f$1(this,z)===this||f$1(this,j)?.type==="!")return true;if(!f$1(this,j)?.isEnd())return false;if(!this.type)return f$1(this,j)?.isEnd();let t=f$1(this,j)?f$1(f$1(this,j),G).length:0;return f$1(this,se)===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this));}clone(t){let i=new X(this.type,t);for(let s of f$1(this,G))i.copyIn(s);return i}static fromGlob(t,i$1={}){var n;let s=new X(null,void 0,i$1);return i(n=X,ce,zi).call(n,t,s,0,i$1),s}toMMPattern(){if(this!==f$1(this,z))return f$1(this,z).toMMPattern();let t=this.toString(),[i,s,n,o]=this.toRegExpSource();if(!(n||f$1(this,V)||f$1(this,Wt).nocase&&!f$1(this,Wt).nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let a=(f$1(this,Wt).nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${i}$`,a),{_src:i,_glob:t})}get options(){return f$1(this,Wt)}toRegExpSource(t){let i$1=t??!!f$1(this,Wt).dot;if(f$1(this,z)===this&&i(this,ke,Yr).call(this),!this.type){let l=this.isStart()&&this.isEnd()&&!f$1(this,G).some(w=>typeof w!="string"),u=f$1(this,G).map(w=>{var v;let[S,x,C,E]=typeof w=="string"?i(v=X,ce,Xr).call(v,w,f$1(this,V),l):w.toRegExpSource(t);return h(this,V,f$1(this,V)||C),h(this,Bt,f$1(this,Bt)||E),S}).join(""),g="";if(this.isStart()&&typeof f$1(this,G)[0]=="string"&&!(f$1(this,G).length===1&&Ao.has(f$1(this,G)[0]))){let w=Eo,S=i$1&&w.has(u.charAt(0))||u.startsWith("\\.")&&w.has(u.charAt(2))||u.startsWith("\\.\\.")&&w.has(u.charAt(4)),x=!i$1&&!t&&w.has(u.charAt(0));g=S?xo:x?Ni:"";}let d="";return this.isEnd()&&f$1(f$1(this,z),re)&&f$1(this,j)?.type==="!"&&(d="(?:$|\\/)"),[g+u+d,Pe(u),h(this,V,!!f$1(this,V)),f$1(this,Bt)]}let s=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",o=i(this,ke,Os).call(this,i$1);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return h(this,G,[l]),this.type=null,h(this,V,void 0),[l,Pe(this.toString()),false,false]}let a=!s||t||i$1||!Ni?"":i(this,ke,Os).call(this,true);a===o&&(a=""),a&&(o=`(?:${o})(?:${a})*?`);let h$1="";if(this.type==="!"&&f$1(this,ni))h$1=(this.isStart()&&!i$1?Ni:"")+sr;else {let l=this.type==="!"?"))"+(this.isStart()&&!i$1&&!t?Ni:"")+ir+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;h$1=n+o+l;}return [h$1,Pe(o),h(this,V,!!f$1(this,V)),f$1(this,Bt)]}},z=new WeakMap,V=new WeakMap,Bt=new WeakMap,G=new WeakMap,j=new WeakMap,se=new WeakMap,me=new WeakMap,re=new WeakMap,Wt=new WeakMap,ye=new WeakMap,ni=new WeakMap,ke=new WeakSet,Yr=function(){if(this!==f$1(this,z))throw new Error("should only call on root");if(f$1(this,re))return this;this.toString(),h(this,re,true);let t;for(;t=f$1(this,me).pop();){if(t.type!=="!")continue;let i=t,s=f$1(i,j);for(;s;){for(let n=f$1(i,se)+1;!s.type&&n<f$1(s,G).length;n++)for(let o of f$1(t,G)){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(f$1(s,G)[n]);}i=s,s=f$1(i,j);}}return this},ce=new WeakSet,zi=function(t,i$1,s,n){var S,x;let o=false,a=false,h$1=-1,l=false;if(i$1.type===null){let C=s,E="";for(;C<t.length;){let v=t.charAt(C++);if(o||v==="\\"){o=!o,E+=v;continue}if(a){C===h$1+1?(v==="^"||v==="!")&&(l=true):v==="]"&&!(C===h$1+2&&l)&&(a=false),E+=v;continue}else if(v==="["){a=true,h$1=C,l=false,E+=v;continue}if(!n.noext&&er(v)&&t.charAt(C)==="("){i$1.push(E),E="";let T=new X(v,i$1);C=i(S=X,ce,zi).call(S,t,T,C,n),i$1.push(T);continue}E+=v;}return i$1.push(E),C}let u=s+1,g=new X(null,i$1),d=[],w="";for(;u<t.length;){let C=t.charAt(u++);if(o||C==="\\"){o=!o,w+=C;continue}if(a){u===h$1+1?(C==="^"||C==="!")&&(l=true):C==="]"&&!(u===h$1+2&&l)&&(a=false),w+=C;continue}else if(C==="["){a=true,h$1=u,l=false,w+=C;continue}if(er(C)&&t.charAt(u)==="("){g.push(w),w="";let E=new X(C,g);g.push(E),u=i(x=X,ce,zi).call(x,t,E,u,n);continue}if(C==="|"){g.push(w),w="",d.push(g),g=new X(null,i$1);continue}if(C===")")return w===""&&f$1(i$1,G).length===0&&h(i$1,ni,true),g.push(w),w="",i$1.push(...d,g),u;w+=C;}return i$1.type=null,h(i$1,V,void 0),h(i$1,G,[t.substring(s-1)]),u},Os=function(t){return f$1(this,G).map(i=>{if(typeof i=="string")throw new Error("string type in extglob ast??");let[s,n,o,a]=i.toRegExpSource(t);return h(this,Bt,f$1(this,Bt)||a),s}).filter(i=>!(this.isStart()&&this.isEnd())||!!i).join("|")},Xr=function(t,i,s=false){let n=false,o="",a=false,h=false;for(let l=0;l<t.length;l++){let u=t.charAt(l);if(n){n=false,o+=(ko.has(u)?"\\":"")+u;continue}if(u==="*"){if(h)continue;h=true,o+=s&&/^[*]+$/.test(t)?sr:ir,i=true;continue}else h=false;if(u==="\\"){l===t.length-1?o+="\\\\":n=true;continue}if(u==="["){let[g,d,w,S]=So(t,l);if(w){o+=g,a=a||d,l+=w-1,i=i||S;continue}}if(u==="?"){o+=$s,i=true;continue}o+=To(u);}return [o,Pe(t),!!i,a]},g(X,ce),X),tn=(e,{windowsPathsNoEscape:t=false,magicalBraces:i=false}={})=>i?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),at=(e,t,i={})=>(Ji(t),!i.nocomment&&t.charAt(0)==="#"?false:new fe(t,i).match(e)),Ro=/^\*+([^+@!?\*\[\(]*)$/,Oo=e=>t=>!t.startsWith(".")&&t.endsWith(e),Fo=e=>t=>t.endsWith(e),Po=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Lo=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),No=/^\*+\.\*+$/,Go=e=>!e.startsWith(".")&&e.includes("."),Do=e=>e!=="."&&e!==".."&&e.includes("."),Wo=/^\.\*+$/,Mo=e=>e!=="."&&e!==".."&&e.startsWith("."),_o=/^\*+$/,jo=e=>e.length!==0&&!e.startsWith("."),Io=e=>e.length!==0&&e!=="."&&e!=="..",zo=/^\?+([^+@!?\*\[\(]*)?$/,Bo=([e,t=""])=>{let i=en([e]);return t?(t=t.toLowerCase(),s=>i(s)&&s.toLowerCase().endsWith(t)):i},Uo=([e,t=""])=>{let i=sn([e]);return t?(t=t.toLowerCase(),s=>i(s)&&s.toLowerCase().endsWith(t)):i},$o=([e,t=""])=>{let i=sn([e]);return t?s=>i(s)&&s.endsWith(t):i},Ho=([e,t=""])=>{let i=en([e]);return t?s=>i(s)&&s.endsWith(t):i},en=([e])=>{let t=e.length;return i=>i.length===t&&!i.startsWith(".")},sn=([e])=>{let t=e.length;return i=>i.length===t&&i!=="."&&i!==".."},rn=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",rr={win32:{sep:"\\"},posix:{sep:"/"}},Ko=rn==="win32"?rr.win32.sep:rr.posix.sep;at.sep=Ko;var ot=Symbol("globstar **");at.GLOBSTAR=ot;var Qo="[^/]",qo=Qo+"*?",Jo="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Vo="(?:(?!(?:\\/|^)\\.).)*?",Zo=(e,t={})=>i=>at(i,e,t);at.filter=Zo;var wt=(e,t={})=>Object.assign({},e,t),Yo=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return at;let t=at;return Object.assign((i,s,n={})=>t(i,s,wt(e,n)),{Minimatch:class extends t.Minimatch{constructor(i,s={}){super(i,wt(e,s));}static defaults(i){return t.defaults(wt(e,i)).Minimatch}},AST:class extends t.AST{constructor(i,s,n={}){super(i,s,wt(e,n));}static fromGlob(i,s={}){return t.AST.fromGlob(i,wt(e,s))}},unescape:(i,s={})=>t.unescape(i,wt(e,s)),escape:(i,s={})=>t.escape(i,wt(e,s)),filter:(i,s={})=>t.filter(i,wt(e,s)),defaults:i=>t.defaults(wt(e,i)),makeRe:(i,s={})=>t.makeRe(i,wt(e,s)),braceExpand:(i,s={})=>t.braceExpand(i,wt(e,s)),match:(i,s,n={})=>t.match(i,s,wt(e,n)),sep:t.sep,GLOBSTAR:ot})};at.defaults=Yo;var nn=(e,t={})=>(Ji(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:po(e,{max:t.braceExpandMax}));at.braceExpand=nn;var Xo=(e,t={})=>new fe(e,t).makeRe();at.makeRe=Xo;var ta=(e,t,i={})=>{let s=new fe(t,i);return e=e.filter(n=>s.match(n)),s.options.nonull&&!e.length&&e.push(t),e};at.match=ta;var nr=/[?*]|[+@!]\(.*?\)|\[|\]/,ea=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),fe=class{constructor(e$1,t={}){e(this,"options");e(this,"set");e(this,"pattern");e(this,"windowsPathsNoEscape");e(this,"nonegate");e(this,"negate");e(this,"comment");e(this,"empty");e(this,"preserveMultipleSlashes");e(this,"partial");e(this,"globSet");e(this,"globParts");e(this,"nocase");e(this,"isWindows");e(this,"platform");e(this,"windowsNoMagicRoot");e(this,"regexp");Ji(e$1),t=t||{},this.options=t,this.pattern=e$1,this.platform=t.platform||rn,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[i]===false,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=false,this.nonegate=!!t.nonegate,this.comment=false,this.empty=false,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make();}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return true;for(let e of this.set)for(let t of e)if(typeof t!="string")return true;return false}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=true;return}if(!e){this.empty=true;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((n,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=n[0]===""&&n[1]===""&&(n[2]==="?"||!nr.test(n[2]))&&!nr.test(n[3]),l=/^[a-z]:/i.test(n[0]);if(h)return [...n.slice(0,4),...n.slice(4).map(u=>this.parse(u))];if(l)return [n[0],...n.slice(1).map(u=>this.parse(u))]}return n.map(h=>this.parse(h))});if(this.debug(this.pattern,s),this.set=s.filter(n=>n.indexOf(false)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let o=this.set[n];o[0]===""&&o[1]===""&&this.globParts[n][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?");}this.debug(this.pattern,this.set);}preprocess(e){if(this.options.noglobstar)for(let i=0;i<e.length;i++)for(let s=0;s<e[i].length;s++)e[i][s]==="**"&&(e[i][s]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let i=-1;for(;(i=t.indexOf("**",i+1))!==-1;){let s=i;for(;t[s+1]==="**";)s++;s!==i&&t.splice(i,s-i);}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((i,s)=>{let n=i[i.length-1];return s==="**"&&n==="**"?i:s===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(i.pop(),i):(i.push(s),i)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=false;do{if(t=false,!this.preserveMultipleSlashes){for(let s=1;s<e.length-1;s++){let n=e[s];s===1&&n===""&&e[0]===""||(n==="."||n==="")&&(t=true,e.splice(s,1),s--);}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=true,e.pop());}let i=0;for(;(i=e.indexOf("..",i+1))!==-1;){let s=e[i-1];s&&s!=="."&&s!==".."&&s!=="**"&&(t=true,e.splice(i-1,2),i-=2);}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=false;do{t=false;for(let i of e){let s=-1;for(;(s=i.indexOf("**",s+1))!==-1;){let o=s;for(;i[o+1]==="**";)o++;o>s&&i.splice(s+1,o-s);let a=i[s+1],h=i[s+2],l=i[s+3];if(a!==".."||!h||h==="."||h===".."||!l||l==="."||l==="..")continue;t=true,i.splice(s,1);let u=i.slice(0);u[s]="**",e.push(u),s--;}if(!this.preserveMultipleSlashes){for(let o=1;o<i.length-1;o++){let a=i[o];o===1&&a===""&&i[0]===""||(a==="."||a==="")&&(t=true,i.splice(o,1),o--);}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(t=true,i.pop());}let n=0;for(;(n=i.indexOf("..",n+1))!==-1;){let o=i[n-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=true;let a=n===1&&i[n+1]==="**"?["."]:[];i.splice(n-1,2,...a),i.length===0&&i.push(""),n-=2;}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let i=t+1;i<e.length;i++){let s=this.partsMatch(e[t],e[i],!this.preserveMultipleSlashes);if(s){e[t]=[],e[i]=s;break}}return e.filter(t=>t.length)}partsMatch(e,t,i=false){let s=0,n=0,o=[],a="";for(;s<e.length&&n<t.length;)if(e[s]===t[n])o.push(a==="b"?t[n]:e[s]),s++,n++;else if(i&&e[s]==="**"&&t[n]===e[s+1])o.push(e[s]),s++;else if(i&&t[n]==="**"&&e[s]===t[n+1])o.push(t[n]),n++;else if(e[s]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(a==="b")return false;a="a",o.push(e[s]),s++,n++;}else if(t[n]==="*"&&e[s]&&(this.options.dot||!e[s].startsWith("."))&&e[s]!=="**"){if(a==="a")return false;a="b",o.push(t[n]),s++,n++;}else return false;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=false,i=0;for(let s=0;s<e.length&&e.charAt(s)==="!";s++)t=!t,i++;i&&(this.pattern=e.slice(i)),this.negate=t;}matchOne(e,t,i=false){let s=this.options;if(this.isWindows){let x=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),C=!x&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),E=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),v=!E&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),T=C?3:x?0:void 0,F=v?3:E?0:void 0;if(typeof T=="number"&&typeof F=="number"){let[P,A]=[e[T],t[F]];P.toLowerCase()===A.toLowerCase()&&(t[F]=P,F>T?t=t.slice(F):T>F&&(e=e.slice(T)));}}let{optimizationLevel:n=1}=this.options;n>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var o=0,a=0,h=e.length,l=t.length;o<h&&a<l;o++,a++){this.debug("matchOne loop");var u=t[a],g=e[o];if(this.debug(t,u,g),u===false)return false;if(u===ot){this.debug("GLOBSTAR",[t,u,g]);var d=o,w=a+1;if(w===l){for(this.debug("** at the end");o<h;o++)if(e[o]==="."||e[o]===".."||!s.dot&&e[o].charAt(0)===".")return false;return true}for(;d<h;){var S=e[d];if(this.debug(`
|
|
2
|
-
globstar while`,e,d,t,w,S),this.matchOne(e.slice(d),t.slice(w),i))return this.debug("globstar found match!",d,h,S),true;if(S==="."||S===".."||!s.dot&&S.charAt(0)==="."){this.debug("dot detected!",e,d,t,w);break}this.debug("globstar swallow a segment, and continue"),d++;}return !!(i&&(this.debug(`
|
|
3
|
-
>>> no match, partial?`,e,d,t,w),d===h))}let x;if(typeof u=="string"?(x=g===u,this.debug("string match",u,g,x)):(x=u.test(g),this.debug("pattern match",u,g,x)),!x)return false}if(o===h&&a===l)return true;if(o===h)return i;if(a===l)return o===h-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return nn(this.pattern,this.options)}parse(e){Ji(e);let t=this.options;if(e==="**")return ot;if(e==="")return "";let i,s=null;(i=e.match(_o))?s=t.dot?Io:jo:(i=e.match(Ro))?s=(t.nocase?t.dot?Lo:Po:t.dot?Fo:Oo)(i[1]):(i=e.match(zo))?s=(t.nocase?t.dot?Uo:Bo:t.dot?$o:Ho)(i):(i=e.match(No))?s=t.dot?Do:Go:(i=e.match(Wo))&&(s=Mo);let n=Zr.fromGlob(e,this.options).toMMPattern();return s&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:s}),n}makeRe(){if(this.regexp||this.regexp===false)return this.regexp;let e=this.set;if(!e.length)return this.regexp=false,this.regexp;let t=this.options,i=t.noglobstar?qo:t.dot?Jo:Vo,s=new Set(t.nocase?["i"]:[]),n=e.map(h=>{let l=h.map(g=>{if(g instanceof RegExp)for(let d of g.flags.split(""))s.add(d);return typeof g=="string"?ea(g):g===ot?ot:g._src});l.forEach((g,d)=>{let w=l[d+1],S=l[d-1];g!==ot||S===ot||(S===void 0?w!==void 0&&w!==ot?l[d+1]="(?:\\/|"+i+"\\/)?"+w:l[d]=i:w===void 0?l[d-1]=S+"(?:\\/|\\/"+i+")?":w!==ot&&(l[d-1]=S+"(?:\\/|\\/"+i+"\\/)"+w,l[d+1]=ot));});let u=l.filter(g=>g!==ot);if(this.partial&&u.length>=1){let g=[];for(let d=1;d<=u.length;d++)g.push(u.slice(0,d).join("/"));return "(?:"+g.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];n="^"+o+n+a+"$",this.partial&&(n="^(?:\\/|"+o+n.slice(1,-1)+a+")$"),this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...s].join(""));}catch{this.regexp=false;}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return false;if(this.empty)return e==="";if(e==="/"&&t)return true;let i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let s=this.slashSplit(e);this.debug(this.pattern,"split",s);let n=this.set;this.debug(this.pattern,"set",n);let o=s[s.length-1];if(!o)for(let a=s.length-2;!o&&a>=0;a--)o=s[a];for(let a=0;a<n.length;a++){let h=n[a],l=s;if(i.matchBase&&h.length===1&&(l=[o]),this.matchOne(l,h,t))return i.flipNegate?true:!this.negate}return i.flipNegate?false:this.negate}static defaults(e){return at.defaults(e).Minimatch}};at.AST=Zr;at.Minimatch=fe;at.escape=tn;at.unescape=Pe;var sa=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,on=new Set,Fs=typeof process=="object"&&process?process:{},an=(e,t,i,s)=>{typeof Fs.emitWarning=="function"?Fs.emitWarning(e,t,i,s):console.error(`[${i}] ${t}: ${e}`);},Vi=globalThis.AbortController,or=globalThis.AbortSignal;if(typeof Vi>"u"){or=class{constructor(){e(this,"onabort");e(this,"_onabort",[]);e(this,"reason");e(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Vi=class{constructor(){e(this,"signal",new or);t();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let e$1=Fs.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e$1&&(e$1=false,an("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ra=e=>!on.has(e),Xt=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),hn=e=>Xt(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Bi:null:null,Bi=class extends Array{constructor(e){super(e),this.fill(0);}},jt,Le,na=(jt=class{constructor(t,i){e(this,"heap");e(this,"length");if(!f$1(jt,Le))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=hn(t);if(!i)return [];h(jt,Le,true);let s=new jt(t,i);return h(jt,Le,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Le=new WeakMap,g(jt,Le,false),jt),Sr,vr,Ct,ft,At,we,kt,Ne,Ge,Tt,B,Rt,I,D,O,st,ut,et,Z,Ot,Y,Ft,Pt,pt,dt,Lt,ne,rt,De,b,Ps,be,Ut,oi,gt,ln,Ce,We,ai,te,ee,Ls,Ui,$i,N,Ns,Xe,ie,Gs,Me,Xi=(Me=class{constructor(t){g(this,b);g(this,Ct);g(this,ft);g(this,At);g(this,we);g(this,kt);g(this,Ne);g(this,Ge);g(this,Tt);e(this,"ttl");e(this,"ttlResolution");e(this,"ttlAutopurge");e(this,"updateAgeOnGet");e(this,"updateAgeOnHas");e(this,"allowStale");e(this,"noDisposeOnSet");e(this,"noUpdateTTL");e(this,"maxEntrySize");e(this,"sizeCalculation");e(this,"noDeleteOnFetchRejection");e(this,"noDeleteOnStaleGet");e(this,"allowStaleOnFetchAbort");e(this,"allowStaleOnFetchRejection");e(this,"ignoreFetchAbort");g(this,B);g(this,Rt);g(this,I);g(this,D);g(this,O);g(this,st);g(this,ut);g(this,et);g(this,Z);g(this,Ot);g(this,Y);g(this,Ft);g(this,Pt);g(this,pt);g(this,dt);g(this,Lt);g(this,ne);g(this,rt);g(this,De);g(this,be,()=>{});g(this,Ut,()=>{});g(this,oi,()=>{});g(this,gt,()=>false);g(this,Ce,t=>{});g(this,We,(t,i,s)=>{});g(this,ai,(t,i,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});e(this,Sr,"LRUCache");let{max:i$1=0,ttl:s,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h$1,allowStale:l,dispose:u,onInsert:g$1,disposeAfter:d,noDisposeOnSet:w,noUpdateTTL:S,maxSize:x=0,maxEntrySize:C=0,sizeCalculation:E,fetchMethod:v,memoMethod:T,noDeleteOnFetchRejection:F,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:L,ignoreFetchAbort:M,perf:H}=t;if(H!==void 0&&typeof H?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(h(this,Tt,H??sa),i$1!==0&&!Xt(i$1))throw new TypeError("max option must be a nonnegative integer");let W=i$1?hn(i$1):Array;if(!W)throw new Error("invalid max value: "+i$1);if(h(this,Ct,i$1),h(this,ft,x),this.maxEntrySize=C||f$1(this,ft),this.sizeCalculation=E,this.sizeCalculation){if(!f$1(this,ft)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(T!==void 0&&typeof T!="function")throw new TypeError("memoMethod must be a function if defined");if(h(this,Ge,T),v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(h(this,Ne,v),h(this,ne,!!v),h(this,I,new Map),h(this,D,new Array(i$1).fill(void 0)),h(this,O,new Array(i$1).fill(void 0)),h(this,st,new W(i$1)),h(this,ut,new W(i$1)),h(this,et,0),h(this,Z,0),h(this,Ot,na.create(i$1)),h(this,B,0),h(this,Rt,0),typeof u=="function"&&h(this,At,u),typeof g$1=="function"&&h(this,we,g$1),typeof d=="function"?(h(this,kt,d),h(this,Y,[])):(h(this,kt,void 0),h(this,Y,void 0)),h(this,Lt,!!f$1(this,At)),h(this,De,!!f$1(this,we)),h(this,rt,!!f$1(this,kt)),this.noDisposeOnSet=!!w,this.noUpdateTTL=!!S,this.noDeleteOnFetchRejection=!!F,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!L,this.ignoreFetchAbort=!!M,this.maxEntrySize!==0){if(f$1(this,ft)!==0&&!Xt(f$1(this,ft)))throw new TypeError("maxSize must be a positive integer if specified");if(!Xt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");i(this,b,ln).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h$1,this.ttlResolution=Xt(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!Xt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");i(this,b,Ps).call(this);}if(f$1(this,Ct)===0&&this.ttl===0&&f$1(this,ft)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!f$1(this,Ct)&&!f$1(this,ft)){let K="LRU_CACHE_UNBOUNDED";ra(K)&&(on.add(K),an("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",K,Me));}}get perf(){return f$1(this,Tt)}static unsafeExposeInternals(t){return {starts:f$1(t,Pt),ttls:f$1(t,pt),autopurgeTimers:f$1(t,dt),sizes:f$1(t,Ft),keyMap:f$1(t,I),keyList:f$1(t,D),valList:f$1(t,O),next:f$1(t,st),prev:f$1(t,ut),get head(){return f$1(t,et)},get tail(){return f$1(t,Z)},free:f$1(t,Ot),isBackgroundFetch:i$1=>{var s;return i(s=t,b,N).call(s,i$1)},backgroundFetch:(i$1,s,n,o)=>{var a;return i(a=t,b,$i).call(a,i$1,s,n,o)},moveToTail:i$1=>{var s;return i(s=t,b,Xe).call(s,i$1)},indexes:i$1=>{var s;return i(s=t,b,te).call(s,i$1)},rindexes:i$1=>{var s;return i(s=t,b,ee).call(s,i$1)},isStale:i=>{var s;return f$1(s=t,gt).call(s,i)}}}get max(){return f$1(this,Ct)}get maxSize(){return f$1(this,ft)}get calculatedSize(){return f$1(this,Rt)}get size(){return f$1(this,B)}get fetchMethod(){return f$1(this,Ne)}get memoMethod(){return f$1(this,Ge)}get dispose(){return f$1(this,At)}get onInsert(){return f$1(this,we)}get disposeAfter(){return f$1(this,kt)}getRemainingTTL(t){return f$1(this,I).has(t)?1/0:0}*entries(){for(let t of i(this,b,te).call(this))f$1(this,O)[t]!==void 0&&f$1(this,D)[t]!==void 0&&!i(this,b,N).call(this,f$1(this,O)[t])&&(yield [f$1(this,D)[t],f$1(this,O)[t]]);}*rentries(){for(let t of i(this,b,ee).call(this))f$1(this,O)[t]!==void 0&&f$1(this,D)[t]!==void 0&&!i(this,b,N).call(this,f$1(this,O)[t])&&(yield [f$1(this,D)[t],f$1(this,O)[t]]);}*keys(){for(let t of i(this,b,te).call(this)){let i$1=f$1(this,D)[t];i$1!==void 0&&!i(this,b,N).call(this,f$1(this,O)[t])&&(yield i$1);}}*rkeys(){for(let t of i(this,b,ee).call(this)){let i$1=f$1(this,D)[t];i$1!==void 0&&!i(this,b,N).call(this,f$1(this,O)[t])&&(yield i$1);}}*values(){for(let t of i(this,b,te).call(this))f$1(this,O)[t]!==void 0&&!i(this,b,N).call(this,f$1(this,O)[t])&&(yield f$1(this,O)[t]);}*rvalues(){for(let t of i(this,b,ee).call(this))f$1(this,O)[t]!==void 0&&!i(this,b,N).call(this,f$1(this,O)[t])&&(yield f$1(this,O)[t]);}[(vr=Symbol.iterator,Sr=Symbol.toStringTag,vr)](){return this.entries()}find(t,i$1={}){for(let s of i(this,b,te).call(this)){let n=f$1(this,O)[s],o=i(this,b,N).call(this,n)?n.__staleWhileFetching:n;if(o!==void 0&&t(o,f$1(this,D)[s],this))return this.get(f$1(this,D)[s],i$1)}}forEach(t,i$1=this){for(let s of i(this,b,te).call(this)){let n=f$1(this,O)[s],o=i(this,b,N).call(this,n)?n.__staleWhileFetching:n;o!==void 0&&t.call(i$1,o,f$1(this,D)[s],this);}}rforEach(t,i$1=this){for(let s of i(this,b,ee).call(this)){let n=f$1(this,O)[s],o=i(this,b,N).call(this,n)?n.__staleWhileFetching:n;o!==void 0&&t.call(i$1,o,f$1(this,D)[s],this);}}purgeStale(){let t=false;for(let i$1 of i(this,b,ee).call(this,{allowStale:true}))f$1(this,gt).call(this,i$1)&&(i(this,b,ie).call(this,f$1(this,D)[i$1],"expire"),t=true);return t}info(t){let i$1=f$1(this,I).get(t);if(i$1===void 0)return;let s=f$1(this,O)[i$1],n=i(this,b,N).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let o={value:n};if(f$1(this,pt)&&f$1(this,Pt)){let a=f$1(this,pt)[i$1],h=f$1(this,Pt)[i$1];if(a&&h){let l=a-(f$1(this,Tt).now()-h);o.ttl=l,o.start=Date.now();}}return f$1(this,Ft)&&(o.size=f$1(this,Ft)[i$1]),o}dump(){let t=[];for(let i$1 of i(this,b,te).call(this,{allowStale:true})){let s=f$1(this,D)[i$1],n=f$1(this,O)[i$1],o=i(this,b,N).call(this,n)?n.__staleWhileFetching:n;if(o===void 0||s===void 0)continue;let a={value:o};if(f$1(this,pt)&&f$1(this,Pt)){a.ttl=f$1(this,pt)[i$1];let h=f$1(this,Tt).now()-f$1(this,Pt)[i$1];a.start=Math.floor(Date.now()-h);}f$1(this,Ft)&&(a.size=f$1(this,Ft)[i$1]),t.unshift([s,a]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let n=Date.now()-s.start;s.start=f$1(this,Tt).now()-n;}this.set(i,s.value,s);}}set(t,i$1,s={}){var w,S,x,C;if(i$1===void 0)return this.delete(t),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h$1=this.sizeCalculation,status:l}=s,{noUpdateTTL:u=this.noUpdateTTL}=s,g=f$1(this,ai).call(this,t,i$1,s.size||0,h$1);if(this.maxEntrySize&&g>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),i(this,b,ie).call(this,t,"set"),this;let d=f$1(this,B)===0?void 0:f$1(this,I).get(t);if(d===void 0)d=f$1(this,B)===0?f$1(this,Z):f$1(this,Ot).length!==0?f$1(this,Ot).pop():f$1(this,B)===f$1(this,Ct)?i(this,b,Ui).call(this,false):f$1(this,B),f$1(this,D)[d]=t,f$1(this,O)[d]=i$1,f$1(this,I).set(t,d),f$1(this,st)[f$1(this,Z)]=d,f$1(this,ut)[d]=f$1(this,Z),h(this,Z,d),j$1(this,B)._++,f$1(this,We).call(this,d,g,l),l&&(l.set="add"),u=false,f$1(this,De)&&((w=f$1(this,we))==null||w.call(this,i$1,t,"add"));else {i(this,b,Xe).call(this,d);let E=f$1(this,O)[d];if(i$1!==E){if(f$1(this,ne)&&i(this,b,N).call(this,E)){E.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:v}=E;v!==void 0&&!a&&(f$1(this,Lt)&&((S=f$1(this,At))==null||S.call(this,v,t,"set")),f$1(this,rt)&&f$1(this,Y)?.push([v,t,"set"]));}else a||(f$1(this,Lt)&&((x=f$1(this,At))==null||x.call(this,E,t,"set")),f$1(this,rt)&&f$1(this,Y)?.push([E,t,"set"]));if(f$1(this,Ce).call(this,d),f$1(this,We).call(this,d,g,l),f$1(this,O)[d]=i$1,l){l.set="replace";let v=E&&i(this,b,N).call(this,E)?E.__staleWhileFetching:E;v!==void 0&&(l.oldValue=v);}}else l&&(l.set="update");f$1(this,De)&&this.onInsert?.(i$1,t,i$1===E?"update":"replace");}if(n!==0&&!f$1(this,pt)&&i(this,b,Ps).call(this),f$1(this,pt)&&(u||f$1(this,oi).call(this,d,n,o),l&&f$1(this,Ut).call(this,l,d)),!a&&f$1(this,rt)&&f$1(this,Y)){let E=f$1(this,Y),v;for(;v=E?.shift();)(C=f$1(this,kt))==null||C.call(this,...v);}return this}pop(){var t;try{for(;f$1(this,B);){let i$1=f$1(this,O)[f$1(this,et)];if(i(this,b,Ui).call(this,!0),i(this,b,N).call(this,i$1)){if(i$1.__staleWhileFetching)return i$1.__staleWhileFetching}else if(i$1!==void 0)return i$1}}finally{if(f$1(this,rt)&&f$1(this,Y)){let i=f$1(this,Y),s;for(;s=i?.shift();)(t=f$1(this,kt))==null||t.call(this,...s);}}}has(t,i$1={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=i$1,o=f$1(this,I).get(t);if(o!==void 0){let a=f$1(this,O)[o];if(i(this,b,N).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(f$1(this,gt).call(this,o))n&&(n.has="stale",f$1(this,Ut).call(this,n,o));else return s&&f$1(this,be).call(this,o),n&&(n.has="hit",f$1(this,Ut).call(this,n,o)),true}else n&&(n.has="miss");return false}peek(t,i$1={}){let{allowStale:s=this.allowStale}=i$1,n=f$1(this,I).get(t);if(n===void 0||!s&&f$1(this,gt).call(this,n))return;let o=f$1(this,O)[n];return i(this,b,N).call(this,o)?o.__staleWhileFetching:o}async fetch(t,i$1={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:w=this.allowStaleOnFetchRejection,ignoreFetchAbort:S=this.ignoreFetchAbort,allowStaleOnFetchAbort:x=this.allowStaleOnFetchAbort,context:C,forceRefresh:E=false,status:v,signal:T}=i$1;if(!f$1(this,ne))return v&&(v.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:v});let F={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:l,sizeCalculation:u,noUpdateTTL:g,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:x,ignoreFetchAbort:S,status:v,signal:T},P=f$1(this,I).get(t);if(P===void 0){v&&(v.fetch="miss");let A=i(this,b,$i).call(this,t,P,F,C);return A.__returned=A}else {let A=f$1(this,O)[P];if(i(this,b,N).call(this,A)){let W=s&&A.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",W&&(v.returnedStale=true)),W?A.__staleWhileFetching:A.__returned=A}let L=f$1(this,gt).call(this,P);if(!E&&!L)return v&&(v.fetch="hit"),i(this,b,Xe).call(this,P),n&&f$1(this,be).call(this,P),v&&f$1(this,Ut).call(this,v,P),A;let M=i(this,b,$i).call(this,t,P,F,C),H=M.__staleWhileFetching!==void 0&&s;return v&&(v.fetch=L?"stale":"refresh",H&&L&&(v.returnedStale=true)),H?M.__staleWhileFetching:M.__returned=M}}async forceFetch(t,i={}){let s=await this.fetch(t,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,i={}){let s=f$1(this,Ge);if(!s)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:o,...a}=i,h=this.get(t,a);if(!o&&h!==void 0)return h;let l=s(t,h,{options:a,context:n});return this.set(t,l,a),l}get(t,i$1={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=i$1,h=f$1(this,I).get(t);if(h!==void 0){let l=f$1(this,O)[h],u=i(this,b,N).call(this,l);return a&&f$1(this,Ut).call(this,a,h),f$1(this,gt).call(this,h)?(a&&(a.get="stale"),u?(a&&s&&l.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?l.__staleWhileFetching:void 0):(o||i(this,b,ie).call(this,t,"expire"),a&&s&&(a.returnedStale=true),s?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(i(this,b,Xe).call(this,h),n&&f$1(this,be).call(this,h),l))}else a&&(a.get="miss");}delete(t){return i(this,b,ie).call(this,t,"delete")}clear(){return i(this,b,Gs).call(this,"delete")}},Ct=new WeakMap,ft=new WeakMap,At=new WeakMap,we=new WeakMap,kt=new WeakMap,Ne=new WeakMap,Ge=new WeakMap,Tt=new WeakMap,B=new WeakMap,Rt=new WeakMap,I=new WeakMap,D=new WeakMap,O=new WeakMap,st=new WeakMap,ut=new WeakMap,et=new WeakMap,Z=new WeakMap,Ot=new WeakMap,Y=new WeakMap,Ft=new WeakMap,Pt=new WeakMap,pt=new WeakMap,dt=new WeakMap,Lt=new WeakMap,ne=new WeakMap,rt=new WeakMap,De=new WeakMap,b=new WeakSet,Ps=function(){let t=new Bi(f$1(this,Ct)),i$1=new Bi(f$1(this,Ct));h(this,pt,t),h(this,Pt,i$1);let s=this.ttlAutopurge?new Array(f$1(this,Ct)):void 0;h(this,dt,s),h(this,oi,(a,h,l=f$1(this,Tt).now())=>{if(i$1[a]=h!==0?l:0,t[a]=h,s?.[a]&&(clearTimeout(s[a]),s[a]=void 0),h!==0&&s){let u=setTimeout(()=>{f$1(this,gt).call(this,a)&&i(this,b,ie).call(this,f$1(this,D)[a],"expire");},h+1);u.unref&&u.unref(),s[a]=u;}}),h(this,be,a=>{i$1[a]=t[a]!==0?f$1(this,Tt).now():0;}),h(this,Ut,(a,h)=>{if(t[h]){let l=t[h],u=i$1[h];if(!l||!u)return;a.ttl=l,a.start=u,a.now=n||o();let g=a.now-u;a.remainingTTL=l-g;}});let n=0,o=()=>{let a=f$1(this,Tt).now();if(this.ttlResolution>0){n=a;let h=setTimeout(()=>n=0,this.ttlResolution);h.unref&&h.unref();}return a};this.getRemainingTTL=a=>{let h=f$1(this,I).get(a);if(h===void 0)return 0;let l=t[h],u=i$1[h];if(!l||!u)return 1/0;let g=(n||o())-u;return l-g},h(this,gt,a=>{let h=i$1[a],l=t[a];return !!l&&!!h&&(n||o())-h>l});},be=new WeakMap,Ut=new WeakMap,oi=new WeakMap,gt=new WeakMap,ln=function(){let t=new Bi(f$1(this,Ct));h(this,Rt,0),h(this,Ft,t),h(this,Ce,i=>{h(this,Rt,f$1(this,Rt)-t[i]),t[i]=0;}),h(this,ai,(i$1,s,n,o)=>{if(i(this,b,N).call(this,s))return 0;if(!Xt(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(s,i$1),!Xt(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n}),h(this,We,(i$1,s,n)=>{if(t[i$1]=s,f$1(this,ft)){let o=f$1(this,ft)-t[i$1];for(;f$1(this,Rt)>o;)i(this,b,Ui).call(this,true);}h(this,Rt,f$1(this,Rt)+t[i$1]),n&&(n.entrySize=s,n.totalCalculatedSize=f$1(this,Rt));});},Ce=new WeakMap,We=new WeakMap,ai=new WeakMap,te=function*({allowStale:t=this.allowStale}={}){if(f$1(this,B))for(let i$1=f$1(this,Z);!(!i(this,b,Ls).call(this,i$1)||((t||!f$1(this,gt).call(this,i$1))&&(yield i$1),i$1===f$1(this,et)));)i$1=f$1(this,ut)[i$1];},ee=function*({allowStale:t=this.allowStale}={}){if(f$1(this,B))for(let i$1=f$1(this,et);!(!i(this,b,Ls).call(this,i$1)||((t||!f$1(this,gt).call(this,i$1))&&(yield i$1),i$1===f$1(this,Z)));)i$1=f$1(this,st)[i$1];},Ls=function(t){return t!==void 0&&f$1(this,I).get(f$1(this,D)[t])===t},Ui=function(t){var o;let i$1=f$1(this,et),s=f$1(this,D)[i$1],n=f$1(this,O)[i$1];return f$1(this,ne)&&i(this,b,N).call(this,n)?n.__abortController.abort(new Error("evicted")):(f$1(this,Lt)||f$1(this,rt))&&(f$1(this,Lt)&&((o=f$1(this,At))==null||o.call(this,n,s,"evict")),f$1(this,rt)&&f$1(this,Y)?.push([n,s,"evict"])),f$1(this,Ce).call(this,i$1),f$1(this,dt)?.[i$1]&&(clearTimeout(f$1(this,dt)[i$1]),f$1(this,dt)[i$1]=void 0),t&&(f$1(this,D)[i$1]=void 0,f$1(this,O)[i$1]=void 0,f$1(this,Ot).push(i$1)),f$1(this,B)===1?(h(this,et,h(this,Z,0)),f$1(this,Ot).length=0):h(this,et,f$1(this,st)[i$1]),f$1(this,I).delete(s),j$1(this,B)._--,i$1},$i=function(t,i$1,s,n){let o=i$1===void 0?void 0:f$1(this,O)[i$1];if(i(this,b,N).call(this,o))return o;let a=new Vi,{signal:h}=s;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let l={signal:a.signal,options:s,context:n},u=(C,E=false)=>{let{aborted:v}=a.signal,T=s.ignoreFetchAbort&&C!==void 0,F=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&C!==void 0);if(s.status&&(v&&!E?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,T&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),v&&!T&&!E)return d(a.signal.reason,F);let P=S,A=f$1(this,O)[i$1];return (A===S||T&&E&&A===void 0)&&(C===void 0?P.__staleWhileFetching!==void 0?f$1(this,O)[i$1]=P.__staleWhileFetching:i(this,b,ie).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,C,l.options))),C},g=C=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=C),d(C,false)),d=(C,E)=>{let{aborted:v}=a.signal,T=v&&s.allowStaleOnFetchAbort,F=T||s.allowStaleOnFetchRejection,P=F||s.noDeleteOnFetchRejection,A=S;if(f$1(this,O)[i$1]===S&&(!P||!E&&A.__staleWhileFetching===void 0?i(this,b,ie).call(this,t,"fetch"):T||(f$1(this,O)[i$1]=A.__staleWhileFetching)),F)return s.status&&A.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),A.__staleWhileFetching;if(A.__returned===A)throw C},w=(C,E)=>{var T;let v=(T=f$1(this,Ne))==null?void 0:T.call(this,t,o,l);v&&v instanceof Promise&&v.then(F=>C(F===void 0?void 0:F),E),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(C(void 0),s.allowStaleOnFetchAbort&&(C=F=>u(F,true)));});};s.status&&(s.status.fetchDispatched=true);let S=new Promise(w).then(u,g),x=Object.assign(S,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return i$1===void 0?(this.set(t,x,{...l.options,status:void 0}),i$1=f$1(this,I).get(t)):f$1(this,O)[i$1]=x,x},N=function(t){if(!f$1(this,ne))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Vi},Ns=function(t,i){f$1(this,ut)[i]=t,f$1(this,st)[t]=i;},Xe=function(t){t!==f$1(this,Z)&&(t===f$1(this,et)?h(this,et,f$1(this,st)[t]):i(this,b,Ns).call(this,f$1(this,ut)[t],f$1(this,st)[t]),i(this,b,Ns).call(this,f$1(this,Z),t),h(this,Z,t));},ie=function(t,i$1){var n,o;let s=false;if(f$1(this,B)!==0){let a=f$1(this,I).get(t);if(a!==void 0)if(f$1(this,dt)?.[a]&&(clearTimeout(f$1(this,dt)?.[a]),f$1(this,dt)[a]=void 0),s=true,f$1(this,B)===1)i(this,b,Gs).call(this,i$1);else {f$1(this,Ce).call(this,a);let h$1=f$1(this,O)[a];if(i(this,b,N).call(this,h$1)?h$1.__abortController.abort(new Error("deleted")):(f$1(this,Lt)||f$1(this,rt))&&(f$1(this,Lt)&&((n=f$1(this,At))==null||n.call(this,h$1,t,i$1)),f$1(this,rt)&&f$1(this,Y)?.push([h$1,t,i$1])),f$1(this,I).delete(t),f$1(this,D)[a]=void 0,f$1(this,O)[a]=void 0,a===f$1(this,Z))h(this,Z,f$1(this,ut)[a]);else if(a===f$1(this,et))h(this,et,f$1(this,st)[a]);else {let l=f$1(this,ut)[a];f$1(this,st)[l]=f$1(this,st)[a];let u=f$1(this,st)[a];f$1(this,ut)[u]=f$1(this,ut)[a];}j$1(this,B)._--,f$1(this,Ot).push(a);}}if(f$1(this,rt)&&f$1(this,Y)?.length){let a=f$1(this,Y),h;for(;h=a?.shift();)(o=f$1(this,kt))==null||o.call(this,...h);}return s},Gs=function(t){var i$1,s;for(let n of i(this,b,ee).call(this,{allowStale:true})){let o=f$1(this,O)[n];if(i(this,b,N).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=f$1(this,D)[n];f$1(this,Lt)&&((i$1=f$1(this,At))==null||i$1.call(this,o,a,t)),f$1(this,rt)&&f$1(this,Y)?.push([o,a,t]);}}if(f$1(this,I).clear(),f$1(this,O).fill(void 0),f$1(this,D).fill(void 0),f$1(this,pt)&&f$1(this,Pt)){f$1(this,pt).fill(0),f$1(this,Pt).fill(0);for(let n of f$1(this,dt)??[])n!==void 0&&clearTimeout(n);f$1(this,dt)?.fill(void 0);}if(f$1(this,Ft)&&f$1(this,Ft).fill(0),h(this,et,0),h(this,Z,0),f$1(this,Ot).length=0,h(this,Rt,0),h(this,B,0),f$1(this,rt)&&f$1(this,Y)){let n=f$1(this,Y),o;for(;o=n?.shift();)(s=f$1(this,kt))==null||s.call(this,...o);}},Me),ar=typeof process=="object"&&process?process:{stdout:null,stderr:null},ba=e=>!!e&&typeof e=="object"&&(e instanceof Zi||e instanceof cn||Ca(e)||Sa(e)),Ca=e=>!!e&&typeof e=="object"&&e instanceof EventEmitter&&typeof e.pipe=="function"&&e.pipe!==cn.Writable.prototype.pipe,Sa=e=>!!e&&typeof e=="object"&&e instanceof EventEmitter&&typeof e.write=="function"&&typeof e.end=="function",It=Symbol("EOF"),zt=Symbol("maybeEmitEnd"),Yt=Symbol("emittedEnd"),Gi=Symbol("emittingEnd"),Qe=Symbol("emittedError"),Di=Symbol("closed"),hr=Symbol("read"),Wi=Symbol("flush"),lr=Symbol("flushChunk"),xt=Symbol("encoding"),Oe=Symbol("decoder"),Q=Symbol("flowing"),qe=Symbol("paused"),Fe=Symbol("resume"),q=Symbol("buffer"),it=Symbol("pipes"),J=Symbol("bufferLength"),vs=Symbol("bufferPush"),Mi=Symbol("bufferShift"),tt=Symbol("objectMode"),_=Symbol("destroyed"),xs=Symbol("error"),Es=Symbol("emitData"),cr=Symbol("emitEnd"),As=Symbol("emitEnd2"),Gt=Symbol("async"),ks=Symbol("abort"),_i=Symbol("aborted"),Je=Symbol("signal"),pe=Symbol("dataListeners"),ct=Symbol("discarded"),Ve=e=>Promise.resolve().then(e),va=e=>e(),xa=e=>e==="end"||e==="finish"||e==="prefinish",Ea=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,Aa=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),fn=class{constructor(e$1,t,i){e(this,"src");e(this,"dest");e(this,"opts");e(this,"ondrain");this.src=e$1,this.dest=t,this.opts=i,this.ondrain=()=>e$1[Fe](),this.dest.on("drain",this.ondrain);}unpipe(){this.dest.removeListener("drain",this.ondrain);}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end();}},ka=class extends fn{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe();}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors);}},Ta=e=>!!e.objectMode,Ra=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",xr,Er,Ar,kr,Tr,Rr,Or,Fr,Pr,Lr,Nr,Gr,Dr,Wr,Mr,_r,jr,Ir,zr,Zi=class extends EventEmitter{constructor(...t){let i=t[0]||{};super();e(this,zr,false);e(this,Ir,false);e(this,jr,[]);e(this,_r,[]);e(this,Mr);e(this,Wr);e(this,Dr);e(this,Gr);e(this,Nr,false);e(this,Lr,false);e(this,Pr,false);e(this,Fr,false);e(this,Or,null);e(this,Rr,0);e(this,Tr,false);e(this,kr);e(this,Ar,false);e(this,Er,0);e(this,xr,false);e(this,"writable",true);e(this,"readable",true);if(i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Ta(i)?(this[tt]=true,this[xt]=null):Ra(i)?(this[xt]=i.encoding,this[tt]=false):(this[tt]=false,this[xt]=null),this[Gt]=!!i.async,this[Oe]=this[xt]?new StringDecoder(this[xt]):null,i&&i.debugExposeBuffer===true&&Object.defineProperty(this,"buffer",{get:()=>this[q]}),i&&i.debugExposePipes===true&&Object.defineProperty(this,"pipes",{get:()=>this[it]});let{signal:s}=i;s&&(this[Je]=s,s.aborted?this[ks]():s.addEventListener("abort",()=>this[ks]()));}get bufferLength(){return this[J]}get encoding(){return this[xt]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[tt]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Gt]}set async(t){this[Gt]=this[Gt]||!!t;}[(zr=Q,Ir=qe,jr=it,_r=q,Mr=tt,Wr=xt,Dr=Gt,Gr=Oe,Nr=It,Lr=Yt,Pr=Gi,Fr=Di,Or=Qe,Rr=J,Tr=_,kr=Je,Ar=_i,Er=pe,xr=ct,ks)](){this[_i]=true,this.emit("abort",this[Je]?.reason),this.destroy(this[Je]?.reason);}get aborted(){return this[_i]}set aborted(t){}write(t,i,s){if(this[_i])return false;if(this[It])throw new Error("write after end");if(this[_])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),true;typeof i=="function"&&(s=i,i="utf8"),i||(i="utf8");let n=this[Gt]?Ve:va;if(!this[tt]&&!Buffer.isBuffer(t)){if(Aa(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Ea(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[tt]?(this[Q]&&this[J]!==0&&this[Wi](true),this[Q]?this.emit("data",t):this[vs](t),this[J]!==0&&this.emit("readable"),s&&n(s),this[Q]):t.length?(typeof t=="string"&&!(i===this[xt]&&!this[Oe]?.lastNeed)&&(t=Buffer.from(t,i)),Buffer.isBuffer(t)&&this[xt]&&(t=this[Oe].write(t)),this[Q]&&this[J]!==0&&this[Wi](true),this[Q]?this.emit("data",t):this[vs](t),this[J]!==0&&this.emit("readable"),s&&n(s),this[Q]):(this[J]!==0&&this.emit("readable"),s&&n(s),this[Q])}read(t){if(this[_])return null;if(this[ct]=false,this[J]===0||t===0||t&&t>this[J])return this[zt](),null;this[tt]&&(t=null),this[q].length>1&&!this[tt]&&(this[q]=[this[xt]?this[q].join(""):Buffer.concat(this[q],this[J])]);let i=this[hr](t||null,this[q][0]);return this[zt](),i}[hr](t,i){if(this[tt])this[Mi]();else {let s=i;t===s.length||t===null?this[Mi]():typeof s=="string"?(this[q][0]=s.slice(t),i=s.slice(0,t),this[J]-=t):(this[q][0]=s.subarray(t),i=s.subarray(0,t),this[J]-=t);}return this.emit("data",i),!this[q].length&&!this[It]&&this.emit("drain"),i}end(t,i,s){return typeof t=="function"&&(s=t,t=void 0),typeof i=="function"&&(s=i,i="utf8"),t!==void 0&&this.write(t,i),s&&this.once("end",s),this[It]=true,this.writable=false,(this[Q]||!this[qe])&&this[zt](),this}[Fe](){this[_]||(!this[pe]&&!this[it].length&&(this[ct]=true),this[qe]=false,this[Q]=true,this.emit("resume"),this[q].length?this[Wi]():this[It]?this[zt]():this.emit("drain"));}resume(){return this[Fe]()}pause(){this[Q]=false,this[qe]=true,this[ct]=false;}get destroyed(){return this[_]}get flowing(){return this[Q]}get paused(){return this[qe]}[vs](t){this[tt]?this[J]+=1:this[J]+=t.length,this[q].push(t);}[Mi](){return this[tt]?this[J]-=1:this[J]-=this[q][0].length,this[q].shift()}[Wi](t=false){do;while(this[lr](this[Mi]())&&this[q].length);!t&&!this[q].length&&!this[It]&&this.emit("drain");}[lr](t){return this.emit("data",t),this[Q]}pipe(t,i){if(this[_])return t;this[ct]=false;let s=this[Yt];return i=i||{},t===ar.stdout||t===ar.stderr?i.end=false:i.end=i.end!==false,i.proxyErrors=!!i.proxyErrors,s?i.end&&t.end():(this[it].push(i.proxyErrors?new ka(this,t,i):new fn(this,t,i)),this[Gt]?Ve(()=>this[Fe]()):this[Fe]()),t}unpipe(t){let i=this[it].find(s=>s.dest===t);i&&(this[it].length===1?(this[Q]&&this[pe]===0&&(this[Q]=false),this[it]=[]):this[it].splice(this[it].indexOf(i),1),i.unpipe());}addListener(t,i){return this.on(t,i)}on(t,i){let s=super.on(t,i);if(t==="data")this[ct]=false,this[pe]++,!this[it].length&&!this[Q]&&this[Fe]();else if(t==="readable"&&this[J]!==0)super.emit("readable");else if(xa(t)&&this[Yt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Qe]){let n=i;this[Gt]?Ve(()=>n.call(this,this[Qe])):n.call(this,this[Qe]);}return s}removeListener(t,i){return this.off(t,i)}off(t,i){let s=super.off(t,i);return t==="data"&&(this[pe]=this.listeners("data").length,this[pe]===0&&!this[ct]&&!this[it].length&&(this[Q]=false)),s}removeAllListeners(t){let i=super.removeAllListeners(t);return (t==="data"||t===void 0)&&(this[pe]=0,!this[ct]&&!this[it].length&&(this[Q]=false)),i}get emittedEnd(){return this[Yt]}[zt](){!this[Gi]&&!this[Yt]&&!this[_]&&this[q].length===0&&this[It]&&(this[Gi]=true,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Di]&&this.emit("close"),this[Gi]=false);}emit(t,...i){let s=i[0];if(t!=="error"&&t!=="close"&&t!==_&&this[_])return false;if(t==="data")return !this[tt]&&!s?false:this[Gt]?(Ve(()=>this[Es](s)),true):this[Es](s);if(t==="end")return this[cr]();if(t==="close"){if(this[Di]=true,!this[Yt]&&!this[_])return false;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(t==="error"){this[Qe]=s,super.emit(xs,s);let o=!this[Je]||this.listeners("error").length?super.emit("error",s):false;return this[zt](),o}else if(t==="resume"){let o=super.emit("resume");return this[zt](),o}else if(t==="finish"||t==="prefinish"){let o=super.emit(t);return this.removeAllListeners(t),o}let n=super.emit(t,...i);return this[zt](),n}[Es](t){for(let s of this[it])s.dest.write(t)===false&&this.pause();let i=this[ct]?false:super.emit("data",t);return this[zt](),i}[cr](){return this[Yt]?false:(this[Yt]=true,this.readable=false,this[Gt]?(Ve(()=>this[As]()),true):this[As]())}[As](){if(this[Oe]){let i=this[Oe].end();if(i){for(let s of this[it])s.dest.write(i);this[ct]||super.emit("data",i);}}for(let i of this[it])i.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[tt]||(t.dataLength=0);let i=this.promise();return this.on("data",s=>{t.push(s),this[tt]||(t.dataLength+=s.length);}),await i,t}async concat(){if(this[tt])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[xt]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,i)=>{this.on(_,()=>i(new Error("stream destroyed"))),this.on("error",s=>i(s)),this.on("end",()=>t());})}[Symbol.asyncIterator](){this[ct]=false;let t=false,i=async()=>(this.pause(),t=true,{value:void 0,done:true});return {next:()=>{if(t)return i();let s=this.read();if(s!==null)return Promise.resolve({done:false,value:s});if(this[It])return i();let n,o,a=g=>{this.off("data",h),this.off("end",l),this.off(_,u),i(),o(g);},h=g=>{this.off("error",a),this.off("end",l),this.off(_,u),this.pause(),n({value:g,done:!!this[It]});},l=()=>{this.off("error",a),this.off("data",h),this.off(_,u),i(),n({done:true,value:void 0});},u=()=>a(new Error("stream destroyed"));return new Promise((g,d)=>{o=d,n=g,this.once(_,u),this.once("error",a),this.once("end",l),this.once("data",h);})},throw:i,return:i,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[ct]=false;let t=false,i=()=>(this.pause(),this.off(xs,i),this.off(_,i),this.off("end",i),t=true,{done:true,value:void 0}),s=()=>{if(t)return i();let n=this.read();return n===null?i():{done:false,value:n}};return this.once("end",i),this.once(xs,i),this.once(_,i),{next:s,throw:i,return:i,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[_])return t?this.emit("error",t):this.emit(_),this;this[_]=true,this[ct]=true,this[q].length=0,this[J]=0;let i=this;return typeof i.close=="function"&&!this[Di]&&i.close(),t?this.emit("error",t):this.emit(_),this}static get isStream(){return ba}},Oa=realpathSync.native,ti={lstatSync:lstatSync,readdir:readdir$1,readdirSync:readdirSync,readlinkSync:readlinkSync,realpathSync:Oa,promises:{lstat:lstat,readdir:readdir,readlink:readlink,realpath:realpath}},un=e=>!e||e===ti||e===pa?ti:{...ti,...e,promises:{...ti.promises,...e.promises||{}}},pn=/^\\\\\?\\([a-z]:)\\?$/i,Fa=e=>e.replace(/\//g,"\\").replace(pn,"$1\\"),Pa=/[\\\/]/,St=0,dn=1,gn=2,Dt=4,mn=6,yn=8,de=10,wn=12,bt=15,Ze=~bt,Ts=16,fr=32,ei=64,Et=128,ji=256,Hi=512,ur=ei|Et|Hi,La=1023,Rs=e=>e.isFile()?yn:e.isDirectory()?Dt:e.isSymbolicLink()?de:e.isCharacterDevice()?gn:e.isBlockDevice()?mn:e.isSocket()?wn:e.isFIFO()?dn:St,pr=new Xi({max:2**12}),ii=e=>{let t=pr.get(e);if(t)return t;let i=e.normalize("NFKD");return pr.set(e,i),i},dr=new Xi({max:2**12}),Ii=e=>{let t=dr.get(e);if(t)return t;let i=ii(e.toLowerCase());return dr.set(e,i),i},gr=class extends Xi{constructor(){super({max:256});}},Na=class extends Xi{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1});}},bn=Symbol("PathScurry setAsCwd"),nt,hi,li,ci,fi,ui,pi,di,gi,mi,yi,wi,bi,Ci,Si,vi,xi,Ei,Ai,oe,Se,Mt,$t,Ht,Kt,R,ve,Qt,_t,k,Ws,Ki,si,Ms,_s,ri,Qi,js,Is,qi,Cn,Sn,vn,zs,_e,je,xn,xe,Br,ht=(Br=class{constructor(e$1,t=St,i,s,n,o,a){g(this,k);e(this,"name");e(this,"root");e(this,"roots");e(this,"parent");e(this,"nocase");e(this,"isCWD",false);g(this,nt);g(this,hi);g(this,li);g(this,ci);g(this,fi);g(this,ui);g(this,pi);g(this,di);g(this,gi);g(this,mi);g(this,yi);g(this,wi);g(this,bi);g(this,Ci);g(this,Si);g(this,vi);g(this,xi);g(this,Ei);g(this,Ai);g(this,oe);g(this,Se);g(this,Mt);g(this,$t);g(this,Ht);g(this,Kt);g(this,R);g(this,ve);g(this,Qt);g(this,_t);g(this,_e,[]);g(this,je,false);g(this,xe);this.name=e$1,h(this,oe,n?Ii(e$1):ii(e$1)),h(this,R,t&La),this.nocase=n,this.roots=s,this.root=i||this,h(this,ve,o),h(this,Mt,a.fullpath),h(this,Ht,a.relative),h(this,Kt,a.relativePosix),this.parent=a.parent,this.parent?h(this,nt,f$1(this.parent,nt)):h(this,nt,un(a.fs));}get dev(){return f$1(this,hi)}get mode(){return f$1(this,li)}get nlink(){return f$1(this,ci)}get uid(){return f$1(this,fi)}get gid(){return f$1(this,ui)}get rdev(){return f$1(this,pi)}get blksize(){return f$1(this,di)}get ino(){return f$1(this,gi)}get size(){return f$1(this,mi)}get blocks(){return f$1(this,yi)}get atimeMs(){return f$1(this,wi)}get mtimeMs(){return f$1(this,bi)}get ctimeMs(){return f$1(this,Ci)}get birthtimeMs(){return f$1(this,Si)}get atime(){return f$1(this,vi)}get mtime(){return f$1(this,xi)}get ctime(){return f$1(this,Ei)}get birthtime(){return f$1(this,Ai)}get parentPath(){return (this.parent||this).fullpath()}get path(){return this.parentPath}depth(){return f$1(this,Se)!==void 0?f$1(this,Se):this.parent?h(this,Se,this.parent.depth()+1):h(this,Se,0)}childrenCache(){return f$1(this,ve)}resolve(e){var s;if(!e)return this;let t=this.getRootString(e),i$1=e.substring(t.length).split(this.splitSep);return t?i(s=this.getRoot(t),k,Ws).call(s,i$1):i(this,k,Ws).call(this,i$1)}children(){let e=f$1(this,ve).get(this);if(e)return e;let t=Object.assign([],{provisional:0});return f$1(this,ve).set(this,t),h(this,R,f$1(this,R)&~Ts),t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let i=this.children(),s=this.nocase?Ii(e):ii(e);for(let h of i)if(f$1(h,oe)===s)return h;let n=this.parent?this.sep:"",o=f$1(this,Mt)?f$1(this,Mt)+n+e:void 0,a=this.newChild(e,St,{...t,parent:this,fullpath:o});return this.canReaddir()||h(a,R,f$1(a,R)|Et),i.push(a),a}relative(){if(this.isCWD)return "";if(f$1(this,Ht)!==void 0)return f$1(this,Ht);let e=this.name,t=this.parent;if(!t)return h(this,Ht,this.name);let i=t.relative();return i+(!i||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return "";if(f$1(this,Kt)!==void 0)return f$1(this,Kt);let e=this.name,t=this.parent;if(!t)return h(this,Kt,this.fullpathPosix());let i=t.relativePosix();return i+(!i||!t.parent?"":"/")+e}fullpath(){if(f$1(this,Mt)!==void 0)return f$1(this,Mt);let e=this.name,t=this.parent;if(!t)return h(this,Mt,this.name);let i=t.fullpath()+(t.parent?this.sep:"")+e;return h(this,Mt,i)}fullpathPosix(){if(f$1(this,$t)!==void 0)return f$1(this,$t);if(this.sep==="/")return h(this,$t,this.fullpath());if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return /^[a-z]:\//i.test(s)?h(this,$t,`//?/${s}`):h(this,$t,s)}let e=this.parent,t=e.fullpathPosix(),i=t+(!t||!e.parent?"":"/")+this.name;return h(this,$t,i)}isUnknown(){return (f$1(this,R)&bt)===St}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return (f$1(this,R)&bt)===yn}isDirectory(){return (f$1(this,R)&bt)===Dt}isCharacterDevice(){return (f$1(this,R)&bt)===gn}isBlockDevice(){return (f$1(this,R)&bt)===mn}isFIFO(){return (f$1(this,R)&bt)===dn}isSocket(){return (f$1(this,R)&bt)===wn}isSymbolicLink(){return (f$1(this,R)&de)===de}lstatCached(){return f$1(this,R)&fr?this:void 0}readlinkCached(){return f$1(this,Qt)}realpathCached(){return f$1(this,_t)}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(f$1(this,Qt))return true;if(!this.parent)return false;let e=f$1(this,R)&bt;return !(e!==St&&e!==de||f$1(this,R)&ji||f$1(this,R)&Et)}calledReaddir(){return !!(f$1(this,R)&Ts)}isENOENT(){return !!(f$1(this,R)&Et)}isNamed(e){return this.nocase?f$1(this,oe)===Ii(e):f$1(this,oe)===ii(e)}async readlink(){let e=f$1(this,Qt);if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await f$1(this,nt).promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(t);if(i)return h(this,Qt,i)}catch(t){i(this,k,Is).call(this,t.code);return}}readlinkSync(){let e=f$1(this,Qt);if(e)return e;if(this.canReadlink()&&this.parent)try{let t=f$1(this,nt).readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(t);if(i)return h(this,Qt,i)}catch(t){i(this,k,Is).call(this,t.code);return}}async lstat(){if((f$1(this,R)&Et)===0)try{return i(this,k,zs).call(this,await f$1(this,nt).promises.lstat(this.fullpath())),this}catch(e){i(this,k,js).call(this,e.code);}}lstatSync(){if((f$1(this,R)&Et)===0)try{return i(this,k,zs).call(this,f$1(this,nt).lstatSync(this.fullpath())),this}catch(e){i(this,k,js).call(this,e.code);}}readdirCB(e,t=false){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let i$1=this.children();if(this.calledReaddir()){let n=i$1.slice(0,i$1.provisional);t?e(null,n):queueMicrotask(()=>e(null,n));return}if(f$1(this,_e).push(e),f$1(this,je))return;h(this,je,true);let s=this.fullpath();f$1(this,nt).readdir(s,{withFileTypes:true},(n,o)=>{if(n)i(this,k,Qi).call(this,n.code),i$1.provisional=0;else {for(let a of o)i(this,k,qi).call(this,a,i$1);i(this,k,Ki).call(this,i$1);}i(this,k,xn).call(this,i$1.slice(0,i$1.provisional));});}async readdir(){if(!this.canReaddir())return [];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(f$1(this,xe))await f$1(this,xe);else {let i$1=()=>{};h(this,xe,new Promise(s=>i$1=s));try{for(let s of await f$1(this,nt).promises.readdir(t,{withFileTypes:!0}))i(this,k,qi).call(this,s,e);i(this,k,Ki).call(this,e);}catch(s){i(this,k,Qi).call(this,s.code),e.provisional=0;}h(this,xe,void 0),i$1();}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return [];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let i$1 of f$1(this,nt).readdirSync(t,{withFileTypes:!0}))i(this,k,qi).call(this,i$1,e);i(this,k,Ki).call(this,e);}catch(i$1){i(this,k,Qi).call(this,i$1.code),e.provisional=0;}return e.slice(0,e.provisional)}canReaddir(){if(f$1(this,R)&ur)return false;let e=bt&f$1(this,R);return e===St||e===Dt||e===de}shouldWalk(e,t){return (f$1(this,R)&Dt)===Dt&&!(f$1(this,R)&ur)&&!e.has(this)&&(!t||t(this))}async realpath(){if(f$1(this,_t))return f$1(this,_t);if(!((Hi|ji|Et)&f$1(this,R)))try{let e=await f$1(this,nt).promises.realpath(this.fullpath());return h(this,_t,this.resolve(e))}catch{i(this,k,_s).call(this);}}realpathSync(){if(f$1(this,_t))return f$1(this,_t);if(!((Hi|ji|Et)&f$1(this,R)))try{let e=f$1(this,nt).realpathSync(this.fullpath());return h(this,_t,this.resolve(e))}catch{i(this,k,_s).call(this);}}[bn](e){if(e===this)return;e.isCWD=false,this.isCWD=true;let t=new Set([]),i=[],s=this;for(;s&&s.parent;)t.add(s),h(s,Ht,i.join(this.sep)),h(s,Kt,i.join("/")),s=s.parent,i.push("..");for(s=e;s&&s.parent&&!t.has(s);)h(s,Ht,void 0),h(s,Kt,void 0),s=s.parent;}},nt=new WeakMap,hi=new WeakMap,li=new WeakMap,ci=new WeakMap,fi=new WeakMap,ui=new WeakMap,pi=new WeakMap,di=new WeakMap,gi=new WeakMap,mi=new WeakMap,yi=new WeakMap,wi=new WeakMap,bi=new WeakMap,Ci=new WeakMap,Si=new WeakMap,vi=new WeakMap,xi=new WeakMap,Ei=new WeakMap,Ai=new WeakMap,oe=new WeakMap,Se=new WeakMap,Mt=new WeakMap,$t=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,R=new WeakMap,ve=new WeakMap,Qt=new WeakMap,_t=new WeakMap,k=new WeakSet,Ws=function(e){let t=this;for(let i of e)t=t.child(i);return t},Ki=function(e){var t;h(this,R,f$1(this,R)|Ts);for(let i$1=e.provisional;i$1<e.length;i$1++){let s=e[i$1];s&&i(t=s,k,si).call(t);}},si=function(){f$1(this,R)&Et||(h(this,R,(f$1(this,R)|Et)&Ze),i(this,k,Ms).call(this));},Ms=function(){var t;let e=this.children();e.provisional=0;for(let i$1 of e)i(t=i$1,k,si).call(t);},_s=function(){h(this,R,f$1(this,R)|Hi),i(this,k,ri).call(this);},ri=function(){if(f$1(this,R)&ei)return;let e=f$1(this,R);(e&bt)===Dt&&(e&=Ze),h(this,R,e|ei),i(this,k,Ms).call(this);},Qi=function(e=""){e==="ENOTDIR"||e==="EPERM"?i(this,k,ri).call(this):e==="ENOENT"?i(this,k,si).call(this):this.children().provisional=0;},js=function(e=""){var t;e==="ENOTDIR"?i(t=this.parent,k,ri).call(t):e==="ENOENT"&&i(this,k,si).call(this);},Is=function(e=""){var i$1;let t=f$1(this,R);t|=ji,e==="ENOENT"&&(t|=Et),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Ze),h(this,R,t),e==="ENOTDIR"&&this.parent&&i(i$1=this.parent,k,ri).call(i$1);},qi=function(e,t){return i(this,k,Sn).call(this,e,t)||i(this,k,Cn).call(this,e,t)},Cn=function(e,t){let i=Rs(e),s=this.newChild(e.name,i,{parent:this}),n=f$1(s,R)&bt;return n!==Dt&&n!==de&&n!==St&&h(s,R,f$1(s,R)|ei),t.unshift(s),t.provisional++,s},Sn=function(e,t){for(let i$1=t.provisional;i$1<t.length;i$1++){let s=t[i$1];if((this.nocase?Ii(e.name):ii(e.name))===f$1(s,oe))return i(this,k,vn).call(this,e,s,i$1,t)}},vn=function(e,t,i,s){let n=t.name;return h(t,R,f$1(t,R)&Ze|Rs(e)),n!==e.name&&(t.name=e.name),i!==s.provisional&&(i===s.length-1?s.pop():s.splice(i,1),s.unshift(t)),s.provisional++,t},zs=function(e){let{atime:t,atimeMs:i,birthtime:s,birthtimeMs:n,blksize:o,blocks:a,ctime:h$1,ctimeMs:l,dev:u,gid:g,ino:d,mode:w,mtime:S,mtimeMs:x,nlink:C,rdev:E,size:v,uid:T}=e;h(this,vi,t),h(this,wi,i),h(this,Ai,s),h(this,Si,n),h(this,di,o),h(this,yi,a),h(this,Ei,h$1),h(this,Ci,l),h(this,hi,u),h(this,ui,g),h(this,gi,d),h(this,li,w),h(this,xi,S),h(this,bi,x),h(this,ci,C),h(this,pi,E),h(this,mi,v),h(this,fi,T);let F=Rs(e);h(this,R,f$1(this,R)&Ze|F|fr),F!==St&&F!==Dt&&F!==de&&h(this,R,f$1(this,R)|ei);},_e=new WeakMap,je=new WeakMap,xn=function(e){h(this,je,false);let t=f$1(this,_e).slice();f$1(this,_e).length=0,t.forEach(i=>i(null,e));},xe=new WeakMap,Br),En=class An extends ht{constructor(i,s=St,n,o,a,h,l){super(i,s,n,o,a,h,l);e(this,"sep","\\");e(this,"splitSep",Pa);}newChild(i,s=St,n={}){return new An(i,s,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(i){return win32.parse(i).root}getRoot(i){if(i=Fa(i.toUpperCase()),i===this.root.name)return this.root;for(let[s,n]of Object.entries(this.roots))if(this.sameRoot(i,s))return this.roots[i]=n;return this.roots[i]=new Ks(i,this).root}sameRoot(i,s=this.root.name){return i=i.toUpperCase().replace(/\//g,"\\").replace(pn,"$1\\"),i===s}},kn=class Tn extends ht{constructor(i,s=St,n,o,a,h,l){super(i,s,n,o,a,h,l);e(this,"splitSep","/");e(this,"sep","/");}getRootString(i){return i.startsWith("/")?"/":""}getRoot(i){return this.root}newChild(i,s=St,n={}){return new Tn(i,s,this.root,this.roots,this.nocase,this.childrenCache(),n)}},Ie,ze,ki,Ti,Ur,Rn=(Ur=class{constructor(e$1=process.cwd(),t,i,{nocase:s,childrenCacheSize:n=16*1024,fs:o=ti}={}){e(this,"root");e(this,"rootPath");e(this,"roots");e(this,"cwd");g(this,Ie);g(this,ze);g(this,ki);e(this,"nocase");g(this,Ti);h(this,Ti,un(o)),(e$1 instanceof URL||e$1.startsWith("file://"))&&(e$1=fileURLToPath(e$1));let a=t.resolve(e$1);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),h(this,Ie,new gr),h(this,ze,new gr),h(this,ki,new Na(n));let h$1=a.substring(this.rootPath.length).split(i);if(h$1.length===1&&!h$1[0]&&h$1.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(f$1(this,Ti)),this.roots[this.rootPath]=this.root;let l=this.root,u=h$1.length-1,g$1=t.sep,d=this.rootPath,w=false;for(let S of h$1){let x=u--;l=l.child(S,{relative:new Array(x).fill("..").join(g$1),relativePosix:new Array(x).fill("..").join("/"),fullpath:d+=(w?"":g$1)+S}),w=true;}this.cwd=l;}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return f$1(this,ki)}resolve(...e){let t="";for(let n=e.length-1;n>=0;n--){let o=e[n];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let i=f$1(this,Ie).get(t);if(i!==void 0)return i;let s=this.cwd.resolve(t).fullpath();return f$1(this,Ie).set(t,s),s}resolvePosix(...e){let t="";for(let n=e.length-1;n>=0;n--){let o=e[n];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let i=f$1(this,ze).get(t);if(i!==void 0)return i;let s=this.cwd.resolve(t).fullpathPosix();return f$1(this,ze).set(t,s),s}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:true}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:i}=t;if(e.canReaddir()){let s=await e.readdir();return i?s:s.map(n=>n.name)}else return []}readdirSync(e=this.cwd,t={withFileTypes:true}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:i=true}=t;return e.canReaddir()?i?e.readdirSync():e.readdirSync().map(s=>s.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:false}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e.withFileTypes,e=this.cwd);let i=await e.readlink();return t?i:i?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:false}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e.withFileTypes,e=this.cwd);let i=e.readlinkSync();return t?i:i?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:false}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e.withFileTypes,e=this.cwd);let i=await e.realpath();return t?i:i?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:false}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e.withFileTypes,e=this.cwd);let i=e.realpathSync();return t?i:i?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:i=true,follow:s=false,filter:n,walkFilter:o}=t,a=[];(!n||n(e))&&a.push(i?e:e.fullpath());let h=new Set,l=(g,d)=>{h.add(g),g.readdirCB((w,S)=>{if(w)return d(w);let x=S.length;if(!x)return d();let C=()=>{--x===0&&d();};for(let E of S)(!n||n(E))&&a.push(i?E:E.fullpath()),s&&E.isSymbolicLink()?E.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(h,o)?l(v,C):C()):E.shouldWalk(h,o)?l(E,C):C();},true);},u=e;return new Promise((g,d)=>{l(u,w=>{if(w)return d(w);g(a);});})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:i=true,follow:s=false,filter:n,walkFilter:o}=t,a=[];(!n||n(e))&&a.push(i?e:e.fullpath());let h=new Set([e]);for(let l of h){let u=l.readdirSync();for(let g of u){(!n||n(g))&&a.push(i?g:g.fullpath());let d=g;if(g.isSymbolicLink()){if(!(s&&(d=g.realpathSync())))continue;d.isUnknown()&&d.lstatSync();}d.shouldWalk(h,o)&&h.add(d);}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:i=true,follow:s=false,filter:n,walkFilter:o}=t;(!n||n(e))&&(yield i?e:e.fullpath());let a=new Set([e]);for(let h of a){let l=h.readdirSync();for(let u of l){(!n||n(u))&&(yield i?u:u.fullpath());let g=u;if(u.isSymbolicLink()){if(!(s&&(g=u.realpathSync())))continue;g.isUnknown()&&g.lstatSync();}g.shouldWalk(a,o)&&a.add(g);}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:i=true,follow:s=false,filter:n,walkFilter:o}=t,a=new Zi({objectMode:true});(!n||n(e))&&a.write(i?e:e.fullpath());let h=new Set,l=[e],u=0,g=()=>{let d=false;for(;!d;){let w=l.shift();if(!w){u===0&&a.end();return}u++,h.add(w);let S=(C,E,v=false)=>{if(C)return a.emit("error",C);if(s&&!v){let T=[];for(let F of E)F.isSymbolicLink()&&T.push(F.realpath().then(P=>P?.isUnknown()?P.lstat():P));if(T.length){Promise.all(T).then(()=>S(null,E,true));return}}for(let T of E)T&&(!n||n(T))&&(a.write(i?T:T.fullpath())||(d=true));u--;for(let T of E){let F=T.realpathCached()||T;F.shouldWalk(h,o)&&l.push(F);}d&&!a.flowing?a.once("drain",g):x||g();},x=true;w.readdirCB(S,true),x=false;}};return g(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:i=true,follow:s=false,filter:n,walkFilter:o}=t,a=new Zi({objectMode:true}),h=new Set;(!n||n(e))&&a.write(i?e:e.fullpath());let l=[e],u=0,g=()=>{let d=false;for(;!d;){let w=l.shift();if(!w){u===0&&a.end();return}u++,h.add(w);let S=w.readdirSync();for(let x of S)(!n||n(x))&&(a.write(i?x:x.fullpath())||(d=true));u--;for(let x of S){let C=x;if(x.isSymbolicLink()){if(!(s&&(C=x.realpathSync())))continue;C.isUnknown()&&C.lstatSync();}C.shouldWalk(h,o)&&l.push(C);}}d&&!a.flowing&&a.once("drain",g);};return g(),a}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[bn](t);}},Ie=new WeakMap,ze=new WeakMap,ki=new WeakMap,Ti=new WeakMap,Ur),Ks=class extends Rn{constructor(t=process.cwd(),i={}){let{nocase:s=true}=i;super(t,win32,"\\",{...i,nocase:s});e(this,"sep","\\");this.nocase=s;for(let n=this.cwd;n;n=n.parent)n.nocase=this.nocase;}parseRootPath(t){return win32.parse(t).root.toUpperCase()}newRoot(t){return new En(this.rootPath,Dt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},Qs=class extends Rn{constructor(t=process.cwd(),i={}){let{nocase:s=false}=i;super(t,posix,"/",{...i,nocase:s});e(this,"sep","/");this.nocase=s;}parseRootPath(t){return "/"}newRoot(t){return new kn(this.rootPath,Dt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},On=class extends Qs{constructor(e=process.cwd(),t={}){let{nocase:i=true}=t;super(e,{...t,nocase:i});}};process.platform==="win32"?En:kn;var Ga=process.platform==="win32"?Ks:process.platform==="darwin"?On:Qs,Da=e=>e.length>=1,Wa=e=>e.length>=1,Ma=Symbol.for("nodejs.util.inspect.custom"),U,lt,$,Ee,Nt,Ri,ae,he,le,Be,Ue,Fn=(Ue=class{constructor(t,i,s,n){g(this,U);g(this,lt);g(this,$);e(this,"length");g(this,Ee);g(this,Nt);g(this,Ri);g(this,ae);g(this,he);g(this,le);g(this,Be,true);if(!Da(t))throw new TypeError("empty pattern list");if(!Wa(i))throw new TypeError("empty glob list");if(i.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(h(this,U,t),h(this,lt,i),h(this,$,s),h(this,Ee,n),f$1(this,$)===0){if(this.isUNC()){let[o,a,h$1,l,...u]=f$1(this,U),[g,d,w,S,...x]=f$1(this,lt);u[0]===""&&(u.shift(),x.shift());let C=[o,a,h$1,l,""].join("/"),E=[g,d,w,S,""].join("/");h(this,U,[C,...u]),h(this,lt,[E,...x]),this.length=f$1(this,U).length;}else if(this.isDrive()||this.isAbsolute()){let[o,...a]=f$1(this,U),[h$1,...l]=f$1(this,lt);a[0]===""&&(a.shift(),l.shift());let u=o+"/",g=h$1+"/";h(this,U,[u,...a]),h(this,lt,[g,...l]),this.length=f$1(this,U).length;}}}[Ma](){return "Pattern <"+f$1(this,lt).slice(f$1(this,$)).join("/")+">"}pattern(){return f$1(this,U)[f$1(this,$)]}isString(){return typeof f$1(this,U)[f$1(this,$)]=="string"}isGlobstar(){return f$1(this,U)[f$1(this,$)]===ot}isRegExp(){return f$1(this,U)[f$1(this,$)]instanceof RegExp}globString(){return h(this,Ri,f$1(this,Ri)||(f$1(this,$)===0?this.isAbsolute()?f$1(this,lt)[0]+f$1(this,lt).slice(1).join("/"):f$1(this,lt).join("/"):f$1(this,lt).slice(f$1(this,$)).join("/")))}hasMore(){return this.length>f$1(this,$)+1}rest(){return f$1(this,Nt)!==void 0?f$1(this,Nt):this.hasMore()?(h(this,Nt,new Ue(f$1(this,U),f$1(this,lt),f$1(this,$)+1,f$1(this,Ee))),h(f$1(this,Nt),le,f$1(this,le)),h(f$1(this,Nt),he,f$1(this,he)),h(f$1(this,Nt),ae,f$1(this,ae)),f$1(this,Nt)):h(this,Nt,null)}isUNC(){let t=f$1(this,U);return f$1(this,he)!==void 0?f$1(this,he):h(this,he,f$1(this,Ee)==="win32"&&f$1(this,$)===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3])}isDrive(){let t=f$1(this,U);return f$1(this,ae)!==void 0?f$1(this,ae):h(this,ae,f$1(this,Ee)==="win32"&&f$1(this,$)===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]))}isAbsolute(){let t=f$1(this,U);return f$1(this,le)!==void 0?f$1(this,le):h(this,le,t[0]===""&&t.length>1||this.isDrive()||this.isUNC())}root(){let t=f$1(this,U)[0];return typeof t=="string"&&this.isAbsolute()&&f$1(this,$)===0?t:""}checkFollowGlobstar(){return !(f$1(this,$)===0||!this.isGlobstar()||!f$1(this,Be))}markFollowGlobstar(){return f$1(this,$)===0||!this.isGlobstar()||!f$1(this,Be)?false:(h(this,Be,false),true)}},U=new WeakMap,lt=new WeakMap,$=new WeakMap,Ee=new WeakMap,Nt=new WeakMap,Ri=new WeakMap,ae=new WeakMap,he=new WeakMap,le=new WeakMap,Be=new WeakMap,Ue),_a=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",mr=class{constructor(e$1,{nobrace:t,nocase:i,noext:s,noglobstar:n,platform:o=_a}){e(this,"relative");e(this,"relativeChildren");e(this,"absolute");e(this,"absoluteChildren");e(this,"platform");e(this,"mmopts");this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:true,nobrace:t,nocase:i,noext:s,noglobstar:n,optimizationLevel:2,platform:o,nocomment:true,nonegate:true};for(let a of e$1)this.add(a);}add(e){let t=new fe(e,this.mmopts);for(let i=0;i<t.set.length;i++){let s=t.set[i],n=t.globParts[i];if(!s||!n)throw new Error("invalid pattern object");for(;s[0]==="."&&n[0]===".";)s.shift(),n.shift();let o=new Fn(s,n,0,this.platform),a=new fe(o.globString(),this.mmopts),h=n[n.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(a):this.relative.push(a),h&&(l?this.absoluteChildren.push(a):this.relativeChildren.push(a));}}ignored(e){let t=e.fullpath(),i=`${t}/`,s=e.relative()||".",n=`${s}/`;for(let o of this.relative)if(o.match(s)||o.match(n))return true;for(let o of this.absolute)if(o.match(t)||o.match(i))return true;return false}childrenIgnored(e){let t=e.fullpath()+"/",i=(e.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(i))return true;for(let s of this.absoluteChildren)if(s.match(t))return true;return false}},ja=class Pn{constructor(t=new Map){e(this,"store");this.store=t;}copy(){return new Pn(new Map(this.store))}hasWalked(t,i){return this.store.get(t.fullpath())?.has(i.globString())}storeWalked(t,i){let s=t.fullpath(),n=this.store.get(s);n?n.add(i.globString()):this.store.set(s,new Set([i.globString()]));}},Ia=class{constructor(){e(this,"store",new Map);}add(e,t,i){let s=(t?2:0)|(i?1:0),n=this.store.get(e);this.store.set(e,n===void 0?s:s&n);}entries(){return [...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},za=class{constructor(){e(this,"store",new Map);}add(e,t){if(!e.canReaddir())return;let i=this.store.get(e);i?i.find(s=>s.globString()===t.globString())||i.push(t):this.store.set(e,[t]);}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return [...this.store.keys()].filter(e=>e.canReaddir())}},yr=class Ln{constructor(t,i){e(this,"hasWalkedCache");e(this,"matches",new Ia);e(this,"subwalks",new za);e(this,"patterns");e(this,"follow");e(this,"dot");e(this,"opts");this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=i?i.copy():new ja;}processPatterns(t,i){this.patterns=i;let s=i.map(n=>[t,n]);for(let[n,o]of s){this.hasWalkedCache.storeWalked(n,o);let a=o.root(),h=o.isAbsolute()&&this.opts.absolute!==false;if(a){n=n.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let d=o.rest();if(d)o=d;else {this.matches.add(n,true,false);continue}}if(n.isENOENT())continue;let l,u,g=false;for(;typeof(l=o.pattern())=="string"&&(u=o.rest());)n=n.resolve(l),o=u,g=true;if(l=o.pattern(),u=o.rest(),g){if(this.hasWalkedCache.hasWalked(n,o))continue;this.hasWalkedCache.storeWalked(n,o);}if(typeof l=="string"){let d=l===".."||l===""||l===".";this.matches.add(n.resolve(l),h,d);continue}else if(l===ot){(!n.isSymbolicLink()||this.follow||o.checkFollowGlobstar())&&this.subwalks.add(n,o);let d=u?.pattern(),w=u?.rest();if(!u||(d===""||d===".")&&!w)this.matches.add(n,h,d===""||d===".");else if(d===".."){let S=n.parent||n;w?this.hasWalkedCache.hasWalked(S,w)||this.subwalks.add(S,w):this.matches.add(S,h,true);}}else l instanceof RegExp&&this.subwalks.add(n,o);}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Ln(this.opts,this.hasWalkedCache)}filterEntries(t,i){let s=this.subwalks.get(t),n=this.child();for(let o of i)for(let a of s){let h=a.isAbsolute(),l=a.pattern(),u=a.rest();l===ot?n.testGlobstar(o,a,u,h):l instanceof RegExp?n.testRegExp(o,l,u,h):n.testString(o,l,u,h);}return n}testGlobstar(t,i,s,n){if((this.dot||!t.name.startsWith("."))&&(i.hasMore()||this.matches.add(t,n,false),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,i):t.isSymbolicLink()&&(s&&i.checkFollowGlobstar()?this.subwalks.add(t,s):i.markFollowGlobstar()&&this.subwalks.add(t,i)))),s){let o=s.pattern();if(typeof o=="string"&&o!==".."&&o!==""&&o!==".")this.testString(t,o,s.rest(),n);else if(o===".."){let a=t.parent||t;this.subwalks.add(a,s);}else o instanceof RegExp&&this.testRegExp(t,o,s.rest(),n);}}testRegExp(t,i,s,n){i.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,n,false));}testString(t,i,s,n){t.isNamed(i)&&(s?this.subwalks.add(t,s):this.matches.add(t,n,false));}},Ba=(e,t)=>typeof e=="string"?new mr([e],t):Array.isArray(e)?new mr(e,t):e,$e,qt,Ae,vt,ge,Bs,$r,Nn=($r=class{constructor(e$1,t,i){g(this,vt);e(this,"path");e(this,"patterns");e(this,"opts");e(this,"seen",new Set);e(this,"paused",false);e(this,"aborted",false);g(this,$e,[]);g(this,qt);g(this,Ae);e(this,"signal");e(this,"maxDepth");e(this,"includeChildMatches");if(this.patterns=e$1,this.path=t,this.opts=i,h(this,Ae,!i.posix&&i.platform==="win32"?"\\":"/"),this.includeChildMatches=i.includeChildMatches!==false,(i.ignore||!this.includeChildMatches)&&(h(this,qt,Ba(i.ignore??[],i)),!this.includeChildMatches&&typeof f$1(this,qt).add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{f$1(this,$e).length=0;}));}pause(){this.paused=true;}resume(){if(this.signal?.aborted)return;this.paused=false;let e;for(;!this.paused&&(e=f$1(this,$e).shift());)e();}onResume(e){this.signal?.aborted||(this.paused?f$1(this,$e).push(e):e());}async matchCheck(e,t){if(t&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||await e.realpath(),!i)return;e=i;}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let n=await s.realpath();n&&(n.isUnknown()||this.opts.stat)&&await n.lstat();}return this.matchCheckTest(s,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!i(this,vt,ge).call(this,e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||e.realpathSync(),!i)return;e=i;}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let n=s.realpathSync();n&&(n?.isUnknown()||this.opts.stat)&&n.lstatSync();}return this.matchCheckTest(s,t)}matchFinish(e,t){if(i(this,vt,ge).call(this,e))return;if(!this.includeChildMatches&&f$1(this,qt)?.add){let n=`${e.relativePosix()}/**`;f$1(this,qt).add(n);}let i$1=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let s=this.opts.mark&&e.isDirectory()?f$1(this,Ae):"";if(this.opts.withFileTypes)this.matchEmit(e);else if(i$1){let n=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(n+s);}else {let n=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!n.startsWith(".."+f$1(this,Ae))?"."+f$1(this,Ae):"";this.matchEmit(n?o+n+s:"."+s);}}async match(e,t,i){let s=await this.matchCheck(e,i);s&&this.matchFinish(s,t);}matchSync(e,t,i){let s=this.matchCheckSync(e,i);s&&this.matchFinish(s,t);}walkCB(e,t,i){this.signal?.aborted&&i(),this.walkCB2(e,t,new yr(this.opts),i);}walkCB2(e,t,i$1,s){if(i(this,vt,Bs).call(this,e))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(e,t,i$1,s));return}i$1.processPatterns(e,t);let n=1,o=()=>{--n===0&&s();};for(let[a,h,l]of i$1.matches.entries())i(this,vt,ge).call(this,a)||(n++,this.match(a,h,l).then(()=>o()));for(let a of i$1.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;n++;let h=a.readdirCached();a.calledReaddir()?this.walkCB3(a,h,i$1,o):a.readdirCB((l,u)=>this.walkCB3(a,u,i$1,o),true);}o();}walkCB3(e,t,i$1,s){i$1=i$1.filterEntries(e,t);let n=1,o=()=>{--n===0&&s();};for(let[a,h,l]of i$1.matches.entries())i(this,vt,ge).call(this,a)||(n++,this.match(a,h,l).then(()=>o()));for(let[a,h]of i$1.subwalks.entries())n++,this.walkCB2(a,h,i$1.child(),o);o();}walkCBSync(e,t,i){this.signal?.aborted&&i(),this.walkCB2Sync(e,t,new yr(this.opts),i);}walkCB2Sync(e,t,i$1,s){if(i(this,vt,Bs).call(this,e))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,i$1,s));return}i$1.processPatterns(e,t);let n=1,o=()=>{--n===0&&s();};for(let[a,h,l]of i$1.matches.entries())i(this,vt,ge).call(this,a)||this.matchSync(a,h,l);for(let a of i$1.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;n++;let h=a.readdirSync();this.walkCB3Sync(a,h,i$1,o);}o();}walkCB3Sync(e,t,i$1,s){i$1=i$1.filterEntries(e,t);let n=1,o=()=>{--n===0&&s();};for(let[a,h,l]of i$1.matches.entries())i(this,vt,ge).call(this,a)||this.matchSync(a,h,l);for(let[a,h]of i$1.subwalks.entries())n++,this.walkCB2Sync(a,h,i$1.child(),o);o();}},$e=new WeakMap,qt=new WeakMap,Ae=new WeakMap,vt=new WeakSet,ge=function(e){return this.seen.has(e)||!!f$1(this,qt)?.ignored?.(e)},Bs=function(e){return !!f$1(this,qt)?.childrenIgnored?.(e)},$r),wr=class extends Nn{constructor(t,i,s){super(t,i,s);e(this,"matches",new Set);}matchEmit(t){this.matches.add(t);}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,i)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?i(this.signal.reason):t(this.matches);});}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},br=class extends Nn{constructor(t,i,s){super(t,i,s);e(this,"results");this.results=new Zi({signal:this.signal,objectMode:true}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume());}matchEmit(t){this.results.write(t),this.results.flowing||this.pause();}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end());}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},Ua=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Te=class{constructor(e$1,t){e(this,"absolute");e(this,"cwd");e(this,"root");e(this,"dot");e(this,"dotRelative");e(this,"follow");e(this,"ignore");e(this,"magicalBraces");e(this,"mark");e(this,"matchBase");e(this,"maxDepth");e(this,"nobrace");e(this,"nocase");e(this,"nodir");e(this,"noext");e(this,"noglobstar");e(this,"pattern");e(this,"platform");e(this,"realpath");e(this,"scurry");e(this,"stat");e(this,"signal");e(this,"windowsPathsNoEscape");e(this,"withFileTypes");e(this,"includeChildMatches");e(this,"opts");e(this,"patterns");if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=fileURLToPath(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==false,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e$1=="string"&&(e$1=[e$1]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===false,this.windowsPathsNoEscape&&(e$1=e$1.map(h=>h.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e$1=e$1.map(h=>h.includes("/")?h:`./**/${h}`);}if(this.pattern=e$1,this.platform=t.platform||Ua,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else {let h=t.platform==="win32"?Ks:t.platform==="darwin"?On:t.platform?Qs:Ga;this.scurry=new h(this.cwd,{nocase:t.nocase,fs:t.fs});}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",s={braceExpandMax:1e4,...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:true,noext:this.noext,nonegate:true,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(h=>new fe(h,s)),[o,a]=n.reduce((h,l)=>(h[0].push(...l.set),h[1].push(...l.globParts),h),[[],[]]);this.patterns=o.map((h,l)=>{let u=a[l];if(!u)throw new Error("invalid pattern object");return new Fn(h,u,0,this.platform)});}async walk(){return [...await new wr(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return [...new wr(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new br(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new br(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},$a=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let i of e)if(new fe(i,t).hasMagic())return true;return false};function ts(e,t={}){return new Te(e,t).streamSync()}function Gn(e,t={}){return new Te(e,t).stream()}function Dn(e,t={}){return new Te(e,t).walkSync()}async function Cr(e,t={}){return new Te(e,t).walk()}function es(e,t={}){return new Te(e,t).iterateSync()}function Wn(e,t={}){return new Te(e,t).iterate()}var Ha=ts,Ka=Object.assign(Gn,{sync:ts}),Qa=es,qa=Object.assign(Wn,{sync:es}),Ja=Object.assign(Dn,{stream:ts,iterate:es}),Yi=Object.assign(Cr,{glob:Cr,globSync:Dn,sync:Ja,globStream:Gn,stream:Ka,globStreamSync:ts,streamSync:Ha,globIterate:Wn,iterate:qa,globIterateSync:es,iterateSync:Qa,Glob:Te,hasMagic:$a,escape:tn,unescape:Pe});Yi.glob=Yi;var ue;(P=>{P.Level=f.enum(["DEBUG","INFO","WARN","ERROR"]).meta({ref:"LogLevel",description:"Log level"});let t={DEBUG:0,INFO:1,WARN:2,ERROR:3},i="INFO";function s(A){return t[A]>=t[i]}function n(){return i}P.getLevel=n;let o=new Map;P.Default=F({service:"default"});let h="";function l(){return h}P.file=l;let u,g,d=false,w=()=>{},S=false;async function x(A){if(d)return;if(A.print){d=true;return}A.level&&(i=A.level);let L=A.logDir||is.join(process.env.EASBOT_LOG_PATH??process.cwd(),"logs");await initLog(A),A.logFile?h=is.join(L,A.logFile??"gateway.log"):h=is.join(L,"gateway.log");try{await Mn.mkdir(L,{recursive:!0}),u=await Mn.open(h,"a"),g=createWriteStream("",{fd:u.fd,autoClose:!1}),w=M=>{if(!(S||!g||g.destroyed))try{if(!g.writable)return;g.write(M,H=>{H&&!S&&(S=!0,setTimeout(()=>{S=!1;},1e3));});}catch(H){S||(S=!0,process.stderr.write(`[LOG ERROR] Write failed: ${H}
|
|
4
|
-
`),setTimeout(()=>{S=!1;},1e3));}},d=!0;}catch(M){process.stderr.write(`[LOG ERROR] Failed to init log file: ${M}
|
|
5
|
-
`),w=H=>{try{process.stderr.write(H);}catch{}},d=true;}}P.init=x;async function C(){d&&(g&&!g.destroyed&&(await new Promise((A,L)=>{g.end(M=>{M?L(M):A();});}).catch(A=>{process.stderr.write(`[LOG ERROR] Failed to close log stream: ${A}
|
|
6
|
-
`);}),g=void 0),u&&(await u.close().catch(A=>{process.stderr.write(`[LOG ERROR] Failed to close log file: ${A}
|
|
7
|
-
`);}),u=void 0),w=A=>{try{process.stderr.write(A);}catch{}},d=false);}P.close=C;function v(A,L=0){let M=A.message;return A.cause instanceof Error&&L<10?M+" Caused by: "+v(A.cause,L+1):M}let T=Date.now();function F(A){A=A||{};let L=A.service;if(L&&typeof L=="string"){let W=o.get(L);if(W)return W}function M(W,K){let bs=Object.entries({...A,...K}).filter(([Ys,Zt])=>Zt!=null).map(([Ys,Zt])=>{let Cs=`${Ys}=`;return Zt instanceof Error?Cs+v(Zt):typeof Zt=="object"?Cs+JSON.stringify(Zt):Cs+Zt}).join(" "),Re=new Date,Yn=Re.getTime()-T;return T=Re.getTime(),[formatLogTime(Re),"+"+Yn+"ms",bs,W].filter(Boolean).join(" ")+`
|
|
8
|
-
`}let H={debug(W,K){s("DEBUG")&&w("DEBUG "+M(W,K));},info(W,K){s("INFO")&&w("INFO "+M(W,K));},error(W,K){s("ERROR")&&w("ERROR "+M(W,K));},warn(W,K){s("WARN")&&w("WARN "+M(W,K));},tag(W,K){return A&&(A[W]=K),H},clone(){return P.create({...A})},time(W,K){let bs=Date.now();H.info(W,{status:"started",...K});function Re(){H.info(W,{status:"completed",duration:Date.now()-bs,...K});}return {stop:Re,[Symbol.dispose](){Re();}}}};return L&&typeof L=="string"&&o.set(L,H),H}P.create=F;})(ue||(ue={}));a();var th=ue.create({service:"gateway:config"});f.enum(["telegram","slack","feishu","wechat","webchat","signal","nostr"]);f.enum(["low","medium","high","critical"]);var rs=f.object({enabled:f.boolean().default(true),botToken:f.string().describe("Telegram Bot Token"),webhookUrl:f.string().optional().describe("Webhook URL for receiving updates"),maxConnections:f.number().int().positive().optional().default(100),timeout:f.number().int().positive().optional().default(3e4)}),ns=f.object({enabled:f.boolean().default(true),botToken:f.string().describe("Slack Bot Token (xoxb-*)"),appToken:f.string().optional().describe("Slack App Token (xapp-*) for Socket Mode"),signingSecret:f.string().optional().describe("Slack Signing Secret for webhook verification"),maxConnections:f.number().int().positive().optional().default(100),timeout:f.number().int().positive().optional().default(3e4)}),os=f.object({enabled:f.boolean().default(true),appId:f.string().describe("Feishu App ID"),appSecret:f.string().describe("Feishu App Secret"),encryptKey:f.string().optional().describe("Feishu Encrypt Key for message encryption"),verificationToken:f.string().optional().describe("Feishu Verification Token"),maxConnections:f.number().int().positive().optional().default(100),timeout:f.number().int().positive().optional().default(3e4)}),as=f.object({enabled:f.boolean().default(true),mode:f.enum(["official","wecom"]).default("official"),appId:f.string().describe("WeChat App ID"),appSecret:f.string().describe("WeChat App Secret"),token:f.string().optional().describe("WeChat Token for message verification"),encodingAESKey:f.string().optional().describe("WeChat Encoding AES Key"),agentId:f.string().optional().describe("WeCom Agent ID"),maxConnections:f.number().int().positive().optional().default(100),timeout:f.number().int().positive().optional().default(3e4)}),hs=f.object({enabled:f.boolean().default(true),path:f.string().optional().default("/ws"),heartbeatInterval:f.number().int().positive().optional().default(3e4),connectionTimeout:f.number().int().positive().optional().default(6e4),maxConnections:f.number().int().positive().optional().default(1e3),cors:f.boolean().optional().default(true)}),ls=f.object({enabled:f.boolean().default(true),serviceUrl:f.string().optional().default("https://chat.signal.org"),phoneNumber:f.string().describe("Signal phone number"),password:f.string().optional().describe("Signal account password"),maxConnections:f.number().int().positive().optional().default(100),timeout:f.number().int().positive().optional().default(3e4)}),cs=f.object({enabled:f.boolean().default(true),relays:f.array(f.string()).min(1).describe("Nostr relay URLs"),privateKey:f.string().optional().describe("Nostr private key (hex)"),publicKey:f.string().optional().describe("Nostr public key (hex)"),maxConnections:f.number().int().positive().optional().default(100),timeout:f.number().int().positive().optional().default(3e4)}),_n=f.object({telegram:rs.optional(),slack:ns.optional(),feishu:os.optional(),wechat:as.optional(),webchat:hs.optional(),signal:ls.optional(),nostr:cs.optional()}),jn=f.object({enabled:f.boolean().default(false),cert:f.string().describe("Path to SSL certificate file (\u6216 certPath)"),key:f.string().describe("Path to SSL key file (\u6216 keyPath)"),certPath:f.string().optional().describe("Path to SSL certificate file (alias of cert)"),keyPath:f.string().optional().describe("Path to SSL key file (alias of key)"),ca:f.string().optional().describe("Path to CA certificate file"),forceRedirect:f.boolean().optional().default(false).describe("Force redirect HTTP to HTTPS"),httpPort:f.number().int().positive().optional().default(80).describe("HTTP redirect port")}),eh=f.object({name:f.string().describe("Token name/description"),value:f.string().describe("Token value"),permissions:f.array(f.string()).default(["*"]).describe("Associated permissions"),expiresAt:f.number().int().positive().optional().describe("Expiration timestamp (Unix timestamp)"),description:f.string().optional().describe("Token description")}),ih=f.object({enabled:f.boolean().default(true),tokens:f.array(eh).default([]).describe("List of valid tokens"),onInvalid:f.enum(["reject","anonymous"]).default("reject").describe("Behavior when token validation fails"),allowAnonymous:f.boolean().default(false).describe("Allow anonymous access"),defaultPermissions:f.array(f.string()).default([]).describe("Default permissions for anonymous users")}),sh=f.object({enabled:f.boolean().default(false),authorizationServer:f.string().describe("OAuth2 authorization server URL"),clientId:f.string().describe("OAuth2 client ID"),clientSecret:f.string().describe("OAuth2 client secret"),tokenValidationEndpoint:f.string().describe("OAuth2 token validation endpoint"),scope:f.array(f.string()).default([]).describe("OAuth2 scopes")}),In=f.object({type:f.enum(["token","oauth2"]).default("token"),token:ih.optional(),oauth2:sh.optional()}),zn=f.object({mode:f.enum(["pull","push","both"]).default("both"),interval:f.number().int().positive().default(3e4),pushEvents:f.array(f.enum(["register","deregister","heartbeat","status_change"])).default(["register","deregister","status_change"]),conflictResolution:f.enum(["latest","local","remote"]).default("latest")}),rh=f.object({id:f.string().describe("Gateway node ID"),address:f.string().describe("Gateway node address (e.g., http://localhost:3001)"),enabled:f.boolean().default(true),metadata:f.record(f.string(),f.any()).optional()}),Bn=f.object({nodeId:f.string().describe("Current gateway node ID"),nodes:f.array(rh).default([]).describe("Other gateway nodes in the cluster"),sync:zn.optional()}),fs=f.object({maxConnectionsPerChannel:f.number().int().positive().default(100),idleTimeout:f.number().int().positive().default(3e5),reuseStrategy:f.enum(["lru","fifo","random"]).default("lru"),healthCheckInterval:f.number().int().positive().default(6e4),acquireTimeout:f.number().int().positive().default(5e3),warmupCount:f.number().int().nonnegative().default(0).describe("Number of connections to warm up")}),us=f.object({maxLength:f.number().int().positive().default(1e4),concurrency:f.number().int().positive().default(100),batchSize:f.number().int().positive().default(10),batchTimeout:f.number().int().positive().default(100),priorityLevels:f.number().int().positive().default(4)}),ps=f.object({failureThreshold:f.number().int().positive().default(5),successThreshold:f.number().int().positive().default(3),timeout:f.number().int().positive().default(3e4),halfOpenDuration:f.number().int().positive().default(15e3)}),ds=f.object({heartbeatInterval:f.number().int().positive().default(3e4),heartbeatTimeout:f.number().int().positive().default(9e4),heartbeatCheckInterval:f.number().int().positive().default(1e4),autoDeregisterTimeout:f.number().int().positive().default(3e5),maxAgents:f.number().int().positive().default(100),persistenceFile:f.string().optional().describe("Path to persist agent registrations"),maxRegistrations:f.number().int().positive().default(1e3)}),gs=f.object({sessionTimeout:f.number().int().positive().default(18e5),resumeGracePeriod:f.number().int().positive().default(3e5),maxSessions:f.number().int().positive().default(1e4),persistenceFile:f.string().optional().describe("Path to persist sessions")}),ms=f.object({enabled:f.boolean().default(true),port:f.number().int().positive().default(8080),hostname:f.string().default("localhost"),path:f.string().optional().default("/ws"),maxConnections:f.number().int().positive().optional().default(1e3),connectionTimeout:f.number().int().positive().optional().default(6e4),heartbeatInterval:f.number().int().positive().optional().default(3e4),sessionExpireMs:f.number().int().positive().optional().default(3e5),https:jn.optional(),auth:In.optional(),cors:f.boolean().default(true),corsOrigins:f.array(f.string()).optional(),mdns:f.boolean().default(false),mdnsDomain:f.string().optional().default("gateway.easbot.local")}),ss=f.object({server:ms.optional(),channels:_n.optional(),cluster:Bn.optional(),connectionPool:fs.optional(),messageQueue:us.optional(),circuitBreaker:ps.optional(),agentRegistry:ds.optional(),session:gs.optional(),defaultAgent:f.string().optional().describe("Default agent ID for routing"),logLevel:f.enum(["DEBUG","INFO","WARN","ERROR"]).optional().default("INFO")}).catchall(f.unknown());function ys(e){let t=ss.safeParse(e);return t.success||th.warn("Invalid gateway config",{issues:t.error.issues}),t.success?t.data:ss.parse({})}function nh(e){return ss.parse(e)}a();a();a();ue.create({service:"gateway:interfaces"});var Jt;function Qn(){return Jt!==void 0}function qn(){throw new Error("Agent adapter not set. Call setAgentAdapter() before using Gateway.");}var bh={Path:{data:".easbot"}},Ch={directory:process.cwd()},Js=class{async load(t){return qs(t)}},Sh=new Js;function $l(){return Sh}function Jn(){return bh}function Vs(){return Ch}var Vt=ue.create({service:"gateway:config"}),Un={enabled:true,port:8080,hostname:"localhost",path:"/",maxConnections:1e3,connectionTimeout:6e4,heartbeatInterval:3e4,sessionExpireMs:3e5,cors:true,mdns:false,mdnsDomain:"gateway.easbot.local",https:{enabled:false,cert:"",key:"",certPath:void 0,keyPath:void 0,ca:void 0,forceRedirect:false,httpPort:80}},xh={maxConnectionsPerChannel:100,idleTimeout:3e5,reuseStrategy:"lru",healthCheckInterval:6e4,acquireTimeout:5e3,warmupCount:0},Eh={maxLength:1e4,concurrency:100,batchSize:10,batchTimeout:100,priorityLevels:4},Ah={failureThreshold:5,successThreshold:3,timeout:3e4,halfOpenDuration:15e3},kh={heartbeatInterval:3e4,heartbeatTimeout:9e4,heartbeatCheckInterval:1e4,autoDeregisterTimeout:3e5,maxAgents:100,maxRegistrations:1e3},Th={sessionTimeout:18e5,resumeGracePeriod:3e5,maxSessions:1e4},Rh={enabled:true,botToken:"",maxConnections:100,timeout:3e4},Oh={enabled:true,botToken:"",maxConnections:100,timeout:3e4},Fh={enabled:true,appId:"",appSecret:"",maxConnections:100,timeout:3e4},Ph={enabled:true,mode:"official",appId:"",appSecret:"",maxConnections:100,timeout:3e4},Lh={enabled:true,path:"/ws",heartbeatInterval:3e4,connectionTimeout:6e4,maxConnections:1e3,cors:true},Nh={enabled:true,serviceUrl:"https://chat.signal.org",phoneNumber:"",maxConnections:100,timeout:3e4},Gh={enabled:true,relays:[],maxConnections:100,timeout:3e4},Pi,He=null;async function Zn(e){try{if(!existsSync(e))return null;let i=(await Mn.readFile(e,"utf-8")).replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim();return i?JSON.parse(i):null}catch(t){return Vt.debug("Failed to load config file",{file:e,error:String(t)}),null}}function Zs(e,t){let i={...e,...t};return (e.server||t.server)&&(i.server={...e.server,...t.server}),(e.channels||t.channels)&&(i.channels={...e.channels,...t.channels}),i}async function Dh(){let e=Jn(),t=Vs(),i=[],s=is.join(e.Path.data,"config");i.push(s),i.push(t.directory);try{let{Filesystem:o}=await import('@easbot/utils'),a=await Array.fromAsync(o.up({targets:[".easbot"],start:t.directory}));i.push(...a);let h=process.env.HOME||process.env.USERPROFILE;if(h){let l=is.join(h,".easbot");existsSync(l)&&i.push(l);}}catch{Vt.debug("Filesystem utils not available, using basic directories");}let n=process.env.EASBOT_CONFIG_DIR;return n&&(i.push(n),Vt.debug("Using EASBOT_CONFIG_DIR",{path:n})),[...new Set(i)]}async function Wh(e){let t=["gateway.jsonc","gateway.json"],i={};for(let s of t){let n=is.join(e,s),o=await Zn(n);o&&(i=Zs(i,o),Vt.debug("Loaded gateway config from file",{file:n}));}return i}async function Mh(e){let t=["easbot.jsonc","easbot.json"];for(let i of t){let s=is.join(e,i),n=await Zn(s);if(n?.gateway)return Vt.debug("Loaded gateway config from easbot.json",{file:s}),n.gateway}return {}}function _h(){return Pi||(Pi=async()=>{let e=await Dh(),t={};for(let s of e){let n=await Wh(s);t=Zs(t,n);let o=await Mh(s);t=Zs(t,o);}let i=ys(t);return He=i,Vt.info("Gateway config loaded",{directories:e.length,port:i.server?.port,logLevel:i.logLevel}),{config:i,directories:e}}),Pi}async function mt(){return _h()()}async function qs(e){return e&&(Pi=void 0,He=null),(await mt()).config}function $n(){return He}function Hn(){return He!==null}function oh(){Pi=void 0,He=null,Vt.debug("Config cache cleared");}function ah(){return Vs().directory}async function hh(){let{config:e}=await mt();return ms.parse({...Un,...e.server})}async function lh(e){let{config:t}=await mt(),i=t.channels?.[e],n={telegram:rs.parse(Rh),slack:ns.parse(Oh),feishu:os.parse(Fh),wechat:as.parse(Ph),webchat:hs.parse(Lh),signal:ls.parse(Nh),nostr:cs.parse(Gh)}[e];if(!n)throw new Error(`Unknown channel type: ${e}`);return {...n,...i}}async function ch(){let{config:e}=await mt();return fs.parse({...xh,...e.connectionPool})}async function fh(){let{config:e}=await mt();return us.parse({...Eh,...e.messageQueue})}async function uh(){let{config:e}=await mt();return ps.parse({...Ah,...e.circuitBreaker})}async function ph(){let{config:e}=await mt();return ds.parse({...kh,...e.agentRegistry})}async function dh(){let{config:e}=await mt();return gs.parse({...Th,...e.session})}async function gh(){let{config:e}=await mt();return e.server?.https}async function mh(){let{config:e}=await mt();return e.server?.auth}async function yh(){let{config:e}=await mt();return e.cluster}async function wh(){let{config:e}=await mt();return e.defaultAgent}async function Kn(){let{config:e}=await mt();return e.logLevel??"INFO"}
|
|
9
|
-
export{oh as A,ah as B,hh as C,lh as D,ch as E,fh as F,uh as G,ph as H,dh as I,gh as J,mh as K,yh as L,wh as M,Kn as N,Qn as O,qn as P,$l as Q,Jn as R,Vs as S,ue as a,rs as b,ns as c,os as d,as as e,hs as f,ls as g,cs as h,_n as i,jn as j,In as k,zn as l,Bn as m,fs as n,us as o,ps as p,ds as q,gs as r,ms as s,ss as t,ys as u,nh as v,Un as w,qs as x,$n as y,Hn as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$2,Q,S as S$1}from'./chunk-ETYFY7SI.mjs';import {a as a$1}from'./chunk-SJNPXLNN.mjs';import {e}from'./chunk-TY6W6O7O.mjs';a$1();var a=a$2.create({service:"gateway"}),c=class t extends Error{constructor(e$1,w,m){super(e$1);e(this,"type");e(this,"stage");e(this,"cause");this.type="GatewayInitializationError",this.stage=w,this.cause=m,Error.captureStackTrace&&Error.captureStackTrace(this,t);}};function S(t){let s=["ECONNRESET","EPIPE","ETIMEDOUT","ECONNREFUSED","ENOTFOUND","EHOSTUNREACH","ENETUNREACH"],e=t.code;return s.includes(e??"")}function z(){process.on("unhandledRejection",t=>{let s=t instanceof Error?t:new Error(String(t));if(a.error("unhandled promise rejection",{error:s.message,stack:s.stack}),S(s)){a.warn("recoverable network error, continuing...",{code:s.code});return}}),process.on("uncaughtException",t=>{if(a.error("uncaught exception",{error:t.message,stack:t.stack}),S(t)){a.warn("recoverable network error, continuing...",{code:t.code});return}process.exit(1);});}var h;(F=>{let t={initialized:false,initPromise:null,directory:".easbot",config:null},s,e={server:null,config:null,initialized:false,status:"stopped"};async function w(o={}){if(t.initialized)return;if(t.initPromise)return t.initPromise;let i={directory:o.directory??".easbot",printLogs:o.printLogs??false,logLevel:o.logLevel??"INFO"};return t.directory=i.directory,t.initPromise=(async()=>{let{Global:n}=await import('./global-KXPT44QD.mjs');try{await n.init();}catch(r){throw new c("Failed to initialize global directories","global",r instanceof Error?r:void 0)}try{await a$2.init({logDir:n.Path.log,print:i.printLogs,level:i.logLevel});}catch(r){throw new c("Failed to initialize log infrastructure","log",r instanceof Error?r:void 0)}try{z();}catch(r){throw new c("Failed to install unhandled exception handlers","server",r instanceof Error?r:void 0)}try{let r=Q();t.config=await r.load(i.directory);}catch(r){throw new c("Failed to load gateway configuration","config",r instanceof Error?r:void 0)}t.initialized=true,a.info("gateway runtime initialized",{directory:i.directory,logLevel:i.logLevel});})(),t.initPromise}F.init=w;function m(){return t.initialized}F.isInitialized=m;function b(){return s||(s=async()=>{if(!t.initialized)throw new c("Gateway not initialized. Call init() first.","server");let o=Q(),i=S$1(),n=await o.load(i.directory);return n.server?.enabled?(e={server:null,config:n,initialized:true,status:"stopped"},a.info("gateway initialized",{port:n.server?.port,hostname:n.server?.hostname}),e):(a.debug("gateway server disabled or not configured"),{server:null,config:n,initialized:true,status:"stopped"})}),s}function u(){return b()()}F.state=u;async function R(){return (await u()).server}F.get=R;async function N(){return (await u()).config?.server?.enabled??false}F.isEnabled=N;async function L(){return (await u()).config}F.config=L;function T(){return e.status}F.getStatus=T;async function P(o){t.initialized||await w();let i=await u();if(!(i.config?.server?.enabled??true))throw a.warn("gateway server is disabled"),new Error("Gateway server is disabled");if(e.status==="running"){a.info("gateway server is already running");return}if(e.status==="starting"){a.info("gateway server is starting");return}e.status="starting";try{let r={...i.config?.server,...o},g=await x(r);e.server=g,e.status="running",e.error=void 0,a.info("gateway server started",{port:r.port,hostname:r.hostname});}catch(r){throw e.status="error",e.error=r instanceof Error?r.message:String(r),a.error("failed to start gateway server",{error:e.error}),r}}F.start=P;async function G(){if(e.status==="stopped"){a.info("gateway server is already stopped");return}if(e.status==="stopping"){a.info("gateway server is stopping");return}e.status="stopping";try{e.server&&await e.server.stop(),e.server=null,e.status="stopped",e.error=void 0,a.info("gateway server stopped");}catch(o){throw e.status="error",e.error=o instanceof Error?o.message:String(o),a.error("failed to stop gateway server",{error:e.error}),o}}F.stop=G;async function I(o){a.info("restarting gateway server"),(e.status==="running"||e.status==="starting")&&await G(),await P(o);}F.restart=I;async function k(){let o=Q(),i=S$1(),n=await o.load(i.directory);return e.config=n,t.config=n,a.info("gateway config reloaded"),n}F.reloadConfig=k;async function x(o,i){let{GatewayServer:n}=await import('./server-GVEVKN4C.mjs'),r=new n(o),g=i?.startupTimeout??3e4;if(await(async()=>{let l=new Promise((d,C)=>{setTimeout(()=>{C(new Error(`Gateway server startup timeout after ${g}ms`));},g);});try{await Promise.race([r.start(),l]);}catch(d){a.error("gateway server start failed, attempting cleanup",{error:d instanceof Error?d.message:String(d)});try{await r.stop();}catch{}throw d}})(),i?.onStarted)try{await i.onStarted(r);}catch(l){a.warn("server started but onStarted callback failed",{error:l instanceof Error?l.message:String(l)});}return a.info("gateway server created and started",{port:o.port,hostname:o.hostname}),r}F.createGatewayServer=x;})(h||(h={}));export{h as a};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var s={name:"@easbot/gateway",version:"0.1.15",description:"EASBot Gateway - AI Agent Server and Multi-channel Integration Platform - \u652F\u6301 WebSocket\u3001HTTP\u3001Discord\u3001Telegram\u3001Slack \u7B49\u591A\u6E20\u9053\u96C6\u6210",type:"module",main:"dist/index.cjs",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.cjs"},"./package.json":"./package.json"},scripts:{dev:"cross-env NODE_ENV=development tsx src/cli.ts -- start",start:"cross-env NODE_ENV=production node dist/cli.mjs start",build:"tsup --env.NODE_ENV production",test:"vitest","test:run":"vitest run",lint:"biome check .","lint:fix":"biome check --write .","lint:report":"biome check --reporter=summary .",format:"biome format .","format:fix":"biome format --write .","type-check":"tsc --noEmit",clean:"npx rimraf dist node_modules",prepare:"echo norun",prepublishOnly:"pnpm build","publish:npm":"bash scripts/publish.sh","publish:npm:win":"powershell -ExecutionPolicy Bypass -File scripts/publish.ps1"},keywords:["easbot","gateway","server","websocket","http","agent","multi-channel","discord","telegram","slack","feishu","wechat","chat","integration"],author:"houjallen",license:"MIT",repository:{type:"git",url:"https://github.com/houjallen/easbot.git",directory:"packages/gateway"},homepage:"https://github.com/houjallen/easbot/tree/main/packages/gateway#readme",bugs:{url:"https://github.com/houjallen/easbot/issues"},files:["dist","README.md","README.en.md","LICENSE"],dependencies:{"@ai-sdk/provider":"^3.0.8","@ai-sdk/provider-utils":"^4.0.21","@ai-sdk/openai-compatible":"2.0.37","@ai-sdk/anthropic":"3.0.63","@easbot/plugin":"workspace:*","@easbot/sdk":"workspace:*","@easbot/types":"workspace:*","@easbot/utils":"workspace:*",zod:"^4.3.6",ws:"^8.20.0",ai:"^6.0.136","better-sqlite3":"^12.9.0","jieba-wasm":"^2.4.0","xdg-basedir":"^5.1.0"},devDependencies:{"@biomejs/biome":"^2.4.8","@types/better-sqlite3":"^7.6.13","@types/ws":"^8.18.1","@types/node":"^22.17.0","@vitest/coverage-v8":"^4.1.1",dotenv:"^17.3.1",tsup:"^8.5.1",typescript:"^6.0.2",vitest:"^4.1.1"},engines:{node:">=22.17.0"},publishConfig:{access:"public"}};
|
|
2
|
-
export{s as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkBOHNPDOJ_cjs=require('./chunk-BOHNPDOJ.cjs');require('./chunk-XQVVSJRM.cjs');module.exports=chunkBOHNPDOJ_cjs.a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as default}from'./chunk-VVZG6LF6.mjs';import'./chunk-TY6W6O7O.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkCTTZF7B6_cjs=require('./chunk-CTTZF7B6.cjs');require('./chunk-EKLLH53Y.cjs'),require('./chunk-SIOB4FC7.cjs'),require('./chunk-XQVVSJRM.cjs');Object.defineProperty(exports,"ChannelPluginLoader",{enumerable:true,get:function(){return chunkCTTZF7B6_cjs.q}});Object.defineProperty(exports,"GatewayServer",{enumerable:true,get:function(){return chunkCTTZF7B6_cjs.s}});Object.defineProperty(exports,"GatewayWebSocketServer",{enumerable:true,get:function(){return chunkCTTZF7B6_cjs.r}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{q as ChannelPluginLoader,s as GatewayServer,r as GatewayWebSocketServer}from'./chunk-YAKKDECJ.mjs';import'./chunk-ETYFY7SI.mjs';import'./chunk-SJNPXLNN.mjs';import'./chunk-TY6W6O7O.mjs';
|