@unocss/svelte-scoped 66.6.7 → 66.7.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vite.mjs CHANGED
@@ -1,13 +1,2088 @@
1
- import { t as UnocssSveltePreprocess } from "./preprocess-C0sgyK1A.mjs";
2
- import process from "node:process";
1
+ import { i as transformClasses, n as transformStyle, r as themeRE, t as checkForApply } from "./transformStyle-NRa-cUil.mjs";
2
+ import process$1 from "node:process";
3
3
  import { createRecoveryConfigLoader } from "@unocss/config";
4
- import { createGenerator, cssIdRE } from "@unocss/core";
4
+ import { BetterMap, createGenerator, cssIdRE } from "@unocss/core";
5
5
  import MagicString from "magic-string";
6
6
  import presetUno from "@unocss/preset-uno";
7
+ import { isAbsolute, join, resolve } from "pathe";
7
8
  import remapping from "@jridgewell/remapping";
8
9
  import { existsSync, readFileSync, statSync } from "node:fs";
9
- import { dirname, resolve } from "node:path";
10
+ import { basename, dirname, resolve as resolve$1 } from "node:path";
10
11
  import { fileURLToPath } from "node:url";
12
+ import crypto from "node:crypto";
13
+ //#region \0rolldown/runtime.js
14
+ var __create = Object.create;
15
+ var __defProp = Object.defineProperty;
16
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
17
+ var __getOwnPropNames = Object.getOwnPropertyNames;
18
+ var __getProtoOf = Object.getPrototypeOf;
19
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
20
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
23
+ key = keys[i];
24
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
25
+ get: ((k) => from[k]).bind(null, key),
26
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
27
+ });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
32
+ value: mod,
33
+ enumerable: true
34
+ }) : target, mod));
35
+ //#endregion
36
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
37
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38
+ const WIN_SLASH = "\\\\/";
39
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
40
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
41
+ /**
42
+ * Posix glob regex
43
+ */
44
+ const DOT_LITERAL = "\\.";
45
+ const PLUS_LITERAL = "\\+";
46
+ const QMARK_LITERAL = "\\?";
47
+ const SLASH_LITERAL = "\\/";
48
+ const ONE_CHAR = "(?=.)";
49
+ const QMARK = "[^/]";
50
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
51
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
52
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
53
+ const POSIX_CHARS = {
54
+ DOT_LITERAL,
55
+ PLUS_LITERAL,
56
+ QMARK_LITERAL,
57
+ SLASH_LITERAL,
58
+ ONE_CHAR,
59
+ QMARK,
60
+ END_ANCHOR,
61
+ DOTS_SLASH,
62
+ NO_DOT: `(?!${DOT_LITERAL})`,
63
+ NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
64
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
65
+ NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
66
+ QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
67
+ STAR: `${QMARK}*?`,
68
+ START_ANCHOR,
69
+ SEP: "/"
70
+ };
71
+ /**
72
+ * Windows glob regex
73
+ */
74
+ const WINDOWS_CHARS = {
75
+ ...POSIX_CHARS,
76
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
77
+ QMARK: WIN_NO_SLASH,
78
+ STAR: `${WIN_NO_SLASH}*?`,
79
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
80
+ NO_DOT: `(?!${DOT_LITERAL})`,
81
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
82
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
83
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
84
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
85
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
86
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
87
+ SEP: "\\"
88
+ };
89
+ module.exports = {
90
+ DEFAULT_MAX_EXTGLOB_RECURSION,
91
+ MAX_LENGTH: 1024 * 64,
92
+ POSIX_REGEX_SOURCE: {
93
+ __proto__: null,
94
+ alnum: "a-zA-Z0-9",
95
+ alpha: "a-zA-Z",
96
+ ascii: "\\x00-\\x7F",
97
+ blank: " \\t",
98
+ cntrl: "\\x00-\\x1F\\x7F",
99
+ digit: "0-9",
100
+ graph: "\\x21-\\x7E",
101
+ lower: "a-z",
102
+ print: "\\x20-\\x7E ",
103
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
104
+ space: " \\t\\r\\n\\v\\f",
105
+ upper: "A-Z",
106
+ word: "A-Za-z0-9_",
107
+ xdigit: "A-Fa-f0-9"
108
+ },
109
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
110
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
111
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
112
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
113
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
114
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
115
+ REPLACEMENTS: {
116
+ __proto__: null,
117
+ "***": "*",
118
+ "**/**": "**",
119
+ "**/**/**": "**"
120
+ },
121
+ CHAR_0: 48,
122
+ CHAR_9: 57,
123
+ CHAR_UPPERCASE_A: 65,
124
+ CHAR_LOWERCASE_A: 97,
125
+ CHAR_UPPERCASE_Z: 90,
126
+ CHAR_LOWERCASE_Z: 122,
127
+ CHAR_LEFT_PARENTHESES: 40,
128
+ CHAR_RIGHT_PARENTHESES: 41,
129
+ CHAR_ASTERISK: 42,
130
+ CHAR_AMPERSAND: 38,
131
+ CHAR_AT: 64,
132
+ CHAR_BACKWARD_SLASH: 92,
133
+ CHAR_CARRIAGE_RETURN: 13,
134
+ CHAR_CIRCUMFLEX_ACCENT: 94,
135
+ CHAR_COLON: 58,
136
+ CHAR_COMMA: 44,
137
+ CHAR_DOT: 46,
138
+ CHAR_DOUBLE_QUOTE: 34,
139
+ CHAR_EQUAL: 61,
140
+ CHAR_EXCLAMATION_MARK: 33,
141
+ CHAR_FORM_FEED: 12,
142
+ CHAR_FORWARD_SLASH: 47,
143
+ CHAR_GRAVE_ACCENT: 96,
144
+ CHAR_HASH: 35,
145
+ CHAR_HYPHEN_MINUS: 45,
146
+ CHAR_LEFT_ANGLE_BRACKET: 60,
147
+ CHAR_LEFT_CURLY_BRACE: 123,
148
+ CHAR_LEFT_SQUARE_BRACKET: 91,
149
+ CHAR_LINE_FEED: 10,
150
+ CHAR_NO_BREAK_SPACE: 160,
151
+ CHAR_PERCENT: 37,
152
+ CHAR_PLUS: 43,
153
+ CHAR_QUESTION_MARK: 63,
154
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
155
+ CHAR_RIGHT_CURLY_BRACE: 125,
156
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
157
+ CHAR_SEMICOLON: 59,
158
+ CHAR_SINGLE_QUOTE: 39,
159
+ CHAR_SPACE: 32,
160
+ CHAR_TAB: 9,
161
+ CHAR_UNDERSCORE: 95,
162
+ CHAR_VERTICAL_LINE: 124,
163
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
164
+ /**
165
+ * Create EXTGLOB_CHARS
166
+ */
167
+ extglobChars(chars) {
168
+ return {
169
+ "!": {
170
+ type: "negate",
171
+ open: "(?:(?!(?:",
172
+ close: `))${chars.STAR})`
173
+ },
174
+ "?": {
175
+ type: "qmark",
176
+ open: "(?:",
177
+ close: ")?"
178
+ },
179
+ "+": {
180
+ type: "plus",
181
+ open: "(?:",
182
+ close: ")+"
183
+ },
184
+ "*": {
185
+ type: "star",
186
+ open: "(?:",
187
+ close: ")*"
188
+ },
189
+ "@": {
190
+ type: "at",
191
+ open: "(?:",
192
+ close: ")"
193
+ }
194
+ };
195
+ },
196
+ /**
197
+ * Create GLOB_CHARS
198
+ */
199
+ globChars(win32) {
200
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
201
+ }
202
+ };
203
+ }));
204
+ //#endregion
205
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
206
+ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
207
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
208
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
209
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
210
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
211
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
212
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
213
+ exports.isWindows = () => {
214
+ if (typeof navigator !== "undefined" && navigator.platform) {
215
+ const platform = navigator.platform.toLowerCase();
216
+ return platform === "win32" || platform === "windows";
217
+ }
218
+ if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
219
+ return false;
220
+ };
221
+ exports.removeBackslashes = (str) => {
222
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
223
+ return match === "\\" ? "" : match;
224
+ });
225
+ };
226
+ exports.escapeLast = (input, char, lastIdx) => {
227
+ const idx = input.lastIndexOf(char, lastIdx);
228
+ if (idx === -1) return input;
229
+ if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
230
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
231
+ };
232
+ exports.removePrefix = (input, state = {}) => {
233
+ let output = input;
234
+ if (output.startsWith("./")) {
235
+ output = output.slice(2);
236
+ state.prefix = "./";
237
+ }
238
+ return output;
239
+ };
240
+ exports.wrapOutput = (input, state = {}, options = {}) => {
241
+ let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
242
+ if (state.negated === true) output = `(?:^(?!${output}).*$)`;
243
+ return output;
244
+ };
245
+ exports.basename = (path, { windows } = {}) => {
246
+ const segs = path.split(windows ? /[\\/]/ : "/");
247
+ const last = segs[segs.length - 1];
248
+ if (last === "") return segs[segs.length - 2];
249
+ return last;
250
+ };
251
+ }));
252
+ //#endregion
253
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
254
+ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
255
+ const utils = require_utils();
256
+ 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();
257
+ const isPathSeparator = (code) => {
258
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
259
+ };
260
+ const depth = (token) => {
261
+ if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
262
+ };
263
+ /**
264
+ * Quickly scans a glob pattern and returns an object with a handful of
265
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
266
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
267
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
268
+ *
269
+ * ```js
270
+ * const pm = require('picomatch');
271
+ * console.log(pm.scan('foo/bar/*.js'));
272
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
273
+ * ```
274
+ * @param {String} `str`
275
+ * @param {Object} `options`
276
+ * @return {Object} Returns an object with tokens and regex source string.
277
+ * @api public
278
+ */
279
+ const scan = (input, options) => {
280
+ const opts = options || {};
281
+ const length = input.length - 1;
282
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
283
+ const slashes = [];
284
+ const tokens = [];
285
+ const parts = [];
286
+ let str = input;
287
+ let index = -1;
288
+ let start = 0;
289
+ let lastIndex = 0;
290
+ let isBrace = false;
291
+ let isBracket = false;
292
+ let isGlob = false;
293
+ let isExtglob = false;
294
+ let isGlobstar = false;
295
+ let braceEscaped = false;
296
+ let backslashes = false;
297
+ let negated = false;
298
+ let negatedExtglob = false;
299
+ let finished = false;
300
+ let braces = 0;
301
+ let prev;
302
+ let code;
303
+ let token = {
304
+ value: "",
305
+ depth: 0,
306
+ isGlob: false
307
+ };
308
+ const eos = () => index >= length;
309
+ const peek = () => str.charCodeAt(index + 1);
310
+ const advance = () => {
311
+ prev = code;
312
+ return str.charCodeAt(++index);
313
+ };
314
+ while (index < length) {
315
+ code = advance();
316
+ let next;
317
+ if (code === CHAR_BACKWARD_SLASH) {
318
+ backslashes = token.backslashes = true;
319
+ code = advance();
320
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
321
+ continue;
322
+ }
323
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
324
+ braces++;
325
+ while (eos() !== true && (code = advance())) {
326
+ if (code === CHAR_BACKWARD_SLASH) {
327
+ backslashes = token.backslashes = true;
328
+ advance();
329
+ continue;
330
+ }
331
+ if (code === CHAR_LEFT_CURLY_BRACE) {
332
+ braces++;
333
+ continue;
334
+ }
335
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
336
+ isBrace = token.isBrace = true;
337
+ isGlob = token.isGlob = true;
338
+ finished = true;
339
+ if (scanToEnd === true) continue;
340
+ break;
341
+ }
342
+ if (braceEscaped !== true && code === CHAR_COMMA) {
343
+ isBrace = token.isBrace = true;
344
+ isGlob = token.isGlob = true;
345
+ finished = true;
346
+ if (scanToEnd === true) continue;
347
+ break;
348
+ }
349
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
350
+ braces--;
351
+ if (braces === 0) {
352
+ braceEscaped = false;
353
+ isBrace = token.isBrace = true;
354
+ finished = true;
355
+ break;
356
+ }
357
+ }
358
+ }
359
+ if (scanToEnd === true) continue;
360
+ break;
361
+ }
362
+ if (code === CHAR_FORWARD_SLASH) {
363
+ slashes.push(index);
364
+ tokens.push(token);
365
+ token = {
366
+ value: "",
367
+ depth: 0,
368
+ isGlob: false
369
+ };
370
+ if (finished === true) continue;
371
+ if (prev === CHAR_DOT && index === start + 1) {
372
+ start += 2;
373
+ continue;
374
+ }
375
+ lastIndex = index + 1;
376
+ continue;
377
+ }
378
+ if (opts.noext !== true) {
379
+ if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
380
+ isGlob = token.isGlob = true;
381
+ isExtglob = token.isExtglob = true;
382
+ finished = true;
383
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
384
+ if (scanToEnd === true) {
385
+ while (eos() !== true && (code = advance())) {
386
+ if (code === CHAR_BACKWARD_SLASH) {
387
+ backslashes = token.backslashes = true;
388
+ code = advance();
389
+ continue;
390
+ }
391
+ if (code === CHAR_RIGHT_PARENTHESES) {
392
+ isGlob = token.isGlob = true;
393
+ finished = true;
394
+ break;
395
+ }
396
+ }
397
+ continue;
398
+ }
399
+ break;
400
+ }
401
+ }
402
+ if (code === CHAR_ASTERISK) {
403
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
404
+ isGlob = token.isGlob = true;
405
+ finished = true;
406
+ if (scanToEnd === true) continue;
407
+ break;
408
+ }
409
+ if (code === CHAR_QUESTION_MARK) {
410
+ isGlob = token.isGlob = true;
411
+ finished = true;
412
+ if (scanToEnd === true) continue;
413
+ break;
414
+ }
415
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
416
+ while (eos() !== true && (next = advance())) {
417
+ if (next === CHAR_BACKWARD_SLASH) {
418
+ backslashes = token.backslashes = true;
419
+ advance();
420
+ continue;
421
+ }
422
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
423
+ isBracket = token.isBracket = true;
424
+ isGlob = token.isGlob = true;
425
+ finished = true;
426
+ break;
427
+ }
428
+ }
429
+ if (scanToEnd === true) continue;
430
+ break;
431
+ }
432
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
433
+ negated = token.negated = true;
434
+ start++;
435
+ continue;
436
+ }
437
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
438
+ isGlob = token.isGlob = true;
439
+ if (scanToEnd === true) {
440
+ while (eos() !== true && (code = advance())) {
441
+ if (code === CHAR_LEFT_PARENTHESES) {
442
+ backslashes = token.backslashes = true;
443
+ code = advance();
444
+ continue;
445
+ }
446
+ if (code === CHAR_RIGHT_PARENTHESES) {
447
+ finished = true;
448
+ break;
449
+ }
450
+ }
451
+ continue;
452
+ }
453
+ break;
454
+ }
455
+ if (isGlob === true) {
456
+ finished = true;
457
+ if (scanToEnd === true) continue;
458
+ break;
459
+ }
460
+ }
461
+ if (opts.noext === true) {
462
+ isExtglob = false;
463
+ isGlob = false;
464
+ }
465
+ let base = str;
466
+ let prefix = "";
467
+ let glob = "";
468
+ if (start > 0) {
469
+ prefix = str.slice(0, start);
470
+ str = str.slice(start);
471
+ lastIndex -= start;
472
+ }
473
+ if (base && isGlob === true && lastIndex > 0) {
474
+ base = str.slice(0, lastIndex);
475
+ glob = str.slice(lastIndex);
476
+ } else if (isGlob === true) {
477
+ base = "";
478
+ glob = str;
479
+ } else base = str;
480
+ if (base && base !== "" && base !== "/" && base !== str) {
481
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
482
+ }
483
+ if (opts.unescape === true) {
484
+ if (glob) glob = utils.removeBackslashes(glob);
485
+ if (base && backslashes === true) base = utils.removeBackslashes(base);
486
+ }
487
+ const state = {
488
+ prefix,
489
+ input,
490
+ start,
491
+ base,
492
+ glob,
493
+ isBrace,
494
+ isBracket,
495
+ isGlob,
496
+ isExtglob,
497
+ isGlobstar,
498
+ negated,
499
+ negatedExtglob
500
+ };
501
+ if (opts.tokens === true) {
502
+ state.maxDepth = 0;
503
+ if (!isPathSeparator(code)) tokens.push(token);
504
+ state.tokens = tokens;
505
+ }
506
+ if (opts.parts === true || opts.tokens === true) {
507
+ let prevIndex;
508
+ for (let idx = 0; idx < slashes.length; idx++) {
509
+ const n = prevIndex ? prevIndex + 1 : start;
510
+ const i = slashes[idx];
511
+ const value = input.slice(n, i);
512
+ if (opts.tokens) {
513
+ if (idx === 0 && start !== 0) {
514
+ tokens[idx].isPrefix = true;
515
+ tokens[idx].value = prefix;
516
+ } else tokens[idx].value = value;
517
+ depth(tokens[idx]);
518
+ state.maxDepth += tokens[idx].depth;
519
+ }
520
+ if (idx !== 0 || value !== "") parts.push(value);
521
+ prevIndex = i;
522
+ }
523
+ if (prevIndex && prevIndex + 1 < input.length) {
524
+ const value = input.slice(prevIndex + 1);
525
+ parts.push(value);
526
+ if (opts.tokens) {
527
+ tokens[tokens.length - 1].value = value;
528
+ depth(tokens[tokens.length - 1]);
529
+ state.maxDepth += tokens[tokens.length - 1].depth;
530
+ }
531
+ }
532
+ state.slashes = slashes;
533
+ state.parts = parts;
534
+ }
535
+ return state;
536
+ };
537
+ module.exports = scan;
538
+ }));
539
+ //#endregion
540
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
541
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
542
+ const constants = require_constants();
543
+ const utils = require_utils();
544
+ /**
545
+ * Constants
546
+ */
547
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
548
+ /**
549
+ * Helpers
550
+ */
551
+ const expandRange = (args, options) => {
552
+ if (typeof options.expandRange === "function") return options.expandRange(...args, options);
553
+ args.sort();
554
+ const value = `[${args.join("-")}]`;
555
+ try {
556
+ new RegExp(value);
557
+ } catch (ex) {
558
+ return args.map((v) => utils.escapeRegex(v)).join("..");
559
+ }
560
+ return value;
561
+ };
562
+ /**
563
+ * Create the message for a syntax error
564
+ */
565
+ const syntaxError = (type, char) => {
566
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
567
+ };
568
+ const splitTopLevel = (input) => {
569
+ const parts = [];
570
+ let bracket = 0;
571
+ let paren = 0;
572
+ let quote = 0;
573
+ let value = "";
574
+ let escaped = false;
575
+ for (const ch of input) {
576
+ if (escaped === true) {
577
+ value += ch;
578
+ escaped = false;
579
+ continue;
580
+ }
581
+ if (ch === "\\") {
582
+ value += ch;
583
+ escaped = true;
584
+ continue;
585
+ }
586
+ if (ch === "\"") {
587
+ quote = quote === 1 ? 0 : 1;
588
+ value += ch;
589
+ continue;
590
+ }
591
+ if (quote === 0) {
592
+ if (ch === "[") bracket++;
593
+ else if (ch === "]" && bracket > 0) bracket--;
594
+ else if (bracket === 0) {
595
+ if (ch === "(") paren++;
596
+ else if (ch === ")" && paren > 0) paren--;
597
+ else if (ch === "|" && paren === 0) {
598
+ parts.push(value);
599
+ value = "";
600
+ continue;
601
+ }
602
+ }
603
+ }
604
+ value += ch;
605
+ }
606
+ parts.push(value);
607
+ return parts;
608
+ };
609
+ const isPlainBranch = (branch) => {
610
+ let escaped = false;
611
+ for (const ch of branch) {
612
+ if (escaped === true) {
613
+ escaped = false;
614
+ continue;
615
+ }
616
+ if (ch === "\\") {
617
+ escaped = true;
618
+ continue;
619
+ }
620
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
621
+ }
622
+ return true;
623
+ };
624
+ const normalizeSimpleBranch = (branch) => {
625
+ let value = branch.trim();
626
+ let changed = true;
627
+ while (changed === true) {
628
+ changed = false;
629
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
630
+ value = value.slice(2, -1);
631
+ changed = true;
632
+ }
633
+ }
634
+ if (!isPlainBranch(value)) return;
635
+ return value.replace(/\\(.)/g, "$1");
636
+ };
637
+ const hasRepeatedCharPrefixOverlap = (branches) => {
638
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
639
+ for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
640
+ const a = values[i];
641
+ const b = values[j];
642
+ const char = a[0];
643
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
644
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
645
+ }
646
+ return false;
647
+ };
648
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
649
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
650
+ let bracket = 0;
651
+ let paren = 0;
652
+ let quote = 0;
653
+ let escaped = false;
654
+ for (let i = 1; i < pattern.length; i++) {
655
+ const ch = pattern[i];
656
+ if (escaped === true) {
657
+ escaped = false;
658
+ continue;
659
+ }
660
+ if (ch === "\\") {
661
+ escaped = true;
662
+ continue;
663
+ }
664
+ if (ch === "\"") {
665
+ quote = quote === 1 ? 0 : 1;
666
+ continue;
667
+ }
668
+ if (quote === 1) continue;
669
+ if (ch === "[") {
670
+ bracket++;
671
+ continue;
672
+ }
673
+ if (ch === "]" && bracket > 0) {
674
+ bracket--;
675
+ continue;
676
+ }
677
+ if (bracket > 0) continue;
678
+ if (ch === "(") {
679
+ paren++;
680
+ continue;
681
+ }
682
+ if (ch === ")") {
683
+ paren--;
684
+ if (paren === 0) {
685
+ if (requireEnd === true && i !== pattern.length - 1) return;
686
+ return {
687
+ type: pattern[0],
688
+ body: pattern.slice(2, i),
689
+ end: i
690
+ };
691
+ }
692
+ }
693
+ }
694
+ };
695
+ const getStarExtglobSequenceOutput = (pattern) => {
696
+ let index = 0;
697
+ const chars = [];
698
+ while (index < pattern.length) {
699
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
700
+ if (!match || match.type !== "*") return;
701
+ const branches = splitTopLevel(match.body).map((branch) => branch.trim());
702
+ if (branches.length !== 1) return;
703
+ const branch = normalizeSimpleBranch(branches[0]);
704
+ if (!branch || branch.length !== 1) return;
705
+ chars.push(branch);
706
+ index += match.end + 1;
707
+ }
708
+ if (chars.length < 1) return;
709
+ return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
710
+ };
711
+ const repeatedExtglobRecursion = (pattern) => {
712
+ let depth = 0;
713
+ let value = pattern.trim();
714
+ let match = parseRepeatedExtglob(value);
715
+ while (match) {
716
+ depth++;
717
+ value = match.body.trim();
718
+ match = parseRepeatedExtglob(value);
719
+ }
720
+ return depth;
721
+ };
722
+ const analyzeRepeatedExtglob = (body, options) => {
723
+ if (options.maxExtglobRecursion === false) return { risky: false };
724
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
725
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
726
+ if (branches.length > 1) {
727
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
728
+ }
729
+ for (const branch of branches) {
730
+ const safeOutput = getStarExtglobSequenceOutput(branch);
731
+ if (safeOutput) return {
732
+ risky: true,
733
+ safeOutput
734
+ };
735
+ if (repeatedExtglobRecursion(branch) > max) return { risky: true };
736
+ }
737
+ return { risky: false };
738
+ };
739
+ /**
740
+ * Parse the given input string.
741
+ * @param {String} input
742
+ * @param {Object} options
743
+ * @return {Object}
744
+ */
745
+ const parse = (input, options) => {
746
+ if (typeof input !== "string") throw new TypeError("Expected a string");
747
+ input = REPLACEMENTS[input] || input;
748
+ const opts = { ...options };
749
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
750
+ let len = input.length;
751
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
752
+ const bos = {
753
+ type: "bos",
754
+ value: "",
755
+ output: opts.prepend || ""
756
+ };
757
+ const tokens = [bos];
758
+ const capture = opts.capture ? "" : "?:";
759
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
760
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
761
+ 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;
762
+ const globstar = (opts) => {
763
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
764
+ };
765
+ const nodot = opts.dot ? "" : NO_DOT;
766
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
767
+ let star = opts.bash === true ? globstar(opts) : STAR;
768
+ if (opts.capture) star = `(${star})`;
769
+ if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
770
+ const state = {
771
+ input,
772
+ index: -1,
773
+ start: 0,
774
+ dot: opts.dot === true,
775
+ consumed: "",
776
+ output: "",
777
+ prefix: "",
778
+ backtrack: false,
779
+ negated: false,
780
+ brackets: 0,
781
+ braces: 0,
782
+ parens: 0,
783
+ quotes: 0,
784
+ globstar: false,
785
+ tokens
786
+ };
787
+ input = utils.removePrefix(input, state);
788
+ len = input.length;
789
+ const extglobs = [];
790
+ const braces = [];
791
+ const stack = [];
792
+ let prev = bos;
793
+ let value;
794
+ /**
795
+ * Tokenizing helpers
796
+ */
797
+ const eos = () => state.index === len - 1;
798
+ const peek = state.peek = (n = 1) => input[state.index + n];
799
+ const advance = state.advance = () => input[++state.index] || "";
800
+ const remaining = () => input.slice(state.index + 1);
801
+ const consume = (value = "", num = 0) => {
802
+ state.consumed += value;
803
+ state.index += num;
804
+ };
805
+ const append = (token) => {
806
+ state.output += token.output != null ? token.output : token.value;
807
+ consume(token.value);
808
+ };
809
+ const negate = () => {
810
+ let count = 1;
811
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
812
+ advance();
813
+ state.start++;
814
+ count++;
815
+ }
816
+ if (count % 2 === 0) return false;
817
+ state.negated = true;
818
+ state.start++;
819
+ return true;
820
+ };
821
+ const increment = (type) => {
822
+ state[type]++;
823
+ stack.push(type);
824
+ };
825
+ const decrement = (type) => {
826
+ state[type]--;
827
+ stack.pop();
828
+ };
829
+ /**
830
+ * Push tokens onto the tokens array. This helper speeds up
831
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
832
+ * and 2) helping us avoid creating extra tokens when consecutive
833
+ * characters are plain text. This improves performance and simplifies
834
+ * lookbehinds.
835
+ */
836
+ const push = (tok) => {
837
+ if (prev.type === "globstar") {
838
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
839
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
840
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
841
+ state.output = state.output.slice(0, -prev.output.length);
842
+ prev.type = "star";
843
+ prev.value = "*";
844
+ prev.output = star;
845
+ state.output += prev.output;
846
+ }
847
+ }
848
+ if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
849
+ if (tok.value || tok.output) append(tok);
850
+ if (prev && prev.type === "text" && tok.type === "text") {
851
+ prev.output = (prev.output || prev.value) + tok.value;
852
+ prev.value += tok.value;
853
+ return;
854
+ }
855
+ tok.prev = prev;
856
+ tokens.push(tok);
857
+ prev = tok;
858
+ };
859
+ const extglobOpen = (type, value) => {
860
+ const token = {
861
+ ...EXTGLOB_CHARS[value],
862
+ conditions: 1,
863
+ inner: ""
864
+ };
865
+ token.prev = prev;
866
+ token.parens = state.parens;
867
+ token.output = state.output;
868
+ token.startIndex = state.index;
869
+ token.tokensIndex = tokens.length;
870
+ const output = (opts.capture ? "(" : "") + token.open;
871
+ increment("parens");
872
+ push({
873
+ type,
874
+ value,
875
+ output: state.output ? "" : ONE_CHAR
876
+ });
877
+ push({
878
+ type: "paren",
879
+ extglob: true,
880
+ value: advance(),
881
+ output
882
+ });
883
+ extglobs.push(token);
884
+ };
885
+ const extglobClose = (token) => {
886
+ const literal = input.slice(token.startIndex, state.index + 1);
887
+ const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
888
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
889
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
890
+ const open = tokens[token.tokensIndex];
891
+ open.type = "text";
892
+ open.value = literal;
893
+ open.output = safeOutput || utils.escapeRegex(literal);
894
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
895
+ tokens[i].value = "";
896
+ tokens[i].output = "";
897
+ delete tokens[i].suffix;
898
+ }
899
+ state.output = token.output + open.output;
900
+ state.backtrack = true;
901
+ push({
902
+ type: "paren",
903
+ extglob: true,
904
+ value,
905
+ output: ""
906
+ });
907
+ decrement("parens");
908
+ return;
909
+ }
910
+ let output = token.close + (opts.capture ? ")" : "");
911
+ let rest;
912
+ if (token.type === "negate") {
913
+ let extglobStar = star;
914
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
915
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
916
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse(rest, {
917
+ ...options,
918
+ fastpaths: false
919
+ }).output})${extglobStar})`;
920
+ if (token.prev.type === "bos") state.negatedExtglob = true;
921
+ }
922
+ push({
923
+ type: "paren",
924
+ extglob: true,
925
+ value,
926
+ output
927
+ });
928
+ decrement("parens");
929
+ };
930
+ /**
931
+ * Fast paths
932
+ */
933
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
934
+ let backslashes = false;
935
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
936
+ if (first === "\\") {
937
+ backslashes = true;
938
+ return m;
939
+ }
940
+ if (first === "?") {
941
+ if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : "");
942
+ if (index === 0) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
943
+ return QMARK.repeat(chars.length);
944
+ }
945
+ if (first === ".") return DOT_LITERAL.repeat(chars.length);
946
+ if (first === "*") {
947
+ if (esc) return esc + first + (rest ? star : "");
948
+ return star;
949
+ }
950
+ return esc ? m : `\\${m}`;
951
+ });
952
+ if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
953
+ else output = output.replace(/\\+/g, (m) => {
954
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
955
+ });
956
+ if (output === input && opts.contains === true) {
957
+ state.output = input;
958
+ return state;
959
+ }
960
+ state.output = utils.wrapOutput(output, state, options);
961
+ return state;
962
+ }
963
+ /**
964
+ * Tokenize input until we reach end-of-string
965
+ */
966
+ while (!eos()) {
967
+ value = advance();
968
+ if (value === "\0") continue;
969
+ /**
970
+ * Escaped characters
971
+ */
972
+ if (value === "\\") {
973
+ const next = peek();
974
+ if (next === "/" && opts.bash !== true) continue;
975
+ if (next === "." || next === ";") continue;
976
+ if (!next) {
977
+ value += "\\";
978
+ push({
979
+ type: "text",
980
+ value
981
+ });
982
+ continue;
983
+ }
984
+ const match = /^\\+/.exec(remaining());
985
+ let slashes = 0;
986
+ if (match && match[0].length > 2) {
987
+ slashes = match[0].length;
988
+ state.index += slashes;
989
+ if (slashes % 2 !== 0) value += "\\";
990
+ }
991
+ if (opts.unescape === true) value = advance();
992
+ else value += advance();
993
+ if (state.brackets === 0) {
994
+ push({
995
+ type: "text",
996
+ value
997
+ });
998
+ continue;
999
+ }
1000
+ }
1001
+ /**
1002
+ * If we're inside a regex character class, continue
1003
+ * until we reach the closing bracket.
1004
+ */
1005
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
1006
+ if (opts.posix !== false && value === ":") {
1007
+ const inner = prev.value.slice(1);
1008
+ if (inner.includes("[")) {
1009
+ prev.posix = true;
1010
+ if (inner.includes(":")) {
1011
+ const idx = prev.value.lastIndexOf("[");
1012
+ const pre = prev.value.slice(0, idx);
1013
+ const posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
1014
+ if (posix) {
1015
+ prev.value = pre + posix;
1016
+ state.backtrack = true;
1017
+ advance();
1018
+ if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR;
1019
+ continue;
1020
+ }
1021
+ }
1022
+ }
1023
+ }
1024
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
1025
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
1026
+ if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
1027
+ prev.value += value;
1028
+ append({ value });
1029
+ continue;
1030
+ }
1031
+ /**
1032
+ * If we're inside a quoted string, continue
1033
+ * until we reach the closing double quote.
1034
+ */
1035
+ if (state.quotes === 1 && value !== "\"") {
1036
+ value = utils.escapeRegex(value);
1037
+ prev.value += value;
1038
+ append({ value });
1039
+ continue;
1040
+ }
1041
+ /**
1042
+ * Double quotes
1043
+ */
1044
+ if (value === "\"") {
1045
+ state.quotes = state.quotes === 1 ? 0 : 1;
1046
+ if (opts.keepQuotes === true) push({
1047
+ type: "text",
1048
+ value
1049
+ });
1050
+ continue;
1051
+ }
1052
+ /**
1053
+ * Parentheses
1054
+ */
1055
+ if (value === "(") {
1056
+ increment("parens");
1057
+ push({
1058
+ type: "paren",
1059
+ value
1060
+ });
1061
+ continue;
1062
+ }
1063
+ if (value === ")") {
1064
+ if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
1065
+ const extglob = extglobs[extglobs.length - 1];
1066
+ if (extglob && state.parens === extglob.parens + 1) {
1067
+ extglobClose(extglobs.pop());
1068
+ continue;
1069
+ }
1070
+ push({
1071
+ type: "paren",
1072
+ value,
1073
+ output: state.parens ? ")" : "\\)"
1074
+ });
1075
+ decrement("parens");
1076
+ continue;
1077
+ }
1078
+ /**
1079
+ * Square brackets
1080
+ */
1081
+ if (value === "[") {
1082
+ if (opts.nobracket === true || !remaining().includes("]")) {
1083
+ if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1084
+ value = `\\${value}`;
1085
+ } else increment("brackets");
1086
+ push({
1087
+ type: "bracket",
1088
+ value
1089
+ });
1090
+ continue;
1091
+ }
1092
+ if (value === "]") {
1093
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
1094
+ push({
1095
+ type: "text",
1096
+ value,
1097
+ output: `\\${value}`
1098
+ });
1099
+ continue;
1100
+ }
1101
+ if (state.brackets === 0) {
1102
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
1103
+ push({
1104
+ type: "text",
1105
+ value,
1106
+ output: `\\${value}`
1107
+ });
1108
+ continue;
1109
+ }
1110
+ decrement("brackets");
1111
+ const prevValue = prev.value.slice(1);
1112
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
1113
+ prev.value += value;
1114
+ append({ value });
1115
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) continue;
1116
+ const escaped = utils.escapeRegex(prev.value);
1117
+ state.output = state.output.slice(0, -prev.value.length);
1118
+ if (opts.literalBrackets === true) {
1119
+ state.output += escaped;
1120
+ prev.value = escaped;
1121
+ continue;
1122
+ }
1123
+ prev.value = `(${capture}${escaped}|${prev.value})`;
1124
+ state.output += prev.value;
1125
+ continue;
1126
+ }
1127
+ /**
1128
+ * Braces
1129
+ */
1130
+ if (value === "{" && opts.nobrace !== true) {
1131
+ increment("braces");
1132
+ const open = {
1133
+ type: "brace",
1134
+ value,
1135
+ output: "(",
1136
+ outputIndex: state.output.length,
1137
+ tokensIndex: state.tokens.length
1138
+ };
1139
+ braces.push(open);
1140
+ push(open);
1141
+ continue;
1142
+ }
1143
+ if (value === "}") {
1144
+ const brace = braces[braces.length - 1];
1145
+ if (opts.nobrace === true || !brace) {
1146
+ push({
1147
+ type: "text",
1148
+ value,
1149
+ output: value
1150
+ });
1151
+ continue;
1152
+ }
1153
+ let output = ")";
1154
+ if (brace.dots === true) {
1155
+ const arr = tokens.slice();
1156
+ const range = [];
1157
+ for (let i = arr.length - 1; i >= 0; i--) {
1158
+ tokens.pop();
1159
+ if (arr[i].type === "brace") break;
1160
+ if (arr[i].type !== "dots") range.unshift(arr[i].value);
1161
+ }
1162
+ output = expandRange(range, opts);
1163
+ state.backtrack = true;
1164
+ }
1165
+ if (brace.comma !== true && brace.dots !== true) {
1166
+ const out = state.output.slice(0, brace.outputIndex);
1167
+ const toks = state.tokens.slice(brace.tokensIndex);
1168
+ brace.value = brace.output = "\\{";
1169
+ value = output = "\\}";
1170
+ state.output = out;
1171
+ for (const t of toks) state.output += t.output || t.value;
1172
+ }
1173
+ push({
1174
+ type: "brace",
1175
+ value,
1176
+ output
1177
+ });
1178
+ decrement("braces");
1179
+ braces.pop();
1180
+ continue;
1181
+ }
1182
+ /**
1183
+ * Pipes
1184
+ */
1185
+ if (value === "|") {
1186
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
1187
+ push({
1188
+ type: "text",
1189
+ value
1190
+ });
1191
+ continue;
1192
+ }
1193
+ /**
1194
+ * Commas
1195
+ */
1196
+ if (value === ",") {
1197
+ let output = value;
1198
+ const brace = braces[braces.length - 1];
1199
+ if (brace && stack[stack.length - 1] === "braces") {
1200
+ brace.comma = true;
1201
+ output = "|";
1202
+ }
1203
+ push({
1204
+ type: "comma",
1205
+ value,
1206
+ output
1207
+ });
1208
+ continue;
1209
+ }
1210
+ /**
1211
+ * Slashes
1212
+ */
1213
+ if (value === "/") {
1214
+ if (prev.type === "dot" && state.index === state.start + 1) {
1215
+ state.start = state.index + 1;
1216
+ state.consumed = "";
1217
+ state.output = "";
1218
+ tokens.pop();
1219
+ prev = bos;
1220
+ continue;
1221
+ }
1222
+ push({
1223
+ type: "slash",
1224
+ value,
1225
+ output: SLASH_LITERAL
1226
+ });
1227
+ continue;
1228
+ }
1229
+ /**
1230
+ * Dots
1231
+ */
1232
+ if (value === ".") {
1233
+ if (state.braces > 0 && prev.type === "dot") {
1234
+ if (prev.value === ".") prev.output = DOT_LITERAL;
1235
+ const brace = braces[braces.length - 1];
1236
+ prev.type = "dots";
1237
+ prev.output += value;
1238
+ prev.value += value;
1239
+ brace.dots = true;
1240
+ continue;
1241
+ }
1242
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1243
+ push({
1244
+ type: "text",
1245
+ value,
1246
+ output: DOT_LITERAL
1247
+ });
1248
+ continue;
1249
+ }
1250
+ push({
1251
+ type: "dot",
1252
+ value,
1253
+ output: DOT_LITERAL
1254
+ });
1255
+ continue;
1256
+ }
1257
+ /**
1258
+ * Question marks
1259
+ */
1260
+ if (value === "?") {
1261
+ if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1262
+ extglobOpen("qmark", value);
1263
+ continue;
1264
+ }
1265
+ if (prev && prev.type === "paren") {
1266
+ const next = peek();
1267
+ let output = value;
1268
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
1269
+ push({
1270
+ type: "text",
1271
+ value,
1272
+ output
1273
+ });
1274
+ continue;
1275
+ }
1276
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1277
+ push({
1278
+ type: "qmark",
1279
+ value,
1280
+ output: QMARK_NO_DOT
1281
+ });
1282
+ continue;
1283
+ }
1284
+ push({
1285
+ type: "qmark",
1286
+ value,
1287
+ output: QMARK
1288
+ });
1289
+ continue;
1290
+ }
1291
+ /**
1292
+ * Exclamation
1293
+ */
1294
+ if (value === "!") {
1295
+ if (opts.noextglob !== true && peek() === "(") {
1296
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1297
+ extglobOpen("negate", value);
1298
+ continue;
1299
+ }
1300
+ }
1301
+ if (opts.nonegate !== true && state.index === 0) {
1302
+ negate();
1303
+ continue;
1304
+ }
1305
+ }
1306
+ /**
1307
+ * Plus
1308
+ */
1309
+ if (value === "+") {
1310
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1311
+ extglobOpen("plus", value);
1312
+ continue;
1313
+ }
1314
+ if (prev && prev.value === "(" || opts.regex === false) {
1315
+ push({
1316
+ type: "plus",
1317
+ value,
1318
+ output: PLUS_LITERAL
1319
+ });
1320
+ continue;
1321
+ }
1322
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1323
+ push({
1324
+ type: "plus",
1325
+ value
1326
+ });
1327
+ continue;
1328
+ }
1329
+ push({
1330
+ type: "plus",
1331
+ value: PLUS_LITERAL
1332
+ });
1333
+ continue;
1334
+ }
1335
+ /**
1336
+ * Plain text
1337
+ */
1338
+ if (value === "@") {
1339
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1340
+ push({
1341
+ type: "at",
1342
+ extglob: true,
1343
+ value,
1344
+ output: ""
1345
+ });
1346
+ continue;
1347
+ }
1348
+ push({
1349
+ type: "text",
1350
+ value
1351
+ });
1352
+ continue;
1353
+ }
1354
+ /**
1355
+ * Plain text
1356
+ */
1357
+ if (value !== "*") {
1358
+ if (value === "$" || value === "^") value = `\\${value}`;
1359
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1360
+ if (match) {
1361
+ value += match[0];
1362
+ state.index += match[0].length;
1363
+ }
1364
+ push({
1365
+ type: "text",
1366
+ value
1367
+ });
1368
+ continue;
1369
+ }
1370
+ /**
1371
+ * Stars
1372
+ */
1373
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
1374
+ prev.type = "star";
1375
+ prev.star = true;
1376
+ prev.value += value;
1377
+ prev.output = star;
1378
+ state.backtrack = true;
1379
+ state.globstar = true;
1380
+ consume(value);
1381
+ continue;
1382
+ }
1383
+ let rest = remaining();
1384
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1385
+ extglobOpen("star", value);
1386
+ continue;
1387
+ }
1388
+ if (prev.type === "star") {
1389
+ if (opts.noglobstar === true) {
1390
+ consume(value);
1391
+ continue;
1392
+ }
1393
+ const prior = prev.prev;
1394
+ const before = prior.prev;
1395
+ const isStart = prior.type === "slash" || prior.type === "bos";
1396
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
1397
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1398
+ push({
1399
+ type: "star",
1400
+ value,
1401
+ output: ""
1402
+ });
1403
+ continue;
1404
+ }
1405
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1406
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1407
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1408
+ push({
1409
+ type: "star",
1410
+ value,
1411
+ output: ""
1412
+ });
1413
+ continue;
1414
+ }
1415
+ while (rest.slice(0, 3) === "/**") {
1416
+ const after = input[state.index + 4];
1417
+ if (after && after !== "/") break;
1418
+ rest = rest.slice(3);
1419
+ consume("/**", 3);
1420
+ }
1421
+ if (prior.type === "bos" && eos()) {
1422
+ prev.type = "globstar";
1423
+ prev.value += value;
1424
+ prev.output = globstar(opts);
1425
+ state.output = prev.output;
1426
+ state.globstar = true;
1427
+ consume(value);
1428
+ continue;
1429
+ }
1430
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
1431
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1432
+ prior.output = `(?:${prior.output}`;
1433
+ prev.type = "globstar";
1434
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1435
+ prev.value += value;
1436
+ state.globstar = true;
1437
+ state.output += prior.output + prev.output;
1438
+ consume(value);
1439
+ continue;
1440
+ }
1441
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1442
+ const end = rest[1] !== void 0 ? "|$" : "";
1443
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1444
+ prior.output = `(?:${prior.output}`;
1445
+ prev.type = "globstar";
1446
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1447
+ prev.value += value;
1448
+ state.output += prior.output + prev.output;
1449
+ state.globstar = true;
1450
+ consume(value + advance());
1451
+ push({
1452
+ type: "slash",
1453
+ value: "/",
1454
+ output: ""
1455
+ });
1456
+ continue;
1457
+ }
1458
+ if (prior.type === "bos" && rest[0] === "/") {
1459
+ prev.type = "globstar";
1460
+ prev.value += value;
1461
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1462
+ state.output = prev.output;
1463
+ state.globstar = true;
1464
+ consume(value + advance());
1465
+ push({
1466
+ type: "slash",
1467
+ value: "/",
1468
+ output: ""
1469
+ });
1470
+ continue;
1471
+ }
1472
+ state.output = state.output.slice(0, -prev.output.length);
1473
+ prev.type = "globstar";
1474
+ prev.output = globstar(opts);
1475
+ prev.value += value;
1476
+ state.output += prev.output;
1477
+ state.globstar = true;
1478
+ consume(value);
1479
+ continue;
1480
+ }
1481
+ const token = {
1482
+ type: "star",
1483
+ value,
1484
+ output: star
1485
+ };
1486
+ if (opts.bash === true) {
1487
+ token.output = ".*?";
1488
+ if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
1489
+ push(token);
1490
+ continue;
1491
+ }
1492
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1493
+ token.output = value;
1494
+ push(token);
1495
+ continue;
1496
+ }
1497
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1498
+ if (prev.type === "dot") {
1499
+ state.output += NO_DOT_SLASH;
1500
+ prev.output += NO_DOT_SLASH;
1501
+ } else if (opts.dot === true) {
1502
+ state.output += NO_DOTS_SLASH;
1503
+ prev.output += NO_DOTS_SLASH;
1504
+ } else {
1505
+ state.output += nodot;
1506
+ prev.output += nodot;
1507
+ }
1508
+ if (peek() !== "*") {
1509
+ state.output += ONE_CHAR;
1510
+ prev.output += ONE_CHAR;
1511
+ }
1512
+ }
1513
+ push(token);
1514
+ }
1515
+ while (state.brackets > 0) {
1516
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1517
+ state.output = utils.escapeLast(state.output, "[");
1518
+ decrement("brackets");
1519
+ }
1520
+ while (state.parens > 0) {
1521
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
1522
+ state.output = utils.escapeLast(state.output, "(");
1523
+ decrement("parens");
1524
+ }
1525
+ while (state.braces > 0) {
1526
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
1527
+ state.output = utils.escapeLast(state.output, "{");
1528
+ decrement("braces");
1529
+ }
1530
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
1531
+ type: "maybe_slash",
1532
+ value: "",
1533
+ output: `${SLASH_LITERAL}?`
1534
+ });
1535
+ if (state.backtrack === true) {
1536
+ state.output = "";
1537
+ for (const token of state.tokens) {
1538
+ state.output += token.output != null ? token.output : token.value;
1539
+ if (token.suffix) state.output += token.suffix;
1540
+ }
1541
+ }
1542
+ return state;
1543
+ };
1544
+ /**
1545
+ * Fast paths for creating regular expressions for common glob patterns.
1546
+ * This can significantly speed up processing and has very little downside
1547
+ * impact when none of the fast paths match.
1548
+ */
1549
+ parse.fastpaths = (input, options) => {
1550
+ const opts = { ...options };
1551
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1552
+ const len = input.length;
1553
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1554
+ input = REPLACEMENTS[input] || input;
1555
+ const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
1556
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
1557
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1558
+ const capture = opts.capture ? "" : "?:";
1559
+ const state = {
1560
+ negated: false,
1561
+ prefix: ""
1562
+ };
1563
+ let star = opts.bash === true ? ".*?" : STAR;
1564
+ if (opts.capture) star = `(${star})`;
1565
+ const globstar = (opts) => {
1566
+ if (opts.noglobstar === true) return star;
1567
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1568
+ };
1569
+ const create = (str) => {
1570
+ switch (str) {
1571
+ case "*": return `${nodot}${ONE_CHAR}${star}`;
1572
+ case ".*": return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1573
+ case "*.*": return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1574
+ case "*/*": return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1575
+ case "**": return nodot + globstar(opts);
1576
+ case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1577
+ case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1578
+ case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1579
+ default: {
1580
+ const match = /^(.*?)\.(\w+)$/.exec(str);
1581
+ if (!match) return;
1582
+ const source = create(match[1]);
1583
+ if (!source) return;
1584
+ return source + DOT_LITERAL + match[2];
1585
+ }
1586
+ }
1587
+ };
1588
+ let source = create(utils.removePrefix(input, state));
1589
+ if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL}?`;
1590
+ return source;
1591
+ };
1592
+ module.exports = parse;
1593
+ }));
1594
+ //#endregion
1595
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
1596
+ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1597
+ const scan = require_scan();
1598
+ const parse = require_parse();
1599
+ const utils = require_utils();
1600
+ const constants = require_constants();
1601
+ const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
1602
+ /**
1603
+ * Creates a matcher function from one or more glob patterns. The
1604
+ * returned function takes a string to match as its first argument,
1605
+ * and returns true if the string is a match. The returned matcher
1606
+ * function also takes a boolean as the second argument that, when true,
1607
+ * returns an object with additional information.
1608
+ *
1609
+ * ```js
1610
+ * const picomatch = require('picomatch');
1611
+ * // picomatch(glob[, options]);
1612
+ *
1613
+ * const isMatch = picomatch('*.!(*a)');
1614
+ * console.log(isMatch('a.a')); //=> false
1615
+ * console.log(isMatch('a.b')); //=> true
1616
+ * ```
1617
+ * @name picomatch
1618
+ * @param {String|Array} `globs` One or more glob patterns.
1619
+ * @param {Object=} `options`
1620
+ * @return {Function=} Returns a matcher function.
1621
+ * @api public
1622
+ */
1623
+ const picomatch = (glob, options, returnState = false) => {
1624
+ if (Array.isArray(glob)) {
1625
+ const fns = glob.map((input) => picomatch(input, options, returnState));
1626
+ const arrayMatcher = (str) => {
1627
+ for (const isMatch of fns) {
1628
+ const state = isMatch(str);
1629
+ if (state) return state;
1630
+ }
1631
+ return false;
1632
+ };
1633
+ return arrayMatcher;
1634
+ }
1635
+ const isState = isObject(glob) && glob.tokens && glob.input;
1636
+ if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
1637
+ const opts = options || {};
1638
+ const posix = opts.windows;
1639
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
1640
+ const state = regex.state;
1641
+ delete regex.state;
1642
+ let isIgnored = () => false;
1643
+ if (opts.ignore) {
1644
+ const ignoreOpts = {
1645
+ ...options,
1646
+ ignore: null,
1647
+ onMatch: null,
1648
+ onResult: null
1649
+ };
1650
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1651
+ }
1652
+ const matcher = (input, returnObject = false) => {
1653
+ const { isMatch, match, output } = picomatch.test(input, regex, options, {
1654
+ glob,
1655
+ posix
1656
+ });
1657
+ const result = {
1658
+ glob,
1659
+ state,
1660
+ regex,
1661
+ posix,
1662
+ input,
1663
+ output,
1664
+ match,
1665
+ isMatch
1666
+ };
1667
+ if (typeof opts.onResult === "function") opts.onResult(result);
1668
+ if (isMatch === false) {
1669
+ result.isMatch = false;
1670
+ return returnObject ? result : false;
1671
+ }
1672
+ if (isIgnored(input)) {
1673
+ if (typeof opts.onIgnore === "function") opts.onIgnore(result);
1674
+ result.isMatch = false;
1675
+ return returnObject ? result : false;
1676
+ }
1677
+ if (typeof opts.onMatch === "function") opts.onMatch(result);
1678
+ return returnObject ? result : true;
1679
+ };
1680
+ if (returnState) matcher.state = state;
1681
+ return matcher;
1682
+ };
1683
+ /**
1684
+ * Test `input` with the given `regex`. This is used by the main
1685
+ * `picomatch()` function to test the input string.
1686
+ *
1687
+ * ```js
1688
+ * const picomatch = require('picomatch');
1689
+ * // picomatch.test(input, regex[, options]);
1690
+ *
1691
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
1692
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
1693
+ * ```
1694
+ * @param {String} `input` String to test.
1695
+ * @param {RegExp} `regex`
1696
+ * @return {Object} Returns an object with matching info.
1697
+ * @api public
1698
+ */
1699
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
1700
+ if (typeof input !== "string") throw new TypeError("Expected input to be a string");
1701
+ if (input === "") return {
1702
+ isMatch: false,
1703
+ output: ""
1704
+ };
1705
+ const opts = options || {};
1706
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
1707
+ let match = input === glob;
1708
+ let output = match && format ? format(input) : input;
1709
+ if (match === false) {
1710
+ output = format ? format(input) : input;
1711
+ match = output === glob;
1712
+ }
1713
+ if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
1714
+ else match = regex.exec(output);
1715
+ return {
1716
+ isMatch: Boolean(match),
1717
+ match,
1718
+ output
1719
+ };
1720
+ };
1721
+ /**
1722
+ * Match the basename of a filepath.
1723
+ *
1724
+ * ```js
1725
+ * const picomatch = require('picomatch');
1726
+ * // picomatch.matchBase(input, glob[, options]);
1727
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
1728
+ * ```
1729
+ * @param {String} `input` String to test.
1730
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
1731
+ * @return {Boolean}
1732
+ * @api public
1733
+ */
1734
+ picomatch.matchBase = (input, glob, options) => {
1735
+ return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input));
1736
+ };
1737
+ /**
1738
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
1739
+ *
1740
+ * ```js
1741
+ * const picomatch = require('picomatch');
1742
+ * // picomatch.isMatch(string, patterns[, options]);
1743
+ *
1744
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
1745
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
1746
+ * ```
1747
+ * @param {String|Array} str The string to test.
1748
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
1749
+ * @param {Object} [options] See available [options](#options).
1750
+ * @return {Boolean} Returns true if any patterns match `str`
1751
+ * @api public
1752
+ */
1753
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
1754
+ /**
1755
+ * Parse a glob pattern to create the source string for a regular
1756
+ * expression.
1757
+ *
1758
+ * ```js
1759
+ * const picomatch = require('picomatch');
1760
+ * const result = picomatch.parse(pattern[, options]);
1761
+ * ```
1762
+ * @param {String} `pattern`
1763
+ * @param {Object} `options`
1764
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
1765
+ * @api public
1766
+ */
1767
+ picomatch.parse = (pattern, options) => {
1768
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
1769
+ return parse(pattern, {
1770
+ ...options,
1771
+ fastpaths: false
1772
+ });
1773
+ };
1774
+ /**
1775
+ * Scan a glob pattern to separate the pattern into segments.
1776
+ *
1777
+ * ```js
1778
+ * const picomatch = require('picomatch');
1779
+ * // picomatch.scan(input[, options]);
1780
+ *
1781
+ * const result = picomatch.scan('!./foo/*.js');
1782
+ * console.log(result);
1783
+ * { prefix: '!./',
1784
+ * input: '!./foo/*.js',
1785
+ * start: 3,
1786
+ * base: 'foo',
1787
+ * glob: '*.js',
1788
+ * isBrace: false,
1789
+ * isBracket: false,
1790
+ * isGlob: true,
1791
+ * isExtglob: false,
1792
+ * isGlobstar: false,
1793
+ * negated: true }
1794
+ * ```
1795
+ * @param {String} `input` Glob pattern to scan.
1796
+ * @param {Object} `options`
1797
+ * @return {Object} Returns an object with
1798
+ * @api public
1799
+ */
1800
+ picomatch.scan = (input, options) => scan(input, options);
1801
+ /**
1802
+ * Compile a regular expression from the `state` object returned by the
1803
+ * [parse()](#parse) method.
1804
+ *
1805
+ * ```js
1806
+ * const picomatch = require('picomatch');
1807
+ * const state = picomatch.parse('*.js');
1808
+ * // picomatch.compileRe(state[, options]);
1809
+ *
1810
+ * console.log(picomatch.compileRe(state));
1811
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
1812
+ * ```
1813
+ * @param {Object} `state`
1814
+ * @param {Object} `options`
1815
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
1816
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
1817
+ * @return {RegExp}
1818
+ * @api public
1819
+ */
1820
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
1821
+ if (returnOutput === true) return state.output;
1822
+ const opts = options || {};
1823
+ const prepend = opts.contains ? "" : "^";
1824
+ const append = opts.contains ? "" : "$";
1825
+ let source = `${prepend}(?:${state.output})${append}`;
1826
+ if (state && state.negated === true) source = `^(?!${source}).*$`;
1827
+ const regex = picomatch.toRegex(source, options);
1828
+ if (returnState === true) regex.state = state;
1829
+ return regex;
1830
+ };
1831
+ /**
1832
+ * Create a regular expression from a parsed glob pattern.
1833
+ *
1834
+ * ```js
1835
+ * const picomatch = require('picomatch');
1836
+ * // picomatch.makeRe(state[, options]);
1837
+ *
1838
+ * const result = picomatch.makeRe('*.js');
1839
+ * console.log(result);
1840
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
1841
+ * ```
1842
+ * @param {String} `state` The object returned from the `.parse` method.
1843
+ * @param {Object} `options`
1844
+ * @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.
1845
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
1846
+ * @return {RegExp} Returns a regex created from the given pattern.
1847
+ * @api public
1848
+ */
1849
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1850
+ if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
1851
+ let parsed = {
1852
+ negated: false,
1853
+ fastpaths: true
1854
+ };
1855
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
1856
+ if (!parsed.output) parsed = parse(input, options);
1857
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
1858
+ };
1859
+ /**
1860
+ * Create a regular expression from the given regex source string.
1861
+ *
1862
+ * ```js
1863
+ * const picomatch = require('picomatch');
1864
+ * // picomatch.toRegex(source[, options]);
1865
+ *
1866
+ * const { output } = picomatch.parse('*.js');
1867
+ * console.log(picomatch.toRegex(output));
1868
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
1869
+ * ```
1870
+ * @param {String} `source` Regular expression source string.
1871
+ * @param {Object} `options`
1872
+ * @return {RegExp}
1873
+ * @api public
1874
+ */
1875
+ picomatch.toRegex = (source, options) => {
1876
+ try {
1877
+ const opts = options || {};
1878
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1879
+ } catch (err) {
1880
+ if (options && options.debug === true) throw err;
1881
+ return /$^/;
1882
+ }
1883
+ };
1884
+ /**
1885
+ * Picomatch constants.
1886
+ * @return {Object}
1887
+ */
1888
+ picomatch.constants = constants;
1889
+ /**
1890
+ * Expose "picomatch"
1891
+ */
1892
+ module.exports = picomatch;
1893
+ }));
1894
+ //#endregion
1895
+ //#region ../../node_modules/.pnpm/unplugin-utils@0.3.1/node_modules/unplugin-utils/dist/index.js
1896
+ var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
1897
+ const pico = require_picomatch$1();
1898
+ const utils = require_utils();
1899
+ function picomatch(glob, options, returnState = false) {
1900
+ if (options && (options.windows === null || options.windows === void 0)) options = {
1901
+ ...options,
1902
+ windows: utils.isWindows()
1903
+ };
1904
+ return pico(glob, options, returnState);
1905
+ }
1906
+ Object.assign(picomatch, pico);
1907
+ module.exports = picomatch;
1908
+ })))(), 1);
1909
+ /**
1910
+ * Converts path separators to forward slash.
1911
+ */
1912
+ function normalizePath(filename) {
1913
+ return filename.replaceAll("\\", "/");
1914
+ }
1915
+ const isArray = Array.isArray;
1916
+ function toArray$1(thing) {
1917
+ if (isArray(thing)) return thing;
1918
+ if (thing == null) return [];
1919
+ return [thing];
1920
+ }
1921
+ const escapeMark = "[_#EsCaPe#_]";
1922
+ function getMatcherString(id, resolutionBase) {
1923
+ if (resolutionBase === false || isAbsolute(id) || id.startsWith("**")) return normalizePath(id);
1924
+ return join(normalizePath(resolve(resolutionBase || "")).replaceAll(/[-^$*+?.()|[\]{}]/g, `${escapeMark}$&`), normalizePath(id)).replaceAll(escapeMark, "\\");
1925
+ }
1926
+ /**
1927
+ * Constructs a filter function which can be used to determine whether or not
1928
+ * certain modules should be operated upon.
1929
+ * @param include If `include` is omitted or has zero length, filter will return `true` by default.
1930
+ * @param exclude ID must not match any of the `exclude` patterns.
1931
+ * @param options Additional options.
1932
+ * @param options.resolve Optionally resolves the patterns against a directory other than `process.cwd()`.
1933
+ * If a `string` is specified, then the value will be used as the base directory.
1934
+ * Relative paths will be resolved against `process.cwd()` first.
1935
+ * If `false`, then the patterns will not be resolved against any directory.
1936
+ * This can be useful if you want to create a filter for virtual module names.
1937
+ */
1938
+ function createFilter(include, exclude, options) {
1939
+ const resolutionBase = options && options.resolve;
1940
+ const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => {
1941
+ return (0, import_picomatch.default)(getMatcherString(id, resolutionBase), { dot: true })(what);
1942
+ } };
1943
+ const includeMatchers = toArray$1(include).map(getMatcher);
1944
+ const excludeMatchers = toArray$1(exclude).map(getMatcher);
1945
+ if (!includeMatchers.length && !excludeMatchers.length) return (id) => typeof id === "string" && !id.includes("\0");
1946
+ return function result(id) {
1947
+ if (typeof id !== "string") return false;
1948
+ if (id.includes("\0")) return false;
1949
+ const pathId = normalizePath(id);
1950
+ for (const matcher of excludeMatchers) {
1951
+ if (matcher instanceof RegExp) matcher.lastIndex = 0;
1952
+ if (matcher.test(pathId)) return false;
1953
+ }
1954
+ for (const matcher of includeMatchers) {
1955
+ if (matcher instanceof RegExp) matcher.lastIndex = 0;
1956
+ if (matcher.test(pathId)) return true;
1957
+ }
1958
+ return !includeMatchers.length;
1959
+ };
1960
+ }
1961
+ const SKIP_START_COMMENT = "@unocss-skip-start";
1962
+ const SKIP_END_COMMENT = "@unocss-skip-end";
1963
+ const SKIP_COMMENT_RE = new RegExp(`(\/\/\\s*?${SKIP_START_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(\/\/\\s*?${SKIP_END_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, "g");
1964
+ const VIRTUAL_ENTRY_ALIAS = [/^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/];
1965
+ //#endregion
1966
+ //#region ../../virtual-shared/integration/src/defaults.ts
1967
+ const defaultPipelineExclude = [cssIdRE];
1968
+ const defaultPipelineInclude = [/\.(vue|svelte|[jt]sx|vine.ts|mdx?|astro|elm|php|phtml|marko|html)($|\?)/];
1969
+ //#endregion
1970
+ //#region ../../virtual-shared/integration/src/context.ts
1971
+ function createContext(configOrPath, defaults = {}, extraConfigSources = [], resolveConfigResult = () => {}) {
1972
+ let root = process$1.cwd();
1973
+ let rawConfig = {};
1974
+ let configFileList = [];
1975
+ let uno;
1976
+ const _uno = createGenerator(rawConfig, defaults).then((r) => {
1977
+ uno = r;
1978
+ return r;
1979
+ });
1980
+ let rollupFilter = createFilter(defaultPipelineInclude, defaultPipelineExclude, { resolve: typeof configOrPath === "string" ? configOrPath : root });
1981
+ const invalidations = [];
1982
+ const reloadListeners = [];
1983
+ const modules = new BetterMap();
1984
+ const tokens = /* @__PURE__ */ new Set();
1985
+ const tasks = [];
1986
+ const affectedModules = /* @__PURE__ */ new Set();
1987
+ const loadConfig = createRecoveryConfigLoader();
1988
+ let ready = reloadConfig();
1989
+ async function reloadConfig() {
1990
+ await _uno;
1991
+ const result = await loadConfig(root, configOrPath, extraConfigSources, defaults);
1992
+ resolveConfigResult(result);
1993
+ result.config;
1994
+ rawConfig = result.config;
1995
+ configFileList = result.sources;
1996
+ await uno.setConfig(rawConfig);
1997
+ uno.config.envMode = "dev";
1998
+ rollupFilter = rawConfig.content?.pipeline === false ? () => false : createFilter(rawConfig.content?.pipeline?.include || defaultPipelineInclude, rawConfig.content?.pipeline?.exclude || defaultPipelineExclude, { resolve: typeof configOrPath === "string" ? configOrPath : root });
1999
+ tokens.clear();
2000
+ await Promise.all(modules.map((code, id) => uno.applyExtractors(code.replace(SKIP_COMMENT_RE, ""), id, tokens)));
2001
+ invalidate();
2002
+ dispatchReload();
2003
+ return result;
2004
+ }
2005
+ async function updateRoot(newRoot) {
2006
+ if (newRoot !== root) {
2007
+ root = newRoot;
2008
+ ready = reloadConfig();
2009
+ }
2010
+ return await ready;
2011
+ }
2012
+ function invalidate() {
2013
+ invalidations.forEach((cb) => cb());
2014
+ }
2015
+ function dispatchReload() {
2016
+ reloadListeners.forEach((cb) => cb());
2017
+ }
2018
+ async function extract(code, id) {
2019
+ const uno = await _uno;
2020
+ if (id) modules.set(id, code);
2021
+ const len = tokens.size;
2022
+ await uno.applyExtractors(code.replace(SKIP_COMMENT_RE, ""), id, tokens);
2023
+ if (tokens.size > len) invalidate();
2024
+ }
2025
+ function filter(code, id) {
2026
+ if (code.includes("@unocss-ignore")) return false;
2027
+ return code.includes("@unocss-include") || code.includes("@unocss-placeholder") || rollupFilter(id.replace(/\?v=\w+$/, ""));
2028
+ }
2029
+ async function getConfig() {
2030
+ await ready;
2031
+ return rawConfig;
2032
+ }
2033
+ async function flushTasks() {
2034
+ const _tasks = [...tasks];
2035
+ await Promise.all(_tasks);
2036
+ if (tasks[0] === _tasks[0]) tasks.splice(0, _tasks.length);
2037
+ }
2038
+ /**
2039
+ * Get regexes to match virtual module ids
2040
+ */
2041
+ const vmpCache = /* @__PURE__ */ new Map();
2042
+ async function getVMPRegexes() {
2043
+ const prefix = (await getConfig()).virtualModulePrefix || "__uno";
2044
+ if (vmpCache.has(prefix)) return vmpCache.get(prefix);
2045
+ const regexes = {
2046
+ prefix,
2047
+ RESOLVED_ID_WITH_QUERY_RE: new RegExp(`[/\\\\]${prefix}(_.*?)?\\.css(\\?.*)?$`),
2048
+ RESOLVED_ID_RE: new RegExp(`[/\\\\]${prefix}(?:_(.*?))?\.css$`)
2049
+ };
2050
+ vmpCache.set(prefix, regexes);
2051
+ return regexes;
2052
+ }
2053
+ return {
2054
+ get ready() {
2055
+ return ready;
2056
+ },
2057
+ tokens,
2058
+ modules,
2059
+ affectedModules,
2060
+ tasks,
2061
+ flushTasks,
2062
+ invalidate,
2063
+ onInvalidate(fn) {
2064
+ invalidations.push(fn);
2065
+ },
2066
+ filter,
2067
+ reloadConfig,
2068
+ onReload(fn) {
2069
+ reloadListeners.push(fn);
2070
+ },
2071
+ get uno() {
2072
+ if (!uno) throw new Error("Run `await context.ready` before accessing `context.uno`");
2073
+ return uno;
2074
+ },
2075
+ extract,
2076
+ getConfig,
2077
+ get root() {
2078
+ return root;
2079
+ },
2080
+ updateRoot,
2081
+ getConfigFileList: () => configFileList,
2082
+ getVMPRegexes
2083
+ };
2084
+ }
2085
+ //#endregion
11
2086
  //#region src/_vite/config-hmr.ts
12
2087
  function ConfigHMRPlugin({ ready }) {
13
2088
  return {
@@ -25,12 +2100,12 @@ function ConfigHMRPlugin({ ready }) {
25
2100
  }
26
2101
  };
27
2102
  }
28
- const SKIP_START_COMMENT = "@unocss-skip-start";
29
- const SKIP_END_COMMENT = "@unocss-skip-end";
30
- const SKIP_COMMENT_RE = new RegExp(`(\/\/\\s*?${SKIP_START_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(\/\/\\s*?${SKIP_END_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, "g");
31
2103
  //#endregion
32
2104
  //#region ../../virtual-shared/integration/src/utils.ts
33
- function hash(str) {
2105
+ function getPath(id) {
2106
+ return id.replace(/\?.*$/, "");
2107
+ }
2108
+ function hash$1(str) {
34
2109
  let i;
35
2110
  let l;
36
2111
  let hval = 2166136261;
@@ -43,7 +2118,7 @@ function hash(str) {
43
2118
  function transformSkipCode(code, map, SKIP_RULES_RE, keyFlag) {
44
2119
  for (const item of Array.from(code.matchAll(SKIP_RULES_RE))) if (item != null) {
45
2120
  const matched = item[0];
46
- const withHashKey = `${keyFlag}${hash(matched)}`;
2121
+ const withHashKey = `${keyFlag}${hash$1(matched)}`;
47
2122
  map.set(withHashKey, matched);
48
2123
  code = code.replace(matched, withHashKey);
49
2124
  }
@@ -116,21 +2191,21 @@ const GLOBAL_STYLES_CSS_FILE_NAME = "unocss-svelte-scoped-global.css";
116
2191
  const _dirname = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
117
2192
  function getReset(injectReset) {
118
2193
  if (injectReset.startsWith("@unocss/reset")) {
119
- const resolvedPNPM = resolve(resolve(_dirname, `../../../${injectReset}`));
2194
+ const resolvedPNPM = resolve$1(resolve$1(_dirname, `../../../${injectReset}`));
120
2195
  if (isFile(resolvedPNPM)) return readFileSync(resolvedPNPM, "utf-8");
121
- const resolvedPNPM_in_uno_repo = resolve(resolve(_dirname, `../node_modules/${injectReset}`));
2196
+ const resolvedPNPM_in_uno_repo = resolve$1(resolve$1(_dirname, `../node_modules/${injectReset}`));
122
2197
  if (isFile(resolvedPNPM_in_uno_repo)) return readFileSync(resolvedPNPM_in_uno_repo, "utf-8");
123
- const resolvedNPM = resolve(process.cwd(), "node_modules", injectReset);
2198
+ const resolvedNPM = resolve$1(process$1.cwd(), "node_modules", injectReset);
124
2199
  if (isFile(resolvedNPM)) return readFileSync(resolvedNPM, "utf-8");
125
2200
  throw new Error(`"${injectReset}" given as your injectReset value is not found. Please make sure it is one of the five supported @unocss/reset options. If it is, file a bug report detailing your environment and package manager`);
126
2201
  }
127
2202
  if (injectReset.startsWith(".")) {
128
- const resolved = resolve(process.cwd(), injectReset);
2203
+ const resolved = resolve$1(process$1.cwd(), injectReset);
129
2204
  if (!isFile(resolved)) throw new Error(`"${injectReset}" given as your injectReset value is not a valid file path relative to the root of your project, where your vite config file sits. To give an example, if you placed a reset.css in your src directory, "./src/reset.css" would work.`);
130
2205
  return readFileSync(resolved, "utf-8");
131
2206
  }
132
2207
  if (injectReset.startsWith("/")) throw new Error(`Your injectReset value: "${injectReset}" is not a valid file path. To give an example, if you placed a reset.css in your src directory, "./src/reset.css" would work.`);
133
- const resolvedFromNodeModules = resolve(process.cwd(), "node_modules", injectReset);
2208
+ const resolvedFromNodeModules = resolve$1(process$1.cwd(), "node_modules", injectReset);
134
2209
  if (!isFile(resolvedFromNodeModules)) throw new Error(`"${injectReset}" given as your injectReset value is not a valid file path relative to your project's node_modules folder. Can you confirm that you've installed "${injectReset}"?`);
135
2210
  return readFileSync(resolvedFromNodeModules, "utf-8");
136
2211
  }
@@ -189,16 +2264,14 @@ function GlobalStylesPlugin(ctx, injectReset) {
189
2264
  }
190
2265
  }
191
2266
  },
192
- async buildStart() {
193
- if (viteConfig.command === "build") unoCssFileReferenceId = this.emitFile({
194
- type: "asset",
195
- name: GLOBAL_STYLES_CSS_FILE_NAME
196
- });
197
- },
198
2267
  async buildEnd() {
199
2268
  if (viteConfig.command === "build") {
200
2269
  const css = await generateGlobalCss(ctx.uno, injectReset);
201
- this.setAssetSource(unoCssFileReferenceId, css);
2270
+ unoCssFileReferenceId = this.emitFile({
2271
+ type: "asset",
2272
+ name: GLOBAL_STYLES_CSS_FILE_NAME,
2273
+ source: css
2274
+ });
202
2275
  }
203
2276
  },
204
2277
  renderStart() {
@@ -219,55 +2292,168 @@ function GlobalStylesPlugin(ctx, injectReset) {
219
2292
  };
220
2293
  }
221
2294
  //#endregion
222
- //#region src/_vite/passPreprocessToSveltePlugin.ts
223
- function PassPreprocessToSveltePlugin(context, options = {}) {
224
- let commandIsBuild = true;
225
- const isBuild = () => commandIsBuild;
2295
+ //#region ../../virtual-shared/integration/src/hash.ts
2296
+ const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
2297
+ function getHash(input, length = 8) {
2298
+ return hash("sha256", input, "hex").substring(0, length);
2299
+ }
2300
+ //#endregion
2301
+ //#region ../../virtual-shared/integration/src/layers.ts
2302
+ async function resolveId(ctx, id, importer) {
2303
+ const { RESOLVED_ID_WITH_QUERY_RE, prefix } = await ctx.getVMPRegexes();
2304
+ if (id.match(RESOLVED_ID_WITH_QUERY_RE)) return id;
2305
+ for (const alias of VIRTUAL_ENTRY_ALIAS) {
2306
+ const match = id.match(alias);
2307
+ if (match) {
2308
+ let virtual = match[1] ? `${prefix}_${match[1]}.css` : `${prefix}.css`;
2309
+ virtual += match[2] || "";
2310
+ if (importer) virtual = resolve(importer, "..", virtual);
2311
+ else virtual = `/${virtual}`;
2312
+ return virtual;
2313
+ }
2314
+ }
2315
+ }
2316
+ async function resolveLayer(ctx, id) {
2317
+ const { RESOLVED_ID_RE } = await ctx.getVMPRegexes();
2318
+ const match = id.match(RESOLVED_ID_RE);
2319
+ if (match) return match[1] || "__ALL__";
2320
+ }
2321
+ //#endregion
2322
+ //#region src/_vite/transform.ts
2323
+ const regexStyleTags = /<style((?:\s+[^=>'"/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"/\s]+)*\s*)(?:\/>|>([\s\S]*?)<\/style>)/g;
2324
+ const regexScriptTags = /<script((?:\s+[^=>'"/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"/\s]+)*\s*)(?:\/>|>([\s\S]*?)<\/script>)/g;
2325
+ function transformPlugin(context, options) {
2326
+ const servers = [];
2327
+ const vfsLayers = /* @__PURE__ */ new Map();
2328
+ const idToEntryMapping = /* @__PURE__ */ new Map();
226
2329
  return {
227
- name: "unocss:svelte-scoped:pass-preprocess",
2330
+ name: "unocss:svelte-scoped:transform",
228
2331
  enforce: "pre",
229
- configResolved({ command }) {
230
- commandIsBuild = command === "build";
2332
+ configureServer(server) {
2333
+ servers.push(server);
231
2334
  },
232
- api: { sveltePreprocess: UnocssSveltePreprocess(options, context, isBuild) }
2335
+ async configResolved({ command }) {
2336
+ if (options.combine === void 0) options.combine = command === "build";
2337
+ await context.ready;
2338
+ },
2339
+ transform: {
2340
+ filter: { id: {
2341
+ include: /\.svelte$/,
2342
+ exclude: defaultPipelineExclude
2343
+ } },
2344
+ order: "pre",
2345
+ async handler(code, id) {
2346
+ if (!id.endsWith(".svelte")) return;
2347
+ const s = new MagicString(code);
2348
+ await transformStyleTag(s, context.uno, options);
2349
+ await transformMarkup(s, id, context.uno, options, (module, layer, css) => {
2350
+ const entry = idToEntryMapping.get(module);
2351
+ if (entry) for (const server of servers) {
2352
+ const mod = server.moduleGraph.getModuleById(entry);
2353
+ if (mod) {
2354
+ server.moduleGraph.invalidateModule(mod);
2355
+ server.ws.send({
2356
+ type: "update",
2357
+ updates: [{
2358
+ acceptedPath: mod.url,
2359
+ path: mod.url,
2360
+ timestamp: Date.now(),
2361
+ type: "js-update"
2362
+ }]
2363
+ });
2364
+ }
2365
+ }
2366
+ vfsLayers.set(layer, css);
2367
+ });
2368
+ return {
2369
+ code: s.toString(),
2370
+ map: s.generateMap({
2371
+ hires: true,
2372
+ source: id
2373
+ })
2374
+ };
2375
+ }
2376
+ },
2377
+ resolveId: {
2378
+ filter: { id: { include: VIRTUAL_ENTRY_ALIAS } },
2379
+ async handler(source, importer) {
2380
+ const entry = await resolveId(context, source, importer);
2381
+ if (entry) {
2382
+ idToEntryMapping.set(source, entry);
2383
+ return {
2384
+ id: entry,
2385
+ moduleSideEffects: false
2386
+ };
2387
+ }
2388
+ }
2389
+ },
2390
+ load: { async handler(id) {
2391
+ const { RESOLVED_ID_RE, RESOLVED_ID_WITH_QUERY_RE } = await context.getVMPRegexes();
2392
+ if (!RESOLVED_ID_RE.test(id) && !RESOLVED_ID_WITH_QUERY_RE.test(id)) return;
2393
+ const layer = await resolveLayer(context, getPath(id));
2394
+ if (layer) {
2395
+ const css = vfsLayers.get(layer);
2396
+ if (css) return {
2397
+ code: css,
2398
+ map: null,
2399
+ moduleSideEffects: false
2400
+ };
2401
+ this.warn(`[svelte-scoped] virtual module ${id} was requested but not generated`);
2402
+ }
2403
+ } }
233
2404
  };
234
2405
  }
2406
+ async function transformStyleTag(s, uno, options) {
2407
+ const matches = s.original.matchAll(regexStyleTags);
2408
+ for (const { index, "0": tag_with_content, "2": content } of matches) {
2409
+ const { hasApply, applyVariables } = checkForApply(content, options.applyVariables);
2410
+ const hasThemeFn = options.transformThemeDirective === false ? false : !!content.match(themeRE);
2411
+ if (!hasApply && !hasThemeFn) continue;
2412
+ const ss = new MagicString(content);
2413
+ await transformStyle({
2414
+ s: ss,
2415
+ uno,
2416
+ prepend: "",
2417
+ applyVariables,
2418
+ transformThemeFn: hasThemeFn
2419
+ });
2420
+ const idx = index + tag_with_content.indexOf(content);
2421
+ s.update(idx, idx + content.length, ss.toString());
2422
+ }
2423
+ }
2424
+ async function transformMarkup(s, filename, uno, options, setCss) {
2425
+ const transformed = await transformClasses({
2426
+ s,
2427
+ filename,
2428
+ uno,
2429
+ options,
2430
+ removeCommentsToMakeGlobalWrappingEasy: false
2431
+ });
2432
+ if (!transformed) return;
2433
+ const layer = `${basename(filename, ".svelte")}_${getHash(filename)}.svelte`;
2434
+ const module = `uno:${layer}.css`;
2435
+ const importStmt = `import '${module}';`;
2436
+ setCss(module, layer, transformed.generatedStyles);
2437
+ const matches = s.original.matchAll(regexScriptTags);
2438
+ for (const { index, "0": tag_with_content, "1": attributes, "2": content } of matches) {
2439
+ if (attributes.includes("module")) continue;
2440
+ const idx = index + tag_with_content.indexOf(content);
2441
+ s.prependLeft(idx, `${importStmt}\n`);
2442
+ return;
2443
+ }
2444
+ s.prepend(`<script>\n${importStmt}\n<\/script>\n`);
2445
+ }
235
2446
  //#endregion
236
2447
  //#region src/_vite/index.ts
237
2448
  function UnocssSvelteScopedVite(options = {}) {
238
- const context = createSvelteScopedContext(options.configOrPath);
2449
+ const context = createContext(options.configOrPath, { presets: [presetUno()] }, void 0, (result) => {
2450
+ if (result.config.transformers?.length) throw new Error("Due to the differences in normal UnoCSS global usage and Svelte Scoped usage, \"config.transformers\" will be ignored. You can still use transformers in CSS files with the \"cssFileTransformers\" option.");
2451
+ });
239
2452
  if (!options.classPrefix) options.classPrefix = "uno-";
240
2453
  const plugins = [GlobalStylesPlugin(context, options.injectReset), ConfigHMRPlugin(context)];
241
- if (!options.onlyGlobal) plugins.push(PassPreprocessToSveltePlugin(context, options));
2454
+ if (!options.onlyGlobal) plugins.push(transformPlugin(context, options));
242
2455
  if (options.cssFileTransformers) plugins.push(...createCssTransformerPlugins(context, options.cssFileTransformers));
243
2456
  return plugins;
244
2457
  }
245
- const defaults = { presets: [presetUno()] };
246
- function createSvelteScopedContext(configOrPath) {
247
- let uno;
248
- const _uno = createGenerator().then((r) => {
249
- uno = r;
250
- if (uno.config.transformers?.length) throw new Error("Due to the differences in normal UnoCSS global usage and Svelte Scoped usage, \"config.transformers\" will be ignored. You can still use transformers in CSS files with the \"cssFileTransformers\" option.");
251
- return r;
252
- });
253
- const loadConfig = createRecoveryConfigLoader();
254
- const ready = reloadConfig();
255
- async function reloadConfig() {
256
- await _uno;
257
- const { config, sources } = await loadConfig(process.cwd(), configOrPath);
258
- await uno.setConfig(config, defaults);
259
- return {
260
- config,
261
- sources
262
- };
263
- }
264
- return {
265
- get uno() {
266
- if (!uno) throw new Error("Run `await ctx.ready` before accessing to `ctx.uno`");
267
- return uno;
268
- },
269
- ready
270
- };
271
- }
272
2458
  //#endregion
273
2459
  export { UnocssSvelteScopedVite as default };