@cmodjs/core 5.5.4 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/docs/commands.md +7 -5
  2. package/docs/dependencies.md +2 -2
  3. package/docs/mod.md +1 -1
  4. package/docs/testing.md +7 -0
  5. package/docs/ui.md +7 -3
  6. package/package.json +2 -2
  7. package/records.d.ts +3 -1
  8. package/records.d.ts.map +1 -1
  9. package/records.js +7 -1
  10. package/runtime/before.d.ts +3 -0
  11. package/runtime/before.d.ts.map +1 -1
  12. package/runtime/before.js +66 -31
  13. package/runtime/conversations.d.ts.map +1 -1
  14. package/runtime/conversations.js +29 -9
  15. package/runtime/lifecycle.d.ts.map +1 -1
  16. package/runtime/lifecycle.js +23 -22
  17. package/runtime/programs.d.ts +1 -0
  18. package/runtime/programs.d.ts.map +1 -1
  19. package/runtime/programs.js +8 -1
  20. package/runtime/router.d.ts +4 -2
  21. package/runtime/router.d.ts.map +1 -1
  22. package/runtime/router.js +10 -8
  23. package/runtime/toaster.d.ts.map +1 -1
  24. package/runtime/toaster.js +15 -7
  25. package/runtime/ui.d.ts +3 -0
  26. package/runtime/ui.d.ts.map +1 -1
  27. package/runtime/ui.js +12 -1
  28. package/src/records.ts +9 -1
  29. package/src/runtime/before.ts +71 -34
  30. package/src/runtime/conversations.ts +26 -8
  31. package/src/runtime/lifecycle.ts +31 -35
  32. package/src/runtime/programs.ts +12 -1
  33. package/src/runtime/router.ts +11 -9
  34. package/src/runtime/toaster.ts +15 -7
  35. package/src/runtime/ui.ts +11 -1
  36. package/src/testing/fake-elements.ts +22 -3
  37. package/src/testing.ts +67 -8
  38. package/src/ui/elements.ts +11 -0
  39. package/src/ui/panes.ts +2 -0
  40. package/testing/fake-elements.d.ts +1 -0
  41. package/testing/fake-elements.d.ts.map +1 -1
  42. package/testing/fake-elements.js +22 -3
  43. package/testing.d.ts +1 -0
  44. package/testing.d.ts.map +1 -1
  45. package/testing.js +76 -8
  46. package/ui/elements.d.ts +1 -0
  47. package/ui/elements.d.ts.map +1 -1
  48. package/ui/elements.js +12 -0
  49. package/ui/panes.d.ts +2 -0
  50. package/ui/panes.d.ts.map +1 -1
  51. package/vendor-markdown.js +4 -8698
  52. package/vendor.js +7 -3384
package/vendor.js CHANGED
@@ -1,3385 +1,8 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- function __accessProp(key) {
7
- return this[key];
8
- }
9
- var __toESMCache_node;
10
- var __toESMCache_esm;
11
- var __toESM = (mod, isNodeMode, target) => {
12
- var canCache = mod != null && typeof mod === "object";
13
- if (canCache) {
14
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
- var cached = cache.get(mod);
16
- if (cached)
17
- return cached;
18
- }
19
- target = mod != null ? __create(__getProtoOf(mod)) : {};
20
- const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
21
- if (mod && typeof mod === "object" || typeof mod === "function") {
22
- for (let key of __getOwnPropNames(mod))
23
- if (!__hasOwnProp.call(to, key))
24
- __defProp(to, key, {
25
- get: __accessProp.bind(mod, key),
26
- enumerable: true
27
- });
28
- }
29
- if (canCache)
30
- cache.set(mod, to);
31
- return to;
32
- };
33
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
-
35
- // node_modules/picomatch/lib/constants.js
36
- var require_constants = __commonJS(function(exports, module) {
37
- var WIN_SLASH = "\\\\/";
38
- var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
39
- var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
40
- var DOT_LITERAL = "\\.";
41
- var PLUS_LITERAL = "\\+";
42
- var QMARK_LITERAL = "\\?";
43
- var SLASH_LITERAL = "\\/";
44
- var ONE_CHAR = "(?=.)";
45
- var QMARK = "[^/]";
46
- var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
47
- var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
48
- var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
49
- var NO_DOT = `(?!${DOT_LITERAL})`;
50
- var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
51
- var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
52
- var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
53
- var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
54
- var STAR = `${QMARK}*?`;
55
- var SEP = "/";
56
- var POSIX_CHARS = {
57
- DOT_LITERAL,
58
- PLUS_LITERAL,
59
- QMARK_LITERAL,
60
- SLASH_LITERAL,
61
- ONE_CHAR,
62
- QMARK,
63
- END_ANCHOR,
64
- DOTS_SLASH,
65
- NO_DOT,
66
- NO_DOTS,
67
- NO_DOT_SLASH,
68
- NO_DOTS_SLASH,
69
- QMARK_NO_DOT,
70
- STAR,
71
- START_ANCHOR,
72
- SEP
73
- };
74
- var 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
- var POSIX_REGEX_SOURCE = {
90
- __proto__: null,
91
- alnum: "a-zA-Z0-9",
92
- alpha: "a-zA-Z",
93
- ascii: "\\x00-\\x7F",
94
- blank: " \\t",
95
- cntrl: "\\x00-\\x1F\\x7F",
96
- digit: "0-9",
97
- graph: "\\x21-\\x7E",
98
- lower: "a-z",
99
- print: "\\x20-\\x7E ",
100
- punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
101
- space: " \\t\\r\\n\\v\\f",
102
- upper: "A-Z",
103
- word: "A-Za-z0-9_",
104
- xdigit: "A-Fa-f0-9"
105
- };
106
- module.exports = {
107
- DEFAULT_MAX_EXTGLOB_RECURSION,
108
- MAX_LENGTH: 1024 * 64,
109
- POSIX_REGEX_SOURCE,
110
- REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
111
- REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
112
- REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
113
- REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
114
- REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
115
- REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
116
- REPLACEMENTS: {
117
- __proto__: null,
118
- "***": "*",
119
- "**/**": "**",
120
- "**/**/**": "**"
121
- },
122
- CHAR_0: 48,
123
- CHAR_9: 57,
124
- CHAR_UPPERCASE_A: 65,
125
- CHAR_LOWERCASE_A: 97,
126
- CHAR_UPPERCASE_Z: 90,
127
- CHAR_LOWERCASE_Z: 122,
128
- CHAR_LEFT_PARENTHESES: 40,
129
- CHAR_RIGHT_PARENTHESES: 41,
130
- CHAR_ASTERISK: 42,
131
- CHAR_AMPERSAND: 38,
132
- CHAR_AT: 64,
133
- CHAR_BACKWARD_SLASH: 92,
134
- CHAR_CARRIAGE_RETURN: 13,
135
- CHAR_CIRCUMFLEX_ACCENT: 94,
136
- CHAR_COLON: 58,
137
- CHAR_COMMA: 44,
138
- CHAR_DOT: 46,
139
- CHAR_DOUBLE_QUOTE: 34,
140
- CHAR_EQUAL: 61,
141
- CHAR_EXCLAMATION_MARK: 33,
142
- CHAR_FORM_FEED: 12,
143
- CHAR_FORWARD_SLASH: 47,
144
- CHAR_GRAVE_ACCENT: 96,
145
- CHAR_HASH: 35,
146
- CHAR_HYPHEN_MINUS: 45,
147
- CHAR_LEFT_ANGLE_BRACKET: 60,
148
- CHAR_LEFT_CURLY_BRACE: 123,
149
- CHAR_LEFT_SQUARE_BRACKET: 91,
150
- CHAR_LINE_FEED: 10,
151
- CHAR_NO_BREAK_SPACE: 160,
152
- CHAR_PERCENT: 37,
153
- CHAR_PLUS: 43,
154
- CHAR_QUESTION_MARK: 63,
155
- CHAR_RIGHT_ANGLE_BRACKET: 62,
156
- CHAR_RIGHT_CURLY_BRACE: 125,
157
- CHAR_RIGHT_SQUARE_BRACKET: 93,
158
- CHAR_SEMICOLON: 59,
159
- CHAR_SINGLE_QUOTE: 39,
160
- CHAR_SPACE: 32,
161
- CHAR_TAB: 9,
162
- CHAR_UNDERSCORE: 95,
163
- CHAR_VERTICAL_LINE: 124,
164
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
165
- extglobChars(chars) {
166
- return {
167
- "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
168
- "?": { type: "qmark", open: "(?:", close: ")?" },
169
- "+": { type: "plus", open: "(?:", close: ")+" },
170
- "*": { type: "star", open: "(?:", close: ")*" },
171
- "@": { type: "at", open: "(?:", close: ")" }
172
- };
173
- },
174
- globChars(win32) {
175
- return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
176
- }
177
- };
178
- });
179
-
180
- // node_modules/picomatch/lib/utils.js
181
- var require_utils = __commonJS(function(exports) {
182
- var {
183
- REGEX_BACKSLASH,
184
- REGEX_REMOVE_BACKSLASH,
185
- REGEX_SPECIAL_CHARS,
186
- REGEX_SPECIAL_CHARS_GLOBAL
187
- } = require_constants();
188
- exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
189
- exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
190
- exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
191
- exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
192
- exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
193
- exports.isWindows = () => {
194
- if (typeof navigator !== "undefined" && navigator.platform) {
195
- const platform = navigator.platform.toLowerCase();
196
- return platform === "win32" || platform === "windows";
197
- }
198
- if (false) {}
199
- return false;
200
- };
201
- exports.removeBackslashes = (str) => {
202
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
203
- return match === "\\" ? "" : match;
204
- });
205
- };
206
- exports.escapeLast = (input, char, lastIdx) => {
207
- const idx = input.lastIndexOf(char, lastIdx);
208
- if (idx === -1)
209
- return input;
210
- if (input[idx - 1] === "\\")
211
- return exports.escapeLast(input, char, idx - 1);
212
- return `${input.slice(0, idx)}\\${input.slice(idx)}`;
213
- };
214
- exports.removePrefix = (input, state = {}) => {
215
- let output = input;
216
- if (output.startsWith("./")) {
217
- output = output.slice(2);
218
- state.prefix = "./";
219
- }
220
- return output;
221
- };
222
- exports.wrapOutput = (input, state = {}, options = {}) => {
223
- const prepend = options.contains ? "" : "^";
224
- const append = options.contains ? "" : "$";
225
- let output = `${prepend}(?:${input})${append}`;
226
- if (state.negated === true) {
227
- output = `(?:^(?!${output}).*$)`;
228
- }
229
- return output;
230
- };
231
- exports.basename = (path, { windows } = {}) => {
232
- const segs = path.split(windows ? /[\\/]/ : "/");
233
- const last = segs[segs.length - 1];
234
- if (last === "") {
235
- return segs[segs.length - 2];
236
- }
237
- return last;
238
- };
239
- });
240
-
241
- // node_modules/picomatch/lib/scan.js
242
- var require_scan = __commonJS(function(exports, module) {
243
- var utils = require_utils();
244
- var {
245
- CHAR_ASTERISK,
246
- CHAR_AT,
247
- CHAR_BACKWARD_SLASH,
248
- CHAR_COMMA,
249
- CHAR_DOT,
250
- CHAR_EXCLAMATION_MARK,
251
- CHAR_FORWARD_SLASH,
252
- CHAR_LEFT_CURLY_BRACE,
253
- CHAR_LEFT_PARENTHESES,
254
- CHAR_LEFT_SQUARE_BRACKET,
255
- CHAR_PLUS,
256
- CHAR_QUESTION_MARK,
257
- CHAR_RIGHT_CURLY_BRACE,
258
- CHAR_RIGHT_PARENTHESES,
259
- CHAR_RIGHT_SQUARE_BRACKET
260
- } = require_constants();
261
- var isPathSeparator = (code) => {
262
- return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
263
- };
264
- var depth = (token) => {
265
- if (token.isPrefix !== true) {
266
- token.depth = token.isGlobstar ? Infinity : 1;
267
- }
268
- };
269
- var scan = (input, options) => {
270
- const opts = options || {};
271
- const length = input.length - 1;
272
- const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
273
- const slashes = [];
274
- const tokens = [];
275
- const parts = [];
276
- let str = input;
277
- let index = -1;
278
- let start = 0;
279
- let lastIndex = 0;
280
- let isBrace = false;
281
- let isBracket = false;
282
- let isGlob = false;
283
- let isExtglob = false;
284
- let isGlobstar = false;
285
- let braceEscaped = false;
286
- let backslashes = false;
287
- let negated = false;
288
- let negatedExtglob = false;
289
- let finished = false;
290
- let braces = 0;
291
- let prev;
292
- let code;
293
- let token = { value: "", depth: 0, isGlob: false };
294
- const eos = () => index >= length;
295
- const peek = () => str.charCodeAt(index + 1);
296
- const advance = () => {
297
- prev = code;
298
- return str.charCodeAt(++index);
299
- };
300
- while (index < length) {
301
- code = advance();
302
- let next;
303
- if (code === CHAR_BACKWARD_SLASH) {
304
- backslashes = token.backslashes = true;
305
- code = advance();
306
- if (code === CHAR_LEFT_CURLY_BRACE) {
307
- braceEscaped = true;
308
- }
309
- continue;
310
- }
311
- if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
312
- braces++;
313
- while (eos() !== true && (code = advance())) {
314
- if (code === CHAR_BACKWARD_SLASH) {
315
- backslashes = token.backslashes = true;
316
- advance();
317
- continue;
318
- }
319
- if (code === CHAR_LEFT_CURLY_BRACE) {
320
- braces++;
321
- continue;
322
- }
323
- if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
324
- isBrace = token.isBrace = true;
325
- isGlob = token.isGlob = true;
326
- finished = true;
327
- if (scanToEnd === true) {
328
- continue;
329
- }
330
- break;
331
- }
332
- if (braceEscaped !== true && code === CHAR_COMMA) {
333
- isBrace = token.isBrace = true;
334
- isGlob = token.isGlob = true;
335
- finished = true;
336
- if (scanToEnd === true) {
337
- continue;
338
- }
339
- break;
340
- }
341
- if (code === CHAR_RIGHT_CURLY_BRACE) {
342
- braces--;
343
- if (braces === 0) {
344
- braceEscaped = false;
345
- isBrace = token.isBrace = true;
346
- finished = true;
347
- break;
348
- }
349
- }
350
- }
351
- if (scanToEnd === true) {
352
- continue;
353
- }
354
- break;
355
- }
356
- if (code === CHAR_FORWARD_SLASH) {
357
- slashes.push(index);
358
- tokens.push(token);
359
- token = { value: "", depth: 0, isGlob: false };
360
- if (finished === true)
361
- continue;
362
- if (prev === CHAR_DOT && index === start + 1) {
363
- start += 2;
364
- continue;
365
- }
366
- lastIndex = index + 1;
367
- continue;
368
- }
369
- if (opts.noext !== true) {
370
- const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
371
- if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
372
- isGlob = token.isGlob = true;
373
- isExtglob = token.isExtglob = true;
374
- finished = true;
375
- if (code === CHAR_EXCLAMATION_MARK && index === start) {
376
- negatedExtglob = true;
377
- }
378
- if (scanToEnd === true) {
379
- let parens = 0;
380
- while (eos() !== true && (code = advance())) {
381
- if (code === CHAR_BACKWARD_SLASH) {
382
- backslashes = token.backslashes = true;
383
- advance();
384
- continue;
385
- }
386
- if (code === CHAR_LEFT_PARENTHESES) {
387
- parens++;
388
- continue;
389
- }
390
- if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
391
- finished = true;
392
- break;
393
- }
394
- }
395
- continue;
396
- }
397
- break;
398
- }
399
- }
400
- if (code === CHAR_ASTERISK) {
401
- if (prev === CHAR_ASTERISK)
402
- isGlobstar = token.isGlobstar = true;
403
- isGlob = token.isGlob = true;
404
- finished = true;
405
- if (scanToEnd === true) {
406
- continue;
407
- }
408
- break;
409
- }
410
- if (code === CHAR_QUESTION_MARK) {
411
- isGlob = token.isGlob = true;
412
- finished = true;
413
- if (scanToEnd === true) {
414
- continue;
415
- }
416
- break;
417
- }
418
- if (code === CHAR_LEFT_SQUARE_BRACKET) {
419
- while (eos() !== true && (next = advance())) {
420
- if (next === CHAR_BACKWARD_SLASH) {
421
- backslashes = token.backslashes = true;
422
- advance();
423
- continue;
424
- }
425
- if (next === CHAR_RIGHT_SQUARE_BRACKET) {
426
- isBracket = token.isBracket = true;
427
- isGlob = token.isGlob = true;
428
- finished = true;
429
- break;
430
- }
431
- }
432
- if (scanToEnd === true) {
433
- continue;
434
- }
435
- break;
436
- }
437
- if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
438
- negated = token.negated = true;
439
- start++;
440
- continue;
441
- }
442
- if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
443
- isGlob = token.isGlob = true;
444
- if (scanToEnd === true) {
445
- let parens = 1;
446
- while (eos() !== true && (code = advance())) {
447
- if (code === CHAR_BACKWARD_SLASH) {
448
- backslashes = token.backslashes = true;
449
- advance();
450
- continue;
451
- }
452
- if (code === CHAR_LEFT_PARENTHESES) {
453
- parens++;
454
- continue;
455
- }
456
- if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
457
- finished = true;
458
- break;
459
- }
460
- }
461
- continue;
462
- }
463
- break;
464
- }
465
- if (isGlob === true) {
466
- finished = true;
467
- if (scanToEnd === true) {
468
- continue;
469
- }
470
- break;
471
- }
472
- }
473
- if (opts.noext === true) {
474
- isExtglob = false;
475
- isGlob = false;
476
- }
477
- let base = str;
478
- let prefix = "";
479
- let glob = "";
480
- if (start > 0) {
481
- prefix = str.slice(0, start);
482
- str = str.slice(start);
483
- lastIndex -= start;
484
- }
485
- if (base && isGlob === true && lastIndex > 0) {
486
- base = str.slice(0, lastIndex);
487
- glob = str.slice(lastIndex);
488
- } else if (isGlob === true) {
489
- base = "";
490
- glob = str;
491
- } else {
492
- base = str;
493
- }
494
- if (base && base !== "" && base !== "/" && base !== str) {
495
- if (isPathSeparator(base.charCodeAt(base.length - 1))) {
496
- base = base.slice(0, -1);
497
- }
498
- }
499
- if (opts.unescape === true) {
500
- if (glob)
501
- glob = utils.removeBackslashes(glob);
502
- if (base && backslashes === true) {
503
- base = utils.removeBackslashes(base);
504
- }
505
- }
506
- const state = {
507
- prefix,
508
- input,
509
- start,
510
- base,
511
- glob,
512
- isBrace,
513
- isBracket,
514
- isGlob,
515
- isExtglob,
516
- isGlobstar,
517
- negated,
518
- negatedExtglob
519
- };
520
- if (opts.tokens === true) {
521
- state.maxDepth = 0;
522
- if (!isPathSeparator(code)) {
523
- tokens.push(token);
524
- }
525
- state.tokens = tokens;
526
- }
527
- if (opts.parts === true || opts.tokens === true) {
528
- let prevIndex;
529
- for (let idx = 0;idx < slashes.length; idx++) {
530
- const n = prevIndex !== undefined ? prevIndex + 1 : start;
531
- const i = slashes[idx];
532
- const value = input.slice(n, i);
533
- if (opts.tokens) {
534
- if (idx === 0 && start !== 0) {
535
- tokens[idx].isPrefix = true;
536
- tokens[idx].value = prefix;
537
- } else {
538
- tokens[idx].value = value;
539
- }
540
- depth(tokens[idx]);
541
- state.maxDepth += tokens[idx].depth;
542
- }
543
- if (i >= start) {
544
- parts.push(value);
545
- prevIndex = i;
546
- }
547
- }
548
- const n = prevIndex !== undefined ? prevIndex + 1 : start;
549
- const value = input.slice(n);
550
- parts.push(value);
551
- if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
552
- tokens[tokens.length - 1].value = value;
553
- depth(tokens[tokens.length - 1]);
554
- state.maxDepth += tokens[tokens.length - 1].depth;
555
- }
556
- state.slashes = slashes;
557
- state.parts = parts;
558
- }
559
- return state;
560
- };
561
- module.exports = scan;
562
- });
563
-
564
- // node_modules/picomatch/lib/parse.js
565
- var require_parse = __commonJS(function(exports, module) {
566
- var constants = require_constants();
567
- var utils = require_utils();
568
- var {
569
- MAX_LENGTH,
570
- POSIX_REGEX_SOURCE,
571
- REGEX_NON_SPECIAL_CHARS,
572
- REGEX_SPECIAL_CHARS_BACKREF,
573
- REPLACEMENTS
574
- } = constants;
575
- var expandRange = (args, options) => {
576
- if (typeof options.expandRange === "function") {
577
- return options.expandRange(...args, options);
578
- }
579
- args.sort();
580
- const value = `[${args.join("-")}]`;
581
- try {
582
- new RegExp(value);
583
- } catch (ex) {
584
- return args.map((v) => utils.escapeRegex(v)).join("..");
585
- }
586
- return value;
587
- };
588
- var syntaxError = (type, char) => {
589
- return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
590
- };
591
- var splitTopLevel = (input) => {
592
- const parts = [];
593
- let bracket = 0;
594
- let paren = 0;
595
- let quote = 0;
596
- let value = "";
597
- let escaped = false;
598
- for (const ch of input) {
599
- if (escaped === true) {
600
- value += ch;
601
- escaped = false;
602
- continue;
603
- }
604
- if (ch === "\\") {
605
- value += ch;
606
- escaped = true;
607
- continue;
608
- }
609
- if (ch === '"') {
610
- quote = quote === 1 ? 0 : 1;
611
- value += ch;
612
- continue;
613
- }
614
- if (quote === 0) {
615
- if (ch === "[") {
616
- bracket++;
617
- } else if (ch === "]" && bracket > 0) {
618
- bracket--;
619
- } else if (bracket === 0) {
620
- if (ch === "(") {
621
- paren++;
622
- } else if (ch === ")" && paren > 0) {
623
- paren--;
624
- } else if (ch === "|" && paren === 0) {
625
- parts.push(value);
626
- value = "";
627
- continue;
628
- }
629
- }
630
- }
631
- value += ch;
632
- }
633
- parts.push(value);
634
- return parts;
635
- };
636
- var isPlainBranch = (branch) => {
637
- let escaped = false;
638
- for (const ch of branch) {
639
- if (escaped === true) {
640
- escaped = false;
641
- continue;
642
- }
643
- if (ch === "\\") {
644
- escaped = true;
645
- continue;
646
- }
647
- if (/[?*+@!()[\]{}]/.test(ch)) {
648
- return false;
649
- }
650
- }
651
- return true;
652
- };
653
- var normalizeSimpleBranch = (branch) => {
654
- let value = branch.trim();
655
- let changed = true;
656
- while (changed === true) {
657
- changed = false;
658
- if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
659
- value = value.slice(2, -1);
660
- changed = true;
661
- }
662
- }
663
- if (!isPlainBranch(value)) {
664
- return;
665
- }
666
- return value.replace(/\\(.)/g, "$1");
667
- };
668
- var hasRepeatedCharPrefixOverlap = (branches) => {
669
- const values = branches.map(normalizeSimpleBranch).filter(Boolean);
670
- for (let i = 0;i < values.length; i++) {
671
- for (let j = i + 1;j < values.length; j++) {
672
- const a = values[i];
673
- const b = values[j];
674
- const char = a[0];
675
- if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
676
- continue;
677
- }
678
- if (a === b || a.startsWith(b) || b.startsWith(a)) {
679
- return true;
680
- }
681
- }
682
- }
683
- return false;
684
- };
685
- var parseRepeatedExtglob = (pattern, requireEnd = true) => {
686
- if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
687
- return;
688
- }
689
- let bracket = 0;
690
- let paren = 0;
691
- let quote = 0;
692
- let escaped = false;
693
- for (let i = 1;i < pattern.length; i++) {
694
- const ch = pattern[i];
695
- if (escaped === true) {
696
- escaped = false;
697
- continue;
698
- }
699
- if (ch === "\\") {
700
- escaped = true;
701
- continue;
702
- }
703
- if (ch === '"') {
704
- quote = quote === 1 ? 0 : 1;
705
- continue;
706
- }
707
- if (quote === 1) {
708
- continue;
709
- }
710
- if (ch === "[") {
711
- bracket++;
712
- continue;
713
- }
714
- if (ch === "]" && bracket > 0) {
715
- bracket--;
716
- continue;
717
- }
718
- if (bracket > 0) {
719
- continue;
720
- }
721
- if (ch === "(") {
722
- paren++;
723
- continue;
724
- }
725
- if (ch === ")") {
726
- paren--;
727
- if (paren === 0) {
728
- if (requireEnd === true && i !== pattern.length - 1) {
729
- return;
730
- }
731
- return {
732
- type: pattern[0],
733
- body: pattern.slice(2, i),
734
- end: i
735
- };
736
- }
737
- }
738
- }
739
- };
740
- var buildCharClassStar = (chars) => {
741
- const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
742
- return `${source}*`;
743
- };
744
- var getStarExtglobSequenceChars = (pattern) => {
745
- let index = 0;
746
- const chars = [];
747
- while (index < pattern.length) {
748
- const match = parseRepeatedExtglob(pattern.slice(index), false);
749
- if (!match || match.type !== "*") {
750
- return;
751
- }
752
- const branches = splitTopLevel(match.body).map((branch) => branch.trim());
753
- if (branches.length !== 1) {
754
- return;
755
- }
756
- const branch = normalizeSimpleBranch(branches[0]);
757
- if (!branch || branch.length !== 1) {
758
- return;
759
- }
760
- chars.push(branch);
761
- index += match.end + 1;
762
- }
763
- if (chars.length < 1) {
764
- return;
765
- }
766
- return chars;
767
- };
768
- var repeatedExtglobRecursion = (pattern) => {
769
- let depth = 0;
770
- let value = pattern.trim();
771
- let match = parseRepeatedExtglob(value);
772
- while (match) {
773
- depth++;
774
- value = match.body.trim();
775
- match = parseRepeatedExtglob(value);
776
- }
777
- return depth;
778
- };
779
- var analyzeRepeatedExtglob = (body, options) => {
780
- if (options.maxExtglobRecursion === false) {
781
- return { risky: false };
782
- }
783
- const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
784
- const branches = splitTopLevel(body).map((branch) => branch.trim());
785
- if (branches.length > 1) {
786
- if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
787
- return { risky: true };
788
- }
789
- }
790
- const safeChars = [];
791
- let sawStarSequence = false;
792
- let combinable = true;
793
- for (const branch of branches) {
794
- const chars = getStarExtglobSequenceChars(branch);
795
- if (chars) {
796
- sawStarSequence = true;
797
- safeChars.push(...chars);
798
- continue;
799
- }
800
- const literal = normalizeSimpleBranch(branch);
801
- if (literal && literal.length === 1) {
802
- safeChars.push(literal);
803
- continue;
804
- }
805
- combinable = false;
806
- if (repeatedExtglobRecursion(branch) > max) {
807
- return { risky: true };
808
- }
809
- }
810
- if (sawStarSequence) {
811
- return combinable ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) } : { risky: true };
812
- }
813
- return { risky: false };
814
- };
815
- var parse = (input, options) => {
816
- if (typeof input !== "string") {
817
- throw new TypeError("Expected a string");
818
- }
819
- input = REPLACEMENTS[input] || input;
820
- const opts = { ...options };
821
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
822
- let len = input.length;
823
- if (len > max) {
824
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
825
- }
826
- const bos = { type: "bos", value: "", output: opts.prepend || "" };
827
- const tokens = [bos];
828
- const capture = opts.capture ? "" : "?:";
829
- const PLATFORM_CHARS = constants.globChars(opts.windows);
830
- const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
831
- const {
832
- DOT_LITERAL,
833
- PLUS_LITERAL,
834
- SLASH_LITERAL,
835
- ONE_CHAR,
836
- DOTS_SLASH,
837
- NO_DOT,
838
- NO_DOT_SLASH,
839
- NO_DOTS_SLASH,
840
- QMARK,
841
- QMARK_NO_DOT,
842
- STAR,
843
- START_ANCHOR
844
- } = PLATFORM_CHARS;
845
- const globstar = (opts) => {
846
- return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
847
- };
848
- const nodot = opts.dot ? "" : NO_DOT;
849
- const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
850
- let star = opts.bash === true ? globstar(opts) : STAR;
851
- if (opts.capture) {
852
- star = `(${star})`;
853
- }
854
- if (typeof opts.noext === "boolean") {
855
- opts.noextglob = opts.noext;
856
- }
857
- const state = {
858
- input,
859
- index: -1,
860
- start: 0,
861
- dot: opts.dot === true,
862
- consumed: "",
863
- output: "",
864
- prefix: "",
865
- backtrack: false,
866
- negated: false,
867
- brackets: 0,
868
- braces: 0,
869
- parens: 0,
870
- quotes: 0,
871
- globstar: false,
872
- tokens
873
- };
874
- input = utils.removePrefix(input, state);
875
- len = input.length;
876
- const extglobs = [];
877
- const braces = [];
878
- const stack = [];
879
- let prev = bos;
880
- let value;
881
- const eos = () => state.index === len - 1;
882
- const peek = state.peek = (n = 1) => input[state.index + n];
883
- const advance = state.advance = () => input[++state.index] || "";
884
- const remaining = () => input.slice(state.index + 1);
885
- const consume = (value = "", num = 0) => {
886
- state.consumed += value;
887
- state.index += num;
888
- };
889
- const append = (token) => {
890
- state.output += token.output != null ? token.output : token.value;
891
- consume(token.value);
892
- };
893
- const negate = () => {
894
- let count = 1;
895
- while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
896
- advance();
897
- state.start++;
898
- count++;
899
- }
900
- if (count % 2 === 0) {
901
- return false;
902
- }
903
- state.negated = true;
904
- state.start++;
905
- return true;
906
- };
907
- const increment = (type) => {
908
- state[type]++;
909
- stack.push(type);
910
- };
911
- const decrement = (type) => {
912
- state[type]--;
913
- stack.pop();
914
- };
915
- const push = (tok) => {
916
- if (prev.type === "globstar") {
917
- const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
918
- const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
919
- if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
920
- state.output = state.output.slice(0, -prev.output.length);
921
- prev.type = "star";
922
- prev.value = "*";
923
- prev.output = star;
924
- state.output += prev.output;
925
- }
926
- }
927
- if (extglobs.length && tok.type !== "paren") {
928
- extglobs[extglobs.length - 1].inner += tok.value;
929
- }
930
- if (tok.value || tok.output)
931
- append(tok);
932
- if (prev && prev.type === "text" && tok.type === "text") {
933
- prev.output = (prev.output || prev.value) + tok.value;
934
- prev.value += tok.value;
935
- return;
936
- }
937
- tok.prev = prev;
938
- tokens.push(tok);
939
- prev = tok;
940
- };
941
- const extglobOpen = (type, value) => {
942
- const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: "" };
943
- token.prev = prev;
944
- token.parens = state.parens;
945
- token.output = state.output;
946
- token.startIndex = state.index;
947
- token.tokensIndex = tokens.length;
948
- const output = (opts.capture ? "(" : "") + token.open;
949
- increment("parens");
950
- push({ type, value, output: state.output ? "" : ONE_CHAR });
951
- push({ type: "paren", extglob: true, value: advance(), output });
952
- extglobs.push(token);
953
- };
954
- const extglobClose = (token) => {
955
- const literal = input.slice(token.startIndex, state.index + 1);
956
- const body = input.slice(token.startIndex + 2, state.index);
957
- const analysis = analyzeRepeatedExtglob(body, opts);
958
- if ((token.type === "plus" || token.type === "star") && analysis.risky) {
959
- const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : undefined;
960
- const open = tokens[token.tokensIndex];
961
- open.type = "text";
962
- open.value = literal;
963
- open.output = safeOutput || utils.escapeRegex(literal);
964
- for (let i = token.tokensIndex + 1;i < tokens.length; i++) {
965
- tokens[i].value = "";
966
- tokens[i].output = "";
967
- delete tokens[i].suffix;
968
- }
969
- state.output = token.output + open.output;
970
- state.backtrack = true;
971
- push({ type: "paren", extglob: true, value, output: "" });
972
- decrement("parens");
973
- return;
974
- }
975
- let output = token.close + (opts.capture ? ")" : "");
976
- let rest;
977
- if (token.type === "negate") {
978
- let extglobStar = star;
979
- if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
980
- extglobStar = globstar(opts);
981
- }
982
- if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
983
- output = token.close = `)$))${extglobStar}`;
984
- }
985
- if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
986
- const expression = parse(rest, { ...options, fastpaths: false }).output;
987
- output = token.close = `)${expression})${extglobStar})`;
988
- }
989
- if (token.prev.type === "bos") {
990
- state.negatedExtglob = true;
991
- }
992
- }
993
- push({ type: "paren", extglob: true, value, output });
994
- decrement("parens");
995
- };
996
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
997
- let backslashes = false;
998
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
999
- if (first === "\\") {
1000
- backslashes = true;
1001
- return m;
1002
- }
1003
- if (first === "?") {
1004
- if (esc) {
1005
- return esc + first + (rest ? QMARK.repeat(rest.length) : "");
1006
- }
1007
- if (index === 0) {
1008
- return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
1009
- }
1010
- return QMARK.repeat(chars.length);
1011
- }
1012
- if (first === ".") {
1013
- return DOT_LITERAL.repeat(chars.length);
1014
- }
1015
- if (first === "*") {
1016
- if (esc) {
1017
- return esc + first + (rest ? star : "");
1018
- }
1019
- return star;
1020
- }
1021
- return esc ? m : `\\${m}`;
1022
- });
1023
- if (backslashes === true) {
1024
- if (opts.unescape === true) {
1025
- output = output.replace(/\\/g, "");
1026
- } else {
1027
- output = output.replace(/\\+/g, (m) => {
1028
- return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
1029
- });
1030
- }
1031
- }
1032
- if (output === input && opts.contains === true) {
1033
- state.output = input;
1034
- return state;
1035
- }
1036
- state.output = utils.wrapOutput(output, state, options);
1037
- return state;
1038
- }
1039
- while (!eos()) {
1040
- value = advance();
1041
- if (value === "\x00") {
1042
- continue;
1043
- }
1044
- if (value === "\\") {
1045
- const next = peek();
1046
- if (next === "/" && opts.bash !== true) {
1047
- continue;
1048
- }
1049
- if (next === "." || next === ";") {
1050
- continue;
1051
- }
1052
- if (!next) {
1053
- value += "\\";
1054
- push({ type: "text", value });
1055
- continue;
1056
- }
1057
- const match = /^\\+/.exec(remaining());
1058
- let slashes = 0;
1059
- if (match && match[0].length > 2) {
1060
- slashes = match[0].length;
1061
- state.index += slashes;
1062
- if (slashes % 2 !== 0) {
1063
- value += "\\";
1064
- }
1065
- }
1066
- if (opts.unescape === true) {
1067
- value = advance();
1068
- } else {
1069
- value += advance();
1070
- }
1071
- if (state.brackets === 0) {
1072
- push({ type: "text", value });
1073
- continue;
1074
- }
1075
- }
1076
- if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
1077
- if (opts.posix !== false && value === ":") {
1078
- const inner = prev.value.slice(1);
1079
- if (inner.includes("[")) {
1080
- prev.posix = true;
1081
- if (inner.includes(":")) {
1082
- const idx = prev.value.lastIndexOf("[");
1083
- const pre = prev.value.slice(0, idx);
1084
- const rest = prev.value.slice(idx + 2);
1085
- const posix = POSIX_REGEX_SOURCE[rest];
1086
- if (posix) {
1087
- prev.value = pre + posix;
1088
- state.backtrack = true;
1089
- advance();
1090
- if (!bos.output && tokens.indexOf(prev) === 1) {
1091
- bos.output = ONE_CHAR;
1092
- }
1093
- continue;
1094
- }
1095
- }
1096
- }
1097
- }
1098
- if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
1099
- value = `\\${value}`;
1100
- }
1101
- if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
1102
- value = `\\${value}`;
1103
- }
1104
- if (opts.posix === true && value === "!" && prev.value === "[") {
1105
- value = "^";
1106
- }
1107
- prev.value += value;
1108
- append({ value });
1109
- continue;
1110
- }
1111
- if (state.quotes === 1 && value !== '"') {
1112
- value = utils.escapeRegex(value);
1113
- prev.value += value;
1114
- append({ value });
1115
- continue;
1116
- }
1117
- if (value === '"') {
1118
- state.quotes = state.quotes === 1 ? 0 : 1;
1119
- if (opts.keepQuotes === true) {
1120
- push({ type: "text", value });
1121
- }
1122
- continue;
1123
- }
1124
- if (value === "(") {
1125
- increment("parens");
1126
- push({ type: "paren", value });
1127
- continue;
1128
- }
1129
- if (value === ")") {
1130
- if (state.parens === 0 && opts.strictBrackets === true) {
1131
- throw new SyntaxError(syntaxError("opening", "("));
1132
- }
1133
- const extglob = extglobs[extglobs.length - 1];
1134
- if (extglob && state.parens === extglob.parens + 1) {
1135
- extglobClose(extglobs.pop());
1136
- continue;
1137
- }
1138
- push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
1139
- decrement("parens");
1140
- continue;
1141
- }
1142
- if (value === "[") {
1143
- if (opts.nobracket === true || !remaining().includes("]")) {
1144
- if (opts.nobracket !== true && opts.strictBrackets === true) {
1145
- throw new SyntaxError(syntaxError("closing", "]"));
1146
- }
1147
- value = `\\${value}`;
1148
- } else {
1149
- increment("brackets");
1150
- }
1151
- push({ type: "bracket", value });
1152
- continue;
1153
- }
1154
- if (value === "]") {
1155
- if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
1156
- push({ type: "text", value, output: `\\${value}` });
1157
- continue;
1158
- }
1159
- if (state.brackets === 0) {
1160
- if (opts.strictBrackets === true) {
1161
- throw new SyntaxError(syntaxError("opening", "["));
1162
- }
1163
- push({ type: "text", value, output: `\\${value}` });
1164
- continue;
1165
- }
1166
- decrement("brackets");
1167
- const prevValue = prev.value.slice(1);
1168
- if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
1169
- value = `/${value}`;
1170
- }
1171
- prev.value += value;
1172
- append({ value });
1173
- if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
1174
- continue;
1175
- }
1176
- const escaped = utils.escapeRegex(prev.value);
1177
- state.output = state.output.slice(0, -prev.value.length);
1178
- if (opts.literalBrackets === true) {
1179
- state.output += escaped;
1180
- prev.value = escaped;
1181
- continue;
1182
- }
1183
- prev.value = `(${capture}${escaped}|${prev.value})`;
1184
- state.output += prev.value;
1185
- continue;
1186
- }
1187
- if (value === "{" && opts.nobrace !== true) {
1188
- increment("braces");
1189
- const open = {
1190
- type: "brace",
1191
- value,
1192
- output: "(",
1193
- outputIndex: state.output.length,
1194
- tokensIndex: state.tokens.length
1195
- };
1196
- braces.push(open);
1197
- push(open);
1198
- continue;
1199
- }
1200
- if (value === "}") {
1201
- const brace = braces[braces.length - 1];
1202
- if (opts.nobrace === true || !brace) {
1203
- push({ type: "text", value, output: value });
1204
- continue;
1205
- }
1206
- let output = ")";
1207
- if (brace.dots === true) {
1208
- const arr = tokens.slice();
1209
- const range = [];
1210
- for (let i = arr.length - 1;i >= 0; i--) {
1211
- tokens.pop();
1212
- if (arr[i].type === "brace") {
1213
- break;
1214
- }
1215
- if (arr[i].type !== "dots") {
1216
- range.unshift(arr[i].value);
1217
- }
1218
- }
1219
- output = expandRange(range, opts);
1220
- state.backtrack = true;
1221
- }
1222
- if (brace.comma !== true && brace.dots !== true) {
1223
- const out = state.output.slice(0, brace.outputIndex);
1224
- const toks = state.tokens.slice(brace.tokensIndex);
1225
- brace.value = brace.output = "\\{";
1226
- value = output = "\\}";
1227
- state.output = out;
1228
- for (const t of toks) {
1229
- state.output += t.output || t.value;
1230
- }
1231
- }
1232
- push({ type: "brace", value, output });
1233
- decrement("braces");
1234
- braces.pop();
1235
- continue;
1236
- }
1237
- if (value === "|") {
1238
- if (extglobs.length > 0) {
1239
- extglobs[extglobs.length - 1].conditions++;
1240
- }
1241
- push({ type: "text", value });
1242
- continue;
1243
- }
1244
- if (value === ",") {
1245
- let output = value;
1246
- const brace = braces[braces.length - 1];
1247
- if (brace && stack[stack.length - 1] === "braces") {
1248
- brace.comma = true;
1249
- output = "|";
1250
- }
1251
- push({ type: "comma", value, output });
1252
- continue;
1253
- }
1254
- if (value === "/") {
1255
- if (prev.type === "dot" && state.index === state.start + 1) {
1256
- state.start = state.index + 1;
1257
- state.consumed = "";
1258
- state.output = "";
1259
- tokens.pop();
1260
- prev = bos;
1261
- continue;
1262
- }
1263
- push({ type: "slash", value, output: SLASH_LITERAL });
1264
- continue;
1265
- }
1266
- if (value === ".") {
1267
- if (state.braces > 0 && prev.type === "dot") {
1268
- if (prev.value === ".")
1269
- prev.output = DOT_LITERAL;
1270
- const brace = braces[braces.length - 1];
1271
- prev.type = "dots";
1272
- prev.output += value;
1273
- prev.value += value;
1274
- brace.dots = true;
1275
- continue;
1276
- }
1277
- if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1278
- push({ type: "text", value, output: DOT_LITERAL });
1279
- continue;
1280
- }
1281
- push({ type: "dot", value, output: DOT_LITERAL });
1282
- continue;
1283
- }
1284
- if (value === "?") {
1285
- const isGroup = prev && prev.value === "(";
1286
- if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1287
- extglobOpen("qmark", value);
1288
- continue;
1289
- }
1290
- if (prev && prev.type === "paren") {
1291
- const next = peek();
1292
- let output = value;
1293
- if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
1294
- output = `\\${value}`;
1295
- }
1296
- push({ type: "text", value, output });
1297
- continue;
1298
- }
1299
- if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1300
- push({ type: "qmark", value, output: QMARK_NO_DOT });
1301
- continue;
1302
- }
1303
- push({ type: "qmark", value, output: QMARK });
1304
- continue;
1305
- }
1306
- if (value === "!") {
1307
- if (opts.noextglob !== true && peek() === "(") {
1308
- if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1309
- extglobOpen("negate", value);
1310
- continue;
1311
- }
1312
- }
1313
- if (opts.nonegate !== true && state.index === 0) {
1314
- negate();
1315
- continue;
1316
- }
1317
- }
1318
- if (value === "+") {
1319
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1320
- extglobOpen("plus", value);
1321
- continue;
1322
- }
1323
- if (prev && prev.value === "(" || opts.regex === false) {
1324
- push({ type: "plus", value, output: PLUS_LITERAL });
1325
- continue;
1326
- }
1327
- if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1328
- push({ type: "plus", value });
1329
- continue;
1330
- }
1331
- push({ type: "plus", value: PLUS_LITERAL });
1332
- continue;
1333
- }
1334
- if (value === "@") {
1335
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1336
- push({ type: "at", extglob: true, value, output: "" });
1337
- continue;
1338
- }
1339
- push({ type: "text", value });
1340
- continue;
1341
- }
1342
- if (value !== "*") {
1343
- if (value === "$" || value === "^") {
1344
- value = `\\${value}`;
1345
- }
1346
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1347
- if (match) {
1348
- value += match[0];
1349
- state.index += match[0].length;
1350
- }
1351
- push({ type: "text", value });
1352
- continue;
1353
- }
1354
- if (prev && (prev.type === "globstar" || prev.star === true)) {
1355
- prev.type = "star";
1356
- prev.star = true;
1357
- prev.value += value;
1358
- prev.output = star;
1359
- state.backtrack = true;
1360
- state.globstar = true;
1361
- consume(value);
1362
- continue;
1363
- }
1364
- let rest = remaining();
1365
- if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1366
- extglobOpen("star", value);
1367
- continue;
1368
- }
1369
- if (prev.type === "star") {
1370
- if (opts.noglobstar === true) {
1371
- consume(value);
1372
- continue;
1373
- }
1374
- const prior = prev.prev;
1375
- const before = prior.prev;
1376
- const isStart = prior.type === "slash" || prior.type === "bos";
1377
- const afterStar = before && (before.type === "star" || before.type === "globstar");
1378
- if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1379
- push({ type: "star", value, output: "" });
1380
- continue;
1381
- }
1382
- const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1383
- const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1384
- if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1385
- push({ type: "star", value, output: "" });
1386
- continue;
1387
- }
1388
- while (rest.slice(0, 3) === "/**") {
1389
- const after = input[state.index + 4];
1390
- if (after && after !== "/") {
1391
- break;
1392
- }
1393
- rest = rest.slice(3);
1394
- consume("/**", 3);
1395
- }
1396
- const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
1397
- if (prior.type === "bos" && eos()) {
1398
- prev.type = "globstar";
1399
- prev.value += value;
1400
- prev.output = globstar(opts);
1401
- state.output = prev.output;
1402
- state.globstar = true;
1403
- consume(value);
1404
- continue;
1405
- }
1406
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
1407
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
1408
- prior.output = `(?:${prior.output}`;
1409
- prev.type = "globstar";
1410
- prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1411
- prev.value += value;
1412
- state.globstar = true;
1413
- state.output += prior.output + prev.output;
1414
- consume(value);
1415
- continue;
1416
- }
1417
- if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1418
- const end = rest[1] !== undefined ? "|$" : "";
1419
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
1420
- prior.output = `(?:${prior.output}`;
1421
- prev.type = "globstar";
1422
- prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1423
- prev.value += value;
1424
- state.output += prior.output + prev.output;
1425
- state.globstar = true;
1426
- consume(value + advance());
1427
- push({ type: "slash", value: "/", output: "" });
1428
- continue;
1429
- }
1430
- if (prior.type === "bos" && rest[0] === "/") {
1431
- prev.type = "globstar";
1432
- prev.value += value;
1433
- prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1434
- state.output = prev.output;
1435
- state.globstar = true;
1436
- consume(value + advance());
1437
- push({ type: "slash", value: "/", output: "" });
1438
- continue;
1439
- }
1440
- state.output = state.output.slice(0, -prev.output.length);
1441
- prev.type = "globstar";
1442
- prev.output = globstar(opts);
1443
- prev.value += value;
1444
- state.output += prev.output;
1445
- state.globstar = true;
1446
- consume(value);
1447
- continue;
1448
- }
1449
- const token = { type: "star", value, output: star };
1450
- if (opts.bash === true) {
1451
- token.output = ".*?";
1452
- if (prev.type === "bos" || prev.type === "slash") {
1453
- token.output = nodot + token.output;
1454
- }
1455
- push(token);
1456
- continue;
1457
- }
1458
- if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1459
- token.output = value;
1460
- push(token);
1461
- continue;
1462
- }
1463
- if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1464
- if (prev.type === "dot") {
1465
- state.output += NO_DOT_SLASH;
1466
- prev.output += NO_DOT_SLASH;
1467
- } else if (opts.dot === true) {
1468
- state.output += NO_DOTS_SLASH;
1469
- prev.output += NO_DOTS_SLASH;
1470
- } else {
1471
- state.output += nodot;
1472
- prev.output += nodot;
1473
- }
1474
- if (peek() !== "*") {
1475
- state.output += ONE_CHAR;
1476
- prev.output += ONE_CHAR;
1477
- }
1478
- }
1479
- push(token);
1480
- }
1481
- while (state.brackets > 0) {
1482
- if (opts.strictBrackets === true)
1483
- throw new SyntaxError(syntaxError("closing", "]"));
1484
- state.output = utils.escapeLast(state.output, "[");
1485
- decrement("brackets");
1486
- }
1487
- while (state.parens > 0) {
1488
- if (opts.strictBrackets === true)
1489
- throw new SyntaxError(syntaxError("closing", ")"));
1490
- state.output = utils.escapeLast(state.output, "(");
1491
- decrement("parens");
1492
- }
1493
- while (state.braces > 0) {
1494
- if (opts.strictBrackets === true)
1495
- throw new SyntaxError(syntaxError("closing", "}"));
1496
- state.output = utils.escapeLast(state.output, "{");
1497
- decrement("braces");
1498
- }
1499
- if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
1500
- push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
1501
- }
1502
- if (state.backtrack === true) {
1503
- state.output = "";
1504
- for (const token of state.tokens) {
1505
- state.output += token.output != null ? token.output : token.value;
1506
- if (token.suffix) {
1507
- state.output += token.suffix;
1508
- }
1509
- }
1510
- }
1511
- return state;
1512
- };
1513
- parse.fastpaths = (input, options) => {
1514
- const opts = { ...options };
1515
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1516
- const len = input.length;
1517
- if (len > max) {
1518
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1519
- }
1520
- input = REPLACEMENTS[input] || input;
1521
- const {
1522
- DOT_LITERAL,
1523
- SLASH_LITERAL,
1524
- ONE_CHAR,
1525
- DOTS_SLASH,
1526
- NO_DOT,
1527
- NO_DOTS,
1528
- NO_DOTS_SLASH,
1529
- STAR,
1530
- START_ANCHOR
1531
- } = constants.globChars(opts.windows);
1532
- const nodot = opts.dot ? NO_DOTS : NO_DOT;
1533
- const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1534
- const capture = opts.capture ? "" : "?:";
1535
- const state = { negated: false, prefix: "" };
1536
- let star = opts.bash === true ? ".*?" : STAR;
1537
- if (opts.capture) {
1538
- star = `(${star})`;
1539
- }
1540
- const globstar = (opts) => {
1541
- if (opts.noglobstar === true)
1542
- return star;
1543
- return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1544
- };
1545
- const create = (str) => {
1546
- switch (str) {
1547
- case "*":
1548
- return `${nodot}${ONE_CHAR}${star}`;
1549
- case ".*":
1550
- return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1551
- case "*.*":
1552
- return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1553
- case "*/*":
1554
- return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1555
- case "**":
1556
- return nodot + globstar(opts);
1557
- case "**/*":
1558
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1559
- case "**/*.*":
1560
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1561
- case "**/.*":
1562
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1563
- default: {
1564
- const match = /^(.*?)\.(\w+)$/.exec(str);
1565
- if (!match)
1566
- return;
1567
- const source = create(match[1]);
1568
- if (!source)
1569
- return;
1570
- return source + DOT_LITERAL + match[2];
1571
- }
1572
- }
1573
- };
1574
- const output = utils.removePrefix(input, state);
1575
- let source = create(output);
1576
- if (source && opts.strictSlashes !== true) {
1577
- source += `${SLASH_LITERAL}?`;
1578
- }
1579
- return source;
1580
- };
1581
- module.exports = parse;
1582
- });
1583
-
1584
- // node_modules/picomatch/lib/picomatch.js
1585
- var require_picomatch = __commonJS(function(exports, module) {
1586
- var scan = require_scan();
1587
- var parse = require_parse();
1588
- var utils = require_utils();
1589
- var constants = require_constants();
1590
- var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
1591
- var picomatch = (glob, options, returnState = false) => {
1592
- if (Array.isArray(glob)) {
1593
- const fns = glob.map((input) => picomatch(input, options, returnState));
1594
- const arrayMatcher = (str) => {
1595
- for (const isMatch of fns) {
1596
- const state = isMatch(str);
1597
- if (state)
1598
- return state;
1599
- }
1600
- return false;
1601
- };
1602
- return arrayMatcher;
1603
- }
1604
- const isState = isObject(glob) && glob.tokens && glob.input;
1605
- if (glob === "" || typeof glob !== "string" && !isState) {
1606
- throw new TypeError("Expected pattern to be a non-empty string");
1607
- }
1608
- const opts = options || {};
1609
- const posix = opts.windows;
1610
- const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
1611
- const state = regex.state;
1612
- delete regex.state;
1613
- let isIgnored = () => false;
1614
- if (opts.ignore) {
1615
- const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
1616
- isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1617
- }
1618
- const matcher = (input, returnObject = false) => {
1619
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
1620
- const result = { glob, state, regex, posix, input, output, match, isMatch };
1621
- if (typeof opts.onResult === "function") {
1622
- opts.onResult(result);
1623
- }
1624
- if (isMatch === false) {
1625
- result.isMatch = false;
1626
- return returnObject ? result : false;
1627
- }
1628
- if (isIgnored(input)) {
1629
- if (typeof opts.onIgnore === "function") {
1630
- opts.onIgnore(result);
1631
- }
1632
- result.isMatch = false;
1633
- return returnObject ? result : false;
1634
- }
1635
- if (typeof opts.onMatch === "function") {
1636
- opts.onMatch(result);
1637
- }
1638
- return returnObject ? result : true;
1639
- };
1640
- if (returnState) {
1641
- matcher.state = state;
1642
- }
1643
- return matcher;
1644
- };
1645
- picomatch.test = (input, regex, options, { glob, posix } = {}) => {
1646
- if (typeof input !== "string") {
1647
- throw new TypeError("Expected input to be a string");
1648
- }
1649
- if (input === "") {
1650
- return { isMatch: false, output: "" };
1651
- }
1652
- const opts = options || {};
1653
- const format = opts.format || (posix ? utils.toPosixSlashes : null);
1654
- let match = input === glob;
1655
- let output = match && format ? format(input) : input;
1656
- if (match === false) {
1657
- output = format ? format(input) : input;
1658
- match = output === glob;
1659
- }
1660
- if (match === false || opts.capture === true) {
1661
- if (opts.matchBase === true || opts.basename === true) {
1662
- match = picomatch.matchBase(input, regex, options, posix);
1663
- } else {
1664
- match = regex.exec(output);
1665
- }
1666
- }
1667
- return { isMatch: Boolean(match), match, output };
1668
- };
1669
- picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
1670
- const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
1671
- return regex.test(utils.basename(input, { windows: posix }));
1672
- };
1673
- picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
1674
- picomatch.parse = (pattern, options) => {
1675
- if (Array.isArray(pattern))
1676
- return pattern.map((p) => picomatch.parse(p, options));
1677
- return parse(pattern, { ...options, fastpaths: false });
1678
- };
1679
- picomatch.scan = (input, options) => scan(input, options);
1680
- picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
1681
- if (returnOutput === true) {
1682
- return state.output;
1683
- }
1684
- const opts = options || {};
1685
- const prepend = opts.contains ? "" : "^";
1686
- const append = opts.contains ? "" : "$";
1687
- let source = `${prepend}(?:${state.output})${append}`;
1688
- if (state && state.negated === true) {
1689
- source = `^(?!${source}).*$`;
1690
- }
1691
- const regex = picomatch.toRegex(source, options);
1692
- if (returnState === true) {
1693
- regex.state = state;
1694
- }
1695
- return regex;
1696
- };
1697
- picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1698
- if (!input || typeof input !== "string") {
1699
- throw new TypeError("Expected a non-empty string");
1700
- }
1701
- let parsed = { negated: false, fastpaths: true };
1702
- if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
1703
- parsed.output = parse.fastpaths(input, options);
1704
- }
1705
- if (!parsed.output) {
1706
- parsed = parse(input, options);
1707
- }
1708
- return picomatch.compileRe(parsed, options, returnOutput, returnState);
1709
- };
1710
- picomatch.toRegex = (source, options) => {
1711
- try {
1712
- const opts = options || {};
1713
- return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1714
- } catch (err) {
1715
- if (options && options.debug === true)
1716
- throw err;
1717
- return /$^/;
1718
- }
1719
- };
1720
- picomatch.constants = constants;
1721
- module.exports = picomatch;
1722
- });
1723
-
1724
- // node_modules/shell-quote/quote.js
1725
- var require_quote = __commonJS(function(exports, module) {
1726
- var OPS = [
1727
- "||",
1728
- "&&",
1729
- ";;&",
1730
- ";;",
1731
- ";&",
1732
- "|&",
1733
- "<(",
1734
- ">(",
1735
- "<<<",
1736
- "<<-",
1737
- "<<",
1738
- ">>",
1739
- ">&",
1740
- ">|",
1741
- "&>>",
1742
- "&>",
1743
- "<&",
1744
- "<>",
1745
- "&",
1746
- ";",
1747
- "(",
1748
- ")",
1749
- "|",
1750
- "<",
1751
- ">"
1752
- ];
1753
- var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
1754
- var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|~]/g;
1755
- module.exports = function quote(xs) {
1756
- var sawComment = false;
1757
- return xs.map(function(s) {
1758
- if (sawComment && typeof s === "string" && LINE_TERMINATORS.test(s)) {
1759
- throw new TypeError("a token after a `comment` must not contain line terminators");
1760
- }
1761
- if (s === "") {
1762
- return "''";
1763
- }
1764
- if (s && typeof s === "object") {
1765
- if ("op" in s && s.op === "glob") {
1766
- if (typeof s.pattern !== "string") {
1767
- throw new TypeError("glob token requires a string `pattern`");
1768
- }
1769
- if (LINE_TERMINATORS.test(s.pattern)) {
1770
- throw new TypeError("glob `pattern` must not contain line terminators");
1771
- }
1772
- if (s.pattern === "") {
1773
- return "''";
1774
- }
1775
- return s.pattern.replace(GLOB_SHELL_SPECIAL, "\\$&");
1776
- }
1777
- if ("op" in s && typeof s.op === "string") {
1778
- if (OPS.indexOf(s.op) < 0) {
1779
- throw new TypeError("invalid `op` value: " + JSON.stringify(s.op));
1780
- }
1781
- return s.op.replace(/[\s\S]/g, "\\$&");
1782
- }
1783
- if ("comment" in s && typeof s.comment === "string") {
1784
- if (LINE_TERMINATORS.test(s.comment)) {
1785
- throw new TypeError("`comment` must not contain line terminators");
1786
- }
1787
- sawComment = true;
1788
- return "#" + s.comment;
1789
- }
1790
- throw new TypeError("unrecognized object token shape");
1791
- }
1792
- if (/'/.test(s) && /!/.test(s)) {
1793
- return "'" + s.replace(/'/g, `'"'"'`) + "'";
1794
- }
1795
- if (/["\s\\]/.test(s) && !/'/.test(s)) {
1796
- return "'" + s + "'";
1797
- }
1798
- if (/["'\s]/.test(s)) {
1799
- return '"' + s.replace(/(["\\$`])/g, "\\$1") + '"';
1800
- }
1801
- return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g, "$1\\$2");
1802
- }).join(" ");
1803
- };
1804
- });
1805
-
1806
- // node_modules/shell-quote/parse.js
1807
- var require_parse2 = __commonJS(function(exports, module) {
1808
- var CONTROL = "(?:" + [
1809
- "\\|\\|",
1810
- "\\&(?:\\&|>>?)",
1811
- ";;\\&?",
1812
- "[;|]\\&",
1813
- "\\<\\(",
1814
- "\\<\\<\\<",
1815
- "\\<\\<-",
1816
- "\\<\\<(?!\\()",
1817
- ">>",
1818
- ">[&|(]",
1819
- "<[&>]",
1820
- "[&;()|<>]"
1821
- ].join("|") + ")";
1822
- var controlRE = new RegExp("^" + CONTROL + "$");
1823
- var META = "|&;()<> \\t";
1824
- var SINGLE_QUOTE = "'([^']*?)'";
1825
- var ANSI_C_BODY = "(?:\\\\[\\s\\S]|[^\\\\'])*?";
1826
- var ANSI_C_QUOTE = "\\$'" + ANSI_C_BODY + "'";
1827
- var ansiCAt = new RegExp("\\$'" + ANSI_C_BODY + "(?:(')|\\\\?$)", "g");
1828
- var ANSI_C_LETTERS = "abeEfnrtv";
1829
- var ANSI_C_CHARS = `\x07\b\x1B\x1B\f
1830
- \r \v`;
1831
- var hash = /^#$/;
1832
- var SQ = "'";
1833
- var DQ = '"';
1834
- var DS = "$";
1835
- var TOKEN = "";
1836
- var mult = 4294967296;
1837
- for (i = 0;i < 4; i++) {
1838
- TOKEN += (mult * Math.random()).toString(16);
1839
- }
1840
- var i;
1841
- var startsWithToken = new RegExp("^" + TOKEN);
1842
- function matchAll(s, r) {
1843
- var origIndex = r.lastIndex;
1844
- var matches = [];
1845
- var matchObj;
1846
- while (matchObj = r.exec(s)) {
1847
- matches[matches.length] = matchObj;
1848
- if (r.lastIndex === matchObj.index) {
1849
- r.lastIndex += 1;
1850
- }
1851
- }
1852
- r.lastIndex = origIndex;
1853
- return matches;
1854
- }
1855
- function getVar(env, pre, key) {
1856
- var r = typeof env === "function" ? env(key) : env[key];
1857
- if (typeof r === "undefined" && key != "") {
1858
- r = "";
1859
- } else if (typeof r === "undefined") {
1860
- r = "$";
1861
- }
1862
- if (typeof r === "object") {
1863
- return pre + TOKEN + JSON.stringify(r) + TOKEN;
1864
- }
1865
- return pre + r;
1866
- }
1867
- var ansiCEscape = /\\([0-7]{1,3}|x[\dA-Fa-f]{1,2}|u[\dA-Fa-f]{1,4}|U[\dA-Fa-f]{1,8}|c(?:\\\\|[\s\S])|[abeEfnrtv\\'"?])/g;
1868
- function expandAnsiCEscape(m, escape) {
1869
- var kind = escape.charAt(0);
1870
- if (kind === "c") {
1871
- var ctrl = escape.charAt(1);
1872
- return ctrl === "?" ? "" : String.fromCharCode(ctrl.charCodeAt(0) & 31);
1873
- }
1874
- if (kind === "x" || kind === "u" || kind === "U") {
1875
- var cp = parseInt(escape.slice(1), 16);
1876
- if (cp > 1114111) {
1877
- return m;
1878
- }
1879
- return String.fromCharCode.apply(null, cp > 65535 ? [55232 + (cp >> 10), 56320 + (cp & 1023)] : [cp]);
1880
- }
1881
- if (kind >= "0" && kind <= "7") {
1882
- return String.fromCharCode(parseInt(escape, 8) & 255);
1883
- }
1884
- var letter = ANSI_C_LETTERS.indexOf(escape);
1885
- return letter < 0 ? escape : ANSI_C_CHARS.charAt(letter);
1886
- }
1887
- function expandAnsiC(body) {
1888
- return body.replace(ansiCEscape, expandAnsiCEscape).split("\x00")[0];
1889
- }
1890
- function closesAnsiC(s, i) {
1891
- ansiCAt.lastIndex = i;
1892
- return !!ansiCAt.exec(s)[1];
1893
- }
1894
- function parseInternal(string, env, opts) {
1895
- if (!opts) {
1896
- opts = {};
1897
- }
1898
- var BS = opts.escape || "\\";
1899
- var ifs = opts.splitUnquoted === true ? `
1900
- ` : typeof opts.splitUnquoted === "string" ? opts.splitUnquoted : "";
1901
- var BAREWORD = "(\\" + BS + `['"$\\` + BS + META + "]|\\$\\$|\\$(?!" + ANSI_C_QUOTE.slice(2) + `)|[^\\s'"$` + META + "])+";
1902
- var DOUBLE_QUOTE = '"(?:\\' + BS + '[\\s\\S]|[^"\\' + BS + '])*"';
1903
- var chunker = new RegExp([
1904
- "(" + CONTROL + ")",
1905
- "(" + ANSI_C_QUOTE + "|" + BAREWORD + "|" + DOUBLE_QUOTE + "|" + SINGLE_QUOTE + ")+"
1906
- ].join("|"), "g");
1907
- var matches = matchAll(string, chunker);
1908
- if (matches.length === 0) {
1909
- return [];
1910
- }
1911
- if (!env) {
1912
- env = {};
1913
- }
1914
- var commented = false;
1915
- return matches.map(function(match) {
1916
- var s = match[0];
1917
- if (!s || commented) {
1918
- return;
1919
- }
1920
- if (controlRE.test(s)) {
1921
- return { op: s };
1922
- }
1923
- var quote = false;
1924
- var esc = false;
1925
- var out = "";
1926
- var words = [];
1927
- var sawQuote = false;
1928
- var pendingNw = null;
1929
- var isGlob = false;
1930
- var i;
1931
- function parseEnvVar() {
1932
- i += 1;
1933
- var varend;
1934
- var varname;
1935
- var char = s.charAt(i);
1936
- if (char === "{") {
1937
- i += 1;
1938
- if (s.charAt(i) === "}") {
1939
- throw new Error("Bad substitution: " + s.slice(i - 2, i + 1));
1940
- }
1941
- var depth = 1;
1942
- varend = i;
1943
- while (depth > 0 && varend < s.length) {
1944
- if (s.charAt(varend) === "{" && s.charAt(varend - 1) === "$") {
1945
- depth += 1;
1946
- } else if (s.charAt(varend) === "}") {
1947
- depth -= 1;
1948
- }
1949
- varend += 1;
1950
- }
1951
- if (depth !== 0) {
1952
- throw new Error("Bad substitution: " + s.slice(i));
1953
- }
1954
- varend -= 1;
1955
- varname = s.slice(i, varend);
1956
- i = varend;
1957
- } else if (/[*@#?$!-]/.test(char)) {
1958
- varname = char;
1959
- } else {
1960
- var slicedFromI = s.slice(i);
1961
- varend = slicedFromI.match(/[^\w\d_]/);
1962
- if (!varend) {
1963
- varname = slicedFromI;
1964
- i = s.length;
1965
- } else {
1966
- varname = slicedFromI.slice(0, varend.index);
1967
- i += varend.index - 1;
1968
- }
1969
- }
1970
- return getVar(env, "", varname);
1971
- }
1972
- function flushRun() {
1973
- if (pendingNw === null) {
1974
- return;
1975
- }
1976
- if (pendingNw === 0) {
1977
- if (out !== "") {
1978
- words[words.length] = out;
1979
- out = "";
1980
- }
1981
- } else {
1982
- words[words.length] = out;
1983
- out = "";
1984
- for (var fe = 1;fe < pendingNw; fe += 1) {
1985
- words[words.length] = "";
1986
- }
1987
- }
1988
- pendingNw = null;
1989
- }
1990
- for (i = 0;i < s.length; i++) {
1991
- var c = s.charAt(i);
1992
- if (ifs && c !== DS) {
1993
- flushRun();
1994
- }
1995
- isGlob = isGlob || !quote && (c === "*" || c === "?");
1996
- if (esc) {
1997
- out += c;
1998
- esc = false;
1999
- } else if (quote) {
2000
- if (c === quote) {
2001
- quote = false;
2002
- } else if (quote == SQ) {
2003
- out += c;
2004
- } else {
2005
- if (c === BS) {
2006
- i += 1;
2007
- c = s.charAt(i);
2008
- if (c === DQ || c === BS || c === DS) {
2009
- out += c;
2010
- } else {
2011
- out += BS + c;
2012
- }
2013
- } else if (c === DS) {
2014
- out += parseEnvVar();
2015
- } else {
2016
- out += c;
2017
- }
2018
- }
2019
- } else if (c === DQ || c === SQ) {
2020
- quote = c;
2021
- sawQuote = true;
2022
- } else if (controlRE.test(c)) {
2023
- return { op: s };
2024
- } else if (hash.test(c)) {
2025
- commented = true;
2026
- var commentObj = { comment: string.slice(match.index + i + 1) };
2027
- if (out.length) {
2028
- return [out, commentObj];
2029
- }
2030
- return [commentObj];
2031
- } else if (c === BS) {
2032
- esc = true;
2033
- } else if (c === DS && s.charAt(i + 1) === SQ && closesAnsiC(s, i)) {
2034
- flushRun();
2035
- sawQuote = true;
2036
- out += expandAnsiC(s.slice(i + 2, ansiCAt.lastIndex - 1));
2037
- i = ansiCAt.lastIndex - 1;
2038
- } else if (c === DS) {
2039
- var value = parseEnvVar();
2040
- if (!ifs) {
2041
- out += value;
2042
- } else {
2043
- for (var vi = 0;vi < value.length; vi += 1) {
2044
- var vc = value.charAt(vi);
2045
- if (ifs.indexOf(vc) < 0) {
2046
- flushRun();
2047
- out += vc;
2048
- } else if (pendingNw === null) {
2049
- pendingNw = vc === " " || vc === "\t" || vc === `
2050
- ` ? 0 : 1;
2051
- } else if (vc !== " " && vc !== "\t" && vc !== `
2052
- `) {
2053
- pendingNw += 1;
2054
- }
2055
- }
2056
- }
2057
- } else {
2058
- out += c;
2059
- }
2060
- }
2061
- if (isGlob) {
2062
- return { op: "glob", pattern: out };
2063
- }
2064
- if (ifs) {
2065
- if (pendingNw !== null && pendingNw > 0) {
2066
- words[words.length] = out;
2067
- out = "";
2068
- for (var te = 1;te < pendingNw; te += 1) {
2069
- words[words.length] = "";
2070
- }
2071
- }
2072
- if (out !== "" || sawQuote && words.length === 0) {
2073
- words[words.length] = out;
2074
- }
2075
- return words;
2076
- }
2077
- return out;
2078
- }).reduce(function(prev, arg) {
2079
- if (typeof arg === "undefined") {
2080
- return prev;
2081
- }
2082
- [].concat(arg).forEach(function(entry) {
2083
- prev[prev.length] = entry;
2084
- });
2085
- return prev;
2086
- }, []);
2087
- }
2088
- module.exports = function parse(s, env, opts) {
2089
- var mapped = parseInternal(s, env, opts);
2090
- if (typeof env !== "function") {
2091
- return mapped;
2092
- }
2093
- return mapped.reduce(function(acc, s) {
2094
- if (typeof s === "object") {
2095
- acc[acc.length] = s;
2096
- return acc;
2097
- }
2098
- var xs = s.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
2099
- if (xs.length === 1) {
2100
- acc[acc.length] = xs[0];
2101
- return acc;
2102
- }
2103
- xs.filter(Boolean).forEach(function(x) {
2104
- acc[acc.length] = startsWithToken.test(x) ? JSON.parse(x.split(TOKEN)[1]) : x;
2105
- });
2106
- return acc;
2107
- }, []);
2108
- };
2109
- });
2110
-
2111
- // node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
2112
- function deepCompareStrict(a, b) {
2113
- const typeofa = typeof a;
2114
- if (typeofa !== typeof b) {
2115
- return false;
2116
- }
2117
- if (Array.isArray(a)) {
2118
- if (!Array.isArray(b)) {
2119
- return false;
2120
- }
2121
- const length = a.length;
2122
- if (length !== b.length) {
2123
- return false;
2124
- }
2125
- for (let i = 0;i < length; i++) {
2126
- if (!deepCompareStrict(a[i], b[i])) {
2127
- return false;
2128
- }
2129
- }
2130
- return true;
2131
- }
2132
- if (typeofa === "object") {
2133
- if (!a || !b) {
2134
- return a === b;
2135
- }
2136
- const aKeys = Object.keys(a);
2137
- const bKeys = Object.keys(b);
2138
- const length = aKeys.length;
2139
- if (length !== bKeys.length) {
2140
- return false;
2141
- }
2142
- for (const k of aKeys) {
2143
- if (!deepCompareStrict(a[k], b[k])) {
2144
- return false;
2145
- }
2146
- }
2147
- return true;
2148
- }
2149
- return a === b;
2150
- }
2151
-
2152
- // node_modules/@cfworker/json-schema/dist/esm/pointer.js
2153
- function encodePointer(p) {
2154
- return encodeURI(escapePointer(p));
2155
- }
2156
- function escapePointer(p) {
2157
- return p.replace(/~/g, "~0").replace(/\//g, "~1");
2158
- }
2159
-
2160
- // node_modules/@cfworker/json-schema/dist/esm/dereference.js
2161
- var schemaArrayKeyword = {
2162
- prefixItems: true,
2163
- items: true,
2164
- allOf: true,
2165
- anyOf: true,
2166
- oneOf: true
2167
- };
2168
- var schemaMapKeyword = {
2169
- $defs: true,
2170
- definitions: true,
2171
- properties: true,
2172
- patternProperties: true,
2173
- dependentSchemas: true
2174
- };
2175
- var ignoredKeyword = {
2176
- id: true,
2177
- $id: true,
2178
- $ref: true,
2179
- $schema: true,
2180
- $anchor: true,
2181
- $vocabulary: true,
2182
- $comment: true,
2183
- default: true,
2184
- enum: true,
2185
- const: true,
2186
- required: true,
2187
- type: true,
2188
- maximum: true,
2189
- minimum: true,
2190
- exclusiveMaximum: true,
2191
- exclusiveMinimum: true,
2192
- multipleOf: true,
2193
- maxLength: true,
2194
- minLength: true,
2195
- pattern: true,
2196
- format: true,
2197
- maxItems: true,
2198
- minItems: true,
2199
- uniqueItems: true,
2200
- maxProperties: true,
2201
- minProperties: true
2202
- };
2203
- var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
2204
- function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = "") {
2205
- if (schema && typeof schema === "object" && !Array.isArray(schema)) {
2206
- const id = schema.$id || schema.id;
2207
- if (id) {
2208
- const url = new URL(id, baseURI.href);
2209
- if (url.hash.length > 1) {
2210
- lookup[url.href] = schema;
2211
- } else {
2212
- url.hash = "";
2213
- if (basePointer === "") {
2214
- baseURI = url;
2215
- } else {
2216
- dereference(schema, lookup, baseURI);
2217
- }
2218
- }
2219
- }
2220
- } else if (schema !== true && schema !== false) {
2221
- return lookup;
2222
- }
2223
- const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
2224
- if (lookup[schemaURI] !== undefined) {
2225
- throw new Error(`Duplicate schema URI "${schemaURI}".`);
2226
- }
2227
- lookup[schemaURI] = schema;
2228
- if (schema === true || schema === false) {
2229
- return lookup;
2230
- }
2231
- if (schema.__absolute_uri__ === undefined) {
2232
- Object.defineProperty(schema, "__absolute_uri__", {
2233
- enumerable: false,
2234
- value: schemaURI
2235
- });
2236
- }
2237
- if (schema.$ref && schema.__absolute_ref__ === undefined) {
2238
- const url = new URL(schema.$ref, baseURI.href);
2239
- url.hash = url.hash;
2240
- Object.defineProperty(schema, "__absolute_ref__", {
2241
- enumerable: false,
2242
- value: url.href
2243
- });
2244
- }
2245
- if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === undefined) {
2246
- const url = new URL(schema.$recursiveRef, baseURI.href);
2247
- url.hash = url.hash;
2248
- Object.defineProperty(schema, "__absolute_recursive_ref__", {
2249
- enumerable: false,
2250
- value: url.href
2251
- });
2252
- }
2253
- if (schema.$anchor) {
2254
- const url = new URL("#" + schema.$anchor, baseURI.href);
2255
- lookup[url.href] = schema;
2256
- }
2257
- for (let key in schema) {
2258
- if (ignoredKeyword[key]) {
2259
- continue;
2260
- }
2261
- const keyBase = `${basePointer}/${encodePointer(key)}`;
2262
- const subSchema = schema[key];
2263
- if (Array.isArray(subSchema)) {
2264
- if (schemaArrayKeyword[key]) {
2265
- const length = subSchema.length;
2266
- for (let i = 0;i < length; i++) {
2267
- dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
2268
- }
2269
- }
2270
- } else if (schemaMapKeyword[key]) {
2271
- for (let subKey in subSchema) {
2272
- dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
2273
- }
2274
- } else {
2275
- dereference(subSchema, lookup, baseURI, keyBase);
2276
- }
2277
- }
2278
- return lookup;
2279
- }
2280
-
2281
- // node_modules/@cfworker/json-schema/dist/esm/format.js
2282
- var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
2283
- var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2284
- var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
2285
- var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
2286
- var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
2287
- var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
2288
- var URL_ = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
2289
- var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
2290
- var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
2291
- var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
2292
- var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
2293
- var EMAIL = (input) => {
2294
- if (input[0] === '"')
2295
- return false;
2296
- const [name, host, ...rest] = input.split("@");
2297
- if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253)
2298
- return false;
2299
- if (name[0] === "." || name.endsWith(".") || name.includes(".."))
2300
- return false;
2301
- if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name))
2302
- return false;
2303
- return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
2304
- };
2305
- var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
2306
- var IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
2307
- var DURATION = (input) => input.length > 1 && input.length < 80 && (/^P\d+([.,]\d+)?W$/.test(input) || /^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) && /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input));
2308
- function bind(r) {
2309
- return r.test.bind(r);
2310
- }
2311
- var format = {
2312
- date,
2313
- time: time.bind(undefined, false),
2314
- "date-time": date_time,
2315
- duration: DURATION,
2316
- uri,
2317
- "uri-reference": bind(URIREF),
2318
- "uri-template": bind(URITEMPLATE),
2319
- url: bind(URL_),
2320
- email: EMAIL,
2321
- hostname: bind(HOSTNAME),
2322
- ipv4: bind(IPV4),
2323
- ipv6: bind(IPV6),
2324
- regex,
2325
- uuid: bind(UUID),
2326
- "json-pointer": bind(JSON_POINTER),
2327
- "json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
2328
- "relative-json-pointer": bind(RELATIVE_JSON_POINTER)
2329
- };
2330
- function isLeapYear(year) {
2331
- return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
2332
- }
2333
- function date(str) {
2334
- const matches = str.match(DATE);
2335
- if (!matches)
2336
- return false;
2337
- const year = +matches[1];
2338
- const month = +matches[2];
2339
- const day = +matches[3];
2340
- return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
2341
- }
2342
- function time(full, str) {
2343
- const matches = str.match(TIME);
2344
- if (!matches)
2345
- return false;
2346
- const hour = +matches[1];
2347
- const minute = +matches[2];
2348
- const second = +matches[3];
2349
- const timeZone = !!matches[5];
2350
- return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
2351
- }
2352
- var DATE_TIME_SEPARATOR = /t|\s/i;
2353
- function date_time(str) {
2354
- const dateTime = str.split(DATE_TIME_SEPARATOR);
2355
- return dateTime.length == 2 && date(dateTime[0]) && time(true, dateTime[1]);
2356
- }
2357
- var NOT_URI_FRAGMENT = /\/|:/;
2358
- var URI_PATTERN = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
2359
- function uri(str) {
2360
- return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
2361
- }
2362
- var Z_ANCHOR = /[^\\]\\Z/;
2363
- function regex(str) {
2364
- if (Z_ANCHOR.test(str))
2365
- return false;
2366
- try {
2367
- new RegExp(str, "u");
2368
- return true;
2369
- } catch (e) {
2370
- return false;
2371
- }
2372
- }
2373
-
2374
- // node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js
2375
- function ucs2length(s) {
2376
- let result = 0;
2377
- let length = s.length;
2378
- let index = 0;
2379
- let charCode;
2380
- while (index < length) {
2381
- result++;
2382
- charCode = s.charCodeAt(index++);
2383
- if (charCode >= 55296 && charCode <= 56319 && index < length) {
2384
- charCode = s.charCodeAt(index);
2385
- if ((charCode & 64512) == 56320) {
2386
- index++;
2387
- }
2388
- }
2389
- }
2390
- return result;
2391
- }
2392
-
2393
- // node_modules/@cfworker/json-schema/dist/esm/validate.js
2394
- function validate(instance, schema, draft = "2019-09", lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = "#", schemaLocation = "#", evaluated = Object.create(null)) {
2395
- if (schema === true) {
2396
- return { valid: true, errors: [] };
2397
- }
2398
- if (schema === false) {
2399
- return {
2400
- valid: false,
2401
- errors: [
2402
- {
2403
- instanceLocation,
2404
- keyword: "false",
2405
- keywordLocation: instanceLocation,
2406
- error: "False boolean schema."
2407
- }
2408
- ]
2409
- };
2410
- }
2411
- const rawInstanceType = typeof instance;
2412
- let instanceType;
2413
- switch (rawInstanceType) {
2414
- case "boolean":
2415
- case "number":
2416
- case "string":
2417
- instanceType = rawInstanceType;
2418
- break;
2419
- case "object":
2420
- if (instance === null) {
2421
- instanceType = "null";
2422
- } else if (Array.isArray(instance)) {
2423
- instanceType = "array";
2424
- } else {
2425
- instanceType = "object";
2426
- }
2427
- break;
2428
- default:
2429
- throw new Error(`Instances of "${rawInstanceType}" type are not supported.`);
2430
- }
2431
- const { $ref, $recursiveRef, $recursiveAnchor, type: $type, const: $const, enum: $enum, required: $required, not: $not, anyOf: $anyOf, allOf: $allOf, oneOf: $oneOf, if: $if, then: $then, else: $else, format: $format, properties: $properties, patternProperties: $patternProperties, additionalProperties: $additionalProperties, unevaluatedProperties: $unevaluatedProperties, minProperties: $minProperties, maxProperties: $maxProperties, propertyNames: $propertyNames, dependentRequired: $dependentRequired, dependentSchemas: $dependentSchemas, dependencies: $dependencies, prefixItems: $prefixItems, items: $items, additionalItems: $additionalItems, unevaluatedItems: $unevaluatedItems, contains: $contains, minContains: $minContains, maxContains: $maxContains, minItems: $minItems, maxItems: $maxItems, uniqueItems: $uniqueItems, minimum: $minimum, maximum: $maximum, exclusiveMinimum: $exclusiveMinimum, exclusiveMaximum: $exclusiveMaximum, multipleOf: $multipleOf, minLength: $minLength, maxLength: $maxLength, pattern: $pattern, __absolute_ref__, __absolute_recursive_ref__ } = schema;
2432
- const errors = [];
2433
- if ($recursiveAnchor === true && recursiveAnchor === null) {
2434
- recursiveAnchor = schema;
2435
- }
2436
- if ($recursiveRef === "#") {
2437
- const refSchema = recursiveAnchor === null ? lookup[__absolute_recursive_ref__] : recursiveAnchor;
2438
- const keywordLocation = `${schemaLocation}/$recursiveRef`;
2439
- const result = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);
2440
- if (!result.valid) {
2441
- errors.push({
2442
- instanceLocation,
2443
- keyword: "$recursiveRef",
2444
- keywordLocation,
2445
- error: "A subschema had errors."
2446
- }, ...result.errors);
2447
- }
2448
- }
2449
- if ($ref !== undefined) {
2450
- const uri = __absolute_ref__ || $ref;
2451
- const refSchema = lookup[uri];
2452
- if (refSchema === undefined) {
2453
- let message = `Unresolved $ref "${$ref}".`;
2454
- if (__absolute_ref__ && __absolute_ref__ !== $ref) {
2455
- message += ` Absolute URI "${__absolute_ref__}".`;
2456
- }
2457
- message += `
1
+ var Bt=Object.create;var{getPrototypeOf:jt,defineProperty:Ve,getOwnPropertyNames:Gt}=Object;var Ye=Object.prototype.hasOwnProperty;function Ut(e){return this[e]}var qt,Ft,Kt=(e,r,t)=>{var n=e!=null&&typeof e==="object";if(n){var o=r?qt??=new WeakMap:Ft??=new WeakMap,u=o.get(e);if(u)return u}t=e!=null?Bt(jt(e)):{};let s=r||!e||!e.__esModule||!Ye.call(e,"default")?Ve(t,"default",{value:e,enumerable:!0}):t;if(e&&typeof e==="object"||typeof e==="function"){for(let i of Gt(e))if(!Ye.call(s,i))Ve(s,i,{get:Ut.bind(e,i),enumerable:!0})}if(n)o.set(e,s);return s};var me=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Se=me(function(Qn,dt){var lt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},wr={...lt,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Or={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};dt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:Or,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?wr:lt}}});var Te=me(function(kr){var{REGEX_BACKSLASH:vr,REGEX_REMOVE_BACKSLASH:Tr,REGEX_SPECIAL_CHARS:Ir,REGEX_SPECIAL_CHARS_GLOBAL:Cr}=Se();kr.isObject=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e);kr.hasRegexChars=(e)=>Ir.test(e);kr.isRegexChar=(e)=>e.length===1&&kr.hasRegexChars(e);kr.escapeRegex=(e)=>e.replace(Cr,"\\$1");kr.toPosixSlashes=(e)=>e.replace(vr,"/");kr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let e=navigator.platform.toLowerCase();return e==="win32"||e==="windows"}return!1};kr.removeBackslashes=(e)=>e.replace(Tr,(r)=>r==="\\"?"":r);kr.escapeLast=(e,r,t)=>{let n=e.lastIndexOf(r,t);if(n===-1)return e;if(e[n-1]==="\\")return kr.escapeLast(e,r,n-1);return`${e.slice(0,n)}\\${e.slice(n)}`};kr.removePrefix=(e,r={})=>{let t=e;if(t.startsWith("./"))t=t.slice(2),r.prefix="./";return t};kr.wrapOutput=(e,r={},t={})=>{let n=t.contains?"":"^",o=t.contains?"":"$",u=`${n}(?:${e})${o}`;if(r.negated===!0)u=`(?:^(?!${u}).*$)`;return u};kr.basename=(e,{windows:r}={})=>{let t=e.split(r?/[\\/]/:"/"),n=t[t.length-1];if(n==="")return t[t.length-2];return n}});var xt=me(function(Vn,_t){var Ce=Te(),{CHAR_ASTERISK:Be,CHAR_AT:Gr,CHAR_BACKWARD_SLASH:xe,CHAR_COMMA:Ur,CHAR_DOT:je,CHAR_EXCLAMATION_MARK:Ge,CHAR_FORWARD_SLASH:gt,CHAR_LEFT_CURLY_BRACE:Ue,CHAR_LEFT_PARENTHESES:Ie,CHAR_LEFT_SQUARE_BRACKET:qr,CHAR_PLUS:Fr,CHAR_QUESTION_MARK:ht,CHAR_RIGHT_CURLY_BRACE:Kr,CHAR_RIGHT_PARENTHESES:$t,CHAR_RIGHT_SQUARE_BRACKET:Wr}=Se(),mt=(e)=>e===gt||e===xe,yt=(e)=>{if(e.isPrefix!==!0)e.depth=e.isGlobstar?1/0:1},Xr=(e,r)=>{let t=r||{},n=e.length-1,o=t.parts===!0||t.tokens===!0||t.scanToEnd===!0,u=[],s=[],i=[],h=e,N=-1,_=0,w=0,M=!1,K=!1,g=!1,k=!1,ee=!1,q=!1,L=!1,H=!1,ne=!1,X=!1,T=0,V,A,I={value:"",depth:0,isGlob:!1},a=()=>N>=n,Q=()=>h.charCodeAt(N+1),C=()=>(V=A,h.charCodeAt(++N));while(N<n){A=C();let P;if(A===xe){if(L=I.backslashes=!0,A=C(),A===Ue)q=!0;continue}if(q===!0||A===Ue){T++;while(a()!==!0&&(A=C())){if(A===xe){L=I.backslashes=!0,C();continue}if(A===Ue){T++;continue}if(q!==!0&&A===je&&(A=C())===je){if(M=I.isBrace=!0,g=I.isGlob=!0,X=!0,o===!0)continue;break}if(q!==!0&&A===Ur){if(M=I.isBrace=!0,g=I.isGlob=!0,X=!0,o===!0)continue;break}if(A===Kr){if(T--,T===0){q=!1,M=I.isBrace=!0,X=!0;break}}}if(o===!0)continue;break}if(A===gt){if(u.push(N),s.push(I),I={value:"",depth:0,isGlob:!1},X===!0)continue;if(V===je&&N===_+1){_+=2;continue}w=N+1;continue}if(t.noext!==!0){if((A===Fr||A===Gr||A===Be||A===ht||A===Ge)===!0&&Q()===Ie){if(g=I.isGlob=!0,k=I.isExtglob=!0,X=!0,A===Ge&&N===_)ne=!0;if(o===!0){let te=0;while(a()!==!0&&(A=C())){if(A===xe){L=I.backslashes=!0,C();continue}if(A===Ie){te++;continue}if(A===$t&&--te===0){X=!0;break}}continue}break}}if(A===Be){if(V===Be)ee=I.isGlobstar=!0;if(g=I.isGlob=!0,X=!0,o===!0)continue;break}if(A===ht){if(g=I.isGlob=!0,X=!0,o===!0)continue;break}if(A===qr){while(a()!==!0&&(P=C())){if(P===xe){L=I.backslashes=!0,C();continue}if(P===Wr){K=I.isBracket=!0,g=I.isGlob=!0,X=!0;break}}if(o===!0)continue;break}if(t.nonegate!==!0&&A===Ge&&N===_){H=I.negated=!0,_++;continue}if(t.noparen!==!0&&A===Ie){if(g=I.isGlob=!0,o===!0){let J=1;while(a()!==!0&&(A=C())){if(A===xe){L=I.backslashes=!0,C();continue}if(A===Ie){J++;continue}if(A===$t&&--J===0){X=!0;break}}continue}break}if(g===!0){if(X=!0,o===!0)continue;break}}if(t.noext===!0)k=!1,g=!1;let B=h,l="",f="";if(_>0)l=h.slice(0,_),h=h.slice(_),w-=_;if(B&&g===!0&&w>0)B=h.slice(0,w),f=h.slice(w);else if(g===!0)B="",f=h;else B=h;if(B&&B!==""&&B!=="/"&&B!==h){if(mt(B.charCodeAt(B.length-1)))B=B.slice(0,-1)}if(t.unescape===!0){if(f)f=Ce.removeBackslashes(f);if(B&&L===!0)B=Ce.removeBackslashes(B)}let Y={prefix:l,input:e,start:_,base:B,glob:f,isBrace:M,isBracket:K,isGlob:g,isExtglob:k,isGlobstar:ee,negated:H,negatedExtglob:ne};if(t.tokens===!0){if(Y.maxDepth=0,!mt(A))s.push(I);Y.tokens=s}if(t.parts===!0||t.tokens===!0){let P;for(let W=0;W<u.length;W++){let ue=P!==void 0?P+1:_,$e=u[W],fe=e.slice(ue,$e);if(t.tokens){if(W===0&&_!==0)s[W].isPrefix=!0,s[W].value=l;else s[W].value=fe;yt(s[W]),Y.maxDepth+=s[W].depth}if($e>=_)i.push(fe),P=$e}let J=P!==void 0?P+1:_,te=e.slice(J);if(i.push(te),t.tokens&&P&&P+1<e.length)s[s.length-1].value=te,yt(s[s.length-1]),Y.maxDepth+=s[s.length-1].depth;Y.slashes=u,Y.parts=i}return Y};_t.exports=Xr});var St=me(function(Yn,Et){var he=Se(),G=Te(),{MAX_LENGTH:ke,POSIX_REGEX_SOURCE:Qr,REGEX_NON_SPECIAL_CHARS:Zr,REGEX_SPECIAL_CHARS_BACKREF:Vr,REPLACEMENTS:At}=he,Yr=(e,r)=>{if(typeof r.expandRange==="function")return r.expandRange(...e,r);e.sort();let t=`[${e.join("-")}]`;try{new RegExp(t)}catch(n){return e.map((o)=>G.escapeRegex(o)).join("..")}return t},Ae=(e,r)=>`Missing ${e}: "${r}" - use "\\\\${r}" to match literal characters`,Rt=(e)=>{let r=[],t=0,n=0,o=0,u="",s=!1;for(let i of e){if(s===!0){u+=i,s=!1;continue}if(i==="\\"){u+=i,s=!0;continue}if(i==='"'){o=o===1?0:1,u+=i;continue}if(o===0){if(i==="[")t++;else if(i==="]"&&t>0)t--;else if(t===0){if(i==="(")n++;else if(i===")"&&n>0)n--;else if(i==="|"&&n===0){r.push(u),u="";continue}}}u+=i}return r.push(u),r},Jr=(e)=>{let r=!1;for(let t of e){if(r===!0){r=!1;continue}if(t==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(t))return!1}return!0},Fe=(e)=>{let r=e.trim(),t=!0;while(t===!0)if(t=!1,/^@\([^\\()[\]{}|]+\)$/.test(r))r=r.slice(2,-1),t=!0;if(!Jr(r))return;return r.replace(/\\(.)/g,"$1")},en=(e)=>{let r=e.map(Fe).filter(Boolean);for(let t=0;t<r.length;t++)for(let n=t+1;n<r.length;n++){let o=r[t],u=r[n],s=o[0];if(!s||o!==s.repeat(o.length)||u!==s.repeat(u.length))continue;if(o===u||o.startsWith(u)||u.startsWith(o))return!0}return!1},qe=(e,r=!0)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let t=0,n=0,o=0,u=!1;for(let s=1;s<e.length;s++){let i=e[s];if(u===!0){u=!1;continue}if(i==="\\"){u=!0;continue}if(i==='"'){o=o===1?0:1;continue}if(o===1)continue;if(i==="["){t++;continue}if(i==="]"&&t>0){t--;continue}if(t>0)continue;if(i==="("){n++;continue}if(i===")"){if(n--,n===0){if(r===!0&&s!==e.length-1)return;return{type:e[0],body:e.slice(2,s),end:s}}}}},tn=(e)=>`${e.length===1?G.escapeRegex(e[0]):`[${e.map((t)=>G.escapeRegex(t)).join("")}]`}*`,rn=(e)=>{let r=0,t=[];while(r<e.length){let n=qe(e.slice(r),!1);if(!n||n.type!=="*")return;let o=Rt(n.body).map((s)=>s.trim());if(o.length!==1)return;let u=Fe(o[0]);if(!u||u.length!==1)return;t.push(u),r+=n.end+1}if(t.length<1)return;return t},nn=(e)=>{let r=0,t=e.trim(),n=qe(t);while(n)r++,t=n.body.trim(),n=qe(t);return r},sn=(e,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let t=typeof r.maxExtglobRecursion==="number"?r.maxExtglobRecursion:he.DEFAULT_MAX_EXTGLOB_RECURSION,n=Rt(e).map((i)=>i.trim());if(n.length>1){if(n.some((i)=>i==="")||n.some((i)=>/^[*?]+$/.test(i))||en(n))return{risky:!0}}let o=[],u=!1,s=!0;for(let i of n){let h=rn(i);if(h){u=!0,o.push(...h);continue}let N=Fe(i);if(N&&N.length===1){o.push(N);continue}if(s=!1,nn(i)>t)return{risky:!0}}if(u)return s?{risky:!0,safeOutput:tn([...new Set(o)])}:{risky:!0};return{risky:!1}},Ke=(e,r)=>{if(typeof e!=="string")throw TypeError("Expected a string");e=At[e]||e;let t={...r},n=typeof t.maxLength==="number"?Math.min(ke,t.maxLength):ke,o=e.length;if(o>n)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let u={type:"bos",value:"",output:t.prepend||""},s=[u],i=t.capture?"":"?:",h=he.globChars(t.windows),N=he.extglobChars(h),{DOT_LITERAL:_,PLUS_LITERAL:w,SLASH_LITERAL:M,ONE_CHAR:K,DOTS_SLASH:g,NO_DOT:k,NO_DOT_SLASH:ee,NO_DOTS_SLASH:q,QMARK:L,QMARK_NO_DOT:H,STAR:ne,START_ANCHOR:X}=h,T=(p)=>`(${i}(?:(?!${X}${p.dot?g:_}).)*?)`,V=t.dot?"":k,A=t.dot?L:H,I=t.bash===!0?T(t):ne;if(t.capture)I=`(${I})`;if(typeof t.noext==="boolean")t.noextglob=t.noext;let a={input:e,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};e=G.removePrefix(e,a),o=e.length;let Q=[],C=[],B=[],l=u,f,Y=()=>a.index===o-1,P=a.peek=(p=1)=>e[a.index+p],J=a.advance=()=>e[++a.index]||"",te=()=>e.slice(a.index+1),W=(p="",j=0)=>{a.consumed+=p,a.index+=j},ue=(p)=>{a.output+=p.output!=null?p.output:p.value,W(p.value)},$e=()=>{let p=1;while(P()==="!"&&(P(2)!=="("||P(3)==="?"))J(),a.start++,p++;if(p%2===0)return!1;return a.negated=!0,a.start++,!0},fe=(p)=>{a[p]++,B.push(p)},ae=(p)=>{a[p]--,B.pop()},R=(p)=>{if(l.type==="globstar"){let j=a.braces>0&&(p.type==="comma"||p.type==="brace"),d=p.extglob===!0||Q.length&&(p.type==="pipe"||p.type==="paren");if(p.type!=="slash"&&p.type!=="paren"&&!j&&!d)a.output=a.output.slice(0,-l.output.length),l.type="star",l.value="*",l.output=I,a.output+=l.output}if(Q.length&&p.type!=="paren")Q[Q.length-1].inner+=p.value;if(p.value||p.output)ue(p);if(l&&l.type==="text"&&p.type==="text"){l.output=(l.output||l.value)+p.value,l.value+=p.value;return}p.prev=l,s.push(p),l=p},de=(p,j)=>{let d={...N[j],conditions:1,inner:""};d.prev=l,d.parens=a.parens,d.output=a.output,d.startIndex=a.index,d.tokensIndex=s.length;let O=(t.capture?"(":"")+d.open;fe("parens"),R({type:p,value:j,output:a.output?"":K}),R({type:"paren",extglob:!0,value:J(),output:O}),Q.push(d)},Re=(p)=>{let j=e.slice(p.startIndex,a.index+1),d=e.slice(p.startIndex+2,a.index),O=sn(d,t);if((p.type==="plus"||p.type==="star")&&O.risky){let z=O.safeOutput?(p.output?"":K)+(t.capture?`(${O.safeOutput})`:O.safeOutput):void 0,re=s[p.tokensIndex];re.type="text",re.value=j,re.output=z||G.escapeRegex(j);for(let ie=p.tokensIndex+1;ie<s.length;ie++)s[ie].value="",s[ie].output="",delete s[ie].suffix;a.output=p.output+re.output,a.backtrack=!0,R({type:"paren",extglob:!0,value:f,output:""}),ae("parens");return}let D=p.close+(t.capture?")":""),U;if(p.type==="negate"){let z=I;if(p.inner&&p.inner.length>1&&p.inner.includes("/"))z=T(t);if(z!==I||Y()||/^\)+$/.test(te()))D=p.close=`)$))${z}`;if(p.inner.includes("*")&&(U=te())&&/^\.[^\\/.]+$/.test(U)){let re=Ke(U,{...r,fastpaths:!1}).output;D=p.close=`)${re})${z})`}if(p.prev.type==="bos")a.negatedExtglob=!0}R({type:"paren",extglob:!0,value:f,output:D}),ae("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let p=!1,j=e.replace(Vr,(d,O,D,U,z,re)=>{if(U==="\\")return p=!0,d;if(U==="?"){if(O)return O+U+(z?L.repeat(z.length):"");if(re===0)return A+(z?L.repeat(z.length):"");return L.repeat(D.length)}if(U===".")return _.repeat(D.length);if(U==="*"){if(O)return O+U+(z?I:"");return I}return O?d:`\\${d}`});if(p===!0)if(t.unescape===!0)j=j.replace(/\\/g,"");else j=j.replace(/\\+/g,(d)=>d.length%2===0?"\\\\":d?"\\":"");if(j===e&&t.contains===!0)return a.output=e,a;return a.output=G.wrapOutput(j,a,r),a}while(!Y()){if(f=J(),f==="\x00")continue;if(f==="\\"){let d=P();if(d==="/"&&t.bash!==!0)continue;if(d==="."||d===";")continue;if(!d){f+="\\",R({type:"text",value:f});continue}let O=/^\\+/.exec(te()),D=0;if(O&&O[0].length>2){if(D=O[0].length,a.index+=D,D%2!==0)f+="\\"}if(t.unescape===!0)f=J();else f+=J();if(a.brackets===0){R({type:"text",value:f});continue}}if(a.brackets>0&&(f!=="]"||l.value==="["||l.value==="[^")){if(t.posix!==!1&&f===":"){let d=l.value.slice(1);if(d.includes("[")){if(l.posix=!0,d.includes(":")){let O=l.value.lastIndexOf("["),D=l.value.slice(0,O),U=l.value.slice(O+2),z=Qr[U];if(z){if(l.value=D+z,a.backtrack=!0,J(),!u.output&&s.indexOf(l)===1)u.output=K;continue}}}}if(f==="["&&P()!==":"||f==="-"&&P()==="]")f=`\\${f}`;if(f==="]"&&(l.value==="["||l.value==="[^"))f=`\\${f}`;if(t.posix===!0&&f==="!"&&l.value==="[")f="^";l.value+=f,ue({value:f});continue}if(a.quotes===1&&f!=='"'){f=G.escapeRegex(f),l.value+=f,ue({value:f});continue}if(f==='"'){if(a.quotes=a.quotes===1?0:1,t.keepQuotes===!0)R({type:"text",value:f});continue}if(f==="("){fe("parens"),R({type:"paren",value:f});continue}if(f===")"){if(a.parens===0&&t.strictBrackets===!0)throw SyntaxError(Ae("opening","("));let d=Q[Q.length-1];if(d&&a.parens===d.parens+1){Re(Q.pop());continue}R({type:"paren",value:f,output:a.parens?")":"\\)"}),ae("parens");continue}if(f==="["){if(t.nobracket===!0||!te().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw SyntaxError(Ae("closing","]"));f=`\\${f}`}else fe("brackets");R({type:"bracket",value:f});continue}if(f==="]"){if(t.nobracket===!0||l&&l.type==="bracket"&&l.value.length===1){R({type:"text",value:f,output:`\\${f}`});continue}if(a.brackets===0){if(t.strictBrackets===!0)throw SyntaxError(Ae("opening","["));R({type:"text",value:f,output:`\\${f}`});continue}ae("brackets");let d=l.value.slice(1);if(l.posix!==!0&&d[0]==="^"&&!d.includes("/"))f=`/${f}`;if(l.value+=f,ue({value:f}),t.literalBrackets===!1||G.hasRegexChars(d))continue;let O=G.escapeRegex(l.value);if(a.output=a.output.slice(0,-l.value.length),t.literalBrackets===!0){a.output+=O,l.value=O;continue}l.value=`(${i}${O}|${l.value})`,a.output+=l.value;continue}if(f==="{"&&t.nobrace!==!0){fe("braces");let d={type:"brace",value:f,output:"(",outputIndex:a.output.length,tokensIndex:a.tokens.length};C.push(d),R(d);continue}if(f==="}"){let d=C[C.length-1];if(t.nobrace===!0||!d){R({type:"text",value:f,output:f});continue}let O=")";if(d.dots===!0){let D=s.slice(),U=[];for(let z=D.length-1;z>=0;z--){if(s.pop(),D[z].type==="brace")break;if(D[z].type!=="dots")U.unshift(D[z].value)}O=Yr(U,t),a.backtrack=!0}if(d.comma!==!0&&d.dots!==!0){let D=a.output.slice(0,d.outputIndex),U=a.tokens.slice(d.tokensIndex);d.value=d.output="\\{",f=O="\\}",a.output=D;for(let z of U)a.output+=z.output||z.value}R({type:"brace",value:f,output:O}),ae("braces"),C.pop();continue}if(f==="|"){if(Q.length>0)Q[Q.length-1].conditions++;R({type:"text",value:f});continue}if(f===","){let d=f,O=C[C.length-1];if(O&&B[B.length-1]==="braces")O.comma=!0,d="|";R({type:"comma",value:f,output:d});continue}if(f==="/"){if(l.type==="dot"&&a.index===a.start+1){a.start=a.index+1,a.consumed="",a.output="",s.pop(),l=u;continue}R({type:"slash",value:f,output:M});continue}if(f==="."){if(a.braces>0&&l.type==="dot"){if(l.value===".")l.output=_;let d=C[C.length-1];l.type="dots",l.output+=f,l.value+=f,d.dots=!0;continue}if(a.braces+a.parens===0&&l.type!=="bos"&&l.type!=="slash"){R({type:"text",value:f,output:_});continue}R({type:"dot",value:f,output:_});continue}if(f==="?"){if(!(l&&l.value==="(")&&t.noextglob!==!0&&P()==="("&&P(2)!=="?"){de("qmark",f);continue}if(l&&l.type==="paren"){let O=P(),D=f;if(l.value==="("&&!/[!=<:]/.test(O)||O==="<"&&!/<([!=]|\w+>)/.test(te()))D=`\\${f}`;R({type:"text",value:f,output:D});continue}if(t.dot!==!0&&(l.type==="slash"||l.type==="bos")){R({type:"qmark",value:f,output:H});continue}R({type:"qmark",value:f,output:L});continue}if(f==="!"){if(t.noextglob!==!0&&P()==="("){if(P(2)!=="?"||!/[!=<:]/.test(P(3))){de("negate",f);continue}}if(t.nonegate!==!0&&a.index===0){$e();continue}}if(f==="+"){if(t.noextglob!==!0&&P()==="("&&P(2)!=="?"){de("plus",f);continue}if(l&&l.value==="("||t.regex===!1){R({type:"plus",value:f,output:w});continue}if(l&&(l.type==="bracket"||l.type==="paren"||l.type==="brace")||a.parens>0){R({type:"plus",value:f});continue}R({type:"plus",value:w});continue}if(f==="@"){if(t.noextglob!==!0&&P()==="("&&P(2)!=="?"){R({type:"at",extglob:!0,value:f,output:""});continue}R({type:"text",value:f});continue}if(f!=="*"){if(f==="$"||f==="^")f=`\\${f}`;let d=Zr.exec(te());if(d)f+=d[0],a.index+=d[0].length;R({type:"text",value:f});continue}if(l&&(l.type==="globstar"||l.star===!0)){l.type="star",l.star=!0,l.value+=f,l.output=I,a.backtrack=!0,a.globstar=!0,W(f);continue}let p=te();if(t.noextglob!==!0&&/^\([^?]/.test(p)){de("star",f);continue}if(l.type==="star"){if(t.noglobstar===!0){W(f);continue}let d=l.prev,O=d.prev,D=d.type==="slash"||d.type==="bos",U=O&&(O.type==="star"||O.type==="globstar");if(t.bash===!0&&(!D||p[0]&&p[0]!=="/")){R({type:"star",value:f,output:""});continue}let z=a.braces>0&&(d.type==="comma"||d.type==="brace"),re=Q.length&&(d.type==="pipe"||d.type==="paren");if(!D&&d.type!=="paren"&&!z&&!re){R({type:"star",value:f,output:""});continue}while(p.slice(0,3)==="/**"){let pe=e[a.index+4];if(pe&&pe!=="/")break;p=p.slice(3),W("/**",3)}let ie=Y()||a.parens>0&&p===")".repeat(a.parens)&&!Q.some((pe)=>pe.type==="negate");if(d.type==="bos"&&Y()){l.type="globstar",l.value+=f,l.output=T(t),a.output=l.output,a.globstar=!0,W(f);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&!U&&ie){a.output=a.output.slice(0,-(d.output+l.output).length),d.output=`(?:${d.output}`,l.type="globstar",l.output=T(t)+(t.strictSlashes?")":"|$)"),l.value+=f,a.globstar=!0,a.output+=d.output+l.output,W(f);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&p[0]==="/"){let pe=p[1]!==void 0?"|$":"";a.output=a.output.slice(0,-(d.output+l.output).length),d.output=`(?:${d.output}`,l.type="globstar",l.output=`${T(t)}${M}|${M}${pe})`,l.value+=f,a.output+=d.output+l.output,a.globstar=!0,W(f+J()),R({type:"slash",value:"/",output:""});continue}if(d.type==="bos"&&p[0]==="/"){l.type="globstar",l.value+=f,l.output=`(?:^|${M}|${T(t)}${M})`,a.output=l.output,a.globstar=!0,W(f+J()),R({type:"slash",value:"/",output:""});continue}a.output=a.output.slice(0,-l.output.length),l.type="globstar",l.output=T(t),l.value+=f,a.output+=l.output,a.globstar=!0,W(f);continue}let j={type:"star",value:f,output:I};if(t.bash===!0){if(j.output=".*?",l.type==="bos"||l.type==="slash")j.output=V+j.output;R(j);continue}if(l&&(l.type==="bracket"||l.type==="paren")&&t.regex===!0){j.output=f,R(j);continue}if(a.index===a.start||l.type==="slash"||l.type==="dot"){if(l.type==="dot")a.output+=ee,l.output+=ee;else if(t.dot===!0)a.output+=q,l.output+=q;else a.output+=V,l.output+=V;if(P()!=="*")a.output+=K,l.output+=K}R(j)}while(a.brackets>0){if(t.strictBrackets===!0)throw SyntaxError(Ae("closing","]"));a.output=G.escapeLast(a.output,"["),ae("brackets")}while(a.parens>0){if(t.strictBrackets===!0)throw SyntaxError(Ae("closing",")"));a.output=G.escapeLast(a.output,"("),ae("parens")}while(a.braces>0){if(t.strictBrackets===!0)throw SyntaxError(Ae("closing","}"));a.output=G.escapeLast(a.output,"{"),ae("braces")}if(t.strictSlashes!==!0&&(l.type==="star"||l.type==="bracket"))R({type:"maybe_slash",value:"",output:`${M}?`});if(a.backtrack===!0){a.output="";for(let p of a.tokens)if(a.output+=p.output!=null?p.output:p.value,p.suffix)a.output+=p.suffix}return a};Ke.fastpaths=(e,r)=>{let t={...r},n=typeof t.maxLength==="number"?Math.min(ke,t.maxLength):ke,o=e.length;if(o>n)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);e=At[e]||e;let{DOT_LITERAL:u,SLASH_LITERAL:s,ONE_CHAR:i,DOTS_SLASH:h,NO_DOT:N,NO_DOTS:_,NO_DOTS_SLASH:w,STAR:M,START_ANCHOR:K}=he.globChars(t.windows),g=t.dot?_:N,k=t.dot?w:N,ee=t.capture?"":"?:",q={negated:!1,prefix:""},L=t.bash===!0?".*?":M;if(t.capture)L=`(${L})`;let H=(V)=>{if(V.noglobstar===!0)return L;return`(${ee}(?:(?!${K}${V.dot?h:u}).)*?)`},ne=(V)=>{switch(V){case"*":return`${g}${i}${L}`;case".*":return`${u}${i}${L}`;case"*.*":return`${g}${L}${u}${i}${L}`;case"*/*":return`${g}${L}${s}${i}${k}${L}`;case"**":return g+H(t);case"**/*":return`(?:${g}${H(t)}${s})?${k}${i}${L}`;case"**/*.*":return`(?:${g}${H(t)}${s})?${k}${L}${u}${i}${L}`;case"**/.*":return`(?:${g}${H(t)}${s})?${u}${i}${L}`;default:{let A=/^(.*?)\.(\w+)$/.exec(V);if(!A)return;let I=ne(A[1]);if(!I)return;return I+u+A[2]}}},X=G.removePrefix(e,q),T=ne(X);if(T&&t.strictSlashes!==!0)T+=`${s}?`;return T};Et.exports=Ke});var wt=me(function(Jn,bt){var on=xt(),He=St(),Ne=Te(),un=Se(),an=(e)=>e&&typeof e==="object"&&!Array.isArray(e),Z=(e,r,t=!1)=>{if(Array.isArray(e)){let _=e.map((M)=>Z(M,r,t));return(M)=>{for(let K of _){let g=K(M);if(g)return g}return!1}}let n=an(e)&&e.tokens&&e.input;if(e===""||typeof e!=="string"&&!n)throw TypeError("Expected pattern to be a non-empty string");let o=r||{},u=o.windows,s=n?Z.compileRe(e,r):Z.makeRe(e,r,!1,!0),i=s.state;delete s.state;let h=()=>!1;if(o.ignore){let _={...r,ignore:null,onMatch:null,onResult:null};h=Z(o.ignore,_,t)}let N=(_,w=!1)=>{let{isMatch:M,match:K,output:g}=Z.test(_,s,r,{glob:e,posix:u}),k={glob:e,state:i,regex:s,posix:u,input:_,output:g,match:K,isMatch:M};if(typeof o.onResult==="function")o.onResult(k);if(M===!1)return k.isMatch=!1,w?k:!1;if(h(_)){if(typeof o.onIgnore==="function")o.onIgnore(k);return k.isMatch=!1,w?k:!1}if(typeof o.onMatch==="function")o.onMatch(k);return w?k:!0};if(t)N.state=i;return N};Z.test=(e,r,t,{glob:n,posix:o}={})=>{if(typeof e!=="string")throw TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let u=t||{},s=u.format||(o?Ne.toPosixSlashes:null),i=e===n,h=i&&s?s(e):e;if(i===!1)h=s?s(e):e,i=h===n;if(i===!1||u.capture===!0)if(u.matchBase===!0||u.basename===!0)i=Z.matchBase(e,r,t,o);else i=r.exec(h);return{isMatch:Boolean(i),match:i,output:h}};Z.matchBase=(e,r,t,n=t&&t.windows)=>(r instanceof RegExp?r:Z.makeRe(r,t)).test(Ne.basename(e,{windows:n}));Z.isMatch=(e,r,t)=>Z(r,t)(e);Z.parse=(e,r)=>{if(Array.isArray(e))return e.map((t)=>Z.parse(t,r));return He(e,{...r,fastpaths:!1})};Z.scan=(e,r)=>on(e,r);Z.compileRe=(e,r,t=!1,n=!1)=>{if(t===!0)return e.output;let o=r||{},u=o.contains?"":"^",s=o.contains?"":"$",i=`${u}(?:${e.output})${s}`;if(e&&e.negated===!0)i=`^(?!${i}).*$`;let h=Z.toRegex(i,r);if(n===!0)h.state=e;return h};Z.makeRe=(e,r={},t=!1,n=!1)=>{if(!e||typeof e!=="string")throw TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};if(r.fastpaths!==!1&&(e[0]==="."||e[0]==="*"))o.output=He.fastpaths(e,r);if(!o.output)o=He(e,r);return Z.compileRe(o,r,t,n)};Z.toRegex=(e,r)=>{try{let t=r||{};return new RegExp(e,t.flags||(t.nocase?"i":""))}catch(t){if(r&&r.debug===!0)throw t;return/$^/}};Z.constants=un;bt.exports=Z});var vt=me(function(es,Ot){var fn=["||","&&",";;&",";;",";&","|&","<(",">(","<<<","<<-","<<",">>",">&",">|","&>>","&>","<&","<>","&",";","(",")","|","<",">"],We=/[\n\r\u2028\u2029]/,ln=/[\s#!"$&'():;<=>@\\^`|~]/g;Ot.exports=function(r){var t=!1;return r.map(function(n){if(t&&typeof n==="string"&&We.test(n))throw TypeError("a token after a `comment` must not contain line terminators");if(n==="")return"''";if(n&&typeof n==="object"){if("op"in n&&n.op==="glob"){if(typeof n.pattern!=="string")throw TypeError("glob token requires a string `pattern`");if(We.test(n.pattern))throw TypeError("glob `pattern` must not contain line terminators");if(n.pattern==="")return"''";return n.pattern.replace(ln,"\\$&")}if("op"in n&&typeof n.op==="string"){if(fn.indexOf(n.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(n.op));return n.op.replace(/[\s\S]/g,"\\$&")}if("comment"in n&&typeof n.comment==="string"){if(We.test(n.comment))throw TypeError("`comment` must not contain line terminators");return t=!0,"#"+n.comment}throw TypeError("unrecognized object token shape")}if(/'/.test(n)&&/!/.test(n))return"'"+n.replace(/'/g,`'"'"'`)+"'";if(/["\s\\]/.test(n)&&!/'/.test(n))return"'"+n+"'";if(/["'\s]/.test(n))return'"'+n.replace(/(["\\$`])/g,"\\$1")+'"';return String(n).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,"$1\\$2")}).join(" ")}});var Pt=me(function(ts,Lt){var Ht="(?:"+["\\|\\|","\\&(?:\\&|>>?)",";;\\&?","[;|]\\&","\\<\\(","\\<\\<\\<","\\<\\<-","\\<\\<(?!\\()",">>",">[&|(]","<[&>]","[&;()|<>]"].join("|")+")",Tt=new RegExp("^"+Ht+"$"),It="|&;()<> \\t",dn="'([^']*?)'",Nt="(?:\\\\[\\s\\S]|[^\\\\'])*?",Ct="\\$'"+Nt+"'",Pe=new RegExp("\\$'"+Nt+"(?:(')|\\\\?$)","g"),pn="abeEfnrtv",cn=`\x07\b\x1B\x1B\f
2
+ \r \v`,hn=/^#$/,Xe="'",kt='"',be="$",ge="",$n=4294967296;for(Le=0;Le<4;Le++)ge+=($n*Math.random()).toString(16);var Le,mn=new RegExp("^"+ge);function yn(e,r){var t=r.lastIndex,n=[],o;while(o=r.exec(e))if(n[n.length]=o,r.lastIndex===o.index)r.lastIndex+=1;return r.lastIndex=t,n}function gn(e,r,t){var n=typeof e==="function"?e(t):e[t];if(typeof n>"u"&&t!="")n="";else if(typeof n>"u")n="$";if(typeof n==="object")return r+ge+JSON.stringify(n)+ge;return r+n}var _n=/\\([0-7]{1,3}|x[\dA-Fa-f]{1,2}|u[\dA-Fa-f]{1,4}|U[\dA-Fa-f]{1,8}|c(?:\\\\|[\s\S])|[abeEfnrtv\\'"?])/g;function xn(e,r){var t=r.charAt(0);if(t==="c"){var n=r.charAt(1);return n==="?"?"":String.fromCharCode(n.charCodeAt(0)&31)}if(t==="x"||t==="u"||t==="U"){var o=parseInt(r.slice(1),16);if(o>1114111)return e;return String.fromCharCode.apply(null,o>65535?[55232+(o>>10),56320+(o&1023)]:[o])}if(t>="0"&&t<="7")return String.fromCharCode(parseInt(r,8)&255);var u=pn.indexOf(r);return u<0?r:cn.charAt(u)}function An(e){return e.replace(_n,xn).split("\x00")[0]}function Rn(e,r){return Pe.lastIndex=r,!!Pe.exec(e)[1]}function En(e,r,t){if(!t)t={};var n=t.escape||"\\",o=t.splitUnquoted===!0?`
3
+ `:typeof t.splitUnquoted==="string"?t.splitUnquoted:"",u="(\\"+n+`['"$\\`+n+It+"]|\\$\\$|\\$(?!"+Ct.slice(2)+`)|[^\\s'"$`+It+"])+",s='"(?:\\'+n+'[\\s\\S]|[^"\\'+n+'])*"',i=new RegExp(["("+Ht+")","("+Ct+"|"+u+"|"+s+"|"+dn+")+"].join("|"),"g"),h=yn(e,i);if(h.length===0)return[];if(!r)r={};var N=!1;return h.map(function(_){var w=_[0];if(!w||N)return;if(Tt.test(w))return{op:w};var M=!1,K=!1,g="",k=[],ee=!1,q=null,L=!1,H;function ne(){H+=1;var C,B,l=w.charAt(H);if(l==="{"){if(H+=1,w.charAt(H)==="}")throw Error("Bad substitution: "+w.slice(H-2,H+1));var f=1;C=H;while(f>0&&C<w.length){if(w.charAt(C)==="{"&&w.charAt(C-1)==="$")f+=1;else if(w.charAt(C)==="}")f-=1;C+=1}if(f!==0)throw Error("Bad substitution: "+w.slice(H));C-=1,B=w.slice(H,C),H=C}else if(/[*@#?$!-]/.test(l))B=l;else{var Y=w.slice(H);if(C=Y.match(/[^\w\d_]/),!C)B=Y,H=w.length;else B=Y.slice(0,C.index),H+=C.index-1}return gn(r,"",B)}function X(){if(q===null)return;if(q===0){if(g!=="")k[k.length]=g,g=""}else{k[k.length]=g,g="";for(var C=1;C<q;C+=1)k[k.length]=""}q=null}for(H=0;H<w.length;H++){var T=w.charAt(H);if(o&&T!==be)X();if(L=L||!M&&(T==="*"||T==="?"),K)g+=T,K=!1;else if(M)if(T===M)M=!1;else if(M==Xe)g+=T;else if(T===n)if(H+=1,T=w.charAt(H),T===kt||T===n||T===be)g+=T;else g+=n+T;else if(T===be)g+=ne();else g+=T;else if(T===kt||T===Xe)M=T,ee=!0;else if(Tt.test(T))return{op:w};else if(hn.test(T)){N=!0;var V={comment:e.slice(_.index+H+1)};if(g.length)return[g,V];return[V]}else if(T===n)K=!0;else if(T===be&&w.charAt(H+1)===Xe&&Rn(w,H))X(),ee=!0,g+=An(w.slice(H+2,Pe.lastIndex-1)),H=Pe.lastIndex-1;else if(T===be){var A=ne();if(!o)g+=A;else for(var I=0;I<A.length;I+=1){var a=A.charAt(I);if(o.indexOf(a)<0)X(),g+=a;else if(q===null)q=a===" "||a==="\t"||a===`
4
+ `?0:1;else if(a!==" "&&a!=="\t"&&a!==`
5
+ `)q+=1}}else g+=T}if(L)return{op:"glob",pattern:g};if(o){if(q!==null&&q>0){k[k.length]=g,g="";for(var Q=1;Q<q;Q+=1)k[k.length]=""}if(g!==""||ee&&k.length===0)k[k.length]=g;return k}return g}).reduce(function(_,w){if(typeof w>"u")return _;return[].concat(w).forEach(function(M){_[_.length]=M}),_},[])}Lt.exports=function(r,t,n){var o=En(r,t,n);if(typeof t!=="function")return o;return o.reduce(function(u,s){if(typeof s==="object")return u[u.length]=s,u;var i=s.split(RegExp("("+ge+".*?"+ge+")","g"));if(i.length===1)return u[u.length]=i[0],u;return i.filter(Boolean).forEach(function(h){u[u.length]=mn.test(h)?JSON.parse(h.split(ge)[1]):h}),u},[])}});function _e(e,r){let t=typeof e;if(t!==typeof r)return!1;if(Array.isArray(e)){if(!Array.isArray(r))return!1;let n=e.length;if(n!==r.length)return!1;for(let o=0;o<n;o++)if(!_e(e[o],r[o]))return!1;return!0}if(t==="object"){if(!e||!r)return e===r;let n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;for(let s of n)if(!_e(e[s],r[s]))return!1;return!0}return e===r}function oe(e){return encodeURI(Wt(e))}function Wt(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var Xt={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Qt={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Zt={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},Vt=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function ce(e,r=Object.create(null),t=Vt,n=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let u=e.$id||e.id;if(u){let s=new URL(u,t.href);if(s.hash.length>1)r[s.href]=e;else if(s.hash="",n==="")t=s;else ce(e,r,t)}}else if(e!==!0&&e!==!1)return r;let o=t.href+(n?"#"+n:"");if(r[o]!==void 0)throw Error(`Duplicate schema URI "${o}".`);if(r[o]=e,e===!0||e===!1)return r;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:o});if(e.$ref&&e.__absolute_ref__===void 0){let u=new URL(e.$ref,t.href);u.hash=u.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:u.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let u=new URL(e.$recursiveRef,t.href);u.hash=u.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:u.href})}if(e.$anchor){let u=new URL("#"+e.$anchor,t.href);r[u.href]=e}for(let u in e){if(Zt[u])continue;let s=`${n}/${oe(u)}`,i=e[u];if(Array.isArray(i)){if(Xt[u]){let h=i.length;for(let N=0;N<h;N++)ce(i[N],r,t,`${s}/${N}`)}}else if(Qt[u])for(let h in i)ce(i[h],r,t,`${s}/${oe(h)}`);else ce(i,r,t,s)}return r}var Yt=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Jt=[0,31,28,31,30,31,30,31,31,30,31,30,31],er=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,tr=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,rr=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,nr=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,sr=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,or=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ur=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ir=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,ar=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,fr=(e)=>{if(e[0]==='"')return!1;let[r,t,...n]=e.split("@");if(!r||!t||n.length!==0||r.length>64||t.length>253)return!1;if(r[0]==="."||r.endsWith(".")||r.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(t)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(r))return!1;return t.split(".").every((o)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},lr=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,dr=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,pr=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function le(e){return e.test.bind(e)}var Me={date:Je,time:et.bind(void 0,!1),"date-time":$r,duration:pr,uri:gr,"uri-reference":le(rr),"uri-template":le(nr),url:le(sr),email:fr,hostname:le(tr),ipv4:le(lr),ipv6:le(dr),regex:xr,uuid:le(or),"json-pointer":le(ur),"json-pointer-uri-fragment":le(ir),"relative-json-pointer":le(ar)};function cr(e){return e%4===0&&(e%100!==0||e%400===0)}function Je(e){let r=e.match(Yt);if(!r)return!1;let t=+r[1],n=+r[2],o=+r[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&cr(t)?29:Jt[n])}function et(e,r){let t=r.match(er);if(!t)return!1;let n=+t[1],o=+t[2],u=+t[3],s=!!t[5];return(n<=23&&o<=59&&u<=59||n==23&&o==59&&u==60)&&(!e||s)}var hr=/t|\s/i;function $r(e){let r=e.split(hr);return r.length==2&&Je(r[0])&&et(!0,r[1])}var mr=/\/|:/,yr=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function gr(e){return mr.test(e)&&yr.test(e)}var _r=/[^\\]\\Z/;function xr(e){if(_r.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(r){return!1}}function tt(e){let r=0,t=e.length,n=0,o;while(n<t)if(r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t){if(o=e.charCodeAt(n),(o&64512)==56320)n++}return r}function F(e,r,t="2019-09",n=ce(r),o=!0,u=null,s="#",i="#",h=Object.create(null)){if(r===!0)return{valid:!0,errors:[]};if(r===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};let N=typeof e,_;switch(N){case"boolean":case"number":case"string":_=N;break;case"object":if(e===null)_="null";else if(Array.isArray(e))_="array";else _="object";break;default:throw Error(`Instances of "${N}" type are not supported.`)}let{$ref:w,$recursiveRef:M,$recursiveAnchor:K,type:g,const:k,enum:ee,required:q,not:L,anyOf:H,allOf:ne,oneOf:X,if:T,then:V,else:A,format:I,properties:a,patternProperties:Q,additionalProperties:C,unevaluatedProperties:B,minProperties:l,maxProperties:f,propertyNames:Y,dependentRequired:P,dependentSchemas:J,dependencies:te,prefixItems:W,items:ue,additionalItems:$e,unevaluatedItems:fe,contains:ae,minContains:R,maxContains:de,minItems:Re,maxItems:p,uniqueItems:j,minimum:d,maximum:O,exclusiveMinimum:D,exclusiveMaximum:U,multipleOf:z,minLength:re,maxLength:ie,pattern:pe,__absolute_ref__:we,__absolute_recursive_ref__:zt}=r,m=[];if(K===!0&&u===null)u=r;if(M==="#"){let E=u===null?n[zt]:u,x=`${i}/$recursiveRef`,v=F(e,u===null?r:u,t,n,o,E,s,x,h);if(!v.valid)m.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:x,error:"A subschema had errors."},...v.errors)}if(w!==void 0){let x=n[we||w];if(x===void 0){let c=`Unresolved $ref "${w}".`;if(we&&we!==w)c+=` Absolute URI "${we}".`;throw c+=`
2458
6
  Known schemas:
2459
- - ${Object.keys(lookup).join(`
2460
- - `)}`;
2461
- throw new Error(message);
2462
- }
2463
- const keywordLocation = `${schemaLocation}/$ref`;
2464
- const result = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);
2465
- if (!result.valid) {
2466
- errors.push({
2467
- instanceLocation,
2468
- keyword: "$ref",
2469
- keywordLocation,
2470
- error: "A subschema had errors."
2471
- }, ...result.errors);
2472
- }
2473
- if (draft === "4" || draft === "7") {
2474
- return { valid: errors.length === 0, errors };
2475
- }
2476
- }
2477
- if (Array.isArray($type)) {
2478
- let length = $type.length;
2479
- let valid = false;
2480
- for (let i = 0;i < length; i++) {
2481
- if (instanceType === $type[i] || $type[i] === "integer" && instanceType === "number" && instance % 1 === 0 && instance === instance) {
2482
- valid = true;
2483
- break;
2484
- }
2485
- }
2486
- if (!valid) {
2487
- errors.push({
2488
- instanceLocation,
2489
- keyword: "type",
2490
- keywordLocation: `${schemaLocation}/type`,
2491
- error: `Instance type "${instanceType}" is invalid. Expected "${$type.join('", "')}".`
2492
- });
2493
- }
2494
- } else if ($type === "integer") {
2495
- if (instanceType !== "number" || instance % 1 || instance !== instance) {
2496
- errors.push({
2497
- instanceLocation,
2498
- keyword: "type",
2499
- keywordLocation: `${schemaLocation}/type`,
2500
- error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
2501
- });
2502
- }
2503
- } else if ($type !== undefined && instanceType !== $type) {
2504
- errors.push({
2505
- instanceLocation,
2506
- keyword: "type",
2507
- keywordLocation: `${schemaLocation}/type`,
2508
- error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
2509
- });
2510
- }
2511
- if ($const !== undefined) {
2512
- if (instanceType === "object" || instanceType === "array") {
2513
- if (!deepCompareStrict(instance, $const)) {
2514
- errors.push({
2515
- instanceLocation,
2516
- keyword: "const",
2517
- keywordLocation: `${schemaLocation}/const`,
2518
- error: `Instance does not match ${JSON.stringify($const)}.`
2519
- });
2520
- }
2521
- } else if (instance !== $const) {
2522
- errors.push({
2523
- instanceLocation,
2524
- keyword: "const",
2525
- keywordLocation: `${schemaLocation}/const`,
2526
- error: `Instance does not match ${JSON.stringify($const)}.`
2527
- });
2528
- }
2529
- }
2530
- if ($enum !== undefined) {
2531
- if (instanceType === "object" || instanceType === "array") {
2532
- if (!$enum.some((value) => deepCompareStrict(instance, value))) {
2533
- errors.push({
2534
- instanceLocation,
2535
- keyword: "enum",
2536
- keywordLocation: `${schemaLocation}/enum`,
2537
- error: `Instance does not match any of ${JSON.stringify($enum)}.`
2538
- });
2539
- }
2540
- } else if (!$enum.some((value) => instance === value)) {
2541
- errors.push({
2542
- instanceLocation,
2543
- keyword: "enum",
2544
- keywordLocation: `${schemaLocation}/enum`,
2545
- error: `Instance does not match any of ${JSON.stringify($enum)}.`
2546
- });
2547
- }
2548
- }
2549
- if ($not !== undefined) {
2550
- const keywordLocation = `${schemaLocation}/not`;
2551
- const result = validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation);
2552
- if (result.valid) {
2553
- errors.push({
2554
- instanceLocation,
2555
- keyword: "not",
2556
- keywordLocation,
2557
- error: 'Instance matched "not" schema.'
2558
- });
2559
- }
2560
- }
2561
- let subEvaluateds = [];
2562
- if ($anyOf !== undefined) {
2563
- const keywordLocation = `${schemaLocation}/anyOf`;
2564
- const errorsLength = errors.length;
2565
- let anyValid = false;
2566
- for (let i = 0;i < $anyOf.length; i++) {
2567
- const subSchema = $anyOf[i];
2568
- const subEvaluated = Object.create(evaluated);
2569
- const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
2570
- errors.push(...result.errors);
2571
- anyValid = anyValid || result.valid;
2572
- if (result.valid) {
2573
- subEvaluateds.push(subEvaluated);
2574
- }
2575
- }
2576
- if (anyValid) {
2577
- errors.length = errorsLength;
2578
- } else {
2579
- errors.splice(errorsLength, 0, {
2580
- instanceLocation,
2581
- keyword: "anyOf",
2582
- keywordLocation,
2583
- error: "Instance does not match any subschemas."
2584
- });
2585
- }
2586
- }
2587
- if ($allOf !== undefined) {
2588
- const keywordLocation = `${schemaLocation}/allOf`;
2589
- const errorsLength = errors.length;
2590
- let allValid = true;
2591
- for (let i = 0;i < $allOf.length; i++) {
2592
- const subSchema = $allOf[i];
2593
- const subEvaluated = Object.create(evaluated);
2594
- const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
2595
- errors.push(...result.errors);
2596
- allValid = allValid && result.valid;
2597
- if (result.valid) {
2598
- subEvaluateds.push(subEvaluated);
2599
- }
2600
- }
2601
- if (allValid) {
2602
- errors.length = errorsLength;
2603
- } else {
2604
- errors.splice(errorsLength, 0, {
2605
- instanceLocation,
2606
- keyword: "allOf",
2607
- keywordLocation,
2608
- error: `Instance does not match every subschema.`
2609
- });
2610
- }
2611
- }
2612
- if ($oneOf !== undefined) {
2613
- const keywordLocation = `${schemaLocation}/oneOf`;
2614
- const errorsLength = errors.length;
2615
- const matches = $oneOf.filter((subSchema, i) => {
2616
- const subEvaluated = Object.create(evaluated);
2617
- const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
2618
- errors.push(...result.errors);
2619
- if (result.valid) {
2620
- subEvaluateds.push(subEvaluated);
2621
- }
2622
- return result.valid;
2623
- }).length;
2624
- if (matches === 1) {
2625
- errors.length = errorsLength;
2626
- } else {
2627
- errors.splice(errorsLength, 0, {
2628
- instanceLocation,
2629
- keyword: "oneOf",
2630
- keywordLocation,
2631
- error: `Instance does not match exactly one subschema (${matches} matches).`
2632
- });
2633
- }
2634
- }
2635
- if (instanceType === "object" || instanceType === "array") {
2636
- Object.assign(evaluated, ...subEvaluateds);
2637
- }
2638
- if ($if !== undefined) {
2639
- const keywordLocation = `${schemaLocation}/if`;
2640
- const conditionResult = validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid;
2641
- if (conditionResult) {
2642
- if ($then !== undefined) {
2643
- const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);
2644
- if (!thenResult.valid) {
2645
- errors.push({
2646
- instanceLocation,
2647
- keyword: "if",
2648
- keywordLocation,
2649
- error: `Instance does not match "then" schema.`
2650
- }, ...thenResult.errors);
2651
- }
2652
- }
2653
- } else if ($else !== undefined) {
2654
- const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);
2655
- if (!elseResult.valid) {
2656
- errors.push({
2657
- instanceLocation,
2658
- keyword: "if",
2659
- keywordLocation,
2660
- error: `Instance does not match "else" schema.`
2661
- }, ...elseResult.errors);
2662
- }
2663
- }
2664
- }
2665
- if (instanceType === "object") {
2666
- if ($required !== undefined) {
2667
- for (const key of $required) {
2668
- if (!(key in instance)) {
2669
- errors.push({
2670
- instanceLocation,
2671
- keyword: "required",
2672
- keywordLocation: `${schemaLocation}/required`,
2673
- error: `Instance does not have required property "${key}".`
2674
- });
2675
- }
2676
- }
2677
- }
2678
- const keys = Object.keys(instance);
2679
- if ($minProperties !== undefined && keys.length < $minProperties) {
2680
- errors.push({
2681
- instanceLocation,
2682
- keyword: "minProperties",
2683
- keywordLocation: `${schemaLocation}/minProperties`,
2684
- error: `Instance does not have at least ${$minProperties} properties.`
2685
- });
2686
- }
2687
- if ($maxProperties !== undefined && keys.length > $maxProperties) {
2688
- errors.push({
2689
- instanceLocation,
2690
- keyword: "maxProperties",
2691
- keywordLocation: `${schemaLocation}/maxProperties`,
2692
- error: `Instance does not have at least ${$maxProperties} properties.`
2693
- });
2694
- }
2695
- if ($propertyNames !== undefined) {
2696
- const keywordLocation = `${schemaLocation}/propertyNames`;
2697
- for (const key in instance) {
2698
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
2699
- const result = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
2700
- if (!result.valid) {
2701
- errors.push({
2702
- instanceLocation,
2703
- keyword: "propertyNames",
2704
- keywordLocation,
2705
- error: `Property name "${key}" does not match schema.`
2706
- }, ...result.errors);
2707
- }
2708
- }
2709
- }
2710
- if ($dependentRequired !== undefined) {
2711
- const keywordLocation = `${schemaLocation}/dependantRequired`;
2712
- for (const key in $dependentRequired) {
2713
- if (key in instance) {
2714
- const required = $dependentRequired[key];
2715
- for (const dependantKey of required) {
2716
- if (!(dependantKey in instance)) {
2717
- errors.push({
2718
- instanceLocation,
2719
- keyword: "dependentRequired",
2720
- keywordLocation,
2721
- error: `Instance has "${key}" but does not have "${dependantKey}".`
2722
- });
2723
- }
2724
- }
2725
- }
2726
- }
2727
- }
2728
- if ($dependentSchemas !== undefined) {
2729
- for (const key in $dependentSchemas) {
2730
- const keywordLocation = `${schemaLocation}/dependentSchemas`;
2731
- if (key in instance) {
2732
- const result = validate(instance, $dependentSchemas[key], draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);
2733
- if (!result.valid) {
2734
- errors.push({
2735
- instanceLocation,
2736
- keyword: "dependentSchemas",
2737
- keywordLocation,
2738
- error: `Instance has "${key}" but does not match dependant schema.`
2739
- }, ...result.errors);
2740
- }
2741
- }
2742
- }
2743
- }
2744
- if ($dependencies !== undefined) {
2745
- const keywordLocation = `${schemaLocation}/dependencies`;
2746
- for (const key in $dependencies) {
2747
- if (key in instance) {
2748
- const propsOrSchema = $dependencies[key];
2749
- if (Array.isArray(propsOrSchema)) {
2750
- for (const dependantKey of propsOrSchema) {
2751
- if (!(dependantKey in instance)) {
2752
- errors.push({
2753
- instanceLocation,
2754
- keyword: "dependencies",
2755
- keywordLocation,
2756
- error: `Instance has "${key}" but does not have "${dependantKey}".`
2757
- });
2758
- }
2759
- }
2760
- } else {
2761
- const result = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);
2762
- if (!result.valid) {
2763
- errors.push({
2764
- instanceLocation,
2765
- keyword: "dependencies",
2766
- keywordLocation,
2767
- error: `Instance has "${key}" but does not match dependant schema.`
2768
- }, ...result.errors);
2769
- }
2770
- }
2771
- }
2772
- }
2773
- }
2774
- const thisEvaluated = Object.create(null);
2775
- let stop = false;
2776
- if ($properties !== undefined) {
2777
- const keywordLocation = `${schemaLocation}/properties`;
2778
- for (const key in $properties) {
2779
- if (!(key in instance)) {
2780
- continue;
2781
- }
2782
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
2783
- const result = validate(instance[key], $properties[key], draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);
2784
- if (result.valid) {
2785
- evaluated[key] = thisEvaluated[key] = true;
2786
- } else {
2787
- stop = shortCircuit;
2788
- errors.push({
2789
- instanceLocation,
2790
- keyword: "properties",
2791
- keywordLocation,
2792
- error: `Property "${key}" does not match schema.`
2793
- }, ...result.errors);
2794
- if (stop)
2795
- break;
2796
- }
2797
- }
2798
- }
2799
- if (!stop && $patternProperties !== undefined) {
2800
- const keywordLocation = `${schemaLocation}/patternProperties`;
2801
- for (const pattern in $patternProperties) {
2802
- const regex = new RegExp(pattern, "u");
2803
- const subSchema = $patternProperties[pattern];
2804
- for (const key in instance) {
2805
- if (!regex.test(key)) {
2806
- continue;
2807
- }
2808
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
2809
- const result = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);
2810
- if (result.valid) {
2811
- evaluated[key] = thisEvaluated[key] = true;
2812
- } else {
2813
- stop = shortCircuit;
2814
- errors.push({
2815
- instanceLocation,
2816
- keyword: "patternProperties",
2817
- keywordLocation,
2818
- error: `Property "${key}" matches pattern "${pattern}" but does not match associated schema.`
2819
- }, ...result.errors);
2820
- }
2821
- }
2822
- }
2823
- }
2824
- if (!stop && $additionalProperties !== undefined) {
2825
- const keywordLocation = `${schemaLocation}/additionalProperties`;
2826
- for (const key in instance) {
2827
- if (thisEvaluated[key]) {
2828
- continue;
2829
- }
2830
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
2831
- const result = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
2832
- if (result.valid) {
2833
- evaluated[key] = true;
2834
- } else {
2835
- stop = shortCircuit;
2836
- errors.push({
2837
- instanceLocation,
2838
- keyword: "additionalProperties",
2839
- keywordLocation,
2840
- error: `Property "${key}" does not match additional properties schema.`
2841
- }, ...result.errors);
2842
- }
2843
- }
2844
- } else if (!stop && $unevaluatedProperties !== undefined) {
2845
- const keywordLocation = `${schemaLocation}/unevaluatedProperties`;
2846
- for (const key in instance) {
2847
- if (!evaluated[key]) {
2848
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
2849
- const result = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
2850
- if (result.valid) {
2851
- evaluated[key] = true;
2852
- } else {
2853
- errors.push({
2854
- instanceLocation,
2855
- keyword: "unevaluatedProperties",
2856
- keywordLocation,
2857
- error: `Property "${key}" does not match unevaluated properties schema.`
2858
- }, ...result.errors);
2859
- }
2860
- }
2861
- }
2862
- }
2863
- } else if (instanceType === "array") {
2864
- if ($maxItems !== undefined && instance.length > $maxItems) {
2865
- errors.push({
2866
- instanceLocation,
2867
- keyword: "maxItems",
2868
- keywordLocation: `${schemaLocation}/maxItems`,
2869
- error: `Array has too many items (${instance.length} > ${$maxItems}).`
2870
- });
2871
- }
2872
- if ($minItems !== undefined && instance.length < $minItems) {
2873
- errors.push({
2874
- instanceLocation,
2875
- keyword: "minItems",
2876
- keywordLocation: `${schemaLocation}/minItems`,
2877
- error: `Array has too few items (${instance.length} < ${$minItems}).`
2878
- });
2879
- }
2880
- const length = instance.length;
2881
- let i = 0;
2882
- let stop = false;
2883
- if ($prefixItems !== undefined) {
2884
- const keywordLocation = `${schemaLocation}/prefixItems`;
2885
- const length2 = Math.min($prefixItems.length, length);
2886
- for (;i < length2; i++) {
2887
- const result = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
2888
- evaluated[i] = true;
2889
- if (!result.valid) {
2890
- stop = shortCircuit;
2891
- errors.push({
2892
- instanceLocation,
2893
- keyword: "prefixItems",
2894
- keywordLocation,
2895
- error: `Items did not match schema.`
2896
- }, ...result.errors);
2897
- if (stop)
2898
- break;
2899
- }
2900
- }
2901
- }
2902
- if ($items !== undefined) {
2903
- const keywordLocation = `${schemaLocation}/items`;
2904
- if (Array.isArray($items)) {
2905
- const length2 = Math.min($items.length, length);
2906
- for (;i < length2; i++) {
2907
- const result = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
2908
- evaluated[i] = true;
2909
- if (!result.valid) {
2910
- stop = shortCircuit;
2911
- errors.push({
2912
- instanceLocation,
2913
- keyword: "items",
2914
- keywordLocation,
2915
- error: `Items did not match schema.`
2916
- }, ...result.errors);
2917
- if (stop)
2918
- break;
2919
- }
2920
- }
2921
- } else {
2922
- for (;i < length; i++) {
2923
- const result = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
2924
- evaluated[i] = true;
2925
- if (!result.valid) {
2926
- stop = shortCircuit;
2927
- errors.push({
2928
- instanceLocation,
2929
- keyword: "items",
2930
- keywordLocation,
2931
- error: `Items did not match schema.`
2932
- }, ...result.errors);
2933
- if (stop)
2934
- break;
2935
- }
2936
- }
2937
- }
2938
- if (!stop && $additionalItems !== undefined) {
2939
- const keywordLocation = `${schemaLocation}/additionalItems`;
2940
- for (;i < length; i++) {
2941
- const result = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
2942
- evaluated[i] = true;
2943
- if (!result.valid) {
2944
- stop = shortCircuit;
2945
- errors.push({
2946
- instanceLocation,
2947
- keyword: "additionalItems",
2948
- keywordLocation,
2949
- error: `Items did not match additional items schema.`
2950
- }, ...result.errors);
2951
- }
2952
- }
2953
- }
2954
- }
2955
- if ($contains !== undefined) {
2956
- if (length === 0 && $minContains === undefined) {
2957
- errors.push({
2958
- instanceLocation,
2959
- keyword: "contains",
2960
- keywordLocation: `${schemaLocation}/contains`,
2961
- error: `Array is empty. It must contain at least one item matching the schema.`
2962
- });
2963
- } else if ($minContains !== undefined && length < $minContains) {
2964
- errors.push({
2965
- instanceLocation,
2966
- keyword: "minContains",
2967
- keywordLocation: `${schemaLocation}/minContains`,
2968
- error: `Array has less items (${length}) than minContains (${$minContains}).`
2969
- });
2970
- } else {
2971
- const keywordLocation = `${schemaLocation}/contains`;
2972
- const errorsLength = errors.length;
2973
- let contained = 0;
2974
- for (let j = 0;j < length; j++) {
2975
- const result = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);
2976
- if (result.valid) {
2977
- evaluated[j] = true;
2978
- contained++;
2979
- } else {
2980
- errors.push(...result.errors);
2981
- }
2982
- }
2983
- if (contained >= ($minContains || 0)) {
2984
- errors.length = errorsLength;
2985
- }
2986
- if ($minContains === undefined && $maxContains === undefined && contained === 0) {
2987
- errors.splice(errorsLength, 0, {
2988
- instanceLocation,
2989
- keyword: "contains",
2990
- keywordLocation,
2991
- error: `Array does not contain item matching schema.`
2992
- });
2993
- } else if ($minContains !== undefined && contained < $minContains) {
2994
- errors.push({
2995
- instanceLocation,
2996
- keyword: "minContains",
2997
- keywordLocation: `${schemaLocation}/minContains`,
2998
- error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`
2999
- });
3000
- } else if ($maxContains !== undefined && contained > $maxContains) {
3001
- errors.push({
3002
- instanceLocation,
3003
- keyword: "maxContains",
3004
- keywordLocation: `${schemaLocation}/maxContains`,
3005
- error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`
3006
- });
3007
- }
3008
- }
3009
- }
3010
- if (!stop && $unevaluatedItems !== undefined) {
3011
- const keywordLocation = `${schemaLocation}/unevaluatedItems`;
3012
- for (i;i < length; i++) {
3013
- if (evaluated[i]) {
3014
- continue;
3015
- }
3016
- const result = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
3017
- evaluated[i] = true;
3018
- if (!result.valid) {
3019
- errors.push({
3020
- instanceLocation,
3021
- keyword: "unevaluatedItems",
3022
- keywordLocation,
3023
- error: `Items did not match unevaluated items schema.`
3024
- }, ...result.errors);
3025
- }
3026
- }
3027
- }
3028
- if ($uniqueItems) {
3029
- for (let j = 0;j < length; j++) {
3030
- const a = instance[j];
3031
- const ao = typeof a === "object" && a !== null;
3032
- for (let k = 0;k < length; k++) {
3033
- if (j === k) {
3034
- continue;
3035
- }
3036
- const b = instance[k];
3037
- const bo = typeof b === "object" && b !== null;
3038
- if (a === b || ao && bo && deepCompareStrict(a, b)) {
3039
- errors.push({
3040
- instanceLocation,
3041
- keyword: "uniqueItems",
3042
- keywordLocation: `${schemaLocation}/uniqueItems`,
3043
- error: `Duplicate items at indexes ${j} and ${k}.`
3044
- });
3045
- j = Number.MAX_SAFE_INTEGER;
3046
- k = Number.MAX_SAFE_INTEGER;
3047
- }
3048
- }
3049
- }
3050
- }
3051
- } else if (instanceType === "number") {
3052
- if (draft === "4") {
3053
- if ($minimum !== undefined && ($exclusiveMinimum === true && instance <= $minimum || instance < $minimum)) {
3054
- errors.push({
3055
- instanceLocation,
3056
- keyword: "minimum",
3057
- keywordLocation: `${schemaLocation}/minimum`,
3058
- error: `${instance} is less than ${$exclusiveMinimum ? "or equal to " : ""} ${$minimum}.`
3059
- });
3060
- }
3061
- if ($maximum !== undefined && ($exclusiveMaximum === true && instance >= $maximum || instance > $maximum)) {
3062
- errors.push({
3063
- instanceLocation,
3064
- keyword: "maximum",
3065
- keywordLocation: `${schemaLocation}/maximum`,
3066
- error: `${instance} is greater than ${$exclusiveMaximum ? "or equal to " : ""} ${$maximum}.`
3067
- });
3068
- }
3069
- } else {
3070
- if ($minimum !== undefined && instance < $minimum) {
3071
- errors.push({
3072
- instanceLocation,
3073
- keyword: "minimum",
3074
- keywordLocation: `${schemaLocation}/minimum`,
3075
- error: `${instance} is less than ${$minimum}.`
3076
- });
3077
- }
3078
- if ($maximum !== undefined && instance > $maximum) {
3079
- errors.push({
3080
- instanceLocation,
3081
- keyword: "maximum",
3082
- keywordLocation: `${schemaLocation}/maximum`,
3083
- error: `${instance} is greater than ${$maximum}.`
3084
- });
3085
- }
3086
- if ($exclusiveMinimum !== undefined && instance <= $exclusiveMinimum) {
3087
- errors.push({
3088
- instanceLocation,
3089
- keyword: "exclusiveMinimum",
3090
- keywordLocation: `${schemaLocation}/exclusiveMinimum`,
3091
- error: `${instance} is less than ${$exclusiveMinimum}.`
3092
- });
3093
- }
3094
- if ($exclusiveMaximum !== undefined && instance >= $exclusiveMaximum) {
3095
- errors.push({
3096
- instanceLocation,
3097
- keyword: "exclusiveMaximum",
3098
- keywordLocation: `${schemaLocation}/exclusiveMaximum`,
3099
- error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`
3100
- });
3101
- }
3102
- }
3103
- if ($multipleOf !== undefined) {
3104
- const remainder = instance % $multipleOf;
3105
- if (Math.abs(0 - remainder) >= 0.00000011920929 && Math.abs($multipleOf - remainder) >= 0.00000011920929) {
3106
- errors.push({
3107
- instanceLocation,
3108
- keyword: "multipleOf",
3109
- keywordLocation: `${schemaLocation}/multipleOf`,
3110
- error: `${instance} is not a multiple of ${$multipleOf}.`
3111
- });
3112
- }
3113
- }
3114
- } else if (instanceType === "string") {
3115
- const length = $minLength === undefined && $maxLength === undefined ? 0 : ucs2length(instance);
3116
- if ($minLength !== undefined && length < $minLength) {
3117
- errors.push({
3118
- instanceLocation,
3119
- keyword: "minLength",
3120
- keywordLocation: `${schemaLocation}/minLength`,
3121
- error: `String is too short (${length} < ${$minLength}).`
3122
- });
3123
- }
3124
- if ($maxLength !== undefined && length > $maxLength) {
3125
- errors.push({
3126
- instanceLocation,
3127
- keyword: "maxLength",
3128
- keywordLocation: `${schemaLocation}/maxLength`,
3129
- error: `String is too long (${length} > ${$maxLength}).`
3130
- });
3131
- }
3132
- if ($pattern !== undefined && !new RegExp($pattern, "u").test(instance)) {
3133
- errors.push({
3134
- instanceLocation,
3135
- keyword: "pattern",
3136
- keywordLocation: `${schemaLocation}/pattern`,
3137
- error: `String does not match pattern.`
3138
- });
3139
- }
3140
- if ($format !== undefined && format[$format] && !format[$format](instance)) {
3141
- errors.push({
3142
- instanceLocation,
3143
- keyword: "format",
3144
- keywordLocation: `${schemaLocation}/format`,
3145
- error: `String does not match format "${$format}".`
3146
- });
3147
- }
3148
- }
3149
- return { valid: errors.length === 0, errors };
3150
- }
3151
-
3152
- // node_modules/@cfworker/json-schema/dist/esm/validator.js
3153
- class Validator {
3154
- schema;
3155
- draft;
3156
- shortCircuit;
3157
- lookup;
3158
- constructor(schema, draft = "2019-09", shortCircuit = true) {
3159
- this.schema = schema;
3160
- this.draft = draft;
3161
- this.shortCircuit = shortCircuit;
3162
- this.lookup = dereference(schema);
3163
- }
3164
- validate(instance) {
3165
- return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
3166
- }
3167
- addSchema(schema, id) {
3168
- if (id) {
3169
- schema = { ...schema, $id: id };
3170
- }
3171
- dereference(schema, this.lookup);
3172
- }
3173
- }
3174
- // node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
3175
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
3176
- function normalizeWindowsPath(input = "") {
3177
- if (!input) {
3178
- return input;
3179
- }
3180
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
3181
- }
3182
- var _UNC_REGEX = /^[/\\]{2}/;
3183
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
3184
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
3185
- var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
3186
- var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
3187
- var normalize = function(path) {
3188
- if (path.length === 0) {
3189
- return ".";
3190
- }
3191
- path = normalizeWindowsPath(path);
3192
- const isUNCPath = path.match(_UNC_REGEX);
3193
- const isPathAbsolute = isAbsolute(path);
3194
- const trailingSeparator = path[path.length - 1] === "/";
3195
- path = normalizeString(path, !isPathAbsolute);
3196
- if (path.length === 0) {
3197
- if (isPathAbsolute) {
3198
- return "/";
3199
- }
3200
- return trailingSeparator ? "./" : ".";
3201
- }
3202
- if (trailingSeparator) {
3203
- path += "/";
3204
- }
3205
- if (_DRIVE_LETTER_RE.test(path)) {
3206
- path += "/";
3207
- }
3208
- if (isUNCPath) {
3209
- if (!isPathAbsolute) {
3210
- return `//./${path}`;
3211
- }
3212
- return `//${path}`;
3213
- }
3214
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
3215
- };
3216
- var join = function(...segments) {
3217
- let path = "";
3218
- for (const seg of segments) {
3219
- if (!seg) {
3220
- continue;
3221
- }
3222
- if (path.length > 0) {
3223
- const pathTrailing = path[path.length - 1] === "/";
3224
- const segLeading = seg[0] === "/";
3225
- const both = pathTrailing && segLeading;
3226
- if (both) {
3227
- path += seg.slice(1);
3228
- } else {
3229
- path += pathTrailing || segLeading ? seg : `/${seg}`;
3230
- }
3231
- } else {
3232
- path += seg;
3233
- }
3234
- }
3235
- return normalize(path);
3236
- };
3237
- function cwd() {
3238
- if (false) {}
3239
- return "/";
3240
- }
3241
- var resolve = function(...arguments_) {
3242
- arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
3243
- let resolvedPath = "";
3244
- let resolvedAbsolute = false;
3245
- for (let index = arguments_.length - 1;index >= -1 && !resolvedAbsolute; index--) {
3246
- const path = index >= 0 ? arguments_[index] : cwd();
3247
- if (!path || path.length === 0) {
3248
- continue;
3249
- }
3250
- resolvedPath = `${path}/${resolvedPath}`;
3251
- resolvedAbsolute = isAbsolute(path);
3252
- }
3253
- resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
3254
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
3255
- return `/${resolvedPath}`;
3256
- }
3257
- return resolvedPath.length > 0 ? resolvedPath : ".";
3258
- };
3259
- function normalizeString(path, allowAboveRoot) {
3260
- let res = "";
3261
- let lastSegmentLength = 0;
3262
- let lastSlash = -1;
3263
- let dots = 0;
3264
- let char = null;
3265
- for (let index = 0;index <= path.length; ++index) {
3266
- if (index < path.length) {
3267
- char = path[index];
3268
- } else if (char === "/") {
3269
- break;
3270
- } else {
3271
- char = "/";
3272
- }
3273
- if (char === "/") {
3274
- if (lastSlash === index - 1 || dots === 1)
3275
- ;
3276
- else if (dots === 2) {
3277
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
3278
- if (res.length > 2) {
3279
- const lastSlashIndex = res.lastIndexOf("/");
3280
- if (lastSlashIndex === -1) {
3281
- res = "";
3282
- lastSegmentLength = 0;
3283
- } else {
3284
- res = res.slice(0, lastSlashIndex);
3285
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
3286
- }
3287
- lastSlash = index;
3288
- dots = 0;
3289
- continue;
3290
- } else if (res.length > 0) {
3291
- res = "";
3292
- lastSegmentLength = 0;
3293
- lastSlash = index;
3294
- dots = 0;
3295
- continue;
3296
- }
3297
- }
3298
- if (allowAboveRoot) {
3299
- res += res.length > 0 ? "/.." : "..";
3300
- lastSegmentLength = 2;
3301
- }
3302
- } else {
3303
- if (res.length > 0) {
3304
- res += `/${path.slice(lastSlash + 1, index)}`;
3305
- } else {
3306
- res = path.slice(lastSlash + 1, index);
3307
- }
3308
- lastSegmentLength = index - lastSlash - 1;
3309
- }
3310
- lastSlash = index;
3311
- dots = 0;
3312
- } else if (char === "." && dots !== -1) {
3313
- ++dots;
3314
- } else {
3315
- dots = -1;
3316
- }
3317
- }
3318
- return res;
3319
- }
3320
- var isAbsolute = function(p) {
3321
- return _IS_ABSOLUTE_RE.test(p);
3322
- };
3323
- var extname = function(p) {
3324
- if (p === "..")
3325
- return "";
3326
- const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
3327
- return match && match[1] || "";
3328
- };
3329
- var relative = function(from, to) {
3330
- const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
3331
- const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
3332
- if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
3333
- return _to.join("/");
3334
- }
3335
- const _fromCopy = [..._from];
3336
- for (const segment of _fromCopy) {
3337
- if (_to[0] !== segment) {
3338
- break;
3339
- }
3340
- _from.shift();
3341
- _to.shift();
3342
- }
3343
- return [..._from.map(() => ".."), ..._to].join("/");
3344
- };
3345
- var dirname = function(p) {
3346
- const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
3347
- if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
3348
- segments[0] += "/";
3349
- }
3350
- return segments.join("/") || (isAbsolute(p) ? "/" : ".");
3351
- };
3352
- var basename = function(p, extension) {
3353
- const segments = normalizeWindowsPath(p).split("/");
3354
- let lastSegment = "";
3355
- for (let i = segments.length - 1;i >= 0; i--) {
3356
- const val = segments[i];
3357
- if (val) {
3358
- lastSegment = val;
3359
- break;
3360
- }
3361
- }
3362
- return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
3363
- };
3364
- // src/vendor.ts
3365
- var import_posix = __toESM(require_picomatch(), 1);
3366
-
3367
- // node_modules/shell-quote/index.js
3368
- var $quote = require_quote();
3369
- var $parse = require_parse2();
3370
- var export_picomatch = import_posix.default;
3371
-
3372
- export {
3373
- Validator,
3374
- basename,
3375
- dirname,
3376
- extname,
3377
- isAbsolute,
3378
- join,
3379
- normalize,
3380
- $parse as parse,
3381
- export_picomatch as picomatch,
3382
- $quote as quote,
3383
- relative,
3384
- resolve
3385
- };
7
+ - ${Object.keys(n).join(`
8
+ - `)}`,Error(c)}let v=`${i}/$ref`,y=F(e,x,t,n,o,u,s,v,h);if(!y.valid)m.push({instanceLocation:s,keyword:"$ref",keywordLocation:v,error:"A subschema had errors."},...y.errors);if(t==="4"||t==="7")return{valid:m.length===0,errors:m}}if(Array.isArray(g)){let E=g.length,x=!1;for(let v=0;v<E;v++)if(_===g[v]||g[v]==="integer"&&_==="number"&&e%1===0&&e===e){x=!0;break}if(!x)m.push({instanceLocation:s,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${_}" is invalid. Expected "${g.join('", "')}".`})}else if(g==="integer"){if(_!=="number"||e%1||e!==e)m.push({instanceLocation:s,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${_}" is invalid. Expected "${g}".`})}else if(g!==void 0&&_!==g)m.push({instanceLocation:s,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${_}" is invalid. Expected "${g}".`});if(k!==void 0){if(_==="object"||_==="array"){if(!_e(e,k))m.push({instanceLocation:s,keyword:"const",keywordLocation:`${i}/const`,error:`Instance does not match ${JSON.stringify(k)}.`})}else if(e!==k)m.push({instanceLocation:s,keyword:"const",keywordLocation:`${i}/const`,error:`Instance does not match ${JSON.stringify(k)}.`})}if(ee!==void 0){if(_==="object"||_==="array"){if(!ee.some((E)=>_e(e,E)))m.push({instanceLocation:s,keyword:"enum",keywordLocation:`${i}/enum`,error:`Instance does not match any of ${JSON.stringify(ee)}.`})}else if(!ee.some((E)=>e===E))m.push({instanceLocation:s,keyword:"enum",keywordLocation:`${i}/enum`,error:`Instance does not match any of ${JSON.stringify(ee)}.`})}if(L!==void 0){let E=`${i}/not`;if(F(e,L,t,n,o,u,s,E).valid)m.push({instanceLocation:s,keyword:"not",keywordLocation:E,error:'Instance matched "not" schema.'})}let Oe=[];if(H!==void 0){let E=`${i}/anyOf`,x=m.length,v=!1;for(let y=0;y<H.length;y++){let c=H[y],b=Object.create(h),S=F(e,c,t,n,o,K===!0?u:null,s,`${E}/${y}`,b);if(m.push(...S.errors),v=v||S.valid,S.valid)Oe.push(b)}if(v)m.length=x;else m.splice(x,0,{instanceLocation:s,keyword:"anyOf",keywordLocation:E,error:"Instance does not match any subschemas."})}if(ne!==void 0){let E=`${i}/allOf`,x=m.length,v=!0;for(let y=0;y<ne.length;y++){let c=ne[y],b=Object.create(h),S=F(e,c,t,n,o,K===!0?u:null,s,`${E}/${y}`,b);if(m.push(...S.errors),v=v&&S.valid,S.valid)Oe.push(b)}if(v)m.length=x;else m.splice(x,0,{instanceLocation:s,keyword:"allOf",keywordLocation:E,error:"Instance does not match every subschema."})}if(X!==void 0){let E=`${i}/oneOf`,x=m.length,v=X.filter((y,c)=>{let b=Object.create(h),S=F(e,y,t,n,o,K===!0?u:null,s,`${E}/${c}`,b);if(m.push(...S.errors),S.valid)Oe.push(b);return S.valid}).length;if(v===1)m.length=x;else m.splice(x,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:E,error:`Instance does not match exactly one subschema (${v} matches).`})}if(_==="object"||_==="array")Object.assign(h,...Oe);if(T!==void 0){let E=`${i}/if`;if(F(e,T,t,n,o,u,s,E,h).valid){if(V!==void 0){let v=F(e,V,t,n,o,u,s,`${i}/then`,h);if(!v.valid)m.push({instanceLocation:s,keyword:"if",keywordLocation:E,error:'Instance does not match "then" schema.'},...v.errors)}}else if(A!==void 0){let v=F(e,A,t,n,o,u,s,`${i}/else`,h);if(!v.valid)m.push({instanceLocation:s,keyword:"if",keywordLocation:E,error:'Instance does not match "else" schema.'},...v.errors)}}if(_==="object"){if(q!==void 0){for(let y of q)if(!(y in e))m.push({instanceLocation:s,keyword:"required",keywordLocation:`${i}/required`,error:`Instance does not have required property "${y}".`})}let E=Object.keys(e);if(l!==void 0&&E.length<l)m.push({instanceLocation:s,keyword:"minProperties",keywordLocation:`${i}/minProperties`,error:`Instance does not have at least ${l} properties.`});if(f!==void 0&&E.length>f)m.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${i}/maxProperties`,error:`Instance does not have at least ${f} properties.`});if(Y!==void 0){let y=`${i}/propertyNames`;for(let c in e){let b=`${s}/${oe(c)}`,S=F(c,Y,t,n,o,u,b,y);if(!S.valid)m.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:y,error:`Property name "${c}" does not match schema.`},...S.errors)}}if(P!==void 0){let y=`${i}/dependantRequired`;for(let c in P)if(c in e){let b=P[c];for(let S of b)if(!(S in e))m.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:y,error:`Instance has "${c}" but does not have "${S}".`})}}if(J!==void 0)for(let y in J){let c=`${i}/dependentSchemas`;if(y in e){let b=F(e,J[y],t,n,o,u,s,`${c}/${oe(y)}`,h);if(!b.valid)m.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:c,error:`Instance has "${y}" but does not match dependant schema.`},...b.errors)}}if(te!==void 0){let y=`${i}/dependencies`;for(let c in te)if(c in e){let b=te[c];if(Array.isArray(b)){for(let S of b)if(!(S in e))m.push({instanceLocation:s,keyword:"dependencies",keywordLocation:y,error:`Instance has "${c}" but does not have "${S}".`})}else{let S=F(e,b,t,n,o,u,s,`${y}/${oe(c)}`);if(!S.valid)m.push({instanceLocation:s,keyword:"dependencies",keywordLocation:y,error:`Instance has "${c}" but does not match dependant schema.`},...S.errors)}}}let x=Object.create(null),v=!1;if(a!==void 0){let y=`${i}/properties`;for(let c in a){if(!(c in e))continue;let b=`${s}/${oe(c)}`,S=F(e[c],a[c],t,n,o,u,b,`${y}/${oe(c)}`);if(S.valid)h[c]=x[c]=!0;else if(v=o,m.push({instanceLocation:s,keyword:"properties",keywordLocation:y,error:`Property "${c}" does not match schema.`},...S.errors),v)break}}if(!v&&Q!==void 0){let y=`${i}/patternProperties`;for(let c in Q){let b=new RegExp(c,"u"),S=Q[c];for(let se in e){if(!b.test(se))continue;let Qe=`${s}/${oe(se)}`,Ze=F(e[se],S,t,n,o,u,Qe,`${y}/${oe(c)}`);if(Ze.valid)h[se]=x[se]=!0;else v=o,m.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:y,error:`Property "${se}" matches pattern "${c}" but does not match associated schema.`},...Ze.errors)}}}if(!v&&C!==void 0){let y=`${i}/additionalProperties`;for(let c in e){if(x[c])continue;let b=`${s}/${oe(c)}`,S=F(e[c],C,t,n,o,u,b,y);if(S.valid)h[c]=!0;else v=o,m.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:y,error:`Property "${c}" does not match additional properties schema.`},...S.errors)}}else if(!v&&B!==void 0){let y=`${i}/unevaluatedProperties`;for(let c in e)if(!h[c]){let b=`${s}/${oe(c)}`,S=F(e[c],B,t,n,o,u,b,y);if(S.valid)h[c]=!0;else m.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:y,error:`Property "${c}" does not match unevaluated properties schema.`},...S.errors)}}}else if(_==="array"){if(p!==void 0&&e.length>p)m.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${i}/maxItems`,error:`Array has too many items (${e.length} > ${p}).`});if(Re!==void 0&&e.length<Re)m.push({instanceLocation:s,keyword:"minItems",keywordLocation:`${i}/minItems`,error:`Array has too few items (${e.length} < ${Re}).`});let E=e.length,x=0,v=!1;if(W!==void 0){let y=`${i}/prefixItems`,c=Math.min(W.length,E);for(;x<c;x++){let b=F(e[x],W[x],t,n,o,u,`${s}/${x}`,`${y}/${x}`);if(h[x]=!0,!b.valid){if(v=o,m.push({instanceLocation:s,keyword:"prefixItems",keywordLocation:y,error:"Items did not match schema."},...b.errors),v)break}}}if(ue!==void 0){let y=`${i}/items`;if(Array.isArray(ue)){let c=Math.min(ue.length,E);for(;x<c;x++){let b=F(e[x],ue[x],t,n,o,u,`${s}/${x}`,`${y}/${x}`);if(h[x]=!0,!b.valid){if(v=o,m.push({instanceLocation:s,keyword:"items",keywordLocation:y,error:"Items did not match schema."},...b.errors),v)break}}}else for(;x<E;x++){let c=F(e[x],ue,t,n,o,u,`${s}/${x}`,y);if(h[x]=!0,!c.valid){if(v=o,m.push({instanceLocation:s,keyword:"items",keywordLocation:y,error:"Items did not match schema."},...c.errors),v)break}}if(!v&&$e!==void 0){let c=`${i}/additionalItems`;for(;x<E;x++){let b=F(e[x],$e,t,n,o,u,`${s}/${x}`,c);if(h[x]=!0,!b.valid)v=o,m.push({instanceLocation:s,keyword:"additionalItems",keywordLocation:c,error:"Items did not match additional items schema."},...b.errors)}}}if(ae!==void 0)if(E===0&&R===void 0)m.push({instanceLocation:s,keyword:"contains",keywordLocation:`${i}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(R!==void 0&&E<R)m.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${i}/minContains`,error:`Array has less items (${E}) than minContains (${R}).`});else{let y=`${i}/contains`,c=m.length,b=0;for(let S=0;S<E;S++){let se=F(e[S],ae,t,n,o,u,`${s}/${S}`,y);if(se.valid)h[S]=!0,b++;else m.push(...se.errors)}if(b>=(R||0))m.length=c;if(R===void 0&&de===void 0&&b===0)m.splice(c,0,{instanceLocation:s,keyword:"contains",keywordLocation:y,error:"Array does not contain item matching schema."});else if(R!==void 0&&b<R)m.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${i}/minContains`,error:`Array must contain at least ${R} items matching schema. Only ${b} items were found.`});else if(de!==void 0&&b>de)m.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${i}/maxContains`,error:`Array may contain at most ${de} items matching schema. ${b} items were found.`})}if(!v&&fe!==void 0){let y=`${i}/unevaluatedItems`;for(x;x<E;x++){if(h[x])continue;let c=F(e[x],fe,t,n,o,u,`${s}/${x}`,y);if(h[x]=!0,!c.valid)m.push({instanceLocation:s,keyword:"unevaluatedItems",keywordLocation:y,error:"Items did not match unevaluated items schema."},...c.errors)}}if(j)for(let y=0;y<E;y++){let c=e[y],b=typeof c==="object"&&c!==null;for(let S=0;S<E;S++){if(y===S)continue;let se=e[S];if(c===se||b&&(typeof se==="object"&&se!==null)&&_e(c,se))m.push({instanceLocation:s,keyword:"uniqueItems",keywordLocation:`${i}/uniqueItems`,error:`Duplicate items at indexes ${y} and ${S}.`}),y=Number.MAX_SAFE_INTEGER,S=Number.MAX_SAFE_INTEGER}}}else if(_==="number"){if(t==="4"){if(d!==void 0&&(D===!0&&e<=d||e<d))m.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${i}/minimum`,error:`${e} is less than ${D?"or equal to ":""} ${d}.`});if(O!==void 0&&(U===!0&&e>=O||e>O))m.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${i}/maximum`,error:`${e} is greater than ${U?"or equal to ":""} ${O}.`})}else{if(d!==void 0&&e<d)m.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${i}/minimum`,error:`${e} is less than ${d}.`});if(O!==void 0&&e>O)m.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${i}/maximum`,error:`${e} is greater than ${O}.`});if(D!==void 0&&e<=D)m.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${i}/exclusiveMinimum`,error:`${e} is less than ${D}.`});if(U!==void 0&&e>=U)m.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${i}/exclusiveMaximum`,error:`${e} is greater than or equal to ${U}.`})}if(z!==void 0){let E=e%z;if(Math.abs(0-E)>=0.00000011920929&&Math.abs(z-E)>=0.00000011920929)m.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${i}/multipleOf`,error:`${e} is not a multiple of ${z}.`})}}else if(_==="string"){let E=re===void 0&&ie===void 0?0:tt(e);if(re!==void 0&&E<re)m.push({instanceLocation:s,keyword:"minLength",keywordLocation:`${i}/minLength`,error:`String is too short (${E} < ${re}).`});if(ie!==void 0&&E>ie)m.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${i}/maxLength`,error:`String is too long (${E} > ${ie}).`});if(pe!==void 0&&!new RegExp(pe,"u").test(e))m.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${i}/pattern`,error:"String does not match pattern."});if(I!==void 0&&Me[I]&&!Me[I](e))m.push({instanceLocation:s,keyword:"format",keywordLocation:`${i}/format`,error:`String does not match format "${I}".`})}return{valid:m.length===0,errors:m}}class rt{schema;draft;shortCircuit;lookup;constructor(e,r="2019-09",t=!0){this.schema=e,this.draft=r,this.shortCircuit=t,this.lookup=ce(e)}validate(e){return F(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){if(r)e={...e,$id:r};ce(e,this.lookup)}}var Ar=/^[A-Za-z]:\//;function Ee(e=""){if(!e)return e;return e.replace(/\\/g,"/").replace(Ar,(r)=>r.toUpperCase())}var Rr=/^[/\\]{2}/,Er=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,st=/^[A-Za-z]:$/,nt=/^\/([A-Za-z]:)?$/,Sr=/.(\.[^./]+|\.)$/;var De=function(e){if(e.length===0)return".";e=Ee(e);let r=e.match(Rr),t=ye(e),n=e[e.length-1]==="/";if(e=ze(e,!t),e.length===0){if(t)return"/";return n?"./":"."}if(n)e+="/";if(st.test(e))e+="/";if(r){if(!t)return`//./${e}`;return`//${e}`}return t&&!ye(e)?`/${e}`:e},ot=function(...e){let r="";for(let t of e){if(!t)continue;if(r.length>0){let n=r[r.length-1]==="/",o=t[0]==="/";if(n&&o)r+=t.slice(1);else r+=n||o?t:`/${t}`}else r+=t}return De(r)};function br(){return"/"}var ve=function(...e){e=e.map((n)=>Ee(n));let r="",t=!1;for(let n=e.length-1;n>=-1&&!t;n--){let o=n>=0?e[n]:br();if(!o||o.length===0)continue;r=`${o}/${r}`,t=ye(o)}if(r=ze(r,!t),t&&!ye(r))return`/${r}`;return r.length>0?r:"."};function ze(e,r){let t="",n=0,o=-1,u=0,s=null;for(let i=0;i<=e.length;++i){if(i<e.length)s=e[i];else if(s==="/")break;else s="/";if(s==="/"){if(o===i-1||u===1);else if(u===2){if(t.length<2||n!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let h=t.lastIndexOf("/");if(h===-1)t="",n=0;else t=t.slice(0,h),n=t.length-1-t.lastIndexOf("/");o=i,u=0;continue}else if(t.length>0){t="",n=0,o=i,u=0;continue}}if(r)t+=t.length>0?"/..":"..",n=2}else{if(t.length>0)t+=`/${e.slice(o+1,i)}`;else t=e.slice(o+1,i);n=i-o-1}o=i,u=0}else if(s==="."&&u!==-1)++u;else u=-1}return t}var ye=function(e){return Er.test(e)};var ut=function(e){if(e==="..")return"";let r=Sr.exec(Ee(e));return r&&r[1]||""},it=function(e,r){let t=ve(e).replace(nt,"$1").split("/"),n=ve(r).replace(nt,"$1").split("/");if(n[0][1]===":"&&t[0][1]===":"&&t[0]!==n[0])return n.join("/");let o=[...t];for(let u of o){if(n[0]!==u)break;t.shift(),n.shift()}return[...t.map(()=>".."),...n].join("/")},at=function(e){let r=Ee(e).replace(/\/$/,"").split("/").slice(0,-1);if(r.length===1&&st.test(r[0]))r[0]+="/";return r.join("/")||(ye(e)?"/":".")};var ft=function(e,r){let t=Ee(e).split("/"),n="";for(let o=t.length-1;o>=0;o--){let u=t[o];if(u){n=u;break}}return r&&n.endsWith(r)?n.slice(0,-r.length):n};var Sn=Kt(wt(),1);var Mt=vt(),Dt=Pt();var $s=Sn.default;export{rt as Validator,ft as basename,at as dirname,ut as extname,ye as isAbsolute,ot as join,De as normalize,Dt as parse,$s as picomatch,Mt as quote,it as relative,ve as resolve};