@usecontextlayer/ctxe 0.2.12 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2399 @@
1
+ import { n as __require, t as __commonJSMin } from "./cli.mjs";
2
+
3
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
4
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ const WIN_SLASH = "\\\\/";
6
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
7
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
8
+ /**
9
+ * Posix glob regex
10
+ */
11
+ const DOT_LITERAL = "\\.";
12
+ const PLUS_LITERAL = "\\+";
13
+ const QMARK_LITERAL = "\\?";
14
+ const SLASH_LITERAL = "\\/";
15
+ const ONE_CHAR = "(?=.)";
16
+ const QMARK = "[^/]";
17
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
18
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
19
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
20
+ const POSIX_CHARS = {
21
+ DOT_LITERAL,
22
+ PLUS_LITERAL,
23
+ QMARK_LITERAL,
24
+ SLASH_LITERAL,
25
+ ONE_CHAR,
26
+ QMARK,
27
+ END_ANCHOR,
28
+ DOTS_SLASH,
29
+ NO_DOT: `(?!${DOT_LITERAL})`,
30
+ NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
31
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
32
+ NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
33
+ QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
34
+ STAR: `${QMARK}*?`,
35
+ START_ANCHOR,
36
+ SEP: "/"
37
+ };
38
+ /**
39
+ * Windows glob regex
40
+ */
41
+ const WINDOWS_CHARS = {
42
+ ...POSIX_CHARS,
43
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
44
+ QMARK: WIN_NO_SLASH,
45
+ STAR: `${WIN_NO_SLASH}*?`,
46
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
47
+ NO_DOT: `(?!${DOT_LITERAL})`,
48
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
49
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
50
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
51
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
52
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
53
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
54
+ SEP: "\\"
55
+ };
56
+ /**
57
+ * POSIX Bracket Regex
58
+ */
59
+ const POSIX_REGEX_SOURCE = {
60
+ __proto__: null,
61
+ alnum: "a-zA-Z0-9",
62
+ alpha: "a-zA-Z",
63
+ ascii: "\\x00-\\x7F",
64
+ blank: " \\t",
65
+ cntrl: "\\x00-\\x1F\\x7F",
66
+ digit: "0-9",
67
+ graph: "\\x21-\\x7E",
68
+ lower: "a-z",
69
+ print: "\\x20-\\x7E ",
70
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
71
+ space: " \\t\\r\\n\\v\\f",
72
+ upper: "A-Z",
73
+ word: "A-Za-z0-9_",
74
+ xdigit: "A-Fa-f0-9"
75
+ };
76
+ module.exports = {
77
+ DEFAULT_MAX_EXTGLOB_RECURSION,
78
+ MAX_LENGTH: 1024 * 64,
79
+ POSIX_REGEX_SOURCE,
80
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
81
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
82
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
83
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
84
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
85
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
86
+ REPLACEMENTS: {
87
+ __proto__: null,
88
+ "***": "*",
89
+ "**/**": "**",
90
+ "**/**/**": "**"
91
+ },
92
+ CHAR_0: 48,
93
+ CHAR_9: 57,
94
+ CHAR_UPPERCASE_A: 65,
95
+ CHAR_LOWERCASE_A: 97,
96
+ CHAR_UPPERCASE_Z: 90,
97
+ CHAR_LOWERCASE_Z: 122,
98
+ CHAR_LEFT_PARENTHESES: 40,
99
+ CHAR_RIGHT_PARENTHESES: 41,
100
+ CHAR_ASTERISK: 42,
101
+ CHAR_AMPERSAND: 38,
102
+ CHAR_AT: 64,
103
+ CHAR_BACKWARD_SLASH: 92,
104
+ CHAR_CARRIAGE_RETURN: 13,
105
+ CHAR_CIRCUMFLEX_ACCENT: 94,
106
+ CHAR_COLON: 58,
107
+ CHAR_COMMA: 44,
108
+ CHAR_DOT: 46,
109
+ CHAR_DOUBLE_QUOTE: 34,
110
+ CHAR_EQUAL: 61,
111
+ CHAR_EXCLAMATION_MARK: 33,
112
+ CHAR_FORM_FEED: 12,
113
+ CHAR_FORWARD_SLASH: 47,
114
+ CHAR_GRAVE_ACCENT: 96,
115
+ CHAR_HASH: 35,
116
+ CHAR_HYPHEN_MINUS: 45,
117
+ CHAR_LEFT_ANGLE_BRACKET: 60,
118
+ CHAR_LEFT_CURLY_BRACE: 123,
119
+ CHAR_LEFT_SQUARE_BRACKET: 91,
120
+ CHAR_LINE_FEED: 10,
121
+ CHAR_NO_BREAK_SPACE: 160,
122
+ CHAR_PERCENT: 37,
123
+ CHAR_PLUS: 43,
124
+ CHAR_QUESTION_MARK: 63,
125
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
126
+ CHAR_RIGHT_CURLY_BRACE: 125,
127
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
128
+ CHAR_SEMICOLON: 59,
129
+ CHAR_SINGLE_QUOTE: 39,
130
+ CHAR_SPACE: 32,
131
+ CHAR_TAB: 9,
132
+ CHAR_UNDERSCORE: 95,
133
+ CHAR_VERTICAL_LINE: 124,
134
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
135
+ /**
136
+ * Create EXTGLOB_CHARS
137
+ */
138
+ extglobChars(chars) {
139
+ return {
140
+ "!": {
141
+ type: "negate",
142
+ open: "(?:(?!(?:",
143
+ close: `))${chars.STAR})`
144
+ },
145
+ "?": {
146
+ type: "qmark",
147
+ open: "(?:",
148
+ close: ")?"
149
+ },
150
+ "+": {
151
+ type: "plus",
152
+ open: "(?:",
153
+ close: ")+"
154
+ },
155
+ "*": {
156
+ type: "star",
157
+ open: "(?:",
158
+ close: ")*"
159
+ },
160
+ "@": {
161
+ type: "at",
162
+ open: "(?:",
163
+ close: ")"
164
+ }
165
+ };
166
+ },
167
+ /**
168
+ * Create GLOB_CHARS
169
+ */
170
+ globChars(win32) {
171
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
172
+ }
173
+ };
174
+ }));
175
+
176
+ //#endregion
177
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
178
+ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
179
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
180
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
181
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
182
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
183
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
184
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
185
+ exports.isWindows = () => {
186
+ if (typeof navigator !== "undefined" && navigator.platform) {
187
+ const platform = navigator.platform.toLowerCase();
188
+ return platform === "win32" || platform === "windows";
189
+ }
190
+ if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
191
+ return false;
192
+ };
193
+ exports.removeBackslashes = (str) => {
194
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
195
+ return match === "\\" ? "" : match;
196
+ });
197
+ };
198
+ exports.escapeLast = (input, char, lastIdx) => {
199
+ const idx = input.lastIndexOf(char, lastIdx);
200
+ if (idx === -1) return input;
201
+ if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
202
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
203
+ };
204
+ exports.removePrefix = (input, state = {}) => {
205
+ let output = input;
206
+ if (output.startsWith("./")) {
207
+ output = output.slice(2);
208
+ state.prefix = "./";
209
+ }
210
+ return output;
211
+ };
212
+ exports.wrapOutput = (input, state = {}, options = {}) => {
213
+ let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
214
+ if (state.negated === true) output = `(?:^(?!${output}).*$)`;
215
+ return output;
216
+ };
217
+ exports.basename = (path, { windows } = {}) => {
218
+ const segs = path.split(windows ? /[\\/]/ : "/");
219
+ const last = segs[segs.length - 1];
220
+ if (last === "") return segs[segs.length - 2];
221
+ return last;
222
+ };
223
+ }));
224
+
225
+ //#endregion
226
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
227
+ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
228
+ const utils = require_utils();
229
+ const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
230
+ const isPathSeparator = (code) => {
231
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
232
+ };
233
+ const depth = (token) => {
234
+ if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
235
+ };
236
+ /**
237
+ * Quickly scans a glob pattern and returns an object with a handful of
238
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
239
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
240
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
241
+ *
242
+ * ```js
243
+ * const pm = require('picomatch');
244
+ * console.log(pm.scan('foo/bar/*.js'));
245
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
246
+ * ```
247
+ * @param {String} `str`
248
+ * @param {Object} `options`
249
+ * @return {Object} Returns an object with tokens and regex source string.
250
+ * @api public
251
+ */
252
+ const scan = (input, options) => {
253
+ const opts = options || {};
254
+ const length = input.length - 1;
255
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
256
+ const slashes = [];
257
+ const tokens = [];
258
+ const parts = [];
259
+ let str = input;
260
+ let index = -1;
261
+ let start = 0;
262
+ let lastIndex = 0;
263
+ let isBrace = false;
264
+ let isBracket = false;
265
+ let isGlob = false;
266
+ let isExtglob = false;
267
+ let isGlobstar = false;
268
+ let braceEscaped = false;
269
+ let backslashes = false;
270
+ let negated = false;
271
+ let negatedExtglob = false;
272
+ let finished = false;
273
+ let braces = 0;
274
+ let prev;
275
+ let code;
276
+ let token = {
277
+ value: "",
278
+ depth: 0,
279
+ isGlob: false
280
+ };
281
+ const eos = () => index >= length;
282
+ const peek = () => str.charCodeAt(index + 1);
283
+ const advance = () => {
284
+ prev = code;
285
+ return str.charCodeAt(++index);
286
+ };
287
+ while (index < length) {
288
+ code = advance();
289
+ let next;
290
+ if (code === CHAR_BACKWARD_SLASH) {
291
+ backslashes = token.backslashes = true;
292
+ code = advance();
293
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
294
+ continue;
295
+ }
296
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
297
+ braces++;
298
+ while (eos() !== true && (code = advance())) {
299
+ if (code === CHAR_BACKWARD_SLASH) {
300
+ backslashes = token.backslashes = true;
301
+ advance();
302
+ continue;
303
+ }
304
+ if (code === CHAR_LEFT_CURLY_BRACE) {
305
+ braces++;
306
+ continue;
307
+ }
308
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
309
+ isBrace = token.isBrace = true;
310
+ isGlob = token.isGlob = true;
311
+ finished = true;
312
+ if (scanToEnd === true) continue;
313
+ break;
314
+ }
315
+ if (braceEscaped !== true && code === CHAR_COMMA) {
316
+ isBrace = token.isBrace = true;
317
+ isGlob = token.isGlob = true;
318
+ finished = true;
319
+ if (scanToEnd === true) continue;
320
+ break;
321
+ }
322
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
323
+ braces--;
324
+ if (braces === 0) {
325
+ braceEscaped = false;
326
+ isBrace = token.isBrace = true;
327
+ finished = true;
328
+ break;
329
+ }
330
+ }
331
+ }
332
+ if (scanToEnd === true) continue;
333
+ break;
334
+ }
335
+ if (code === CHAR_FORWARD_SLASH) {
336
+ slashes.push(index);
337
+ tokens.push(token);
338
+ token = {
339
+ value: "",
340
+ depth: 0,
341
+ isGlob: false
342
+ };
343
+ if (finished === true) continue;
344
+ if (prev === CHAR_DOT && index === start + 1) {
345
+ start += 2;
346
+ continue;
347
+ }
348
+ lastIndex = index + 1;
349
+ continue;
350
+ }
351
+ if (opts.noext !== true) {
352
+ if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
353
+ isGlob = token.isGlob = true;
354
+ isExtglob = token.isExtglob = true;
355
+ finished = true;
356
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
357
+ if (scanToEnd === true) {
358
+ while (eos() !== true && (code = advance())) {
359
+ if (code === CHAR_BACKWARD_SLASH) {
360
+ backslashes = token.backslashes = true;
361
+ code = advance();
362
+ continue;
363
+ }
364
+ if (code === CHAR_RIGHT_PARENTHESES) {
365
+ isGlob = token.isGlob = true;
366
+ finished = true;
367
+ break;
368
+ }
369
+ }
370
+ continue;
371
+ }
372
+ break;
373
+ }
374
+ }
375
+ if (code === CHAR_ASTERISK) {
376
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
377
+ isGlob = token.isGlob = true;
378
+ finished = true;
379
+ if (scanToEnd === true) continue;
380
+ break;
381
+ }
382
+ if (code === CHAR_QUESTION_MARK) {
383
+ isGlob = token.isGlob = true;
384
+ finished = true;
385
+ if (scanToEnd === true) continue;
386
+ break;
387
+ }
388
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
389
+ while (eos() !== true && (next = advance())) {
390
+ if (next === CHAR_BACKWARD_SLASH) {
391
+ backslashes = token.backslashes = true;
392
+ advance();
393
+ continue;
394
+ }
395
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
396
+ isBracket = token.isBracket = true;
397
+ isGlob = token.isGlob = true;
398
+ finished = true;
399
+ break;
400
+ }
401
+ }
402
+ if (scanToEnd === true) continue;
403
+ break;
404
+ }
405
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
406
+ negated = token.negated = true;
407
+ start++;
408
+ continue;
409
+ }
410
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
411
+ isGlob = token.isGlob = true;
412
+ if (scanToEnd === true) {
413
+ while (eos() !== true && (code = advance())) {
414
+ if (code === CHAR_LEFT_PARENTHESES) {
415
+ backslashes = token.backslashes = true;
416
+ code = advance();
417
+ continue;
418
+ }
419
+ if (code === CHAR_RIGHT_PARENTHESES) {
420
+ finished = true;
421
+ break;
422
+ }
423
+ }
424
+ continue;
425
+ }
426
+ break;
427
+ }
428
+ if (isGlob === true) {
429
+ finished = true;
430
+ if (scanToEnd === true) continue;
431
+ break;
432
+ }
433
+ }
434
+ if (opts.noext === true) {
435
+ isExtglob = false;
436
+ isGlob = false;
437
+ }
438
+ let base = str;
439
+ let prefix = "";
440
+ let glob = "";
441
+ if (start > 0) {
442
+ prefix = str.slice(0, start);
443
+ str = str.slice(start);
444
+ lastIndex -= start;
445
+ }
446
+ if (base && isGlob === true && lastIndex > 0) {
447
+ base = str.slice(0, lastIndex);
448
+ glob = str.slice(lastIndex);
449
+ } else if (isGlob === true) {
450
+ base = "";
451
+ glob = str;
452
+ } else base = str;
453
+ if (base && base !== "" && base !== "/" && base !== str) {
454
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
455
+ }
456
+ if (opts.unescape === true) {
457
+ if (glob) glob = utils.removeBackslashes(glob);
458
+ if (base && backslashes === true) base = utils.removeBackslashes(base);
459
+ }
460
+ const state = {
461
+ prefix,
462
+ input,
463
+ start,
464
+ base,
465
+ glob,
466
+ isBrace,
467
+ isBracket,
468
+ isGlob,
469
+ isExtglob,
470
+ isGlobstar,
471
+ negated,
472
+ negatedExtglob
473
+ };
474
+ if (opts.tokens === true) {
475
+ state.maxDepth = 0;
476
+ if (!isPathSeparator(code)) tokens.push(token);
477
+ state.tokens = tokens;
478
+ }
479
+ if (opts.parts === true || opts.tokens === true) {
480
+ let prevIndex;
481
+ for (let idx = 0; idx < slashes.length; idx++) {
482
+ const n = prevIndex ? prevIndex + 1 : start;
483
+ const i = slashes[idx];
484
+ const value = input.slice(n, i);
485
+ if (opts.tokens) {
486
+ if (idx === 0 && start !== 0) {
487
+ tokens[idx].isPrefix = true;
488
+ tokens[idx].value = prefix;
489
+ } else tokens[idx].value = value;
490
+ depth(tokens[idx]);
491
+ state.maxDepth += tokens[idx].depth;
492
+ }
493
+ if (idx !== 0 || value !== "") parts.push(value);
494
+ prevIndex = i;
495
+ }
496
+ if (prevIndex && prevIndex + 1 < input.length) {
497
+ const value = input.slice(prevIndex + 1);
498
+ parts.push(value);
499
+ if (opts.tokens) {
500
+ tokens[tokens.length - 1].value = value;
501
+ depth(tokens[tokens.length - 1]);
502
+ state.maxDepth += tokens[tokens.length - 1].depth;
503
+ }
504
+ }
505
+ state.slashes = slashes;
506
+ state.parts = parts;
507
+ }
508
+ return state;
509
+ };
510
+ module.exports = scan;
511
+ }));
512
+
513
+ //#endregion
514
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
515
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
516
+ const constants = require_constants();
517
+ const utils = require_utils();
518
+ /**
519
+ * Constants
520
+ */
521
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
522
+ /**
523
+ * Helpers
524
+ */
525
+ const expandRange = (args, options) => {
526
+ if (typeof options.expandRange === "function") return options.expandRange(...args, options);
527
+ args.sort();
528
+ const value = `[${args.join("-")}]`;
529
+ try {
530
+ new RegExp(value);
531
+ } catch (ex) {
532
+ return args.map((v) => utils.escapeRegex(v)).join("..");
533
+ }
534
+ return value;
535
+ };
536
+ /**
537
+ * Create the message for a syntax error
538
+ */
539
+ const syntaxError = (type, char) => {
540
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
541
+ };
542
+ const splitTopLevel = (input) => {
543
+ const parts = [];
544
+ let bracket = 0;
545
+ let paren = 0;
546
+ let quote = 0;
547
+ let value = "";
548
+ let escaped = false;
549
+ for (const ch of input) {
550
+ if (escaped === true) {
551
+ value += ch;
552
+ escaped = false;
553
+ continue;
554
+ }
555
+ if (ch === "\\") {
556
+ value += ch;
557
+ escaped = true;
558
+ continue;
559
+ }
560
+ if (ch === "\"") {
561
+ quote = quote === 1 ? 0 : 1;
562
+ value += ch;
563
+ continue;
564
+ }
565
+ if (quote === 0) {
566
+ if (ch === "[") bracket++;
567
+ else if (ch === "]" && bracket > 0) bracket--;
568
+ else if (bracket === 0) {
569
+ if (ch === "(") paren++;
570
+ else if (ch === ")" && paren > 0) paren--;
571
+ else if (ch === "|" && paren === 0) {
572
+ parts.push(value);
573
+ value = "";
574
+ continue;
575
+ }
576
+ }
577
+ }
578
+ value += ch;
579
+ }
580
+ parts.push(value);
581
+ return parts;
582
+ };
583
+ const isPlainBranch = (branch) => {
584
+ let escaped = false;
585
+ for (const ch of branch) {
586
+ if (escaped === true) {
587
+ escaped = false;
588
+ continue;
589
+ }
590
+ if (ch === "\\") {
591
+ escaped = true;
592
+ continue;
593
+ }
594
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
595
+ }
596
+ return true;
597
+ };
598
+ const normalizeSimpleBranch = (branch) => {
599
+ let value = branch.trim();
600
+ let changed = true;
601
+ while (changed === true) {
602
+ changed = false;
603
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
604
+ value = value.slice(2, -1);
605
+ changed = true;
606
+ }
607
+ }
608
+ if (!isPlainBranch(value)) return;
609
+ return value.replace(/\\(.)/g, "$1");
610
+ };
611
+ const hasRepeatedCharPrefixOverlap = (branches) => {
612
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
613
+ for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
614
+ const a = values[i];
615
+ const b = values[j];
616
+ const char = a[0];
617
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
618
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
619
+ }
620
+ return false;
621
+ };
622
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
623
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
624
+ let bracket = 0;
625
+ let paren = 0;
626
+ let quote = 0;
627
+ let escaped = false;
628
+ for (let i = 1; i < pattern.length; i++) {
629
+ const ch = pattern[i];
630
+ if (escaped === true) {
631
+ escaped = false;
632
+ continue;
633
+ }
634
+ if (ch === "\\") {
635
+ escaped = true;
636
+ continue;
637
+ }
638
+ if (ch === "\"") {
639
+ quote = quote === 1 ? 0 : 1;
640
+ continue;
641
+ }
642
+ if (quote === 1) continue;
643
+ if (ch === "[") {
644
+ bracket++;
645
+ continue;
646
+ }
647
+ if (ch === "]" && bracket > 0) {
648
+ bracket--;
649
+ continue;
650
+ }
651
+ if (bracket > 0) continue;
652
+ if (ch === "(") {
653
+ paren++;
654
+ continue;
655
+ }
656
+ if (ch === ")") {
657
+ paren--;
658
+ if (paren === 0) {
659
+ if (requireEnd === true && i !== pattern.length - 1) return;
660
+ return {
661
+ type: pattern[0],
662
+ body: pattern.slice(2, i),
663
+ end: i
664
+ };
665
+ }
666
+ }
667
+ }
668
+ };
669
+ const getStarExtglobSequenceOutput = (pattern) => {
670
+ let index = 0;
671
+ const chars = [];
672
+ while (index < pattern.length) {
673
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
674
+ if (!match || match.type !== "*") return;
675
+ const branches = splitTopLevel(match.body).map((branch) => branch.trim());
676
+ if (branches.length !== 1) return;
677
+ const branch = normalizeSimpleBranch(branches[0]);
678
+ if (!branch || branch.length !== 1) return;
679
+ chars.push(branch);
680
+ index += match.end + 1;
681
+ }
682
+ if (chars.length < 1) return;
683
+ return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
684
+ };
685
+ const repeatedExtglobRecursion = (pattern) => {
686
+ let depth = 0;
687
+ let value = pattern.trim();
688
+ let match = parseRepeatedExtglob(value);
689
+ while (match) {
690
+ depth++;
691
+ value = match.body.trim();
692
+ match = parseRepeatedExtglob(value);
693
+ }
694
+ return depth;
695
+ };
696
+ const analyzeRepeatedExtglob = (body, options) => {
697
+ if (options.maxExtglobRecursion === false) return { risky: false };
698
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
699
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
700
+ if (branches.length > 1) {
701
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
702
+ }
703
+ for (const branch of branches) {
704
+ const safeOutput = getStarExtglobSequenceOutput(branch);
705
+ if (safeOutput) return {
706
+ risky: true,
707
+ safeOutput
708
+ };
709
+ if (repeatedExtglobRecursion(branch) > max) return { risky: true };
710
+ }
711
+ return { risky: false };
712
+ };
713
+ /**
714
+ * Parse the given input string.
715
+ * @param {String} input
716
+ * @param {Object} options
717
+ * @return {Object}
718
+ */
719
+ const parse = (input, options) => {
720
+ if (typeof input !== "string") throw new TypeError("Expected a string");
721
+ input = REPLACEMENTS[input] || input;
722
+ const opts = { ...options };
723
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
724
+ let len = input.length;
725
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
726
+ const bos = {
727
+ type: "bos",
728
+ value: "",
729
+ output: opts.prepend || ""
730
+ };
731
+ const tokens = [bos];
732
+ const capture = opts.capture ? "" : "?:";
733
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
734
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
735
+ const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
736
+ const globstar = (opts) => {
737
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
738
+ };
739
+ const nodot = opts.dot ? "" : NO_DOT;
740
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
741
+ let star = opts.bash === true ? globstar(opts) : STAR;
742
+ if (opts.capture) star = `(${star})`;
743
+ if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
744
+ const state = {
745
+ input,
746
+ index: -1,
747
+ start: 0,
748
+ dot: opts.dot === true,
749
+ consumed: "",
750
+ output: "",
751
+ prefix: "",
752
+ backtrack: false,
753
+ negated: false,
754
+ brackets: 0,
755
+ braces: 0,
756
+ parens: 0,
757
+ quotes: 0,
758
+ globstar: false,
759
+ tokens
760
+ };
761
+ input = utils.removePrefix(input, state);
762
+ len = input.length;
763
+ const extglobs = [];
764
+ const braces = [];
765
+ const stack = [];
766
+ let prev = bos;
767
+ let value;
768
+ /**
769
+ * Tokenizing helpers
770
+ */
771
+ const eos = () => state.index === len - 1;
772
+ const peek = state.peek = (n = 1) => input[state.index + n];
773
+ const advance = state.advance = () => input[++state.index] || "";
774
+ const remaining = () => input.slice(state.index + 1);
775
+ const consume = (value = "", num = 0) => {
776
+ state.consumed += value;
777
+ state.index += num;
778
+ };
779
+ const append = (token) => {
780
+ state.output += token.output != null ? token.output : token.value;
781
+ consume(token.value);
782
+ };
783
+ const negate = () => {
784
+ let count = 1;
785
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
786
+ advance();
787
+ state.start++;
788
+ count++;
789
+ }
790
+ if (count % 2 === 0) return false;
791
+ state.negated = true;
792
+ state.start++;
793
+ return true;
794
+ };
795
+ const increment = (type) => {
796
+ state[type]++;
797
+ stack.push(type);
798
+ };
799
+ const decrement = (type) => {
800
+ state[type]--;
801
+ stack.pop();
802
+ };
803
+ /**
804
+ * Push tokens onto the tokens array. This helper speeds up
805
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
806
+ * and 2) helping us avoid creating extra tokens when consecutive
807
+ * characters are plain text. This improves performance and simplifies
808
+ * lookbehinds.
809
+ */
810
+ const push = (tok) => {
811
+ if (prev.type === "globstar") {
812
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
813
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
814
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
815
+ state.output = state.output.slice(0, -prev.output.length);
816
+ prev.type = "star";
817
+ prev.value = "*";
818
+ prev.output = star;
819
+ state.output += prev.output;
820
+ }
821
+ }
822
+ if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
823
+ if (tok.value || tok.output) append(tok);
824
+ if (prev && prev.type === "text" && tok.type === "text") {
825
+ prev.output = (prev.output || prev.value) + tok.value;
826
+ prev.value += tok.value;
827
+ return;
828
+ }
829
+ tok.prev = prev;
830
+ tokens.push(tok);
831
+ prev = tok;
832
+ };
833
+ const extglobOpen = (type, value) => {
834
+ const token = {
835
+ ...EXTGLOB_CHARS[value],
836
+ conditions: 1,
837
+ inner: ""
838
+ };
839
+ token.prev = prev;
840
+ token.parens = state.parens;
841
+ token.output = state.output;
842
+ token.startIndex = state.index;
843
+ token.tokensIndex = tokens.length;
844
+ const output = (opts.capture ? "(" : "") + token.open;
845
+ increment("parens");
846
+ push({
847
+ type,
848
+ value,
849
+ output: state.output ? "" : ONE_CHAR
850
+ });
851
+ push({
852
+ type: "paren",
853
+ extglob: true,
854
+ value: advance(),
855
+ output
856
+ });
857
+ extglobs.push(token);
858
+ };
859
+ const extglobClose = (token) => {
860
+ const literal = input.slice(token.startIndex, state.index + 1);
861
+ const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
862
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
863
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
864
+ const open = tokens[token.tokensIndex];
865
+ open.type = "text";
866
+ open.value = literal;
867
+ open.output = safeOutput || utils.escapeRegex(literal);
868
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
869
+ tokens[i].value = "";
870
+ tokens[i].output = "";
871
+ delete tokens[i].suffix;
872
+ }
873
+ state.output = token.output + open.output;
874
+ state.backtrack = true;
875
+ push({
876
+ type: "paren",
877
+ extglob: true,
878
+ value,
879
+ output: ""
880
+ });
881
+ decrement("parens");
882
+ return;
883
+ }
884
+ let output = token.close + (opts.capture ? ")" : "");
885
+ let rest;
886
+ if (token.type === "negate") {
887
+ let extglobStar = star;
888
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
889
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
890
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse(rest, {
891
+ ...options,
892
+ fastpaths: false
893
+ }).output})${extglobStar})`;
894
+ if (token.prev.type === "bos") state.negatedExtglob = true;
895
+ }
896
+ push({
897
+ type: "paren",
898
+ extglob: true,
899
+ value,
900
+ output
901
+ });
902
+ decrement("parens");
903
+ };
904
+ /**
905
+ * Fast paths
906
+ */
907
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
908
+ let backslashes = false;
909
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
910
+ if (first === "\\") {
911
+ backslashes = true;
912
+ return m;
913
+ }
914
+ if (first === "?") {
915
+ if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : "");
916
+ if (index === 0) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
917
+ return QMARK.repeat(chars.length);
918
+ }
919
+ if (first === ".") return DOT_LITERAL.repeat(chars.length);
920
+ if (first === "*") {
921
+ if (esc) return esc + first + (rest ? star : "");
922
+ return star;
923
+ }
924
+ return esc ? m : `\\${m}`;
925
+ });
926
+ if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
927
+ else output = output.replace(/\\+/g, (m) => {
928
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
929
+ });
930
+ if (output === input && opts.contains === true) {
931
+ state.output = input;
932
+ return state;
933
+ }
934
+ state.output = utils.wrapOutput(output, state, options);
935
+ return state;
936
+ }
937
+ /**
938
+ * Tokenize input until we reach end-of-string
939
+ */
940
+ while (!eos()) {
941
+ value = advance();
942
+ if (value === "\0") continue;
943
+ /**
944
+ * Escaped characters
945
+ */
946
+ if (value === "\\") {
947
+ const next = peek();
948
+ if (next === "/" && opts.bash !== true) continue;
949
+ if (next === "." || next === ";") continue;
950
+ if (!next) {
951
+ value += "\\";
952
+ push({
953
+ type: "text",
954
+ value
955
+ });
956
+ continue;
957
+ }
958
+ const match = /^\\+/.exec(remaining());
959
+ let slashes = 0;
960
+ if (match && match[0].length > 2) {
961
+ slashes = match[0].length;
962
+ state.index += slashes;
963
+ if (slashes % 2 !== 0) value += "\\";
964
+ }
965
+ if (opts.unescape === true) value = advance();
966
+ else value += advance();
967
+ if (state.brackets === 0) {
968
+ push({
969
+ type: "text",
970
+ value
971
+ });
972
+ continue;
973
+ }
974
+ }
975
+ /**
976
+ * If we're inside a regex character class, continue
977
+ * until we reach the closing bracket.
978
+ */
979
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
980
+ if (opts.posix !== false && value === ":") {
981
+ const inner = prev.value.slice(1);
982
+ if (inner.includes("[")) {
983
+ prev.posix = true;
984
+ if (inner.includes(":")) {
985
+ const idx = prev.value.lastIndexOf("[");
986
+ const pre = prev.value.slice(0, idx);
987
+ const posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
988
+ if (posix) {
989
+ prev.value = pre + posix;
990
+ state.backtrack = true;
991
+ advance();
992
+ if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR;
993
+ continue;
994
+ }
995
+ }
996
+ }
997
+ }
998
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
999
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
1000
+ if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
1001
+ prev.value += value;
1002
+ append({ value });
1003
+ continue;
1004
+ }
1005
+ /**
1006
+ * If we're inside a quoted string, continue
1007
+ * until we reach the closing double quote.
1008
+ */
1009
+ if (state.quotes === 1 && value !== "\"") {
1010
+ value = utils.escapeRegex(value);
1011
+ prev.value += value;
1012
+ append({ value });
1013
+ continue;
1014
+ }
1015
+ /**
1016
+ * Double quotes
1017
+ */
1018
+ if (value === "\"") {
1019
+ state.quotes = state.quotes === 1 ? 0 : 1;
1020
+ if (opts.keepQuotes === true) push({
1021
+ type: "text",
1022
+ value
1023
+ });
1024
+ continue;
1025
+ }
1026
+ /**
1027
+ * Parentheses
1028
+ */
1029
+ if (value === "(") {
1030
+ increment("parens");
1031
+ push({
1032
+ type: "paren",
1033
+ value
1034
+ });
1035
+ continue;
1036
+ }
1037
+ if (value === ")") {
1038
+ if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
1039
+ const extglob = extglobs[extglobs.length - 1];
1040
+ if (extglob && state.parens === extglob.parens + 1) {
1041
+ extglobClose(extglobs.pop());
1042
+ continue;
1043
+ }
1044
+ push({
1045
+ type: "paren",
1046
+ value,
1047
+ output: state.parens ? ")" : "\\)"
1048
+ });
1049
+ decrement("parens");
1050
+ continue;
1051
+ }
1052
+ /**
1053
+ * Square brackets
1054
+ */
1055
+ if (value === "[") {
1056
+ if (opts.nobracket === true || !remaining().includes("]")) {
1057
+ if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1058
+ value = `\\${value}`;
1059
+ } else increment("brackets");
1060
+ push({
1061
+ type: "bracket",
1062
+ value
1063
+ });
1064
+ continue;
1065
+ }
1066
+ if (value === "]") {
1067
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
1068
+ push({
1069
+ type: "text",
1070
+ value,
1071
+ output: `\\${value}`
1072
+ });
1073
+ continue;
1074
+ }
1075
+ if (state.brackets === 0) {
1076
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
1077
+ push({
1078
+ type: "text",
1079
+ value,
1080
+ output: `\\${value}`
1081
+ });
1082
+ continue;
1083
+ }
1084
+ decrement("brackets");
1085
+ const prevValue = prev.value.slice(1);
1086
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
1087
+ prev.value += value;
1088
+ append({ value });
1089
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) continue;
1090
+ const escaped = utils.escapeRegex(prev.value);
1091
+ state.output = state.output.slice(0, -prev.value.length);
1092
+ if (opts.literalBrackets === true) {
1093
+ state.output += escaped;
1094
+ prev.value = escaped;
1095
+ continue;
1096
+ }
1097
+ prev.value = `(${capture}${escaped}|${prev.value})`;
1098
+ state.output += prev.value;
1099
+ continue;
1100
+ }
1101
+ /**
1102
+ * Braces
1103
+ */
1104
+ if (value === "{" && opts.nobrace !== true) {
1105
+ increment("braces");
1106
+ const open = {
1107
+ type: "brace",
1108
+ value,
1109
+ output: "(",
1110
+ outputIndex: state.output.length,
1111
+ tokensIndex: state.tokens.length
1112
+ };
1113
+ braces.push(open);
1114
+ push(open);
1115
+ continue;
1116
+ }
1117
+ if (value === "}") {
1118
+ const brace = braces[braces.length - 1];
1119
+ if (opts.nobrace === true || !brace) {
1120
+ push({
1121
+ type: "text",
1122
+ value,
1123
+ output: value
1124
+ });
1125
+ continue;
1126
+ }
1127
+ let output = ")";
1128
+ if (brace.dots === true) {
1129
+ const arr = tokens.slice();
1130
+ const range = [];
1131
+ for (let i = arr.length - 1; i >= 0; i--) {
1132
+ tokens.pop();
1133
+ if (arr[i].type === "brace") break;
1134
+ if (arr[i].type !== "dots") range.unshift(arr[i].value);
1135
+ }
1136
+ output = expandRange(range, opts);
1137
+ state.backtrack = true;
1138
+ }
1139
+ if (brace.comma !== true && brace.dots !== true) {
1140
+ const out = state.output.slice(0, brace.outputIndex);
1141
+ const toks = state.tokens.slice(brace.tokensIndex);
1142
+ brace.value = brace.output = "\\{";
1143
+ value = output = "\\}";
1144
+ state.output = out;
1145
+ for (const t of toks) state.output += t.output || t.value;
1146
+ }
1147
+ push({
1148
+ type: "brace",
1149
+ value,
1150
+ output
1151
+ });
1152
+ decrement("braces");
1153
+ braces.pop();
1154
+ continue;
1155
+ }
1156
+ /**
1157
+ * Pipes
1158
+ */
1159
+ if (value === "|") {
1160
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
1161
+ push({
1162
+ type: "text",
1163
+ value
1164
+ });
1165
+ continue;
1166
+ }
1167
+ /**
1168
+ * Commas
1169
+ */
1170
+ if (value === ",") {
1171
+ let output = value;
1172
+ const brace = braces[braces.length - 1];
1173
+ if (brace && stack[stack.length - 1] === "braces") {
1174
+ brace.comma = true;
1175
+ output = "|";
1176
+ }
1177
+ push({
1178
+ type: "comma",
1179
+ value,
1180
+ output
1181
+ });
1182
+ continue;
1183
+ }
1184
+ /**
1185
+ * Slashes
1186
+ */
1187
+ if (value === "/") {
1188
+ if (prev.type === "dot" && state.index === state.start + 1) {
1189
+ state.start = state.index + 1;
1190
+ state.consumed = "";
1191
+ state.output = "";
1192
+ tokens.pop();
1193
+ prev = bos;
1194
+ continue;
1195
+ }
1196
+ push({
1197
+ type: "slash",
1198
+ value,
1199
+ output: SLASH_LITERAL
1200
+ });
1201
+ continue;
1202
+ }
1203
+ /**
1204
+ * Dots
1205
+ */
1206
+ if (value === ".") {
1207
+ if (state.braces > 0 && prev.type === "dot") {
1208
+ if (prev.value === ".") prev.output = DOT_LITERAL;
1209
+ const brace = braces[braces.length - 1];
1210
+ prev.type = "dots";
1211
+ prev.output += value;
1212
+ prev.value += value;
1213
+ brace.dots = true;
1214
+ continue;
1215
+ }
1216
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1217
+ push({
1218
+ type: "text",
1219
+ value,
1220
+ output: DOT_LITERAL
1221
+ });
1222
+ continue;
1223
+ }
1224
+ push({
1225
+ type: "dot",
1226
+ value,
1227
+ output: DOT_LITERAL
1228
+ });
1229
+ continue;
1230
+ }
1231
+ /**
1232
+ * Question marks
1233
+ */
1234
+ if (value === "?") {
1235
+ if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1236
+ extglobOpen("qmark", value);
1237
+ continue;
1238
+ }
1239
+ if (prev && prev.type === "paren") {
1240
+ const next = peek();
1241
+ let output = value;
1242
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
1243
+ push({
1244
+ type: "text",
1245
+ value,
1246
+ output
1247
+ });
1248
+ continue;
1249
+ }
1250
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1251
+ push({
1252
+ type: "qmark",
1253
+ value,
1254
+ output: QMARK_NO_DOT
1255
+ });
1256
+ continue;
1257
+ }
1258
+ push({
1259
+ type: "qmark",
1260
+ value,
1261
+ output: QMARK
1262
+ });
1263
+ continue;
1264
+ }
1265
+ /**
1266
+ * Exclamation
1267
+ */
1268
+ if (value === "!") {
1269
+ if (opts.noextglob !== true && peek() === "(") {
1270
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1271
+ extglobOpen("negate", value);
1272
+ continue;
1273
+ }
1274
+ }
1275
+ if (opts.nonegate !== true && state.index === 0) {
1276
+ negate();
1277
+ continue;
1278
+ }
1279
+ }
1280
+ /**
1281
+ * Plus
1282
+ */
1283
+ if (value === "+") {
1284
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1285
+ extglobOpen("plus", value);
1286
+ continue;
1287
+ }
1288
+ if (prev && prev.value === "(" || opts.regex === false) {
1289
+ push({
1290
+ type: "plus",
1291
+ value,
1292
+ output: PLUS_LITERAL
1293
+ });
1294
+ continue;
1295
+ }
1296
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1297
+ push({
1298
+ type: "plus",
1299
+ value
1300
+ });
1301
+ continue;
1302
+ }
1303
+ push({
1304
+ type: "plus",
1305
+ value: PLUS_LITERAL
1306
+ });
1307
+ continue;
1308
+ }
1309
+ /**
1310
+ * Plain text
1311
+ */
1312
+ if (value === "@") {
1313
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1314
+ push({
1315
+ type: "at",
1316
+ extglob: true,
1317
+ value,
1318
+ output: ""
1319
+ });
1320
+ continue;
1321
+ }
1322
+ push({
1323
+ type: "text",
1324
+ value
1325
+ });
1326
+ continue;
1327
+ }
1328
+ /**
1329
+ * Plain text
1330
+ */
1331
+ if (value !== "*") {
1332
+ if (value === "$" || value === "^") value = `\\${value}`;
1333
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1334
+ if (match) {
1335
+ value += match[0];
1336
+ state.index += match[0].length;
1337
+ }
1338
+ push({
1339
+ type: "text",
1340
+ value
1341
+ });
1342
+ continue;
1343
+ }
1344
+ /**
1345
+ * Stars
1346
+ */
1347
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
1348
+ prev.type = "star";
1349
+ prev.star = true;
1350
+ prev.value += value;
1351
+ prev.output = star;
1352
+ state.backtrack = true;
1353
+ state.globstar = true;
1354
+ consume(value);
1355
+ continue;
1356
+ }
1357
+ let rest = remaining();
1358
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1359
+ extglobOpen("star", value);
1360
+ continue;
1361
+ }
1362
+ if (prev.type === "star") {
1363
+ if (opts.noglobstar === true) {
1364
+ consume(value);
1365
+ continue;
1366
+ }
1367
+ const prior = prev.prev;
1368
+ const before = prior.prev;
1369
+ const isStart = prior.type === "slash" || prior.type === "bos";
1370
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
1371
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1372
+ push({
1373
+ type: "star",
1374
+ value,
1375
+ output: ""
1376
+ });
1377
+ continue;
1378
+ }
1379
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1380
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1381
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1382
+ push({
1383
+ type: "star",
1384
+ value,
1385
+ output: ""
1386
+ });
1387
+ continue;
1388
+ }
1389
+ while (rest.slice(0, 3) === "/**") {
1390
+ const after = input[state.index + 4];
1391
+ if (after && after !== "/") break;
1392
+ rest = rest.slice(3);
1393
+ consume("/**", 3);
1394
+ }
1395
+ if (prior.type === "bos" && eos()) {
1396
+ prev.type = "globstar";
1397
+ prev.value += value;
1398
+ prev.output = globstar(opts);
1399
+ state.output = prev.output;
1400
+ state.globstar = true;
1401
+ consume(value);
1402
+ continue;
1403
+ }
1404
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
1405
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1406
+ prior.output = `(?:${prior.output}`;
1407
+ prev.type = "globstar";
1408
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1409
+ prev.value += value;
1410
+ state.globstar = true;
1411
+ state.output += prior.output + prev.output;
1412
+ consume(value);
1413
+ continue;
1414
+ }
1415
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1416
+ const end = rest[1] !== void 0 ? "|$" : "";
1417
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1418
+ prior.output = `(?:${prior.output}`;
1419
+ prev.type = "globstar";
1420
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1421
+ prev.value += value;
1422
+ state.output += prior.output + prev.output;
1423
+ state.globstar = true;
1424
+ consume(value + advance());
1425
+ push({
1426
+ type: "slash",
1427
+ value: "/",
1428
+ output: ""
1429
+ });
1430
+ continue;
1431
+ }
1432
+ if (prior.type === "bos" && rest[0] === "/") {
1433
+ prev.type = "globstar";
1434
+ prev.value += value;
1435
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1436
+ state.output = prev.output;
1437
+ state.globstar = true;
1438
+ consume(value + advance());
1439
+ push({
1440
+ type: "slash",
1441
+ value: "/",
1442
+ output: ""
1443
+ });
1444
+ continue;
1445
+ }
1446
+ state.output = state.output.slice(0, -prev.output.length);
1447
+ prev.type = "globstar";
1448
+ prev.output = globstar(opts);
1449
+ prev.value += value;
1450
+ state.output += prev.output;
1451
+ state.globstar = true;
1452
+ consume(value);
1453
+ continue;
1454
+ }
1455
+ const token = {
1456
+ type: "star",
1457
+ value,
1458
+ output: star
1459
+ };
1460
+ if (opts.bash === true) {
1461
+ token.output = ".*?";
1462
+ if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
1463
+ push(token);
1464
+ continue;
1465
+ }
1466
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1467
+ token.output = value;
1468
+ push(token);
1469
+ continue;
1470
+ }
1471
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1472
+ if (prev.type === "dot") {
1473
+ state.output += NO_DOT_SLASH;
1474
+ prev.output += NO_DOT_SLASH;
1475
+ } else if (opts.dot === true) {
1476
+ state.output += NO_DOTS_SLASH;
1477
+ prev.output += NO_DOTS_SLASH;
1478
+ } else {
1479
+ state.output += nodot;
1480
+ prev.output += nodot;
1481
+ }
1482
+ if (peek() !== "*") {
1483
+ state.output += ONE_CHAR;
1484
+ prev.output += ONE_CHAR;
1485
+ }
1486
+ }
1487
+ push(token);
1488
+ }
1489
+ while (state.brackets > 0) {
1490
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1491
+ state.output = utils.escapeLast(state.output, "[");
1492
+ decrement("brackets");
1493
+ }
1494
+ while (state.parens > 0) {
1495
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
1496
+ state.output = utils.escapeLast(state.output, "(");
1497
+ decrement("parens");
1498
+ }
1499
+ while (state.braces > 0) {
1500
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
1501
+ state.output = utils.escapeLast(state.output, "{");
1502
+ decrement("braces");
1503
+ }
1504
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
1505
+ type: "maybe_slash",
1506
+ value: "",
1507
+ output: `${SLASH_LITERAL}?`
1508
+ });
1509
+ if (state.backtrack === true) {
1510
+ state.output = "";
1511
+ for (const token of state.tokens) {
1512
+ state.output += token.output != null ? token.output : token.value;
1513
+ if (token.suffix) state.output += token.suffix;
1514
+ }
1515
+ }
1516
+ return state;
1517
+ };
1518
+ /**
1519
+ * Fast paths for creating regular expressions for common glob patterns.
1520
+ * This can significantly speed up processing and has very little downside
1521
+ * impact when none of the fast paths match.
1522
+ */
1523
+ parse.fastpaths = (input, options) => {
1524
+ const opts = { ...options };
1525
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1526
+ const len = input.length;
1527
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1528
+ input = REPLACEMENTS[input] || input;
1529
+ const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
1530
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
1531
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1532
+ const capture = opts.capture ? "" : "?:";
1533
+ const state = {
1534
+ negated: false,
1535
+ prefix: ""
1536
+ };
1537
+ let star = opts.bash === true ? ".*?" : STAR;
1538
+ if (opts.capture) star = `(${star})`;
1539
+ const globstar = (opts) => {
1540
+ if (opts.noglobstar === true) return star;
1541
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1542
+ };
1543
+ const create = (str) => {
1544
+ switch (str) {
1545
+ case "*": return `${nodot}${ONE_CHAR}${star}`;
1546
+ case ".*": return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1547
+ case "*.*": return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1548
+ case "*/*": return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1549
+ case "**": return nodot + globstar(opts);
1550
+ case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1551
+ case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1552
+ case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1553
+ default: {
1554
+ const match = /^(.*?)\.(\w+)$/.exec(str);
1555
+ if (!match) return;
1556
+ const source = create(match[1]);
1557
+ if (!source) return;
1558
+ return source + DOT_LITERAL + match[2];
1559
+ }
1560
+ }
1561
+ };
1562
+ let source = create(utils.removePrefix(input, state));
1563
+ if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL}?`;
1564
+ return source;
1565
+ };
1566
+ module.exports = parse;
1567
+ }));
1568
+
1569
+ //#endregion
1570
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
1571
+ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1572
+ const scan = require_scan();
1573
+ const parse = require_parse();
1574
+ const utils = require_utils();
1575
+ const constants = require_constants();
1576
+ const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
1577
+ /**
1578
+ * Creates a matcher function from one or more glob patterns. The
1579
+ * returned function takes a string to match as its first argument,
1580
+ * and returns true if the string is a match. The returned matcher
1581
+ * function also takes a boolean as the second argument that, when true,
1582
+ * returns an object with additional information.
1583
+ *
1584
+ * ```js
1585
+ * const picomatch = require('picomatch');
1586
+ * // picomatch(glob[, options]);
1587
+ *
1588
+ * const isMatch = picomatch('*.!(*a)');
1589
+ * console.log(isMatch('a.a')); //=> false
1590
+ * console.log(isMatch('a.b')); //=> true
1591
+ * ```
1592
+ * @name picomatch
1593
+ * @param {String|Array} `globs` One or more glob patterns.
1594
+ * @param {Object=} `options`
1595
+ * @return {Function=} Returns a matcher function.
1596
+ * @api public
1597
+ */
1598
+ const picomatch = (glob, options, returnState = false) => {
1599
+ if (Array.isArray(glob)) {
1600
+ const fns = glob.map((input) => picomatch(input, options, returnState));
1601
+ const arrayMatcher = (str) => {
1602
+ for (const isMatch of fns) {
1603
+ const state = isMatch(str);
1604
+ if (state) return state;
1605
+ }
1606
+ return false;
1607
+ };
1608
+ return arrayMatcher;
1609
+ }
1610
+ const isState = isObject(glob) && glob.tokens && glob.input;
1611
+ if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
1612
+ const opts = options || {};
1613
+ const posix = opts.windows;
1614
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
1615
+ const state = regex.state;
1616
+ delete regex.state;
1617
+ let isIgnored = () => false;
1618
+ if (opts.ignore) {
1619
+ const ignoreOpts = {
1620
+ ...options,
1621
+ ignore: null,
1622
+ onMatch: null,
1623
+ onResult: null
1624
+ };
1625
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1626
+ }
1627
+ const matcher = (input, returnObject = false) => {
1628
+ const { isMatch, match, output } = picomatch.test(input, regex, options, {
1629
+ glob,
1630
+ posix
1631
+ });
1632
+ const result = {
1633
+ glob,
1634
+ state,
1635
+ regex,
1636
+ posix,
1637
+ input,
1638
+ output,
1639
+ match,
1640
+ isMatch
1641
+ };
1642
+ if (typeof opts.onResult === "function") opts.onResult(result);
1643
+ if (isMatch === false) {
1644
+ result.isMatch = false;
1645
+ return returnObject ? result : false;
1646
+ }
1647
+ if (isIgnored(input)) {
1648
+ if (typeof opts.onIgnore === "function") opts.onIgnore(result);
1649
+ result.isMatch = false;
1650
+ return returnObject ? result : false;
1651
+ }
1652
+ if (typeof opts.onMatch === "function") opts.onMatch(result);
1653
+ return returnObject ? result : true;
1654
+ };
1655
+ if (returnState) matcher.state = state;
1656
+ return matcher;
1657
+ };
1658
+ /**
1659
+ * Test `input` with the given `regex`. This is used by the main
1660
+ * `picomatch()` function to test the input string.
1661
+ *
1662
+ * ```js
1663
+ * const picomatch = require('picomatch');
1664
+ * // picomatch.test(input, regex[, options]);
1665
+ *
1666
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
1667
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
1668
+ * ```
1669
+ * @param {String} `input` String to test.
1670
+ * @param {RegExp} `regex`
1671
+ * @return {Object} Returns an object with matching info.
1672
+ * @api public
1673
+ */
1674
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
1675
+ if (typeof input !== "string") throw new TypeError("Expected input to be a string");
1676
+ if (input === "") return {
1677
+ isMatch: false,
1678
+ output: ""
1679
+ };
1680
+ const opts = options || {};
1681
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
1682
+ let match = input === glob;
1683
+ let output = match && format ? format(input) : input;
1684
+ if (match === false) {
1685
+ output = format ? format(input) : input;
1686
+ match = output === glob;
1687
+ }
1688
+ if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
1689
+ else match = regex.exec(output);
1690
+ return {
1691
+ isMatch: Boolean(match),
1692
+ match,
1693
+ output
1694
+ };
1695
+ };
1696
+ /**
1697
+ * Match the basename of a filepath.
1698
+ *
1699
+ * ```js
1700
+ * const picomatch = require('picomatch');
1701
+ * // picomatch.matchBase(input, glob[, options]);
1702
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
1703
+ * ```
1704
+ * @param {String} `input` String to test.
1705
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
1706
+ * @return {Boolean}
1707
+ * @api public
1708
+ */
1709
+ picomatch.matchBase = (input, glob, options) => {
1710
+ return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input));
1711
+ };
1712
+ /**
1713
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
1714
+ *
1715
+ * ```js
1716
+ * const picomatch = require('picomatch');
1717
+ * // picomatch.isMatch(string, patterns[, options]);
1718
+ *
1719
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
1720
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
1721
+ * ```
1722
+ * @param {String|Array} str The string to test.
1723
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
1724
+ * @param {Object} [options] See available [options](#options).
1725
+ * @return {Boolean} Returns true if any patterns match `str`
1726
+ * @api public
1727
+ */
1728
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
1729
+ /**
1730
+ * Parse a glob pattern to create the source string for a regular
1731
+ * expression.
1732
+ *
1733
+ * ```js
1734
+ * const picomatch = require('picomatch');
1735
+ * const result = picomatch.parse(pattern[, options]);
1736
+ * ```
1737
+ * @param {String} `pattern`
1738
+ * @param {Object} `options`
1739
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
1740
+ * @api public
1741
+ */
1742
+ picomatch.parse = (pattern, options) => {
1743
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
1744
+ return parse(pattern, {
1745
+ ...options,
1746
+ fastpaths: false
1747
+ });
1748
+ };
1749
+ /**
1750
+ * Scan a glob pattern to separate the pattern into segments.
1751
+ *
1752
+ * ```js
1753
+ * const picomatch = require('picomatch');
1754
+ * // picomatch.scan(input[, options]);
1755
+ *
1756
+ * const result = picomatch.scan('!./foo/*.js');
1757
+ * console.log(result);
1758
+ * { prefix: '!./',
1759
+ * input: '!./foo/*.js',
1760
+ * start: 3,
1761
+ * base: 'foo',
1762
+ * glob: '*.js',
1763
+ * isBrace: false,
1764
+ * isBracket: false,
1765
+ * isGlob: true,
1766
+ * isExtglob: false,
1767
+ * isGlobstar: false,
1768
+ * negated: true }
1769
+ * ```
1770
+ * @param {String} `input` Glob pattern to scan.
1771
+ * @param {Object} `options`
1772
+ * @return {Object} Returns an object with
1773
+ * @api public
1774
+ */
1775
+ picomatch.scan = (input, options) => scan(input, options);
1776
+ /**
1777
+ * Compile a regular expression from the `state` object returned by the
1778
+ * [parse()](#parse) method.
1779
+ *
1780
+ * ```js
1781
+ * const picomatch = require('picomatch');
1782
+ * const state = picomatch.parse('*.js');
1783
+ * // picomatch.compileRe(state[, options]);
1784
+ *
1785
+ * console.log(picomatch.compileRe(state));
1786
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
1787
+ * ```
1788
+ * @param {Object} `state`
1789
+ * @param {Object} `options`
1790
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
1791
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
1792
+ * @return {RegExp}
1793
+ * @api public
1794
+ */
1795
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
1796
+ if (returnOutput === true) return state.output;
1797
+ const opts = options || {};
1798
+ const prepend = opts.contains ? "" : "^";
1799
+ const append = opts.contains ? "" : "$";
1800
+ let source = `${prepend}(?:${state.output})${append}`;
1801
+ if (state && state.negated === true) source = `^(?!${source}).*$`;
1802
+ const regex = picomatch.toRegex(source, options);
1803
+ if (returnState === true) regex.state = state;
1804
+ return regex;
1805
+ };
1806
+ /**
1807
+ * Create a regular expression from a parsed glob pattern.
1808
+ *
1809
+ * ```js
1810
+ * const picomatch = require('picomatch');
1811
+ * // picomatch.makeRe(state[, options]);
1812
+ *
1813
+ * const result = picomatch.makeRe('*.js');
1814
+ * console.log(result);
1815
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
1816
+ * ```
1817
+ * @param {String} `state` The object returned from the `.parse` method.
1818
+ * @param {Object} `options`
1819
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
1820
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
1821
+ * @return {RegExp} Returns a regex created from the given pattern.
1822
+ * @api public
1823
+ */
1824
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1825
+ if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
1826
+ let parsed = {
1827
+ negated: false,
1828
+ fastpaths: true
1829
+ };
1830
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
1831
+ if (!parsed.output) parsed = parse(input, options);
1832
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
1833
+ };
1834
+ /**
1835
+ * Create a regular expression from the given regex source string.
1836
+ *
1837
+ * ```js
1838
+ * const picomatch = require('picomatch');
1839
+ * // picomatch.toRegex(source[, options]);
1840
+ *
1841
+ * const { output } = picomatch.parse('*.js');
1842
+ * console.log(picomatch.toRegex(output));
1843
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
1844
+ * ```
1845
+ * @param {String} `source` Regular expression source string.
1846
+ * @param {Object} `options`
1847
+ * @return {RegExp}
1848
+ * @api public
1849
+ */
1850
+ picomatch.toRegex = (source, options) => {
1851
+ try {
1852
+ const opts = options || {};
1853
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1854
+ } catch (err) {
1855
+ if (options && options.debug === true) throw err;
1856
+ return /$^/;
1857
+ }
1858
+ };
1859
+ /**
1860
+ * Picomatch constants.
1861
+ * @return {Object}
1862
+ */
1863
+ picomatch.constants = constants;
1864
+ /**
1865
+ * Expose "picomatch"
1866
+ */
1867
+ module.exports = picomatch;
1868
+ }));
1869
+
1870
+ //#endregion
1871
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
1872
+ var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1873
+ const pico = require_picomatch$1();
1874
+ const utils = require_utils();
1875
+ function picomatch(glob, options, returnState = false) {
1876
+ if (options && (options.windows === null || options.windows === void 0)) options = {
1877
+ ...options,
1878
+ windows: utils.isWindows()
1879
+ };
1880
+ return pico(glob, options, returnState);
1881
+ }
1882
+ Object.assign(picomatch, pico);
1883
+ module.exports = picomatch;
1884
+ }));
1885
+
1886
+ //#endregion
1887
+ //#region ../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js
1888
+ var require_is_extglob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1889
+ /*!
1890
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
1891
+ *
1892
+ * Copyright (c) 2014-2016, Jon Schlinkert.
1893
+ * Licensed under the MIT License.
1894
+ */
1895
+ module.exports = function isExtglob(str) {
1896
+ if (typeof str !== "string" || str === "") return false;
1897
+ var match;
1898
+ while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
1899
+ if (match[2]) return true;
1900
+ str = str.slice(match.index + match[0].length);
1901
+ }
1902
+ return false;
1903
+ };
1904
+ }));
1905
+
1906
+ //#endregion
1907
+ //#region ../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js
1908
+ var require_is_glob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1909
+ /*!
1910
+ * is-glob <https://github.com/jonschlinkert/is-glob>
1911
+ *
1912
+ * Copyright (c) 2014-2017, Jon Schlinkert.
1913
+ * Released under the MIT License.
1914
+ */
1915
+ var isExtglob = require_is_extglob();
1916
+ var chars = {
1917
+ "{": "}",
1918
+ "(": ")",
1919
+ "[": "]"
1920
+ };
1921
+ var strictCheck = function(str) {
1922
+ if (str[0] === "!") return true;
1923
+ var index = 0;
1924
+ var pipeIndex = -2;
1925
+ var closeSquareIndex = -2;
1926
+ var closeCurlyIndex = -2;
1927
+ var closeParenIndex = -2;
1928
+ var backSlashIndex = -2;
1929
+ while (index < str.length) {
1930
+ if (str[index] === "*") return true;
1931
+ if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) return true;
1932
+ if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") {
1933
+ if (closeSquareIndex < index) closeSquareIndex = str.indexOf("]", index);
1934
+ if (closeSquareIndex > index) {
1935
+ if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) return true;
1936
+ backSlashIndex = str.indexOf("\\", index);
1937
+ if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) return true;
1938
+ }
1939
+ }
1940
+ if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") {
1941
+ closeCurlyIndex = str.indexOf("}", index);
1942
+ if (closeCurlyIndex > index) {
1943
+ backSlashIndex = str.indexOf("\\", index);
1944
+ if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) return true;
1945
+ }
1946
+ }
1947
+ if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") {
1948
+ closeParenIndex = str.indexOf(")", index);
1949
+ if (closeParenIndex > index) {
1950
+ backSlashIndex = str.indexOf("\\", index);
1951
+ if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) return true;
1952
+ }
1953
+ }
1954
+ if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") {
1955
+ if (pipeIndex < index) pipeIndex = str.indexOf("|", index);
1956
+ if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") {
1957
+ closeParenIndex = str.indexOf(")", pipeIndex);
1958
+ if (closeParenIndex > pipeIndex) {
1959
+ backSlashIndex = str.indexOf("\\", pipeIndex);
1960
+ if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) return true;
1961
+ }
1962
+ }
1963
+ }
1964
+ if (str[index] === "\\") {
1965
+ var open = str[index + 1];
1966
+ index += 2;
1967
+ var close = chars[open];
1968
+ if (close) {
1969
+ var n = str.indexOf(close, index);
1970
+ if (n !== -1) index = n + 1;
1971
+ }
1972
+ if (str[index] === "!") return true;
1973
+ } else index++;
1974
+ }
1975
+ return false;
1976
+ };
1977
+ var relaxedCheck = function(str) {
1978
+ if (str[0] === "!") return true;
1979
+ var index = 0;
1980
+ while (index < str.length) {
1981
+ if (/[*?{}()[\]]/.test(str[index])) return true;
1982
+ if (str[index] === "\\") {
1983
+ var open = str[index + 1];
1984
+ index += 2;
1985
+ var close = chars[open];
1986
+ if (close) {
1987
+ var n = str.indexOf(close, index);
1988
+ if (n !== -1) index = n + 1;
1989
+ }
1990
+ if (str[index] === "!") return true;
1991
+ } else index++;
1992
+ }
1993
+ return false;
1994
+ };
1995
+ module.exports = function isGlob(str, options) {
1996
+ if (typeof str !== "string" || str === "") return false;
1997
+ if (isExtglob(str)) return true;
1998
+ var check = strictCheck;
1999
+ if (options && options.strict === false) check = relaxedCheck;
2000
+ return check(str);
2001
+ };
2002
+ }));
2003
+
2004
+ //#endregion
2005
+ //#region ../../node_modules/.pnpm/@parcel+watcher@2.5.6/node_modules/@parcel/watcher/wrapper.js
2006
+ var require_wrapper = /* @__PURE__ */ __commonJSMin(((exports) => {
2007
+ const path = __require("path");
2008
+ const picomatch = require_picomatch();
2009
+ const isGlob = require_is_glob();
2010
+ function normalizeOptions(dir, opts = {}) {
2011
+ const { ignore, ...rest } = opts;
2012
+ if (Array.isArray(ignore)) {
2013
+ opts = { ...rest };
2014
+ for (const value of ignore) if (isGlob(value)) {
2015
+ if (!opts.ignoreGlobs) opts.ignoreGlobs = [];
2016
+ const regex = picomatch.makeRe(value, {
2017
+ dot: true,
2018
+ windows: process.platform === "win32"
2019
+ });
2020
+ opts.ignoreGlobs.push(regex.source);
2021
+ } else {
2022
+ if (!opts.ignorePaths) opts.ignorePaths = [];
2023
+ opts.ignorePaths.push(path.resolve(dir, value));
2024
+ }
2025
+ }
2026
+ return opts;
2027
+ }
2028
+ exports.createWrapper = (binding) => {
2029
+ return {
2030
+ writeSnapshot(dir, snapshot, opts) {
2031
+ return binding.writeSnapshot(path.resolve(dir), path.resolve(snapshot), normalizeOptions(dir, opts));
2032
+ },
2033
+ getEventsSince(dir, snapshot, opts) {
2034
+ return binding.getEventsSince(path.resolve(dir), path.resolve(snapshot), normalizeOptions(dir, opts));
2035
+ },
2036
+ async subscribe(dir, fn, opts) {
2037
+ dir = path.resolve(dir);
2038
+ opts = normalizeOptions(dir, opts);
2039
+ await binding.subscribe(dir, fn, opts);
2040
+ return { unsubscribe() {
2041
+ return binding.unsubscribe(dir, fn, opts);
2042
+ } };
2043
+ },
2044
+ unsubscribe(dir, fn, opts) {
2045
+ return binding.unsubscribe(path.resolve(dir), fn, normalizeOptions(dir, opts));
2046
+ }
2047
+ };
2048
+ };
2049
+ }));
2050
+
2051
+ //#endregion
2052
+ //#region ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js
2053
+ var require_process = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2054
+ const isLinux = () => process.platform === "linux";
2055
+ let report = null;
2056
+ const getReport = () => {
2057
+ if (!report)
2058
+ /* istanbul ignore next */
2059
+ if (isLinux() && process.report) {
2060
+ const orig = process.report.excludeNetwork;
2061
+ process.report.excludeNetwork = true;
2062
+ report = process.report.getReport();
2063
+ process.report.excludeNetwork = orig;
2064
+ } else report = {};
2065
+ return report;
2066
+ };
2067
+ module.exports = {
2068
+ isLinux,
2069
+ getReport
2070
+ };
2071
+ }));
2072
+
2073
+ //#endregion
2074
+ //#region ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js
2075
+ var require_filesystem = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2076
+ const fs = __require("fs");
2077
+ const LDD_PATH = "/usr/bin/ldd";
2078
+ const SELF_PATH = "/proc/self/exe";
2079
+ const MAX_LENGTH = 2048;
2080
+ /**
2081
+ * Read the content of a file synchronous
2082
+ *
2083
+ * @param {string} path
2084
+ * @returns {Buffer}
2085
+ */
2086
+ const readFileSync = (path) => {
2087
+ const fd = fs.openSync(path, "r");
2088
+ const buffer = Buffer.alloc(MAX_LENGTH);
2089
+ const bytesRead = fs.readSync(fd, buffer, 0, MAX_LENGTH, 0);
2090
+ fs.close(fd, () => {});
2091
+ return buffer.subarray(0, bytesRead);
2092
+ };
2093
+ /**
2094
+ * Read the content of a file
2095
+ *
2096
+ * @param {string} path
2097
+ * @returns {Promise<Buffer>}
2098
+ */
2099
+ const readFile = (path) => new Promise((resolve, reject) => {
2100
+ fs.open(path, "r", (err, fd) => {
2101
+ if (err) reject(err);
2102
+ else {
2103
+ const buffer = Buffer.alloc(MAX_LENGTH);
2104
+ fs.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
2105
+ resolve(buffer.subarray(0, bytesRead));
2106
+ fs.close(fd, () => {});
2107
+ });
2108
+ }
2109
+ });
2110
+ });
2111
+ module.exports = {
2112
+ LDD_PATH,
2113
+ SELF_PATH,
2114
+ readFileSync,
2115
+ readFile
2116
+ };
2117
+ }));
2118
+
2119
+ //#endregion
2120
+ //#region ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js
2121
+ var require_elf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2122
+ const interpreterPath = (elf) => {
2123
+ if (elf.length < 64) return null;
2124
+ if (elf.readUInt32BE(0) !== 2135247942) return null;
2125
+ if (elf.readUInt8(4) !== 2) return null;
2126
+ if (elf.readUInt8(5) !== 1) return null;
2127
+ const offset = elf.readUInt32LE(32);
2128
+ const size = elf.readUInt16LE(54);
2129
+ const count = elf.readUInt16LE(56);
2130
+ for (let i = 0; i < count; i++) {
2131
+ const headerOffset = offset + i * size;
2132
+ if (elf.readUInt32LE(headerOffset) === 3) {
2133
+ const fileOffset = elf.readUInt32LE(headerOffset + 8);
2134
+ const fileSize = elf.readUInt32LE(headerOffset + 32);
2135
+ return elf.subarray(fileOffset, fileOffset + fileSize).toString().replace(/\0.*$/g, "");
2136
+ }
2137
+ }
2138
+ return null;
2139
+ };
2140
+ module.exports = { interpreterPath };
2141
+ }));
2142
+
2143
+ //#endregion
2144
+ //#region ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js
2145
+ var require_detect_libc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2146
+ const childProcess = __require("child_process");
2147
+ const { isLinux, getReport } = require_process();
2148
+ const { LDD_PATH, SELF_PATH, readFile, readFileSync } = require_filesystem();
2149
+ const { interpreterPath } = require_elf();
2150
+ let cachedFamilyInterpreter;
2151
+ let cachedFamilyFilesystem;
2152
+ let cachedVersionFilesystem;
2153
+ const command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
2154
+ let commandOut = "";
2155
+ const safeCommand = () => {
2156
+ if (!commandOut) return new Promise((resolve) => {
2157
+ childProcess.exec(command, (err, out) => {
2158
+ commandOut = err ? " " : out;
2159
+ resolve(commandOut);
2160
+ });
2161
+ });
2162
+ return commandOut;
2163
+ };
2164
+ const safeCommandSync = () => {
2165
+ if (!commandOut) try {
2166
+ commandOut = childProcess.execSync(command, { encoding: "utf8" });
2167
+ } catch (_err) {
2168
+ commandOut = " ";
2169
+ }
2170
+ return commandOut;
2171
+ };
2172
+ /**
2173
+ * A String constant containing the value `glibc`.
2174
+ * @type {string}
2175
+ * @public
2176
+ */
2177
+ const GLIBC = "glibc";
2178
+ /**
2179
+ * A Regexp constant to get the GLIBC Version.
2180
+ * @type {string}
2181
+ */
2182
+ const RE_GLIBC_VERSION = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i;
2183
+ /**
2184
+ * A String constant containing the value `musl`.
2185
+ * @type {string}
2186
+ * @public
2187
+ */
2188
+ const MUSL = "musl";
2189
+ const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
2190
+ const familyFromReport = () => {
2191
+ const report = getReport();
2192
+ if (report.header && report.header.glibcVersionRuntime) return GLIBC;
2193
+ if (Array.isArray(report.sharedObjects)) {
2194
+ if (report.sharedObjects.some(isFileMusl)) return MUSL;
2195
+ }
2196
+ return null;
2197
+ };
2198
+ const familyFromCommand = (out) => {
2199
+ const [getconf, ldd1] = out.split(/[\r\n]+/);
2200
+ if (getconf && getconf.includes(GLIBC)) return GLIBC;
2201
+ if (ldd1 && ldd1.includes(MUSL)) return MUSL;
2202
+ return null;
2203
+ };
2204
+ const familyFromInterpreterPath = (path) => {
2205
+ if (path) {
2206
+ if (path.includes("/ld-musl-")) return MUSL;
2207
+ else if (path.includes("/ld-linux-")) return GLIBC;
2208
+ }
2209
+ return null;
2210
+ };
2211
+ const getFamilyFromLddContent = (content) => {
2212
+ content = content.toString();
2213
+ if (content.includes("musl")) return MUSL;
2214
+ if (content.includes("GNU C Library")) return GLIBC;
2215
+ return null;
2216
+ };
2217
+ const familyFromFilesystem = async () => {
2218
+ if (cachedFamilyFilesystem !== void 0) return cachedFamilyFilesystem;
2219
+ cachedFamilyFilesystem = null;
2220
+ try {
2221
+ cachedFamilyFilesystem = getFamilyFromLddContent(await readFile(LDD_PATH));
2222
+ } catch (e) {}
2223
+ return cachedFamilyFilesystem;
2224
+ };
2225
+ const familyFromFilesystemSync = () => {
2226
+ if (cachedFamilyFilesystem !== void 0) return cachedFamilyFilesystem;
2227
+ cachedFamilyFilesystem = null;
2228
+ try {
2229
+ cachedFamilyFilesystem = getFamilyFromLddContent(readFileSync(LDD_PATH));
2230
+ } catch (e) {}
2231
+ return cachedFamilyFilesystem;
2232
+ };
2233
+ const familyFromInterpreter = async () => {
2234
+ if (cachedFamilyInterpreter !== void 0) return cachedFamilyInterpreter;
2235
+ cachedFamilyInterpreter = null;
2236
+ try {
2237
+ cachedFamilyInterpreter = familyFromInterpreterPath(interpreterPath(await readFile(SELF_PATH)));
2238
+ } catch (e) {}
2239
+ return cachedFamilyInterpreter;
2240
+ };
2241
+ const familyFromInterpreterSync = () => {
2242
+ if (cachedFamilyInterpreter !== void 0) return cachedFamilyInterpreter;
2243
+ cachedFamilyInterpreter = null;
2244
+ try {
2245
+ cachedFamilyInterpreter = familyFromInterpreterPath(interpreterPath(readFileSync(SELF_PATH)));
2246
+ } catch (e) {}
2247
+ return cachedFamilyInterpreter;
2248
+ };
2249
+ /**
2250
+ * Resolves with the libc family when it can be determined, `null` otherwise.
2251
+ * @returns {Promise<?string>}
2252
+ */
2253
+ const family = async () => {
2254
+ let family = null;
2255
+ if (isLinux()) {
2256
+ family = await familyFromInterpreter();
2257
+ if (!family) {
2258
+ family = await familyFromFilesystem();
2259
+ if (!family) family = familyFromReport();
2260
+ if (!family) family = familyFromCommand(await safeCommand());
2261
+ }
2262
+ }
2263
+ return family;
2264
+ };
2265
+ /**
2266
+ * Returns the libc family when it can be determined, `null` otherwise.
2267
+ * @returns {?string}
2268
+ */
2269
+ const familySync = () => {
2270
+ let family = null;
2271
+ if (isLinux()) {
2272
+ family = familyFromInterpreterSync();
2273
+ if (!family) {
2274
+ family = familyFromFilesystemSync();
2275
+ if (!family) family = familyFromReport();
2276
+ if (!family) family = familyFromCommand(safeCommandSync());
2277
+ }
2278
+ }
2279
+ return family;
2280
+ };
2281
+ /**
2282
+ * Resolves `true` only when the platform is Linux and the libc family is not `glibc`.
2283
+ * @returns {Promise<boolean>}
2284
+ */
2285
+ const isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
2286
+ /**
2287
+ * Returns `true` only when the platform is Linux and the libc family is not `glibc`.
2288
+ * @returns {boolean}
2289
+ */
2290
+ const isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
2291
+ const versionFromFilesystem = async () => {
2292
+ if (cachedVersionFilesystem !== void 0) return cachedVersionFilesystem;
2293
+ cachedVersionFilesystem = null;
2294
+ try {
2295
+ const versionMatch = (await readFile(LDD_PATH)).match(RE_GLIBC_VERSION);
2296
+ if (versionMatch) cachedVersionFilesystem = versionMatch[1];
2297
+ } catch (e) {}
2298
+ return cachedVersionFilesystem;
2299
+ };
2300
+ const versionFromFilesystemSync = () => {
2301
+ if (cachedVersionFilesystem !== void 0) return cachedVersionFilesystem;
2302
+ cachedVersionFilesystem = null;
2303
+ try {
2304
+ const versionMatch = readFileSync(LDD_PATH).match(RE_GLIBC_VERSION);
2305
+ if (versionMatch) cachedVersionFilesystem = versionMatch[1];
2306
+ } catch (e) {}
2307
+ return cachedVersionFilesystem;
2308
+ };
2309
+ const versionFromReport = () => {
2310
+ const report = getReport();
2311
+ if (report.header && report.header.glibcVersionRuntime) return report.header.glibcVersionRuntime;
2312
+ return null;
2313
+ };
2314
+ const versionSuffix = (s) => s.trim().split(/\s+/)[1];
2315
+ const versionFromCommand = (out) => {
2316
+ const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
2317
+ if (getconf && getconf.includes(GLIBC)) return versionSuffix(getconf);
2318
+ if (ldd1 && ldd2 && ldd1.includes(MUSL)) return versionSuffix(ldd2);
2319
+ return null;
2320
+ };
2321
+ /**
2322
+ * Resolves with the libc version when it can be determined, `null` otherwise.
2323
+ * @returns {Promise<?string>}
2324
+ */
2325
+ const version = async () => {
2326
+ let version = null;
2327
+ if (isLinux()) {
2328
+ version = await versionFromFilesystem();
2329
+ if (!version) version = versionFromReport();
2330
+ if (!version) version = versionFromCommand(await safeCommand());
2331
+ }
2332
+ return version;
2333
+ };
2334
+ /**
2335
+ * Returns the libc version when it can be determined, `null` otherwise.
2336
+ * @returns {?string}
2337
+ */
2338
+ const versionSync = () => {
2339
+ let version = null;
2340
+ if (isLinux()) {
2341
+ version = versionFromFilesystemSync();
2342
+ if (!version) version = versionFromReport();
2343
+ if (!version) version = versionFromCommand(safeCommandSync());
2344
+ }
2345
+ return version;
2346
+ };
2347
+ module.exports = {
2348
+ GLIBC,
2349
+ MUSL,
2350
+ family,
2351
+ familySync,
2352
+ isNonGlibcLinux,
2353
+ isNonGlibcLinuxSync,
2354
+ version,
2355
+ versionSync
2356
+ };
2357
+ }));
2358
+
2359
+ //#endregion
2360
+ //#region ../../node_modules/.pnpm/@parcel+watcher@2.5.6/node_modules/@parcel/watcher/index.js
2361
+ var require_watcher = /* @__PURE__ */ __commonJSMin(((exports) => {
2362
+ const { createWrapper } = require_wrapper();
2363
+ let name = `@parcel/watcher-${process.platform}-${process.arch}`;
2364
+ if (process.platform === "linux") {
2365
+ const { MUSL, familySync } = require_detect_libc();
2366
+ if (familySync() === MUSL) name += "-musl";
2367
+ else name += "-glibc";
2368
+ }
2369
+ let binding;
2370
+ try {
2371
+ binding = __require(name);
2372
+ } catch (err) {
2373
+ handleError(err);
2374
+ try {
2375
+ binding = __require("./build/Release/watcher.node");
2376
+ } catch (err) {
2377
+ handleError(err);
2378
+ try {
2379
+ binding = __require("./build/Debug/watcher.node");
2380
+ } catch (err) {
2381
+ handleError(err);
2382
+ throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`);
2383
+ }
2384
+ }
2385
+ }
2386
+ function handleError(err) {
2387
+ if (err?.code !== "MODULE_NOT_FOUND") throw err;
2388
+ }
2389
+ const wrapper = createWrapper(binding);
2390
+ exports.writeSnapshot = wrapper.writeSnapshot;
2391
+ exports.getEventsSince = wrapper.getEventsSince;
2392
+ exports.subscribe = wrapper.subscribe;
2393
+ exports.unsubscribe = wrapper.unsubscribe;
2394
+ }));
2395
+
2396
+ //#endregion
2397
+ export default require_watcher();
2398
+
2399
+ export { };