tinker-token-usage 0.1.3 → 0.1.5

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.
@@ -0,0 +1,1680 @@
1
+ var he = Object.defineProperty;
2
+ var ge = (t, s, e) => s in t ? he(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var N = (t, s, e) => ge(t, typeof s != "symbol" ? s + "" : s, e);
4
+ import * as de from "fs";
5
+ import { statSync as ye, stat as Ae, realpathSync as Re, realpath as _e, readdirSync as Ee, readdir as Se } from "fs";
6
+ import { sep as Gt, basename as be, dirname as bt, resolve as Wt, normalize as me, relative as xe, posix as tt, isAbsolute as Ce } from "path";
7
+ import { fileURLToPath as $e } from "url";
8
+ import { createRequire as ve } from "module";
9
+ var Ht = /* @__PURE__ */ ve(import.meta.url);
10
+ function we(t) {
11
+ let s = me(t);
12
+ return s.length > 1 && s[s.length - 1] === Gt && (s = s.substring(0, s.length - 1)), s;
13
+ }
14
+ const Oe = /[\\/]/g;
15
+ function Ut(t, s) {
16
+ return t.replace(Oe, s);
17
+ }
18
+ const He = /^[a-z]:[\\/]$/i;
19
+ function Le(t) {
20
+ return t === "/" || He.test(t);
21
+ }
22
+ function yt(t, s) {
23
+ const { resolvePaths: e, normalizePath: r, pathSeparator: o } = s, n = process.platform === "win32" && t.includes("/") || t.startsWith(".");
24
+ if (e && (t = Wt(t)), (r || n) && (t = we(t)), t === ".") return "";
25
+ const i = t[t.length - 1] !== o;
26
+ return Ut(i ? t + o : t, o);
27
+ }
28
+ function qt(t, s) {
29
+ return s + t;
30
+ }
31
+ function Te(t, s) {
32
+ return function(e, r) {
33
+ return r.startsWith(t) ? r.slice(t.length) + e : Ut(xe(t, r), s.pathSeparator) + s.pathSeparator + e;
34
+ };
35
+ }
36
+ function ke(t) {
37
+ return t;
38
+ }
39
+ function Pe(t, s, e) {
40
+ return s + t + e;
41
+ }
42
+ function De(t, s) {
43
+ const { relativePaths: e, includeBasePath: r } = s;
44
+ return e && t ? Te(t, s) : r ? qt : ke;
45
+ }
46
+ function Ie(t) {
47
+ return function(s, e) {
48
+ e.push(s.substring(t.length) || ".");
49
+ };
50
+ }
51
+ function Ne(t) {
52
+ return function(s, e, r) {
53
+ const o = s.substring(t.length) || ".";
54
+ r.every((n) => n(o, !0)) && e.push(o);
55
+ };
56
+ }
57
+ const Be = (t, s) => {
58
+ s.push(t || ".");
59
+ }, Fe = (t, s, e) => {
60
+ const r = t || ".";
61
+ e.every((o) => o(r, !0)) && s.push(r);
62
+ }, Me = () => {
63
+ };
64
+ function Ge(t, s) {
65
+ const { includeDirs: e, filters: r, relativePaths: o } = s;
66
+ return e ? o ? r && r.length ? Ne(t) : Ie(t) : r && r.length ? Fe : Be : Me;
67
+ }
68
+ const We = (t, s, e, r) => {
69
+ r.every((o) => o(t, !1)) && e.files++;
70
+ }, Ue = (t, s, e, r) => {
71
+ r.every((o) => o(t, !1)) && s.push(t);
72
+ }, qe = (t, s, e, r) => {
73
+ e.files++;
74
+ }, Ke = (t, s) => {
75
+ s.push(t);
76
+ }, Xe = () => {
77
+ };
78
+ function je(t) {
79
+ const { excludeFiles: s, filters: e, onlyCounts: r } = t;
80
+ return s ? Xe : e && e.length ? r ? We : Ue : r ? qe : Ke;
81
+ }
82
+ const Qe = (t) => t, ze = () => [""].slice(0, 0);
83
+ function Ye(t) {
84
+ return t.group ? ze : Qe;
85
+ }
86
+ const Ze = (t, s, e) => {
87
+ t.push({
88
+ directory: s,
89
+ files: e,
90
+ dir: s
91
+ });
92
+ }, Ve = () => {
93
+ };
94
+ function Je(t) {
95
+ return t.group ? Ze : Ve;
96
+ }
97
+ const ts = function(t, s, e) {
98
+ const { queue: r, fs: o, options: { suppressErrors: n } } = s;
99
+ r.enqueue(), o.realpath(t, (i, l) => {
100
+ if (i) return r.dequeue(n ? null : i, s);
101
+ o.stat(l, (h, g) => {
102
+ if (h) return r.dequeue(n ? null : h, s);
103
+ if (g.isDirectory() && Kt(t, l, s)) return r.dequeue(null, s);
104
+ e(g, l), r.dequeue(null, s);
105
+ });
106
+ });
107
+ }, es = function(t, s, e) {
108
+ const { queue: r, fs: o, options: { suppressErrors: n } } = s;
109
+ r.enqueue();
110
+ try {
111
+ const i = o.realpathSync(t), l = o.statSync(i);
112
+ if (l.isDirectory() && Kt(t, i, s)) return;
113
+ e(l, i);
114
+ } catch (i) {
115
+ if (!n) throw i;
116
+ }
117
+ };
118
+ function ss(t, s) {
119
+ return !t.resolveSymlinks || t.excludeSymlinks ? null : s ? es : ts;
120
+ }
121
+ function Kt(t, s, e) {
122
+ if (e.options.useRealPaths) return ns(s, e);
123
+ let r = bt(t), o = 1;
124
+ for (; r !== e.root && o < 2; ) {
125
+ const n = e.symlinks.get(r);
126
+ !!n && (n === s || n.startsWith(s) || s.startsWith(n)) ? o++ : r = bt(r);
127
+ }
128
+ return e.symlinks.set(t, s), o > 1;
129
+ }
130
+ function ns(t, s) {
131
+ return s.visited.includes(t + s.options.pathSeparator);
132
+ }
133
+ const rs = (t) => t.counts, os = (t) => t.groups, is = (t) => t.paths, us = (t) => t.paths.slice(0, t.options.maxFiles), as = (t, s, e) => (ht(s, e, t.counts, t.options.suppressErrors), null), cs = (t, s, e) => (ht(s, e, t.paths, t.options.suppressErrors), null), ls = (t, s, e) => (ht(s, e, t.paths.slice(0, t.options.maxFiles), t.options.suppressErrors), null), fs = (t, s, e) => (ht(s, e, t.groups, t.options.suppressErrors), null);
134
+ function ht(t, s, e, r) {
135
+ s(t && !r ? t : null, e);
136
+ }
137
+ function ps(t, s) {
138
+ const { onlyCounts: e, group: r, maxFiles: o } = t;
139
+ return e ? s ? rs : as : r ? s ? os : fs : o ? s ? us : ls : s ? is : cs;
140
+ }
141
+ const Xt = { withFileTypes: !0 }, hs = (t, s, e, r, o) => {
142
+ if (t.queue.enqueue(), r < 0) return t.queue.dequeue(null, t);
143
+ const { fs: n } = t;
144
+ t.visited.push(s), t.counts.directories++, n.readdir(s || ".", Xt, (i, l = []) => {
145
+ o(l, e, r), t.queue.dequeue(t.options.suppressErrors ? null : i, t);
146
+ });
147
+ }, gs = (t, s, e, r, o) => {
148
+ const { fs: n } = t;
149
+ if (r < 0) return;
150
+ t.visited.push(s), t.counts.directories++;
151
+ let i = [];
152
+ try {
153
+ i = n.readdirSync(s || ".", Xt);
154
+ } catch (l) {
155
+ if (!t.options.suppressErrors) throw l;
156
+ }
157
+ o(i, e, r);
158
+ };
159
+ function ds(t) {
160
+ return t ? gs : hs;
161
+ }
162
+ var ys = class {
163
+ constructor(t) {
164
+ N(this, "count", 0);
165
+ this.onQueueEmpty = t;
166
+ }
167
+ enqueue() {
168
+ return this.count++, this.count;
169
+ }
170
+ dequeue(t, s) {
171
+ this.onQueueEmpty && (--this.count <= 0 || t) && (this.onQueueEmpty(t, s), t && (s.controller.abort(), this.onQueueEmpty = void 0));
172
+ }
173
+ }, As = class {
174
+ constructor() {
175
+ N(this, "_files", 0);
176
+ N(this, "_directories", 0);
177
+ }
178
+ set files(t) {
179
+ this._files = t;
180
+ }
181
+ get files() {
182
+ return this._files;
183
+ }
184
+ set directories(t) {
185
+ this._directories = t;
186
+ }
187
+ get directories() {
188
+ return this._directories;
189
+ }
190
+ /**
191
+ * @deprecated use `directories` instead
192
+ */
193
+ /* c8 ignore next 3 */
194
+ get dirs() {
195
+ return this._directories;
196
+ }
197
+ }, Rs = class {
198
+ constructor() {
199
+ N(this, "aborted", !1);
200
+ }
201
+ abort() {
202
+ this.aborted = !0;
203
+ }
204
+ }, jt = class {
205
+ constructor(t, s, e) {
206
+ N(this, "root");
207
+ N(this, "isSynchronous");
208
+ N(this, "state");
209
+ N(this, "joinPath");
210
+ N(this, "pushDirectory");
211
+ N(this, "pushFile");
212
+ N(this, "getArray");
213
+ N(this, "groupFiles");
214
+ N(this, "resolveSymlink");
215
+ N(this, "walkDirectory");
216
+ N(this, "callbackInvoker");
217
+ N(this, "walk", (t, s, e) => {
218
+ const { paths: r, options: { filters: o, resolveSymlinks: n, excludeSymlinks: i, exclude: l, maxFiles: h, signal: g, useRealPaths: d, pathSeparator: A }, controller: E } = this.state;
219
+ if (E.aborted || g && g.aborted || h && r.length > h) return;
220
+ const x = this.getArray(this.state.paths);
221
+ for (let y = 0; y < t.length; ++y) {
222
+ const C = t[y];
223
+ if (C.isFile() || C.isSymbolicLink() && !n && !i) {
224
+ const T = this.joinPath(C.name, s);
225
+ this.pushFile(T, x, this.state.counts, o);
226
+ } else if (C.isDirectory()) {
227
+ let T = Pe(C.name, s, this.state.options.pathSeparator);
228
+ if (l && l(C.name, T)) continue;
229
+ this.pushDirectory(T, r, o), this.walkDirectory(this.state, T, T, e - 1, this.walk);
230
+ } else if (this.resolveSymlink && C.isSymbolicLink()) {
231
+ let T = qt(C.name, s);
232
+ this.resolveSymlink(T, this.state, (W, _) => {
233
+ if (W.isDirectory()) {
234
+ if (_ = yt(_, this.state.options), l && l(C.name, d ? _ : T + A)) return;
235
+ this.walkDirectory(this.state, _, d ? _ : T + A, e - 1, this.walk);
236
+ } else {
237
+ _ = d ? _ : T;
238
+ const M = be(_), j = yt(bt(_), this.state.options);
239
+ _ = this.joinPath(M, j), this.pushFile(_, x, this.state.counts, o);
240
+ }
241
+ });
242
+ }
243
+ }
244
+ this.groupFiles(this.state.groups, s, x);
245
+ });
246
+ this.isSynchronous = !e, this.callbackInvoker = ps(s, this.isSynchronous), this.root = yt(t, s), this.state = {
247
+ root: Le(this.root) ? this.root : this.root.slice(0, -1),
248
+ paths: [""].slice(0, 0),
249
+ groups: [],
250
+ counts: new As(),
251
+ options: s,
252
+ queue: new ys((r, o) => this.callbackInvoker(o, r, e)),
253
+ symlinks: /* @__PURE__ */ new Map(),
254
+ visited: [""].slice(0, 0),
255
+ controller: new Rs(),
256
+ fs: s.fs || de
257
+ }, this.joinPath = De(this.root, s), this.pushDirectory = Ge(this.root, s), this.pushFile = je(s), this.getArray = Ye(s), this.groupFiles = Je(s), this.resolveSymlink = ss(s, this.isSynchronous), this.walkDirectory = ds(this.isSynchronous);
258
+ }
259
+ start() {
260
+ return this.pushDirectory(this.root, this.state.paths, this.state.options.filters), this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk), this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
261
+ }
262
+ };
263
+ function _s(t, s) {
264
+ return new Promise((e, r) => {
265
+ Qt(t, s, (o, n) => {
266
+ if (o) return r(o);
267
+ e(n);
268
+ });
269
+ });
270
+ }
271
+ function Qt(t, s, e) {
272
+ new jt(t, s, e).start();
273
+ }
274
+ function Es(t, s) {
275
+ return new jt(t, s).start();
276
+ }
277
+ var Lt = class {
278
+ constructor(t, s) {
279
+ this.root = t, this.options = s;
280
+ }
281
+ withPromise() {
282
+ return _s(this.root, this.options);
283
+ }
284
+ withCallback(t) {
285
+ Qt(this.root, this.options, t);
286
+ }
287
+ sync() {
288
+ return Es(this.root, this.options);
289
+ }
290
+ };
291
+ let zt = null;
292
+ try {
293
+ Ht.resolve("picomatch"), zt = Ht("picomatch");
294
+ } catch {
295
+ }
296
+ var Ss = class {
297
+ constructor(t) {
298
+ N(this, "globCache", {});
299
+ N(this, "options", {
300
+ maxDepth: 1 / 0,
301
+ suppressErrors: !0,
302
+ pathSeparator: Gt,
303
+ filters: []
304
+ });
305
+ N(this, "globFunction");
306
+ this.options = {
307
+ ...this.options,
308
+ ...t
309
+ }, this.globFunction = this.options.globFunction;
310
+ }
311
+ group() {
312
+ return this.options.group = !0, this;
313
+ }
314
+ withPathSeparator(t) {
315
+ return this.options.pathSeparator = t, this;
316
+ }
317
+ withBasePath() {
318
+ return this.options.includeBasePath = !0, this;
319
+ }
320
+ withRelativePaths() {
321
+ return this.options.relativePaths = !0, this;
322
+ }
323
+ withDirs() {
324
+ return this.options.includeDirs = !0, this;
325
+ }
326
+ withMaxDepth(t) {
327
+ return this.options.maxDepth = t, this;
328
+ }
329
+ withMaxFiles(t) {
330
+ return this.options.maxFiles = t, this;
331
+ }
332
+ withFullPaths() {
333
+ return this.options.resolvePaths = !0, this.options.includeBasePath = !0, this;
334
+ }
335
+ withErrors() {
336
+ return this.options.suppressErrors = !1, this;
337
+ }
338
+ withSymlinks({ resolvePaths: t = !0 } = {}) {
339
+ return this.options.resolveSymlinks = !0, this.options.useRealPaths = t, this.withFullPaths();
340
+ }
341
+ withAbortSignal(t) {
342
+ return this.options.signal = t, this;
343
+ }
344
+ normalize() {
345
+ return this.options.normalizePath = !0, this;
346
+ }
347
+ filter(t) {
348
+ return this.options.filters.push(t), this;
349
+ }
350
+ onlyDirs() {
351
+ return this.options.excludeFiles = !0, this.options.includeDirs = !0, this;
352
+ }
353
+ exclude(t) {
354
+ return this.options.exclude = t, this;
355
+ }
356
+ onlyCounts() {
357
+ return this.options.onlyCounts = !0, this;
358
+ }
359
+ crawl(t) {
360
+ return new Lt(t || ".", this.options);
361
+ }
362
+ withGlobFunction(t) {
363
+ return this.globFunction = t, this;
364
+ }
365
+ /**
366
+ * @deprecated Pass options using the constructor instead:
367
+ * ```ts
368
+ * new fdir(options).crawl("/path/to/root");
369
+ * ```
370
+ * This method will be removed in v7.0
371
+ */
372
+ /* c8 ignore next 4 */
373
+ crawlWithOptions(t, s) {
374
+ return this.options = {
375
+ ...this.options,
376
+ ...s
377
+ }, new Lt(t || ".", this.options);
378
+ }
379
+ glob(...t) {
380
+ return this.globFunction ? this.globWithOptions(t) : this.globWithOptions(t, { dot: !0 });
381
+ }
382
+ globWithOptions(t, ...s) {
383
+ const e = this.globFunction || zt;
384
+ if (!e) throw new Error("Please specify a glob function to use glob matching.");
385
+ var r = this.globCache[t.join("\0")];
386
+ return r || (r = e(t, ...s), this.globCache[t.join("\0")] = r), this.options.filters.push((o) => r(o)), this;
387
+ }
388
+ };
389
+ function bs(t) {
390
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
391
+ }
392
+ var ct = {};
393
+ const z = "\\\\/", Tt = `[^${z}]`, ms = 0, Y = "\\.", xs = "\\+", Cs = "\\?", gt = "\\/", $s = "(?=.)", Yt = "[^/]", Ct = `(?:${gt}|$)`, Zt = `(?:^|${gt})`, $t = `${Y}{1,2}${Ct}`, vs = `(?!${Y})`, ws = `(?!${Zt}${$t})`, Os = `(?!${Y}{0,1}${Ct})`, Hs = `(?!${$t})`, Ls = `[^.${gt}]`, Ts = `${Yt}*?`, ks = "/", Vt = {
394
+ DOT_LITERAL: Y,
395
+ PLUS_LITERAL: xs,
396
+ QMARK_LITERAL: Cs,
397
+ SLASH_LITERAL: gt,
398
+ ONE_CHAR: $s,
399
+ QMARK: Yt,
400
+ END_ANCHOR: Ct,
401
+ DOTS_SLASH: $t,
402
+ NO_DOT: vs,
403
+ NO_DOTS: ws,
404
+ NO_DOT_SLASH: Os,
405
+ NO_DOTS_SLASH: Hs,
406
+ QMARK_NO_DOT: Ls,
407
+ STAR: Ts,
408
+ START_ANCHOR: Zt,
409
+ SEP: ks
410
+ }, Ps = {
411
+ ...Vt,
412
+ SLASH_LITERAL: `[${z}]`,
413
+ QMARK: Tt,
414
+ STAR: `${Tt}*?`,
415
+ DOTS_SLASH: `${Y}{1,2}(?:[${z}]|$)`,
416
+ NO_DOT: `(?!${Y})`,
417
+ NO_DOTS: `(?!(?:^|[${z}])${Y}{1,2}(?:[${z}]|$))`,
418
+ NO_DOT_SLASH: `(?!${Y}{0,1}(?:[${z}]|$))`,
419
+ NO_DOTS_SLASH: `(?!${Y}{1,2}(?:[${z}]|$))`,
420
+ QMARK_NO_DOT: `[^.${z}]`,
421
+ START_ANCHOR: `(?:^|[${z}])`,
422
+ END_ANCHOR: `(?:[${z}]|$)`,
423
+ SEP: "\\"
424
+ }, Ds = {
425
+ __proto__: null,
426
+ alnum: "a-zA-Z0-9",
427
+ alpha: "a-zA-Z",
428
+ ascii: "\\x00-\\x7F",
429
+ blank: " \\t",
430
+ cntrl: "\\x00-\\x1F\\x7F",
431
+ digit: "0-9",
432
+ graph: "\\x21-\\x7E",
433
+ lower: "a-z",
434
+ print: "\\x20-\\x7E ",
435
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
436
+ space: " \\t\\r\\n\\v\\f",
437
+ upper: "A-Z",
438
+ word: "A-Za-z0-9_",
439
+ xdigit: "A-Fa-f0-9"
440
+ };
441
+ var dt = {
442
+ DEFAULT_MAX_EXTGLOB_RECURSION: ms,
443
+ MAX_LENGTH: 1024 * 64,
444
+ POSIX_REGEX_SOURCE: Ds,
445
+ // regular expressions
446
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
447
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
448
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
449
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
450
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
451
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
452
+ // Replace globs with equivalent patterns to reduce parsing time.
453
+ REPLACEMENTS: {
454
+ __proto__: null,
455
+ "***": "*",
456
+ "**/**": "**",
457
+ "**/**/**": "**"
458
+ },
459
+ // Digits
460
+ CHAR_0: 48,
461
+ /* 0 */
462
+ CHAR_9: 57,
463
+ /* 9 */
464
+ // Alphabet chars.
465
+ CHAR_UPPERCASE_A: 65,
466
+ /* A */
467
+ CHAR_LOWERCASE_A: 97,
468
+ /* a */
469
+ CHAR_UPPERCASE_Z: 90,
470
+ /* Z */
471
+ CHAR_LOWERCASE_Z: 122,
472
+ /* z */
473
+ CHAR_LEFT_PARENTHESES: 40,
474
+ /* ( */
475
+ CHAR_RIGHT_PARENTHESES: 41,
476
+ /* ) */
477
+ CHAR_ASTERISK: 42,
478
+ /* * */
479
+ // Non-alphabetic chars.
480
+ CHAR_AMPERSAND: 38,
481
+ /* & */
482
+ CHAR_AT: 64,
483
+ /* @ */
484
+ CHAR_BACKWARD_SLASH: 92,
485
+ /* \ */
486
+ CHAR_CARRIAGE_RETURN: 13,
487
+ /* \r */
488
+ CHAR_CIRCUMFLEX_ACCENT: 94,
489
+ /* ^ */
490
+ CHAR_COLON: 58,
491
+ /* : */
492
+ CHAR_COMMA: 44,
493
+ /* , */
494
+ CHAR_DOT: 46,
495
+ /* . */
496
+ CHAR_DOUBLE_QUOTE: 34,
497
+ /* " */
498
+ CHAR_EQUAL: 61,
499
+ /* = */
500
+ CHAR_EXCLAMATION_MARK: 33,
501
+ /* ! */
502
+ CHAR_FORM_FEED: 12,
503
+ /* \f */
504
+ CHAR_FORWARD_SLASH: 47,
505
+ /* / */
506
+ CHAR_GRAVE_ACCENT: 96,
507
+ /* ` */
508
+ CHAR_HASH: 35,
509
+ /* # */
510
+ CHAR_HYPHEN_MINUS: 45,
511
+ /* - */
512
+ CHAR_LEFT_ANGLE_BRACKET: 60,
513
+ /* < */
514
+ CHAR_LEFT_CURLY_BRACE: 123,
515
+ /* { */
516
+ CHAR_LEFT_SQUARE_BRACKET: 91,
517
+ /* [ */
518
+ CHAR_LINE_FEED: 10,
519
+ /* \n */
520
+ CHAR_NO_BREAK_SPACE: 160,
521
+ /* \u00A0 */
522
+ CHAR_PERCENT: 37,
523
+ /* % */
524
+ CHAR_PLUS: 43,
525
+ /* + */
526
+ CHAR_QUESTION_MARK: 63,
527
+ /* ? */
528
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
529
+ /* > */
530
+ CHAR_RIGHT_CURLY_BRACE: 125,
531
+ /* } */
532
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
533
+ /* ] */
534
+ CHAR_SEMICOLON: 59,
535
+ /* ; */
536
+ CHAR_SINGLE_QUOTE: 39,
537
+ /* ' */
538
+ CHAR_SPACE: 32,
539
+ /* */
540
+ CHAR_TAB: 9,
541
+ /* \t */
542
+ CHAR_UNDERSCORE: 95,
543
+ /* _ */
544
+ CHAR_VERTICAL_LINE: 124,
545
+ /* | */
546
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
547
+ /* \uFEFF */
548
+ /**
549
+ * Create EXTGLOB_CHARS
550
+ */
551
+ extglobChars(t) {
552
+ return {
553
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${t.STAR})` },
554
+ "?": { type: "qmark", open: "(?:", close: ")?" },
555
+ "+": { type: "plus", open: "(?:", close: ")+" },
556
+ "*": { type: "star", open: "(?:", close: ")*" },
557
+ "@": { type: "at", open: "(?:", close: ")" }
558
+ };
559
+ },
560
+ /**
561
+ * Create GLOB_CHARS
562
+ */
563
+ globChars(t) {
564
+ return t === !0 ? Ps : Vt;
565
+ }
566
+ };
567
+ (function(t) {
568
+ const {
569
+ REGEX_BACKSLASH: s,
570
+ REGEX_REMOVE_BACKSLASH: e,
571
+ REGEX_SPECIAL_CHARS: r,
572
+ REGEX_SPECIAL_CHARS_GLOBAL: o
573
+ } = dt;
574
+ t.isObject = (n) => n !== null && typeof n == "object" && !Array.isArray(n), t.hasRegexChars = (n) => r.test(n), t.isRegexChar = (n) => n.length === 1 && t.hasRegexChars(n), t.escapeRegex = (n) => n.replace(o, "\\$1"), t.toPosixSlashes = (n) => n.replace(s, "/"), t.isWindows = () => {
575
+ if (typeof navigator < "u" && navigator.platform) {
576
+ const n = navigator.platform.toLowerCase();
577
+ return n === "win32" || n === "windows";
578
+ }
579
+ return typeof process < "u" && process.platform ? process.platform === "win32" : !1;
580
+ }, t.removeBackslashes = (n) => n.replace(e, (i) => i === "\\" ? "" : i), t.escapeLast = (n, i, l) => {
581
+ const h = n.lastIndexOf(i, l);
582
+ return h === -1 ? n : n[h - 1] === "\\" ? t.escapeLast(n, i, h - 1) : `${n.slice(0, h)}\\${n.slice(h)}`;
583
+ }, t.removePrefix = (n, i = {}) => {
584
+ let l = n;
585
+ return l.startsWith("./") && (l = l.slice(2), i.prefix = "./"), l;
586
+ }, t.wrapOutput = (n, i = {}, l = {}) => {
587
+ const h = l.contains ? "" : "^", g = l.contains ? "" : "$";
588
+ let d = `${h}(?:${n})${g}`;
589
+ return i.negated === !0 && (d = `(?:^(?!${d}).*$)`), d;
590
+ }, t.basename = (n, { windows: i } = {}) => {
591
+ const l = n.split(i ? /[\\/]/ : "/"), h = l[l.length - 1];
592
+ return h === "" ? l[l.length - 2] : h;
593
+ };
594
+ })(ct);
595
+ const kt = ct, {
596
+ CHAR_ASTERISK: At,
597
+ /* * */
598
+ CHAR_AT: Is,
599
+ /* @ */
600
+ CHAR_BACKWARD_SLASH: rt,
601
+ /* \ */
602
+ CHAR_COMMA: Ns,
603
+ /* , */
604
+ CHAR_DOT: Rt,
605
+ /* . */
606
+ CHAR_EXCLAMATION_MARK: _t,
607
+ /* ! */
608
+ CHAR_FORWARD_SLASH: Jt,
609
+ /* / */
610
+ CHAR_LEFT_CURLY_BRACE: Et,
611
+ /* { */
612
+ CHAR_LEFT_PARENTHESES: ft,
613
+ /* ( */
614
+ CHAR_LEFT_SQUARE_BRACKET: Bs,
615
+ /* [ */
616
+ CHAR_PLUS: Fs,
617
+ /* + */
618
+ CHAR_QUESTION_MARK: Pt,
619
+ /* ? */
620
+ CHAR_RIGHT_CURLY_BRACE: Ms,
621
+ /* } */
622
+ CHAR_RIGHT_PARENTHESES: Dt,
623
+ /* ) */
624
+ CHAR_RIGHT_SQUARE_BRACKET: Gs
625
+ /* ] */
626
+ } = dt, It = (t) => t === Jt || t === rt, Nt = (t) => {
627
+ t.isPrefix !== !0 && (t.depth = t.isGlobstar ? 1 / 0 : 1);
628
+ }, Ws = (t, s) => {
629
+ const e = s || {}, r = t.length - 1, o = e.parts === !0 || e.tokens === !0 || e.scanToEnd === !0, n = [], i = [], l = [];
630
+ let h = t, g = -1, d = 0, A = 0, E = !1, x = !1, y = !1, C = !1, T = !1, W = !1, _ = !1, M = !1, j = !1, k = !1, O = 0, v, R, m = { value: "", depth: 0, isGlob: !1 };
631
+ const u = () => g >= r, G = () => h.charCodeAt(g + 1), I = () => (v = R, h.charCodeAt(++g));
632
+ for (; g < r; ) {
633
+ R = I();
634
+ let $;
635
+ if (R === rt) {
636
+ _ = m.backslashes = !0, R = I(), R === Et && (W = !0);
637
+ continue;
638
+ }
639
+ if (W === !0 || R === Et) {
640
+ for (O++; u() !== !0 && (R = I()); ) {
641
+ if (R === rt) {
642
+ _ = m.backslashes = !0, I();
643
+ continue;
644
+ }
645
+ if (R === Et) {
646
+ O++;
647
+ continue;
648
+ }
649
+ if (W !== !0 && R === Rt && (R = I()) === Rt) {
650
+ if (E = m.isBrace = !0, y = m.isGlob = !0, k = !0, o === !0)
651
+ continue;
652
+ break;
653
+ }
654
+ if (W !== !0 && R === Ns) {
655
+ if (E = m.isBrace = !0, y = m.isGlob = !0, k = !0, o === !0)
656
+ continue;
657
+ break;
658
+ }
659
+ if (R === Ms && (O--, O === 0)) {
660
+ W = !1, E = m.isBrace = !0, k = !0;
661
+ break;
662
+ }
663
+ }
664
+ if (o === !0)
665
+ continue;
666
+ break;
667
+ }
668
+ if (R === Jt) {
669
+ if (n.push(g), i.push(m), m = { value: "", depth: 0, isGlob: !1 }, k === !0) continue;
670
+ if (v === Rt && g === d + 1) {
671
+ d += 2;
672
+ continue;
673
+ }
674
+ A = g + 1;
675
+ continue;
676
+ }
677
+ if (e.noext !== !0 && (R === Fs || R === Is || R === At || R === Pt || R === _t) === !0 && G() === ft) {
678
+ if (y = m.isGlob = !0, C = m.isExtglob = !0, k = !0, R === _t && g === d && (j = !0), o === !0) {
679
+ let q = 0;
680
+ for (; u() !== !0 && (R = I()); ) {
681
+ if (R === rt) {
682
+ _ = m.backslashes = !0, I();
683
+ continue;
684
+ }
685
+ if (R === ft) {
686
+ q++;
687
+ continue;
688
+ }
689
+ if (R === Dt && --q === 0) {
690
+ k = !0;
691
+ break;
692
+ }
693
+ }
694
+ continue;
695
+ }
696
+ break;
697
+ }
698
+ if (R === At) {
699
+ if (v === At && (T = m.isGlobstar = !0), y = m.isGlob = !0, k = !0, o === !0)
700
+ continue;
701
+ break;
702
+ }
703
+ if (R === Pt) {
704
+ if (y = m.isGlob = !0, k = !0, o === !0)
705
+ continue;
706
+ break;
707
+ }
708
+ if (R === Bs) {
709
+ for (; u() !== !0 && ($ = I()); ) {
710
+ if ($ === rt) {
711
+ _ = m.backslashes = !0, I();
712
+ continue;
713
+ }
714
+ if ($ === Gs) {
715
+ x = m.isBracket = !0, y = m.isGlob = !0, k = !0;
716
+ break;
717
+ }
718
+ }
719
+ if (o === !0)
720
+ continue;
721
+ break;
722
+ }
723
+ if (e.nonegate !== !0 && R === _t && g === d) {
724
+ M = m.negated = !0, d++;
725
+ continue;
726
+ }
727
+ if (e.noparen !== !0 && R === ft) {
728
+ if (y = m.isGlob = !0, o === !0) {
729
+ let U = 1;
730
+ for (; u() !== !0 && (R = I()); ) {
731
+ if (R === rt) {
732
+ _ = m.backslashes = !0, I();
733
+ continue;
734
+ }
735
+ if (R === ft) {
736
+ U++;
737
+ continue;
738
+ }
739
+ if (R === Dt && --U === 0) {
740
+ k = !0;
741
+ break;
742
+ }
743
+ }
744
+ continue;
745
+ }
746
+ break;
747
+ }
748
+ if (y === !0) {
749
+ if (k = !0, o === !0)
750
+ continue;
751
+ break;
752
+ }
753
+ }
754
+ e.noext === !0 && (C = !1, y = !1);
755
+ let P = h, c = "", a = "";
756
+ d > 0 && (c = h.slice(0, d), h = h.slice(d), A -= d), P && y === !0 && A > 0 ? (P = h.slice(0, A), a = h.slice(A)) : y === !0 ? (P = "", a = h) : P = h, P && P !== "" && P !== "/" && P !== h && It(P.charCodeAt(P.length - 1)) && (P = P.slice(0, -1)), e.unescape === !0 && (a && (a = kt.removeBackslashes(a)), P && _ === !0 && (P = kt.removeBackslashes(P)));
757
+ const X = {
758
+ prefix: c,
759
+ input: t,
760
+ start: d,
761
+ base: P,
762
+ glob: a,
763
+ isBrace: E,
764
+ isBracket: x,
765
+ isGlob: y,
766
+ isExtglob: C,
767
+ isGlobstar: T,
768
+ negated: M,
769
+ negatedExtglob: j
770
+ };
771
+ if (e.tokens === !0 && (X.maxDepth = 0, It(R) || i.push(m), X.tokens = i), e.parts === !0 || e.tokens === !0) {
772
+ let $;
773
+ for (let B = 0; B < n.length; B++) {
774
+ const et = $ !== void 0 ? $ + 1 : d, ot = n[B], V = t.slice(et, ot);
775
+ e.tokens && (B === 0 && d !== 0 ? (i[B].isPrefix = !0, i[B].value = c) : i[B].value = V, Nt(i[B]), X.maxDepth += i[B].depth), ot >= d && (l.push(V), $ = ot);
776
+ }
777
+ const U = $ !== void 0 ? $ + 1 : d, q = t.slice(U);
778
+ l.push(q), e.tokens && $ && $ + 1 < t.length && (i[i.length - 1].value = q, Nt(i[i.length - 1]), X.maxDepth += i[i.length - 1].depth), X.slashes = n, X.parts = l;
779
+ }
780
+ return X;
781
+ };
782
+ var Us = Ws;
783
+ const ut = dt, K = ct, {
784
+ MAX_LENGTH: pt,
785
+ POSIX_REGEX_SOURCE: qs,
786
+ REGEX_NON_SPECIAL_CHARS: Ks,
787
+ REGEX_SPECIAL_CHARS_BACKREF: Xs,
788
+ REPLACEMENTS: te
789
+ } = ut, js = (t, s) => {
790
+ if (typeof s.expandRange == "function")
791
+ return s.expandRange(...t, s);
792
+ t.sort();
793
+ const e = `[${t.join("-")}]`;
794
+ try {
795
+ new RegExp(e);
796
+ } catch {
797
+ return t.map((o) => K.escapeRegex(o)).join("..");
798
+ }
799
+ return e;
800
+ }, nt = (t, s) => `Missing ${t}: "${s}" - use "\\\\${s}" to match literal characters`, ee = (t) => {
801
+ const s = [];
802
+ let e = 0, r = 0, o = 0, n = "", i = !1;
803
+ for (const l of t) {
804
+ if (i === !0) {
805
+ n += l, i = !1;
806
+ continue;
807
+ }
808
+ if (l === "\\") {
809
+ n += l, i = !0;
810
+ continue;
811
+ }
812
+ if (l === '"') {
813
+ o = o === 1 ? 0 : 1, n += l;
814
+ continue;
815
+ }
816
+ if (o === 0) {
817
+ if (l === "[")
818
+ e++;
819
+ else if (l === "]" && e > 0)
820
+ e--;
821
+ else if (e === 0) {
822
+ if (l === "(")
823
+ r++;
824
+ else if (l === ")" && r > 0)
825
+ r--;
826
+ else if (l === "|" && r === 0) {
827
+ s.push(n), n = "";
828
+ continue;
829
+ }
830
+ }
831
+ }
832
+ n += l;
833
+ }
834
+ return s.push(n), s;
835
+ }, Qs = (t) => {
836
+ let s = !1;
837
+ for (const e of t) {
838
+ if (s === !0) {
839
+ s = !1;
840
+ continue;
841
+ }
842
+ if (e === "\\") {
843
+ s = !0;
844
+ continue;
845
+ }
846
+ if (/[?*+@!()[\]{}]/.test(e))
847
+ return !1;
848
+ }
849
+ return !0;
850
+ }, vt = (t) => {
851
+ let s = t.trim(), e = !0;
852
+ for (; e === !0; )
853
+ e = !1, /^@\([^\\()[\]{}|]+\)$/.test(s) && (s = s.slice(2, -1), e = !0);
854
+ if (Qs(s))
855
+ return s.replace(/\\(.)/g, "$1");
856
+ }, zs = (t) => {
857
+ const s = t.map(vt).filter(Boolean);
858
+ for (let e = 0; e < s.length; e++)
859
+ for (let r = e + 1; r < s.length; r++) {
860
+ const o = s[e], n = s[r], i = o[0];
861
+ if (!(!i || o !== i.repeat(o.length) || n !== i.repeat(n.length)) && (o === n || o.startsWith(n) || n.startsWith(o)))
862
+ return !0;
863
+ }
864
+ return !1;
865
+ }, mt = (t, s = !0) => {
866
+ if (t[0] !== "+" && t[0] !== "*" || t[1] !== "(")
867
+ return;
868
+ let e = 0, r = 0, o = 0, n = !1;
869
+ for (let i = 1; i < t.length; i++) {
870
+ const l = t[i];
871
+ if (n === !0) {
872
+ n = !1;
873
+ continue;
874
+ }
875
+ if (l === "\\") {
876
+ n = !0;
877
+ continue;
878
+ }
879
+ if (l === '"') {
880
+ o = o === 1 ? 0 : 1;
881
+ continue;
882
+ }
883
+ if (o !== 1) {
884
+ if (l === "[") {
885
+ e++;
886
+ continue;
887
+ }
888
+ if (l === "]" && e > 0) {
889
+ e--;
890
+ continue;
891
+ }
892
+ if (!(e > 0)) {
893
+ if (l === "(") {
894
+ r++;
895
+ continue;
896
+ }
897
+ if (l === ")" && (r--, r === 0))
898
+ return s === !0 && i !== t.length - 1 ? void 0 : {
899
+ type: t[0],
900
+ body: t.slice(2, i),
901
+ end: i
902
+ };
903
+ }
904
+ }
905
+ }
906
+ }, Ys = (t) => `${t.length === 1 ? K.escapeRegex(t[0]) : `[${t.map((e) => K.escapeRegex(e)).join("")}]`}*`, Zs = (t) => {
907
+ let s = 0;
908
+ const e = [];
909
+ for (; s < t.length; ) {
910
+ const r = mt(t.slice(s), !1);
911
+ if (!r || r.type !== "*")
912
+ return;
913
+ const o = ee(r.body).map((i) => i.trim());
914
+ if (o.length !== 1)
915
+ return;
916
+ const n = vt(o[0]);
917
+ if (!n || n.length !== 1)
918
+ return;
919
+ e.push(n), s += r.end + 1;
920
+ }
921
+ if (!(e.length < 1))
922
+ return e;
923
+ }, Vs = (t) => {
924
+ let s = 0, e = t.trim(), r = mt(e);
925
+ for (; r; )
926
+ s++, e = r.body.trim(), r = mt(e);
927
+ return s;
928
+ }, Js = (t, s) => {
929
+ if (s.maxExtglobRecursion === !1)
930
+ return { risky: !1 };
931
+ const e = typeof s.maxExtglobRecursion == "number" ? s.maxExtglobRecursion : ut.DEFAULT_MAX_EXTGLOB_RECURSION, r = ee(t).map((l) => l.trim());
932
+ if (r.length > 1 && (r.some((l) => l === "") || r.some((l) => /^[*?]+$/.test(l)) || zs(r)))
933
+ return { risky: !0 };
934
+ const o = [];
935
+ let n = !1, i = !0;
936
+ for (const l of r) {
937
+ const h = Zs(l);
938
+ if (h) {
939
+ n = !0, o.push(...h);
940
+ continue;
941
+ }
942
+ const g = vt(l);
943
+ if (g && g.length === 1) {
944
+ o.push(g);
945
+ continue;
946
+ }
947
+ if (i = !1, Vs(l) > e)
948
+ return { risky: !0 };
949
+ }
950
+ return n ? i ? { risky: !0, safeOutput: Ys([...new Set(o)]) } : { risky: !0 } : { risky: !1 };
951
+ }, wt = (t, s) => {
952
+ if (typeof t != "string")
953
+ throw new TypeError("Expected a string");
954
+ t = te[t] || t;
955
+ const e = { ...s }, r = typeof e.maxLength == "number" ? Math.min(pt, e.maxLength) : pt;
956
+ let o = t.length;
957
+ if (o > r)
958
+ throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);
959
+ const n = { type: "bos", value: "", output: e.prepend || "" }, i = [n], l = e.capture ? "" : "?:", h = ut.globChars(e.windows), g = ut.extglobChars(h), {
960
+ DOT_LITERAL: d,
961
+ PLUS_LITERAL: A,
962
+ SLASH_LITERAL: E,
963
+ ONE_CHAR: x,
964
+ DOTS_SLASH: y,
965
+ NO_DOT: C,
966
+ NO_DOT_SLASH: T,
967
+ NO_DOTS_SLASH: W,
968
+ QMARK: _,
969
+ QMARK_NO_DOT: M,
970
+ STAR: j,
971
+ START_ANCHOR: k
972
+ } = h, O = (p) => `(${l}(?:(?!${k}${p.dot ? y : d}).)*?)`, v = e.dot ? "" : C, R = e.dot ? _ : M;
973
+ let m = e.bash === !0 ? O(e) : j;
974
+ e.capture && (m = `(${m})`), typeof e.noext == "boolean" && (e.noextglob = e.noext);
975
+ const u = {
976
+ input: t,
977
+ index: -1,
978
+ start: 0,
979
+ dot: e.dot === !0,
980
+ consumed: "",
981
+ output: "",
982
+ prefix: "",
983
+ backtrack: !1,
984
+ negated: !1,
985
+ brackets: 0,
986
+ braces: 0,
987
+ parens: 0,
988
+ quotes: 0,
989
+ globstar: !1,
990
+ tokens: i
991
+ };
992
+ t = K.removePrefix(t, u), o = t.length;
993
+ const G = [], I = [], P = [];
994
+ let c = n, a;
995
+ const X = () => u.index === o - 1, $ = u.peek = (p = 1) => t[u.index + p], U = u.advance = () => t[++u.index] || "", q = () => t.slice(u.index + 1), B = (p = "", L = 0) => {
996
+ u.consumed += p, u.index += L;
997
+ }, et = (p) => {
998
+ u.output += p.output != null ? p.output : p.value, B(p.value);
999
+ }, ot = () => {
1000
+ let p = 1;
1001
+ for (; $() === "!" && ($(2) !== "(" || $(3) === "?"); )
1002
+ U(), u.start++, p++;
1003
+ return p % 2 === 0 ? !1 : (u.negated = !0, u.start++, !0);
1004
+ }, V = (p) => {
1005
+ u[p]++, P.push(p);
1006
+ }, Z = (p) => {
1007
+ u[p]--, P.pop();
1008
+ }, S = (p) => {
1009
+ if (c.type === "globstar") {
1010
+ const L = u.braces > 0 && (p.type === "comma" || p.type === "brace"), f = p.extglob === !0 || G.length && (p.type === "pipe" || p.type === "paren");
1011
+ p.type !== "slash" && p.type !== "paren" && !L && !f && (u.output = u.output.slice(0, -c.output.length), c.type = "star", c.value = "*", c.output = m, u.output += c.output);
1012
+ }
1013
+ if (G.length && p.type !== "paren" && (G[G.length - 1].inner += p.value), (p.value || p.output) && et(p), c && c.type === "text" && p.type === "text") {
1014
+ c.output = (c.output || c.value) + p.value, c.value += p.value;
1015
+ return;
1016
+ }
1017
+ p.prev = c, i.push(p), c = p;
1018
+ }, lt = (p, L) => {
1019
+ const f = { ...g[L], conditions: 1, inner: "" };
1020
+ f.prev = c, f.parens = u.parens, f.output = u.output, f.startIndex = u.index, f.tokensIndex = i.length;
1021
+ const b = (e.capture ? "(" : "") + f.open;
1022
+ V("parens"), S({ type: p, value: L, output: u.output ? "" : x }), S({ type: "paren", extglob: !0, value: U(), output: b }), G.push(f);
1023
+ }, pe = (p) => {
1024
+ const L = t.slice(p.startIndex, u.index + 1), f = t.slice(p.startIndex + 2, u.index), b = Js(f, e);
1025
+ if ((p.type === "plus" || p.type === "star") && b.risky) {
1026
+ const w = b.safeOutput ? (p.output ? "" : x) + (e.capture ? `(${b.safeOutput})` : b.safeOutput) : void 0, Q = i[p.tokensIndex];
1027
+ Q.type = "text", Q.value = L, Q.output = w || K.escapeRegex(L);
1028
+ for (let J = p.tokensIndex + 1; J < i.length; J++)
1029
+ i[J].value = "", i[J].output = "", delete i[J].suffix;
1030
+ u.output = p.output + Q.output, u.backtrack = !0, S({ type: "paren", extglob: !0, value: a, output: "" }), Z("parens");
1031
+ return;
1032
+ }
1033
+ let H = p.close + (e.capture ? ")" : ""), F;
1034
+ if (p.type === "negate") {
1035
+ let w = m;
1036
+ if (p.inner && p.inner.length > 1 && p.inner.includes("/") && (w = O(e)), (w !== m || X() || /^\)+$/.test(q())) && (H = p.close = `)$))${w}`), p.inner.includes("*") && (F = q()) && /^\.[^\\/.]+$/.test(F)) {
1037
+ const Q = wt(F, { ...s, fastpaths: !1 }).output;
1038
+ H = p.close = `)${Q})${w})`;
1039
+ }
1040
+ p.prev.type === "bos" && (u.negatedExtglob = !0);
1041
+ }
1042
+ S({ type: "paren", extglob: !0, value: a, output: H }), Z("parens");
1043
+ };
1044
+ if (e.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(t)) {
1045
+ let p = !1, L = t.replace(Xs, (f, b, H, F, w, Q) => F === "\\" ? (p = !0, f) : F === "?" ? b ? b + F + (w ? _.repeat(w.length) : "") : Q === 0 ? R + (w ? _.repeat(w.length) : "") : _.repeat(H.length) : F === "." ? d.repeat(H.length) : F === "*" ? b ? b + F + (w ? m : "") : m : b ? f : `\\${f}`);
1046
+ return p === !0 && (e.unescape === !0 ? L = L.replace(/\\/g, "") : L = L.replace(/\\+/g, (f) => f.length % 2 === 0 ? "\\\\" : f ? "\\" : "")), L === t && e.contains === !0 ? (u.output = t, u) : (u.output = K.wrapOutput(L, u, s), u);
1047
+ }
1048
+ for (; !X(); ) {
1049
+ if (a = U(), a === "\0")
1050
+ continue;
1051
+ if (a === "\\") {
1052
+ const f = $();
1053
+ if (f === "/" && e.bash !== !0 || f === "." || f === ";")
1054
+ continue;
1055
+ if (!f) {
1056
+ a += "\\", S({ type: "text", value: a });
1057
+ continue;
1058
+ }
1059
+ const b = /^\\+/.exec(q());
1060
+ let H = 0;
1061
+ if (b && b[0].length > 2 && (H = b[0].length, u.index += H, H % 2 !== 0 && (a += "\\")), e.unescape === !0 ? a = U() : a += U(), u.brackets === 0) {
1062
+ S({ type: "text", value: a });
1063
+ continue;
1064
+ }
1065
+ }
1066
+ if (u.brackets > 0 && (a !== "]" || c.value === "[" || c.value === "[^")) {
1067
+ if (e.posix !== !1 && a === ":") {
1068
+ const f = c.value.slice(1);
1069
+ if (f.includes("[") && (c.posix = !0, f.includes(":"))) {
1070
+ const b = c.value.lastIndexOf("["), H = c.value.slice(0, b), F = c.value.slice(b + 2), w = qs[F];
1071
+ if (w) {
1072
+ c.value = H + w, u.backtrack = !0, U(), !n.output && i.indexOf(c) === 1 && (n.output = x);
1073
+ continue;
1074
+ }
1075
+ }
1076
+ }
1077
+ (a === "[" && $() !== ":" || a === "-" && $() === "]") && (a = `\\${a}`), a === "]" && (c.value === "[" || c.value === "[^") && (a = `\\${a}`), e.posix === !0 && a === "!" && c.value === "[" && (a = "^"), c.value += a, et({ value: a });
1078
+ continue;
1079
+ }
1080
+ if (u.quotes === 1 && a !== '"') {
1081
+ a = K.escapeRegex(a), c.value += a, et({ value: a });
1082
+ continue;
1083
+ }
1084
+ if (a === '"') {
1085
+ u.quotes = u.quotes === 1 ? 0 : 1, e.keepQuotes === !0 && S({ type: "text", value: a });
1086
+ continue;
1087
+ }
1088
+ if (a === "(") {
1089
+ V("parens"), S({ type: "paren", value: a });
1090
+ continue;
1091
+ }
1092
+ if (a === ")") {
1093
+ if (u.parens === 0 && e.strictBrackets === !0)
1094
+ throw new SyntaxError(nt("opening", "("));
1095
+ const f = G[G.length - 1];
1096
+ if (f && u.parens === f.parens + 1) {
1097
+ pe(G.pop());
1098
+ continue;
1099
+ }
1100
+ S({ type: "paren", value: a, output: u.parens ? ")" : "\\)" }), Z("parens");
1101
+ continue;
1102
+ }
1103
+ if (a === "[") {
1104
+ if (e.nobracket === !0 || !q().includes("]")) {
1105
+ if (e.nobracket !== !0 && e.strictBrackets === !0)
1106
+ throw new SyntaxError(nt("closing", "]"));
1107
+ a = `\\${a}`;
1108
+ } else
1109
+ V("brackets");
1110
+ S({ type: "bracket", value: a });
1111
+ continue;
1112
+ }
1113
+ if (a === "]") {
1114
+ if (e.nobracket === !0 || c && c.type === "bracket" && c.value.length === 1) {
1115
+ S({ type: "text", value: a, output: `\\${a}` });
1116
+ continue;
1117
+ }
1118
+ if (u.brackets === 0) {
1119
+ if (e.strictBrackets === !0)
1120
+ throw new SyntaxError(nt("opening", "["));
1121
+ S({ type: "text", value: a, output: `\\${a}` });
1122
+ continue;
1123
+ }
1124
+ Z("brackets");
1125
+ const f = c.value.slice(1);
1126
+ if (c.posix !== !0 && f[0] === "^" && !f.includes("/") && (a = `/${a}`), c.value += a, et({ value: a }), e.literalBrackets === !1 || K.hasRegexChars(f))
1127
+ continue;
1128
+ const b = K.escapeRegex(c.value);
1129
+ if (u.output = u.output.slice(0, -c.value.length), e.literalBrackets === !0) {
1130
+ u.output += b, c.value = b;
1131
+ continue;
1132
+ }
1133
+ c.value = `(${l}${b}|${c.value})`, u.output += c.value;
1134
+ continue;
1135
+ }
1136
+ if (a === "{" && e.nobrace !== !0) {
1137
+ V("braces");
1138
+ const f = {
1139
+ type: "brace",
1140
+ value: a,
1141
+ output: "(",
1142
+ outputIndex: u.output.length,
1143
+ tokensIndex: u.tokens.length
1144
+ };
1145
+ I.push(f), S(f);
1146
+ continue;
1147
+ }
1148
+ if (a === "}") {
1149
+ const f = I[I.length - 1];
1150
+ if (e.nobrace === !0 || !f) {
1151
+ S({ type: "text", value: a, output: a });
1152
+ continue;
1153
+ }
1154
+ let b = ")";
1155
+ if (f.dots === !0) {
1156
+ const H = i.slice(), F = [];
1157
+ for (let w = H.length - 1; w >= 0 && (i.pop(), H[w].type !== "brace"); w--)
1158
+ H[w].type !== "dots" && F.unshift(H[w].value);
1159
+ b = js(F, e), u.backtrack = !0;
1160
+ }
1161
+ if (f.comma !== !0 && f.dots !== !0) {
1162
+ const H = u.output.slice(0, f.outputIndex), F = u.tokens.slice(f.tokensIndex);
1163
+ f.value = f.output = "\\{", a = b = "\\}", u.output = H;
1164
+ for (const w of F)
1165
+ u.output += w.output || w.value;
1166
+ }
1167
+ S({ type: "brace", value: a, output: b }), Z("braces"), I.pop();
1168
+ continue;
1169
+ }
1170
+ if (a === "|") {
1171
+ G.length > 0 && G[G.length - 1].conditions++, S({ type: "text", value: a });
1172
+ continue;
1173
+ }
1174
+ if (a === ",") {
1175
+ let f = a;
1176
+ const b = I[I.length - 1];
1177
+ b && P[P.length - 1] === "braces" && (b.comma = !0, f = "|"), S({ type: "comma", value: a, output: f });
1178
+ continue;
1179
+ }
1180
+ if (a === "/") {
1181
+ if (c.type === "dot" && u.index === u.start + 1) {
1182
+ u.start = u.index + 1, u.consumed = "", u.output = "", i.pop(), c = n;
1183
+ continue;
1184
+ }
1185
+ S({ type: "slash", value: a, output: E });
1186
+ continue;
1187
+ }
1188
+ if (a === ".") {
1189
+ if (u.braces > 0 && c.type === "dot") {
1190
+ c.value === "." && (c.output = d);
1191
+ const f = I[I.length - 1];
1192
+ c.type = "dots", c.output += a, c.value += a, f.dots = !0;
1193
+ continue;
1194
+ }
1195
+ if (u.braces + u.parens === 0 && c.type !== "bos" && c.type !== "slash") {
1196
+ S({ type: "text", value: a, output: d });
1197
+ continue;
1198
+ }
1199
+ S({ type: "dot", value: a, output: d });
1200
+ continue;
1201
+ }
1202
+ if (a === "?") {
1203
+ if (!(c && c.value === "(") && e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
1204
+ lt("qmark", a);
1205
+ continue;
1206
+ }
1207
+ if (c && c.type === "paren") {
1208
+ const b = $();
1209
+ let H = a;
1210
+ (c.value === "(" && !/[!=<:]/.test(b) || b === "<" && !/<([!=]|\w+>)/.test(q())) && (H = `\\${a}`), S({ type: "text", value: a, output: H });
1211
+ continue;
1212
+ }
1213
+ if (e.dot !== !0 && (c.type === "slash" || c.type === "bos")) {
1214
+ S({ type: "qmark", value: a, output: M });
1215
+ continue;
1216
+ }
1217
+ S({ type: "qmark", value: a, output: _ });
1218
+ continue;
1219
+ }
1220
+ if (a === "!") {
1221
+ if (e.noextglob !== !0 && $() === "(" && ($(2) !== "?" || !/[!=<:]/.test($(3)))) {
1222
+ lt("negate", a);
1223
+ continue;
1224
+ }
1225
+ if (e.nonegate !== !0 && u.index === 0) {
1226
+ ot();
1227
+ continue;
1228
+ }
1229
+ }
1230
+ if (a === "+") {
1231
+ if (e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
1232
+ lt("plus", a);
1233
+ continue;
1234
+ }
1235
+ if (c && c.value === "(" || e.regex === !1) {
1236
+ S({ type: "plus", value: a, output: A });
1237
+ continue;
1238
+ }
1239
+ if (c && (c.type === "bracket" || c.type === "paren" || c.type === "brace") || u.parens > 0) {
1240
+ S({ type: "plus", value: a });
1241
+ continue;
1242
+ }
1243
+ S({ type: "plus", value: A });
1244
+ continue;
1245
+ }
1246
+ if (a === "@") {
1247
+ if (e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
1248
+ S({ type: "at", extglob: !0, value: a, output: "" });
1249
+ continue;
1250
+ }
1251
+ S({ type: "text", value: a });
1252
+ continue;
1253
+ }
1254
+ if (a !== "*") {
1255
+ (a === "$" || a === "^") && (a = `\\${a}`);
1256
+ const f = Ks.exec(q());
1257
+ f && (a += f[0], u.index += f[0].length), S({ type: "text", value: a });
1258
+ continue;
1259
+ }
1260
+ if (c && (c.type === "globstar" || c.star === !0)) {
1261
+ c.type = "star", c.star = !0, c.value += a, c.output = m, u.backtrack = !0, u.globstar = !0, B(a);
1262
+ continue;
1263
+ }
1264
+ let p = q();
1265
+ if (e.noextglob !== !0 && /^\([^?]/.test(p)) {
1266
+ lt("star", a);
1267
+ continue;
1268
+ }
1269
+ if (c.type === "star") {
1270
+ if (e.noglobstar === !0) {
1271
+ B(a);
1272
+ continue;
1273
+ }
1274
+ const f = c.prev, b = f.prev, H = f.type === "slash" || f.type === "bos", F = b && (b.type === "star" || b.type === "globstar");
1275
+ if (e.bash === !0 && (!H || p[0] && p[0] !== "/")) {
1276
+ S({ type: "star", value: a, output: "" });
1277
+ continue;
1278
+ }
1279
+ const w = u.braces > 0 && (f.type === "comma" || f.type === "brace"), Q = G.length && (f.type === "pipe" || f.type === "paren");
1280
+ if (!H && f.type !== "paren" && !w && !Q) {
1281
+ S({ type: "star", value: a, output: "" });
1282
+ continue;
1283
+ }
1284
+ for (; p.slice(0, 3) === "/**"; ) {
1285
+ const st = t[u.index + 4];
1286
+ if (st && st !== "/")
1287
+ break;
1288
+ p = p.slice(3), B("/**", 3);
1289
+ }
1290
+ const J = X() || u.parens > 0 && p === ")".repeat(u.parens) && !G.some((st) => st.type === "negate");
1291
+ if (f.type === "bos" && X()) {
1292
+ c.type = "globstar", c.value += a, c.output = O(e), u.output = c.output, u.globstar = !0, B(a);
1293
+ continue;
1294
+ }
1295
+ if (f.type === "slash" && f.prev.type !== "bos" && !F && J) {
1296
+ u.output = u.output.slice(0, -(f.output + c.output).length), f.output = `(?:${f.output}`, c.type = "globstar", c.output = O(e) + (e.strictSlashes ? ")" : "|$)"), c.value += a, u.globstar = !0, u.output += f.output + c.output, B(a);
1297
+ continue;
1298
+ }
1299
+ if (f.type === "slash" && f.prev.type !== "bos" && p[0] === "/") {
1300
+ const st = p[1] !== void 0 ? "|$" : "";
1301
+ u.output = u.output.slice(0, -(f.output + c.output).length), f.output = `(?:${f.output}`, c.type = "globstar", c.output = `${O(e)}${E}|${E}${st})`, c.value += a, u.output += f.output + c.output, u.globstar = !0, B(a + U()), S({ type: "slash", value: "/", output: "" });
1302
+ continue;
1303
+ }
1304
+ if (f.type === "bos" && p[0] === "/") {
1305
+ c.type = "globstar", c.value += a, c.output = `(?:^|${E}|${O(e)}${E})`, u.output = c.output, u.globstar = !0, B(a + U()), S({ type: "slash", value: "/", output: "" });
1306
+ continue;
1307
+ }
1308
+ u.output = u.output.slice(0, -c.output.length), c.type = "globstar", c.output = O(e), c.value += a, u.output += c.output, u.globstar = !0, B(a);
1309
+ continue;
1310
+ }
1311
+ const L = { type: "star", value: a, output: m };
1312
+ if (e.bash === !0) {
1313
+ L.output = ".*?", (c.type === "bos" || c.type === "slash") && (L.output = v + L.output), S(L);
1314
+ continue;
1315
+ }
1316
+ if (c && (c.type === "bracket" || c.type === "paren") && e.regex === !0) {
1317
+ L.output = a, S(L);
1318
+ continue;
1319
+ }
1320
+ (u.index === u.start || c.type === "slash" || c.type === "dot") && (c.type === "dot" ? (u.output += T, c.output += T) : e.dot === !0 ? (u.output += W, c.output += W) : (u.output += v, c.output += v), $() !== "*" && (u.output += x, c.output += x)), S(L);
1321
+ }
1322
+ for (; u.brackets > 0; ) {
1323
+ if (e.strictBrackets === !0) throw new SyntaxError(nt("closing", "]"));
1324
+ u.output = K.escapeLast(u.output, "["), Z("brackets");
1325
+ }
1326
+ for (; u.parens > 0; ) {
1327
+ if (e.strictBrackets === !0) throw new SyntaxError(nt("closing", ")"));
1328
+ u.output = K.escapeLast(u.output, "("), Z("parens");
1329
+ }
1330
+ for (; u.braces > 0; ) {
1331
+ if (e.strictBrackets === !0) throw new SyntaxError(nt("closing", "}"));
1332
+ u.output = K.escapeLast(u.output, "{"), Z("braces");
1333
+ }
1334
+ if (e.strictSlashes !== !0 && (c.type === "star" || c.type === "bracket") && S({ type: "maybe_slash", value: "", output: `${E}?` }), u.backtrack === !0) {
1335
+ u.output = "";
1336
+ for (const p of u.tokens)
1337
+ u.output += p.output != null ? p.output : p.value, p.suffix && (u.output += p.suffix);
1338
+ }
1339
+ return u;
1340
+ };
1341
+ wt.fastpaths = (t, s) => {
1342
+ const e = { ...s }, r = typeof e.maxLength == "number" ? Math.min(pt, e.maxLength) : pt, o = t.length;
1343
+ if (o > r)
1344
+ throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);
1345
+ t = te[t] || t;
1346
+ const {
1347
+ DOT_LITERAL: n,
1348
+ SLASH_LITERAL: i,
1349
+ ONE_CHAR: l,
1350
+ DOTS_SLASH: h,
1351
+ NO_DOT: g,
1352
+ NO_DOTS: d,
1353
+ NO_DOTS_SLASH: A,
1354
+ STAR: E,
1355
+ START_ANCHOR: x
1356
+ } = ut.globChars(e.windows), y = e.dot ? d : g, C = e.dot ? A : g, T = e.capture ? "" : "?:", W = { negated: !1, prefix: "" };
1357
+ let _ = e.bash === !0 ? ".*?" : E;
1358
+ e.capture && (_ = `(${_})`);
1359
+ const M = (v) => v.noglobstar === !0 ? _ : `(${T}(?:(?!${x}${v.dot ? h : n}).)*?)`, j = (v) => {
1360
+ switch (v) {
1361
+ case "*":
1362
+ return `${y}${l}${_}`;
1363
+ case ".*":
1364
+ return `${n}${l}${_}`;
1365
+ case "*.*":
1366
+ return `${y}${_}${n}${l}${_}`;
1367
+ case "*/*":
1368
+ return `${y}${_}${i}${l}${C}${_}`;
1369
+ case "**":
1370
+ return y + M(e);
1371
+ case "**/*":
1372
+ return `(?:${y}${M(e)}${i})?${C}${l}${_}`;
1373
+ case "**/*.*":
1374
+ return `(?:${y}${M(e)}${i})?${C}${_}${n}${l}${_}`;
1375
+ case "**/.*":
1376
+ return `(?:${y}${M(e)}${i})?${n}${l}${_}`;
1377
+ default: {
1378
+ const R = /^(.*?)\.(\w+)$/.exec(v);
1379
+ if (!R) return;
1380
+ const m = j(R[1]);
1381
+ return m ? m + n + R[2] : void 0;
1382
+ }
1383
+ }
1384
+ }, k = K.removePrefix(t, W);
1385
+ let O = j(k);
1386
+ return O && e.strictSlashes !== !0 && (O += `${i}?`), O;
1387
+ };
1388
+ var tn = wt;
1389
+ const en = Us, xt = tn, se = ct, sn = dt, nn = (t) => t && typeof t == "object" && !Array.isArray(t), D = (t, s, e = !1) => {
1390
+ if (Array.isArray(t)) {
1391
+ const d = t.map((E) => D(E, s, e));
1392
+ return (E) => {
1393
+ for (const x of d) {
1394
+ const y = x(E);
1395
+ if (y) return y;
1396
+ }
1397
+ return !1;
1398
+ };
1399
+ }
1400
+ const r = nn(t) && t.tokens && t.input;
1401
+ if (t === "" || typeof t != "string" && !r)
1402
+ throw new TypeError("Expected pattern to be a non-empty string");
1403
+ const o = s || {}, n = o.windows, i = r ? D.compileRe(t, s) : D.makeRe(t, s, !1, !0), l = i.state;
1404
+ delete i.state;
1405
+ let h = () => !1;
1406
+ if (o.ignore) {
1407
+ const d = { ...s, ignore: null, onMatch: null, onResult: null };
1408
+ h = D(o.ignore, d, e);
1409
+ }
1410
+ const g = (d, A = !1) => {
1411
+ const { isMatch: E, match: x, output: y } = D.test(d, i, s, { glob: t, posix: n }), C = { glob: t, state: l, regex: i, posix: n, input: d, output: y, match: x, isMatch: E };
1412
+ return typeof o.onResult == "function" && o.onResult(C), E === !1 ? (C.isMatch = !1, A ? C : !1) : h(d) ? (typeof o.onIgnore == "function" && o.onIgnore(C), C.isMatch = !1, A ? C : !1) : (typeof o.onMatch == "function" && o.onMatch(C), A ? C : !0);
1413
+ };
1414
+ return e && (g.state = l), g;
1415
+ };
1416
+ D.test = (t, s, e, { glob: r, posix: o } = {}) => {
1417
+ if (typeof t != "string")
1418
+ throw new TypeError("Expected input to be a string");
1419
+ if (t === "")
1420
+ return { isMatch: !1, output: "" };
1421
+ const n = e || {}, i = n.format || (o ? se.toPosixSlashes : null);
1422
+ let l = t === r, h = l && i ? i(t) : t;
1423
+ return l === !1 && (h = i ? i(t) : t, l = h === r), (l === !1 || n.capture === !0) && (n.matchBase === !0 || n.basename === !0 ? l = D.matchBase(t, s, e, o) : l = s.exec(h)), { isMatch: !!l, match: l, output: h };
1424
+ };
1425
+ D.matchBase = (t, s, e, r = e && e.windows) => (s instanceof RegExp ? s : D.makeRe(s, e)).test(se.basename(t, { windows: r }));
1426
+ D.isMatch = (t, s, e) => D(s, e)(t);
1427
+ D.parse = (t, s) => Array.isArray(t) ? t.map((e) => D.parse(e, s)) : xt(t, { ...s, fastpaths: !1 });
1428
+ D.scan = (t, s) => en(t, s);
1429
+ D.compileRe = (t, s, e = !1, r = !1) => {
1430
+ if (e === !0)
1431
+ return t.output;
1432
+ const o = s || {}, n = o.contains ? "" : "^", i = o.contains ? "" : "$";
1433
+ let l = `${n}(?:${t.output})${i}`;
1434
+ t && t.negated === !0 && (l = `^(?!${l}).*$`);
1435
+ const h = D.toRegex(l, s);
1436
+ return r === !0 && (h.state = t), h;
1437
+ };
1438
+ D.makeRe = (t, s = {}, e = !1, r = !1) => {
1439
+ if (!t || typeof t != "string")
1440
+ throw new TypeError("Expected a non-empty string");
1441
+ let o = { negated: !1, fastpaths: !0 };
1442
+ return s.fastpaths !== !1 && (t[0] === "." || t[0] === "*") && (o.output = xt.fastpaths(t, s)), o.output || (o = xt(t, s)), D.compileRe(o, s, e, r);
1443
+ };
1444
+ D.toRegex = (t, s) => {
1445
+ try {
1446
+ const e = s || {};
1447
+ return new RegExp(t, e.flags || (e.nocase ? "i" : ""));
1448
+ } catch (e) {
1449
+ if (s && s.debug === !0) throw e;
1450
+ return /$^/;
1451
+ }
1452
+ };
1453
+ D.constants = sn;
1454
+ var rn = D;
1455
+ const ne = rn, on = ct;
1456
+ function re(t, s, e = !1) {
1457
+ return s && (s.windows === null || s.windows === void 0) && (s = { ...s, windows: on.isWindows() }), ne(t, s, e);
1458
+ }
1459
+ Object.assign(re, ne);
1460
+ var un = re;
1461
+ const at = /* @__PURE__ */ bs(un), an = Array.isArray, oe = /\\/g, cn = /^[A-Za-z]:$/, Ot = process.platform === "win32", ln = /^(\/?\.\.)+$/;
1462
+ function fn(t, s = {}) {
1463
+ const e = t.length, r = Array(e), o = Array(e);
1464
+ let n, i;
1465
+ for (n = 0; n < e; n++) {
1466
+ const l = ie(t[n]);
1467
+ r[n] = l;
1468
+ const h = l.length, g = Array(h);
1469
+ for (i = 0; i < h; i++) g[i] = at(l[i], s);
1470
+ o[n] = g;
1471
+ }
1472
+ return (l) => {
1473
+ const h = l.split("/");
1474
+ if (h[0] === ".." && ln.test(l)) return !0;
1475
+ for (n = 0; n < e; n++) {
1476
+ const g = r[n], d = o[n], A = h.length, E = Math.min(A, g.length);
1477
+ for (i = 0; i < E; ) {
1478
+ const x = g[i];
1479
+ if (x.includes("/")) return !0;
1480
+ if (!d[i](h[i])) break;
1481
+ if (!s.noglobstar && x === "**") return !0;
1482
+ i++;
1483
+ }
1484
+ if (i === A) return !0;
1485
+ }
1486
+ return !1;
1487
+ };
1488
+ }
1489
+ const pn = /^[A-Z]:\/$/i, hn = Ot ? (t) => pn.test(t) : (t) => t === "/";
1490
+ function Bt(t, s, e) {
1491
+ if (t === s || s.startsWith(`${t}/`)) {
1492
+ if (e) {
1493
+ const o = t.length + +!hn(t);
1494
+ return (n, i) => n.slice(o, i ? -1 : void 0) || ".";
1495
+ }
1496
+ const r = s.slice(t.length + 1);
1497
+ return r ? (o, n) => {
1498
+ if (o === ".") return r;
1499
+ const i = `${r}/${o}`;
1500
+ return n ? i.slice(0, -1) : i;
1501
+ } : (o, n) => n && o !== "." ? o.slice(0, -1) : o;
1502
+ }
1503
+ return e ? (r) => tt.relative(t, r) || "." : (r) => tt.relative(t, `${s}/${r}`) || ".";
1504
+ }
1505
+ function gn(t, s) {
1506
+ if (s.startsWith(`${t}/`)) {
1507
+ const e = s.slice(t.length + 1);
1508
+ return (r) => `${e}/${r}`;
1509
+ }
1510
+ return (e) => {
1511
+ const r = tt.relative(t, `${s}/${e}`);
1512
+ return e[e.length - 1] === "/" && r !== "" ? `${r}/` : r || ".";
1513
+ };
1514
+ }
1515
+ function Ft(t) {
1516
+ return t.replace(cn, (s) => `${s}/`);
1517
+ }
1518
+ const dn = { parts: !0 };
1519
+ function ie(t) {
1520
+ var s;
1521
+ const e = at.scan(t, dn);
1522
+ return !((s = e.parts) === null || s === void 0) && s.length ? e.parts : [t];
1523
+ }
1524
+ const yn = /\\(?![()[\]{}!+@])/g;
1525
+ function An(t) {
1526
+ return ue(t);
1527
+ }
1528
+ function Rn(t) {
1529
+ return ae(t).replace(yn, "/");
1530
+ }
1531
+ const kn = Ot ? Rn : An, _n = new RegExp("(?<!\\\\)([()[\\]{}*?|]|^!|[!+@](?=\\()|\\\\(?![()[\\]{}!*+?@|]))", "g"), En = new RegExp("(?<!\\\\)([()[\\]{}]|^!|[!+@](?=\\())", "g"), ue = (t) => t.replace(_n, "\\$&"), ae = (t) => t.replace(En, "\\$&"), Sn = Ot ? ae : ue;
1532
+ function bn(t, s) {
1533
+ if ((s == null ? void 0 : s.caseSensitiveMatch) === !1) return !0;
1534
+ const e = at.scan(t);
1535
+ return e.isGlob || e.negated;
1536
+ }
1537
+ function it(...t) {
1538
+ console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...t);
1539
+ }
1540
+ function ce(t) {
1541
+ return typeof t == "string" ? [t] : t ?? [];
1542
+ }
1543
+ const mn = /^(\/?\.\.)+/, xn = /\\(?=[()[\]{}!*+?@|])/g;
1544
+ function St(t, s, e, r) {
1545
+ var o;
1546
+ const n = s.cwd;
1547
+ let i = t;
1548
+ t[t.length - 1] === "/" && (i = t.slice(0, -1)), i[i.length - 1] !== "*" && s.expandDirectories && (i += "/**");
1549
+ const l = Sn(n);
1550
+ i = Ce(i.replace(xn, "")) ? tt.relative(l, i) : tt.normalize(i);
1551
+ const h = (o = mn.exec(i)) === null || o === void 0 ? void 0 : o[0], g = ie(i);
1552
+ if (h) {
1553
+ const A = (h.length + 1) / 3;
1554
+ let E = 0;
1555
+ const x = l.split("/");
1556
+ for (; E < A && g[E + A] === x[x.length + E - A]; )
1557
+ i = i.slice(0, (A - E - 1) * 3) + i.slice((A - E) * 3 + g[E + A].length + 1) || ".", E++;
1558
+ const y = tt.join(n, h.slice(E * 3));
1559
+ y[0] !== "." && e.root.length > y.length && (e.root = Ft(y), e.depthOffset = -A + E);
1560
+ }
1561
+ if (!r && e.depthOffset >= 0) {
1562
+ var d;
1563
+ (d = e.commonPath) !== null && d !== void 0 || (e.commonPath = g);
1564
+ const A = [], E = Math.min(e.commonPath.length, g.length);
1565
+ for (let x = 0; x < E; x++) {
1566
+ const y = g[x];
1567
+ if (y === "**" && !g[x + 1]) {
1568
+ A.pop();
1569
+ break;
1570
+ }
1571
+ if (x === g.length - 1 || y !== e.commonPath[x] || bn(y)) break;
1572
+ A.push(y);
1573
+ }
1574
+ e.depthOffset = A.length, e.commonPath = A, e.root = Ft(A.length > 0 ? tt.join(n, ...A) : n);
1575
+ }
1576
+ return i;
1577
+ }
1578
+ function Cn(t, s, e) {
1579
+ const r = [], o = [];
1580
+ for (const n of t.ignore)
1581
+ n && (n[0] !== "!" || n[1] === "(") && o.push(St(n, t, e, !0));
1582
+ for (const n of s)
1583
+ n && (n[0] !== "!" || n[1] === "(" ? r.push(St(n, t, e, !1)) : (n[1] !== "!" || n[2] === "(") && o.push(St(n.slice(1), t, e, !0)));
1584
+ return {
1585
+ match: r,
1586
+ ignore: o
1587
+ };
1588
+ }
1589
+ function $n(t, s) {
1590
+ const e = t.cwd, r = {
1591
+ root: e,
1592
+ depthOffset: 0
1593
+ }, o = Cn(t, s, r);
1594
+ t.debug && it("internal processing patterns:", o);
1595
+ const { absolute: n, caseSensitiveMatch: i, debug: l, dot: h, followSymbolicLinks: g, onlyDirectories: d } = t, A = r.root.replace(oe, ""), E = {
1596
+ dot: h,
1597
+ nobrace: t.braceExpansion === !1,
1598
+ nocase: !i,
1599
+ noextglob: t.extglob === !1,
1600
+ noglobstar: t.globstar === !1,
1601
+ posix: !0
1602
+ }, x = at(o.match, E), y = at(o.ignore, E), C = fn(o.match, E), T = Bt(e, A, n), W = n ? T : Bt(e, A, !0), _ = (k, O) => {
1603
+ const v = W(O, !0);
1604
+ return v !== "." && !C(v) || y(v);
1605
+ };
1606
+ let M;
1607
+ t.deep !== void 0 && (M = Math.round(t.deep - r.depthOffset));
1608
+ const j = new Ss({
1609
+ filters: [l ? (k, O) => {
1610
+ const v = T(k, O), R = x(v) && !y(v);
1611
+ return R && it(`matched ${v}`), R;
1612
+ } : (k, O) => {
1613
+ const v = T(k, O);
1614
+ return x(v) && !y(v);
1615
+ }],
1616
+ exclude: l ? (k, O) => {
1617
+ const v = _(k, O);
1618
+ return it(`${v ? "skipped" : "crawling"} ${O}`), v;
1619
+ } : _,
1620
+ fs: t.fs,
1621
+ pathSeparator: "/",
1622
+ relativePaths: !n,
1623
+ resolvePaths: n,
1624
+ includeBasePath: n,
1625
+ resolveSymlinks: g,
1626
+ excludeSymlinks: !g,
1627
+ excludeFiles: d,
1628
+ includeDirs: d || !t.onlyFiles,
1629
+ maxDepth: M,
1630
+ signal: t.signal
1631
+ }).crawl(A);
1632
+ return t.debug && it("internal properties:", {
1633
+ ...r,
1634
+ root: A
1635
+ }), [j, e !== A && !n && gn(e, A)];
1636
+ }
1637
+ function le(t, s) {
1638
+ if (s) for (let e = t.length - 1; e >= 0; e--) t[e] = s(t[e]);
1639
+ return t;
1640
+ }
1641
+ const Mt = {
1642
+ caseSensitiveMatch: !0,
1643
+ debug: !!process.env.TINYGLOBBY_DEBUG,
1644
+ expandDirectories: !0,
1645
+ followSymbolicLinks: !0,
1646
+ onlyFiles: !0
1647
+ };
1648
+ function vn(t) {
1649
+ const s = Object.assign({}, t);
1650
+ for (const e in Mt) s[e] === void 0 && Object.assign(s, { [e]: Mt[e] });
1651
+ return s.cwd = (s.cwd instanceof URL ? $e(s.cwd) : Wt(s.cwd || process.cwd())).replace(oe, "/"), s.ignore = ce(s.ignore), s.fs && (s.fs = {
1652
+ readdir: s.fs.readdir || Se,
1653
+ readdirSync: s.fs.readdirSync || Ee,
1654
+ realpath: s.fs.realpath || _e,
1655
+ realpathSync: s.fs.realpathSync || Re,
1656
+ stat: s.fs.stat || Ae,
1657
+ statSync: s.fs.statSync || ye
1658
+ }), s.debug && it("globbing with options:", s), s;
1659
+ }
1660
+ function fe(t, s = {}) {
1661
+ var e;
1662
+ if (t && (s != null && s.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
1663
+ const r = an(t) || typeof t == "string", o = ce((e = r ? t : t.patterns) !== null && e !== void 0 ? e : "**/*"), n = vn(r ? s : t);
1664
+ return o.length > 0 ? $n(n, o) : [];
1665
+ }
1666
+ async function Pn(t, s) {
1667
+ const [e, r] = fe(t, s);
1668
+ return e ? le(await e.withPromise(), r) : [];
1669
+ }
1670
+ function Dn(t, s) {
1671
+ const [e, r] = fe(t, s);
1672
+ return e ? le(e.sync(), r) : [];
1673
+ }
1674
+ export {
1675
+ kn as convertPathToPattern,
1676
+ Sn as escapePath,
1677
+ Pn as glob,
1678
+ Dn as globSync,
1679
+ bn as isDynamicPattern
1680
+ };