vitest 0.0.68 → 0.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1415 @@
1
+ import { existsSync, promises } from 'fs';
2
+ import require$$0 from 'tty';
3
+ import { SourceMapConsumer } from 'source-map';
4
+ import { n as notNullish } from './utils-9dcc4050.js';
5
+
6
+ var picocolors = {exports: {}};
7
+
8
+ let tty = require$$0;
9
+
10
+ let isColorSupported =
11
+ !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
12
+ ("FORCE_COLOR" in process.env ||
13
+ process.argv.includes("--color") ||
14
+ process.platform === "win32" ||
15
+ (tty.isatty(1) && process.env.TERM !== "dumb") ||
16
+ "CI" in process.env);
17
+
18
+ let formatter =
19
+ (open, close, replace = open) =>
20
+ input => {
21
+ let string = "" + input;
22
+ let index = string.indexOf(close, open.length);
23
+ return ~index
24
+ ? open + replaceClose(string, close, replace, index) + close
25
+ : open + string + close
26
+ };
27
+
28
+ let replaceClose = (string, close, replace, index) => {
29
+ let start = string.substring(0, index) + replace;
30
+ let end = string.substring(index + close.length);
31
+ let nextIndex = end.indexOf(close);
32
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
33
+ };
34
+
35
+ let createColors = (enabled = isColorSupported) => ({
36
+ isColorSupported: enabled,
37
+ reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
38
+ bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
39
+ dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
40
+ italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
41
+ underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
42
+ inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
43
+ hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
44
+ strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
45
+ black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
46
+ red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
47
+ green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
48
+ yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
49
+ blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
50
+ magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
51
+ cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
52
+ white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
53
+ gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
54
+ bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
55
+ bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
56
+ bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
57
+ bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
58
+ bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
59
+ bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
60
+ bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
61
+ bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
62
+ });
63
+
64
+ picocolors.exports = createColors();
65
+ picocolors.exports.createColors = createColors;
66
+
67
+ var c = picocolors.exports;
68
+
69
+ function Diff() {}
70
+ Diff.prototype = {
71
+ diff: function diff(oldString, newString) {
72
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
73
+ var callback = options.callback;
74
+
75
+ if (typeof options === 'function') {
76
+ callback = options;
77
+ options = {};
78
+ }
79
+
80
+ this.options = options;
81
+ var self = this;
82
+
83
+ function done(value) {
84
+ if (callback) {
85
+ setTimeout(function () {
86
+ callback(undefined, value);
87
+ }, 0);
88
+ return true;
89
+ } else {
90
+ return value;
91
+ }
92
+ } // Allow subclasses to massage the input prior to running
93
+
94
+
95
+ oldString = this.castInput(oldString);
96
+ newString = this.castInput(newString);
97
+ oldString = this.removeEmpty(this.tokenize(oldString));
98
+ newString = this.removeEmpty(this.tokenize(newString));
99
+ var newLen = newString.length,
100
+ oldLen = oldString.length;
101
+ var editLength = 1;
102
+ var maxEditLength = newLen + oldLen;
103
+ var bestPath = [{
104
+ newPos: -1,
105
+ components: []
106
+ }]; // Seed editLength = 0, i.e. the content starts with the same values
107
+
108
+ var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
109
+
110
+ if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
111
+ // Identity per the equality and tokenizer
112
+ return done([{
113
+ value: this.join(newString),
114
+ count: newString.length
115
+ }]);
116
+ } // Main worker method. checks all permutations of a given edit length for acceptance.
117
+
118
+
119
+ function execEditLength() {
120
+ for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
121
+ var basePath = void 0;
122
+
123
+ var addPath = bestPath[diagonalPath - 1],
124
+ removePath = bestPath[diagonalPath + 1],
125
+ _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
126
+
127
+ if (addPath) {
128
+ // No one else is going to attempt to use this value, clear it
129
+ bestPath[diagonalPath - 1] = undefined;
130
+ }
131
+
132
+ var canAdd = addPath && addPath.newPos + 1 < newLen,
133
+ canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
134
+
135
+ if (!canAdd && !canRemove) {
136
+ // If this path is a terminal then prune
137
+ bestPath[diagonalPath] = undefined;
138
+ continue;
139
+ } // Select the diagonal that we want to branch from. We select the prior
140
+ // path whose position in the new string is the farthest from the origin
141
+ // and does not pass the bounds of the diff graph
142
+
143
+
144
+ if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
145
+ basePath = clonePath(removePath);
146
+ self.pushComponent(basePath.components, undefined, true);
147
+ } else {
148
+ basePath = addPath; // No need to clone, we've pulled it from the list
149
+
150
+ basePath.newPos++;
151
+ self.pushComponent(basePath.components, true, undefined);
152
+ }
153
+
154
+ _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
155
+
156
+ if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
157
+ return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
158
+ } else {
159
+ // Otherwise track this path as a potential candidate and continue.
160
+ bestPath[diagonalPath] = basePath;
161
+ }
162
+ }
163
+
164
+ editLength++;
165
+ } // Performs the length of edit iteration. Is a bit fugly as this has to support the
166
+ // sync and async mode which is never fun. Loops over execEditLength until a value
167
+ // is produced.
168
+
169
+
170
+ if (callback) {
171
+ (function exec() {
172
+ setTimeout(function () {
173
+ // This should not happen, but we want to be safe.
174
+
175
+ /* istanbul ignore next */
176
+ if (editLength > maxEditLength) {
177
+ return callback();
178
+ }
179
+
180
+ if (!execEditLength()) {
181
+ exec();
182
+ }
183
+ }, 0);
184
+ })();
185
+ } else {
186
+ while (editLength <= maxEditLength) {
187
+ var ret = execEditLength();
188
+
189
+ if (ret) {
190
+ return ret;
191
+ }
192
+ }
193
+ }
194
+ },
195
+ pushComponent: function pushComponent(components, added, removed) {
196
+ var last = components[components.length - 1];
197
+
198
+ if (last && last.added === added && last.removed === removed) {
199
+ // We need to clone here as the component clone operation is just
200
+ // as shallow array clone
201
+ components[components.length - 1] = {
202
+ count: last.count + 1,
203
+ added: added,
204
+ removed: removed
205
+ };
206
+ } else {
207
+ components.push({
208
+ count: 1,
209
+ added: added,
210
+ removed: removed
211
+ });
212
+ }
213
+ },
214
+ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
215
+ var newLen = newString.length,
216
+ oldLen = oldString.length,
217
+ newPos = basePath.newPos,
218
+ oldPos = newPos - diagonalPath,
219
+ commonCount = 0;
220
+
221
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
222
+ newPos++;
223
+ oldPos++;
224
+ commonCount++;
225
+ }
226
+
227
+ if (commonCount) {
228
+ basePath.components.push({
229
+ count: commonCount
230
+ });
231
+ }
232
+
233
+ basePath.newPos = newPos;
234
+ return oldPos;
235
+ },
236
+ equals: function equals(left, right) {
237
+ if (this.options.comparator) {
238
+ return this.options.comparator(left, right);
239
+ } else {
240
+ return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
241
+ }
242
+ },
243
+ removeEmpty: function removeEmpty(array) {
244
+ var ret = [];
245
+
246
+ for (var i = 0; i < array.length; i++) {
247
+ if (array[i]) {
248
+ ret.push(array[i]);
249
+ }
250
+ }
251
+
252
+ return ret;
253
+ },
254
+ castInput: function castInput(value) {
255
+ return value;
256
+ },
257
+ tokenize: function tokenize(value) {
258
+ return value.split('');
259
+ },
260
+ join: function join(chars) {
261
+ return chars.join('');
262
+ }
263
+ };
264
+
265
+ function buildValues(diff, components, newString, oldString, useLongestToken) {
266
+ var componentPos = 0,
267
+ componentLen = components.length,
268
+ newPos = 0,
269
+ oldPos = 0;
270
+
271
+ for (; componentPos < componentLen; componentPos++) {
272
+ var component = components[componentPos];
273
+
274
+ if (!component.removed) {
275
+ if (!component.added && useLongestToken) {
276
+ var value = newString.slice(newPos, newPos + component.count);
277
+ value = value.map(function (value, i) {
278
+ var oldValue = oldString[oldPos + i];
279
+ return oldValue.length > value.length ? oldValue : value;
280
+ });
281
+ component.value = diff.join(value);
282
+ } else {
283
+ component.value = diff.join(newString.slice(newPos, newPos + component.count));
284
+ }
285
+
286
+ newPos += component.count; // Common case
287
+
288
+ if (!component.added) {
289
+ oldPos += component.count;
290
+ }
291
+ } else {
292
+ component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
293
+ oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
294
+ // The diffing algorithm is tied to add then remove output and this is the simplest
295
+ // route to get the desired output with minimal overhead.
296
+
297
+ if (componentPos && components[componentPos - 1].added) {
298
+ var tmp = components[componentPos - 1];
299
+ components[componentPos - 1] = components[componentPos];
300
+ components[componentPos] = tmp;
301
+ }
302
+ }
303
+ } // Special case handle for when one terminal is ignored (i.e. whitespace).
304
+ // For this case we merge the terminal into the prior string and drop the change.
305
+ // This is only available for string mode.
306
+
307
+
308
+ var lastComponent = components[componentLen - 1];
309
+
310
+ if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
311
+ components[componentLen - 2].value += lastComponent.value;
312
+ components.pop();
313
+ }
314
+
315
+ return components;
316
+ }
317
+
318
+ function clonePath(path) {
319
+ return {
320
+ newPos: path.newPos,
321
+ components: path.components.slice(0)
322
+ };
323
+ }
324
+
325
+ //
326
+ // Ranges and exceptions:
327
+ // Latin-1 Supplement, 0080–00FF
328
+ // - U+00D7 × Multiplication sign
329
+ // - U+00F7 ÷ Division sign
330
+ // Latin Extended-A, 0100–017F
331
+ // Latin Extended-B, 0180–024F
332
+ // IPA Extensions, 0250–02AF
333
+ // Spacing Modifier Letters, 02B0–02FF
334
+ // - U+02C7 ˇ &#711; Caron
335
+ // - U+02D8 ˘ &#728; Breve
336
+ // - U+02D9 ˙ &#729; Dot Above
337
+ // - U+02DA ˚ &#730; Ring Above
338
+ // - U+02DB ˛ &#731; Ogonek
339
+ // - U+02DC ˜ &#732; Small Tilde
340
+ // - U+02DD ˝ &#733; Double Acute Accent
341
+ // Latin Extended Additional, 1E00–1EFF
342
+
343
+ var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
344
+ var reWhitespace = /\S/;
345
+ var wordDiff = new Diff();
346
+
347
+ wordDiff.equals = function (left, right) {
348
+ if (this.options.ignoreCase) {
349
+ left = left.toLowerCase();
350
+ right = right.toLowerCase();
351
+ }
352
+
353
+ return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
354
+ };
355
+
356
+ wordDiff.tokenize = function (value) {
357
+ // All whitespace symbols except newline group into one token, each newline - in separate token
358
+ var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
359
+
360
+ for (var i = 0; i < tokens.length - 1; i++) {
361
+ // If we have an empty string in the next field and we have only word chars before and after, merge
362
+ if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
363
+ tokens[i] += tokens[i + 2];
364
+ tokens.splice(i + 1, 2);
365
+ i--;
366
+ }
367
+ }
368
+
369
+ return tokens;
370
+ };
371
+
372
+ var lineDiff = new Diff();
373
+
374
+ lineDiff.tokenize = function (value) {
375
+ var retLines = [],
376
+ linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
377
+
378
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
379
+ linesAndNewlines.pop();
380
+ } // Merge the content and line separators into single tokens
381
+
382
+
383
+ for (var i = 0; i < linesAndNewlines.length; i++) {
384
+ var line = linesAndNewlines[i];
385
+
386
+ if (i % 2 && !this.options.newlineIsToken) {
387
+ retLines[retLines.length - 1] += line;
388
+ } else {
389
+ if (this.options.ignoreWhitespace) {
390
+ line = line.trim();
391
+ }
392
+
393
+ retLines.push(line);
394
+ }
395
+ }
396
+
397
+ return retLines;
398
+ };
399
+
400
+ function diffLines(oldStr, newStr, callback) {
401
+ return lineDiff.diff(oldStr, newStr, callback);
402
+ }
403
+
404
+ var sentenceDiff = new Diff();
405
+
406
+ sentenceDiff.tokenize = function (value) {
407
+ return value.split(/(\S.+?[.!?])(?=\s+|$)/);
408
+ };
409
+
410
+ var cssDiff = new Diff();
411
+
412
+ cssDiff.tokenize = function (value) {
413
+ return value.split(/([{}:;,]|\s+)/);
414
+ };
415
+
416
+ function _typeof(obj) {
417
+ "@babel/helpers - typeof";
418
+
419
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
420
+ _typeof = function (obj) {
421
+ return typeof obj;
422
+ };
423
+ } else {
424
+ _typeof = function (obj) {
425
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
426
+ };
427
+ }
428
+
429
+ return _typeof(obj);
430
+ }
431
+
432
+ function _toConsumableArray(arr) {
433
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
434
+ }
435
+
436
+ function _arrayWithoutHoles(arr) {
437
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
438
+ }
439
+
440
+ function _iterableToArray(iter) {
441
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
442
+ }
443
+
444
+ function _unsupportedIterableToArray(o, minLen) {
445
+ if (!o) return;
446
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
447
+ var n = Object.prototype.toString.call(o).slice(8, -1);
448
+ if (n === "Object" && o.constructor) n = o.constructor.name;
449
+ if (n === "Map" || n === "Set") return Array.from(o);
450
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
451
+ }
452
+
453
+ function _arrayLikeToArray(arr, len) {
454
+ if (len == null || len > arr.length) len = arr.length;
455
+
456
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
457
+
458
+ return arr2;
459
+ }
460
+
461
+ function _nonIterableSpread() {
462
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
463
+ }
464
+
465
+ var objectPrototypeToString = Object.prototype.toString;
466
+ var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
467
+ // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
468
+
469
+ jsonDiff.useLongestToken = true;
470
+ jsonDiff.tokenize = lineDiff.tokenize;
471
+
472
+ jsonDiff.castInput = function (value) {
473
+ var _this$options = this.options,
474
+ undefinedReplacement = _this$options.undefinedReplacement,
475
+ _this$options$stringi = _this$options.stringifyReplacer,
476
+ stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) {
477
+ return typeof v === 'undefined' ? undefinedReplacement : v;
478
+ } : _this$options$stringi;
479
+ return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
480
+ };
481
+
482
+ jsonDiff.equals = function (left, right) {
483
+ return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
484
+ };
485
+ // object that is already on the "stack" of items being processed. Accepts an optional replacer
486
+
487
+ function canonicalize(obj, stack, replacementStack, replacer, key) {
488
+ stack = stack || [];
489
+ replacementStack = replacementStack || [];
490
+
491
+ if (replacer) {
492
+ obj = replacer(key, obj);
493
+ }
494
+
495
+ var i;
496
+
497
+ for (i = 0; i < stack.length; i += 1) {
498
+ if (stack[i] === obj) {
499
+ return replacementStack[i];
500
+ }
501
+ }
502
+
503
+ var canonicalizedObj;
504
+
505
+ if ('[object Array]' === objectPrototypeToString.call(obj)) {
506
+ stack.push(obj);
507
+ canonicalizedObj = new Array(obj.length);
508
+ replacementStack.push(canonicalizedObj);
509
+
510
+ for (i = 0; i < obj.length; i += 1) {
511
+ canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
512
+ }
513
+
514
+ stack.pop();
515
+ replacementStack.pop();
516
+ return canonicalizedObj;
517
+ }
518
+
519
+ if (obj && obj.toJSON) {
520
+ obj = obj.toJSON();
521
+ }
522
+
523
+ if (_typeof(obj) === 'object' && obj !== null) {
524
+ stack.push(obj);
525
+ canonicalizedObj = {};
526
+ replacementStack.push(canonicalizedObj);
527
+
528
+ var sortedKeys = [],
529
+ _key;
530
+
531
+ for (_key in obj) {
532
+ /* istanbul ignore else */
533
+ if (obj.hasOwnProperty(_key)) {
534
+ sortedKeys.push(_key);
535
+ }
536
+ }
537
+
538
+ sortedKeys.sort();
539
+
540
+ for (i = 0; i < sortedKeys.length; i += 1) {
541
+ _key = sortedKeys[i];
542
+ canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
543
+ }
544
+
545
+ stack.pop();
546
+ replacementStack.pop();
547
+ } else {
548
+ canonicalizedObj = obj;
549
+ }
550
+
551
+ return canonicalizedObj;
552
+ }
553
+
554
+ var arrayDiff = new Diff();
555
+
556
+ arrayDiff.tokenize = function (value) {
557
+ return value.slice();
558
+ };
559
+
560
+ arrayDiff.join = arrayDiff.removeEmpty = function (value) {
561
+ return value;
562
+ };
563
+
564
+ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
565
+ if (!options) {
566
+ options = {};
567
+ }
568
+
569
+ if (typeof options.context === 'undefined') {
570
+ options.context = 4;
571
+ }
572
+
573
+ var diff = diffLines(oldStr, newStr, options);
574
+ diff.push({
575
+ value: '',
576
+ lines: []
577
+ }); // Append an empty value to make cleanup easier
578
+
579
+ function contextLines(lines) {
580
+ return lines.map(function (entry) {
581
+ return ' ' + entry;
582
+ });
583
+ }
584
+
585
+ var hunks = [];
586
+ var oldRangeStart = 0,
587
+ newRangeStart = 0,
588
+ curRange = [],
589
+ oldLine = 1,
590
+ newLine = 1;
591
+
592
+ var _loop = function _loop(i) {
593
+ var current = diff[i],
594
+ lines = current.lines || current.value.replace(/\n$/, '').split('\n');
595
+ current.lines = lines;
596
+
597
+ if (current.added || current.removed) {
598
+ var _curRange;
599
+
600
+ // If we have previous context, start with that
601
+ if (!oldRangeStart) {
602
+ var prev = diff[i - 1];
603
+ oldRangeStart = oldLine;
604
+ newRangeStart = newLine;
605
+
606
+ if (prev) {
607
+ curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
608
+ oldRangeStart -= curRange.length;
609
+ newRangeStart -= curRange.length;
610
+ }
611
+ } // Output our changes
612
+
613
+
614
+ (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) {
615
+ return (current.added ? '+' : '-') + entry;
616
+ }))); // Track the updated file position
617
+
618
+
619
+ if (current.added) {
620
+ newLine += lines.length;
621
+ } else {
622
+ oldLine += lines.length;
623
+ }
624
+ } else {
625
+ // Identical context lines. Track line changes
626
+ if (oldRangeStart) {
627
+ // Close out any changes that have been output (or join overlapping)
628
+ if (lines.length <= options.context * 2 && i < diff.length - 2) {
629
+ var _curRange2;
630
+
631
+ // Overlapping
632
+ (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
633
+ } else {
634
+ var _curRange3;
635
+
636
+ // end the range and output
637
+ var contextSize = Math.min(lines.length, options.context);
638
+
639
+ (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
640
+
641
+ var hunk = {
642
+ oldStart: oldRangeStart,
643
+ oldLines: oldLine - oldRangeStart + contextSize,
644
+ newStart: newRangeStart,
645
+ newLines: newLine - newRangeStart + contextSize,
646
+ lines: curRange
647
+ };
648
+
649
+ if (i >= diff.length - 2 && lines.length <= options.context) {
650
+ // EOF is inside this hunk
651
+ var oldEOFNewline = /\n$/.test(oldStr);
652
+ var newEOFNewline = /\n$/.test(newStr);
653
+ var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
654
+
655
+ if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
656
+ // special case: old has no eol and no trailing context; no-nl can end up before adds
657
+ // however, if the old file is empty, do not output the no-nl line
658
+ curRange.splice(hunk.oldLines, 0, '\');
659
+ }
660
+
661
+ if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
662
+ curRange.push('\');
663
+ }
664
+ }
665
+
666
+ hunks.push(hunk);
667
+ oldRangeStart = 0;
668
+ newRangeStart = 0;
669
+ curRange = [];
670
+ }
671
+ }
672
+
673
+ oldLine += lines.length;
674
+ newLine += lines.length;
675
+ }
676
+ };
677
+
678
+ for (var i = 0; i < diff.length; i++) {
679
+ _loop(i);
680
+ }
681
+
682
+ return {
683
+ oldFileName: oldFileName,
684
+ newFileName: newFileName,
685
+ oldHeader: oldHeader,
686
+ newHeader: newHeader,
687
+ hunks: hunks
688
+ };
689
+ }
690
+ function formatPatch(diff) {
691
+ var ret = [];
692
+
693
+ if (diff.oldFileName == diff.newFileName) {
694
+ ret.push('Index: ' + diff.oldFileName);
695
+ }
696
+
697
+ ret.push('===================================================================');
698
+ ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
699
+ ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
700
+
701
+ for (var i = 0; i < diff.hunks.length; i++) {
702
+ var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0,
703
+ // the first number is one lower than one would expect.
704
+ // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
705
+
706
+ if (hunk.oldLines === 0) {
707
+ hunk.oldStart -= 1;
708
+ }
709
+
710
+ if (hunk.newLines === 0) {
711
+ hunk.newStart -= 1;
712
+ }
713
+
714
+ ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
715
+ ret.push.apply(ret, hunk.lines);
716
+ }
717
+
718
+ return ret.join('\n') + '\n';
719
+ }
720
+ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
721
+ return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
722
+ }
723
+ function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
724
+ return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
725
+ }
726
+
727
+ /* eslint-disable yoda */
728
+
729
+ function isFullwidthCodePoint(codePoint) {
730
+ if (!Number.isInteger(codePoint)) {
731
+ return false;
732
+ }
733
+
734
+ // Code points are derived from:
735
+ // https://unicode.org/Public/UNIDATA/EastAsianWidth.txt
736
+ return codePoint >= 0x1100 && (
737
+ codePoint <= 0x115F || // Hangul Jamo
738
+ codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
739
+ codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
740
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
741
+ (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
742
+ // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
743
+ (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
744
+ // CJK Unified Ideographs .. Yi Radicals
745
+ (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
746
+ // Hangul Jamo Extended-A
747
+ (0xA960 <= codePoint && codePoint <= 0xA97C) ||
748
+ // Hangul Syllables
749
+ (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
750
+ // CJK Compatibility Ideographs
751
+ (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
752
+ // Vertical Forms
753
+ (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
754
+ // CJK Compatibility Forms .. Small Form Variants
755
+ (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
756
+ // Halfwidth and Fullwidth Forms
757
+ (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
758
+ (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
759
+ // Kana Supplement
760
+ (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
761
+ // Enclosed Ideographic Supplement
762
+ (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
763
+ // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
764
+ (0x20000 <= codePoint && codePoint <= 0x3FFFD)
765
+ );
766
+ }
767
+
768
+ const ANSI_BACKGROUND_OFFSET = 10;
769
+
770
+ const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
771
+
772
+ const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
773
+
774
+ const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
775
+
776
+ function assembleStyles() {
777
+ const codes = new Map();
778
+ const styles = {
779
+ modifier: {
780
+ reset: [0, 0],
781
+ // 21 isn't widely supported and 22 does the same thing
782
+ bold: [1, 22],
783
+ dim: [2, 22],
784
+ italic: [3, 23],
785
+ underline: [4, 24],
786
+ overline: [53, 55],
787
+ inverse: [7, 27],
788
+ hidden: [8, 28],
789
+ strikethrough: [9, 29]
790
+ },
791
+ color: {
792
+ black: [30, 39],
793
+ red: [31, 39],
794
+ green: [32, 39],
795
+ yellow: [33, 39],
796
+ blue: [34, 39],
797
+ magenta: [35, 39],
798
+ cyan: [36, 39],
799
+ white: [37, 39],
800
+
801
+ // Bright color
802
+ blackBright: [90, 39],
803
+ redBright: [91, 39],
804
+ greenBright: [92, 39],
805
+ yellowBright: [93, 39],
806
+ blueBright: [94, 39],
807
+ magentaBright: [95, 39],
808
+ cyanBright: [96, 39],
809
+ whiteBright: [97, 39]
810
+ },
811
+ bgColor: {
812
+ bgBlack: [40, 49],
813
+ bgRed: [41, 49],
814
+ bgGreen: [42, 49],
815
+ bgYellow: [43, 49],
816
+ bgBlue: [44, 49],
817
+ bgMagenta: [45, 49],
818
+ bgCyan: [46, 49],
819
+ bgWhite: [47, 49],
820
+
821
+ // Bright color
822
+ bgBlackBright: [100, 49],
823
+ bgRedBright: [101, 49],
824
+ bgGreenBright: [102, 49],
825
+ bgYellowBright: [103, 49],
826
+ bgBlueBright: [104, 49],
827
+ bgMagentaBright: [105, 49],
828
+ bgCyanBright: [106, 49],
829
+ bgWhiteBright: [107, 49]
830
+ }
831
+ };
832
+
833
+ // Alias bright black as gray (and grey)
834
+ styles.color.gray = styles.color.blackBright;
835
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
836
+ styles.color.grey = styles.color.blackBright;
837
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
838
+
839
+ for (const [groupName, group] of Object.entries(styles)) {
840
+ for (const [styleName, style] of Object.entries(group)) {
841
+ styles[styleName] = {
842
+ open: `\u001B[${style[0]}m`,
843
+ close: `\u001B[${style[1]}m`
844
+ };
845
+
846
+ group[styleName] = styles[styleName];
847
+
848
+ codes.set(style[0], style[1]);
849
+ }
850
+
851
+ Object.defineProperty(styles, groupName, {
852
+ value: group,
853
+ enumerable: false
854
+ });
855
+ }
856
+
857
+ Object.defineProperty(styles, 'codes', {
858
+ value: codes,
859
+ enumerable: false
860
+ });
861
+
862
+ styles.color.close = '\u001B[39m';
863
+ styles.bgColor.close = '\u001B[49m';
864
+
865
+ styles.color.ansi = wrapAnsi16();
866
+ styles.color.ansi256 = wrapAnsi256();
867
+ styles.color.ansi16m = wrapAnsi16m();
868
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
869
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
870
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
871
+
872
+ // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
873
+ Object.defineProperties(styles, {
874
+ rgbToAnsi256: {
875
+ value: (red, green, blue) => {
876
+ // We use the extended greyscale palette here, with the exception of
877
+ // black and white. normal palette only has 4 greyscale shades.
878
+ if (red === green && green === blue) {
879
+ if (red < 8) {
880
+ return 16;
881
+ }
882
+
883
+ if (red > 248) {
884
+ return 231;
885
+ }
886
+
887
+ return Math.round(((red - 8) / 247) * 24) + 232;
888
+ }
889
+
890
+ return 16 +
891
+ (36 * Math.round(red / 255 * 5)) +
892
+ (6 * Math.round(green / 255 * 5)) +
893
+ Math.round(blue / 255 * 5);
894
+ },
895
+ enumerable: false
896
+ },
897
+ hexToRgb: {
898
+ value: hex => {
899
+ const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
900
+ if (!matches) {
901
+ return [0, 0, 0];
902
+ }
903
+
904
+ let {colorString} = matches.groups;
905
+
906
+ if (colorString.length === 3) {
907
+ colorString = colorString.split('').map(character => character + character).join('');
908
+ }
909
+
910
+ const integer = Number.parseInt(colorString, 16);
911
+
912
+ return [
913
+ (integer >> 16) & 0xFF,
914
+ (integer >> 8) & 0xFF,
915
+ integer & 0xFF
916
+ ];
917
+ },
918
+ enumerable: false
919
+ },
920
+ hexToAnsi256: {
921
+ value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
922
+ enumerable: false
923
+ },
924
+ ansi256ToAnsi: {
925
+ value: code => {
926
+ if (code < 8) {
927
+ return 30 + code;
928
+ }
929
+
930
+ if (code < 16) {
931
+ return 90 + (code - 8);
932
+ }
933
+
934
+ let red;
935
+ let green;
936
+ let blue;
937
+
938
+ if (code >= 232) {
939
+ red = (((code - 232) * 10) + 8) / 255;
940
+ green = red;
941
+ blue = red;
942
+ } else {
943
+ code -= 16;
944
+
945
+ const remainder = code % 36;
946
+
947
+ red = Math.floor(code / 36) / 5;
948
+ green = Math.floor(remainder / 6) / 5;
949
+ blue = (remainder % 6) / 5;
950
+ }
951
+
952
+ const value = Math.max(red, green, blue) * 2;
953
+
954
+ if (value === 0) {
955
+ return 30;
956
+ }
957
+
958
+ let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
959
+
960
+ if (value === 2) {
961
+ result += 60;
962
+ }
963
+
964
+ return result;
965
+ },
966
+ enumerable: false
967
+ },
968
+ rgbToAnsi: {
969
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
970
+ enumerable: false
971
+ },
972
+ hexToAnsi: {
973
+ value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
974
+ enumerable: false
975
+ }
976
+ });
977
+
978
+ return styles;
979
+ }
980
+
981
+ const ansiStyles = assembleStyles();
982
+
983
+ const astralRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/;
984
+
985
+ const ESCAPES = [
986
+ '\u001B',
987
+ '\u009B'
988
+ ];
989
+
990
+ const wrapAnsi = code => `${ESCAPES[0]}[${code}m`;
991
+
992
+ const checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
993
+ let output = [];
994
+ ansiCodes = [...ansiCodes];
995
+
996
+ for (let ansiCode of ansiCodes) {
997
+ const ansiCodeOrigin = ansiCode;
998
+ if (ansiCode.includes(';')) {
999
+ ansiCode = ansiCode.split(';')[0][0] + '0';
1000
+ }
1001
+
1002
+ const item = ansiStyles.codes.get(Number.parseInt(ansiCode, 10));
1003
+ if (item) {
1004
+ const indexEscape = ansiCodes.indexOf(item.toString());
1005
+ if (indexEscape === -1) {
1006
+ output.push(wrapAnsi(isEscapes ? item : ansiCodeOrigin));
1007
+ } else {
1008
+ ansiCodes.splice(indexEscape, 1);
1009
+ }
1010
+ } else if (isEscapes) {
1011
+ output.push(wrapAnsi(0));
1012
+ break;
1013
+ } else {
1014
+ output.push(wrapAnsi(ansiCodeOrigin));
1015
+ }
1016
+ }
1017
+
1018
+ if (isEscapes) {
1019
+ output = output.filter((element, index) => output.indexOf(element) === index);
1020
+
1021
+ if (endAnsiCode !== undefined) {
1022
+ const fistEscapeCode = wrapAnsi(ansiStyles.codes.get(Number.parseInt(endAnsiCode, 10)));
1023
+ // TODO: Remove the use of `.reduce` here.
1024
+ // eslint-disable-next-line unicorn/no-array-reduce
1025
+ output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
1026
+ }
1027
+ }
1028
+
1029
+ return output.join('');
1030
+ };
1031
+
1032
+ function sliceAnsi(string, begin, end) {
1033
+ const characters = [...string];
1034
+ const ansiCodes = [];
1035
+
1036
+ let stringEnd = typeof end === 'number' ? end : characters.length;
1037
+ let isInsideEscape = false;
1038
+ let ansiCode;
1039
+ let visible = 0;
1040
+ let output = '';
1041
+
1042
+ for (const [index, character] of characters.entries()) {
1043
+ let leftEscape = false;
1044
+
1045
+ if (ESCAPES.includes(character)) {
1046
+ const code = /\d[^m]*/.exec(string.slice(index, index + 18));
1047
+ ansiCode = code && code.length > 0 ? code[0] : undefined;
1048
+
1049
+ if (visible < stringEnd) {
1050
+ isInsideEscape = true;
1051
+
1052
+ if (ansiCode !== undefined) {
1053
+ ansiCodes.push(ansiCode);
1054
+ }
1055
+ }
1056
+ } else if (isInsideEscape && character === 'm') {
1057
+ isInsideEscape = false;
1058
+ leftEscape = true;
1059
+ }
1060
+
1061
+ if (!isInsideEscape && !leftEscape) {
1062
+ visible++;
1063
+ }
1064
+
1065
+ if (!astralRegex.test(character) && isFullwidthCodePoint(character.codePointAt())) {
1066
+ visible++;
1067
+
1068
+ if (typeof end !== 'number') {
1069
+ stringEnd++;
1070
+ }
1071
+ }
1072
+
1073
+ if (visible > begin && visible <= stringEnd) {
1074
+ output += character;
1075
+ } else if (visible === begin && !isInsideEscape && ansiCode !== undefined) {
1076
+ output = checkAnsi(ansiCodes);
1077
+ } else if (visible >= stringEnd) {
1078
+ output += checkAnsi(ansiCodes, true, ansiCode);
1079
+ break;
1080
+ }
1081
+ }
1082
+
1083
+ return output;
1084
+ }
1085
+
1086
+ function ansiRegex({onlyFirst = false} = {}) {
1087
+ const pattern = [
1088
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
1089
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
1090
+ ].join('|');
1091
+
1092
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
1093
+ }
1094
+
1095
+ function stripAnsi(string) {
1096
+ if (typeof string !== 'string') {
1097
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
1098
+ }
1099
+
1100
+ return string.replace(ansiRegex(), '');
1101
+ }
1102
+
1103
+ var emojiRegex = function () {
1104
+ // https://mths.be/emoji
1105
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
1106
+ };
1107
+
1108
+ function stringWidth(string) {
1109
+ if (typeof string !== 'string' || string.length === 0) {
1110
+ return 0;
1111
+ }
1112
+
1113
+ string = stripAnsi(string);
1114
+
1115
+ if (string.length === 0) {
1116
+ return 0;
1117
+ }
1118
+
1119
+ string = string.replace(emojiRegex(), ' ');
1120
+
1121
+ let width = 0;
1122
+
1123
+ for (let index = 0; index < string.length; index++) {
1124
+ const codePoint = string.codePointAt(index);
1125
+
1126
+ // Ignore control characters
1127
+ if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
1128
+ continue;
1129
+ }
1130
+
1131
+ // Ignore combining characters
1132
+ if (codePoint >= 0x300 && codePoint <= 0x36F) {
1133
+ continue;
1134
+ }
1135
+
1136
+ // Surrogates
1137
+ if (codePoint > 0xFFFF) {
1138
+ index++;
1139
+ }
1140
+
1141
+ width += isFullwidthCodePoint(codePoint) ? 2 : 1;
1142
+ }
1143
+
1144
+ return width;
1145
+ }
1146
+
1147
+ function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
1148
+ if (string.charAt(wantedIndex) === ' ') {
1149
+ return wantedIndex;
1150
+ }
1151
+
1152
+ for (let index = 1; index <= 3; index++) {
1153
+ if (shouldSearchRight) {
1154
+ if (string.charAt(wantedIndex + index) === ' ') {
1155
+ return wantedIndex + index;
1156
+ }
1157
+ } else if (string.charAt(wantedIndex - index) === ' ') {
1158
+ return wantedIndex - index;
1159
+ }
1160
+ }
1161
+
1162
+ return wantedIndex;
1163
+ }
1164
+
1165
+ function cliTruncate(text, columns, options) {
1166
+ options = {
1167
+ position: 'end',
1168
+ preferTruncationOnSpace: false,
1169
+ truncationCharacter: '…',
1170
+ ...options,
1171
+ };
1172
+
1173
+ const {position, space, preferTruncationOnSpace} = options;
1174
+ let {truncationCharacter} = options;
1175
+
1176
+ if (typeof text !== 'string') {
1177
+ throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
1178
+ }
1179
+
1180
+ if (typeof columns !== 'number') {
1181
+ throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
1182
+ }
1183
+
1184
+ if (columns < 1) {
1185
+ return '';
1186
+ }
1187
+
1188
+ if (columns === 1) {
1189
+ return truncationCharacter;
1190
+ }
1191
+
1192
+ const length = stringWidth(text);
1193
+
1194
+ if (length <= columns) {
1195
+ return text;
1196
+ }
1197
+
1198
+ if (position === 'start') {
1199
+ if (preferTruncationOnSpace) {
1200
+ const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
1201
+ return truncationCharacter + sliceAnsi(text, nearestSpace, length).trim();
1202
+ }
1203
+
1204
+ if (space === true) {
1205
+ truncationCharacter += ' ';
1206
+ }
1207
+
1208
+ return truncationCharacter + sliceAnsi(text, length - columns + stringWidth(truncationCharacter), length);
1209
+ }
1210
+
1211
+ if (position === 'middle') {
1212
+ if (space === true) {
1213
+ truncationCharacter = ` ${truncationCharacter} `;
1214
+ }
1215
+
1216
+ const half = Math.floor(columns / 2);
1217
+
1218
+ if (preferTruncationOnSpace) {
1219
+ const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
1220
+ const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
1221
+ return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + truncationCharacter + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
1222
+ }
1223
+
1224
+ return (
1225
+ sliceAnsi(text, 0, half)
1226
+ + truncationCharacter
1227
+ + sliceAnsi(text, length - (columns - half) + stringWidth(truncationCharacter), length)
1228
+ );
1229
+ }
1230
+
1231
+ if (position === 'end') {
1232
+ if (preferTruncationOnSpace) {
1233
+ const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
1234
+ return sliceAnsi(text, 0, nearestSpace) + truncationCharacter;
1235
+ }
1236
+
1237
+ if (space === true) {
1238
+ truncationCharacter = ` ${truncationCharacter}`;
1239
+ }
1240
+
1241
+ return sliceAnsi(text, 0, columns - stringWidth(truncationCharacter)) + truncationCharacter;
1242
+ }
1243
+
1244
+ throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
1245
+ }
1246
+
1247
+ const F_RIGHT = "\u2192";
1248
+ const F_DOWN = "\u2193";
1249
+ const F_UP = "\u2191";
1250
+ const F_DOWN_RIGHT = "\u21B3";
1251
+ const F_POINTER = "\u276F";
1252
+ const F_DOT = "\xB7";
1253
+ const F_CHECK = "\u221A";
1254
+ const F_CROSS = "\xD7";
1255
+
1256
+ async function printError(error) {
1257
+ const { server } = process.__vitest__;
1258
+ let e = error;
1259
+ if (typeof error === "string") {
1260
+ e = {
1261
+ message: error.split(/\n/g)[0],
1262
+ stack: error
1263
+ };
1264
+ }
1265
+ let codeFramePrinted = false;
1266
+ const stacks = parseStack(e.stack || e.stackStr || "");
1267
+ const nearest = stacks.find((stack) => server.moduleGraph.getModuleById(stack.file));
1268
+ if (nearest) {
1269
+ const mod = server.moduleGraph.getModuleById(nearest.file);
1270
+ const transformResult = mod == null ? void 0 : mod.ssrTransformResult;
1271
+ const pos = await getOriginalPos(transformResult == null ? void 0 : transformResult.map, nearest);
1272
+ if (pos && existsSync(nearest.file)) {
1273
+ const sourceCode = await promises.readFile(nearest.file, "utf-8");
1274
+ displayErrorMessage(e);
1275
+ displayFilePath(nearest.file, pos);
1276
+ displayCodeFrame(sourceCode, pos);
1277
+ codeFramePrinted = true;
1278
+ }
1279
+ }
1280
+ if (!codeFramePrinted)
1281
+ console.error(e);
1282
+ if (e.showDiff)
1283
+ displayDiff(e.actual, e.expected);
1284
+ }
1285
+ function displayDiff(actual, expected) {
1286
+ console.error(c.gray(generateDiff(stringify(actual), stringify(expected))));
1287
+ }
1288
+ function displayErrorMessage(error) {
1289
+ const errorName = error.name || error.nameStr || "Unknown Error";
1290
+ console.error(c.red(`${c.bold(errorName)}: ${error.message}`));
1291
+ }
1292
+ function displayFilePath(filePath, pos) {
1293
+ console.log(c.gray(`${filePath}:${pos.line}:${pos.column}`));
1294
+ }
1295
+ function displayCodeFrame(sourceCode, pos) {
1296
+ console.log(c.yellow(generateCodeFrame(sourceCode, pos)));
1297
+ }
1298
+ function getOriginalPos(map, { line, column }) {
1299
+ return new Promise((resolve) => {
1300
+ if (!map)
1301
+ return resolve(null);
1302
+ SourceMapConsumer.with(map, null, (consumer) => {
1303
+ const pos = consumer.originalPositionFor({ line, column });
1304
+ if (pos.line != null && pos.column != null)
1305
+ resolve(pos);
1306
+ else
1307
+ resolve(null);
1308
+ });
1309
+ });
1310
+ }
1311
+ const splitRE = /\r?\n/;
1312
+ function posToNumber(source, pos) {
1313
+ if (typeof pos === "number")
1314
+ return pos;
1315
+ const lines = source.split(splitRE);
1316
+ const { line, column } = pos;
1317
+ let start = 0;
1318
+ for (let i = 0; i < line - 1; i++)
1319
+ start += lines[i].length + 1;
1320
+ return start + column;
1321
+ }
1322
+ function generateCodeFrame(source, start = 0, end, range = 2) {
1323
+ start = posToNumber(source, start);
1324
+ end = end || start;
1325
+ const lines = source.split(splitRE);
1326
+ let count = 0;
1327
+ const res = [];
1328
+ function lineNo(no = "") {
1329
+ return c.gray(`${String(no).padStart(3, " ")}| `);
1330
+ }
1331
+ for (let i = 0; i < lines.length; i++) {
1332
+ count += lines[i].length + 1;
1333
+ if (count >= start) {
1334
+ for (let j = i - range; j <= i + range || end > count; j++) {
1335
+ if (j < 0 || j >= lines.length)
1336
+ continue;
1337
+ const lineLength = lines[j].length;
1338
+ if (lineLength > 200)
1339
+ return "";
1340
+ res.push(lineNo(j + 1) + cliTruncate(lines[j], process.stdout.columns - 5));
1341
+ if (j === i) {
1342
+ const pad = start - (count - lineLength);
1343
+ const length = Math.max(1, end > count ? lineLength - pad : end - start);
1344
+ res.push(lineNo() + " ".repeat(pad) + F_UP.repeat(length));
1345
+ } else if (j > i) {
1346
+ if (end > count) {
1347
+ const length = Math.max(1, Math.min(end - count, lineLength));
1348
+ res.push(lineNo() + F_UP.repeat(length));
1349
+ }
1350
+ count += lineLength + 1;
1351
+ }
1352
+ }
1353
+ break;
1354
+ }
1355
+ }
1356
+ return res.join("\n");
1357
+ }
1358
+ function stringify(obj) {
1359
+ return String(obj);
1360
+ }
1361
+ const stackFnCallRE = /at (.*) \((.+):(\d+):(\d+)\)$/;
1362
+ const stackBarePathRE = /at ()(.+):(\d+):(\d+)$/;
1363
+ function parseStack(stack) {
1364
+ const lines = stack.split("\n");
1365
+ const stackFrames = lines.map((raw) => {
1366
+ const line = raw.trim();
1367
+ const match = line.match(stackFnCallRE) || line.match(stackBarePathRE);
1368
+ if (!match)
1369
+ return null;
1370
+ let file = match[2];
1371
+ if (file.startsWith("file://"))
1372
+ file = file.slice(7);
1373
+ return {
1374
+ method: match[1],
1375
+ file: match[2],
1376
+ line: parseInt(match[3]),
1377
+ column: parseInt(match[4])
1378
+ };
1379
+ });
1380
+ return stackFrames.filter(notNullish);
1381
+ }
1382
+ function generateDiff(actual, expected) {
1383
+ const diffSize = 2048;
1384
+ if (actual.length > diffSize)
1385
+ actual = `${actual.substring(0, diffSize)} ... Lines skipped`;
1386
+ if (expected.length > diffSize)
1387
+ expected = `${expected.substring(0, diffSize)} ... Lines skipped`;
1388
+ return unifiedDiff(actual, expected);
1389
+ }
1390
+ function unifiedDiff(actual, expected) {
1391
+ const indent = " ";
1392
+ function cleanUp(line) {
1393
+ if (line[0] === "+")
1394
+ return indent + c.green(`${line[0]}${line.slice(1)}`);
1395
+ if (line[0] === "-")
1396
+ return indent + c.red(`${line[0]}${line.slice(1)}`);
1397
+ if (line.match(/@@/))
1398
+ return "--";
1399
+ if (line.match(/\\ No newline/))
1400
+ return null;
1401
+ return indent + line;
1402
+ }
1403
+ const msg = createPatch("string", actual, expected);
1404
+ const lines = msg.split("\n").splice(5);
1405
+ return `
1406
+ ${indent}${c.red("- actual")}
1407
+ ${indent}${c.green("+ expected")}
1408
+
1409
+ ${lines.map(cleanUp).filter(notBlank).join("\n")}`;
1410
+ }
1411
+ function notBlank(line) {
1412
+ return typeof line !== "undefined" && line !== null;
1413
+ }
1414
+
1415
+ export { F_POINTER as F, ansiStyles as a, stripAnsi as b, sliceAnsi as c, c as d, F_DOWN as e, F_DOWN_RIGHT as f, F_DOT as g, F_CHECK as h, F_CROSS as i, cliTruncate as j, F_RIGHT as k, generateDiff as l, printError as p, stringWidth as s };