@easbot/gateway 0.2.1 → 0.2.3
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-34MFQLJP.cjs +2 -0
- package/dist/chunks/chunk-4PHQN25U.cjs +2 -0
- package/dist/chunks/chunk-5ETPYYQR.cjs +7 -0
- package/dist/chunks/chunk-6TRL3CVJ.mjs +7 -0
- package/dist/chunks/chunk-AVBAZ6OJ.cjs +1 -0
- package/dist/chunks/{chunk-5RLC2FW2.mjs → chunk-GRBXQALD.mjs} +1 -1
- package/dist/chunks/chunk-GY3SWWW3.cjs +1 -0
- package/dist/chunks/chunk-HAMGVOQD.mjs +1 -0
- package/dist/chunks/chunk-K2WP2GA3.mjs +2 -0
- package/dist/chunks/chunk-KT3LOK7X.mjs +1 -0
- package/dist/chunks/{chunk-2DDZUOLB.cjs → chunk-OTZE7MGS.cjs} +1 -1
- package/dist/chunks/chunk-YU4JG7OA.mjs +2 -0
- package/dist/chunks/global-N3LSJP4X.mjs +1 -0
- package/dist/chunks/global-VJ6XBERK.cjs +1 -0
- package/dist/chunks/log-B5SORET6.cjs +1 -0
- package/dist/chunks/log-K67H67P2.mjs +1 -0
- package/dist/chunks/package-LIXBTRLN.mjs +1 -0
- package/dist/chunks/package-ZAW6IG3H.cjs +1 -0
- package/dist/chunks/server-C5W7D4CU.mjs +1 -0
- package/dist/chunks/server-HQL7QNZY.cjs +1 -0
- package/dist/cli.cjs +7 -32
- package/dist/cli.mjs +7 -32
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +14 -52
- package/dist/index.d.ts +14 -52
- package/dist/index.mjs +8 -8
- package/package.json +25 -17
- package/dist/chunks/chunk-NJHJCACX.cjs +0 -2
- package/dist/chunks/chunk-O3U6QY4W.mjs +0 -2
- package/dist/chunks/chunk-OSZ6KMPF.cjs +0 -1
- package/dist/chunks/chunk-P3MN336E.cjs +0 -8
- package/dist/chunks/chunk-SIOB4FC7.cjs +0 -1
- package/dist/chunks/chunk-SJNPXLNN.mjs +0 -1
- package/dist/chunks/chunk-SSKI3TXN.mjs +0 -8
- package/dist/chunks/chunk-TY6W6O7O.mjs +0 -1
- package/dist/chunks/chunk-UCF5C44I.mjs +0 -1
- package/dist/chunks/chunk-XQVVSJRM.cjs +0 -1
- package/dist/chunks/global-BCWJXCJA.cjs +0 -1
- package/dist/chunks/global-C2YB6FKX.mjs +0 -1
- package/dist/chunks/package-HISKEB3S.cjs +0 -1
- package/dist/chunks/package-VYOXRMBW.mjs +0 -1
- package/dist/chunks/server-5P63VGLE.mjs +0 -1
- package/dist/chunks/server-EFOLB7OJ.cjs +0 -1
|
@@ -1,8 +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 ss,{win32,posix}from'path';import _n,{realpath,readlink,readdir,lstat}from'fs/promises';import*as da 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 fn from'stream';import {StringDecoder}from'string_decoder';import {initLog,formatLogTime}from'@easbot/utils';a();a();var Kr=(e,t,i)=>{let s=e instanceof RegExp?tr(e,i):e,n=t instanceof RegExp?tr(t,i):t,o=s!==null&&n!=null&&to(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)}},tr=(e,t)=>{let i=t.match(e);return i?i[0]:null},to=(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},Qr="\0SLASH"+Math.random()+"\0",qr="\0OPEN"+Math.random()+"\0",$s="\0CLOSE"+Math.random()+"\0",Jr="\0COMMA"+Math.random()+"\0",Vr="\0PERIOD"+Math.random()+"\0",eo=new RegExp(Qr,"g"),io=new RegExp(qr,"g"),so=new RegExp($s,"g"),ro=new RegExp(Jr,"g"),no=new RegExp(Vr,"g"),oo=/\\\\/g,ao=/\\{/g,ho=/\\}/g,lo=/\\,/g,co=/\\./g,fo=1e5;function vs(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function uo(e){return e.replace(oo,Qr).replace(ao,qr).replace(ho,$s).replace(lo,Jr).replace(co,Vr)}function po(e){return e.replace(eo,"\\").replace(io,"{").replace(so,"}").replace(ro,",").replace(no,".")}function Zr(e){if(!e)return [""];let t=[],i=Kr("{","}",e);if(!i)return e.split(",");let{pre:s,body:n,post:o}=i,a=s.split(",");a[a.length-1]+="{"+n+"}";let h=Zr(o);return o.length&&(a[a.length-1]+=h.shift(),a.push.apply(a,h)),t.push.apply(t,a),t}function go(e,t={}){if(!e)return [];let{max:i=fo}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Xe(uo(e),i,true).map(po)}function mo(e){return "{"+e+"}"}function yo(e){return /^-?0\d/.test(e)}function wo(e,t){return e<=t}function bo(e,t){return e>=t}function Xe(e,t,i){let s=[],n=Kr("{","}",e);if(!n)return [e];let o=n.pre,a=n.post.length?Xe(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+$s+n.post,Xe(e,t,true)):[e];let d;if(u)d=n.body.split(/\.\./);else if(d=Zr(n.body),d.length===1&&d[0]!==void 0&&(d=Xe(d[0],t,false).map(mo),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=vs(d[0]),x=vs(d[1]),C=Math.max(d[0].length,d[1].length),E=d.length===3&&d[2]!==void 0?Math.abs(vs(d[2])):1,v=wo;x<S&&(E*=-1,v=bo);let k=d.some(yo);w=[];for(let O=S;v(O,x);O+=E){let P;if(l)P=String.fromCharCode(O),P==="\\"&&(P="");else if(P=String(O),k){let L=C-P.length;if(L>0){let F=new Array(L+1).join("0");O<0?P="-"+F+P.slice(1):P=F+P;}}w.push(P);}}else {w=[];for(let S=0;S<d.length;S++)w.push.apply(w,Xe(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 Vi=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},Co={"[: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]},Qe=e=>e.replace(/[[\]\\-]/g,"\\$&"),So=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),er=e=>e.join(""),vo=(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,k]]of Object.entries(Co))if(e.startsWith(C,o)){if(d)return ["$.",false,e.length-i,true];o+=C.length,k?n.push(E):s.push(E),h=h||v;continue t}}if(l=false,d){x>d?s.push(Qe(d)+"-"+Qe(x)):x===d&&s.push(Qe(x)),d="",o++;continue}if(e.startsWith("-]",o+1)){s.push(Qe(x+"-")),o+=2;continue}if(e.startsWith("-",o+1)){d=x,o+=2;continue}s.push(Qe(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 [So(x),false,g-i,false]}let w="["+(u?"^":"")+er(s)+"]",S="["+(u?"":"^")+er(n)+"]";return [s.length&&n.length?"("+w+"|"+S+")":s.length?w:S,h,g-i,true]},Le=(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"),xo=new Set(["!","?","+","*","@"]),ir=e=>xo.has(e),Eo="(?!(?:^|/)\\.\\.?(?:$|/))",Gi="(?!\\.)",Ao=new Set(["[","."]),ko=new Set(["..","."]),To=new Set("().*{}+?[]^$\\!"),Ro=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Hs="[^/]",sr=Hs+"*?",rr=Hs+"+?",U,V,Ut,D,j,re,ye,ne,Mt,we,oi,Te,Xr,fe,X,Bi,Fs,tn,Yr=(X=class{constructor(t,i,s={}){g(this,Te);e(this,"type");g(this,U);g(this,V);g(this,Ut,false);g(this,D,[]);g(this,j);g(this,re);g(this,ye);g(this,ne,false);g(this,Mt);g(this,we);g(this,oi,false);this.type=t,t&&h(this,V,true),h(this,j,i),h(this,U,f$1(this,j)?f$1(f$1(this,j),U):this),h(this,Mt,f$1(this,U)===this?s:f$1(f$1(this,U),Mt)),h(this,ye,f$1(this,U)===this?[]:f$1(f$1(this,U),ye)),t==="!"&&!f$1(f$1(this,U),ne)&&f$1(this,ye).push(this),h(this,re,f$1(this,j)?f$1(f$1(this,j),D).length:0);}get hasMagic(){if(f$1(this,V)!==void 0)return f$1(this,V);for(let t of f$1(this,D))if(typeof t!="string"&&(t.type||t.hasMagic))return h(this,V,true);return f$1(this,V)}toString(){return f$1(this,we)!==void 0?f$1(this,we):this.type?h(this,we,this.type+"("+f$1(this,D).map(t=>String(t)).join("|")+")"):h(this,we,f$1(this,D).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,D).push(i);}}toJSON(){let t=this.type===null?f$1(this,D).slice().map(i=>typeof i=="string"?i:i.toJSON()):[this.type,...f$1(this,D).map(i=>i.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===f$1(this,U)||f$1(f$1(this,U),ne)&&f$1(this,j)?.type==="!")&&t.push({}),t}isStart(){if(f$1(this,U)===this)return true;if(!f$1(this,j)?.isStart())return false;if(f$1(this,re)===0)return true;let t=f$1(this,j);for(let i=0;i<f$1(this,re);i++){let s=f$1(t,D)[i];if(!(s instanceof X&&s.type==="!"))return false}return true}isEnd(){if(f$1(this,U)===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),D).length:0;return f$1(this,re)===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,D))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,fe,Bi).call(n,t,s,0,i$1),s}toMMPattern(){if(this!==f$1(this,U))return f$1(this,U).toMMPattern();let t=this.toString(),[i,s,n,o]=this.toRegExpSource();if(!(n||f$1(this,V)||f$1(this,Mt).nocase&&!f$1(this,Mt).nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let a=(f$1(this,Mt).nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${i}$`,a),{_src:i,_glob:t})}get options(){return f$1(this,Mt)}toRegExpSource(t){let i$1=t??!!f$1(this,Mt).dot;if(f$1(this,U)===this&&i(this,Te,Xr).call(this),!this.type){let l=this.isStart()&&this.isEnd()&&!f$1(this,D).some(w=>typeof w!="string"),u=f$1(this,D).map(w=>{var v;let[S,x,C,E]=typeof w=="string"?i(v=X,fe,tn).call(v,w,f$1(this,V),l):w.toRegExpSource(t);return h(this,V,f$1(this,V)||C),h(this,Ut,f$1(this,Ut)||E),S}).join(""),g="";if(this.isStart()&&typeof f$1(this,D)[0]=="string"&&!(f$1(this,D).length===1&&ko.has(f$1(this,D)[0]))){let w=Ao,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?Eo:x?Gi:"";}let d="";return this.isEnd()&&f$1(f$1(this,U),ne)&&f$1(this,j)?.type==="!"&&(d="(?:$|\\/)"),[g+u+d,Le(u),h(this,V,!!f$1(this,V)),f$1(this,Ut)]}let s=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",o=i(this,Te,Fs).call(this,i$1);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return h(this,D,[l]),this.type=null,h(this,V,void 0),[l,Le(this.toString()),false,false]}let a=!s||t||i$1||!Gi?"":i(this,Te,Fs).call(this,true);a===o&&(a=""),a&&(o=`(?:${o})(?:${a})*?`);let h$1="";if(this.type==="!"&&f$1(this,oi))h$1=(this.isStart()&&!i$1?Gi:"")+rr;else {let l=this.type==="!"?"))"+(this.isStart()&&!i$1&&!t?Gi:"")+sr+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;h$1=n+o+l;}return [h$1,Le(o),h(this,V,!!f$1(this,V)),f$1(this,Ut)]}},U=new WeakMap,V=new WeakMap,Ut=new WeakMap,D=new WeakMap,j=new WeakMap,re=new WeakMap,ye=new WeakMap,ne=new WeakMap,Mt=new WeakMap,we=new WeakMap,oi=new WeakMap,Te=new WeakSet,Xr=function(){if(this!==f$1(this,U))throw new Error("should only call on root");if(f$1(this,ne))return this;this.toString(),h(this,ne,true);let t;for(;t=f$1(this,ye).pop();){if(t.type!=="!")continue;let i=t,s=f$1(i,j);for(;s;){for(let n=f$1(i,re)+1;!s.type&&n<f$1(s,D).length;n++)for(let o of f$1(t,D)){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(f$1(s,D)[n]);}i=s,s=f$1(i,j);}}return this},fe=new WeakSet,Bi=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&&ir(v)&&t.charAt(C)==="("){i$1.push(E),E="";let k=new X(v,i$1);C=i(S=X,fe,Bi).call(S,t,k,C,n),i$1.push(k);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(ir(C)&&t.charAt(u)==="("){g.push(w),w="";let E=new X(C,g);g.push(E),u=i(x=X,fe,Bi).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,D).length===0&&h(i$1,oi,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,D,[t.substring(s-1)]),u},Fs=function(t){return f$1(this,D).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,Ut,f$1(this,Ut)||a),s}).filter(i=>!(this.isStart()&&this.isEnd())||!!i).join("|")},tn=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+=(To.has(u)?"\\":"")+u;continue}if(u==="*"){if(h)continue;h=true,o+=s&&/^[*]+$/.test(t)?rr:sr,i=true;continue}else h=false;if(u==="\\"){l===t.length-1?o+="\\\\":n=true;continue}if(u==="["){let[g,d,w,S]=vo(t,l);if(w){o+=g,a=a||d,l+=w-1,i=i||S;continue}}if(u==="?"){o+=Hs,i=true;continue}o+=Ro(u);}return [o,Le(t),!!i,a]},g(X,fe),X),en=(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={})=>(Vi(t),!i.nocomment&&t.charAt(0)==="#"?false:new ue(t,i).match(e)),Oo=/^\*+([^+@!?\*\[\(]*)$/,Fo=e=>t=>!t.startsWith(".")&&t.endsWith(e),Po=e=>t=>t.endsWith(e),Lo=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),No=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Go=/^\*+\.\*+$/,Do=e=>!e.startsWith(".")&&e.includes("."),Wo=e=>e!=="."&&e!==".."&&e.includes("."),Mo=/^\.\*+$/,_o=e=>e!=="."&&e!==".."&&e.startsWith("."),Io=/^\*+$/,jo=e=>e.length!==0&&!e.startsWith("."),zo=e=>e.length!==0&&e!=="."&&e!=="..",Bo=/^\?+([^+@!?\*\[\(]*)?$/,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=rn([e]);return t?(t=t.toLowerCase(),s=>i(s)&&s.toLowerCase().endsWith(t)):i},Ho=([e,t=""])=>{let i=rn([e]);return t?s=>i(s)&&s.endsWith(t):i},Ko=([e,t=""])=>{let i=sn([e]);return t?s=>i(s)&&s.endsWith(t):i},sn=([e])=>{let t=e.length;return i=>i.length===t&&!i.startsWith(".")},rn=([e])=>{let t=e.length;return i=>i.length===t&&i!=="."&&i!==".."},nn=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",nr={win32:{sep:"\\"},posix:{sep:"/"}},Qo=nn==="win32"?nr.win32.sep:nr.posix.sep;at.sep=Qo;var ot=Symbol("globstar **");at.GLOBSTAR=ot;var qo="[^/]",Jo=qo+"*?",Vo="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Zo="(?:(?!(?:\\/|^)\\.).)*?",Yo=(e,t={})=>i=>at(i,e,t);at.filter=Yo;var bt=(e,t={})=>Object.assign({},e,t),Xo=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return at;let t=at;return Object.assign((i,s,n={})=>t(i,s,bt(e,n)),{Minimatch:class extends t.Minimatch{constructor(i,s={}){super(i,bt(e,s));}static defaults(i){return t.defaults(bt(e,i)).Minimatch}},AST:class extends t.AST{constructor(i,s,n={}){super(i,s,bt(e,n));}static fromGlob(i,s={}){return t.AST.fromGlob(i,bt(e,s))}},unescape:(i,s={})=>t.unescape(i,bt(e,s)),escape:(i,s={})=>t.escape(i,bt(e,s)),filter:(i,s={})=>t.filter(i,bt(e,s)),defaults:i=>t.defaults(bt(e,i)),makeRe:(i,s={})=>t.makeRe(i,bt(e,s)),braceExpand:(i,s={})=>t.braceExpand(i,bt(e,s)),match:(i,s,n={})=>t.match(i,s,bt(e,n)),sep:t.sep,GLOBSTAR:ot})};at.defaults=Xo;var on=(e,t={})=>(Vi(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:go(e,{max:t.braceExpandMax}));at.braceExpand=on;var ta=(e,t={})=>new ue(e,t).makeRe();at.makeRe=ta;var ea=(e,t,i={})=>{let s=new ue(t,i);return e=e.filter(n=>s.match(n)),s.options.nonull&&!e.length&&e.push(t),e};at.match=ea;var or=/[?*]|[+@!]\(.*?\)|\[|\]/,ia=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ue=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");Vi(e$1),t=t||{},this.options=t,this.pattern=e$1,this.platform=t.platform||nn,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]==="?"||!or.test(n[2]))&&!or.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]),k=C?3:x?0:void 0,O=v?3:E?0:void 0;if(typeof k=="number"&&typeof O=="number"){let[P,L]=[e[k],t[O]];P.toLowerCase()===L.toLowerCase()&&(t[O]=P,O>k?t=t.slice(O):k>O&&(e=e.slice(k)));}}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 on(this.pattern,this.options)}parse(e){Vi(e);let t=this.options;if(e==="**")return ot;if(e==="")return "";let i,s=null;(i=e.match(Io))?s=t.dot?zo:jo:(i=e.match(Oo))?s=(t.nocase?t.dot?No:Lo:t.dot?Po:Fo)(i[1]):(i=e.match(Bo))?s=(t.nocase?t.dot?$o:Uo:t.dot?Ho:Ko)(i):(i=e.match(Go))?s=t.dot?Wo:Do:(i=e.match(Mo))&&(s=_o);let n=Yr.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?Jo:t.dot?Vo:Zo,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"?ia(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=Yr;at.Minimatch=ue;at.escape=en;at.unescape=Le;var ra=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,an=new Set,Ps=typeof process=="object"&&process?process:{},hn=(e,t,i,s)=>{typeof Ps.emitWarning=="function"?Ps.emitWarning(e,t,i,s):console.error(`[${i}] ${t}: ${e}`);},Zi=globalThis.AbortController,ar=globalThis.AbortSignal;if(typeof Zi>"u"){ar=class{constructor(){e(this,"onabort");e(this,"_onabort",[]);e(this,"reason");e(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Zi=class{constructor(){e(this,"signal",new ar);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=Ps.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e$1&&(e$1=false,hn("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 na=e=>!an.has(e),te=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),ln=e=>te(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Ui:null:null,Ui=class extends Array{constructor(e){super(e),this.fill(0);}},jt,Ne,oa=(jt=class{constructor(t,i){e(this,"heap");e(this,"length");if(!f$1(jt,Ne))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=ln(t);if(!i)return [];h(jt,Ne,true);let s=new jt(t,i);return h(jt,Ne,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Ne=new WeakMap,g(jt,Ne,false),jt),vr,xr,St,ut,kt,be,Tt,Ge,De,Rt,$,Ot,z,W,R,st,pt,et,Z,Ft,Y,Pt,Lt,dt,gt,Nt,oe,rt,We,b,Ls,Ce,$t,ai,mt,cn,Se,Me,hi,ee,ie,Ns,$i,Hi,G,Gs,ti,se,Ds,_e,ts=(_e=class{constructor(t){g(this,b);g(this,St);g(this,ut);g(this,kt);g(this,be);g(this,Tt);g(this,Ge);g(this,De);g(this,Rt);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,$);g(this,Ot);g(this,z);g(this,W);g(this,R);g(this,st);g(this,pt);g(this,et);g(this,Z);g(this,Ft);g(this,Y);g(this,Pt);g(this,Lt);g(this,dt);g(this,gt);g(this,Nt);g(this,oe);g(this,rt);g(this,We);g(this,Ce,()=>{});g(this,$t,()=>{});g(this,ai,()=>{});g(this,mt,()=>false);g(this,Se,t=>{});g(this,Me,(t,i,s)=>{});g(this,hi,(t,i,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});e(this,vr,"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:k,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:F,ignoreFetchAbort:M,perf:_}=t;if(_!==void 0&&typeof _?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(h(this,Rt,_??ra),i$1!==0&&!te(i$1))throw new TypeError("max option must be a nonnegative integer");let B=i$1?ln(i$1):Array;if(!B)throw new Error("invalid max value: "+i$1);if(h(this,St,i$1),h(this,ut,x),this.maxEntrySize=C||f$1(this,ut),this.sizeCalculation=E,this.sizeCalculation){if(!f$1(this,ut)&&!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(k!==void 0&&typeof k!="function")throw new TypeError("memoMethod must be a function if defined");if(h(this,De,k),v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(h(this,Ge,v),h(this,oe,!!v),h(this,z,new Map),h(this,W,new Array(i$1).fill(void 0)),h(this,R,new Array(i$1).fill(void 0)),h(this,st,new B(i$1)),h(this,pt,new B(i$1)),h(this,et,0),h(this,Z,0),h(this,Ft,oa.create(i$1)),h(this,$,0),h(this,Ot,0),typeof u=="function"&&h(this,kt,u),typeof g$1=="function"&&h(this,be,g$1),typeof d=="function"?(h(this,Tt,d),h(this,Y,[])):(h(this,Tt,void 0),h(this,Y,void 0)),h(this,Nt,!!f$1(this,kt)),h(this,We,!!f$1(this,be)),h(this,rt,!!f$1(this,Tt)),this.noDisposeOnSet=!!w,this.noUpdateTTL=!!S,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!M,this.maxEntrySize!==0){if(f$1(this,ut)!==0&&!te(f$1(this,ut)))throw new TypeError("maxSize must be a positive integer if specified");if(!te(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");i(this,b,cn).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h$1,this.ttlResolution=te(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!te(this.ttl))throw new TypeError("ttl must be a positive integer if specified");i(this,b,Ls).call(this);}if(f$1(this,St)===0&&this.ttl===0&&f$1(this,ut)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!f$1(this,St)&&!f$1(this,ut)){let N="LRU_CACHE_UNBOUNDED";na(N)&&(an.add(N),hn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",N,_e));}}get perf(){return f$1(this,Rt)}static unsafeExposeInternals(t){return {starts:f$1(t,Lt),ttls:f$1(t,dt),autopurgeTimers:f$1(t,gt),sizes:f$1(t,Pt),keyMap:f$1(t,z),keyList:f$1(t,W),valList:f$1(t,R),next:f$1(t,st),prev:f$1(t,pt),get head(){return f$1(t,et)},get tail(){return f$1(t,Z)},free:f$1(t,Ft),isBackgroundFetch:i$1=>{var s;return i(s=t,b,G).call(s,i$1)},backgroundFetch:(i$1,s,n,o)=>{var a;return i(a=t,b,Hi).call(a,i$1,s,n,o)},moveToTail:i$1=>{var s;return i(s=t,b,ti).call(s,i$1)},indexes:i$1=>{var s;return i(s=t,b,ee).call(s,i$1)},rindexes:i$1=>{var s;return i(s=t,b,ie).call(s,i$1)},isStale:i=>{var s;return f$1(s=t,mt).call(s,i)}}}get max(){return f$1(this,St)}get maxSize(){return f$1(this,ut)}get calculatedSize(){return f$1(this,Ot)}get size(){return f$1(this,$)}get fetchMethod(){return f$1(this,Ge)}get memoMethod(){return f$1(this,De)}get dispose(){return f$1(this,kt)}get onInsert(){return f$1(this,be)}get disposeAfter(){return f$1(this,Tt)}getRemainingTTL(t){return f$1(this,z).has(t)?1/0:0}*entries(){for(let t of i(this,b,ee).call(this))f$1(this,R)[t]!==void 0&&f$1(this,W)[t]!==void 0&&!i(this,b,G).call(this,f$1(this,R)[t])&&(yield [f$1(this,W)[t],f$1(this,R)[t]]);}*rentries(){for(let t of i(this,b,ie).call(this))f$1(this,R)[t]!==void 0&&f$1(this,W)[t]!==void 0&&!i(this,b,G).call(this,f$1(this,R)[t])&&(yield [f$1(this,W)[t],f$1(this,R)[t]]);}*keys(){for(let t of i(this,b,ee).call(this)){let i$1=f$1(this,W)[t];i$1!==void 0&&!i(this,b,G).call(this,f$1(this,R)[t])&&(yield i$1);}}*rkeys(){for(let t of i(this,b,ie).call(this)){let i$1=f$1(this,W)[t];i$1!==void 0&&!i(this,b,G).call(this,f$1(this,R)[t])&&(yield i$1);}}*values(){for(let t of i(this,b,ee).call(this))f$1(this,R)[t]!==void 0&&!i(this,b,G).call(this,f$1(this,R)[t])&&(yield f$1(this,R)[t]);}*rvalues(){for(let t of i(this,b,ie).call(this))f$1(this,R)[t]!==void 0&&!i(this,b,G).call(this,f$1(this,R)[t])&&(yield f$1(this,R)[t]);}[(xr=Symbol.iterator,vr=Symbol.toStringTag,xr)](){return this.entries()}find(t,i$1={}){for(let s of i(this,b,ee).call(this)){let n=f$1(this,R)[s],o=i(this,b,G).call(this,n)?n.__staleWhileFetching:n;if(o!==void 0&&t(o,f$1(this,W)[s],this))return this.get(f$1(this,W)[s],i$1)}}forEach(t,i$1=this){for(let s of i(this,b,ee).call(this)){let n=f$1(this,R)[s],o=i(this,b,G).call(this,n)?n.__staleWhileFetching:n;o!==void 0&&t.call(i$1,o,f$1(this,W)[s],this);}}rforEach(t,i$1=this){for(let s of i(this,b,ie).call(this)){let n=f$1(this,R)[s],o=i(this,b,G).call(this,n)?n.__staleWhileFetching:n;o!==void 0&&t.call(i$1,o,f$1(this,W)[s],this);}}purgeStale(){let t=false;for(let i$1 of i(this,b,ie).call(this,{allowStale:true}))f$1(this,mt).call(this,i$1)&&(i(this,b,se).call(this,f$1(this,W)[i$1],"expire"),t=true);return t}info(t){let i$1=f$1(this,z).get(t);if(i$1===void 0)return;let s=f$1(this,R)[i$1],n=i(this,b,G).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let o={value:n};if(f$1(this,dt)&&f$1(this,Lt)){let a=f$1(this,dt)[i$1],h=f$1(this,Lt)[i$1];if(a&&h){let l=a-(f$1(this,Rt).now()-h);o.ttl=l,o.start=Date.now();}}return f$1(this,Pt)&&(o.size=f$1(this,Pt)[i$1]),o}dump(){let t=[];for(let i$1 of i(this,b,ee).call(this,{allowStale:true})){let s=f$1(this,W)[i$1],n=f$1(this,R)[i$1],o=i(this,b,G).call(this,n)?n.__staleWhileFetching:n;if(o===void 0||s===void 0)continue;let a={value:o};if(f$1(this,dt)&&f$1(this,Lt)){a.ttl=f$1(this,dt)[i$1];let h=f$1(this,Rt).now()-f$1(this,Lt)[i$1];a.start=Math.floor(Date.now()-h);}f$1(this,Pt)&&(a.size=f$1(this,Pt)[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,Rt).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,hi).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,se).call(this,t,"set"),this;let d=f$1(this,$)===0?void 0:f$1(this,z).get(t);if(d===void 0)d=f$1(this,$)===0?f$1(this,Z):f$1(this,Ft).length!==0?f$1(this,Ft).pop():f$1(this,$)===f$1(this,St)?i(this,b,$i).call(this,false):f$1(this,$),f$1(this,W)[d]=t,f$1(this,R)[d]=i$1,f$1(this,z).set(t,d),f$1(this,st)[f$1(this,Z)]=d,f$1(this,pt)[d]=f$1(this,Z),h(this,Z,d),j$1(this,$)._++,f$1(this,Me).call(this,d,g,l),l&&(l.set="add"),u=false,f$1(this,We)&&((w=f$1(this,be))==null||w.call(this,i$1,t,"add"));else {i(this,b,ti).call(this,d);let E=f$1(this,R)[d];if(i$1!==E){if(f$1(this,oe)&&i(this,b,G).call(this,E)){E.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:v}=E;v!==void 0&&!a&&(f$1(this,Nt)&&((S=f$1(this,kt))==null||S.call(this,v,t,"set")),f$1(this,rt)&&f$1(this,Y)?.push([v,t,"set"]));}else a||(f$1(this,Nt)&&((x=f$1(this,kt))==null||x.call(this,E,t,"set")),f$1(this,rt)&&f$1(this,Y)?.push([E,t,"set"]));if(f$1(this,Se).call(this,d),f$1(this,Me).call(this,d,g,l),f$1(this,R)[d]=i$1,l){l.set="replace";let v=E&&i(this,b,G).call(this,E)?E.__staleWhileFetching:E;v!==void 0&&(l.oldValue=v);}}else l&&(l.set="update");f$1(this,We)&&this.onInsert?.(i$1,t,i$1===E?"update":"replace");}if(n!==0&&!f$1(this,dt)&&i(this,b,Ls).call(this),f$1(this,dt)&&(u||f$1(this,ai).call(this,d,n,o),l&&f$1(this,$t).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,Tt))==null||C.call(this,...v);}return this}pop(){var t;try{for(;f$1(this,$);){let i$1=f$1(this,R)[f$1(this,et)];if(i(this,b,$i).call(this,!0),i(this,b,G).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,Tt))==null||t.call(this,...s);}}}has(t,i$1={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=i$1,o=f$1(this,z).get(t);if(o!==void 0){let a=f$1(this,R)[o];if(i(this,b,G).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(f$1(this,mt).call(this,o))n&&(n.has="stale",f$1(this,$t).call(this,n,o));else return s&&f$1(this,Ce).call(this,o),n&&(n.has="hit",f$1(this,$t).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,z).get(t);if(n===void 0||!s&&f$1(this,mt).call(this,n))return;let o=f$1(this,R)[n];return i(this,b,G).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:k}=i$1;if(!f$1(this,oe))return v&&(v.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:v});let O={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:k},P=f$1(this,z).get(t);if(P===void 0){v&&(v.fetch="miss");let L=i(this,b,Hi).call(this,t,P,O,C);return L.__returned=L}else {let L=f$1(this,R)[P];if(i(this,b,G).call(this,L)){let B=s&&L.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",B&&(v.returnedStale=true)),B?L.__staleWhileFetching:L.__returned=L}let F=f$1(this,mt).call(this,P);if(!E&&!F)return v&&(v.fetch="hit"),i(this,b,ti).call(this,P),n&&f$1(this,Ce).call(this,P),v&&f$1(this,$t).call(this,v,P),L;let M=i(this,b,Hi).call(this,t,P,O,C),_=M.__staleWhileFetching!==void 0&&s;return v&&(v.fetch=F?"stale":"refresh",_&&F&&(v.returnedStale=true)),_?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,De);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,z).get(t);if(h!==void 0){let l=f$1(this,R)[h],u=i(this,b,G).call(this,l);return a&&f$1(this,$t).call(this,a,h),f$1(this,mt).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,se).call(this,t,"expire"),a&&s&&(a.returnedStale=true),s?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(i(this,b,ti).call(this,h),n&&f$1(this,Ce).call(this,h),l))}else a&&(a.get="miss");}delete(t){return i(this,b,se).call(this,t,"delete")}clear(){return i(this,b,Ds).call(this,"delete")}},St=new WeakMap,ut=new WeakMap,kt=new WeakMap,be=new WeakMap,Tt=new WeakMap,Ge=new WeakMap,De=new WeakMap,Rt=new WeakMap,$=new WeakMap,Ot=new WeakMap,z=new WeakMap,W=new WeakMap,R=new WeakMap,st=new WeakMap,pt=new WeakMap,et=new WeakMap,Z=new WeakMap,Ft=new WeakMap,Y=new WeakMap,Pt=new WeakMap,Lt=new WeakMap,dt=new WeakMap,gt=new WeakMap,Nt=new WeakMap,oe=new WeakMap,rt=new WeakMap,We=new WeakMap,b=new WeakSet,Ls=function(){let t=new Ui(f$1(this,St)),i$1=new Ui(f$1(this,St));h(this,dt,t),h(this,Lt,i$1);let s=this.ttlAutopurge?new Array(f$1(this,St)):void 0;h(this,gt,s),h(this,ai,(a,h,l=f$1(this,Rt).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,mt).call(this,a)&&i(this,b,se).call(this,f$1(this,W)[a],"expire");},h+1);u.unref&&u.unref(),s[a]=u;}}),h(this,Ce,a=>{i$1[a]=t[a]!==0?f$1(this,Rt).now():0;}),h(this,$t,(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,Rt).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,z).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,mt,a=>{let h=i$1[a],l=t[a];return !!l&&!!h&&(n||o())-h>l});},Ce=new WeakMap,$t=new WeakMap,ai=new WeakMap,mt=new WeakMap,cn=function(){let t=new Ui(f$1(this,St));h(this,Ot,0),h(this,Pt,t),h(this,Se,i=>{h(this,Ot,f$1(this,Ot)-t[i]),t[i]=0;}),h(this,hi,(i$1,s,n,o)=>{if(i(this,b,G).call(this,s))return 0;if(!te(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(s,i$1),!te(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,Me,(i$1,s,n)=>{if(t[i$1]=s,f$1(this,ut)){let o=f$1(this,ut)-t[i$1];for(;f$1(this,Ot)>o;)i(this,b,$i).call(this,true);}h(this,Ot,f$1(this,Ot)+t[i$1]),n&&(n.entrySize=s,n.totalCalculatedSize=f$1(this,Ot));});},Se=new WeakMap,Me=new WeakMap,hi=new WeakMap,ee=function*({allowStale:t=this.allowStale}={}){if(f$1(this,$))for(let i$1=f$1(this,Z);!(!i(this,b,Ns).call(this,i$1)||((t||!f$1(this,mt).call(this,i$1))&&(yield i$1),i$1===f$1(this,et)));)i$1=f$1(this,pt)[i$1];},ie=function*({allowStale:t=this.allowStale}={}){if(f$1(this,$))for(let i$1=f$1(this,et);!(!i(this,b,Ns).call(this,i$1)||((t||!f$1(this,mt).call(this,i$1))&&(yield i$1),i$1===f$1(this,Z)));)i$1=f$1(this,st)[i$1];},Ns=function(t){return t!==void 0&&f$1(this,z).get(f$1(this,W)[t])===t},$i=function(t){var o;let i$1=f$1(this,et),s=f$1(this,W)[i$1],n=f$1(this,R)[i$1];return f$1(this,oe)&&i(this,b,G).call(this,n)?n.__abortController.abort(new Error("evicted")):(f$1(this,Nt)||f$1(this,rt))&&(f$1(this,Nt)&&((o=f$1(this,kt))==null||o.call(this,n,s,"evict")),f$1(this,rt)&&f$1(this,Y)?.push([n,s,"evict"])),f$1(this,Se).call(this,i$1),f$1(this,gt)?.[i$1]&&(clearTimeout(f$1(this,gt)[i$1]),f$1(this,gt)[i$1]=void 0),t&&(f$1(this,W)[i$1]=void 0,f$1(this,R)[i$1]=void 0,f$1(this,Ft).push(i$1)),f$1(this,$)===1?(h(this,et,h(this,Z,0)),f$1(this,Ft).length=0):h(this,et,f$1(this,st)[i$1]),f$1(this,z).delete(s),j$1(this,$)._--,i$1},Hi=function(t,i$1,s,n){let o=i$1===void 0?void 0:f$1(this,R)[i$1];if(i(this,b,G).call(this,o))return o;let a=new Zi,{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,k=s.ignoreFetchAbort&&C!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&C!==void 0);if(s.status&&(v&&!E?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,k&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),v&&!k&&!E)return d(a.signal.reason,O);let P=S,L=f$1(this,R)[i$1];return (L===S||k&&E&&L===void 0)&&(C===void 0?P.__staleWhileFetching!==void 0?f$1(this,R)[i$1]=P.__staleWhileFetching:i(this,b,se).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,k=v&&s.allowStaleOnFetchAbort,O=k||s.allowStaleOnFetchRejection,P=O||s.noDeleteOnFetchRejection,L=S;if(f$1(this,R)[i$1]===S&&(!P||!E&&L.__staleWhileFetching===void 0?i(this,b,se).call(this,t,"fetch"):k||(f$1(this,R)[i$1]=L.__staleWhileFetching)),O)return s.status&&L.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),L.__staleWhileFetching;if(L.__returned===L)throw C},w=(C,E)=>{var k;let v=(k=f$1(this,Ge))==null?void 0:k.call(this,t,o,l);v&&v instanceof Promise&&v.then(O=>C(O===void 0?void 0:O),E),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(C(void 0),s.allowStaleOnFetchAbort&&(C=O=>u(O,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,z).get(t)):f$1(this,R)[i$1]=x,x},G=function(t){if(!f$1(this,oe))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Zi},Gs=function(t,i){f$1(this,pt)[i]=t,f$1(this,st)[t]=i;},ti=function(t){t!==f$1(this,Z)&&(t===f$1(this,et)?h(this,et,f$1(this,st)[t]):i(this,b,Gs).call(this,f$1(this,pt)[t],f$1(this,st)[t]),i(this,b,Gs).call(this,f$1(this,Z),t),h(this,Z,t));},se=function(t,i$1){var n,o;let s=false;if(f$1(this,$)!==0){let a=f$1(this,z).get(t);if(a!==void 0)if(f$1(this,gt)?.[a]&&(clearTimeout(f$1(this,gt)?.[a]),f$1(this,gt)[a]=void 0),s=true,f$1(this,$)===1)i(this,b,Ds).call(this,i$1);else {f$1(this,Se).call(this,a);let h$1=f$1(this,R)[a];if(i(this,b,G).call(this,h$1)?h$1.__abortController.abort(new Error("deleted")):(f$1(this,Nt)||f$1(this,rt))&&(f$1(this,Nt)&&((n=f$1(this,kt))==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,z).delete(t),f$1(this,W)[a]=void 0,f$1(this,R)[a]=void 0,a===f$1(this,Z))h(this,Z,f$1(this,pt)[a]);else if(a===f$1(this,et))h(this,et,f$1(this,st)[a]);else {let l=f$1(this,pt)[a];f$1(this,st)[l]=f$1(this,st)[a];let u=f$1(this,st)[a];f$1(this,pt)[u]=f$1(this,pt)[a];}j$1(this,$)._--,f$1(this,Ft).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,Tt))==null||o.call(this,...h);}return s},Ds=function(t){var i$1,s;for(let n of i(this,b,ie).call(this,{allowStale:true})){let o=f$1(this,R)[n];if(i(this,b,G).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=f$1(this,W)[n];f$1(this,Nt)&&((i$1=f$1(this,kt))==null||i$1.call(this,o,a,t)),f$1(this,rt)&&f$1(this,Y)?.push([o,a,t]);}}if(f$1(this,z).clear(),f$1(this,R).fill(void 0),f$1(this,W).fill(void 0),f$1(this,dt)&&f$1(this,Lt)){f$1(this,dt).fill(0),f$1(this,Lt).fill(0);for(let n of f$1(this,gt)??[])n!==void 0&&clearTimeout(n);f$1(this,gt)?.fill(void 0);}if(f$1(this,Pt)&&f$1(this,Pt).fill(0),h(this,et,0),h(this,Z,0),f$1(this,Ft).length=0,h(this,Ot,0),h(this,$,0),f$1(this,rt)&&f$1(this,Y)){let n=f$1(this,Y),o;for(;o=n?.shift();)(s=f$1(this,Tt))==null||s.call(this,...o);}},_e),hr=typeof process=="object"&&process?process:{stdout:null,stderr:null},Ca=e=>!!e&&typeof e=="object"&&(e instanceof Yi||e instanceof fn||Sa(e)||va(e)),Sa=e=>!!e&&typeof e=="object"&&e instanceof EventEmitter&&typeof e.pipe=="function"&&e.pipe!==fn.Writable.prototype.pipe,va=e=>!!e&&typeof e=="object"&&e instanceof EventEmitter&&typeof e.write=="function"&&typeof e.end=="function",zt=Symbol("EOF"),Bt=Symbol("maybeEmitEnd"),Xt=Symbol("emittedEnd"),Di=Symbol("emittingEnd"),qe=Symbol("emittedError"),Wi=Symbol("closed"),lr=Symbol("read"),Mi=Symbol("flush"),cr=Symbol("flushChunk"),Et=Symbol("encoding"),Fe=Symbol("decoder"),Q=Symbol("flowing"),Je=Symbol("paused"),Pe=Symbol("resume"),q=Symbol("buffer"),it=Symbol("pipes"),J=Symbol("bufferLength"),xs=Symbol("bufferPush"),_i=Symbol("bufferShift"),tt=Symbol("objectMode"),I=Symbol("destroyed"),Es=Symbol("error"),As=Symbol("emitData"),fr=Symbol("emitEnd"),ks=Symbol("emitEnd2"),Dt=Symbol("async"),Ts=Symbol("abort"),Ii=Symbol("aborted"),Ve=Symbol("signal"),de=Symbol("dataListeners"),ft=Symbol("discarded"),Ze=e=>Promise.resolve().then(e),xa=e=>e(),Ea=e=>e==="end"||e==="finish"||e==="prefinish",Aa=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,ka=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),un=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[Pe](),this.dest.on("drain",this.ondrain);}unpipe(){this.dest.removeListener("drain",this.ondrain);}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end();}},Ta=class extends un{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);}},Ra=e=>!!e.objectMode,Oa=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Er,Ar,kr,Tr,Rr,Or,Fr,Pr,Lr,Nr,Gr,Dr,Wr,Mr,_r,Ir,jr,zr,Br,Yi=class extends EventEmitter{constructor(...t){let i=t[0]||{};super();e(this,Br,false);e(this,zr,false);e(this,jr,[]);e(this,Ir,[]);e(this,_r);e(this,Mr);e(this,Wr);e(this,Dr);e(this,Gr,false);e(this,Nr,false);e(this,Lr,false);e(this,Pr,false);e(this,Fr,null);e(this,Or,0);e(this,Rr,false);e(this,Tr);e(this,kr,false);e(this,Ar,0);e(this,Er,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");Ra(i)?(this[tt]=true,this[Et]=null):Oa(i)?(this[Et]=i.encoding,this[tt]=false):(this[tt]=false,this[Et]=null),this[Dt]=!!i.async,this[Fe]=this[Et]?new StringDecoder(this[Et]):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[Ve]=s,s.aborted?this[Ts]():s.addEventListener("abort",()=>this[Ts]()));}get bufferLength(){return this[J]}get encoding(){return this[Et]}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[Dt]}set async(t){this[Dt]=this[Dt]||!!t;}[(Br=Q,zr=Je,jr=it,Ir=q,_r=tt,Mr=Et,Wr=Dt,Dr=Fe,Gr=zt,Nr=Xt,Lr=Di,Pr=Wi,Fr=qe,Or=J,Rr=I,Tr=Ve,kr=Ii,Ar=de,Er=ft,Ts)](){this[Ii]=true,this.emit("abort",this[Ve]?.reason),this.destroy(this[Ve]?.reason);}get aborted(){return this[Ii]}set aborted(t){}write(t,i,s){if(this[Ii])return false;if(this[zt])throw new Error("write after end");if(this[I])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[Dt]?Ze:xa;if(!this[tt]&&!Buffer.isBuffer(t)){if(ka(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Aa(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[Mi](true),this[Q]?this.emit("data",t):this[xs](t),this[J]!==0&&this.emit("readable"),s&&n(s),this[Q]):t.length?(typeof t=="string"&&!(i===this[Et]&&!this[Fe]?.lastNeed)&&(t=Buffer.from(t,i)),Buffer.isBuffer(t)&&this[Et]&&(t=this[Fe].write(t)),this[Q]&&this[J]!==0&&this[Mi](true),this[Q]?this.emit("data",t):this[xs](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[I])return null;if(this[ft]=false,this[J]===0||t===0||t&&t>this[J])return this[Bt](),null;this[tt]&&(t=null),this[q].length>1&&!this[tt]&&(this[q]=[this[Et]?this[q].join(""):Buffer.concat(this[q],this[J])]);let i=this[lr](t||null,this[q][0]);return this[Bt](),i}[lr](t,i){if(this[tt])this[_i]();else {let s=i;t===s.length||t===null?this[_i]():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[zt]&&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[zt]=true,this.writable=false,(this[Q]||!this[Je])&&this[Bt](),this}[Pe](){this[I]||(!this[de]&&!this[it].length&&(this[ft]=true),this[Je]=false,this[Q]=true,this.emit("resume"),this[q].length?this[Mi]():this[zt]?this[Bt]():this.emit("drain"));}resume(){return this[Pe]()}pause(){this[Q]=false,this[Je]=true,this[ft]=false;}get destroyed(){return this[I]}get flowing(){return this[Q]}get paused(){return this[Je]}[xs](t){this[tt]?this[J]+=1:this[J]+=t.length,this[q].push(t);}[_i](){return this[tt]?this[J]-=1:this[J]-=this[q][0].length,this[q].shift()}[Mi](t=false){do;while(this[cr](this[_i]())&&this[q].length);!t&&!this[q].length&&!this[zt]&&this.emit("drain");}[cr](t){return this.emit("data",t),this[Q]}pipe(t,i){if(this[I])return t;this[ft]=false;let s=this[Xt];return i=i||{},t===hr.stdout||t===hr.stderr?i.end=false:i.end=i.end!==false,i.proxyErrors=!!i.proxyErrors,s?i.end&&t.end():(this[it].push(i.proxyErrors?new Ta(this,t,i):new un(this,t,i)),this[Dt]?Ze(()=>this[Pe]()):this[Pe]()),t}unpipe(t){let i=this[it].find(s=>s.dest===t);i&&(this[it].length===1?(this[Q]&&this[de]===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[ft]=false,this[de]++,!this[it].length&&!this[Q]&&this[Pe]();else if(t==="readable"&&this[J]!==0)super.emit("readable");else if(Ea(t)&&this[Xt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[qe]){let n=i;this[Dt]?Ze(()=>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[de]=this.listeners("data").length,this[de]===0&&!this[ft]&&!this[it].length&&(this[Q]=false)),s}removeAllListeners(t){let i=super.removeAllListeners(t);return (t==="data"||t===void 0)&&(this[de]=0,!this[ft]&&!this[it].length&&(this[Q]=false)),i}get emittedEnd(){return this[Xt]}[Bt](){!this[Di]&&!this[Xt]&&!this[I]&&this[q].length===0&&this[zt]&&(this[Di]=true,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Wi]&&this.emit("close"),this[Di]=false);}emit(t,...i){let s=i[0];if(t!=="error"&&t!=="close"&&t!==I&&this[I])return false;if(t==="data")return !this[tt]&&!s?false:this[Dt]?(Ze(()=>this[As](s)),true):this[As](s);if(t==="end")return this[fr]();if(t==="close"){if(this[Wi]=true,!this[Xt]&&!this[I])return false;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(t==="error"){this[qe]=s,super.emit(Es,s);let o=!this[Ve]||this.listeners("error").length?super.emit("error",s):false;return this[Bt](),o}else if(t==="resume"){let o=super.emit("resume");return this[Bt](),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[Bt](),n}[As](t){for(let s of this[it])s.dest.write(t)===false&&this.pause();let i=this[ft]?false:super.emit("data",t);return this[Bt](),i}[fr](){return this[Xt]?false:(this[Xt]=true,this.readable=false,this[Dt]?(Ze(()=>this[ks]()),true):this[ks]())}[ks](){if(this[Fe]){let i=this[Fe].end();if(i){for(let s of this[it])s.dest.write(i);this[ft]||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[Et]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,i)=>{this.on(I,()=>i(new Error("stream destroyed"))),this.on("error",s=>i(s)),this.on("end",()=>t());})}[Symbol.asyncIterator](){this[ft]=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[zt])return i();let n,o,a=g=>{this.off("data",h),this.off("end",l),this.off(I,u),i(),o(g);},h=g=>{this.off("error",a),this.off("end",l),this.off(I,u),this.pause(),n({value:g,done:!!this[zt]});},l=()=>{this.off("error",a),this.off("data",h),this.off(I,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(I,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[ft]=false;let t=false,i=()=>(this.pause(),this.off(Es,i),this.off(I,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(Es,i),this.once(I,i),{next:s,throw:i,return:i,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[I])return t?this.emit("error",t):this.emit(I),this;this[I]=true,this[ft]=true,this[q].length=0,this[J]=0;let i=this;return typeof i.close=="function"&&!this[Wi]&&i.close(),t?this.emit("error",t):this.emit(I),this}static get isStream(){return Ca}},Fa=realpathSync.native,ei={lstatSync:lstatSync,readdir:readdir$1,readdirSync:readdirSync,readlinkSync:readlinkSync,realpathSync:Fa,promises:{lstat:lstat,readdir:readdir,readlink:readlink,realpath:realpath}},pn=e=>!e||e===ei||e===da?ei:{...ei,...e,promises:{...ei.promises,...e.promises||{}}},dn=/^\\\\\?\\([a-z]:)\\?$/i,Pa=e=>e.replace(/\//g,"\\").replace(dn,"$1\\"),La=/[\\\/]/,vt=0,gn=1,mn=2,Wt=4,yn=6,wn=8,ge=10,bn=12,Ct=15,Ye=~Ct,Rs=16,ur=32,ii=64,At=128,ji=256,Ki=512,pr=ii|At|Ki,Na=1023,Os=e=>e.isFile()?wn:e.isDirectory()?Wt:e.isSymbolicLink()?ge:e.isCharacterDevice()?mn:e.isBlockDevice()?yn:e.isSocket()?bn:e.isFIFO()?gn:vt,dr=new ts({max:2**12}),si=e=>{let t=dr.get(e);if(t)return t;let i=e.normalize("NFKD");return dr.set(e,i),i},gr=new ts({max:2**12}),zi=e=>{let t=gr.get(e);if(t)return t;let i=si(e.toLowerCase());return gr.set(e,i),i},mr=class extends ts{constructor(){super({max:256});}},Ga=class extends ts{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1});}},Cn=Symbol("PathScurry setAsCwd"),nt,li,ci,fi,ui,pi,di,gi,mi,yi,wi,bi,Ci,Si,vi,xi,Ei,Ai,ki,ae,ve,_t,Ht,Kt,Qt,T,xe,qt,It,A,Ms,Qi,ri,_s,Is,ni,qi,js,zs,Ji,Sn,vn,xn,Bs,Ie,je,En,Ee,Ur,lt=(Ur=class{constructor(e$1,t=vt,i,s,n,o,a){g(this,A);e(this,"name");e(this,"root");e(this,"roots");e(this,"parent");e(this,"nocase");e(this,"isCWD",false);g(this,nt);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,ki);g(this,ae);g(this,ve);g(this,_t);g(this,Ht);g(this,Kt);g(this,Qt);g(this,T);g(this,xe);g(this,qt);g(this,It);g(this,Ie,[]);g(this,je,false);g(this,Ee);this.name=e$1,h(this,ae,n?zi(e$1):si(e$1)),h(this,T,t&Na),this.nocase=n,this.roots=s,this.root=i||this,h(this,xe,o),h(this,_t,a.fullpath),h(this,Kt,a.relative),h(this,Qt,a.relativePosix),this.parent=a.parent,this.parent?h(this,nt,f$1(this.parent,nt)):h(this,nt,pn(a.fs));}get dev(){return f$1(this,li)}get mode(){return f$1(this,ci)}get nlink(){return f$1(this,fi)}get uid(){return f$1(this,ui)}get gid(){return f$1(this,pi)}get rdev(){return f$1(this,di)}get blksize(){return f$1(this,gi)}get ino(){return f$1(this,mi)}get size(){return f$1(this,yi)}get blocks(){return f$1(this,wi)}get atimeMs(){return f$1(this,bi)}get mtimeMs(){return f$1(this,Ci)}get ctimeMs(){return f$1(this,Si)}get birthtimeMs(){return f$1(this,vi)}get atime(){return f$1(this,xi)}get mtime(){return f$1(this,Ei)}get ctime(){return f$1(this,Ai)}get birthtime(){return f$1(this,ki)}get parentPath(){return (this.parent||this).fullpath()}get path(){return this.parentPath}depth(){return f$1(this,ve)!==void 0?f$1(this,ve):this.parent?h(this,ve,this.parent.depth()+1):h(this,ve,0)}childrenCache(){return f$1(this,xe)}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),A,Ms).call(s,i$1):i(this,A,Ms).call(this,i$1)}children(){let e=f$1(this,xe).get(this);if(e)return e;let t=Object.assign([],{provisional:0});return f$1(this,xe).set(this,t),h(this,T,f$1(this,T)&~Rs),t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let i=this.children(),s=this.nocase?zi(e):si(e);for(let h of i)if(f$1(h,ae)===s)return h;let n=this.parent?this.sep:"",o=f$1(this,_t)?f$1(this,_t)+n+e:void 0,a=this.newChild(e,vt,{...t,parent:this,fullpath:o});return this.canReaddir()||h(a,T,f$1(a,T)|At),i.push(a),a}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.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,Qt)!==void 0)return f$1(this,Qt);let e=this.name,t=this.parent;if(!t)return h(this,Qt,this.fullpathPosix());let i=t.relativePosix();return i+(!i||!t.parent?"":"/")+e}fullpath(){if(f$1(this,_t)!==void 0)return f$1(this,_t);let e=this.name,t=this.parent;if(!t)return h(this,_t,this.name);let i=t.fullpath()+(t.parent?this.sep:"")+e;return h(this,_t,i)}fullpathPosix(){if(f$1(this,Ht)!==void 0)return f$1(this,Ht);if(this.sep==="/")return h(this,Ht,this.fullpath());if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return /^[a-z]:\//i.test(s)?h(this,Ht,`//?/${s}`):h(this,Ht,s)}let e=this.parent,t=e.fullpathPosix(),i=t+(!t||!e.parent?"":"/")+this.name;return h(this,Ht,i)}isUnknown(){return (f$1(this,T)&Ct)===vt}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,T)&Ct)===wn}isDirectory(){return (f$1(this,T)&Ct)===Wt}isCharacterDevice(){return (f$1(this,T)&Ct)===mn}isBlockDevice(){return (f$1(this,T)&Ct)===yn}isFIFO(){return (f$1(this,T)&Ct)===gn}isSocket(){return (f$1(this,T)&Ct)===bn}isSymbolicLink(){return (f$1(this,T)&ge)===ge}lstatCached(){return f$1(this,T)&ur?this:void 0}readlinkCached(){return f$1(this,qt)}realpathCached(){return f$1(this,It)}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,T)&Ct;return !(e!==vt&&e!==ge||f$1(this,T)&ji||f$1(this,T)&At)}calledReaddir(){return !!(f$1(this,T)&Rs)}isENOENT(){return !!(f$1(this,T)&At)}isNamed(e){return this.nocase?f$1(this,ae)===zi(e):f$1(this,ae)===si(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,A,zs).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,A,zs).call(this,t.code);return}}async lstat(){if((f$1(this,T)&At)===0)try{return i(this,A,Bs).call(this,await f$1(this,nt).promises.lstat(this.fullpath())),this}catch(e){i(this,A,js).call(this,e.code);}}lstatSync(){if((f$1(this,T)&At)===0)try{return i(this,A,Bs).call(this,f$1(this,nt).lstatSync(this.fullpath())),this}catch(e){i(this,A,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,Ie).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,A,qi).call(this,n.code),i$1.provisional=0;else {for(let a of o)i(this,A,Ji).call(this,a,i$1);i(this,A,Qi).call(this,i$1);}i(this,A,En).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,Ee))await f$1(this,Ee);else {let i$1=()=>{};h(this,Ee,new Promise(s=>i$1=s));try{for(let s of await f$1(this,nt).promises.readdir(t,{withFileTypes:!0}))i(this,A,Ji).call(this,s,e);i(this,A,Qi).call(this,e);}catch(s){i(this,A,qi).call(this,s.code),e.provisional=0;}h(this,Ee,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,A,Ji).call(this,i$1,e);i(this,A,Qi).call(this,e);}catch(i$1){i(this,A,qi).call(this,i$1.code),e.provisional=0;}return e.slice(0,e.provisional)}canReaddir(){if(f$1(this,T)&pr)return false;let e=Ct&f$1(this,T);return e===vt||e===Wt||e===ge}shouldWalk(e,t){return (f$1(this,T)&Wt)===Wt&&!(f$1(this,T)&pr)&&!e.has(this)&&(!t||t(this))}async realpath(){if(f$1(this,It))return f$1(this,It);if(!((Ki|ji|At)&f$1(this,T)))try{let e=await f$1(this,nt).promises.realpath(this.fullpath());return h(this,It,this.resolve(e))}catch{i(this,A,Is).call(this);}}realpathSync(){if(f$1(this,It))return f$1(this,It);if(!((Ki|ji|At)&f$1(this,T)))try{let e=f$1(this,nt).realpathSync(this.fullpath());return h(this,It,this.resolve(e))}catch{i(this,A,Is).call(this);}}[Cn](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,Kt,i.join(this.sep)),h(s,Qt,i.join("/")),s=s.parent,i.push("..");for(s=e;s&&s.parent&&!t.has(s);)h(s,Kt,void 0),h(s,Qt,void 0),s=s.parent;}},nt=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,ki=new WeakMap,ae=new WeakMap,ve=new WeakMap,_t=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,T=new WeakMap,xe=new WeakMap,qt=new WeakMap,It=new WeakMap,A=new WeakSet,Ms=function(e){let t=this;for(let i of e)t=t.child(i);return t},Qi=function(e){var t;h(this,T,f$1(this,T)|Rs);for(let i$1=e.provisional;i$1<e.length;i$1++){let s=e[i$1];s&&i(t=s,A,ri).call(t);}},ri=function(){f$1(this,T)&At||(h(this,T,(f$1(this,T)|At)&Ye),i(this,A,_s).call(this));},_s=function(){var t;let e=this.children();e.provisional=0;for(let i$1 of e)i(t=i$1,A,ri).call(t);},Is=function(){h(this,T,f$1(this,T)|Ki),i(this,A,ni).call(this);},ni=function(){if(f$1(this,T)&ii)return;let e=f$1(this,T);(e&Ct)===Wt&&(e&=Ye),h(this,T,e|ii),i(this,A,_s).call(this);},qi=function(e=""){e==="ENOTDIR"||e==="EPERM"?i(this,A,ni).call(this):e==="ENOENT"?i(this,A,ri).call(this):this.children().provisional=0;},js=function(e=""){var t;e==="ENOTDIR"?i(t=this.parent,A,ni).call(t):e==="ENOENT"&&i(this,A,ri).call(this);},zs=function(e=""){var i$1;let t=f$1(this,T);t|=ji,e==="ENOENT"&&(t|=At),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Ye),h(this,T,t),e==="ENOTDIR"&&this.parent&&i(i$1=this.parent,A,ni).call(i$1);},Ji=function(e,t){return i(this,A,vn).call(this,e,t)||i(this,A,Sn).call(this,e,t)},Sn=function(e,t){let i=Os(e),s=this.newChild(e.name,i,{parent:this}),n=f$1(s,T)&Ct;return n!==Wt&&n!==ge&&n!==vt&&h(s,T,f$1(s,T)|ii),t.unshift(s),t.provisional++,s},vn=function(e,t){for(let i$1=t.provisional;i$1<t.length;i$1++){let s=t[i$1];if((this.nocase?zi(e.name):si(e.name))===f$1(s,ae))return i(this,A,xn).call(this,e,s,i$1,t)}},xn=function(e,t,i,s){let n=t.name;return h(t,T,f$1(t,T)&Ye|Os(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},Bs=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:k}=e;h(this,xi,t),h(this,bi,i),h(this,ki,s),h(this,vi,n),h(this,gi,o),h(this,wi,a),h(this,Ai,h$1),h(this,Si,l),h(this,li,u),h(this,pi,g),h(this,mi,d),h(this,ci,w),h(this,Ei,S),h(this,Ci,x),h(this,fi,C),h(this,di,E),h(this,yi,v),h(this,ui,k);let O=Os(e);h(this,T,f$1(this,T)&Ye|O|ur),O!==vt&&O!==Wt&&O!==ge&&h(this,T,f$1(this,T)|ii);},Ie=new WeakMap,je=new WeakMap,En=function(e){h(this,je,false);let t=f$1(this,Ie).slice();f$1(this,Ie).length=0,t.forEach(i=>i(null,e));},Ee=new WeakMap,Ur),An=class kn extends lt{constructor(i,s=vt,n,o,a,h,l){super(i,s,n,o,a,h,l);e(this,"sep","\\");e(this,"splitSep",La);}newChild(i,s=vt,n={}){return new kn(i,s,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(i){return win32.parse(i).root}getRoot(i){if(i=Pa(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 Qs(i,this).root}sameRoot(i,s=this.root.name){return i=i.toUpperCase().replace(/\//g,"\\").replace(dn,"$1\\"),i===s}},Tn=class Rn extends lt{constructor(i,s=vt,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=vt,n={}){return new Rn(i,s,this.root,this.roots,this.nocase,this.childrenCache(),n)}},ze,Be,Ti,Ri,$r,On=($r=class{constructor(e$1=process.cwd(),t,i,{nocase:s,childrenCacheSize:n=16*1024,fs:o=ei}={}){e(this,"root");e(this,"rootPath");e(this,"roots");e(this,"cwd");g(this,ze);g(this,Be);g(this,Ti);e(this,"nocase");g(this,Ri);h(this,Ri,pn(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,ze,new mr),h(this,Be,new mr),h(this,Ti,new Ga(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,Ri)),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,Ti)}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,ze).get(t);if(i!==void 0)return i;let s=this.cwd.resolve(t).fullpath();return f$1(this,ze).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,Be).get(t);if(i!==void 0)return i;let s=this.cwd.resolve(t).fullpathPosix();return f$1(this,Be).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 lt||(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 lt||(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 lt||(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 lt||(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 lt||(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 lt||(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 lt||(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 lt||(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 lt||(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 lt||(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 lt||(t=e,e=this.cwd);let{withFileTypes:i=true,follow:s=false,filter:n,walkFilter:o}=t,a=new Yi({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 k=[];for(let O of E)O.isSymbolicLink()&&k.push(O.realpath().then(P=>P?.isUnknown()?P.lstat():P));if(k.length){Promise.all(k).then(()=>S(null,E,true));return}}for(let k of E)k&&(!n||n(k))&&(a.write(i?k:k.fullpath())||(d=true));u--;for(let k of E){let O=k.realpathCached()||k;O.shouldWalk(h,o)&&l.push(O);}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 lt||(t=e,e=this.cwd);let{withFileTypes:i=true,follow:s=false,filter:n,walkFilter:o}=t,a=new Yi({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[Cn](t);}},ze=new WeakMap,Be=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,$r),Qs=class extends On{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 An(this.rootPath,Wt,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 On{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 Tn(this.rootPath,Wt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},Fn=class extends qs{constructor(e=process.cwd(),t={}){let{nocase:i=true}=t;super(e,{...t,nocase:i});}};process.platform==="win32"?An:Tn;var Da=process.platform==="win32"?Qs:process.platform==="darwin"?Fn:qs,Wa=e=>e.length>=1,Ma=e=>e.length>=1,_a=Symbol.for("nodejs.util.inspect.custom"),H,ct,K,Ae,Gt,Oi,he,le,ce,Ue,$e,Pn=($e=class{constructor(t,i,s,n){g(this,H);g(this,ct);g(this,K);e(this,"length");g(this,Ae);g(this,Gt);g(this,Oi);g(this,he);g(this,le);g(this,ce);g(this,Ue,true);if(!Wa(t))throw new TypeError("empty pattern list");if(!Ma(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,H,t),h(this,ct,i),h(this,K,s),h(this,Ae,n),f$1(this,K)===0){if(this.isUNC()){let[o,a,h$1,l,...u]=f$1(this,H),[g,d,w,S,...x]=f$1(this,ct);u[0]===""&&(u.shift(),x.shift());let C=[o,a,h$1,l,""].join("/"),E=[g,d,w,S,""].join("/");h(this,H,[C,...u]),h(this,ct,[E,...x]),this.length=f$1(this,H).length;}else if(this.isDrive()||this.isAbsolute()){let[o,...a]=f$1(this,H),[h$1,...l]=f$1(this,ct);a[0]===""&&(a.shift(),l.shift());let u=o+"/",g=h$1+"/";h(this,H,[u,...a]),h(this,ct,[g,...l]),this.length=f$1(this,H).length;}}}[_a](){return "Pattern <"+f$1(this,ct).slice(f$1(this,K)).join("/")+">"}pattern(){return f$1(this,H)[f$1(this,K)]}isString(){return typeof f$1(this,H)[f$1(this,K)]=="string"}isGlobstar(){return f$1(this,H)[f$1(this,K)]===ot}isRegExp(){return f$1(this,H)[f$1(this,K)]instanceof RegExp}globString(){return h(this,Oi,f$1(this,Oi)||(f$1(this,K)===0?this.isAbsolute()?f$1(this,ct)[0]+f$1(this,ct).slice(1).join("/"):f$1(this,ct).join("/"):f$1(this,ct).slice(f$1(this,K)).join("/")))}hasMore(){return this.length>f$1(this,K)+1}rest(){return f$1(this,Gt)!==void 0?f$1(this,Gt):this.hasMore()?(h(this,Gt,new $e(f$1(this,H),f$1(this,ct),f$1(this,K)+1,f$1(this,Ae))),h(f$1(this,Gt),ce,f$1(this,ce)),h(f$1(this,Gt),le,f$1(this,le)),h(f$1(this,Gt),he,f$1(this,he)),f$1(this,Gt)):h(this,Gt,null)}isUNC(){let t=f$1(this,H);return f$1(this,le)!==void 0?f$1(this,le):h(this,le,f$1(this,Ae)==="win32"&&f$1(this,K)===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3])}isDrive(){let t=f$1(this,H);return f$1(this,he)!==void 0?f$1(this,he):h(this,he,f$1(this,Ae)==="win32"&&f$1(this,K)===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]))}isAbsolute(){let t=f$1(this,H);return f$1(this,ce)!==void 0?f$1(this,ce):h(this,ce,t[0]===""&&t.length>1||this.isDrive()||this.isUNC())}root(){let t=f$1(this,H)[0];return typeof t=="string"&&this.isAbsolute()&&f$1(this,K)===0?t:""}checkFollowGlobstar(){return !(f$1(this,K)===0||!this.isGlobstar()||!f$1(this,Ue))}markFollowGlobstar(){return f$1(this,K)===0||!this.isGlobstar()||!f$1(this,Ue)?false:(h(this,Ue,false),true)}},H=new WeakMap,ct=new WeakMap,K=new WeakMap,Ae=new WeakMap,Gt=new WeakMap,Oi=new WeakMap,he=new WeakMap,le=new WeakMap,ce=new WeakMap,Ue=new WeakMap,$e),Ia=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",yr=class{constructor(e$1,{nobrace:t,nocase:i,noext:s,noglobstar:n,platform:o=Ia}){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 ue(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 Pn(s,n,0,this.platform),a=new ue(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 Ln{constructor(t=new Map){e(this,"store");this.store=t;}copy(){return new Ln(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()]));}},za=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)])}},Ba=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())}},wr=class Nn{constructor(t,i){e(this,"hasWalkedCache");e(this,"matches",new za);e(this,"subwalks",new Ba);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 Nn(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));}},Ua=(e,t)=>typeof e=="string"?new yr([e],t):Array.isArray(e)?new yr(e,t):e,He,Jt,ke,xt,me,Us,Hr,Gn=(Hr=class{constructor(e$1,t,i){g(this,xt);e(this,"path");e(this,"patterns");e(this,"opts");e(this,"seen",new Set);e(this,"paused",false);e(this,"aborted",false);g(this,He,[]);g(this,Jt);g(this,ke);e(this,"signal");e(this,"maxDepth");e(this,"includeChildMatches");if(this.patterns=e$1,this.path=t,this.opts=i,h(this,ke,!i.posix&&i.platform==="win32"?"\\":"/"),this.includeChildMatches=i.includeChildMatches!==false,(i.ignore||!this.includeChildMatches)&&(h(this,Jt,Ua(i.ignore??[],i)),!this.includeChildMatches&&typeof f$1(this,Jt).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,He).length=0;}));}pause(){this.paused=true;}resume(){if(this.signal?.aborted)return;this.paused=false;let e;for(;!this.paused&&(e=f$1(this,He).shift());)e();}onResume(e){this.signal?.aborted||(this.paused?f$1(this,He).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,xt,me).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,xt,me).call(this,e))return;if(!this.includeChildMatches&&f$1(this,Jt)?.add){let n=`${e.relativePosix()}/**`;f$1(this,Jt).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,ke):"";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,ke))?"."+f$1(this,ke):"";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 wr(this.opts),i);}walkCB2(e,t,i$1,s){if(i(this,xt,Us).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,xt,me).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,xt,me).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 wr(this.opts),i);}walkCB2Sync(e,t,i$1,s){if(i(this,xt,Us).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,xt,me).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,xt,me).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();}},He=new WeakMap,Jt=new WeakMap,ke=new WeakMap,xt=new WeakSet,me=function(e){return this.seen.has(e)||!!f$1(this,Jt)?.ignored?.(e)},Us=function(e){return !!f$1(this,Jt)?.childrenIgnored?.(e)},Hr),br=class extends Gn{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}},Cr=class extends Gn{constructor(t,i,s){super(t,i,s);e(this,"results");this.results=new Yi({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}},$a=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Re=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||$a,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"?Qs:t.platform==="darwin"?Fn:t.platform?qs:Da;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 ue(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 Pn(h,u,0,this.platform)});}async walk(){return [...await 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}).walk()]}walkSync(){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}).walkSync()]}stream(){return new Cr(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 Cr(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()}},Ha=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let i of e)if(new ue(i,t).hasMagic())return true;return false};function es(e,t={}){return new Re(e,t).streamSync()}function Dn(e,t={}){return new Re(e,t).stream()}function Wn(e,t={}){return new Re(e,t).walkSync()}async function Sr(e,t={}){return new Re(e,t).walk()}function is(e,t={}){return new Re(e,t).iterateSync()}function Mn(e,t={}){return new Re(e,t).iterate()}var Ka=es,Qa=Object.assign(Dn,{sync:es}),qa=is,Ja=Object.assign(Mn,{sync:is}),Va=Object.assign(Wn,{stream:es,iterate:is}),Xi=Object.assign(Sr,{glob:Sr,globSync:Wn,sync:Va,globStream:Dn,stream:Qa,globStreamSync:es,streamSync:Ka,globIterate:Mn,iterate:Ja,globIterateSync:is,iterateSync:qa,Glob:Re,hasMagic:Ha,escape:en,unescape:Le});Xi.glob=Xi;var pe;(L=>{L.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(F){return t[F]>=t[i]}function n(){return i}L.getLevel=n;let o=new Map;L.Default=P({service:"default"});let h="";function l(){return h}L.file=l;let u,g,d=false,w=()=>{},S=false,x=false;async function C(F){if(d)return;if(F.print){d=true;return}F.level&&(i=F.level);let M=F.logDir||ss.join(process.env.EASBOT_LOG_PATH??process.cwd(),"logs");await initLog(F),F.logFile?h=ss.join(M,F.logFile??"gateway.log"):h=ss.join(M,"gateway.log");try{await _n.mkdir(M,{recursive:!0}),u=await _n.open(h,"a"),g=createWriteStream("",{fd:u.fd,autoClose:!1}),w=_=>{if(!(S||x||!g||g.destroyed))try{if(!g.writable)return;g.write(_,B=>{if(B&&!S){let N=B;if(N.code==="EPIPE"||N.code==="EIO"){x=!0,g?.destroy();return}S=!0,setTimeout(()=>{S=!1;},1e3);}});}catch(B){let N=B;if(N.code==="EPIPE"||N.code==="EIO"){x=!0,g?.destroy();return}S||(S=!0,setTimeout(()=>{S=!1;},1e3));}},d=!0;}catch(_){process.stderr.write(`[LOG ERROR] Failed to init log file: ${_}
|
|
4
|
-
`),w=B=>{try{process.stderr.write(B);}catch{}},d=true;}}L.init=C;async function E(){d&&(g&&!g.destroyed&&(await new Promise((F,M)=>{g.end(_=>{_?M(_):F();});}).catch(F=>{process.stderr.write(`[LOG ERROR] Failed to close log stream: ${F}
|
|
5
|
-
`);}),g=void 0),u&&(await u.close().catch(F=>{process.stderr.write(`[LOG ERROR] Failed to close log file: ${F}
|
|
6
|
-
`);}),u=void 0),w=F=>{try{process.stderr.write(F);}catch{}},d=false);}L.close=E;function k(F,M=0){let _=F.message;return F.cause instanceof Error&&M<10?_+" Caused by: "+k(F.cause,M+1):_}let O=Date.now();function P(F){F=F||{};let M=F.service;if(M&&typeof M=="string"){let N=o.get(M);if(N)return N}function _(N,ht){let Cs=Object.entries({...F,...ht}).filter(([Xs,Yt])=>Yt!=null).map(([Xs,Yt])=>{let Ss=`${Xs}=`;return Yt instanceof Error?Ss+k(Yt):typeof Yt=="object"?Ss+JSON.stringify(Yt):Ss+Yt}).join(" "),Oe=new Date,Xn=Oe.getTime()-O;return O=Oe.getTime(),[formatLogTime(Oe),"+"+Xn+"ms",Cs,N].filter(Boolean).join(" ")+`
|
|
7
|
-
`}let B={debug(N,ht){s("DEBUG")&&w("DEBUG "+_(N,ht));},info(N,ht){s("INFO")&&w("INFO "+_(N,ht));},error(N,ht){s("ERROR")&&w("ERROR "+_(N,ht));},warn(N,ht){s("WARN")&&w("WARN "+_(N,ht));},tag(N,ht){return F&&(F[N]=ht),B},clone(){return L.create({...F})},time(N,ht){let Cs=Date.now();B.info(N,{status:"started",...ht});function Oe(){B.info(N,{status:"completed",duration:Date.now()-Cs,...ht});}return {stop:Oe,[Symbol.dispose](){Oe();}}}};return M&&typeof M=="string"&&o.set(M,B),B}L.create=P;})(pe||(pe={}));a();var eh=pe.create({service:"gateway:config"});f.enum(["telegram","slack","feishu","wechat","webchat","signal","nostr"]);f.enum(["low","medium","high","critical"]);var ns=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)}),os=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)}),as=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)}),hs=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)}),ls=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)}),cs=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)}),fs=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)}),In=f.object({telegram:ns.optional(),slack:os.optional(),feishu:as.optional(),wechat:hs.optional(),webchat:ls.optional(),signal:cs.optional(),nostr:fs.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")}),ih=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")}),sh=f.object({enabled:f.boolean().default(true),tokens:f.array(ih).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")}),rh=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")}),zn=f.object({type:f.enum(["token","oauth2"]).default("token"),token:sh.optional(),oauth2:rh.optional()}),Bn=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")}),nh=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()}),Un=f.object({nodeId:f.string().describe("Current gateway node ID"),nodes:f.array(nh).default([]).describe("Other gateway nodes in the cluster"),sync:Bn.optional()}),us=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")}),ps=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)}),ds=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)}),gs=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)}),ms=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")}),ys=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:zn.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")}),rs=f.object({server:ys.optional(),channels:In.optional(),cluster:Un.optional(),connectionPool:us.optional(),messageQueue:ps.optional(),circuitBreaker:ds.optional(),agentRegistry:gs.optional(),session:ms.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 ws(e){let t=rs.safeParse(e);return t.success||eh.warn("Invalid gateway config",{issues:t.error.issues}),t.success?t.data:rs.parse({})}function oh(e){return rs.parse(e)}a();a();a();pe.create({service:"gateway:interfaces"});var Vt;function qn(){return Vt!==void 0}function Jn(){throw new Error("Agent adapter not set. Call setAgentAdapter() before using Gateway.");}var Ch={Path:{data:".easbot"}},Sh={directory:process.cwd()},Vs=class{async load(t){return Js(t)}},vh=new Vs;function Hl(){return vh}function Vn(){return Ch}function Zs(){return Sh}var Zt=pe.create({service:"gateway:config"}),$n={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}},Eh={maxConnectionsPerChannel:100,idleTimeout:3e5,reuseStrategy:"lru",healthCheckInterval:6e4,acquireTimeout:5e3,warmupCount:0},Ah={maxLength:1e4,concurrency:100,batchSize:10,batchTimeout:100,priorityLevels:4},kh={failureThreshold:5,successThreshold:3,timeout:3e4,halfOpenDuration:15e3},Th={heartbeatInterval:3e4,heartbeatTimeout:9e4,heartbeatCheckInterval:1e4,autoDeregisterTimeout:3e5,maxAgents:100,maxRegistrations:1e3},Rh={sessionTimeout:18e5,resumeGracePeriod:3e5,maxSessions:1e4},Oh={enabled:true,botToken:"",maxConnections:100,timeout:3e4},Fh={enabled:true,botToken:"",maxConnections:100,timeout:3e4},Ph={enabled:true,appId:"",appSecret:"",maxConnections:100,timeout:3e4},Lh={enabled:true,mode:"official",appId:"",appSecret:"",maxConnections:100,timeout:3e4},Nh={enabled:true,path:"/ws",heartbeatInterval:3e4,connectionTimeout:6e4,maxConnections:1e3,cors:true},Gh={enabled:true,serviceUrl:"https://chat.signal.org",phoneNumber:"",maxConnections:100,timeout:3e4},Dh={enabled:true,relays:[],maxConnections:100,timeout:3e4},Li,Ke=null;async function Yn(e){try{if(!existsSync(e))return null;let i=(await _n.readFile(e,"utf-8")).replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim();return i?JSON.parse(i):null}catch(t){return Zt.debug("Failed to load config file",{file:e,error:String(t)}),null}}function Ys(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 Wh(){let e=Vn(),t=Zs(),i=[],s=ss.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=ss.join(h,".easbot");existsSync(l)&&i.push(l);}}catch{Zt.debug("Filesystem utils not available, using basic directories");}let n=process.env.EASBOT_CONFIG_DIR;return n&&(i.push(n),Zt.debug("Using EASBOT_CONFIG_DIR",{path:n})),[...new Set(i)]}async function Mh(e){let t=["gateway.jsonc","gateway.json"],i={};for(let s of t){let n=ss.join(e,s),o=await Yn(n);o&&(i=Ys(i,o),Zt.debug("Loaded gateway config from file",{file:n}));}return i}async function _h(e){let t=["easbot.jsonc","easbot.json"];for(let i of t){let s=ss.join(e,i),n=await Yn(s);if(n?.gateway)return Zt.debug("Loaded gateway config from easbot.json",{file:s}),n.gateway}return {}}function Ih(){return Li||(Li=async()=>{let e=await Wh(),t={};for(let s of e){let n=await Mh(s);t=Ys(t,n);let o=await _h(s);t=Ys(t,o);}let i=ws(t);return Ke=i,Zt.info("Gateway config loaded",{directories:e.length,port:i.server?.port,logLevel:i.logLevel}),{config:i,directories:e}}),Li}async function yt(){return Ih()()}async function Js(e){return e&&(Li=void 0,Ke=null),(await yt()).config}function Hn(){return Ke}function Kn(){return Ke!==null}function ah(){Li=void 0,Ke=null,Zt.debug("Config cache cleared");}function hh(){return Zs().directory}async function lh(){let{config:e}=await yt();return ys.parse({...$n,...e.server})}async function ch(e){let{config:t}=await yt(),i=t.channels?.[e],n={telegram:ns.parse(Oh),slack:os.parse(Fh),feishu:as.parse(Ph),wechat:hs.parse(Lh),webchat:ls.parse(Nh),signal:cs.parse(Gh),nostr:fs.parse(Dh)}[e];if(!n)throw new Error(`Unknown channel type: ${e}`);return {...n,...i}}async function fh(){let{config:e}=await yt();return us.parse({...Eh,...e.connectionPool})}async function uh(){let{config:e}=await yt();return ps.parse({...Ah,...e.messageQueue})}async function ph(){let{config:e}=await yt();return ds.parse({...kh,...e.circuitBreaker})}async function dh(){let{config:e}=await yt();return gs.parse({...Th,...e.agentRegistry})}async function gh(){let{config:e}=await yt();return ms.parse({...Rh,...e.session})}async function mh(){let{config:e}=await yt();return e.server?.https}async function yh(){let{config:e}=await yt();return e.server?.auth}async function wh(){let{config:e}=await yt();return e.cluster}async function bh(){let{config:e}=await yt();return e.defaultAgent}async function Qn(){let{config:e}=await yt();return e.logLevel??"INFO"}
|
|
8
|
-
export{ah as A,hh as B,lh as C,ch as D,fh as E,uh as F,ph as G,dh as H,gh as I,mh as J,yh as K,wh as L,bh as M,Qn as N,qn as O,Jn as P,Hl as Q,Vn as R,Zs as S,pe as a,ns as b,os as c,as as d,hs as e,ls as f,cs as g,fs as h,In as i,jn as j,zn as k,Bn as l,Un as m,us as n,ps as o,ds as p,gs as q,ms as r,ys as s,rs as t,ws as u,oh as v,$n as w,Js as x,Hn as y,Kn as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.create;var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var h=a=>{throw TypeError(a)};var n=(a,b,c)=>b in a?f(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c;var r=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var s=(a,b)=>()=>(a&&(b=a(a=0)),b);var t=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var o=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of k(b))!m.call(a,e)&&e!==c&&f(a,e,{get:()=>b[e],enumerable:!(d=j(b,e))||d.enumerable});return a};var u=(a,b,c)=>(c=a!=null?i(l(a)):{},o(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:true}):c,a));var v=(a,b,c)=>n(a,typeof b!="symbol"?b+"":b,c),g=(a,b,c)=>b.has(a)||h("Cannot "+c);var p=(a,b,c)=>(g(a,b,"read from private field"),c?c.call(a):b.get(a)),w=(a,b,c)=>b.has(a)?h("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),q=(a,b,c,d)=>(g(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c),x=(a,b,c)=>(g(a,b,"access private method"),c);var y=(a,b,c,d)=>({set _(e){q(a,b,e,c);},get _(){return p(a,b,d)}});export{r as a,s as b,t as c,u as d,v as e,p as f,w as g,q as h,x as i,y as j};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$2,Q,S as S$1}from'./chunk-SSKI3TXN.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,y,m){super(e$1);e(this,"type");e(this,"stage");e(this,"cause");this.type="GatewayInitializationError",this.stage=y,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));S(s)||a.error("unhandled promise rejection",{error:s.message,stack:s.stack});}),process.on("uncaughtException",t=>{S(t)||(a.error("uncaught exception",{error:t.message,stack:t.stack}),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 y(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-C2YB6FKX.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=y;function m(){return t.initialized}F.isInitialized=m;function P(){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 d(){return P()()}F.state=d;async function R(){return (await d()).server}F.get=R;async function L(){return (await d()).config?.server?.enabled??false}F.isEnabled=L;async function N(){return (await d()).config}F.config=N;function T(){return e.status}F.getStatus=T;async function b(o){t.initialized||await y();let i=await d();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=b;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 b(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-5P63VGLE.mjs'),r=new n(o),g=i?.startupTimeout??3e4;if(await(async()=>{let l=new Promise((u,C)=>{setTimeout(()=>{C(new Error(`Gateway server startup timeout after ${g}ms`));},g);});try{await Promise.race([r.start(),l]);}catch(u){a.error("gateway server start failed, attempting cleanup",{error:u instanceof Error?u.message:String(u)});try{await r.stop();}catch{}throw u}})(),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 +0,0 @@
|
|
|
1
|
-
'use strict';var i=Object.create;var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var h=a=>{throw TypeError(a)};var n=(a,b,c)=>b in a?f(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c;var r=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var s=(a,b)=>()=>(a&&(b=a(a=0)),b);var t=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var o=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of k(b))!m.call(a,e)&&e!==c&&f(a,e,{get:()=>b[e],enumerable:!(d=j(b,e))||d.enumerable});return a};var u=(a,b,c)=>(c=a!=null?i(l(a)):{},o(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:true}):c,a));var v=(a,b,c)=>n(a,typeof b!="symbol"?b+"":b,c),g=(a,b,c)=>b.has(a)||h("Cannot "+c);var p=(a,b,c)=>(g(a,b,"read from private field"),c?c.call(a):b.get(a)),w=(a,b,c)=>b.has(a)?h("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),q=(a,b,c,d)=>(g(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c),x=(a,b,c)=>(g(a,b,"access private method"),c);var y=(a,b,c,d)=>({set _(e){q(a,b,e,c);},get _(){return p(a,b,d)}});exports.a=r;exports.b=s;exports.c=t;exports.d=u;exports.e=v;exports.f=p;exports.g=w;exports.h=q;exports.i=x;exports.j=y;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk2DDZUOLB_cjs=require('./chunk-2DDZUOLB.cjs'),chunkSIOB4FC7_cjs=require('./chunk-SIOB4FC7.cjs');require('./chunk-XQVVSJRM.cjs');var promises=require('fs/promises'),o=require('path'),xdgBasedir=require('xdg-basedir'),x=require('os');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);var x__default=/*#__PURE__*/_interopDefault(x);chunkSIOB4FC7_cjs.a();var s="easbot",c=o__default.default.join(xdgBasedir.xdgData,s),H=o__default.default.join(xdgBasedir.xdgCache,s),N=o__default.default.join(xdgBasedir.xdgConfig,s),j=o__default.default.join(xdgBasedir.xdgState,s);exports.Global=void 0;(e=>{e.Path={get home(){return process.env.EASBOT_TEST_HOME||x__default.default.homedir()},data:c,bin:o__default.default.join(c,"bin"),log:o__default.default.join(c,"log"),cache:H,config:N,state:j};let t=null,n=null;async function A(){if(t)return t;if(process.env.EASBOT_VERSION)return t=process.env.EASBOT_VERSION,t;try{let r=await import('./package-HISKEB3S.cjs');t=r.default?.version||r.version||"local";}catch{t="local";}return t||"local"}function E(){if(t)return t;if(process.env.EASBOT_VERSION)return t=process.env.EASBOT_VERSION,t;try{t=chunk2DDZUOLB_cjs.a.version||"local";}catch{t="local";}return t||"local"}e.getVersion=E;function l(){if(n)return n;if(process.env.EASBOT_CHANNEL)return n=process.env.EASBOT_CHANNEL,n;let r=E();return r==="local"||r.includes("dev")?n="local":r.includes("beta")||r.includes("alpha")?n="preview":n="latest",n||"local"}e.getChannel=l;function C(){return l()==="local"}e.isLocal=C;function V(){return l()==="preview"}e.isPreview=V;let u=false,a=null;async function I(){if(!u)return a||(a=(async()=>{await A(),await Promise.all([promises.mkdir(e.Path.data,{recursive:true}),promises.mkdir(e.Path.config,{recursive:true}),promises.mkdir(e.Path.state,{recursive:true}),promises.mkdir(e.Path.log,{recursive:true}),promises.mkdir(e.Path.bin,{recursive:true}),promises.mkdir(e.Path.cache,{recursive:true})]).then(()=>{process.env.EASBOT_DATA_PATH=e.Path.data,process.env.EASBOT_CONFIG_PATH=e.Path.config,process.env.EASBOT_STATE_PATH=e.Path.state,process.env.EASBOT_LOG_PATH=e.Path.log,process.env.EASBOT_BIN_PATH=e.Path.bin,process.env.EASBOT_CACHE_PATH=e.Path.cache;});let r="1",h=o__default.default.join(e.Path.cache,"version");if(await promises.readFile(h,"utf-8").catch(()=>"0")!==r){try{let p=await promises.readdir(e.Path.cache);await Promise.all(p.map(g=>promises.rm(o__default.default.join(e.Path.cache,g),{recursive:!0,force:!0})));}catch{}await promises.writeFile(h,r);}u=true;})(),a)}e.init=I;})(exports.Global||(exports.Global={}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-5RLC2FW2.mjs';import {a}from'./chunk-SJNPXLNN.mjs';import'./chunk-TY6W6O7O.mjs';import {mkdir,readFile,readdir,rm,writeFile}from'fs/promises';import o from'path';import {xdgData,xdgCache,xdgConfig,xdgState}from'xdg-basedir';import x from'os';a();var s="easbot",c=o.join(xdgData,s),H=o.join(xdgCache,s),N=o.join(xdgConfig,s),j=o.join(xdgState,s),P;(e=>{e.Path={get home(){return process.env.EASBOT_TEST_HOME||x.homedir()},data:c,bin:o.join(c,"bin"),log:o.join(c,"log"),cache:H,config:N,state:j};let t=null,n=null;async function A(){if(t)return t;if(process.env.EASBOT_VERSION)return t=process.env.EASBOT_VERSION,t;try{let r=await import('./package-VYOXRMBW.mjs');t=r.default?.version||r.version||"local";}catch{t="local";}return t||"local"}function E(){if(t)return t;if(process.env.EASBOT_VERSION)return t=process.env.EASBOT_VERSION,t;try{t=a$1.version||"local";}catch{t="local";}return t||"local"}e.getVersion=E;function l(){if(n)return n;if(process.env.EASBOT_CHANNEL)return n=process.env.EASBOT_CHANNEL,n;let r=E();return r==="local"||r.includes("dev")?n="local":r.includes("beta")||r.includes("alpha")?n="preview":n="latest",n||"local"}e.getChannel=l;function C(){return l()==="local"}e.isLocal=C;function V(){return l()==="preview"}e.isPreview=V;let u=false,a=null;async function I(){if(!u)return a||(a=(async()=>{await A(),await Promise.all([mkdir(e.Path.data,{recursive:true}),mkdir(e.Path.config,{recursive:true}),mkdir(e.Path.state,{recursive:true}),mkdir(e.Path.log,{recursive:true}),mkdir(e.Path.bin,{recursive:true}),mkdir(e.Path.cache,{recursive:true})]).then(()=>{process.env.EASBOT_DATA_PATH=e.Path.data,process.env.EASBOT_CONFIG_PATH=e.Path.config,process.env.EASBOT_STATE_PATH=e.Path.state,process.env.EASBOT_LOG_PATH=e.Path.log,process.env.EASBOT_BIN_PATH=e.Path.bin,process.env.EASBOT_CACHE_PATH=e.Path.cache;});let r="1",h=o.join(e.Path.cache,"version");if(await readFile(h,"utf-8").catch(()=>"0")!==r){try{let p=await readdir(e.Path.cache);await Promise.all(p.map(g=>rm(o.join(e.Path.cache,g),{recursive:!0,force:!0})));}catch{}await writeFile(h,r);}u=true;})(),a)}e.init=I;})(P||(P={}));export{P as Global};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk2DDZUOLB_cjs=require('./chunk-2DDZUOLB.cjs');require('./chunk-XQVVSJRM.cjs');module.exports=chunk2DDZUOLB_cjs.a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as default}from'./chunk-5RLC2FW2.mjs';import'./chunk-TY6W6O7O.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{q as ChannelPluginLoader,s as GatewayServer,r as GatewayWebSocketServer}from'./chunk-O3U6QY4W.mjs';import'./chunk-SSKI3TXN.mjs';import'./chunk-SJNPXLNN.mjs';import'./chunk-TY6W6O7O.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkNJHJCACX_cjs=require('./chunk-NJHJCACX.cjs');require('./chunk-P3MN336E.cjs'),require('./chunk-SIOB4FC7.cjs'),require('./chunk-XQVVSJRM.cjs');Object.defineProperty(exports,"ChannelPluginLoader",{enumerable:true,get:function(){return chunkNJHJCACX_cjs.q}});Object.defineProperty(exports,"GatewayServer",{enumerable:true,get:function(){return chunkNJHJCACX_cjs.s}});Object.defineProperty(exports,"GatewayWebSocketServer",{enumerable:true,get:function(){return chunkNJHJCACX_cjs.r}});
|