@mherod/get-cookie 2.1.3 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +2 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +4 -0
- package/README.md +163 -18
- package/commitlint.config.js +12 -0
- package/dist/chunk-4I5M3M7H.js +6 -0
- package/dist/chunk-4I5M3M7H.js.map +1 -0
- package/dist/chunk-ACXFQWII.js +2 -0
- package/dist/chunk-ACXFQWII.js.map +1 -0
- package/dist/chunk-BKU5PKJ5.js +2 -0
- package/dist/chunk-BKU5PKJ5.js.map +1 -0
- package/dist/chunk-DR2EQC4R.js +2 -0
- package/dist/chunk-DR2EQC4R.js.map +1 -0
- package/dist/chunk-FZ5IFH4R.js +2 -0
- package/dist/chunk-FZ5IFH4R.js.map +1 -0
- package/dist/chunk-S5FU4HO5.js +2 -0
- package/dist/chunk-S5FU4HO5.js.map +1 -0
- package/dist/chunk-TUGIEFXM.js +2 -0
- package/dist/chunk-TUGIEFXM.js.map +1 -0
- package/dist/cli/cli.cjs +8 -0
- package/dist/cli/cli.cjs.map +1 -0
- package/dist/cli/cli.d.cts +1 -0
- package/dist/cli/cli.d.ts +1 -0
- package/dist/cli/cli.js +4 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/getChromeCookie-P623SIWB.js +2 -0
- package/dist/getChromeCookie-P623SIWB.js.map +1 -0
- package/dist/getChromePassword-74BC3LXO.js +2 -0
- package/dist/getChromePassword-74BC3LXO.js.map +1 -0
- package/dist/getCookie-FBQKCKJB.js +2 -0
- package/dist/getCookie-FBQKCKJB.js.map +1 -0
- package/dist/getFirefoxCookie-CGJJJ7VC.js +2 -0
- package/dist/getFirefoxCookie-CGJJJ7VC.js.map +1 -0
- package/dist/getGroupedRenderedCookies-RNB6DKBL.js +2 -0
- package/dist/getGroupedRenderedCookies-RNB6DKBL.js.map +1 -0
- package/dist/getMergedRenderedCookies-NC3UTOIC.js +2 -0
- package/dist/getMergedRenderedCookies-NC3UTOIC.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +252 -0
- package/dist/index.d.ts +252 -0
- package/dist/index.js +2 -24712
- package/dist/index.js.map +1 -0
- package/eslint.config.js +243 -0
- package/jest.setup.js +4 -0
- package/package.json +81 -35
- package/tsconfig.build.json +5 -0
- package/typedoc.json +22 -0
- package/.parcelrc +0 -7
- package/.prettierignore +0 -5
- package/.prettierrc +0 -12
- package/.terserrc +0 -26
- package/build-indexes.ts +0 -108
- package/bun.lockb +0 -0
- package/dist/cli.js +0 -18319
- package/dist/types.d.ts +0 -361
- package/jest.config.ts +0 -14
- package/package-lock.json +0 -5608
- package/src/CookieRow.ts +0 -43
- package/src/CookieSpec.ts +0 -42
- package/src/ExportedCookie.ts +0 -19
- package/src/FetchResponse.ts +0 -13
- package/src/SpecialCases.ts +0 -15
- package/src/StringToRegex.ts +0 -16
- package/src/argv.ts +0 -30
- package/src/browsers/CompositeCookieQueryStrategy.ts +0 -76
- package/src/browsers/CookieQueryStrategy.ts +0 -7
- package/src/browsers/CookieStoreQueryStrategy.ts +0 -115
- package/src/browsers/QuerySqliteThenTransform.ts +0 -48
- package/src/browsers/chrome/ChromeApplicationSupport.ts +0 -14
- package/src/browsers/chrome/ChromeCookieQueryStrategy.ts +0 -158
- package/src/browsers/chrome/decrypt.ts +0 -154
- package/src/browsers/chrome/getChromePassword.ts +0 -28
- package/src/browsers/firefox/FirefoxCookieQueryStrategy.ts +0 -109
- package/src/browsers/getEncryptedChromeCookie.ts +0 -122
- package/src/browsers/index.ts +0 -12
- package/src/browsers/mock/MockCookieQueryStrategy.ts +0 -22
- package/src/browsers/safari/SafariCookieQueryStrategy.ts +0 -42
- package/src/cli.ts +0 -94
- package/src/cliQueryCookies.ts +0 -65
- package/src/comboQueryCookieSpec.test.ts +0 -92
- package/src/comboQueryCookieSpec.ts +0 -26
- package/src/cookieQueryOptions.ts +0 -27
- package/src/cookieSpecsFromUrl.test.ts +0 -65
- package/src/cookieSpecsFromUrl.ts +0 -73
- package/src/decodeBinaryCookies.ts +0 -72
- package/src/execSimple.ts +0 -12
- package/src/fetchWithCookies.test.ts +0 -32
- package/src/fetchWithCookies.ts +0 -217
- package/src/findAllFiles.ts +0 -48
- package/src/getChromeCookie.ts +0 -19
- package/src/getCookie.ts +0 -22
- package/src/getFirefoxCookie.ts +0 -25
- package/src/getGroupedRenderedCookies.ts +0 -42
- package/src/getMergedRenderedCookies.test.ts +0 -43
- package/src/getMergedRenderedCookies.ts +0 -19
- package/src/global.ts +0 -8
- package/src/index.ts +0 -16
- package/src/isValidJwt.ts +0 -26
- package/src/listChromeProfiles.ts +0 -53
- package/src/logger.ts +0 -12
- package/src/processBeforeReturn.ts +0 -29
- package/src/queryCookies.ts +0 -41
- package/src/resultsRendered.ts +0 -24
- package/src/unpackHeaders.ts +0 -18
- package/src/util/flatMapAsync.test.ts +0 -55
- package/src/util/flatMapAsync.ts +0 -41
- package/src/util/index.ts +0 -1
- package/tsconfig.json +0 -26
package/.husky/pre-push
ADDED
package/README.md
CHANGED
|
@@ -1,33 +1,178 @@
|
|
|
1
|
-
# get-cookie
|
|
1
|
+
# get-cookie 🍪
|
|
2
2
|
|
|
3
|
-
## What is it?
|
|
3
|
+
## What is it? 🤔
|
|
4
4
|
|
|
5
|
-
get-cookie is a command
|
|
6
|
-
It is useful for testing web pages that require authentication.
|
|
5
|
+
get-cookie is a powerful command-line utility and Node.js module that allows you to securely retrieve browser cookies from your locally installed browsers. Perfect for:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- 🔐 Testing authenticated web applications
|
|
8
|
+
- 🔍 Debugging cookie-related issues
|
|
9
|
+
- 🤖 Automating browser cookie extraction
|
|
10
|
+
- 🧪 Integration testing with real browser cookies
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
## Documentation 📚
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
Visit our [comprehensive documentation](https://mherod.github.io/get-cookie/) for:
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
- Detailed API reference
|
|
17
|
+
- Getting started guides
|
|
18
|
+
- Advanced usage examples
|
|
19
|
+
- TypeScript type definitions
|
|
15
20
|
|
|
16
|
-
##
|
|
21
|
+
## Features ✨
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
- 🌐 **Multi-Browser Support**: Works with Chrome, Firefox, and Safari
|
|
24
|
+
- 🔒 **Secure**: Safe cookie extraction with proper encryption handling
|
|
25
|
+
- 📝 **TypeScript Ready**: Built with TypeScript for excellent type safety
|
|
26
|
+
- 🎯 **Flexible Querying**: Search by name, domain, or URL pattern
|
|
27
|
+
- 🔄 **Multiple Output Formats**: JSON, rendered, or grouped results
|
|
28
|
+
- 👥 **Profile Support**: Query cookies from different browser profiles
|
|
19
29
|
|
|
20
|
-
|
|
30
|
+
## Installation 📦
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
Install from npm registry using your preferred package manager:
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
```bash
|
|
35
|
+
# Using pnpm (recommended)
|
|
36
|
+
pnpm add @mherod/get-cookie
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
# Using npm
|
|
39
|
+
npm install @mherod/get-cookie
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
# Using yarn
|
|
42
|
+
yarn add @mherod/get-cookie
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For global installation:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Using pnpm (recommended)
|
|
49
|
+
pnpm add -g @mherod/get-cookie
|
|
50
|
+
|
|
51
|
+
# Using npm
|
|
52
|
+
npm install -g @mherod/get-cookie
|
|
53
|
+
|
|
54
|
+
# Using yarn
|
|
55
|
+
yarn global add @mherod/get-cookie
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Note: Currently only macOS is supported. Windows support is planned for a future release.** 🚧
|
|
59
|
+
|
|
60
|
+
## How do I use it? 🚀
|
|
61
|
+
|
|
62
|
+
### CLI Usage 💻
|
|
63
|
+
|
|
64
|
+
Basic cookie retrieval:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Get a specific cookie
|
|
68
|
+
get-cookie auth example.com
|
|
69
|
+
|
|
70
|
+
# Get all cookies for a domain
|
|
71
|
+
get-cookie % example.com
|
|
72
|
+
|
|
73
|
+
# Get cookies with output formatting
|
|
74
|
+
get-cookie auth example.com --render
|
|
75
|
+
get-cookie auth example.com --dump-grouped
|
|
76
|
+
|
|
77
|
+
# Get cookies from a specific URL
|
|
78
|
+
get-cookie --url https://example.com/path
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Node.js Module Usage 📚
|
|
82
|
+
|
|
83
|
+
Basic usage:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { getCookie } from "@mherod/get-cookie";
|
|
87
|
+
|
|
88
|
+
// Get a specific cookie
|
|
89
|
+
const authCookies = await getCookie({
|
|
90
|
+
name: "auth",
|
|
91
|
+
domain: "example.com",
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Get all cookies for a domain
|
|
95
|
+
const allCookies = await getCookie({
|
|
96
|
+
name: "%",
|
|
97
|
+
domain: "example.com",
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Get cookies from multiple specifications
|
|
101
|
+
import { comboQueryCookieSpec } from "@mherod/get-cookie";
|
|
102
|
+
|
|
103
|
+
const cookies = await comboQueryCookieSpec(
|
|
104
|
+
[
|
|
105
|
+
{ name: "session", domain: "api.example.com" },
|
|
106
|
+
{ name: "auth", domain: "auth.example.com" },
|
|
107
|
+
],
|
|
108
|
+
{
|
|
109
|
+
removeExpired: true,
|
|
110
|
+
limit: 10,
|
|
111
|
+
},
|
|
112
|
+
);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Advanced Usage 🔧
|
|
116
|
+
|
|
117
|
+
Using browser-specific strategies:
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import {
|
|
121
|
+
ChromeCookieQueryStrategy,
|
|
122
|
+
FirefoxCookieQueryStrategy,
|
|
123
|
+
} from "@mherod/get-cookie";
|
|
124
|
+
|
|
125
|
+
// Query Chrome cookies
|
|
126
|
+
const chromeStrategy = new ChromeCookieQueryStrategy();
|
|
127
|
+
const chromeCookies = await chromeStrategy.queryCookies(
|
|
128
|
+
"sessionId",
|
|
129
|
+
"example.com",
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// Query Firefox cookies
|
|
133
|
+
const firefoxStrategy = new FirefoxCookieQueryStrategy();
|
|
134
|
+
const firefoxCookies = await firefoxStrategy.queryCookies(
|
|
135
|
+
"auth",
|
|
136
|
+
"example.com",
|
|
137
|
+
);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Using URL-based cookie extraction:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { cookieSpecsFromUrl } from "@mherod/get-cookie";
|
|
144
|
+
|
|
145
|
+
// Get all cookies needed for a specific URL
|
|
146
|
+
const specs = cookieSpecsFromUrl("https://example.com/dashboard");
|
|
147
|
+
const cookies = await comboQueryCookieSpec(specs);
|
|
148
|
+
```
|
|
29
149
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
150
|
+
## Output Formats 📊
|
|
151
|
+
|
|
152
|
+
The CLI supports various output formats:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Default output (just values)
|
|
156
|
+
get-cookie auth example.com
|
|
157
|
+
|
|
158
|
+
# JSON output
|
|
159
|
+
get-cookie auth example.com --output json
|
|
160
|
+
|
|
161
|
+
# Rendered output (human-readable)
|
|
162
|
+
get-cookie auth example.com --render
|
|
163
|
+
|
|
164
|
+
# Grouped by browser/profile
|
|
165
|
+
get-cookie auth example.com --dump-grouped
|
|
33
166
|
```
|
|
167
|
+
|
|
168
|
+
## Contributing 🤝
|
|
169
|
+
|
|
170
|
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
171
|
+
|
|
172
|
+
## License 📄
|
|
173
|
+
|
|
174
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
175
|
+
|
|
176
|
+
## Security 🛡️
|
|
177
|
+
|
|
178
|
+
This tool handles sensitive data (cookies). Always be careful when extracting and storing cookie information. Never share your cookies or use this tool on untrusted machines.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
extends: ["@commitlint/config-conventional"],
|
|
3
|
+
rules: {
|
|
4
|
+
"body-max-line-length": [2, "always", 100],
|
|
5
|
+
"header-max-length": [2, "always", 72],
|
|
6
|
+
"subject-case": [
|
|
7
|
+
2,
|
|
8
|
+
"never",
|
|
9
|
+
["sentence-case", "start-case", "pascal-case", "upper-case"],
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as Ke}from"./chunk-TUGIEFXM.js";import{a as Q,b as B,c as ri,d as u,e as a,f as w,g as p,h as b}from"./chunk-ACXFQWII.js";var lt=B(Ye=>{"use strict";Ye.getBooleanOption=(r,t)=>{let e=!1;if(t in r&&typeof(e=r[t])!="boolean")throw new TypeError(`Expected the "${t}" option to be a boolean`);return e};Ye.cppdb=Symbol();Ye.inspect=Symbol.for("nodejs.util.inspect.custom")});var ks=B((pa,ni)=>{"use strict";var Ts={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function Nt(r,t){if(new.target!==Nt)return new Nt(r,t);if(typeof t!="string")throw new TypeError("Expected second argument to be a string");Error.call(this,r),Ts.value=""+r,Object.defineProperty(this,"message",Ts),Error.captureStackTrace(this,Nt),this.code=t}Object.setPrototypeOf(Nt,Error);Object.setPrototypeOf(Nt.prototype,Error.prototype);Object.defineProperty(Nt.prototype,"name",Ts);ni.exports=Nt});var ai=B((da,oi)=>{"use strict";var Je=Q("path").sep||"/";oi.exports=hn;function hn(r){if(typeof r!="string"||r.length<=7||r.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var t=decodeURI(r.substring(7)),e=t.indexOf("/"),s=t.substring(0,e),i=t.substring(e+1);return s=="localhost"&&(s=""),s&&(s=Je+Je+s),i=i.replace(/^(.+)\|/,"$1:"),Je=="\\"&&(i=i.replace(/\//g,"\\")),/^.+\:/.test(i)||(i=Je+i),s+i}});var fi=B((Ht,ci)=>{"use strict";var Rs=Q("fs"),Qe=Q("path"),ln=ai(),Ze=Qe.join,cn=Qe.dirname,hi=Rs.accessSync&&function(r){try{Rs.accessSync(r)}catch(t){return!1}return!0}||Rs.existsSync||Qe.existsSync,li={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function fn(r){typeof r=="string"?r={bindings:r}:r||(r={}),Object.keys(li).map(function(h){h in r||(r[h]=li[h])}),r.module_root||(r.module_root=Ht.getRoot(Ht.getFileName())),Qe.extname(r.bindings)!=".node"&&(r.bindings+=".node");for(var t=typeof __webpack_require__=="function"?__non_webpack_require__:Q,e=[],s=0,i=r.try.length,n,o,l;s<i;s++){n=Ze.apply(null,r.try[s].map(function(h){return r[h]||h})),e.push(n);try{return o=r.path?t.resolve(n):t(n),r.path||(o.path=n),o}catch(h){if(h.code!=="MODULE_NOT_FOUND"&&h.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(h.message))throw h}}throw l=new Error(`Could not locate the bindings file. Tried:
|
|
2
|
+
`+e.map(function(h){return r.arrow+h}).join(`
|
|
3
|
+
`)),l.tries=e,l}ci.exports=Ht=fn;Ht.getFileName=function(t){var e=Error.prepareStackTrace,s=Error.stackTraceLimit,i={},n;Error.stackTraceLimit=10,Error.prepareStackTrace=function(l,h){for(var c=0,f=h.length;c<f;c++)if(n=h[c].getFileName(),n!==__filename)if(t){if(n!==t)return}else return},Error.captureStackTrace(i),i.stack,Error.prepareStackTrace=e,Error.stackTraceLimit=s;var o="file://";return n.indexOf(o)===0&&(n=ln(n)),n};Ht.getRoot=function(t){for(var e=cn(t),s;;){if(e==="."&&(e=process.cwd()),hi(Ze(e,"package.json"))||hi(Ze(e,"node_modules")))return e;if(s===e)throw new Error('Could not find module root given file: "'+t+'". Do you have a `package.json` file? ');s=e,e=Ze(e,"..")}}});var ui=B(vt=>{"use strict";var{cppdb:it}=lt();vt.prepare=function(t){return this[it].prepare(t,this,!1)};vt.exec=function(t){return this[it].exec(t),this};vt.close=function(){return this[it].close(),this};vt.loadExtension=function(...t){return this[it].loadExtension(...t),this};vt.defaultSafeIntegers=function(...t){return this[it].defaultSafeIntegers(...t),this};vt.unsafeMode=function(...t){return this[it].unsafeMode(...t),this};vt.getters={name:{get:function(){return this[it].name},enumerable:!0},open:{get:function(){return this[it].open},enumerable:!0},inTransaction:{get:function(){return this[it].inTransaction},enumerable:!0},readonly:{get:function(){return this[it].readonly},enumerable:!0},memory:{get:function(){return this[it].memory},enumerable:!0}}});var mi=B((wa,di)=>{"use strict";var{cppdb:un}=lt(),pi=new WeakMap;di.exports=function(t){if(typeof t!="function")throw new TypeError("Expected first argument to be a function");let e=this[un],s=pn(e,this),{apply:i}=Function.prototype,n={default:{value:Xe(i,t,e,s.default)},deferred:{value:Xe(i,t,e,s.deferred)},immediate:{value:Xe(i,t,e,s.immediate)},exclusive:{value:Xe(i,t,e,s.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(n.default.value,n),Object.defineProperties(n.deferred.value,n),Object.defineProperties(n.immediate.value,n),Object.defineProperties(n.exclusive.value,n),n.default.value};var pn=(r,t)=>{let e=pi.get(r);if(!e){let s={commit:r.prepare("COMMIT",t,!1),rollback:r.prepare("ROLLBACK",t,!1),savepoint:r.prepare("SAVEPOINT ` _bs3. `",t,!1),release:r.prepare("RELEASE ` _bs3. `",t,!1),rollbackTo:r.prepare("ROLLBACK TO ` _bs3. `",t,!1)};pi.set(r,e={default:Object.assign({begin:r.prepare("BEGIN",t,!1)},s),deferred:Object.assign({begin:r.prepare("BEGIN DEFERRED",t,!1)},s),immediate:Object.assign({begin:r.prepare("BEGIN IMMEDIATE",t,!1)},s),exclusive:Object.assign({begin:r.prepare("BEGIN EXCLUSIVE",t,!1)},s)})}return e},Xe=(r,t,e,{begin:s,commit:i,rollback:n,savepoint:o,release:l,rollbackTo:h})=>function(){let f,d,m;e.inTransaction?(f=o,d=l,m=h):(f=s,d=i,m=n),f.run();try{let y=r.call(t,this,arguments);return d.run(),y}catch(y){throw e.inTransaction&&(m.run(),m!==n&&d.run()),y}}});var wi=B((ya,gi)=>{"use strict";var{getBooleanOption:dn,cppdb:mn}=lt();gi.exports=function(t,e){if(e==null&&(e={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof e!="object")throw new TypeError("Expected second argument to be an options object");let s=dn(e,"simple"),i=this[mn].prepare(`PRAGMA ${t}`,this,!0);return s?i.pluck().get():i.all()}});var Ei=B((ba,bi)=>{"use strict";var gn=Q("fs"),wn=Q("path"),{promisify:yn}=Q("util"),{cppdb:bn}=lt(),yi=yn(gn.access);bi.exports=async function(t,e){if(e==null&&(e={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof e!="object")throw new TypeError("Expected second argument to be an options object");t=t.trim();let s="attached"in e?e.attached:"main",i="progress"in e?e.progress:null;if(!t)throw new TypeError("Backup filename cannot be an empty string");if(t===":memory:")throw new TypeError('Invalid backup filename ":memory:"');if(typeof s!="string")throw new TypeError('Expected the "attached" option to be a string');if(!s)throw new TypeError('The "attached" option cannot be an empty string');if(i!=null&&typeof i!="function")throw new TypeError('Expected the "progress" option to be a function');await yi(wn.dirname(t)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let n=await yi(t).then(()=>!1,()=>!0);return En(this[bn].backup(this,s,t,n),i||null)};var En=(r,t)=>{let e=0,s=!0;return new Promise((i,n)=>{setImmediate(function o(){try{let l=r.transfer(e);if(!l.remainingPages){r.close(),i(l);return}if(s&&(s=!1,e=100),t){let h=t(l);if(h!==void 0)if(typeof h=="number"&&h===h)e=Math.max(0,Math.min(2147483647,Math.round(h)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(o)}catch(l){r.close(),n(l)}})})}});var xi=B((Ea,Si)=>{"use strict";var{cppdb:Sn}=lt();Si.exports=function(t){if(t==null&&(t={}),typeof t!="object")throw new TypeError("Expected first argument to be an options object");let e="attached"in t?t.attached:"main";if(typeof e!="string")throw new TypeError('Expected the "attached" option to be a string');if(!e)throw new TypeError('The "attached" option cannot be an empty string');return this[Sn].serialize(e)}});var Ti=B((Sa,vi)=>{"use strict";var{getBooleanOption:ts,cppdb:xn}=lt();vi.exports=function(t,e,s){if(e==null&&(e={}),typeof e=="function"&&(s=e,e={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof s!="function")throw new TypeError("Expected last argument to be a function");if(typeof e!="object")throw new TypeError("Expected second argument to be an options object");if(!t)throw new TypeError("User-defined function name cannot be an empty string");let i="safeIntegers"in e?+ts(e,"safeIntegers"):2,n=ts(e,"deterministic"),o=ts(e,"directOnly"),l=ts(e,"varargs"),h=-1;if(!l){if(h=s.length,!Number.isInteger(h)||h<0)throw new TypeError("Expected function.length to be a positive integer");if(h>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[xn].function(s,t,h,i,n,o),this}});var Ci=B((xa,Ri)=>{"use strict";var{getBooleanOption:es,cppdb:vn}=lt();Ri.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof e!="object"||e===null)throw new TypeError("Expected second argument to be an options object");if(!t)throw new TypeError("User-defined function name cannot be an empty string");let s="start"in e?e.start:null,i=Cs(e,"step",!0),n=Cs(e,"inverse",!1),o=Cs(e,"result",!1),l="safeIntegers"in e?+es(e,"safeIntegers"):2,h=es(e,"deterministic"),c=es(e,"directOnly"),f=es(e,"varargs"),d=-1;if(!f&&(d=Math.max(ki(i),n?ki(n):0),d>0&&(d-=1),d>100))throw new RangeError("User-defined functions cannot have more than 100 arguments");return this[vn].aggregate(s,i,n,o,t,d,l,h,c),this};var Cs=(r,t,e)=>{let s=t in r?r[t]:null;if(typeof s=="function")return s;if(s!=null)throw new TypeError(`Expected the "${t}" option to be a function`);if(e)throw new TypeError(`Missing required option "${t}"`);return null},ki=({length:r})=>{if(Number.isInteger(r)&&r>=0)return r;throw new TypeError("Expected function.length to be a positive integer")}});var ji=B((va,Mi)=>{"use strict";var{cppdb:Tn}=lt();Mi.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected first argument to be a string");if(!t)throw new TypeError("Virtual table module name cannot be an empty string");let s=!1;if(typeof e=="object"&&e!==null)s=!0,e=An(Di(e,"used",t));else{if(typeof e!="function")throw new TypeError("Expected second argument to be a function or a table definition object");e=kn(e)}return this[Tn].table(e,t,s),this};function kn(r){return function(e,s,i,...n){let o={module:e,database:s,table:i},l=Mn.call(r,o,n);if(typeof l!="object"||l===null)throw new TypeError(`Virtual table module "${e}" did not return a table definition object`);return Di(l,"returned",e)}}function Di(r,t,e){if(!he.call(r,"rows"))throw new TypeError(`Virtual table module "${e}" ${t} a table definition without a "rows" property`);if(!he.call(r,"columns"))throw new TypeError(`Virtual table module "${e}" ${t} a table definition without a "columns" property`);let s=r.rows;if(typeof s!="function"||Object.getPrototypeOf(s)!==jn)throw new TypeError(`Virtual table module "${e}" ${t} a table definition with an invalid "rows" property (should be a generator function)`);let i=r.columns;if(!Array.isArray(i)||!(i=[...i]).every(c=>typeof c=="string"))throw new TypeError(`Virtual table module "${e}" ${t} a table definition with an invalid "columns" property (should be an array of strings)`);if(i.length!==new Set(i).size)throw new TypeError(`Virtual table module "${e}" ${t} a table definition with duplicate column names`);if(!i.length)throw new RangeError(`Virtual table module "${e}" ${t} a table definition with zero columns`);let n;if(he.call(r,"parameters")){if(n=r.parameters,!Array.isArray(n)||!(n=[...n]).every(c=>typeof c=="string"))throw new TypeError(`Virtual table module "${e}" ${t} a table definition with an invalid "parameters" property (should be an array of strings)`)}else n=Dn(s);if(n.length!==new Set(n).size)throw new TypeError(`Virtual table module "${e}" ${t} a table definition with duplicate parameter names`);if(n.length>32)throw new RangeError(`Virtual table module "${e}" ${t} a table definition with more than the maximum number of 32 parameters`);for(let c of n)if(i.includes(c))throw new TypeError(`Virtual table module "${e}" ${t} a table definition with column "${c}" which was ambiguously defined as both a column and parameter`);let o=2;if(he.call(r,"safeIntegers")){let c=r.safeIntegers;if(typeof c!="boolean")throw new TypeError(`Virtual table module "${e}" ${t} a table definition with an invalid "safeIntegers" property (should be a boolean)`);o=+c}let l=!1;if(he.call(r,"directOnly")&&(l=r.directOnly,typeof l!="boolean"))throw new TypeError(`Virtual table module "${e}" ${t} a table definition with an invalid "directOnly" property (should be a boolean)`);return[`CREATE TABLE x(${[...n.map(Oi).map(c=>`${c} HIDDEN`),...i.map(Oi)].join(", ")});`,Rn(s,new Map(i.map((c,f)=>[c,n.length+f])),e),n,o,l]}function Rn(r,t,e){return function*(...i){let n=i.map(o=>Buffer.isBuffer(o)?Buffer.from(o):o);for(let o=0;o<t.size;++o)n.push(null);for(let o of r(...i))if(Array.isArray(o))Cn(o,n,t.size,e),yield n;else if(typeof o=="object"&&o!==null)On(o,n,t,e),yield n;else throw new TypeError(`Virtual table module "${e}" yielded something that isn't a valid row object`)}}function Cn(r,t,e,s){if(r.length!==e)throw new TypeError(`Virtual table module "${s}" yielded a row with an incorrect number of columns`);let i=t.length-e;for(let n=0;n<e;++n)t[n+i]=r[n]}function On(r,t,e,s){let i=0;for(let n of Object.keys(r)){let o=e.get(n);if(o===void 0)throw new TypeError(`Virtual table module "${s}" yielded a row with an undeclared column "${n}"`);t[o]=r[n],i+=1}if(i!==e.size)throw new TypeError(`Virtual table module "${s}" yielded a row with missing columns`)}function Dn({length:r}){if(!Number.isInteger(r)||r<0)throw new TypeError("Expected function.length to be a positive integer");let t=[];for(let e=0;e<r;++e)t.push(`$${e+1}`);return t}var{hasOwnProperty:he}=Object.prototype,{apply:Mn}=Function.prototype,jn=Object.getPrototypeOf(function*(){}),Oi=r=>`"${r.replace(/"/g,'""')}"`,An=r=>()=>r});var Ii=B((Ta,Ai)=>{"use strict";var In=function(){};Ai.exports=function(t,e){return Object.assign(new In,this)}});var Fi=B((ka,Li)=>{"use strict";var Nn=Q("fs"),Ni=Q("path"),ss=lt(),Pn=ks(),Pi;function _(r,t){if(new.target==null)return new _(r,t);let e;if(Buffer.isBuffer(r)&&(e=r,r=":memory:"),r==null&&(r=""),t==null&&(t={}),typeof r!="string")throw new TypeError("Expected first argument to be a string");if(typeof t!="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in t)throw new TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in t)throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');let s=r.trim(),i=s===""||s===":memory:",n=ss.getBooleanOption(t,"readonly"),o=ss.getBooleanOption(t,"fileMustExist"),l="timeout"in t?t.timeout:5e3,h="verbose"in t?t.verbose:null,c="nativeBinding"in t?t.nativeBinding:null;if(n&&i&&!e)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(l)||l<0)throw new TypeError('Expected the "timeout" option to be a positive integer');if(l>2147483647)throw new RangeError('Option "timeout" cannot be greater than 2147483647');if(h!=null&&typeof h!="function")throw new TypeError('Expected the "verbose" option to be a function');if(c!=null&&typeof c!="string"&&typeof c!="object")throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');let f;if(c==null?f=Pi||(Pi=fi()("better_sqlite3.node")):typeof c=="string"?f=(typeof __non_webpack_require__=="function"?__non_webpack_require__:Q)(Ni.resolve(c).replace(/(\.node)?$/,".node")):f=c,f.isInitialized||(f.setErrorConstructor(Pn),f.isInitialized=!0),!i&&!Nn.existsSync(Ni.dirname(s)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[ss.cppdb]:{value:new f.Database(s,r,i,n,o,l,h||null,e||null)},...Pt.getters})}var Pt=ui();_.prototype.prepare=Pt.prepare;_.prototype.transaction=mi();_.prototype.pragma=wi();_.prototype.backup=Ei();_.prototype.serialize=xi();_.prototype.function=Ti();_.prototype.aggregate=Ci();_.prototype.table=ji();_.prototype.loadExtension=Pt.loadExtension;_.prototype.exec=Pt.exec;_.prototype.close=Pt.close;_.prototype.defaultSafeIntegers=Pt.defaultSafeIntegers;_.prototype.unsafeMode=Pt.unsafeMode;_.prototype[ss.inspect]=Ii();Li.exports=_});var Bi=B((Ca,Os)=>{"use strict";Os.exports=Fi();Os.exports.SqliteError=ks()});var zi=B((Ia,Ui)=>{"use strict";Ui.exports=Wi;function Wi(r,t,e){r instanceof RegExp&&(r=_i(r,e)),t instanceof RegExp&&(t=_i(t,e));var s=qi(r,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+r.length,s[1]),post:e.slice(s[1]+t.length)}}function _i(r,t){var e=t.match(r);return e?e[0]:null}Wi.range=qi;function qi(r,t,e){var s,i,n,o,l,h=e.indexOf(r),c=e.indexOf(t,h+1),f=h;if(h>=0&&c>0){if(r===t)return[h,c];for(s=[],n=e.length;f>=0&&!l;)f==h?(s.push(f),h=e.indexOf(r,f+1)):s.length==1?l=[s.pop(),c]:(i=s.pop(),i<n&&(n=i,o=c),c=e.indexOf(t,f+1)),f=h<c&&h>=0?h:c;s.length&&(l=[n,o])}return l}});var Qi=B((Na,Zi)=>{"use strict";var Gi=zi();Zi.exports=Wn;var Vi="\0SLASH"+Math.random()+"\0",Hi="\0OPEN"+Math.random()+"\0",Ms="\0CLOSE"+Math.random()+"\0",Ki="\0COMMA"+Math.random()+"\0",Yi="\0PERIOD"+Math.random()+"\0";function Ds(r){return parseInt(r,10)==r?parseInt(r,10):r.charCodeAt(0)}function $n(r){return r.split("\\\\").join(Vi).split("\\{").join(Hi).split("\\}").join(Ms).split("\\,").join(Ki).split("\\.").join(Yi)}function _n(r){return r.split(Vi).join("\\").split(Hi).join("{").split(Ms).join("}").split(Ki).join(",").split(Yi).join(".")}function Ji(r){if(!r)return[""];var t=[],e=Gi("{","}",r);if(!e)return r.split(",");var s=e.pre,i=e.body,n=e.post,o=s.split(",");o[o.length-1]+="{"+i+"}";var l=Ji(n);return n.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}function Wn(r){return r?(r.substr(0,2)==="{}"&&(r="\\{\\}"+r.substr(2)),le($n(r),!0).map(_n)):[]}function qn(r){return"{"+r+"}"}function Un(r){return/^-?0\d/.test(r)}function zn(r,t){return r<=t}function Gn(r,t){return r>=t}function le(r,t){var e=[],s=Gi("{","}",r);if(!s)return[r];var i=s.pre,n=s.post.length?le(s.post,!1):[""];if(/\$$/.test(s.pre))for(var o=0;o<n.length;o++){var l=i+"{"+s.body+"}"+n[o];e.push(l)}else{var h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),f=h||c,d=s.body.indexOf(",")>=0;if(!f&&!d)return s.post.match(/,.*\}/)?(r=s.pre+"{"+s.body+Ms+s.post,le(r)):[r];var m;if(f)m=s.body.split(/\.\./);else if(m=Ji(s.body),m.length===1&&(m=le(m[0],!1).map(qn),m.length===1))return n.map(function(an){return s.pre+m[0]+an});var y;if(f){var T=Ds(m[0]),g=Ds(m[1]),v=Math.max(m[0].length,m[1].length),x=m.length==3?Math.abs(Ds(m[2])):1,k=zn,R=g<T;R&&(x*=-1,k=Gn);var M=m.some(Un);y=[];for(var H=T;k(H,g);H+=x){var Z;if(c)Z=String.fromCharCode(H),Z==="\\"&&(Z="");else if(Z=String(H),M){var si=v-Z.length;if(si>0){var ii=new Array(si+1).join("0");H<0?Z="-"+ii+Z.slice(1):Z=ii+Z}}y.push(Z)}}else{y=[];for(var It=0;It<m.length;It++)y.push.apply(y,le(m[It],!1))}for(var It=0;It<y.length;It++)for(var o=0;o<n.length;o++){var l=i+y[It]+n[o];(!t||f||l)&&e.push(l)}}return e}});var $i=ri(Bi(),1);import Ln from"lodash/memoize";var Fn=Ln(r=>{try{return Promise.resolve(new $i.default(r,{readonly:!0}))}catch(t){throw Ke("Database open failed",t,{file:r}),t}});function Bn(r){try{return r.close(),Promise.resolve()}catch(t){return Ke("Database close failed",t),Promise.reject(t instanceof Error?t:new Error("Failed to close database: Unknown error"))}}async function ja({file:r,sql:t,params:e,rowFilter:s,rowTransform:i}){let n;try{n=await Fn(r);let l=n.prepare(t).all(e),h=s?l.filter(s):l;return i?h.map(i):h}catch(o){throw Ke("Database query failed",o,{file:r,sql:t}),o}finally{n&&await Bn(n)}}var hr=ri(Qi(),1);var ce=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>65536)throw new TypeError("pattern is too long")};var Vn={"[: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]},fe=r=>r.replace(/[[\]\\-]/g,"\\$&"),Hn=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Xi=r=>r.join(""),tr=(r,t)=>{let e=t;if(r.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],i=[],n=e+1,o=!1,l=!1,h=!1,c=!1,f=e,d="";t:for(;n<r.length;){let g=r.charAt(n);if((g==="!"||g==="^")&&n===e+1){c=!0,n++;continue}if(g==="]"&&o&&!h){f=n+1;break}if(o=!0,g==="\\"&&!h){h=!0,n++;continue}if(g==="["&&!h){for(let[v,[x,k,R]]of Object.entries(Vn))if(r.startsWith(v,n)){if(d)return["$.",!1,r.length-e,!0];n+=v.length,R?i.push(x):s.push(x),l=l||k;continue t}}if(h=!1,d){g>d?s.push(fe(d)+"-"+fe(g)):g===d&&s.push(fe(g)),d="",n++;continue}if(r.startsWith("-]",n+1)){s.push(fe(g+"-")),n+=2;continue}if(r.startsWith("-",n+1)){d=g,n+=2;continue}s.push(fe(g)),n++}if(f<n)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,r.length-e,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let g=s[0].length===2?s[0].slice(-1):s[0];return[Hn(g),!1,f-e,!1]}let m="["+(c?"^":"")+Xi(s)+"]",y="["+(c?"":"^")+Xi(i)+"]";return[s.length&&i.length?"("+m+"|"+y+")":s.length?m:y,l,f-e,!0]};var rt=(r,{windowsPathsNoEscape:t=!1}={})=>t?r.replace(/\[([^\/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var Kn=new Set(["!","?","+","*","@"]),er=r=>Kn.has(r),Yn="(?!(?:^|/)\\.\\.?(?:$|/))",is="(?!\\.)",Jn=new Set(["[","."]),Zn=new Set(["..","."]),Qn=new Set("().*{}+?[]^$\\!"),Xn=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),As="[^/]",sr=As+"*?",ir=As+"+?",j,I,mt,C,D,Tt,Lt,kt,ct,Ft,ue,Bt,rr,Rt,rs,js,nr,U=class U{constructor(t,e,s={}){w(this,Bt);u(this,"type");w(this,j);w(this,I);w(this,mt,!1);w(this,C,[]);w(this,D);w(this,Tt);w(this,Lt);w(this,kt,!1);w(this,ct);w(this,Ft);w(this,ue,!1);this.type=t,t&&p(this,I,!0),p(this,D,e),p(this,j,a(this,D)?a(a(this,D),j):this),p(this,ct,a(this,j)===this?s:a(a(this,j),ct)),p(this,Lt,a(this,j)===this?[]:a(a(this,j),Lt)),t==="!"&&!a(a(this,j),kt)&&a(this,Lt).push(this),p(this,Tt,a(this,D)?a(a(this,D),C).length:0)}get hasMagic(){if(a(this,I)!==void 0)return a(this,I);for(let t of a(this,C))if(typeof t!="string"&&(t.type||t.hasMagic))return p(this,I,!0);return a(this,I)}toString(){return a(this,Ft)!==void 0?a(this,Ft):this.type?p(this,Ft,this.type+"("+a(this,C).map(t=>String(t)).join("|")+")"):p(this,Ft,a(this,C).map(t=>String(t)).join(""))}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof U&&a(e,D)===this))throw new Error("invalid part: "+e);a(this,C).push(e)}}toJSON(){var e;let t=this.type===null?a(this,C).slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...a(this,C).map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===a(this,j)||a(a(this,j),kt)&&((e=a(this,D))==null?void 0:e.type)==="!")&&t.push({}),t}isStart(){var e;if(a(this,j)===this)return!0;if(!((e=a(this,D))!=null&&e.isStart()))return!1;if(a(this,Tt)===0)return!0;let t=a(this,D);for(let s=0;s<a(this,Tt);s++){let i=a(t,C)[s];if(!(i instanceof U&&i.type==="!"))return!1}return!0}isEnd(){var e,s,i;if(a(this,j)===this||((e=a(this,D))==null?void 0:e.type)==="!")return!0;if(!((s=a(this,D))!=null&&s.isEnd()))return!1;if(!this.type)return(i=a(this,D))==null?void 0:i.isEnd();let t=a(this,D)?a(a(this,D),C).length:0;return a(this,Tt)===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new U(this.type,t);for(let s of a(this,C))e.copyIn(s);return e}static fromGlob(t,e={}){var i;let s=new U(null,void 0,e);return b(i=U,Rt,rs).call(i,t,s,0,e),s}toMMPattern(){if(this!==a(this,j))return a(this,j).toMMPattern();let t=this.toString(),[e,s,i,n]=this.toRegExpSource();if(!(i||a(this,I)||a(this,ct).nocase&&!a(this,ct).nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let l=(a(this,ct).nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${e}$`,l),{_src:e,_glob:t})}get options(){return a(this,ct)}toRegExpSource(t){var h;let e=t!=null?t:!!a(this,ct).dot;if(a(this,j)===this&&b(this,Bt,rr).call(this),!this.type){let c=this.isStart()&&this.isEnd(),f=a(this,C).map(T=>{var R;let[g,v,x,k]=typeof T=="string"?b(R=U,Rt,nr).call(R,T,a(this,I),c):T.toRegExpSource(t);return p(this,I,a(this,I)||x),p(this,mt,a(this,mt)||k),g}).join(""),d="";if(this.isStart()&&typeof a(this,C)[0]=="string"&&!(a(this,C).length===1&&Zn.has(a(this,C)[0]))){let g=Jn,v=e&&g.has(f.charAt(0))||f.startsWith("\\.")&&g.has(f.charAt(2))||f.startsWith("\\.\\.")&&g.has(f.charAt(4)),x=!e&&!t&&g.has(f.charAt(0));d=v?Yn:x?is:""}let m="";return this.isEnd()&&a(a(this,j),kt)&&((h=a(this,D))==null?void 0:h.type)==="!"&&(m="(?:$|\\/)"),[d+f+m,rt(f),p(this,I,!!a(this,I)),a(this,mt)]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",n=b(this,Bt,js).call(this,e);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let c=this.toString();return p(this,C,[c]),this.type=null,p(this,I,void 0),[c,rt(this.toString()),!1,!1]}let o=!s||t||e||!is?"":b(this,Bt,js).call(this,!0);o===n&&(o=""),o&&(n=`(?:${n})(?:${o})*?`);let l="";if(this.type==="!"&&a(this,ue))l=(this.isStart()&&!e?is:"")+ir;else{let c=this.type==="!"?"))"+(this.isStart()&&!e&&!t?is:"")+sr+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=i+n+c}return[l,rt(n),p(this,I,!!a(this,I)),a(this,mt)]}};j=new WeakMap,I=new WeakMap,mt=new WeakMap,C=new WeakMap,D=new WeakMap,Tt=new WeakMap,Lt=new WeakMap,kt=new WeakMap,ct=new WeakMap,Ft=new WeakMap,ue=new WeakMap,Bt=new WeakSet,rr=function(){if(this!==a(this,j))throw new Error("should only call on root");if(a(this,kt))return this;this.toString(),p(this,kt,!0);let t;for(;t=a(this,Lt).pop();){if(t.type!=="!")continue;let e=t,s=a(e,D);for(;s;){for(let i=a(e,Tt)+1;!s.type&&i<a(s,C).length;i++)for(let n of a(t,C)){if(typeof n=="string")throw new Error("string part in extglob AST??");n.copyIn(a(s,C)[i])}e=s,s=a(e,D)}}return this},Rt=new WeakSet,rs=function(t,e,s,i){var y,T;let n=!1,o=!1,l=-1,h=!1;if(e.type===null){let g=s,v="";for(;g<t.length;){let x=t.charAt(g++);if(n||x==="\\"){n=!n,v+=x;continue}if(o){g===l+1?(x==="^"||x==="!")&&(h=!0):x==="]"&&!(g===l+2&&h)&&(o=!1),v+=x;continue}else if(x==="["){o=!0,l=g,h=!1,v+=x;continue}if(!i.noext&&er(x)&&t.charAt(g)==="("){e.push(v),v="";let k=new U(x,e);g=b(y=U,Rt,rs).call(y,t,k,g,i),e.push(k);continue}v+=x}return e.push(v),g}let c=s+1,f=new U(null,e),d=[],m="";for(;c<t.length;){let g=t.charAt(c++);if(n||g==="\\"){n=!n,m+=g;continue}if(o){c===l+1?(g==="^"||g==="!")&&(h=!0):g==="]"&&!(c===l+2&&h)&&(o=!1),m+=g;continue}else if(g==="["){o=!0,l=c,h=!1,m+=g;continue}if(er(g)&&t.charAt(c)==="("){f.push(m),m="";let v=new U(g,f);f.push(v),c=b(T=U,Rt,rs).call(T,t,v,c,i);continue}if(g==="|"){f.push(m),m="",d.push(f),f=new U(null,e);continue}if(g===")")return m===""&&a(e,C).length===0&&p(e,ue,!0),f.push(m),m="",e.push(...d,f),c;m+=g}return e.type=null,p(e,I,void 0),p(e,C,[t.substring(s-1)]),c},js=function(t){return a(this,C).map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,i,n,o]=e.toRegExpSource(t);return p(this,mt,a(this,mt)||o),s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")},nr=function(t,e,s=!1){let i=!1,n="",o=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(i){i=!1,n+=(Qn.has(h)?"\\":"")+h;continue}if(h==="\\"){l===t.length-1?n+="\\\\":i=!0;continue}if(h==="["){let[c,f,d,m]=tr(t,l);if(d){n+=c,o=o||f,l+=d-1,e=e||m;continue}}if(h==="*"){s&&t==="*"?n+=ir:n+=sr,e=!0;continue}if(h==="?"){n+=As,e=!0;continue}n+=Xn(h)}return[n,rt(t),!!e,o]},w(U,Rt);var Kt=U;var Yt=(r,{windowsPathsNoEscape:t=!1}={})=>t?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&");var z=(r,t,e={})=>(ce(t),!e.nocomment&&t.charAt(0)==="#"?!1:new K(t,e).match(r)),to=/^\*+([^+@!?\*\[\(]*)$/,eo=r=>t=>!t.startsWith(".")&&t.endsWith(r),so=r=>t=>t.endsWith(r),io=r=>(r=r.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(r)),ro=r=>(r=r.toLowerCase(),t=>t.toLowerCase().endsWith(r)),no=/^\*+\.\*+$/,oo=r=>!r.startsWith(".")&&r.includes("."),ao=r=>r!=="."&&r!==".."&&r.includes("."),ho=/^\.\*+$/,lo=r=>r!=="."&&r!==".."&&r.startsWith("."),co=/^\*+$/,fo=r=>r.length!==0&&!r.startsWith("."),uo=r=>r.length!==0&&r!=="."&&r!=="..",po=/^\?+([^+@!?\*\[\(]*)?$/,mo=([r,t=""])=>{let e=lr([r]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},go=([r,t=""])=>{let e=cr([r]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},wo=([r,t=""])=>{let e=cr([r]);return t?s=>e(s)&&s.endsWith(t):e},yo=([r,t=""])=>{let e=lr([r]);return t?s=>e(s)&&s.endsWith(t):e},lr=([r])=>{let t=r.length;return e=>e.length===t&&!e.startsWith(".")},cr=([r])=>{let t=r.length;return e=>e.length===t&&e!=="."&&e!==".."},fr=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",or={win32:{sep:"\\"},posix:{sep:"/"}},bo=fr==="win32"?or.win32.sep:or.posix.sep;z.sep=bo;var $=Symbol("globstar **");z.GLOBSTAR=$;var Eo="[^/]",So=Eo+"*?",xo="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",vo="(?:(?!(?:\\/|^)\\.).)*?",To=(r,t={})=>e=>z(e,r,t);z.filter=To;var X=(r,t={})=>Object.assign({},r,t),ko=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return z;let t=z;return Object.assign((s,i,n={})=>t(s,i,X(r,n)),{Minimatch:class extends t.Minimatch{constructor(i,n={}){super(i,X(r,n))}static defaults(i){return t.defaults(X(r,i)).Minimatch}},AST:class extends t.AST{constructor(i,n,o={}){super(i,n,X(r,o))}static fromGlob(i,n={}){return t.AST.fromGlob(i,X(r,n))}},unescape:(s,i={})=>t.unescape(s,X(r,i)),escape:(s,i={})=>t.escape(s,X(r,i)),filter:(s,i={})=>t.filter(s,X(r,i)),defaults:s=>t.defaults(X(r,s)),makeRe:(s,i={})=>t.makeRe(s,X(r,i)),braceExpand:(s,i={})=>t.braceExpand(s,X(r,i)),match:(s,i,n={})=>t.match(s,i,X(r,n)),sep:t.sep,GLOBSTAR:$})};z.defaults=ko;var ur=(r,t={})=>(ce(r),t.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,hr.default)(r));z.braceExpand=ur;var Ro=(r,t={})=>new K(r,t).makeRe();z.makeRe=Ro;var Co=(r,t,e={})=>{let s=new K(t,e);return r=r.filter(i=>s.match(i)),s.options.nonull&&!r.length&&r.push(t),r};z.match=Co;var ar=/[?*]|[+@!]\(.*?\)|\[|\]/,Oo=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),K=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");ce(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||fr,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=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((n,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=n[0]===""&&n[1]===""&&(n[2]==="?"||!ar.test(n[2]))&&!ar.test(n[3]),c=/^[a-z]:/i.test(n[0]);if(h)return[...n.slice(0,4),...n.slice(4).map(f=>this.parse(f))];if(c)return[n[0],...n.slice(1).map(f=>this.parse(f))]}return n.map(h=>this.parse(h))});if(this.debug(this.pattern,i),this.set=i.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let o=this.set[n];o[0]===""&&o[1]===""&&this.globParts[n][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let i=0;i<t[s].length;i++)t[s][i]==="**"&&(t[s][i]="*");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 i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,i)=>{let n=s[s.length-1];return i==="**"&&n==="**"?s:i===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(s.pop(),s):(s.push(i),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 i=1;i<t.length-1;i++){let n=t[i];i===1&&n===""&&t[0]===""||(n==="."||n==="")&&(e=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let i=t[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(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 i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let o=i;for(;s[o+1]==="**";)o++;o>i&&s.splice(i+1,o-i);let l=s[i+1],h=s[i+2],c=s[i+3];if(l!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(i,1);let f=s.slice(0);f[i]="**",t.push(f),i--}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 n=0;for(;(n=s.indexOf("..",n+1))!==-1;){let o=s[n-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let h=n===1&&s[n+1]==="**"?["."]:[];s.splice(n-1,2,...h),s.length===0&&s.push(""),n-=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 i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[],t[s]=i;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let i=0,n=0,o=[],l="";for(;i<t.length&&n<e.length;)if(t[i]===e[n])o.push(l==="b"?e[n]:t[i]),i++,n++;else if(s&&t[i]==="**"&&e[n]===t[i+1])o.push(t[i]),i++;else if(s&&e[n]==="**"&&t[i]===e[n+1])o.push(e[n]),n++;else if(t[i]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(l==="b")return!1;l="a",o.push(t[i]),i++,n++}else if(e[n]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(l==="a")return!1;l="b",o.push(e[n]),i++,n++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let i=this.options;if(this.isWindows){let g=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),v=!g&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),x=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),k=!x&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),R=v?3:g?0:void 0,M=k?3:x?0:void 0;if(typeof R=="number"&&typeof M=="number"){let[H,Z]=[t[R],e[M]];H.toLowerCase()===Z.toLowerCase()&&(e[M]=H,M>R?e=e.slice(M):R>M&&(t=t.slice(R)))}}let{optimizationLevel:n=1}=this.options;n>=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,h=t.length,c=e.length;o<h&&l<c;o++,l++){this.debug("matchOne loop");var f=e[l],d=t[o];if(this.debug(e,f,d),f===!1)return!1;if(f===$){this.debug("GLOBSTAR",[e,f,d]);var m=o,y=l+1;if(y===c){for(this.debug("** at the end");o<h;o++)if(t[o]==="."||t[o]===".."||!i.dot&&t[o].charAt(0)===".")return!1;return!0}for(;m<h;){var T=t[m];if(this.debug(`
|
|
4
|
+
globstar while`,t,m,e,y,T),this.matchOne(t.slice(m),e.slice(y),s))return this.debug("globstar found match!",m,h,T),!0;if(T==="."||T===".."||!i.dot&&T.charAt(0)==="."){this.debug("dot detected!",t,m,e,y);break}this.debug("globstar swallow a segment, and continue"),m++}return!!(s&&(this.debug(`
|
|
5
|
+
>>> no match, partial?`,t,m,e,y),m===h))}let g;if(typeof f=="string"?(g=d===f,this.debug("string match",f,d,g)):(g=f.test(d),this.debug("pattern match",f,d,g)),!g)return!1}if(o===h&&l===c)return!0;if(o===h)return s;if(l===c)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return ur(this.pattern,this.options)}parse(t){ce(t);let e=this.options;if(t==="**")return $;if(t==="")return"";let s,i=null;(s=t.match(co))?i=e.dot?uo:fo:(s=t.match(to))?i=(e.nocase?e.dot?ro:io:e.dot?so:eo)(s[1]):(s=t.match(po))?i=(e.nocase?e.dot?go:mo:e.dot?wo:yo)(s):(s=t.match(no))?i=e.dot?ao:oo:(s=t.match(ho))&&(i=lo);let n=Kt.fromGlob(t,this.options).toMMPattern();return i&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:i}),n}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?So:e.dot?xo:vo,i=new Set(e.nocase?["i"]:[]),n=t.map(h=>{let c=h.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?Oo(f):f===$?$:f._src});return c.forEach((f,d)=>{let m=c[d+1],y=c[d-1];f!==$||y===$||(y===void 0?m!==void 0&&m!==$?c[d+1]="(?:\\/|"+s+"\\/)?"+m:c[d]=s:m===void 0?c[d-1]=y+"(?:\\/|"+s+")?":m!==$&&(c[d-1]=y+"(?:\\/|\\/"+s+"\\/)"+m,c[d+1]=$))}),c.filter(f=>f!==$).join("/")}).join("|"),[o,l]=t.length>1?["(?:",")"]:["",""];n="^"+o+n+l+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...i].join(""))}catch(h){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 i=this.slashSplit(t);this.debug(this.pattern,"split",i);let n=this.set;this.debug(this.pattern,"set",n);let o=i[i.length-1];if(!o)for(let l=i.length-2;!o&&l>=0;l--)o=i[l];for(let l=0;l<n.length;l++){let h=n[l],c=i;if(s.matchBase&&h.length===1&&(c=[o]),this.matchOne(c,h,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return z.defaults(t).Minimatch}};z.AST=Kt;z.Minimatch=K;z.escape=Yt;z.unescape=rt;import{fileURLToPath as na}from"node:url";import{LRUCache as Wr}from"lru-cache";import{posix as $o,win32 as qs}from"node:path";import{fileURLToPath as _o}from"node:url";import{lstatSync as Wo,readdir as qo,readdirSync as Uo,readlinkSync as zo,realpathSync as Go}from"fs";import*as Vo from"node:fs";import{lstat as Ko,readdir as Yo,readlink as Jo,realpath as Zo}from"node:fs/promises";import{EventEmitter as $s}from"node:events";import Lr from"node:stream";import{StringDecoder as Do}from"node:string_decoder";var pr=typeof process=="object"&&process?process:{stdout:null,stderr:null},Mo=r=>!!r&&typeof r=="object"&&(r instanceof Ot||r instanceof Lr||jo(r)||Ao(r)),jo=r=>!!r&&typeof r=="object"&&r instanceof $s&&typeof r.pipe=="function"&&r.pipe!==Lr.Writable.prototype.pipe,Ao=r=>!!r&&typeof r=="object"&&r instanceof $s&&typeof r.write=="function"&&typeof r.end=="function",gt=Symbol("EOF"),wt=Symbol("maybeEmitEnd"),Ct=Symbol("emittedEnd"),ns=Symbol("emittingEnd"),pe=Symbol("emittedError"),os=Symbol("closed"),dr=Symbol("read"),as=Symbol("flush"),mr=Symbol("flushChunk"),nt=Symbol("encoding"),Jt=Symbol("decoder"),N=Symbol("flowing"),de=Symbol("paused"),Zt=Symbol("resume"),P=Symbol("buffer"),G=Symbol("pipes"),L=Symbol("bufferLength"),Is=Symbol("bufferPush"),hs=Symbol("bufferShift"),W=Symbol("objectMode"),O=Symbol("destroyed"),Ns=Symbol("error"),Ps=Symbol("emitData"),gr=Symbol("emitEnd"),Ls=Symbol("emitEnd2"),ft=Symbol("async"),Fs=Symbol("abort"),ls=Symbol("aborted"),me=Symbol("signal"),$t=Symbol("dataListeners"),Y=Symbol("discarded"),ge=r=>Promise.resolve().then(r),Io=r=>r(),No=r=>r==="end"||r==="finish"||r==="prefinish",Po=r=>r instanceof ArrayBuffer||!!r&&typeof r=="object"&&r.constructor&&r.constructor.name==="ArrayBuffer"&&r.byteLength>=0,Lo=r=>!Buffer.isBuffer(r)&&ArrayBuffer.isView(r),cs=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[Zt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Bs=class extends cs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=i=>e.emit("error",i),t.on("error",this.proxyErrors)}},Fo=r=>!!r.objectMode,Bo=r=>!r.objectMode&&!!r.encoding&&r.encoding!=="buffer",wr,yr,br,Er,Sr,xr,vr,Tr,kr,Rr,Cr,Or,Dr,Mr,jr,Ar,Ir,Nr,Pr,Ot=class extends $s{constructor(...e){let s=e[0]||{};super();u(this,Pr,!1);u(this,Nr,!1);u(this,Ir,[]);u(this,Ar,[]);u(this,jr);u(this,Mr);u(this,Dr);u(this,Or);u(this,Cr,!1);u(this,Rr,!1);u(this,kr,!1);u(this,Tr,!1);u(this,vr,null);u(this,xr,0);u(this,Sr,!1);u(this,Er);u(this,br,!1);u(this,yr,0);u(this,wr,!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");Fo(s)?(this[W]=!0,this[nt]=null):Bo(s)?(this[nt]=s.encoding,this[W]=!1):(this[W]=!1,this[nt]=null),this[ft]=!!s.async,this[Jt]=this[nt]?new Do(this[nt]):null,s&&s.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[P]}),s&&s.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[G]});let{signal:i}=s;i&&(this[me]=i,i.aborted?this[Fs]():i.addEventListener("abort",()=>this[Fs]()))}get bufferLength(){return this[L]}get encoding(){return this[nt]}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[W]}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}[(Pr=N,Nr=de,Ir=G,Ar=P,jr=W,Mr=nt,Dr=ft,Or=Jt,Cr=gt,Rr=Ct,kr=ns,Tr=os,vr=pe,xr=L,Sr=O,Er=me,br=ls,yr=$t,wr=Y,Fs)](){var e,s;this[ls]=!0,this.emit("abort",(e=this[me])==null?void 0:e.reason),this.destroy((s=this[me])==null?void 0:s.reason)}get aborted(){return this[ls]}set aborted(e){}write(e,s,i){var o;if(this[ls])return!1;if(this[gt])throw new Error("write after end");if(this[O])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof s=="function"&&(i=s,s="utf8"),s||(s="utf8");let n=this[ft]?ge:Io;if(!this[W]&&!Buffer.isBuffer(e)){if(Lo(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Po(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[W]?(this[N]&&this[L]!==0&&this[as](!0),this[N]?this.emit("data",e):this[Is](e),this[L]!==0&&this.emit("readable"),i&&n(i),this[N]):e.length?(typeof e=="string"&&!(s===this[nt]&&!((o=this[Jt])!=null&&o.lastNeed))&&(e=Buffer.from(e,s)),Buffer.isBuffer(e)&&this[nt]&&(e=this[Jt].write(e)),this[N]&&this[L]!==0&&this[as](!0),this[N]?this.emit("data",e):this[Is](e),this[L]!==0&&this.emit("readable"),i&&n(i),this[N]):(this[L]!==0&&this.emit("readable"),i&&n(i),this[N])}read(e){if(this[O])return null;if(this[Y]=!1,this[L]===0||e===0||e&&e>this[L])return this[wt](),null;this[W]&&(e=null),this[P].length>1&&!this[W]&&(this[P]=[this[nt]?this[P].join(""):Buffer.concat(this[P],this[L])]);let s=this[dr](e||null,this[P][0]);return this[wt](),s}[dr](e,s){if(this[W])this[hs]();else{let i=s;e===i.length||e===null?this[hs]():typeof i=="string"?(this[P][0]=i.slice(e),s=i.slice(0,e),this[L]-=e):(this[P][0]=i.subarray(e),s=i.subarray(0,e),this[L]-=e)}return this.emit("data",s),!this[P].length&&!this[gt]&&this.emit("drain"),s}end(e,s,i){return typeof e=="function"&&(i=e,e=void 0),typeof s=="function"&&(i=s,s="utf8"),e!==void 0&&this.write(e,s),i&&this.once("end",i),this[gt]=!0,this.writable=!1,(this[N]||!this[de])&&this[wt](),this}[Zt](){this[O]||(!this[$t]&&!this[G].length&&(this[Y]=!0),this[de]=!1,this[N]=!0,this.emit("resume"),this[P].length?this[as]():this[gt]?this[wt]():this.emit("drain"))}resume(){return this[Zt]()}pause(){this[N]=!1,this[de]=!0,this[Y]=!1}get destroyed(){return this[O]}get flowing(){return this[N]}get paused(){return this[de]}[Is](e){this[W]?this[L]+=1:this[L]+=e.length,this[P].push(e)}[hs](){return this[W]?this[L]-=1:this[L]-=this[P][0].length,this[P].shift()}[as](e=!1){do;while(this[mr](this[hs]())&&this[P].length);!e&&!this[P].length&&!this[gt]&&this.emit("drain")}[mr](e){return this.emit("data",e),this[N]}pipe(e,s){if(this[O])return e;this[Y]=!1;let i=this[Ct];return s=s||{},e===pr.stdout||e===pr.stderr?s.end=!1:s.end=s.end!==!1,s.proxyErrors=!!s.proxyErrors,i?s.end&&e.end():(this[G].push(s.proxyErrors?new Bs(this,e,s):new cs(this,e,s)),this[ft]?ge(()=>this[Zt]()):this[Zt]()),e}unpipe(e){let s=this[G].find(i=>i.dest===e);s&&(this[G].length===1?(this[N]&&this[$t]===0&&(this[N]=!1),this[G]=[]):this[G].splice(this[G].indexOf(s),1),s.unpipe())}addListener(e,s){return this.on(e,s)}on(e,s){let i=super.on(e,s);if(e==="data")this[Y]=!1,this[$t]++,!this[G].length&&!this[N]&&this[Zt]();else if(e==="readable"&&this[L]!==0)super.emit("readable");else if(No(e)&&this[Ct])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[pe]){let n=s;this[ft]?ge(()=>n.call(this,this[pe])):n.call(this,this[pe])}return i}removeListener(e,s){return this.off(e,s)}off(e,s){let i=super.off(e,s);return e==="data"&&(this[$t]=this.listeners("data").length,this[$t]===0&&!this[Y]&&!this[G].length&&(this[N]=!1)),i}removeAllListeners(e){let s=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[$t]=0,!this[Y]&&!this[G].length&&(this[N]=!1)),s}get emittedEnd(){return this[Ct]}[wt](){!this[ns]&&!this[Ct]&&!this[O]&&this[P].length===0&&this[gt]&&(this[ns]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[os]&&this.emit("close"),this[ns]=!1)}emit(e,...s){let i=s[0];if(e!=="error"&&e!=="close"&&e!==O&&this[O])return!1;if(e==="data")return!this[W]&&!i?!1:this[ft]?(ge(()=>this[Ps](i)),!0):this[Ps](i);if(e==="end")return this[gr]();if(e==="close"){if(this[os]=!0,!this[Ct]&&!this[O])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[pe]=i,super.emit(Ns,i);let o=!this[me]||this.listeners("error").length?super.emit("error",i):!1;return this[wt](),o}else if(e==="resume"){let o=super.emit("resume");return this[wt](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let n=super.emit(e,...s);return this[wt](),n}[Ps](e){for(let i of this[G])i.dest.write(e)===!1&&this.pause();let s=this[Y]?!1:super.emit("data",e);return this[wt](),s}[gr](){return this[Ct]?!1:(this[Ct]=!0,this.readable=!1,this[ft]?(ge(()=>this[Ls]()),!0):this[Ls]())}[Ls](){if(this[Jt]){let s=this[Jt].end();if(s){for(let i of this[G])i.dest.write(s);this[Y]||super.emit("data",s)}}for(let s of this[G])s.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[W]||(e.dataLength=0);let s=this.promise();return this.on("data",i=>{e.push(i),this[W]||(e.dataLength+=i.length)}),await s,e}async concat(){if(this[W])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[nt]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,s)=>{this.on(O,()=>s(new Error("stream destroyed"))),this.on("error",i=>s(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Y]=!1;let e=!1,s=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return s();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[gt])return s();let o,l,h=m=>{this.off("data",c),this.off("end",f),this.off(O,d),s(),l(m)},c=m=>{this.off("error",h),this.off("end",f),this.off(O,d),this.pause(),o({value:m,done:!!this[gt]})},f=()=>{this.off("error",h),this.off("data",c),this.off(O,d),s(),o({done:!0,value:void 0})},d=()=>h(new Error("stream destroyed"));return new Promise((m,y)=>{l=y,o=m,this.once(O,d),this.once("error",h),this.once("end",f),this.once("data",c)})},throw:s,return:s,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Y]=!1;let e=!1,s=()=>(this.pause(),this.off(Ns,s),this.off(O,s),this.off("end",s),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return s();let n=this.read();return n===null?s():{done:!1,value:n}};return this.once("end",s),this.once(Ns,s),this.once(O,s),{next:i,throw:s,return:s,[Symbol.iterator](){return this}}}destroy(e){if(this[O])return e?this.emit("error",e):this.emit(O),this;this[O]=!0,this[Y]=!0,this[P].length=0,this[L]=0;let s=this;return typeof s.close=="function"&&!this[os]&&s.close(),e?this.emit("error",e):this.emit(O),this}static get isStream(){return Mo}};var Ho=Go.native,ye={lstatSync:Wo,readdir:qo,readdirSync:Uo,readlinkSync:zo,realpathSync:Ho,promises:{lstat:Ko,readdir:Yo,readlink:Jo,realpath:Zo}},qr=r=>!r||r===ye||r===Vo?ye:{...ye,...r,promises:{...ye.promises,...r.promises||{}}},Ur=/^\\\\\?\\([a-z]:)\\?$/i,Qo=r=>r.replace(/\//g,"\\").replace(Ur,"$1\\"),Xo=/[\\\/]/,et=0,zr=1,Gr=2,ut=4,Vr=6,Hr=8,_t=10,Kr=12,tt=15,we=~tt,_s=16,Fr=32,be=64,ot=128,fs=256,ps=512,Br=be|ot|ps,ta=1023,Ws=r=>r.isFile()?Hr:r.isDirectory()?ut:r.isSymbolicLink()?_t:r.isCharacterDevice()?Gr:r.isBlockDevice()?Vr:r.isSocket()?Kr:r.isFIFO()?zr:et,$r=new Map,Ee=r=>{let t=$r.get(r);if(t)return t;let e=r.normalize("NFKD");return $r.set(r,e),e},_r=new Map,us=r=>{let t=_r.get(r);if(t)return t;let e=Ee(r.toLowerCase());return _r.set(r,e),e},ws=class extends Wr{constructor(){super({max:256})}},Us=class extends Wr{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},Yr=Symbol("PathScurry setAsCwd"),V,Te,ke,Re,Ce,Oe,De,Me,je,Ae,Ie,Ne,Pe,Le,Fe,Be,$e,_e,We,Dt,Wt,pt,yt,bt,Et,S,qt,St,dt,E,zs,ds,Se,Gs,Vs,xe,ms,Hs,Ks,gs,Jr,Zr,Qr,Ys,Qt,Xt,Xr,Ut,q=class{constructor(t,e=et,s,i,n,o,l){w(this,E);u(this,"name");u(this,"root");u(this,"roots");u(this,"parent");u(this,"nocase");u(this,"isCWD",!1);w(this,V);w(this,Te);w(this,ke);w(this,Re);w(this,Ce);w(this,Oe);w(this,De);w(this,Me);w(this,je);w(this,Ae);w(this,Ie);w(this,Ne);w(this,Pe);w(this,Le);w(this,Fe);w(this,Be);w(this,$e);w(this,_e);w(this,We);w(this,Dt);w(this,Wt);w(this,pt);w(this,yt);w(this,bt);w(this,Et);w(this,S);w(this,qt);w(this,St);w(this,dt);w(this,Qt,[]);w(this,Xt,!1);w(this,Ut);this.name=t,p(this,Dt,n?us(t):Ee(t)),p(this,S,e&ta),this.nocase=n,this.roots=i,this.root=s||this,p(this,qt,o),p(this,pt,l.fullpath),p(this,bt,l.relative),p(this,Et,l.relativePosix),this.parent=l.parent,this.parent?p(this,V,a(this.parent,V)):p(this,V,qr(l.fs))}get dev(){return a(this,Te)}get mode(){return a(this,ke)}get nlink(){return a(this,Re)}get uid(){return a(this,Ce)}get gid(){return a(this,Oe)}get rdev(){return a(this,De)}get blksize(){return a(this,Me)}get ino(){return a(this,je)}get size(){return a(this,Ae)}get blocks(){return a(this,Ie)}get atimeMs(){return a(this,Ne)}get mtimeMs(){return a(this,Pe)}get ctimeMs(){return a(this,Le)}get birthtimeMs(){return a(this,Fe)}get atime(){return a(this,Be)}get mtime(){return a(this,$e)}get ctime(){return a(this,_e)}get birthtime(){return a(this,We)}get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}depth(){return a(this,Wt)!==void 0?a(this,Wt):this.parent?p(this,Wt,this.parent.depth()+1):p(this,Wt,0)}childrenCache(){return a(this,qt)}resolve(t){var o;if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?b(o=this.getRoot(e),E,zs).call(o,i):b(this,E,zs).call(this,i)}children(){let t=a(this,qt).get(this);if(t)return t;let e=Object.assign([],{provisional:0});return a(this,qt).set(this,e),p(this,S,a(this,S)&~_s),e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),i=this.nocase?us(t):Ee(t);for(let h of s)if(a(h,Dt)===i)return h;let n=this.parent?this.sep:"",o=a(this,pt)?a(this,pt)+n+t:void 0,l=this.newChild(t,et,{...e,parent:this,fullpath:o});return this.canReaddir()||p(l,S,a(l,S)|ot),s.push(l),l}relative(){if(this.isCWD)return"";if(a(this,bt)!==void 0)return a(this,bt);let t=this.name,e=this.parent;if(!e)return p(this,bt,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(a(this,Et)!==void 0)return a(this,Et);let t=this.name,e=this.parent;if(!e)return p(this,Et,this.fullpathPosix());let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(a(this,pt)!==void 0)return a(this,pt);let t=this.name,e=this.parent;if(!e)return p(this,pt,this.name);let i=e.fullpath()+(e.parent?this.sep:"")+t;return p(this,pt,i)}fullpathPosix(){if(a(this,yt)!==void 0)return a(this,yt);if(this.sep==="/")return p(this,yt,this.fullpath());if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?p(this,yt,`//?/${i}`):p(this,yt,i)}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return p(this,yt,s)}isUnknown(){return(a(this,S)&tt)===et}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(a(this,S)&tt)===Hr}isDirectory(){return(a(this,S)&tt)===ut}isCharacterDevice(){return(a(this,S)&tt)===Gr}isBlockDevice(){return(a(this,S)&tt)===Vr}isFIFO(){return(a(this,S)&tt)===zr}isSocket(){return(a(this,S)&tt)===Kr}isSymbolicLink(){return(a(this,S)&_t)===_t}lstatCached(){return a(this,S)&Fr?this:void 0}readlinkCached(){return a(this,St)}realpathCached(){return a(this,dt)}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(a(this,St))return!0;if(!this.parent)return!1;let t=a(this,S)&tt;return!(t!==et&&t!==_t||a(this,S)&fs||a(this,S)&ot)}calledReaddir(){return!!(a(this,S)&_s)}isENOENT(){return!!(a(this,S)&ot)}isNamed(t){return this.nocase?a(this,Dt)===us(t):a(this,Dt)===Ee(t)}async readlink(){var e;let t=a(this,St);if(t)return t;if(this.canReadlink()&&this.parent)try{let s=await a(this,V).promises.readlink(this.fullpath()),i=(e=await this.parent.realpath())==null?void 0:e.resolve(s);if(i)return p(this,St,i)}catch(s){b(this,E,Ks).call(this,s.code);return}}readlinkSync(){var e;let t=a(this,St);if(t)return t;if(this.canReadlink()&&this.parent)try{let s=a(this,V).readlinkSync(this.fullpath()),i=(e=this.parent.realpathSync())==null?void 0:e.resolve(s);if(i)return p(this,St,i)}catch(s){b(this,E,Ks).call(this,s.code);return}}async lstat(){if(!(a(this,S)&ot))try{return b(this,E,Ys).call(this,await a(this,V).promises.lstat(this.fullpath())),this}catch(t){b(this,E,Hs).call(this,t.code)}}lstatSync(){if(!(a(this,S)&ot))try{return b(this,E,Ys).call(this,a(this,V).lstatSync(this.fullpath())),this}catch(t){b(this,E,Hs).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 n=s.slice(0,s.provisional);e?t(null,n):queueMicrotask(()=>t(null,n));return}if(a(this,Qt).push(t),a(this,Xt))return;p(this,Xt,!0);let i=this.fullpath();a(this,V).readdir(i,{withFileTypes:!0},(n,o)=>{if(n)b(this,E,ms).call(this,n.code),s.provisional=0;else{for(let l of o)b(this,E,gs).call(this,l,s);b(this,E,ds).call(this,s)}b(this,E,Xr).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(a(this,Ut))await a(this,Ut);else{let s=()=>{};p(this,Ut,new Promise(i=>s=i));try{for(let i of await a(this,V).promises.readdir(e,{withFileTypes:!0}))b(this,E,gs).call(this,i,t);b(this,E,ds).call(this,t)}catch(i){b(this,E,ms).call(this,i.code),t.provisional=0}p(this,Ut,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 a(this,V).readdirSync(e,{withFileTypes:!0}))b(this,E,gs).call(this,s,t);b(this,E,ds).call(this,t)}catch(s){b(this,E,ms).call(this,s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(a(this,S)&Br)return!1;let t=tt&a(this,S);return t===et||t===ut||t===_t}shouldWalk(t,e){return(a(this,S)&ut)===ut&&!(a(this,S)&Br)&&!t.has(this)&&(!e||e(this))}async realpath(){if(a(this,dt))return a(this,dt);if(!((ps|fs|ot)&a(this,S)))try{let t=await a(this,V).promises.realpath(this.fullpath());return p(this,dt,this.resolve(t))}catch(t){b(this,E,Vs).call(this)}}realpathSync(){if(a(this,dt))return a(this,dt);if(!((ps|fs|ot)&a(this,S)))try{let t=a(this,V).realpathSync(this.fullpath());return p(this,dt,this.resolve(t))}catch(t){b(this,E,Vs).call(this)}}[Yr](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),p(i,bt,s.join(this.sep)),p(i,Et,s.join("/")),i=i.parent,s.push("..");for(i=t;i&&i.parent&&!e.has(i);)p(i,bt,void 0),p(i,Et,void 0),i=i.parent}};V=new WeakMap,Te=new WeakMap,ke=new WeakMap,Re=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,De=new WeakMap,Me=new WeakMap,je=new WeakMap,Ae=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,Pe=new WeakMap,Le=new WeakMap,Fe=new WeakMap,Be=new WeakMap,$e=new WeakMap,_e=new WeakMap,We=new WeakMap,Dt=new WeakMap,Wt=new WeakMap,pt=new WeakMap,yt=new WeakMap,bt=new WeakMap,Et=new WeakMap,S=new WeakMap,qt=new WeakMap,St=new WeakMap,dt=new WeakMap,E=new WeakSet,zs=function(t){let e=this;for(let s of t)e=e.child(s);return e},ds=function(t){var e;p(this,S,a(this,S)|_s);for(let s=t.provisional;s<t.length;s++){let i=t[s];i&&b(e=i,E,Se).call(e)}},Se=function(){a(this,S)&ot||(p(this,S,(a(this,S)|ot)&we),b(this,E,Gs).call(this))},Gs=function(){var e;let t=this.children();t.provisional=0;for(let s of t)b(e=s,E,Se).call(e)},Vs=function(){p(this,S,a(this,S)|ps),b(this,E,xe).call(this)},xe=function(){if(a(this,S)&be)return;let t=a(this,S);(t&tt)===ut&&(t&=we),p(this,S,t|be),b(this,E,Gs).call(this)},ms=function(t=""){t==="ENOTDIR"||t==="EPERM"?b(this,E,xe).call(this):t==="ENOENT"?b(this,E,Se).call(this):this.children().provisional=0},Hs=function(t=""){var e;if(t==="ENOTDIR"){let s=this.parent;b(e=s,E,xe).call(e)}else t==="ENOENT"&&b(this,E,Se).call(this)},Ks=function(t=""){var s;let e=a(this,S);e|=fs,t==="ENOENT"&&(e|=ot),(t==="EINVAL"||t==="UNKNOWN")&&(e&=we),p(this,S,e),t==="ENOTDIR"&&this.parent&&b(s=this.parent,E,xe).call(s)},gs=function(t,e){return b(this,E,Zr).call(this,t,e)||b(this,E,Jr).call(this,t,e)},Jr=function(t,e){let s=Ws(t),i=this.newChild(t.name,s,{parent:this}),n=a(i,S)&tt;return n!==ut&&n!==_t&&n!==et&&p(i,S,a(i,S)|be),e.unshift(i),e.provisional++,i},Zr=function(t,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?us(t.name):Ee(t.name))===a(i,Dt))return b(this,E,Qr).call(this,t,i,s,e)}},Qr=function(t,e,s,i){let n=e.name;return p(e,S,a(e,S)&we|Ws(t)),n!==t.name&&(e.name=t.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e},Ys=function(t){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:n,blksize:o,blocks:l,ctime:h,ctimeMs:c,dev:f,gid:d,ino:m,mode:y,mtime:T,mtimeMs:g,nlink:v,rdev:x,size:k,uid:R}=t;p(this,Be,e),p(this,Ne,s),p(this,We,i),p(this,Fe,n),p(this,Me,o),p(this,Ie,l),p(this,_e,h),p(this,Le,c),p(this,Te,f),p(this,Oe,d),p(this,je,m),p(this,ke,y),p(this,$e,T),p(this,Pe,g),p(this,Re,v),p(this,De,x),p(this,Ae,k),p(this,Ce,R);let M=Ws(t);p(this,S,a(this,S)&we|M|Fr),M!==et&&M!==ut&&M!==_t&&p(this,S,a(this,S)|be)},Qt=new WeakMap,Xt=new WeakMap,Xr=function(t){p(this,Xt,!1);let e=a(this,Qt).slice();a(this,Qt).length=0,e.forEach(s=>s(null,t))},Ut=new WeakMap;var ys=class r extends q{constructor(e,s=et,i,n,o,l,h){super(e,s,i,n,o,l,h);u(this,"sep","\\");u(this,"splitSep",Xo)}newChild(e,s=et,i={}){return new r(e,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return qs.parse(e).root}getRoot(e){if(e=Qo(e.toUpperCase()),e===this.root.name)return this.root;for(let[s,i]of Object.entries(this.roots))if(this.sameRoot(e,s))return this.roots[e]=i;return this.roots[e]=new se(e,this).root}sameRoot(e,s=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(Ur,"$1\\"),e===s}},bs=class r extends q{constructor(e,s=et,i,n,o,l,h){super(e,s,i,n,o,l,h);u(this,"splitSep","/");u(this,"sep","/")}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,s=et,i={}){return new r(e,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}},te,ee,qe,Ue,Es=class{constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:n=16*1024,fs:o=ye}={}){u(this,"root");u(this,"rootPath");u(this,"roots");u(this,"cwd");w(this,te);w(this,ee);w(this,qe);u(this,"nocase");w(this,Ue);p(this,Ue,qr(o)),(t instanceof URL||t.startsWith("file://"))&&(t=_o(t));let l=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(l),p(this,te,new ws),p(this,ee,new ws),p(this,qe,new Us(n));let h=l.substring(this.rootPath.length).split(s);if(h.length===1&&!h[0]&&h.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(a(this,Ue)),this.roots[this.rootPath]=this.root;let c=this.root,f=h.length-1,d=e.sep,m=this.rootPath,y=!1;for(let T of h){let g=f--;c=c.child(T,{relative:new Array(g).fill("..").join(d),relativePosix:new Array(g).fill("..").join("/"),fullpath:m+=(y?"":d)+T}),y=!0}this.cwd=c}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return a(this,qe)}resolve(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=a(this,te).get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return a(this,te).set(e,i),i}resolvePosix(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=a(this,ee).get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return a(this,ee).set(e,i),i}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 q||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let i=await t.readdir();return s?i:i.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(i=>i.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 q||(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 q||(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 q||(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 q||(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 q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e,l=[];(!n||n(t))&&l.push(s?t:t.fullpath());let h=new Set,c=(d,m)=>{h.add(d),d.readdirCB((y,T)=>{if(y)return m(y);let g=T.length;if(!g)return m();let v=()=>{--g===0&&m()};for(let x of T)(!n||n(x))&&l.push(s?x:x.fullpath()),i&&x.isSymbolicLink()?x.realpath().then(k=>k!=null&&k.isUnknown()?k.lstat():k).then(k=>k!=null&&k.shouldWalk(h,o)?c(k,v):v()):x.shouldWalk(h,o)?c(x,v):v()},!0)},f=t;return new Promise((d,m)=>{c(f,y=>{if(y)return m(y);d(l)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e,l=[];(!n||n(t))&&l.push(s?t:t.fullpath());let h=new Set([t]);for(let c of h){let f=c.readdirSync();for(let d of f){(!n||n(d))&&l.push(s?d:d.fullpath());let m=d;if(d.isSymbolicLink()){if(!(i&&(m=d.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(h,o)&&h.add(m)}}return l}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(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 q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e;(!n||n(t))&&(yield s?t:t.fullpath());let l=new Set([t]);for(let h of l){let c=h.readdirSync();for(let f of c){(!n||n(f))&&(yield s?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(l,o)&&l.add(d)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e,l=new Ot({objectMode:!0});(!n||n(t))&&l.write(s?t:t.fullpath());let h=new Set,c=[t],f=0,d=()=>{let m=!1;for(;!m;){let y=c.shift();if(!y){f===0&&l.end();return}f++,h.add(y);let T=(v,x,k=!1)=>{if(v)return l.emit("error",v);if(i&&!k){let R=[];for(let M of x)M.isSymbolicLink()&&R.push(M.realpath().then(H=>H!=null&&H.isUnknown()?H.lstat():H));if(R.length){Promise.all(R).then(()=>T(null,x,!0));return}}for(let R of x)R&&(!n||n(R))&&(l.write(s?R:R.fullpath())||(m=!0));f--;for(let R of x){let M=R.realpathCached()||R;M.shouldWalk(h,o)&&c.push(M)}m&&!l.flowing?l.once("drain",d):g||d()},g=!0;y.readdirCB(T,!0),g=!1}};return d(),l}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e,l=new Ot({objectMode:!0}),h=new Set;(!n||n(t))&&l.write(s?t:t.fullpath());let c=[t],f=0,d=()=>{let m=!1;for(;!m;){let y=c.shift();if(!y){f===0&&l.end();return}f++,h.add(y);let T=y.readdirSync();for(let g of T)(!n||n(g))&&(l.write(s?g:g.fullpath())||(m=!0));f--;for(let g of T){let v=g;if(g.isSymbolicLink()){if(!(i&&(v=g.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(h,o)&&c.push(v)}}m&&!l.flowing&&l.once("drain",d)};return d(),l}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[Yr](e)}};te=new WeakMap,ee=new WeakMap,qe=new WeakMap,Ue=new WeakMap;var se=class extends Es{constructor(e=process.cwd(),s={}){let{nocase:i=!0}=s;super(e,qs,"\\",{...s,nocase:i});u(this,"sep","\\");this.nocase=i;for(let n=this.cwd;n;n=n.parent)n.nocase=this.nocase}parseRootPath(e){return qs.parse(e).root.toUpperCase()}newRoot(e){return new ys(this.rootPath,ut,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},ie=class extends Es{constructor(e=process.cwd(),s={}){let{nocase:i=!1}=s;super(e,$o,"/",{...s,nocase:i});u(this,"sep","/");this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new bs(this.rootPath,ut,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},ve=class extends ie{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},fh=process.platform==="win32"?ys:bs,tn=process.platform==="win32"?se:process.platform==="darwin"?ve:ie;var ea=r=>r.length>=1,sa=r=>r.length>=1,A,J,F,zt,at,ze,Mt,jt,At,re,Js=class Js{constructor(t,e,s,i){w(this,A);w(this,J);w(this,F);u(this,"length");w(this,zt);w(this,at);w(this,ze);w(this,Mt);w(this,jt);w(this,At);w(this,re,!0);if(!ea(t))throw new TypeError("empty pattern list");if(!sa(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(p(this,A,t),p(this,J,e),p(this,F,s),p(this,zt,i),a(this,F)===0){if(this.isUNC()){let[n,o,l,h,...c]=a(this,A),[f,d,m,y,...T]=a(this,J);c[0]===""&&(c.shift(),T.shift());let g=[n,o,l,h,""].join("/"),v=[f,d,m,y,""].join("/");p(this,A,[g,...c]),p(this,J,[v,...T]),this.length=a(this,A).length}else if(this.isDrive()||this.isAbsolute()){let[n,...o]=a(this,A),[l,...h]=a(this,J);o[0]===""&&(o.shift(),h.shift());let c=n+"/",f=l+"/";p(this,A,[c,...o]),p(this,J,[f,...h]),this.length=a(this,A).length}}}pattern(){return a(this,A)[a(this,F)]}isString(){return typeof a(this,A)[a(this,F)]=="string"}isGlobstar(){return a(this,A)[a(this,F)]===$}isRegExp(){return a(this,A)[a(this,F)]instanceof RegExp}globString(){return p(this,ze,a(this,ze)||(a(this,F)===0?this.isAbsolute()?a(this,J)[0]+a(this,J).slice(1).join("/"):a(this,J).join("/"):a(this,J).slice(a(this,F)).join("/")))}hasMore(){return this.length>a(this,F)+1}rest(){return a(this,at)!==void 0?a(this,at):this.hasMore()?(p(this,at,new Js(a(this,A),a(this,J),a(this,F)+1,a(this,zt))),p(a(this,at),At,a(this,At)),p(a(this,at),jt,a(this,jt)),p(a(this,at),Mt,a(this,Mt)),a(this,at)):p(this,at,null)}isUNC(){let t=a(this,A);return a(this,jt)!==void 0?a(this,jt):p(this,jt,a(this,zt)==="win32"&&a(this,F)===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3])}isDrive(){let t=a(this,A);return a(this,Mt)!==void 0?a(this,Mt):p(this,Mt,a(this,zt)==="win32"&&a(this,F)===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]))}isAbsolute(){let t=a(this,A);return a(this,At)!==void 0?a(this,At):p(this,At,t[0]===""&&t.length>1||this.isDrive()||this.isUNC())}root(){let t=a(this,A)[0];return typeof t=="string"&&this.isAbsolute()&&a(this,F)===0?t:""}checkFollowGlobstar(){return!(a(this,F)===0||!this.isGlobstar()||!a(this,re))}markFollowGlobstar(){return a(this,F)===0||!this.isGlobstar()||!a(this,re)?!1:(p(this,re,!1),!0)}};A=new WeakMap,J=new WeakMap,F=new WeakMap,zt=new WeakMap,at=new WeakMap,ze=new WeakMap,Mt=new WeakMap,jt=new WeakMap,At=new WeakMap,re=new WeakMap;var ne=Js;var ia=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",oe=class{constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:n,platform:o=ia}){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:i,noglobstar:n,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let l of t)this.add(l)}add(t){let e=new K(t,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],n=e.globParts[s];if(!i||!n)throw new Error("invalid pattern object");for(;i[0]==="."&&n[0]===".";)i.shift(),n.shift();let o=new ne(i,n,0,this.platform),l=new K(o.globString(),this.mmopts),h=n[n.length-1]==="**",c=o.isAbsolute();c?this.absolute.push(l):this.relative.push(l),h&&(c?this.absoluteChildren.push(l):this.relativeChildren.push(l))}}ignored(t){let e=t.fullpath(),s=`${e}/`,i=t.relative()||".",n=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(n))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 i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}};var Zs=class r{constructor(t=new Map){u(this,"store");this.store=t}copy(){return new r(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(),i=this.store.get(s);i?i.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},Qs=class{constructor(){u(this,"store",new Map)}add(t,e,s){let i=(e?2:0)|(s?1:0),n=this.store.get(t);this.store.set(t,n===void 0?i:i&n)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},Xs=class{constructor(){u(this,"store",new Map)}add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(i=>i.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())}},Ge=class r{constructor(t,e){u(this,"hasWalkedCache");u(this,"matches",new Qs);u(this,"subwalks",new Xs);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 Zs}processPatterns(t,e){this.patterns=e;let s=e.map(i=>[t,i]);for(let[i,n]of s){this.hasWalkedCache.storeWalked(i,n);let o=n.root(),l=n.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=n.rest();if(d)n=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let h,c,f=!1;for(;typeof(h=n.pattern())=="string"&&(c=n.rest());)i=i.resolve(h),n=c,f=!0;if(h=n.pattern(),c=n.rest(),f){if(this.hasWalkedCache.hasWalked(i,n))continue;this.hasWalkedCache.storeWalked(i,n)}if(typeof h=="string"){let d=h===".."||h===""||h===".";this.matches.add(i.resolve(h),l,d);continue}else if(h===$){(!i.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(i,n);let d=c==null?void 0:c.pattern(),m=c==null?void 0:c.rest();if(!c||(d===""||d===".")&&!m)this.matches.add(i,l,d===""||d===".");else if(d===".."){let y=i.parent||i;m?this.hasWalkedCache.hasWalked(y,m)||this.subwalks.add(y,m):this.matches.add(y,l,!0)}}else h instanceof RegExp&&this.subwalks.add(i,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new r(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),i=this.child();for(let n of e)for(let o of s){let l=o.isAbsolute(),h=o.pattern(),c=o.rest();h===$?i.testGlobstar(n,o,c,l):h instanceof RegExp?i.testRegExp(n,h,c,l):i.testString(n,h,c,l)}return i}testGlobstar(t,e,s,i){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,i,!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 n=s.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,s.rest(),i);else if(n===".."){let o=t.parent||t;this.subwalks.add(o,s)}else n instanceof RegExp&&this.testRegExp(t,n,s.rest(),i)}}testRegExp(t,e,s,i){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}testString(t,e,s,i){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}};var ra=(r,t)=>typeof r=="string"?new oe([r],t):Array.isArray(r)?new oe(r,t):r,ae,xt,Vt,st,Gt,ti,Ss=class{constructor(t,e,s){w(this,st);u(this,"path");u(this,"patterns");u(this,"opts");u(this,"seen",new Set);u(this,"paused",!1);u(this,"aborted",!1);w(this,ae,[]);w(this,xt);w(this,Vt);u(this,"signal");u(this,"maxDepth");u(this,"includeChildMatches");var i;if(this.patterns=t,this.path=e,this.opts=s,p(this,Vt,!s.posix&&s.platform==="win32"?"\\":"/"),this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(p(this,xt,ra((i=s.ignore)!=null?i:[],s)),!this.includeChildMatches&&typeof a(this,xt).add!="function")){let n="cannot ignore child matches, ignore lacks add() method.";throw new Error(n)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{a(this,ae).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=a(this,ae).shift());)t()}onResume(t){var e;(e=this.signal)!=null&&e.aborted||(this.paused?a(this,ae).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 n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&(n!=null&&n.isSymbolicLink())){let o=await n.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(n,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()))&&!b(this,st,Gt).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 n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&(n!=null&&n.isSymbolicLink())){let o=n.realpathSync();o&&(o!=null&&o.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(n,e)}matchFinish(t,e){var n;if(b(this,st,Gt).call(this,t))return;if(!this.includeChildMatches&&((n=a(this,xt))!=null&&n.add)){let o=`${t.relativePosix()}/**`;a(this,xt).add(o)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let i=this.opts.mark&&t.isDirectory()?a(this,Vt):"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let o=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(o+i)}else{let o=this.opts.posix?t.relativePosix():t.relative(),l=this.opts.dotRelative&&!o.startsWith(".."+a(this,Vt))?"."+a(this,Vt):"";this.matchEmit(o?l+o+i:"."+i)}}async match(t,e,s){let i=await this.matchCheck(t,s);i&&this.matchFinish(i,e)}matchSync(t,e,s){let i=this.matchCheckSync(t,s);i&&this.matchFinish(i,e)}walkCB(t,e,s){var i;(i=this.signal)!=null&&i.aborted&&s(),this.walkCB2(t,e,new Ge(this.opts),s)}walkCB2(t,e,s,i){var l;if(b(this,st,ti).call(this,t))return i();if((l=this.signal)!=null&&l.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,i));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&i()};for(let[h,c,f]of s.matches.entries())b(this,st,Gt).call(this,h)||(n++,this.match(h,c,f).then(()=>o()));for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let c=h.readdirCached();h.calledReaddir()?this.walkCB3(h,c,s,o):h.readdirCB((f,d)=>this.walkCB3(h,d,s,o),!0)}o()}walkCB3(t,e,s,i){s=s.filterEntries(t,e);let n=1,o=()=>{--n===0&&i()};for(let[l,h,c]of s.matches.entries())b(this,st,Gt).call(this,l)||(n++,this.match(l,h,c).then(()=>o()));for(let[l,h]of s.subwalks.entries())n++,this.walkCB2(l,h,s.child(),o);o()}walkCBSync(t,e,s){var i;(i=this.signal)!=null&&i.aborted&&s(),this.walkCB2Sync(t,e,new Ge(this.opts),s)}walkCB2Sync(t,e,s,i){var l;if(b(this,st,ti).call(this,t))return i();if((l=this.signal)!=null&&l.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,i));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&i()};for(let[h,c,f]of s.matches.entries())b(this,st,Gt).call(this,h)||this.matchSync(h,c,f);for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let c=h.readdirSync();this.walkCB3Sync(h,c,s,o)}o()}walkCB3Sync(t,e,s,i){s=s.filterEntries(t,e);let n=1,o=()=>{--n===0&&i()};for(let[l,h,c]of s.matches.entries())b(this,st,Gt).call(this,l)||this.matchSync(l,h,c);for(let[l,h]of s.subwalks.entries())n++,this.walkCB2Sync(l,h,s.child(),o);o()}};ae=new WeakMap,xt=new WeakMap,Vt=new WeakMap,st=new WeakSet,Gt=function(t){var e,s;return this.seen.has(t)||!!((s=(e=a(this,xt))==null?void 0:e.ignored)!=null&&s.call(e,t))},ti=function(t){var e,s;return!!((s=(e=a(this,xt))==null?void 0:e.childrenIgnored)!=null&&s.call(e,t))};var Ve=class extends Ss{constructor(e,s,i){super(e,s,i);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,i)=>{this.walkCB(this.path,this.patterns,()=>{var n;(n=this.signal)!=null&&n.aborted?i(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}},He=class extends Ss{constructor(e,s,i){super(e,s,i);u(this,"results");this.results=new Ot({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 oa=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ht=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=na(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(h=>h.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(h=>h.includes("/")?h:`./**/${h}`)}if(this.pattern=t,this.platform=e.platform||oa,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 h=e.platform==="win32"?se:e.platform==="darwin"?ve:e.platform?ie:tn;this.scurry=new h(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...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},n=this.pattern.map(h=>new K(h,i)),[o,l]=n.reduce((h,c)=>(h[0].push(...c.set),h[1].push(...c.globParts),h),[[],[]]);this.patterns=o.map((h,c)=>{let f=l[c];if(!f)throw new Error("invalid pattern object");return new ne(h,f,0,this.platform)})}async walk(){return[...await new Ve(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 Ve(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 He(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 He(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 ei=(r,t={})=>{Array.isArray(r)||(r=[r]);for(let e of r)if(new K(e,t).hasMagic())return!0;return!1};function xs(r,t={}){return new ht(r,t).streamSync()}function rn(r,t={}){return new ht(r,t).stream()}function nn(r,t={}){return new ht(r,t).walkSync()}async function en(r,t={}){return new ht(r,t).walk()}function vs(r,t={}){return new ht(r,t).iterateSync()}function on(r,t={}){return new ht(r,t).iterate()}var aa=xs,ha=Object.assign(rn,{sync:xs}),la=vs,ca=Object.assign(on,{sync:vs}),fa=Object.assign(nn,{stream:xs,iterate:vs}),sn=Object.assign(en,{glob:en,globSync:nn,sync:fa,globStream:rn,stream:ha,globStreamSync:xs,streamSync:aa,globIterate:on,iterate:ca,globIterateSync:vs,iterateSync:la,Glob:ht,hasMagic:ei,escape:Yt,unescape:rt});sn.glob=sn;export{ja as a,fa as b};
|
|
6
|
+
//# sourceMappingURL=chunk-4I5M3M7H.js.map
|