@mherod/get-cookie 4.0.4 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/{chunk-IRERRCUF.js → chunk-3FVH4L25.js} +2 -2
  2. package/dist/{chunk-UPNW543B.js → chunk-7XZ7PCDJ.js} +2 -2
  3. package/dist/chunk-DVWQBWUF.js +4 -0
  4. package/dist/chunk-DVWQBWUF.js.map +1 -0
  5. package/dist/{chunk-VMBA4NVU.js → chunk-I6AYGFSQ.js} +2 -2
  6. package/dist/chunk-U27I5BLR.js +2 -0
  7. package/dist/chunk-U27I5BLR.js.map +1 -0
  8. package/dist/chunk-YOZOS2YM.js +2 -0
  9. package/dist/chunk-YOZOS2YM.js.map +1 -0
  10. package/dist/cli.cjs +3 -3
  11. package/dist/cli.cjs.map +1 -1
  12. package/dist/getChromeCookie-2ROVM47V.js +2 -0
  13. package/dist/{getChromePassword-GTIXL733.js → getChromePassword-O452VQWI.js} +2 -2
  14. package/dist/getCookie-CRE6M3GI.js +2 -0
  15. package/dist/getFirefoxCookie-5P74VDC7.js +2 -0
  16. package/dist/getGroupedRenderedCookies-DFEJTTC6.js +2 -0
  17. package/dist/getMergedRenderedCookies-W5GSSHQQ.js +2 -0
  18. package/dist/index.cjs +3 -3
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +12 -12
  21. package/dist/index.d.ts +12 -12
  22. package/dist/index.js +1 -1
  23. package/package.json +1 -4
  24. package/dist/chunk-5FUMK7M3.js +0 -4
  25. package/dist/chunk-5FUMK7M3.js.map +0 -1
  26. package/dist/chunk-A6MIB6FP.js +0 -2
  27. package/dist/chunk-A6MIB6FP.js.map +0 -1
  28. package/dist/chunk-CFMK2YSL.js +0 -2
  29. package/dist/chunk-CFMK2YSL.js.map +0 -1
  30. package/dist/getChromeCookie-CL3SRRWX.js +0 -2
  31. package/dist/getCookie-WV5KDZN7.js +0 -2
  32. package/dist/getFirefoxCookie-BXQ2GXAW.js +0 -2
  33. package/dist/getGroupedRenderedCookies-FNJ6FQVQ.js +0 -2
  34. package/dist/getMergedRenderedCookies-PNC2LHSD.js +0 -2
  35. /package/dist/{chunk-IRERRCUF.js.map → chunk-3FVH4L25.js.map} +0 -0
  36. /package/dist/{chunk-UPNW543B.js.map → chunk-7XZ7PCDJ.js.map} +0 -0
  37. /package/dist/{chunk-VMBA4NVU.js.map → chunk-I6AYGFSQ.js.map} +0 -0
  38. /package/dist/{getChromeCookie-CL3SRRWX.js.map → getChromeCookie-2ROVM47V.js.map} +0 -0
  39. /package/dist/{getChromePassword-GTIXL733.js.map → getChromePassword-O452VQWI.js.map} +0 -0
  40. /package/dist/{getCookie-WV5KDZN7.js.map → getCookie-CRE6M3GI.js.map} +0 -0
  41. /package/dist/{getFirefoxCookie-BXQ2GXAW.js.map → getFirefoxCookie-5P74VDC7.js.map} +0 -0
  42. /package/dist/{getGroupedRenderedCookies-FNJ6FQVQ.js.map → getGroupedRenderedCookies-DFEJTTC6.js.map} +0 -0
  43. /package/dist/{getMergedRenderedCookies-PNC2LHSD.js.map → getMergedRenderedCookies-W5GSSHQQ.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as l,b as c}from"./chunk-5FUMK7M3.js";import{d as m,f as s}from"./chunk-56Z35D5R.js";import{join as p}from"path";function x(){let o=[],e=process.env.HOME;if(typeof e!="string"||e.length===0)return s("FirefoxCookieQuery","HOME environment variable not set"),o;let a=[p(e,"Library/Application Support/Firefox/Profiles/*/cookies.sqlite"),p(e,".mozilla/firefox/*/cookies.sqlite")];for(let f of a){let i=c(f);o.push(...i)}return m("FirefoxCookieQuery","Found Firefox cookie files",{files:o}),o}var u=class{constructor(){this.browserName="Firefox"}async queryCookies(e,a){let f=x(),i=[];for(let t of f)try{let n=await l({file:t,sql:"SELECT name, value, host as domain, expiry FROM moz_cookies WHERE name = ? AND host LIKE ?",params:[e,`%${a}%`],rowTransform:r=>({name:r.name,value:r.value,domain:r.domain,expiry:r.expiry>0?new Date(r.expiry*1e3):"Infinity",meta:{file:t,browser:"Firefox",decrypted:!1}})});i.push(...n)}catch(n){n instanceof Error?s("FirefoxCookieQuery",`Error reading Firefox cookie file ${t}`,{error:n.message}):s("FirefoxCookieQuery",`Error reading Firefox cookie file ${t}`)}return i}};export{u as a};
2
- //# sourceMappingURL=chunk-IRERRCUF.js.map
1
+ import{a as l,b as c}from"./chunk-DVWQBWUF.js";import{d as m,f as s}from"./chunk-56Z35D5R.js";import{join as p}from"path";function x(){let o=[],e=process.env.HOME;if(typeof e!="string"||e.length===0)return s("FirefoxCookieQuery","HOME environment variable not set"),o;let a=[p(e,"Library/Application Support/Firefox/Profiles/*/cookies.sqlite"),p(e,".mozilla/firefox/*/cookies.sqlite")];for(let f of a){let i=c(f);o.push(...i)}return m("FirefoxCookieQuery","Found Firefox cookie files",{files:o}),o}var u=class{constructor(){this.browserName="Firefox"}async queryCookies(e,a){let f=x(),i=[];for(let t of f)try{let n=await l({file:t,sql:"SELECT name, value, host as domain, expiry FROM moz_cookies WHERE name = ? AND host LIKE ?",params:[e,`%${a}%`],rowTransform:r=>({name:r.name,value:r.value,domain:r.domain,expiry:r.expiry>0?new Date(r.expiry*1e3):"Infinity",meta:{file:t,browser:"Firefox",decrypted:!1}})});i.push(...n)}catch(n){n instanceof Error?s("FirefoxCookieQuery",`Error reading Firefox cookie file ${t}`,{error:n.message}):s("FirefoxCookieQuery",`Error reading Firefox cookie file ${t}`)}return i}};export{u as a};
2
+ //# sourceMappingURL=chunk-3FVH4L25.js.map
@@ -1,2 +1,2 @@
1
- import{a as C,b as w}from"./chunk-5FUMK7M3.js";import{a as d,b as h,c as l,d as c,e as y}from"./chunk-56Z35D5R.js";import{existsSync as q}from"fs";import{join as p}from"path";import L from"fast-glob";import{join as D}from"path";import{merge as O}from"lodash-es";var k={};O(k,process.env);var m=k.HOME;if(typeof m!="string"||m.length===0)throw new Error("HOME environment variable is not set or empty");var E,f=D((E=m)!=null?E:"","Library","Application Support","Google","Chrome");function T(r){if(typeof r!="string")return!1;let e=r.trim();return e.length===0?!1:q(e)}async function Q(){let r=[p(f,"Default/Cookies"),p(f,"Profile */Cookies"),p(f,"Profile Default/Cookies")],e=[];for(let t of r){let o=await L(t);e.push(...o)}return c("ChromeCookies","Found cookie files",{count:e.length,files:e}),e}function I(r,e){let t=r==="%",o=t?"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE host_key LIKE ?":"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE name = ? AND host_key LIKE ?",i=t?[`%${e}%`]:[r,`%${e}%`];return{sql:o,params:i}}async function M(r,e,t){try{let{sql:o,params:i}=I(e,t);c("ChromeCookies","Executing query",{sql:o,params:i});let n=await C({file:r,sql:o,params:i,rowTransform:s=>({name:s.name,domain:s.host_key,value:s.encrypted_value,expiry:s.expires_utc})});return h("QueryCookies",!0,{file:r,count:n.length}),n}catch(o){return l("Failed to read cookie file",o,{file:r}),[]}}async function x({name:r,domain:e,file:t}){let o=typeof t=="string"&&t.length>0?[t]:await Q();if(o.length===0)return c("ChromeCookies","No cookie files found"),[];let i=[];for(let n of o){if(!T(n)){c("ChromeCookies","Cookie file missing or invalid",{file:n});continue}let s=await M(n,r,e);i.push(...s)}return c("ChromeCookies","Query complete",{totalCookies:i.length}),i}import{readFileSync as sr}from"fs";import{join as lr}from"path";var N=d.withTag("listChromeProfiles");function P(){let r=w("./**/Cookies",{cwd:f,absolute:!0});return N.debug("Found cookie files:",r),r}import{createDecipheriv as A,pbkdf2 as H}from"crypto";import{memoize as _}from"lodash-es";var $=_(r=>r.length>=3&&r[0]===118&&r[1]===49&&r[2]===48?r.slice(3):r,r=>r.toString("hex")),z=_(r=>{let e=r[r.length-1];return e&&e<=16?r.slice(0,-e):r},r=>r.toString("hex"));function G(r){var t;let e=[/.*?0t(.+)$/,/.*?1e`(.+)$/,/.*?[`'](.+)$/,/[^\x20-\x7E]*([\x20-\x7E].+)$/];for(let o of e){let i=r.match(o),n=(t=i==null?void 0:i[1])!=null?t:"";if(n.length>0)return n}return r}async function S(r,e){if(typeof e!="string")throw new Error("password must be a string");if(!Buffer.isBuffer(r))throw new Error("encryptedData must be a Buffer");return new Promise((t,o)=>{H(e,"saltysalt",1003,16,"sha1",(i,n)=>{try{if(i){o(new Error("Failed to derive key: "+i.message));return}let s=$(r);if(s.length%16!==0){o(new Error("Encrypted data length is not a multiple of 16"));return}let g=Buffer.alloc(16," "),a=A("aes-128-cbc",n,g);a.setAutoPadding(!1);let u=a.update(s);try{a.final()}catch(B){o(new Error("Failed to finalize decryption: "+B.message));return}u=z(u);let R=u.toString("utf8");t(G(R))}catch(s){o(new Error("Decryption failed: "+s.message))}})})}import{memoize as V}from"lodash-es";var v=V(async()=>{if(process.platform!=="darwin")throw l("Chrome password retrieval failed",new Error("This only works on macOS"),{platform:process.platform}),new Error("This only works on macOS");try{let{getChromePassword:r}=await import("./getChromePassword-GTIXL733.js"),e=await r();return c("ChromePassword","Retrieved password successfully",{platform:"macOS"}),e}catch(r){throw l("Chrome password retrieval failed",r,{platform:"macOS"}),r}});function W(r){return typeof r!="number"||r<=0?"Infinity":new Date(r)}function b(r,e,t,o,i,n){return{domain:r,name:e,value:t,expiry:W(o),meta:{file:i,browser:"Chrome",decrypted:n}}}var F=class{constructor(){this.logger=y("ChromeCookieQueryStrategy");this.browserName="Chrome"}async queryCookies(e,t){try{if(this.logger.info("Querying cookies",{name:e,domain:t}),process.platform!=="darwin")return this.logger.warn("Platform not supported",{platform:process.platform}),[];let o=P();if(o.length===0)return this.logger.warn("No Chrome cookie files found"),[];let i=await v();return(await Promise.all(o.map(s=>this.processFile(s,e,t,i)))).flat()}catch(o){return o instanceof Error?l("Failed to query cookies",o,{name:e,domain:t}):l("Failed to query cookies",new Error(String(o)),{name:e,domain:t}),[]}}async processFile(e,t,o,i){try{let n=await x({name:t,domain:o,file:e}),s={file:e,password:i};return(await Promise.allSettled(n.map(a=>this.processCookie(a,s)))).map(a=>a.status==="fulfilled"?a.value:null).filter(a=>a!==null)}catch(n){return n instanceof Error?this.logger.error("Failed to process cookie file",{error:n,file:e}):this.logger.error("Failed to process cookie file",{error:String(n),file:e}),[]}}async processCookie(e,t){try{let o=Buffer.isBuffer(e.value)?e.value:Buffer.from(String(e.value)),i=await S(o,t.password);return b(e.domain,e.name,i,e.expiry,t.file,!0)}catch(o){return o instanceof Error?this.logger.warn("Failed to decrypt cookie",{error:o}):this.logger.warn("Failed to decrypt cookie",{error:String(o)}),b(e.domain,e.name,e.value.toString("utf-8"),e.expiry,t.file,!1)}}};export{F as a};
2
- //# sourceMappingURL=chunk-UPNW543B.js.map
1
+ import{a as C,b as w}from"./chunk-DVWQBWUF.js";import{a as d,b as h,c as l,d as c,e as y}from"./chunk-56Z35D5R.js";import{existsSync as q}from"fs";import{join as p}from"path";import L from"fast-glob";import{join as D}from"path";import{merge as O}from"lodash-es";var k={};O(k,process.env);var m=k.HOME;if(typeof m!="string"||m.length===0)throw new Error("HOME environment variable is not set or empty");var E,f=D((E=m)!=null?E:"","Library","Application Support","Google","Chrome");function T(r){if(typeof r!="string")return!1;let e=r.trim();return e.length===0?!1:q(e)}async function Q(){let r=[p(f,"Default/Cookies"),p(f,"Profile */Cookies"),p(f,"Profile Default/Cookies")],e=[];for(let t of r){let o=await L(t);e.push(...o)}return c("ChromeCookies","Found cookie files",{count:e.length,files:e}),e}function I(r,e){let t=r==="%",o=t?"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE host_key LIKE ?":"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE name = ? AND host_key LIKE ?",i=t?[`%${e}%`]:[r,`%${e}%`];return{sql:o,params:i}}async function M(r,e,t){try{let{sql:o,params:i}=I(e,t);c("ChromeCookies","Executing query",{sql:o,params:i});let n=await C({file:r,sql:o,params:i,rowTransform:s=>({name:s.name,domain:s.host_key,value:s.encrypted_value,expiry:s.expires_utc})});return h("QueryCookies",!0,{file:r,count:n.length}),n}catch(o){return l("Failed to read cookie file",o,{file:r}),[]}}async function x({name:r,domain:e,file:t}){let o=typeof t=="string"&&t.length>0?[t]:await Q();if(o.length===0)return c("ChromeCookies","No cookie files found"),[];let i=[];for(let n of o){if(!T(n)){c("ChromeCookies","Cookie file missing or invalid",{file:n});continue}let s=await M(n,r,e);i.push(...s)}return c("ChromeCookies","Query complete",{totalCookies:i.length}),i}import{readFileSync as sr}from"fs";import{join as lr}from"path";var N=d.withTag("listChromeProfiles");function P(){let r=w("./**/Cookies",{cwd:f,absolute:!0});return N.debug("Found cookie files:",r),r}import{createDecipheriv as A,pbkdf2 as H}from"crypto";import{memoize as _}from"lodash-es";var $=_(r=>r.length>=3&&r[0]===118&&r[1]===49&&r[2]===48?r.slice(3):r,r=>r.toString("hex")),z=_(r=>{let e=r[r.length-1];return e&&e<=16?r.slice(0,-e):r},r=>r.toString("hex"));function G(r){var t;let e=[/.*?0t(.+)$/,/.*?1e`(.+)$/,/.*?[`'](.+)$/,/[^\x20-\x7E]*([\x20-\x7E].+)$/];for(let o of e){let i=r.match(o),n=(t=i==null?void 0:i[1])!=null?t:"";if(n.length>0)return n}return r}async function S(r,e){if(typeof e!="string")throw new Error("password must be a string");if(!Buffer.isBuffer(r))throw new Error("encryptedData must be a Buffer");return new Promise((t,o)=>{H(e,"saltysalt",1003,16,"sha1",(i,n)=>{try{if(i){o(new Error("Failed to derive key: "+i.message));return}let s=$(r);if(s.length%16!==0){o(new Error("Encrypted data length is not a multiple of 16"));return}let g=Buffer.alloc(16," "),a=A("aes-128-cbc",n,g);a.setAutoPadding(!1);let u=a.update(s);try{a.final()}catch(B){o(new Error("Failed to finalize decryption: "+B.message));return}u=z(u);let R=u.toString("utf8");t(G(R))}catch(s){o(new Error("Decryption failed: "+s.message))}})})}import{memoize as V}from"lodash-es";var v=V(async()=>{if(process.platform!=="darwin")throw l("Chrome password retrieval failed",new Error("This only works on macOS"),{platform:process.platform}),new Error("This only works on macOS");try{let{getChromePassword:r}=await import("./getChromePassword-O452VQWI.js"),e=await r();return c("ChromePassword","Retrieved password successfully",{platform:"macOS"}),e}catch(r){throw l("Chrome password retrieval failed",r,{platform:"macOS"}),r}});function W(r){return typeof r!="number"||r<=0?"Infinity":new Date(r)}function b(r,e,t,o,i,n){return{domain:r,name:e,value:t,expiry:W(o),meta:{file:i,browser:"Chrome",decrypted:n}}}var F=class{constructor(){this.logger=y("ChromeCookieQueryStrategy");this.browserName="Chrome"}async queryCookies(e,t){try{if(this.logger.info("Querying cookies",{name:e,domain:t}),process.platform!=="darwin")return this.logger.warn("Platform not supported",{platform:process.platform}),[];let o=P();if(o.length===0)return this.logger.warn("No Chrome cookie files found"),[];let i=await v();return(await Promise.all(o.map(s=>this.processFile(s,e,t,i)))).flat()}catch(o){return o instanceof Error?l("Failed to query cookies",o,{name:e,domain:t}):l("Failed to query cookies",new Error(String(o)),{name:e,domain:t}),[]}}async processFile(e,t,o,i){try{let n=await x({name:t,domain:o,file:e}),s={file:e,password:i};return(await Promise.allSettled(n.map(a=>this.processCookie(a,s)))).map(a=>a.status==="fulfilled"?a.value:null).filter(a=>a!==null)}catch(n){return n instanceof Error?this.logger.error("Failed to process cookie file",{error:n,file:e}):this.logger.error("Failed to process cookie file",{error:String(n),file:e}),[]}}async processCookie(e,t){try{let o=Buffer.isBuffer(e.value)?e.value:Buffer.from(String(e.value)),i=await S(o,t.password);return b(e.domain,e.name,i,e.expiry,t.file,!0)}catch(o){return o instanceof Error?this.logger.warn("Failed to decrypt cookie",{error:o}):this.logger.warn("Failed to decrypt cookie",{error:String(o)}),b(e.domain,e.name,e.value.toString("utf-8"),e.expiry,t.file,!1)}}};export{F as a};
2
+ //# sourceMappingURL=chunk-7XZ7PCDJ.js.map
@@ -0,0 +1,4 @@
1
+ import{c as Ds}from"./chunk-56Z35D5R.js";import{a as Li,b as cr,c as u,d as i,e as g,f as c,g as p,h as Os}from"./chunk-I6AYGFSQ.js";var zi=Li((Yo,Ii)=>{"use strict";Ii.exports=Pi;function Pi(h,t,e){h instanceof RegExp&&(h=Wi(h,e)),t instanceof RegExp&&(t=Wi(t,e));var s=ji(h,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+h.length,s[1]),post:e.slice(s[1]+t.length)}}function Wi(h,t){var e=t.match(h);return e?e[0]:null}Pi.range=ji;function ji(h,t,e){var s,n,r,o,l,a=e.indexOf(h),f=e.indexOf(t,a+1),d=a;if(a>=0&&f>0){if(h===t)return[a,f];for(s=[],r=e.length;d>=0&&!l;)d==a?(s.push(d),a=e.indexOf(h,d+1)):s.length==1?l=[s.pop(),f]:(n=s.pop(),n<r&&(r=n,o=f),f=e.indexOf(t,d+1)),d=a<f&&a>=0?a:f;s.length&&(l=[r,o])}return l}});var Vi=Li((Jo,Ki)=>{"use strict";var Bi=zi();Ki.exports=wr;var Ui="\0SLASH"+Math.random()+"\0",$i="\0OPEN"+Math.random()+"\0",si="\0CLOSE"+Math.random()+"\0",Gi="\0COMMA"+Math.random()+"\0",Hi="\0PERIOD"+Math.random()+"\0";function ei(h){return parseInt(h,10)==h?parseInt(h,10):h.charCodeAt(0)}function mr(h){return h.split("\\\\").join(Ui).split("\\{").join($i).split("\\}").join(si).split("\\,").join(Gi).split("\\.").join(Hi)}function gr(h){return h.split(Ui).join("\\").split($i).join("{").split(si).join("}").split(Gi).join(",").split(Hi).join(".")}function qi(h){if(!h)return[""];var t=[],e=Bi("{","}",h);if(!e)return h.split(",");var s=e.pre,n=e.body,r=e.post,o=s.split(",");o[o.length-1]+="{"+n+"}";var l=qi(r);return r.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}function wr(h){return h?(h.substr(0,2)==="{}"&&(h="\\{\\}"+h.substr(2)),Ie(mr(h),!0).map(gr)):[]}function yr(h){return"{"+h+"}"}function br(h){return/^-?0\d/.test(h)}function Sr(h,t){return h<=t}function Er(h,t){return h>=t}function Ie(h,t){var e=[],s=Bi("{","}",h);if(!s)return[h];var n=s.pre,r=s.post.length?Ie(s.post,!1):[""];if(/\$$/.test(s.pre))for(var o=0;o<r.length;o++){var l=n+"{"+s.body+"}"+r[o];e.push(l)}else{var a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),f=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),d=a||f,m=s.body.indexOf(",")>=0;if(!d&&!m)return s.post.match(/,.*\}/)?(h=s.pre+"{"+s.body+si+s.post,Ie(h)):[h];var y;if(d)y=s.body.split(/\.\./);else if(y=qi(s.body),y.length===1&&(y=Ie(y[0],!1).map(yr),y.length===1))return r.map(function(ks){return s.pre+y[0]+ks});var E;if(d){var C=ei(y[0]),w=ei(y[1]),v=Math.max(y[0].length,y[1].length),b=y.length==3?Math.abs(ei(y[2])):1,T=Sr,k=w<C;k&&(b*=-1,T=Er);var O=y.some(br);E=[];for(var D=C;T(D,w);D+=b){var z;if(f)z=String.fromCharCode(D),z==="\\"&&(z="");else if(z=String(D),O){var mt=v-z.length;if(mt>0){var ne=new Array(mt+1).join("0");D<0?z="-"+ne+z.slice(1):z=ne+z}}E.push(z)}}else{E=[];for(var gt=0;gt<y.length;gt++)E.push.apply(E,Ie(y[gt],!1))}for(var gt=0;gt<E.length;gt++)for(var o=0;o<r.length;o++){var l=n+E[gt]+r[o];(!t||d||l)&&e.push(l)}}return e}});import fr from"better-sqlite3";import{memoize as ur}from"lodash-es";var dr=ur(h=>{try{return Promise.resolve(new fr(h,{readonly:!0}))}catch(t){throw Ds("Database open failed",t,{file:h}),t}});function pr(h){try{return h.close(),Promise.resolve()}catch(t){return Ds("Database close failed",t),Promise.reject(t instanceof Error?t:new Error("Failed to close database: Unknown error"))}}async function Ko({file:h,sql:t,params:e,rowFilter:s,rowTransform:n}){let r;try{r=await dr(h);let l=r.prepare(t).all(e),a=s?l.filter(s):l;return n?a.map(n):a}catch(o){throw Ds("Database query failed",o,{file:h,sql:t}),o}finally{r&&await pr(r)}}var rn=cr(Vi(),1);var ze=h=>{if(typeof h!="string")throw new TypeError("invalid pattern");if(h.length>65536)throw new TypeError("pattern is too long")};var vr={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Be=h=>h.replace(/[[\]\\-]/g,"\\$&"),xr=h=>h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Yi=h=>h.join(""),Ji=(h,t)=>{let e=t;if(h.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],n=[],r=e+1,o=!1,l=!1,a=!1,f=!1,d=e,m="";t:for(;r<h.length;){let w=h.charAt(r);if((w==="!"||w==="^")&&r===e+1){f=!0,r++;continue}if(w==="]"&&o&&!a){d=r+1;break}if(o=!0,w==="\\"&&!a){a=!0,r++;continue}if(w==="["&&!a){for(let[v,[b,T,k]]of Object.entries(vr))if(h.startsWith(v,r)){if(m)return["$.",!1,h.length-e,!0];r+=v.length,k?n.push(b):s.push(b),l=l||T;continue t}}if(a=!1,m){w>m?s.push(Be(m)+"-"+Be(w)):w===m&&s.push(Be(w)),m="",r++;continue}if(h.startsWith("-]",r+1)){s.push(Be(w+"-")),r+=2;continue}if(h.startsWith("-",r+1)){m=w,r+=2;continue}s.push(Be(w)),r++}if(d<r)return["",!1,0,!1];if(!s.length&&!n.length)return["$.",!1,h.length-e,!0];if(n.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!f){let w=s[0].length===2?s[0].slice(-1):s[0];return[xr(w),!1,d-e,!1]}let y="["+(f?"^":"")+Yi(s)+"]",E="["+(f?"":"^")+Yi(n)+"]";return[s.length&&n.length?"("+y+"|"+E+")":s.length?y:E,l,d-e,!0]};var wt=(h,{windowsPathsNoEscape:t=!1}={})=>t?h.replace(/\[([^\/\\])\]/g,"$1"):h.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var Tr=new Set(["!","?","+","*","@"]),Xi=h=>Tr.has(h),Cr="(?!(?:^|/)\\.\\.?(?:$|/))",Fs="(?!\\.)",Rr=new Set(["[","."]),Ar=new Set(["..","."]),kr=new Set("().*{}+?[]^$\\!"),Or=h=>h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ni="[^/]",Zi=ni+"*?",Qi=ni+"+?",P,B,Lt,_,L,Gt,re,Ht,Dt,oe,Ue,he,tn,qt,Ms,ii,en,Z=class Z{constructor(t,e,s={}){g(this,he);u(this,"type");g(this,P);g(this,B);g(this,Lt,!1);g(this,_,[]);g(this,L);g(this,Gt);g(this,re);g(this,Ht,!1);g(this,Dt);g(this,oe);g(this,Ue,!1);this.type=t,t&&c(this,B,!0),c(this,L,e),c(this,P,i(this,L)?i(i(this,L),P):this),c(this,Dt,i(this,P)===this?s:i(i(this,P),Dt)),c(this,re,i(this,P)===this?[]:i(i(this,P),re)),t==="!"&&!i(i(this,P),Ht)&&i(this,re).push(this),c(this,Gt,i(this,L)?i(i(this,L),_).length:0)}get hasMagic(){if(i(this,B)!==void 0)return i(this,B);for(let t of i(this,_))if(typeof t!="string"&&(t.type||t.hasMagic))return c(this,B,!0);return i(this,B)}toString(){return i(this,oe)!==void 0?i(this,oe):this.type?c(this,oe,this.type+"("+i(this,_).map(t=>String(t)).join("|")+")"):c(this,oe,i(this,_).map(t=>String(t)).join(""))}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof Z&&i(e,L)===this))throw new Error("invalid part: "+e);i(this,_).push(e)}}toJSON(){var e;let t=this.type===null?i(this,_).slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...i(this,_).map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===i(this,P)||i(i(this,P),Ht)&&((e=i(this,L))==null?void 0:e.type)==="!")&&t.push({}),t}isStart(){var e;if(i(this,P)===this)return!0;if(!((e=i(this,L))!=null&&e.isStart()))return!1;if(i(this,Gt)===0)return!0;let t=i(this,L);for(let s=0;s<i(this,Gt);s++){let n=i(t,_)[s];if(!(n instanceof Z&&n.type==="!"))return!1}return!0}isEnd(){var e,s,n;if(i(this,P)===this||((e=i(this,L))==null?void 0:e.type)==="!")return!0;if(!((s=i(this,L))!=null&&s.isEnd()))return!1;if(!this.type)return(n=i(this,L))==null?void 0:n.isEnd();let t=i(this,L)?i(i(this,L),_).length:0;return i(this,Gt)===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new Z(this.type,t);for(let s of i(this,_))e.copyIn(s);return e}static fromGlob(t,e={}){var n;let s=new Z(null,void 0,e);return p(n=Z,qt,Ms).call(n,t,s,0,e),s}toMMPattern(){if(this!==i(this,P))return i(this,P).toMMPattern();let t=this.toString(),[e,s,n,r]=this.toRegExpSource();if(!(n||i(this,B)||i(this,Dt).nocase&&!i(this,Dt).nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let l=(i(this,Dt).nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,l),{_src:e,_glob:t})}get options(){return i(this,Dt)}toRegExpSource(t){var a;let e=t!=null?t:!!i(this,Dt).dot;if(i(this,P)===this&&p(this,he,tn).call(this),!this.type){let f=this.isStart()&&this.isEnd(),d=i(this,_).map(C=>{var k;let[w,v,b,T]=typeof C=="string"?p(k=Z,qt,en).call(k,C,i(this,B),f):C.toRegExpSource(t);return c(this,B,i(this,B)||b),c(this,Lt,i(this,Lt)||T),w}).join(""),m="";if(this.isStart()&&typeof i(this,_)[0]=="string"&&!(i(this,_).length===1&&Ar.has(i(this,_)[0]))){let w=Rr,v=e&&w.has(d.charAt(0))||d.startsWith("\\.")&&w.has(d.charAt(2))||d.startsWith("\\.\\.")&&w.has(d.charAt(4)),b=!e&&!t&&w.has(d.charAt(0));m=v?Cr:b?Fs:""}let y="";return this.isEnd()&&i(i(this,P),Ht)&&((a=i(this,L))==null?void 0:a.type)==="!"&&(y="(?:$|\\/)"),[m+d+y,wt(d),c(this,B,!!i(this,B)),i(this,Lt)]}let s=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",r=p(this,he,ii).call(this,e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let f=this.toString();return c(this,_,[f]),this.type=null,c(this,B,void 0),[f,wt(this.toString()),!1,!1]}let o=!s||t||e||!Fs?"":p(this,he,ii).call(this,!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let l="";if(this.type==="!"&&i(this,Ue))l=(this.isStart()&&!e?Fs:"")+Qi;else{let f=this.type==="!"?"))"+(this.isStart()&&!e&&!t?Fs:"")+Zi+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=n+r+f}return[l,wt(r),c(this,B,!!i(this,B)),i(this,Lt)]}};P=new WeakMap,B=new WeakMap,Lt=new WeakMap,_=new WeakMap,L=new WeakMap,Gt=new WeakMap,re=new WeakMap,Ht=new WeakMap,Dt=new WeakMap,oe=new WeakMap,Ue=new WeakMap,he=new WeakSet,tn=function(){if(this!==i(this,P))throw new Error("should only call on root");if(i(this,Ht))return this;this.toString(),c(this,Ht,!0);let t;for(;t=i(this,re).pop();){if(t.type!=="!")continue;let e=t,s=i(e,L);for(;s;){for(let n=i(e,Gt)+1;!s.type&&n<i(s,_).length;n++)for(let r of i(t,_)){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(i(s,_)[n])}e=s,s=i(e,L)}}return this},qt=new WeakSet,Ms=function(t,e,s,n){var E,C;let r=!1,o=!1,l=-1,a=!1;if(e.type===null){let w=s,v="";for(;w<t.length;){let b=t.charAt(w++);if(r||b==="\\"){r=!r,v+=b;continue}if(o){w===l+1?(b==="^"||b==="!")&&(a=!0):b==="]"&&!(w===l+2&&a)&&(o=!1),v+=b;continue}else if(b==="["){o=!0,l=w,a=!1,v+=b;continue}if(!n.noext&&Xi(b)&&t.charAt(w)==="("){e.push(v),v="";let T=new Z(b,e);w=p(E=Z,qt,Ms).call(E,t,T,w,n),e.push(T);continue}v+=b}return e.push(v),w}let f=s+1,d=new Z(null,e),m=[],y="";for(;f<t.length;){let w=t.charAt(f++);if(r||w==="\\"){r=!r,y+=w;continue}if(o){f===l+1?(w==="^"||w==="!")&&(a=!0):w==="]"&&!(f===l+2&&a)&&(o=!1),y+=w;continue}else if(w==="["){o=!0,l=f,a=!1,y+=w;continue}if(Xi(w)&&t.charAt(f)==="("){d.push(y),y="";let v=new Z(w,d);d.push(v),f=p(C=Z,qt,Ms).call(C,t,v,f,n);continue}if(w==="|"){d.push(y),y="",m.push(d),d=new Z(null,e);continue}if(w===")")return y===""&&i(e,_).length===0&&c(e,Ue,!0),d.push(y),y="",e.push(...m,d),f;y+=w}return e.type=null,c(e,B,void 0),c(e,_,[t.substring(s-1)]),f},ii=function(t){return i(this,_).map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,n,r,o]=e.toRegExpSource(t);return c(this,Lt,i(this,Lt)||o),s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")},en=function(t,e,s=!1){let n=!1,r="",o=!1;for(let l=0;l<t.length;l++){let a=t.charAt(l);if(n){n=!1,r+=(kr.has(a)?"\\":"")+a;continue}if(a==="\\"){l===t.length-1?r+="\\\\":n=!0;continue}if(a==="["){let[f,d,m,y]=Ji(t,l);if(m){r+=f,o=o||d,l+=m-1,e=e||y;continue}}if(a==="*"){s&&t==="*"?r+=Qi:r+=Zi,e=!0;continue}if(a==="?"){r+=ni,e=!0;continue}r+=Or(a)}return[r,wt(t),!!e,o]},g(Z,qt);var be=Z;var Se=(h,{windowsPathsNoEscape:t=!1}={})=>t?h.replace(/[?*()[\]]/g,"[$&]"):h.replace(/[?*()[\]\\]/g,"\\$&");var Q=(h,t,e={})=>(ze(t),!e.nocomment&&t.charAt(0)==="#"?!1:new nt(t,e).match(h)),Dr=/^\*+([^+@!?\*\[\(]*)$/,Fr=h=>t=>!t.startsWith(".")&&t.endsWith(h),Mr=h=>t=>t.endsWith(h),_r=h=>(h=h.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(h)),Nr=h=>(h=h.toLowerCase(),t=>t.toLowerCase().endsWith(h)),Lr=/^\*+\.\*+$/,Wr=h=>!h.startsWith(".")&&h.includes("."),Pr=h=>h!=="."&&h!==".."&&h.includes("."),jr=/^\.\*+$/,Ir=h=>h!=="."&&h!==".."&&h.startsWith("."),zr=/^\*+$/,Br=h=>h.length!==0&&!h.startsWith("."),Ur=h=>h.length!==0&&h!=="."&&h!=="..",$r=/^\?+([^+@!?\*\[\(]*)?$/,Gr=([h,t=""])=>{let e=on([h]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},Hr=([h,t=""])=>{let e=hn([h]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},qr=([h,t=""])=>{let e=hn([h]);return t?s=>e(s)&&s.endsWith(t):e},Kr=([h,t=""])=>{let e=on([h]);return t?s=>e(s)&&s.endsWith(t):e},on=([h])=>{let t=h.length;return e=>e.length===t&&!e.startsWith(".")},hn=([h])=>{let t=h.length;return e=>e.length===t&&e!=="."&&e!==".."},an=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",sn={win32:{sep:"\\"},posix:{sep:"/"}},Vr=an==="win32"?sn.win32.sep:sn.posix.sep;Q.sep=Vr;var V=Symbol("globstar **");Q.GLOBSTAR=V;var Yr="[^/]",Jr=Yr+"*?",Xr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Zr="(?:(?!(?:\\/|^)\\.).)*?",Qr=(h,t={})=>e=>Q(e,h,t);Q.filter=Qr;var ft=(h,t={})=>Object.assign({},h,t),to=h=>{if(!h||typeof h!="object"||!Object.keys(h).length)return Q;let t=Q;return Object.assign((s,n,r={})=>t(s,n,ft(h,r)),{Minimatch:class extends t.Minimatch{constructor(n,r={}){super(n,ft(h,r))}static defaults(n){return t.defaults(ft(h,n)).Minimatch}},AST:class extends t.AST{constructor(n,r,o={}){super(n,r,ft(h,o))}static fromGlob(n,r={}){return t.AST.fromGlob(n,ft(h,r))}},unescape:(s,n={})=>t.unescape(s,ft(h,n)),escape:(s,n={})=>t.escape(s,ft(h,n)),filter:(s,n={})=>t.filter(s,ft(h,n)),defaults:s=>t.defaults(ft(h,s)),makeRe:(s,n={})=>t.makeRe(s,ft(h,n)),braceExpand:(s,n={})=>t.braceExpand(s,ft(h,n)),match:(s,n,r={})=>t.match(s,n,ft(h,r)),sep:t.sep,GLOBSTAR:V})};Q.defaults=to;var ln=(h,t={})=>(ze(h),t.nobrace||!/\{(?:(?!\{).)*\}/.test(h)?[h]:(0,rn.default)(h));Q.braceExpand=ln;var eo=(h,t={})=>new nt(h,t).makeRe();Q.makeRe=eo;var so=(h,t,e={})=>{let s=new nt(t,e);return h=h.filter(n=>s.match(n)),s.options.nonull&&!h.length&&h.push(t),h};Q.match=so;var nn=/[?*]|[+@!]\(.*?\)|\[|\]/,io=h=>h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),nt=class{constructor(t,e={}){u(this,"options");u(this,"set");u(this,"pattern");u(this,"windowsPathsNoEscape");u(this,"nonegate");u(this,"negate");u(this,"comment");u(this,"empty");u(this,"preserveMultipleSlashes");u(this,"partial");u(this,"globSet");u(this,"globParts");u(this,"nocase");u(this,"isWindows");u(this,"platform");u(this,"windowsNoMagicRoot");u(this,"regexp");ze(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||an,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let n=this.globParts.map((r,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let a=r[0]===""&&r[1]===""&&(r[2]==="?"||!nn.test(r[2]))&&!nn.test(r[3]),f=/^[a-z]:/i.test(r[0]);if(a)return[...r.slice(0,4),...r.slice(4).map(d=>this.parse(d))];if(f)return[r[0],...r.slice(1).map(d=>this.parse(d))]}return r.map(a=>this.parse(a))});if(this.debug(this.pattern,n),this.set=n.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let n=0;n<t[s].length;n++)t[s][n]==="**"&&(t[s][n]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let n=s;for(;e[n+1]==="**";)n++;n!==s&&e.splice(s,n-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,n)=>{let r=s[s.length-1];return n==="**"&&r==="**"?s:n===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(n),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;n<t.length-1;n++){let r=t[n];n===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(n,1),n--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let n=t[s-1];n&&n!=="."&&n!==".."&&n!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let n=-1;for(;(n=s.indexOf("**",n+1))!==-1;){let o=n;for(;s[o+1]==="**";)o++;o>n&&s.splice(n+1,o-n);let l=s[n+1],a=s[n+2],f=s[n+3];if(l!==".."||!a||a==="."||a===".."||!f||f==="."||f==="..")continue;e=!0,s.splice(n,1);let d=s.slice(0);d[n]="**",t.push(d),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let l=s[o];o===1&&l===""&&s[0]===""||(l==="."||l==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let a=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...a),s.length===0&&s.push(""),r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let n=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(n){t[e]=[],t[s]=n;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let n=0,r=0,o=[],l="";for(;n<t.length&&r<e.length;)if(t[n]===e[r])o.push(l==="b"?e[r]:t[n]),n++,r++;else if(s&&t[n]==="**"&&e[r]===t[n+1])o.push(t[n]),n++;else if(s&&e[r]==="**"&&t[n]===e[r+1])o.push(e[r]),r++;else if(t[n]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(l==="b")return!1;l="a",o.push(t[n]),n++,r++}else if(e[r]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(l==="a")return!1;l="b",o.push(e[r]),n++,r++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let n=0;n<t.length&&t.charAt(n)==="!";n++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let n=this.options;if(this.isWindows){let w=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),v=!w&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),b=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),T=!b&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),k=v?3:w?0:void 0,O=T?3:b?0:void 0;if(typeof k=="number"&&typeof O=="number"){let[D,z]=[t[k],e[O]];D.toLowerCase()===z.toLowerCase()&&(e[O]=D,O>k?e=e.slice(O):k>O&&(t=t.slice(k)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var o=0,l=0,a=t.length,f=e.length;o<a&&l<f;o++,l++){this.debug("matchOne loop");var d=e[l],m=t[o];if(this.debug(e,d,m),d===!1)return!1;if(d===V){this.debug("GLOBSTAR",[e,d,m]);var y=o,E=l+1;if(E===f){for(this.debug("** at the end");o<a;o++)if(t[o]==="."||t[o]===".."||!n.dot&&t[o].charAt(0)===".")return!1;return!0}for(;y<a;){var C=t[y];if(this.debug(`
2
+ globstar while`,t,y,e,E,C),this.matchOne(t.slice(y),e.slice(E),s))return this.debug("globstar found match!",y,a,C),!0;if(C==="."||C===".."||!n.dot&&C.charAt(0)==="."){this.debug("dot detected!",t,y,e,E);break}this.debug("globstar swallow a segment, and continue"),y++}return!!(s&&(this.debug(`
3
+ >>> no match, partial?`,t,y,e,E),y===a))}let w;if(typeof d=="string"?(w=m===d,this.debug("string match",d,m,w)):(w=d.test(m),this.debug("pattern match",d,m,w)),!w)return!1}if(o===a&&l===f)return!0;if(o===a)return s;if(l===f)return o===a-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return ln(this.pattern,this.options)}parse(t){ze(t);let e=this.options;if(t==="**")return V;if(t==="")return"";let s,n=null;(s=t.match(zr))?n=e.dot?Ur:Br:(s=t.match(Dr))?n=(e.nocase?e.dot?Nr:_r:e.dot?Mr:Fr)(s[1]):(s=t.match($r))?n=(e.nocase?e.dot?Hr:Gr:e.dot?qr:Kr)(s):(s=t.match(Lr))?n=e.dot?Pr:Wr:(s=t.match(jr))&&(n=Ir);let r=be.fromGlob(t,this.options).toMMPattern();return n&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:n}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?Jr:e.dot?Xr:Zr,n=new Set(e.nocase?["i"]:[]),r=t.map(a=>{let f=a.map(d=>{if(d instanceof RegExp)for(let m of d.flags.split(""))n.add(m);return typeof d=="string"?io(d):d===V?V:d._src});return f.forEach((d,m)=>{let y=f[m+1],E=f[m-1];d!==V||E===V||(E===void 0?y!==void 0&&y!==V?f[m+1]="(?:\\/|"+s+"\\/)?"+y:f[m]=s:y===void 0?f[m-1]=E+"(?:\\/|"+s+")?":y!==V&&(f[m-1]=E+"(?:\\/|\\/"+s+"\\/)"+y,f[m+1]=V))}),f.filter(d=>d!==V).join("/")}).join("|"),[o,l]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+l+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...n].join(""))}catch(a){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let n=this.slashSplit(t);this.debug(this.pattern,"split",n);let r=this.set;this.debug(this.pattern,"set",r);let o=n[n.length-1];if(!o)for(let l=n.length-2;!o&&l>=0;l--)o=n[l];for(let l=0;l<r.length;l++){let a=r[l],f=n;if(s.matchBase&&a.length===1&&(f=[o]),this.matchOne(f,a,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return Q.defaults(t).Minimatch}};Q.AST=be;Q.Minimatch=nt;Q.escape=Se;Q.unescape=wt;import{fileURLToPath as Wo}from"node:url";var Ee=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,pn=new Set,ri=typeof process=="object"&&process?process:{},mn=(h,t,e,s)=>{typeof ri.emitWarning=="function"?ri.emitWarning(h,t,e,s):console.error(`[${e}] ${t}: ${h}`)},Ls=globalThis.AbortController,cn=globalThis.AbortSignal,fn;if(typeof Ls=="undefined"){cn=class{constructor(){u(this,"onabort");u(this,"_onabort",[]);u(this,"reason");u(this,"aborted",!1)}addEventListener(s,n){this._onabort.push(n)}},Ls=class{constructor(){u(this,"signal",new cn);t()}abort(s){var n,r;if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let o of this.signal._onabort)o(s);(r=(n=this.signal).onabort)==null||r.call(n,s)}}};let h=((fn=ri.env)==null?void 0:fn.LRU_CACHE_IGNORE_AC_WARNING)!=="1",t=()=>{h&&(h=!1,mn("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 no=h=>!pn.has(h),yh=Symbol("type"),Kt=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),gn=h=>Kt(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?ve:null:null,ve=class extends Array{constructor(t){super(t),this.fill(0)}},xe,ae=class ae{constructor(t,e){u(this,"heap");u(this,"length");if(!i(ae,xe))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}static create(t){let e=gn(t);if(!e)return[];c(ae,xe,!0);let s=new ae(t,e);return c(ae,xe,!1),s}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}};xe=new WeakMap,g(ae,xe,!1);var oi=ae,un,dn,yt,rt,bt,St,Te,Ce,j,Et,W,M,A,tt,ot,Y,U,vt,$,xt,Tt,ht,Ct,Xt,et,S,hi,le,Wt,He,at,wn,ce,Re,qe,Vt,Yt,ai,_s,Ns,F,li,$e,Jt,ci,fi=class fi{constructor(t){g(this,S);g(this,yt);g(this,rt);g(this,bt);g(this,St);g(this,Te);g(this,Ce);u(this,"ttl");u(this,"ttlResolution");u(this,"ttlAutopurge");u(this,"updateAgeOnGet");u(this,"updateAgeOnHas");u(this,"allowStale");u(this,"noDisposeOnSet");u(this,"noUpdateTTL");u(this,"maxEntrySize");u(this,"sizeCalculation");u(this,"noDeleteOnFetchRejection");u(this,"noDeleteOnStaleGet");u(this,"allowStaleOnFetchAbort");u(this,"allowStaleOnFetchRejection");u(this,"ignoreFetchAbort");g(this,j);g(this,Et);g(this,W);g(this,M);g(this,A);g(this,tt);g(this,ot);g(this,Y);g(this,U);g(this,vt);g(this,$);g(this,xt);g(this,Tt);g(this,ht);g(this,Ct);g(this,Xt);g(this,et);g(this,le,()=>{});g(this,Wt,()=>{});g(this,He,()=>{});g(this,at,()=>!1);g(this,ce,t=>{});g(this,Re,(t,e,s)=>{});g(this,qe,(t,e,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});u(this,un,"LRUCache");let{max:e=0,ttl:s,ttlResolution:n=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:l,allowStale:a,dispose:f,disposeAfter:d,noDisposeOnSet:m,noUpdateTTL:y,maxSize:E=0,maxEntrySize:C=0,sizeCalculation:w,fetchMethod:v,memoMethod:b,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:k,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:D,ignoreFetchAbort:z}=t;if(e!==0&&!Kt(e))throw new TypeError("max option must be a nonnegative integer");let mt=e?gn(e):Array;if(!mt)throw new Error("invalid max value: "+e);if(c(this,yt,e),c(this,rt,E),this.maxEntrySize=C||i(this,rt),this.sizeCalculation=w,this.sizeCalculation){if(!i(this,rt)&&!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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(c(this,Ce,b),v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,Te,v),c(this,Xt,!!v),c(this,W,new Map),c(this,M,new Array(e).fill(void 0)),c(this,A,new Array(e).fill(void 0)),c(this,tt,new mt(e)),c(this,ot,new mt(e)),c(this,Y,0),c(this,U,0),c(this,vt,oi.create(e)),c(this,j,0),c(this,Et,0),typeof f=="function"&&c(this,bt,f),typeof d=="function"?(c(this,St,d),c(this,$,[])):(c(this,St,void 0),c(this,$,void 0)),c(this,Ct,!!i(this,bt)),c(this,et,!!i(this,St)),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!y,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!D,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(i(this,rt)!==0&&!Kt(i(this,rt)))throw new TypeError("maxSize must be a positive integer if specified");if(!Kt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");p(this,S,wn).call(this)}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!k,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!l,this.ttlResolution=Kt(n)||n===0?n:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!Kt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");p(this,S,hi).call(this)}if(i(this,yt)===0&&this.ttl===0&&i(this,rt)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,yt)&&!i(this,rt)){let ne="LRU_CACHE_UNBOUNDED";no(ne)&&(pn.add(ne),mn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ne,fi))}}static unsafeExposeInternals(t){return{starts:i(t,Tt),ttls:i(t,ht),sizes:i(t,xt),keyMap:i(t,W),keyList:i(t,M),valList:i(t,A),next:i(t,tt),prev:i(t,ot),get head(){return i(t,Y)},get tail(){return i(t,U)},free:i(t,vt),isBackgroundFetch:e=>{var s;return p(s=t,S,F).call(s,e)},backgroundFetch:(e,s,n,r)=>{var o;return p(o=t,S,Ns).call(o,e,s,n,r)},moveToTail:e=>{var s;return p(s=t,S,$e).call(s,e)},indexes:e=>{var s;return p(s=t,S,Vt).call(s,e)},rindexes:e=>{var s;return p(s=t,S,Yt).call(s,e)},isStale:e=>{var s;return i(s=t,at).call(s,e)}}}get max(){return i(this,yt)}get maxSize(){return i(this,rt)}get calculatedSize(){return i(this,Et)}get size(){return i(this,j)}get fetchMethod(){return i(this,Te)}get memoMethod(){return i(this,Ce)}get dispose(){return i(this,bt)}get disposeAfter(){return i(this,St)}getRemainingTTL(t){return i(this,W).has(t)?1/0:0}*entries(){for(let t of p(this,S,Vt).call(this))i(this,A)[t]!==void 0&&i(this,M)[t]!==void 0&&!p(this,S,F).call(this,i(this,A)[t])&&(yield[i(this,M)[t],i(this,A)[t]])}*rentries(){for(let t of p(this,S,Yt).call(this))i(this,A)[t]!==void 0&&i(this,M)[t]!==void 0&&!p(this,S,F).call(this,i(this,A)[t])&&(yield[i(this,M)[t],i(this,A)[t]])}*keys(){for(let t of p(this,S,Vt).call(this)){let e=i(this,M)[t];e!==void 0&&!p(this,S,F).call(this,i(this,A)[t])&&(yield e)}}*rkeys(){for(let t of p(this,S,Yt).call(this)){let e=i(this,M)[t];e!==void 0&&!p(this,S,F).call(this,i(this,A)[t])&&(yield e)}}*values(){for(let t of p(this,S,Vt).call(this))i(this,A)[t]!==void 0&&!p(this,S,F).call(this,i(this,A)[t])&&(yield i(this,A)[t])}*rvalues(){for(let t of p(this,S,Yt).call(this))i(this,A)[t]!==void 0&&!p(this,S,F).call(this,i(this,A)[t])&&(yield i(this,A)[t])}[(dn=Symbol.iterator,un=Symbol.toStringTag,dn)](){return this.entries()}find(t,e={}){for(let s of p(this,S,Vt).call(this)){let n=i(this,A)[s],r=p(this,S,F).call(this,n)?n.__staleWhileFetching:n;if(r!==void 0&&t(r,i(this,M)[s],this))return this.get(i(this,M)[s],e)}}forEach(t,e=this){for(let s of p(this,S,Vt).call(this)){let n=i(this,A)[s],r=p(this,S,F).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(e,r,i(this,M)[s],this)}}rforEach(t,e=this){for(let s of p(this,S,Yt).call(this)){let n=i(this,A)[s],r=p(this,S,F).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(e,r,i(this,M)[s],this)}}purgeStale(){let t=!1;for(let e of p(this,S,Yt).call(this,{allowStale:!0}))i(this,at).call(this,e)&&(p(this,S,Jt).call(this,i(this,M)[e],"expire"),t=!0);return t}info(t){let e=i(this,W).get(t);if(e===void 0)return;let s=i(this,A)[e],n=p(this,S,F).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let r={value:n};if(i(this,ht)&&i(this,Tt)){let o=i(this,ht)[e],l=i(this,Tt)[e];if(o&&l){let a=o-(Ee.now()-l);r.ttl=a,r.start=Date.now()}}return i(this,xt)&&(r.size=i(this,xt)[e]),r}dump(){let t=[];for(let e of p(this,S,Vt).call(this,{allowStale:!0})){let s=i(this,M)[e],n=i(this,A)[e],r=p(this,S,F).call(this,n)?n.__staleWhileFetching:n;if(r===void 0||s===void 0)continue;let o={value:r};if(i(this,ht)&&i(this,Tt)){o.ttl=i(this,ht)[e];let l=Ee.now()-i(this,Tt)[e];o.start=Math.floor(Date.now()-l)}i(this,xt)&&(o.size=i(this,xt)[e]),t.unshift([s,o])}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let n=Date.now()-s.start;s.start=Ee.now()-n}this.set(e,s.value,s)}}set(t,e,s={}){var y,E,C,w,v;if(e===void 0)return this.delete(t),this;let{ttl:n=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:a}=s,{noUpdateTTL:f=this.noUpdateTTL}=s,d=i(this,qe).call(this,t,e,s.size||0,l);if(this.maxEntrySize&&d>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),p(this,S,Jt).call(this,t,"set"),this;let m=i(this,j)===0?void 0:i(this,W).get(t);if(m===void 0)m=i(this,j)===0?i(this,U):i(this,vt).length!==0?i(this,vt).pop():i(this,j)===i(this,yt)?p(this,S,_s).call(this,!1):i(this,j),i(this,M)[m]=t,i(this,A)[m]=e,i(this,W).set(t,m),i(this,tt)[i(this,U)]=m,i(this,ot)[m]=i(this,U),c(this,U,m),Os(this,j)._++,i(this,Re).call(this,m,d,a),a&&(a.set="add"),f=!1;else{p(this,S,$e).call(this,m);let b=i(this,A)[m];if(e!==b){if(i(this,Xt)&&p(this,S,F).call(this,b)){b.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:T}=b;T!==void 0&&!o&&(i(this,Ct)&&((y=i(this,bt))==null||y.call(this,T,t,"set")),i(this,et)&&((E=i(this,$))==null||E.push([T,t,"set"])))}else o||(i(this,Ct)&&((C=i(this,bt))==null||C.call(this,b,t,"set")),i(this,et)&&((w=i(this,$))==null||w.push([b,t,"set"])));if(i(this,ce).call(this,m),i(this,Re).call(this,m,d,a),i(this,A)[m]=e,a){a.set="replace";let T=b&&p(this,S,F).call(this,b)?b.__staleWhileFetching:b;T!==void 0&&(a.oldValue=T)}}else a&&(a.set="update")}if(n!==0&&!i(this,ht)&&p(this,S,hi).call(this),i(this,ht)&&(f||i(this,He).call(this,m,n,r),a&&i(this,Wt).call(this,a,m)),!o&&i(this,et)&&i(this,$)){let b=i(this,$),T;for(;T=b==null?void 0:b.shift();)(v=i(this,St))==null||v.call(this,...T)}return this}pop(){var t;try{for(;i(this,j);){let e=i(this,A)[i(this,Y)];if(p(this,S,_s).call(this,!0),p(this,S,F).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,et)&&i(this,$)){let e=i(this,$),s;for(;s=e==null?void 0:e.shift();)(t=i(this,St))==null||t.call(this,...s)}}}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=e,r=i(this,W).get(t);if(r!==void 0){let o=i(this,A)[r];if(p(this,S,F).call(this,o)&&o.__staleWhileFetching===void 0)return!1;if(i(this,at).call(this,r))n&&(n.has="stale",i(this,Wt).call(this,n,r));else return s&&i(this,le).call(this,r),n&&(n.has="hit",i(this,Wt).call(this,n,r)),!0}else n&&(n.has="miss");return!1}peek(t,e={}){let{allowStale:s=this.allowStale}=e,n=i(this,W).get(t);if(n===void 0||!s&&i(this,at).call(this,n))return;let r=i(this,A)[n];return p(this,S,F).call(this,r)?r.__staleWhileFetching:r}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:a=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:E=this.ignoreFetchAbort,allowStaleOnFetchAbort:C=this.allowStaleOnFetchAbort,context:w,forceRefresh:v=!1,status:b,signal:T}=e;if(!i(this,Xt))return b&&(b.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:b});let k={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:l,size:a,sizeCalculation:f,noUpdateTTL:d,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:C,ignoreFetchAbort:E,status:b,signal:T},O=i(this,W).get(t);if(O===void 0){b&&(b.fetch="miss");let D=p(this,S,Ns).call(this,t,O,k,w);return D.__returned=D}else{let D=i(this,A)[O];if(p(this,S,F).call(this,D)){let ks=s&&D.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",ks&&(b.returnedStale=!0)),ks?D.__staleWhileFetching:D.__returned=D}let z=i(this,at).call(this,O);if(!v&&!z)return b&&(b.fetch="hit"),p(this,S,$e).call(this,O),n&&i(this,le).call(this,O),b&&i(this,Wt).call(this,b,O),D;let mt=p(this,S,Ns).call(this,t,O,k,w),gt=mt.__staleWhileFetching!==void 0&&s;return b&&(b.fetch=z?"stale":"refresh",gt&&z&&(b.returnedStale=!0)),gt?mt.__staleWhileFetching:mt.__returned=mt}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=i(this,Ce);if(!s)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:r,...o}=e,l=this.get(t,o);if(!r&&l!==void 0)return l;let a=s(t,l,{options:o,context:n});return this.set(t,a,o),a}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=e,l=i(this,W).get(t);if(l!==void 0){let a=i(this,A)[l],f=p(this,S,F).call(this,a);return o&&i(this,Wt).call(this,o,l),i(this,at).call(this,l)?(o&&(o.get="stale"),f?(o&&s&&a.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?a.__staleWhileFetching:void 0):(r||p(this,S,Jt).call(this,t,"expire"),o&&s&&(o.returnedStale=!0),s?a:void 0)):(o&&(o.get="hit"),f?a.__staleWhileFetching:(p(this,S,$e).call(this,l),n&&i(this,le).call(this,l),a))}else o&&(o.get="miss")}delete(t){return p(this,S,Jt).call(this,t,"delete")}clear(){return p(this,S,ci).call(this,"delete")}};yt=new WeakMap,rt=new WeakMap,bt=new WeakMap,St=new WeakMap,Te=new WeakMap,Ce=new WeakMap,j=new WeakMap,Et=new WeakMap,W=new WeakMap,M=new WeakMap,A=new WeakMap,tt=new WeakMap,ot=new WeakMap,Y=new WeakMap,U=new WeakMap,vt=new WeakMap,$=new WeakMap,xt=new WeakMap,Tt=new WeakMap,ht=new WeakMap,Ct=new WeakMap,Xt=new WeakMap,et=new WeakMap,S=new WeakSet,hi=function(){let t=new ve(i(this,yt)),e=new ve(i(this,yt));c(this,ht,t),c(this,Tt,e),c(this,He,(r,o,l=Ee.now())=>{if(e[r]=o!==0?l:0,t[r]=o,o!==0&&this.ttlAutopurge){let a=setTimeout(()=>{i(this,at).call(this,r)&&p(this,S,Jt).call(this,i(this,M)[r],"expire")},o+1);a.unref&&a.unref()}}),c(this,le,r=>{e[r]=t[r]!==0?Ee.now():0}),c(this,Wt,(r,o)=>{if(t[o]){let l=t[o],a=e[o];if(!l||!a)return;r.ttl=l,r.start=a,r.now=s||n();let f=r.now-a;r.remainingTTL=l-f}});let s=0,n=()=>{let r=Ee.now();if(this.ttlResolution>0){s=r;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{let o=i(this,W).get(r);if(o===void 0)return 0;let l=t[o],a=e[o];if(!l||!a)return 1/0;let f=(s||n())-a;return l-f},c(this,at,r=>{let o=e[r],l=t[r];return!!l&&!!o&&(s||n())-o>l})},le=new WeakMap,Wt=new WeakMap,He=new WeakMap,at=new WeakMap,wn=function(){let t=new ve(i(this,yt));c(this,Et,0),c(this,xt,t),c(this,ce,e=>{c(this,Et,i(this,Et)-t[e]),t[e]=0}),c(this,qe,(e,s,n,r)=>{if(p(this,S,F).call(this,s))return 0;if(!Kt(n))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(n=r(s,e),!Kt(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}),c(this,Re,(e,s,n)=>{if(t[e]=s,i(this,rt)){let r=i(this,rt)-t[e];for(;i(this,Et)>r;)p(this,S,_s).call(this,!0)}c(this,Et,i(this,Et)+t[e]),n&&(n.entrySize=s,n.totalCalculatedSize=i(this,Et))})},ce=new WeakMap,Re=new WeakMap,qe=new WeakMap,Vt=function*({allowStale:t=this.allowStale}={}){if(i(this,j))for(let e=i(this,U);!(!p(this,S,ai).call(this,e)||((t||!i(this,at).call(this,e))&&(yield e),e===i(this,Y)));)e=i(this,ot)[e]},Yt=function*({allowStale:t=this.allowStale}={}){if(i(this,j))for(let e=i(this,Y);!(!p(this,S,ai).call(this,e)||((t||!i(this,at).call(this,e))&&(yield e),e===i(this,U)));)e=i(this,tt)[e]},ai=function(t){return t!==void 0&&i(this,W).get(i(this,M)[t])===t},_s=function(t){var r,o;let e=i(this,Y),s=i(this,M)[e],n=i(this,A)[e];return i(this,Xt)&&p(this,S,F).call(this,n)?n.__abortController.abort(new Error("evicted")):(i(this,Ct)||i(this,et))&&(i(this,Ct)&&((r=i(this,bt))==null||r.call(this,n,s,"evict")),i(this,et)&&((o=i(this,$))==null||o.push([n,s,"evict"]))),i(this,ce).call(this,e),t&&(i(this,M)[e]=void 0,i(this,A)[e]=void 0,i(this,vt).push(e)),i(this,j)===1?(c(this,Y,c(this,U,0)),i(this,vt).length=0):c(this,Y,i(this,tt)[e]),i(this,W).delete(s),Os(this,j)._--,e},Ns=function(t,e,s,n){let r=e===void 0?void 0:i(this,A)[e];if(p(this,S,F).call(this,r))return r;let o=new Ls,{signal:l}=s;l==null||l.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let a={signal:o.signal,options:s,context:n},f=(w,v=!1)=>{let{aborted:b}=o.signal,T=s.ignoreFetchAbort&&w!==void 0;if(s.status&&(b&&!v?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,T&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),b&&!T&&!v)return m(o.signal.reason);let k=E;return i(this,A)[e]===E&&(w===void 0?k.__staleWhileFetching?i(this,A)[e]=k.__staleWhileFetching:p(this,S,Jt).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,w,a.options))),w},d=w=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=w),m(w)),m=w=>{let{aborted:v}=o.signal,b=v&&s.allowStaleOnFetchAbort,T=b||s.allowStaleOnFetchRejection,k=T||s.noDeleteOnFetchRejection,O=E;if(i(this,A)[e]===E&&(!k||O.__staleWhileFetching===void 0?p(this,S,Jt).call(this,t,"fetch"):b||(i(this,A)[e]=O.__staleWhileFetching)),T)return s.status&&O.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),O.__staleWhileFetching;if(O.__returned===O)throw w},y=(w,v)=>{var T;let b=(T=i(this,Te))==null?void 0:T.call(this,t,r,a);b&&b instanceof Promise&&b.then(k=>w(k===void 0?void 0:k),v),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=k=>f(k,!0)))})};s.status&&(s.status.fetchDispatched=!0);let E=new Promise(y).then(f,d),C=Object.assign(E,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,C,{...a.options,status:void 0}),e=i(this,W).get(t)):i(this,A)[e]=C,C},F=function(t){if(!i(this,Xt))return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Ls},li=function(t,e){i(this,ot)[e]=t,i(this,tt)[t]=e},$e=function(t){t!==i(this,U)&&(t===i(this,Y)?c(this,Y,i(this,tt)[t]):p(this,S,li).call(this,i(this,ot)[t],i(this,tt)[t]),p(this,S,li).call(this,i(this,U),t),c(this,U,t))},Jt=function(t,e){var n,r,o,l;let s=!1;if(i(this,j)!==0){let a=i(this,W).get(t);if(a!==void 0)if(s=!0,i(this,j)===1)p(this,S,ci).call(this,e);else{i(this,ce).call(this,a);let f=i(this,A)[a];if(p(this,S,F).call(this,f)?f.__abortController.abort(new Error("deleted")):(i(this,Ct)||i(this,et))&&(i(this,Ct)&&((n=i(this,bt))==null||n.call(this,f,t,e)),i(this,et)&&((r=i(this,$))==null||r.push([f,t,e]))),i(this,W).delete(t),i(this,M)[a]=void 0,i(this,A)[a]=void 0,a===i(this,U))c(this,U,i(this,ot)[a]);else if(a===i(this,Y))c(this,Y,i(this,tt)[a]);else{let d=i(this,ot)[a];i(this,tt)[d]=i(this,tt)[a];let m=i(this,tt)[a];i(this,ot)[m]=i(this,ot)[a]}Os(this,j)._--,i(this,vt).push(a)}}if(i(this,et)&&((o=i(this,$))!=null&&o.length)){let a=i(this,$),f;for(;f=a==null?void 0:a.shift();)(l=i(this,St))==null||l.call(this,...f)}return s},ci=function(t){var e,s,n;for(let r of p(this,S,Yt).call(this,{allowStale:!0})){let o=i(this,A)[r];if(p(this,S,F).call(this,o))o.__abortController.abort(new Error("deleted"));else{let l=i(this,M)[r];i(this,Ct)&&((e=i(this,bt))==null||e.call(this,o,l,t)),i(this,et)&&((s=i(this,$))==null||s.push([o,l,t]))}}if(i(this,W).clear(),i(this,A).fill(void 0),i(this,M).fill(void 0),i(this,ht)&&i(this,Tt)&&(i(this,ht).fill(0),i(this,Tt).fill(0)),i(this,xt)&&i(this,xt).fill(0),c(this,Y,0),c(this,U,0),i(this,vt).length=0,c(this,Et,0),c(this,j,0),i(this,et)&&i(this,$)){let r=i(this,$),o;for(;o=r==null?void 0:r.shift();)(n=i(this,St))==null||n.call(this,...o)}};var Ge=fi;import{posix as go,win32 as Ei}from"node:path";import{fileURLToPath as wo}from"node:url";import{lstatSync as yo,readdir as bo,readdirSync as So,readlinkSync as Eo,realpathSync as vo}from"fs";import*as xo from"node:fs";import{lstat as Co,readdir as Ro,readlink as Ao,realpath as ko}from"node:fs/promises";import{EventEmitter as yi}from"node:events";import Bn from"node:stream";import{StringDecoder as ro}from"node:string_decoder";var yn=typeof process=="object"&&process?process:{stdout:null,stderr:null},oo=h=>!!h&&typeof h=="object"&&(h instanceof Qt||h instanceof Bn||ho(h)||ao(h)),ho=h=>!!h&&typeof h=="object"&&h instanceof yi&&typeof h.pipe=="function"&&h.pipe!==Bn.Writable.prototype.pipe,ao=h=>!!h&&typeof h=="object"&&h instanceof yi&&typeof h.write=="function"&&typeof h.end=="function",Pt=Symbol("EOF"),jt=Symbol("maybeEmitEnd"),Zt=Symbol("emittedEnd"),Ws=Symbol("emittingEnd"),Ke=Symbol("emittedError"),Ps=Symbol("closed"),bn=Symbol("read"),js=Symbol("flush"),Sn=Symbol("flushChunk"),Rt=Symbol("encoding"),Ae=Symbol("decoder"),G=Symbol("flowing"),Ve=Symbol("paused"),ke=Symbol("resume"),H=Symbol("buffer"),st=Symbol("pipes"),q=Symbol("bufferLength"),ui=Symbol("bufferPush"),Is=Symbol("bufferShift"),J=Symbol("objectMode"),N=Symbol("destroyed"),di=Symbol("error"),pi=Symbol("emitData"),En=Symbol("emitEnd"),mi=Symbol("emitEnd2"),Ft=Symbol("async"),gi=Symbol("abort"),zs=Symbol("aborted"),Ye=Symbol("signal"),fe=Symbol("dataListeners"),lt=Symbol("discarded"),Je=h=>Promise.resolve().then(h),lo=h=>h(),co=h=>h==="end"||h==="finish"||h==="prefinish",fo=h=>h instanceof ArrayBuffer||!!h&&typeof h=="object"&&h.constructor&&h.constructor.name==="ArrayBuffer"&&h.byteLength>=0,uo=h=>!Buffer.isBuffer(h)&&ArrayBuffer.isView(h),Bs=class{constructor(t,e,s){u(this,"src");u(this,"dest");u(this,"opts");u(this,"ondrain");this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[ke](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},wi=class extends Bs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=n=>e.emit("error",n),t.on("error",this.proxyErrors)}},po=h=>!!h.objectMode,mo=h=>!h.objectMode&&!!h.encoding&&h.encoding!=="buffer",vn,xn,Tn,Cn,Rn,An,kn,On,Dn,Fn,Mn,_n,Nn,Ln,Wn,Pn,jn,In,zn,Qt=class extends yi{constructor(...e){let s=e[0]||{};super();u(this,zn,!1);u(this,In,!1);u(this,jn,[]);u(this,Pn,[]);u(this,Wn);u(this,Ln);u(this,Nn);u(this,_n);u(this,Mn,!1);u(this,Fn,!1);u(this,Dn,!1);u(this,On,!1);u(this,kn,null);u(this,An,0);u(this,Rn,!1);u(this,Cn);u(this,Tn,!1);u(this,xn,0);u(this,vn,!1);u(this,"writable",!0);u(this,"readable",!0);if(s.objectMode&&typeof s.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");po(s)?(this[J]=!0,this[Rt]=null):mo(s)?(this[Rt]=s.encoding,this[J]=!1):(this[J]=!1,this[Rt]=null),this[Ft]=!!s.async,this[Ae]=this[Rt]?new ro(this[Rt]):null,s&&s.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[H]}),s&&s.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[st]});let{signal:n}=s;n&&(this[Ye]=n,n.aborted?this[gi]():n.addEventListener("abort",()=>this[gi]()))}get bufferLength(){return this[q]}get encoding(){return this[Rt]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[J]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ft]}set async(e){this[Ft]=this[Ft]||!!e}[(zn=G,In=Ve,jn=st,Pn=H,Wn=J,Ln=Rt,Nn=Ft,_n=Ae,Mn=Pt,Fn=Zt,Dn=Ws,On=Ps,kn=Ke,An=q,Rn=N,Cn=Ye,Tn=zs,xn=fe,vn=lt,gi)](){var e,s;this[zs]=!0,this.emit("abort",(e=this[Ye])==null?void 0:e.reason),this.destroy((s=this[Ye])==null?void 0:s.reason)}get aborted(){return this[zs]}set aborted(e){}write(e,s,n){var o;if(this[zs])return!1;if(this[Pt])throw new Error("write after end");if(this[N])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof s=="function"&&(n=s,s="utf8"),s||(s="utf8");let r=this[Ft]?Je:lo;if(!this[J]&&!Buffer.isBuffer(e)){if(uo(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(fo(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[J]?(this[G]&&this[q]!==0&&this[js](!0),this[G]?this.emit("data",e):this[ui](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[G]):e.length?(typeof e=="string"&&!(s===this[Rt]&&!((o=this[Ae])!=null&&o.lastNeed))&&(e=Buffer.from(e,s)),Buffer.isBuffer(e)&&this[Rt]&&(e=this[Ae].write(e)),this[G]&&this[q]!==0&&this[js](!0),this[G]?this.emit("data",e):this[ui](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[G]):(this[q]!==0&&this.emit("readable"),n&&r(n),this[G])}read(e){if(this[N])return null;if(this[lt]=!1,this[q]===0||e===0||e&&e>this[q])return this[jt](),null;this[J]&&(e=null),this[H].length>1&&!this[J]&&(this[H]=[this[Rt]?this[H].join(""):Buffer.concat(this[H],this[q])]);let s=this[bn](e||null,this[H][0]);return this[jt](),s}[bn](e,s){if(this[J])this[Is]();else{let n=s;e===n.length||e===null?this[Is]():typeof n=="string"?(this[H][0]=n.slice(e),s=n.slice(0,e),this[q]-=e):(this[H][0]=n.subarray(e),s=n.subarray(0,e),this[q]-=e)}return this.emit("data",s),!this[H].length&&!this[Pt]&&this.emit("drain"),s}end(e,s,n){return typeof e=="function"&&(n=e,e=void 0),typeof s=="function"&&(n=s,s="utf8"),e!==void 0&&this.write(e,s),n&&this.once("end",n),this[Pt]=!0,this.writable=!1,(this[G]||!this[Ve])&&this[jt](),this}[ke](){this[N]||(!this[fe]&&!this[st].length&&(this[lt]=!0),this[Ve]=!1,this[G]=!0,this.emit("resume"),this[H].length?this[js]():this[Pt]?this[jt]():this.emit("drain"))}resume(){return this[ke]()}pause(){this[G]=!1,this[Ve]=!0,this[lt]=!1}get destroyed(){return this[N]}get flowing(){return this[G]}get paused(){return this[Ve]}[ui](e){this[J]?this[q]+=1:this[q]+=e.length,this[H].push(e)}[Is](){return this[J]?this[q]-=1:this[q]-=this[H][0].length,this[H].shift()}[js](e=!1){do;while(this[Sn](this[Is]())&&this[H].length);!e&&!this[H].length&&!this[Pt]&&this.emit("drain")}[Sn](e){return this.emit("data",e),this[G]}pipe(e,s){if(this[N])return e;this[lt]=!1;let n=this[Zt];return s=s||{},e===yn.stdout||e===yn.stderr?s.end=!1:s.end=s.end!==!1,s.proxyErrors=!!s.proxyErrors,n?s.end&&e.end():(this[st].push(s.proxyErrors?new wi(this,e,s):new Bs(this,e,s)),this[Ft]?Je(()=>this[ke]()):this[ke]()),e}unpipe(e){let s=this[st].find(n=>n.dest===e);s&&(this[st].length===1?(this[G]&&this[fe]===0&&(this[G]=!1),this[st]=[]):this[st].splice(this[st].indexOf(s),1),s.unpipe())}addListener(e,s){return this.on(e,s)}on(e,s){let n=super.on(e,s);if(e==="data")this[lt]=!1,this[fe]++,!this[st].length&&!this[G]&&this[ke]();else if(e==="readable"&&this[q]!==0)super.emit("readable");else if(co(e)&&this[Zt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Ke]){let r=s;this[Ft]?Je(()=>r.call(this,this[Ke])):r.call(this,this[Ke])}return n}removeListener(e,s){return this.off(e,s)}off(e,s){let n=super.off(e,s);return e==="data"&&(this[fe]=this.listeners("data").length,this[fe]===0&&!this[lt]&&!this[st].length&&(this[G]=!1)),n}removeAllListeners(e){let s=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[fe]=0,!this[lt]&&!this[st].length&&(this[G]=!1)),s}get emittedEnd(){return this[Zt]}[jt](){!this[Ws]&&!this[Zt]&&!this[N]&&this[H].length===0&&this[Pt]&&(this[Ws]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ps]&&this.emit("close"),this[Ws]=!1)}emit(e,...s){let n=s[0];if(e!=="error"&&e!=="close"&&e!==N&&this[N])return!1;if(e==="data")return!this[J]&&!n?!1:this[Ft]?(Je(()=>this[pi](n)),!0):this[pi](n);if(e==="end")return this[En]();if(e==="close"){if(this[Ps]=!0,!this[Zt]&&!this[N])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[Ke]=n,super.emit(di,n);let o=!this[Ye]||this.listeners("error").length?super.emit("error",n):!1;return this[jt](),o}else if(e==="resume"){let o=super.emit("resume");return this[jt](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...s);return this[jt](),r}[pi](e){for(let n of this[st])n.dest.write(e)===!1&&this.pause();let s=this[lt]?!1:super.emit("data",e);return this[jt](),s}[En](){return this[Zt]?!1:(this[Zt]=!0,this.readable=!1,this[Ft]?(Je(()=>this[mi]()),!0):this[mi]())}[mi](){if(this[Ae]){let s=this[Ae].end();if(s){for(let n of this[st])n.dest.write(s);this[lt]||super.emit("data",s)}}for(let s of this[st])s.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[J]||(e.dataLength=0);let s=this.promise();return this.on("data",n=>{e.push(n),this[J]||(e.dataLength+=n.length)}),await s,e}async concat(){if(this[J])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Rt]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,s)=>{this.on(N,()=>s(new Error("stream destroyed"))),this.on("error",n=>s(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[lt]=!1;let e=!1,s=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return s();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Pt])return s();let o,l,a=y=>{this.off("data",f),this.off("end",d),this.off(N,m),s(),l(y)},f=y=>{this.off("error",a),this.off("end",d),this.off(N,m),this.pause(),o({value:y,done:!!this[Pt]})},d=()=>{this.off("error",a),this.off("data",f),this.off(N,m),s(),o({done:!0,value:void 0})},m=()=>a(new Error("stream destroyed"));return new Promise((y,E)=>{l=E,o=y,this.once(N,m),this.once("error",a),this.once("end",d),this.once("data",f)})},throw:s,return:s,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[lt]=!1;let e=!1,s=()=>(this.pause(),this.off(di,s),this.off(N,s),this.off("end",s),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return s();let r=this.read();return r===null?s():{done:!1,value:r}};return this.once("end",s),this.once(di,s),this.once(N,s),{next:n,throw:s,return:s,[Symbol.iterator](){return this}}}destroy(e){if(this[N])return e?this.emit("error",e):this.emit(N),this;this[N]=!0,this[lt]=!0,this[H].length=0,this[q]=0;let s=this;return typeof s.close=="function"&&!this[Ps]&&s.close(),e?this.emit("error",e):this.emit(N),this}static get isStream(){return oo}};var To=vo.native,Ze={lstatSync:yo,readdir:bo,readdirSync:So,readlinkSync:Eo,realpathSync:To,promises:{lstat:Co,readdir:Ro,readlink:Ao,realpath:ko}},qn=h=>!h||h===Ze||h===xo?Ze:{...Ze,...h,promises:{...Ze.promises,...h.promises||{}}},Kn=/^\\\\\?\\([a-z]:)\\?$/i,Oo=h=>h.replace(/\//g,"\\").replace(Kn,"$1\\"),Do=/[\\\/]/,dt=0,Vn=1,Yn=2,Mt=4,Jn=6,Xn=8,ue=10,Zn=12,ut=15,Xe=~ut,bi=16,Un=32,Qe=64,At=128,Us=256,Gs=512,$n=Qe|At|Gs,Fo=1023,Si=h=>h.isFile()?Xn:h.isDirectory()?Mt:h.isSymbolicLink()?ue:h.isCharacterDevice()?Yn:h.isBlockDevice()?Jn:h.isSocket()?Zn:h.isFIFO()?Vn:dt,Gn=new Map,ts=h=>{let t=Gn.get(h);if(t)return t;let e=h.normalize("NFKD");return Gn.set(h,e),e},Hn=new Map,$s=h=>{let t=Hn.get(h);if(t)return t;let e=ts(h.toLowerCase());return Hn.set(h,e),e},Vs=class extends Ge{constructor(){super({max:256})}},vi=class extends Ge{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},Qn=Symbol("PathScurry setAsCwd"),it,ns,rs,os,hs,as,ls,cs,fs,us,ds,ps,ms,gs,ws,ys,bs,Ss,Es,te,de,_t,It,zt,Bt,R,pe,Ut,Nt,x,xi,Hs,es,Ti,Ci,ss,qs,Ri,Ai,Ks,tr,er,sr,ki,Oe,De,ir,me,X=class{constructor(t,e=dt,s,n,r,o,l){g(this,x);u(this,"name");u(this,"root");u(this,"roots");u(this,"parent");u(this,"nocase");u(this,"isCWD",!1);g(this,it);g(this,ns);g(this,rs);g(this,os);g(this,hs);g(this,as);g(this,ls);g(this,cs);g(this,fs);g(this,us);g(this,ds);g(this,ps);g(this,ms);g(this,gs);g(this,ws);g(this,ys);g(this,bs);g(this,Ss);g(this,Es);g(this,te);g(this,de);g(this,_t);g(this,It);g(this,zt);g(this,Bt);g(this,R);g(this,pe);g(this,Ut);g(this,Nt);g(this,Oe,[]);g(this,De,!1);g(this,me);this.name=t,c(this,te,r?$s(t):ts(t)),c(this,R,e&Fo),this.nocase=r,this.roots=n,this.root=s||this,c(this,pe,o),c(this,_t,l.fullpath),c(this,zt,l.relative),c(this,Bt,l.relativePosix),this.parent=l.parent,this.parent?c(this,it,i(this.parent,it)):c(this,it,qn(l.fs))}get dev(){return i(this,ns)}get mode(){return i(this,rs)}get nlink(){return i(this,os)}get uid(){return i(this,hs)}get gid(){return i(this,as)}get rdev(){return i(this,ls)}get blksize(){return i(this,cs)}get ino(){return i(this,fs)}get size(){return i(this,us)}get blocks(){return i(this,ds)}get atimeMs(){return i(this,ps)}get mtimeMs(){return i(this,ms)}get ctimeMs(){return i(this,gs)}get birthtimeMs(){return i(this,ws)}get atime(){return i(this,ys)}get mtime(){return i(this,bs)}get ctime(){return i(this,Ss)}get birthtime(){return i(this,Es)}get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}depth(){return i(this,de)!==void 0?i(this,de):this.parent?c(this,de,this.parent.depth()+1):c(this,de,0)}childrenCache(){return i(this,pe)}resolve(t){var o;if(!t)return this;let e=this.getRootString(t),n=t.substring(e.length).split(this.splitSep);return e?p(o=this.getRoot(e),x,xi).call(o,n):p(this,x,xi).call(this,n)}children(){let t=i(this,pe).get(this);if(t)return t;let e=Object.assign([],{provisional:0});return i(this,pe).set(this,e),c(this,R,i(this,R)&~bi),e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),n=this.nocase?$s(t):ts(t);for(let a of s)if(i(a,te)===n)return a;let r=this.parent?this.sep:"",o=i(this,_t)?i(this,_t)+r+t:void 0,l=this.newChild(t,dt,{...e,parent:this,fullpath:o});return this.canReaddir()||c(l,R,i(l,R)|At),s.push(l),l}relative(){if(this.isCWD)return"";if(i(this,zt)!==void 0)return i(this,zt);let t=this.name,e=this.parent;if(!e)return c(this,zt,this.name);let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(i(this,Bt)!==void 0)return i(this,Bt);let t=this.name,e=this.parent;if(!e)return c(this,Bt,this.fullpathPosix());let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(i(this,_t)!==void 0)return i(this,_t);let t=this.name,e=this.parent;if(!e)return c(this,_t,this.name);let n=e.fullpath()+(e.parent?this.sep:"")+t;return c(this,_t,n)}fullpathPosix(){if(i(this,It)!==void 0)return i(this,It);if(this.sep==="/")return c(this,It,this.fullpath());if(!this.parent){let n=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(n)?c(this,It,`//?/${n}`):c(this,It,n)}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return c(this,It,s)}isUnknown(){return(i(this,R)&ut)===dt}isType(t){return this[`is${t}`]()}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(i(this,R)&ut)===Xn}isDirectory(){return(i(this,R)&ut)===Mt}isCharacterDevice(){return(i(this,R)&ut)===Yn}isBlockDevice(){return(i(this,R)&ut)===Jn}isFIFO(){return(i(this,R)&ut)===Vn}isSocket(){return(i(this,R)&ut)===Zn}isSymbolicLink(){return(i(this,R)&ue)===ue}lstatCached(){return i(this,R)&Un?this:void 0}readlinkCached(){return i(this,Ut)}realpathCached(){return i(this,Nt)}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(i(this,Ut))return!0;if(!this.parent)return!1;let t=i(this,R)&ut;return!(t!==dt&&t!==ue||i(this,R)&Us||i(this,R)&At)}calledReaddir(){return!!(i(this,R)&bi)}isENOENT(){return!!(i(this,R)&At)}isNamed(t){return this.nocase?i(this,te)===$s(t):i(this,te)===ts(t)}async readlink(){var e;let t=i(this,Ut);if(t)return t;if(this.canReadlink()&&this.parent)try{let s=await i(this,it).promises.readlink(this.fullpath()),n=(e=await this.parent.realpath())==null?void 0:e.resolve(s);if(n)return c(this,Ut,n)}catch(s){p(this,x,Ai).call(this,s.code);return}}readlinkSync(){var e;let t=i(this,Ut);if(t)return t;if(this.canReadlink()&&this.parent)try{let s=i(this,it).readlinkSync(this.fullpath()),n=(e=this.parent.realpathSync())==null?void 0:e.resolve(s);if(n)return c(this,Ut,n)}catch(s){p(this,x,Ai).call(this,s.code);return}}async lstat(){if(!(i(this,R)&At))try{return p(this,x,ki).call(this,await i(this,it).promises.lstat(this.fullpath())),this}catch(t){p(this,x,Ri).call(this,t.code)}}lstatSync(){if(!(i(this,R)&At))try{return p(this,x,ki).call(this,i(this,it).lstatSync(this.fullpath())),this}catch(t){p(this,x,Ri).call(this,t.code)}}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);e?t(null,r):queueMicrotask(()=>t(null,r));return}if(i(this,Oe).push(t),i(this,De))return;c(this,De,!0);let n=this.fullpath();i(this,it).readdir(n,{withFileTypes:!0},(r,o)=>{if(r)p(this,x,qs).call(this,r.code),s.provisional=0;else{for(let l of o)p(this,x,Ks).call(this,l,s);p(this,x,Hs).call(this,s)}p(this,x,ir).call(this,s.slice(0,s.provisional))})}async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(i(this,me))await i(this,me);else{let s=()=>{};c(this,me,new Promise(n=>s=n));try{for(let n of await i(this,it).promises.readdir(e,{withFileTypes:!0}))p(this,x,Ks).call(this,n,t);p(this,x,Hs).call(this,t)}catch(n){p(this,x,qs).call(this,n.code),t.provisional=0}c(this,me,void 0),s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let s of i(this,it).readdirSync(e,{withFileTypes:!0}))p(this,x,Ks).call(this,s,t);p(this,x,Hs).call(this,t)}catch(s){p(this,x,qs).call(this,s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(i(this,R)&$n)return!1;let t=ut&i(this,R);return t===dt||t===Mt||t===ue}shouldWalk(t,e){return(i(this,R)&Mt)===Mt&&!(i(this,R)&$n)&&!t.has(this)&&(!e||e(this))}async realpath(){if(i(this,Nt))return i(this,Nt);if(!((Gs|Us|At)&i(this,R)))try{let t=await i(this,it).promises.realpath(this.fullpath());return c(this,Nt,this.resolve(t))}catch(t){p(this,x,Ci).call(this)}}realpathSync(){if(i(this,Nt))return i(this,Nt);if(!((Gs|Us|At)&i(this,R)))try{let t=i(this,it).realpathSync(this.fullpath());return c(this,Nt,this.resolve(t))}catch(t){p(this,x,Ci).call(this)}}[Qn](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],n=this;for(;n&&n.parent;)e.add(n),c(n,zt,s.join(this.sep)),c(n,Bt,s.join("/")),n=n.parent,s.push("..");for(n=t;n&&n.parent&&!e.has(n);)c(n,zt,void 0),c(n,Bt,void 0),n=n.parent}};it=new WeakMap,ns=new WeakMap,rs=new WeakMap,os=new WeakMap,hs=new WeakMap,as=new WeakMap,ls=new WeakMap,cs=new WeakMap,fs=new WeakMap,us=new WeakMap,ds=new WeakMap,ps=new WeakMap,ms=new WeakMap,gs=new WeakMap,ws=new WeakMap,ys=new WeakMap,bs=new WeakMap,Ss=new WeakMap,Es=new WeakMap,te=new WeakMap,de=new WeakMap,_t=new WeakMap,It=new WeakMap,zt=new WeakMap,Bt=new WeakMap,R=new WeakMap,pe=new WeakMap,Ut=new WeakMap,Nt=new WeakMap,x=new WeakSet,xi=function(t){let e=this;for(let s of t)e=e.child(s);return e},Hs=function(t){var e;c(this,R,i(this,R)|bi);for(let s=t.provisional;s<t.length;s++){let n=t[s];n&&p(e=n,x,es).call(e)}},es=function(){i(this,R)&At||(c(this,R,(i(this,R)|At)&Xe),p(this,x,Ti).call(this))},Ti=function(){var e;let t=this.children();t.provisional=0;for(let s of t)p(e=s,x,es).call(e)},Ci=function(){c(this,R,i(this,R)|Gs),p(this,x,ss).call(this)},ss=function(){if(i(this,R)&Qe)return;let t=i(this,R);(t&ut)===Mt&&(t&=Xe),c(this,R,t|Qe),p(this,x,Ti).call(this)},qs=function(t=""){t==="ENOTDIR"||t==="EPERM"?p(this,x,ss).call(this):t==="ENOENT"?p(this,x,es).call(this):this.children().provisional=0},Ri=function(t=""){var e;if(t==="ENOTDIR"){let s=this.parent;p(e=s,x,ss).call(e)}else t==="ENOENT"&&p(this,x,es).call(this)},Ai=function(t=""){var s;let e=i(this,R);e|=Us,t==="ENOENT"&&(e|=At),(t==="EINVAL"||t==="UNKNOWN")&&(e&=Xe),c(this,R,e),t==="ENOTDIR"&&this.parent&&p(s=this.parent,x,ss).call(s)},Ks=function(t,e){return p(this,x,er).call(this,t,e)||p(this,x,tr).call(this,t,e)},tr=function(t,e){let s=Si(t),n=this.newChild(t.name,s,{parent:this}),r=i(n,R)&ut;return r!==Mt&&r!==ue&&r!==dt&&c(n,R,i(n,R)|Qe),e.unshift(n),e.provisional++,n},er=function(t,e){for(let s=e.provisional;s<e.length;s++){let n=e[s];if((this.nocase?$s(t.name):ts(t.name))===i(n,te))return p(this,x,sr).call(this,t,n,s,e)}},sr=function(t,e,s,n){let r=e.name;return c(e,R,i(e,R)&Xe|Si(t)),r!==t.name&&(e.name=t.name),s!==n.provisional&&(s===n.length-1?n.pop():n.splice(s,1),n.unshift(e)),n.provisional++,e},ki=function(t){let{atime:e,atimeMs:s,birthtime:n,birthtimeMs:r,blksize:o,blocks:l,ctime:a,ctimeMs:f,dev:d,gid:m,ino:y,mode:E,mtime:C,mtimeMs:w,nlink:v,rdev:b,size:T,uid:k}=t;c(this,ys,e),c(this,ps,s),c(this,Es,n),c(this,ws,r),c(this,cs,o),c(this,ds,l),c(this,Ss,a),c(this,gs,f),c(this,ns,d),c(this,as,m),c(this,fs,y),c(this,rs,E),c(this,bs,C),c(this,ms,w),c(this,os,v),c(this,ls,b),c(this,us,T),c(this,hs,k);let O=Si(t);c(this,R,i(this,R)&Xe|O|Un),O!==dt&&O!==Mt&&O!==ue&&c(this,R,i(this,R)|Qe)},Oe=new WeakMap,De=new WeakMap,ir=function(t){c(this,De,!1);let e=i(this,Oe).slice();i(this,Oe).length=0,e.forEach(s=>s(null,t))},me=new WeakMap;var Ys=class h extends X{constructor(e,s=dt,n,r,o,l,a){super(e,s,n,r,o,l,a);u(this,"sep","\\");u(this,"splitSep",Do)}newChild(e,s=dt,n={}){return new h(e,s,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return Ei.parse(e).root}getRoot(e){if(e=Oo(e.toUpperCase()),e===this.root.name)return this.root;for(let[s,n]of Object.entries(this.roots))if(this.sameRoot(e,s))return this.roots[e]=n;return this.roots[e]=new _e(e,this).root}sameRoot(e,s=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(Kn,"$1\\"),e===s}},Js=class h extends X{constructor(e,s=dt,n,r,o,l,a){super(e,s,n,r,o,l,a);u(this,"splitSep","/");u(this,"sep","/")}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,s=dt,n={}){return new h(e,s,this.root,this.roots,this.nocase,this.childrenCache(),n)}},Fe,Me,vs,xs,Xs=class{constructor(t=process.cwd(),e,s,{nocase:n,childrenCacheSize:r=16*1024,fs:o=Ze}={}){u(this,"root");u(this,"rootPath");u(this,"roots");u(this,"cwd");g(this,Fe);g(this,Me);g(this,vs);u(this,"nocase");g(this,xs);c(this,xs,qn(o)),(t instanceof URL||t.startsWith("file://"))&&(t=wo(t));let l=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(l),c(this,Fe,new Vs),c(this,Me,new Vs),c(this,vs,new vi(r));let a=l.substring(this.rootPath.length).split(s);if(a.length===1&&!a[0]&&a.pop(),n===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=n,this.root=this.newRoot(i(this,xs)),this.roots[this.rootPath]=this.root;let f=this.root,d=a.length-1,m=e.sep,y=this.rootPath,E=!1;for(let C of a){let w=d--;f=f.child(C,{relative:new Array(w).fill("..").join(m),relativePosix:new Array(w).fill("..").join("/"),fullpath:y+=(E?"":m)+C}),E=!0}this.cwd=f}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return i(this,vs)}resolve(...t){let e="";for(let r=t.length-1;r>=0;r--){let o=t[r];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=i(this,Fe).get(e);if(s!==void 0)return s;let n=this.cwd.resolve(e).fullpath();return i(this,Fe).set(e,n),n}resolvePosix(...t){let e="";for(let r=t.length-1;r>=0;r--){let o=t[r];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=i(this,Me).get(e);if(s!==void 0)return s;let n=this.cwd.resolve(e).fullpathPosix();return i(this,Me).set(e,n),n}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let n=await t.readdir();return s?n:n.map(r=>r.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(n=>n.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s==null?void 0:s.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s==null?void 0:s.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s==null?void 0:s.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s==null?void 0:s.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:n=!1,filter:r,walkFilter:o}=e,l=[];(!r||r(t))&&l.push(s?t:t.fullpath());let a=new Set,f=(m,y)=>{a.add(m),m.readdirCB((E,C)=>{if(E)return y(E);let w=C.length;if(!w)return y();let v=()=>{--w===0&&y()};for(let b of C)(!r||r(b))&&l.push(s?b:b.fullpath()),n&&b.isSymbolicLink()?b.realpath().then(T=>T!=null&&T.isUnknown()?T.lstat():T).then(T=>T!=null&&T.shouldWalk(a,o)?f(T,v):v()):b.shouldWalk(a,o)?f(b,v):v()},!0)},d=t;return new Promise((m,y)=>{f(d,E=>{if(E)return y(E);m(l)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:n=!1,filter:r,walkFilter:o}=e,l=[];(!r||r(t))&&l.push(s?t:t.fullpath());let a=new Set([t]);for(let f of a){let d=f.readdirSync();for(let m of d){(!r||r(m))&&l.push(s?m:m.fullpath());let y=m;if(m.isSymbolicLink()){if(!(n&&(y=m.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(a,o)&&a.add(y)}}return l}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:n=!1,filter:r,walkFilter:o}=e;(!r||r(t))&&(yield s?t:t.fullpath());let l=new Set([t]);for(let a of l){let f=a.readdirSync();for(let d of f){(!r||r(d))&&(yield s?d:d.fullpath());let m=d;if(d.isSymbolicLink()){if(!(n&&(m=d.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(l,o)&&l.add(m)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:n=!1,filter:r,walkFilter:o}=e,l=new Qt({objectMode:!0});(!r||r(t))&&l.write(s?t:t.fullpath());let a=new Set,f=[t],d=0,m=()=>{let y=!1;for(;!y;){let E=f.shift();if(!E){d===0&&l.end();return}d++,a.add(E);let C=(v,b,T=!1)=>{if(v)return l.emit("error",v);if(n&&!T){let k=[];for(let O of b)O.isSymbolicLink()&&k.push(O.realpath().then(D=>D!=null&&D.isUnknown()?D.lstat():D));if(k.length){Promise.all(k).then(()=>C(null,b,!0));return}}for(let k of b)k&&(!r||r(k))&&(l.write(s?k:k.fullpath())||(y=!0));d--;for(let k of b){let O=k.realpathCached()||k;O.shouldWalk(a,o)&&f.push(O)}y&&!l.flowing?l.once("drain",m):w||m()},w=!0;E.readdirCB(C,!0),w=!1}};return m(),l}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:n=!1,filter:r,walkFilter:o}=e,l=new Qt({objectMode:!0}),a=new Set;(!r||r(t))&&l.write(s?t:t.fullpath());let f=[t],d=0,m=()=>{let y=!1;for(;!y;){let E=f.shift();if(!E){d===0&&l.end();return}d++,a.add(E);let C=E.readdirSync();for(let w of C)(!r||r(w))&&(l.write(s?w:w.fullpath())||(y=!0));d--;for(let w of C){let v=w;if(w.isSymbolicLink()){if(!(n&&(v=w.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(a,o)&&f.push(v)}}y&&!l.flowing&&l.once("drain",m)};return m(),l}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[Qn](e)}};Fe=new WeakMap,Me=new WeakMap,vs=new WeakMap,xs=new WeakMap;var _e=class extends Xs{constructor(e=process.cwd(),s={}){let{nocase:n=!0}=s;super(e,Ei,"\\",{...s,nocase:n});u(this,"sep","\\");this.nocase=n;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(e){return Ei.parse(e).root.toUpperCase()}newRoot(e){return new Ys(this.rootPath,Mt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Ne=class extends Xs{constructor(e=process.cwd(),s={}){let{nocase:n=!1}=s;super(e,go,"/",{...s,nocase:n});u(this,"sep","/");this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new Js(this.rootPath,Mt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},is=class extends Ne{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},Mh=process.platform==="win32"?Ys:Js,nr=process.platform==="win32"?_e:process.platform==="darwin"?is:Ne;var Mo=h=>h.length>=1,_o=h=>h.length>=1,I,ct,K,ge,kt,Ts,ee,se,ie,Le,Oi=class Oi{constructor(t,e,s,n){g(this,I);g(this,ct);g(this,K);u(this,"length");g(this,ge);g(this,kt);g(this,Ts);g(this,ee);g(this,se);g(this,ie);g(this,Le,!0);if(!Mo(t))throw new TypeError("empty pattern list");if(!_o(e))throw new TypeError("empty glob list");if(e.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(c(this,I,t),c(this,ct,e),c(this,K,s),c(this,ge,n),i(this,K)===0){if(this.isUNC()){let[r,o,l,a,...f]=i(this,I),[d,m,y,E,...C]=i(this,ct);f[0]===""&&(f.shift(),C.shift());let w=[r,o,l,a,""].join("/"),v=[d,m,y,E,""].join("/");c(this,I,[w,...f]),c(this,ct,[v,...C]),this.length=i(this,I).length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=i(this,I),[l,...a]=i(this,ct);o[0]===""&&(o.shift(),a.shift());let f=r+"/",d=l+"/";c(this,I,[f,...o]),c(this,ct,[d,...a]),this.length=i(this,I).length}}}pattern(){return i(this,I)[i(this,K)]}isString(){return typeof i(this,I)[i(this,K)]=="string"}isGlobstar(){return i(this,I)[i(this,K)]===V}isRegExp(){return i(this,I)[i(this,K)]instanceof RegExp}globString(){return c(this,Ts,i(this,Ts)||(i(this,K)===0?this.isAbsolute()?i(this,ct)[0]+i(this,ct).slice(1).join("/"):i(this,ct).join("/"):i(this,ct).slice(i(this,K)).join("/")))}hasMore(){return this.length>i(this,K)+1}rest(){return i(this,kt)!==void 0?i(this,kt):this.hasMore()?(c(this,kt,new Oi(i(this,I),i(this,ct),i(this,K)+1,i(this,ge))),c(i(this,kt),ie,i(this,ie)),c(i(this,kt),se,i(this,se)),c(i(this,kt),ee,i(this,ee)),i(this,kt)):c(this,kt,null)}isUNC(){let t=i(this,I);return i(this,se)!==void 0?i(this,se):c(this,se,i(this,ge)==="win32"&&i(this,K)===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3])}isDrive(){let t=i(this,I);return i(this,ee)!==void 0?i(this,ee):c(this,ee,i(this,ge)==="win32"&&i(this,K)===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]))}isAbsolute(){let t=i(this,I);return i(this,ie)!==void 0?i(this,ie):c(this,ie,t[0]===""&&t.length>1||this.isDrive()||this.isUNC())}root(){let t=i(this,I)[0];return typeof t=="string"&&this.isAbsolute()&&i(this,K)===0?t:""}checkFollowGlobstar(){return!(i(this,K)===0||!this.isGlobstar()||!i(this,Le))}markFollowGlobstar(){return i(this,K)===0||!this.isGlobstar()||!i(this,Le)?!1:(c(this,Le,!1),!0)}};I=new WeakMap,ct=new WeakMap,K=new WeakMap,ge=new WeakMap,kt=new WeakMap,Ts=new WeakMap,ee=new WeakMap,se=new WeakMap,ie=new WeakMap,Le=new WeakMap;var We=Oi;var No=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Pe=class{constructor(t,{nobrace:e,nocase:s,noext:n,noglobstar:r,platform:o=No}){u(this,"relative");u(this,"relativeChildren");u(this,"absolute");u(this,"absoluteChildren");u(this,"platform");u(this,"mmopts");this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:n,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let l of t)this.add(l)}add(t){let e=new nt(t,this.mmopts);for(let s=0;s<e.set.length;s++){let n=e.set[s],r=e.globParts[s];if(!n||!r)throw new Error("invalid pattern object");for(;n[0]==="."&&r[0]===".";)n.shift(),r.shift();let o=new We(n,r,0,this.platform),l=new nt(o.globString(),this.mmopts),a=r[r.length-1]==="**",f=o.isAbsolute();f?this.absolute.push(l):this.relative.push(l),a&&(f?this.absoluteChildren.push(l):this.relativeChildren.push(l))}}ignored(t){let e=t.fullpath(),s=`${e}/`,n=t.relative()||".",r=`${n}/`;for(let o of this.relative)if(o.match(n)||o.match(r))return!0;for(let o of this.absolute)if(o.match(e)||o.match(s))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let n of this.relativeChildren)if(n.match(s))return!0;for(let n of this.absoluteChildren)if(n.match(e))return!0;return!1}};var Di=class h{constructor(t=new Map){u(this,"store");this.store=t}copy(){return new h(new Map(this.store))}hasWalked(t,e){var s;return(s=this.store.get(t.fullpath()))==null?void 0:s.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),n=this.store.get(s);n?n.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},Fi=class{constructor(){u(this,"store",new Map)}add(t,e,s){let n=(e?2:0)|(s?1:0),r=this.store.get(t);this.store.set(t,r===void 0?n:n&r)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},Mi=class{constructor(){u(this,"store",new Map)}add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(n=>n.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},Cs=class h{constructor(t,e){u(this,"hasWalkedCache");u(this,"matches",new Fi);u(this,"subwalks",new Mi);u(this,"patterns");u(this,"follow");u(this,"dot");u(this,"opts");this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new Di}processPatterns(t,e){this.patterns=e;let s=e.map(n=>[t,n]);for(let[n,r]of s){this.hasWalkedCache.storeWalked(n,r);let o=r.root(),l=r.isAbsolute()&&this.opts.absolute!==!1;if(o){n=n.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let m=r.rest();if(m)r=m;else{this.matches.add(n,!0,!1);continue}}if(n.isENOENT())continue;let a,f,d=!1;for(;typeof(a=r.pattern())=="string"&&(f=r.rest());)n=n.resolve(a),r=f,d=!0;if(a=r.pattern(),f=r.rest(),d){if(this.hasWalkedCache.hasWalked(n,r))continue;this.hasWalkedCache.storeWalked(n,r)}if(typeof a=="string"){let m=a===".."||a===""||a===".";this.matches.add(n.resolve(a),l,m);continue}else if(a===V){(!n.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(n,r);let m=f==null?void 0:f.pattern(),y=f==null?void 0:f.rest();if(!f||(m===""||m===".")&&!y)this.matches.add(n,l,m===""||m===".");else if(m===".."){let E=n.parent||n;y?this.hasWalkedCache.hasWalked(E,y)||this.subwalks.add(E,y):this.matches.add(E,l,!0)}}else a instanceof RegExp&&this.subwalks.add(n,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new h(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),n=this.child();for(let r of e)for(let o of s){let l=o.isAbsolute(),a=o.pattern(),f=o.rest();a===V?n.testGlobstar(r,o,f,l):a instanceof RegExp?n.testRegExp(r,a,f,l):n.testString(r,a,f,l)}return n}testGlobstar(t,e,s,n){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,n,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(t,r,s.rest(),n);else if(r===".."){let o=t.parent||t;this.subwalks.add(o,s)}else r instanceof RegExp&&this.testRegExp(t,r,s.rest(),n)}}testRegExp(t,e,s,n){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,n,!1))}testString(t,e,s,n){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,n,!1))}};var Lo=(h,t)=>typeof h=="string"?new Pe([h],t):Array.isArray(h)?new Pe(h,t):h,je,$t,ye,pt,we,_i,Zs=class{constructor(t,e,s){g(this,pt);u(this,"path");u(this,"patterns");u(this,"opts");u(this,"seen",new Set);u(this,"paused",!1);u(this,"aborted",!1);g(this,je,[]);g(this,$t);g(this,ye);u(this,"signal");u(this,"maxDepth");u(this,"includeChildMatches");var n;if(this.patterns=t,this.path=e,this.opts=s,c(this,ye,!s.posix&&s.platform==="win32"?"\\":"/"),this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(c(this,$t,Lo((n=s.ignore)!=null?n:[],s)),!this.includeChildMatches&&typeof i(this,$t).add!="function")){let r="cannot ignore child matches, ignore lacks add() method.";throw new Error(r)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{i(this,je).length=0}))}pause(){this.paused=!0}resume(){var e;if((e=this.signal)!=null&&e.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=i(this,je).shift());)t()}onResume(t){var e;(e=this.signal)!=null&&e.aborted||(this.paused?i(this,je).push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let r=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&(r!=null&&r.isSymbolicLink())){let o=await r.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(r,e)}matchCheckTest(t,e){var s;return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!((s=t.realpathCached())!=null&&s.isDirectory()))&&!p(this,pt,we).call(this,t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let r=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&(r!=null&&r.isSymbolicLink())){let o=r.realpathSync();o&&(o!=null&&o.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(r,e)}matchFinish(t,e){var r;if(p(this,pt,we).call(this,t))return;if(!this.includeChildMatches&&((r=i(this,$t))!=null&&r.add)){let o=`${t.relativePosix()}/**`;i(this,$t).add(o)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let n=this.opts.mark&&t.isDirectory()?i(this,ye):"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let o=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(o+n)}else{let o=this.opts.posix?t.relativePosix():t.relative(),l=this.opts.dotRelative&&!o.startsWith(".."+i(this,ye))?"."+i(this,ye):"";this.matchEmit(o?l+o+n:"."+n)}}async match(t,e,s){let n=await this.matchCheck(t,s);n&&this.matchFinish(n,e)}matchSync(t,e,s){let n=this.matchCheckSync(t,s);n&&this.matchFinish(n,e)}walkCB(t,e,s){var n;(n=this.signal)!=null&&n.aborted&&s(),this.walkCB2(t,e,new Cs(this.opts),s)}walkCB2(t,e,s,n){var l;if(p(this,pt,_i).call(this,t))return n();if((l=this.signal)!=null&&l.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,n));return}s.processPatterns(t,e);let r=1,o=()=>{--r===0&&n()};for(let[a,f,d]of s.matches.entries())p(this,pt,we).call(this,a)||(r++,this.match(a,f,d).then(()=>o()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let f=a.readdirCached();a.calledReaddir()?this.walkCB3(a,f,s,o):a.readdirCB((d,m)=>this.walkCB3(a,m,s,o),!0)}o()}walkCB3(t,e,s,n){s=s.filterEntries(t,e);let r=1,o=()=>{--r===0&&n()};for(let[l,a,f]of s.matches.entries())p(this,pt,we).call(this,l)||(r++,this.match(l,a,f).then(()=>o()));for(let[l,a]of s.subwalks.entries())r++,this.walkCB2(l,a,s.child(),o);o()}walkCBSync(t,e,s){var n;(n=this.signal)!=null&&n.aborted&&s(),this.walkCB2Sync(t,e,new Cs(this.opts),s)}walkCB2Sync(t,e,s,n){var l;if(p(this,pt,_i).call(this,t))return n();if((l=this.signal)!=null&&l.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,n));return}s.processPatterns(t,e);let r=1,o=()=>{--r===0&&n()};for(let[a,f,d]of s.matches.entries())p(this,pt,we).call(this,a)||this.matchSync(a,f,d);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let f=a.readdirSync();this.walkCB3Sync(a,f,s,o)}o()}walkCB3Sync(t,e,s,n){s=s.filterEntries(t,e);let r=1,o=()=>{--r===0&&n()};for(let[l,a,f]of s.matches.entries())p(this,pt,we).call(this,l)||this.matchSync(l,a,f);for(let[l,a]of s.subwalks.entries())r++,this.walkCB2Sync(l,a,s.child(),o);o()}};je=new WeakMap,$t=new WeakMap,ye=new WeakMap,pt=new WeakSet,we=function(t){var e,s;return this.seen.has(t)||!!((s=(e=i(this,$t))==null?void 0:e.ignored)!=null&&s.call(e,t))},_i=function(t){var e,s;return!!((s=(e=i(this,$t))==null?void 0:e.childrenIgnored)!=null&&s.call(e,t))};var Rs=class extends Zs{constructor(e,s,n){super(e,s,n);u(this,"matches",new Set)}matchEmit(e){this.matches.add(e)}async walk(){var e;if((e=this.signal)!=null&&e.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,n)=>{this.walkCB(this.path,this.patterns,()=>{var r;(r=this.signal)!=null&&r.aborted?n(this.signal.reason):s(this.matches)})}),this.matches}walkSync(){var e;if((e=this.signal)!=null&&e.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{var s;if((s=this.signal)!=null&&s.aborted)throw this.signal.reason}),this.matches}},As=class extends Zs{constructor(e,s,n){super(e,s,n);u(this,"results");this.results=new Qt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,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}};var Po=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ot=class{constructor(t,e){u(this,"absolute");u(this,"cwd");u(this,"root");u(this,"dot");u(this,"dotRelative");u(this,"follow");u(this,"ignore");u(this,"magicalBraces");u(this,"mark");u(this,"matchBase");u(this,"maxDepth");u(this,"nobrace");u(this,"nocase");u(this,"nodir");u(this,"noext");u(this,"noglobstar");u(this,"pattern");u(this,"platform");u(this,"realpath");u(this,"scurry");u(this,"stat");u(this,"signal");u(this,"windowsPathsNoEscape");u(this,"withFileTypes");u(this,"includeChildMatches");u(this,"opts");u(this,"patterns");if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=Wo(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(a=>a.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(a=>a.includes("/")?a:`./**/${a}`)}if(this.pattern=t,this.platform=e.platform||Po,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let a=e.platform==="win32"?_e:e.platform==="darwin"?is:e.platform?Ne:nr;this.scurry=new a(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",n={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(a=>new nt(a,n)),[o,l]=r.reduce((a,f)=>(a[0].push(...f.set),a[1].push(...f.globParts),a),[[],[]]);this.patterns=o.map((a,f)=>{let d=l[f];if(!d)throw new Error("invalid pattern object");return new We(a,d,0,this.platform)})}async walk(){return[...await new Rs(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 Rs(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 As(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 As(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()}};var Ni=(h,t={})=>{Array.isArray(h)||(h=[h]);for(let e of h)if(new nt(e,t).hasMagic())return!0;return!1};function Qs(h,t={}){return new Ot(h,t).streamSync()}function hr(h,t={}){return new Ot(h,t).stream()}function ar(h,t={}){return new Ot(h,t).walkSync()}async function rr(h,t={}){return new Ot(h,t).walk()}function ti(h,t={}){return new Ot(h,t).iterateSync()}function lr(h,t={}){return new Ot(h,t).iterate()}var jo=Qs,Io=Object.assign(hr,{sync:Qs}),zo=ti,Bo=Object.assign(lr,{sync:ti}),Uo=Object.assign(ar,{stream:Qs,iterate:ti}),or=Object.assign(rr,{glob:rr,globSync:ar,sync:Uo,globStream:hr,stream:Io,globStreamSync:Qs,streamSync:jo,globIterate:lr,iterate:Bo,globIterateSync:ti,iterateSync:zo,Glob:Ot,hasMagic:Ni,escape:Se,unescape:wt});or.glob=or;export{Ko as a,Uo as b};
4
+ //# sourceMappingURL=chunk-DVWQBWUF.js.map