Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / prettier / standalone.js
1 (function (global, factory) {
2   typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3   typeof define === 'function' && define.amd ? define(factory) :
4   (global = global || self, global.prettier = factory());
5 }(this, (function () { 'use strict';
6
7   var name = "prettier";
8   var version = "2.0.5";
9   var description = "Prettier is an opinionated code formatter";
10   var bin = "./bin/prettier.js";
11   var repository = "prettier/prettier";
12   var homepage = "https://prettier.io";
13   var author = "James Long";
14   var license = "MIT";
15   var main = "./index.js";
16   var engines = {
17         node: ">=10.13.0"
18   };
19   var dependencies = {
20         "@angular/compiler": "9.0.5",
21         "@babel/code-frame": "7.8.0",
22         "@babel/parser": "7.9.4",
23         "@glimmer/syntax": "0.50.0",
24         "@iarna/toml": "2.2.3",
25         "@typescript-eslint/typescript-estree": "2.26.0",
26         "angular-estree-parser": "1.3.0",
27         "angular-html-parser": "1.4.0",
28         camelcase: "5.3.1",
29         chalk: "4.0.0",
30         "ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
31         "cjk-regex": "2.0.0",
32         cosmiconfig: "6.0.0",
33         dashify: "2.0.0",
34         dedent: "0.7.0",
35         diff: "4.0.2",
36         editorconfig: "0.15.3",
37         "editorconfig-to-prettier": "0.1.1",
38         "escape-string-regexp": "2.0.0",
39         esutils: "2.0.3",
40         "fast-glob": "3.2.2",
41         "find-parent-dir": "0.3.0",
42         "find-project-root": "1.1.1",
43         "flow-parser": "0.122.0",
44         "get-stream": "5.1.0",
45         globby: "11.0.0",
46         graphql: "15.0.0",
47         "html-element-attributes": "2.2.1",
48         "html-styles": "1.0.0",
49         "html-tag-names": "1.1.5",
50         ignore: "4.0.6",
51         "jest-docblock": "25.2.6",
52         "json-stable-stringify": "1.0.1",
53         leven: "3.1.0",
54         "lines-and-columns": "1.1.6",
55         "linguist-languages": "7.9.0",
56         lodash: "4.17.15",
57         mem: "6.0.1",
58         minimatch: "3.0.4",
59         minimist: "1.2.5",
60         "n-readlines": "1.0.0",
61         "please-upgrade-node": "3.2.0",
62         "postcss-less": "3.1.4",
63         "postcss-media-query-parser": "0.2.3",
64         "postcss-scss": "2.0.0",
65         "postcss-selector-parser": "2.2.3",
66         "postcss-values-parser": "2.0.1",
67         "regexp-util": "1.2.2",
68         "remark-math": "1.0.6",
69         "remark-parse": "5.0.0",
70         resolve: "1.16.1",
71         semver: "7.1.3",
72         srcset: "2.0.1",
73         "string-width": "4.2.0",
74         typescript: "3.8.3",
75         "unicode-regex": "3.0.0",
76         unified: "9.0.0",
77         vnopts: "1.0.2",
78         "yaml-unist-parser": "1.1.1"
79   };
80   var devDependencies = {
81         "@babel/core": "7.9.0",
82         "@babel/preset-env": "7.9.0",
83         "@rollup/plugin-alias": "3.0.1",
84         "@rollup/plugin-commonjs": "11.0.2",
85         "@rollup/plugin-json": "4.0.2",
86         "@rollup/plugin-node-resolve": "7.1.1",
87         "@rollup/plugin-replace": "2.3.1",
88         "babel-loader": "8.1.0",
89         benchmark: "2.1.4",
90         "builtin-modules": "3.1.0",
91         codecov: "3.6.5",
92         "cross-env": "7.0.2",
93         cspell: "4.0.55",
94         eslint: "6.8.0",
95         "eslint-config-prettier": "6.10.1",
96         "eslint-formatter-friendly": "7.0.0",
97         "eslint-plugin-import": "2.20.2",
98         "eslint-plugin-prettier": "3.1.2",
99         "eslint-plugin-react": "7.19.0",
100         "eslint-plugin-unicorn": "18.0.1",
101         execa: "4.0.0",
102         jest: "25.2.7",
103         "jest-snapshot-serializer-ansi": "1.0.0",
104         "jest-snapshot-serializer-raw": "1.1.0",
105         "jest-watch-typeahead": "0.5.0",
106         prettier: "2.0.4",
107         rimraf: "3.0.2",
108         rollup: "2.3.2",
109         "rollup-plugin-babel": "4.4.0",
110         "rollup-plugin-node-globals": "1.4.0",
111         "rollup-plugin-terser": "5.3.0",
112         shelljs: "0.8.3",
113         "snapshot-diff": "0.7.0",
114         "strip-ansi": "6.0.0",
115         "synchronous-promise": "2.0.10",
116         tempy: "0.5.0",
117         "terser-webpack-plugin": "2.3.5",
118         webpack: "4.42.1"
119   };
120   var scripts = {
121         prepublishOnly: "echo \"Error: must publish from dist/\" && exit 1",
122         "prepare-release": "yarn && yarn build && yarn test:dist",
123         test: "jest",
124         "test:dist": "cross-env NODE_ENV=production jest",
125         "test:dist-standalone": "cross-env NODE_ENV=production TEST_STANDALONE=1 jest tests/",
126         "test:integration": "jest tests_integration",
127         "perf:repeat": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
128         "perf:repeat-inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
129         "perf:benchmark": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-benchmark --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
130         "lint:typecheck": "tsc",
131         "lint:eslint": "cross-env EFF_NO_LINK_RULES=true eslint . --format friendly",
132         "lint:changelog": "node ./scripts/lint-changelog.js",
133         "lint:prettier": "prettier \"**/*.{md,json,yml,html,css}\" --check",
134         "lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2016 \"dist/!(bin-prettier|index|third-party).js\"",
135         "lint:spellcheck": "cspell {bin,scripts,src,website}/**/*.js {docs,website/blog,changelog_unreleased}/**/*.md",
136         "lint:deps": "node ./scripts/check-deps.js",
137         build: "node --max-old-space-size=3072 ./scripts/build/build.js",
138         "build-docs": "node ./scripts/build-docs.js"
139   };
140   var _package = {
141         name: name,
142         version: version,
143         description: description,
144         bin: bin,
145         repository: repository,
146         homepage: homepage,
147         author: author,
148         license: license,
149         main: main,
150         engines: engines,
151         dependencies: dependencies,
152         devDependencies: devDependencies,
153         scripts: scripts
154   };
155
156   var _package$1 = /*#__PURE__*/Object.freeze({
157     __proto__: null,
158     name: name,
159     version: version,
160     description: description,
161     bin: bin,
162     repository: repository,
163     homepage: homepage,
164     author: author,
165     license: license,
166     main: main,
167     engines: engines,
168     dependencies: dependencies,
169     devDependencies: devDependencies,
170     scripts: scripts,
171     'default': _package
172   });
173
174   function Diff() {}
175
176   Diff.prototype = {
177     diff: function diff(oldString, newString) {
178       var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
179       var callback = options.callback;
180
181       if (typeof options === 'function') {
182         callback = options;
183         options = {};
184       }
185
186       this.options = options;
187       var self = this;
188
189       function done(value) {
190         if (callback) {
191           setTimeout(function () {
192             callback(undefined, value);
193           }, 0);
194           return true;
195         } else {
196           return value;
197         }
198       } // Allow subclasses to massage the input prior to running
199
200
201       oldString = this.castInput(oldString);
202       newString = this.castInput(newString);
203       oldString = this.removeEmpty(this.tokenize(oldString));
204       newString = this.removeEmpty(this.tokenize(newString));
205       var newLen = newString.length,
206           oldLen = oldString.length;
207       var editLength = 1;
208       var maxEditLength = newLen + oldLen;
209       var bestPath = [{
210         newPos: -1,
211         components: []
212       }]; // Seed editLength = 0, i.e. the content starts with the same values
213
214       var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
215
216       if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
217         // Identity per the equality and tokenizer
218         return done([{
219           value: this.join(newString),
220           count: newString.length
221         }]);
222       } // Main worker method. checks all permutations of a given edit length for acceptance.
223
224
225       function execEditLength() {
226         for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
227           var basePath = void 0;
228
229           var addPath = bestPath[diagonalPath - 1],
230               removePath = bestPath[diagonalPath + 1],
231               _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
232
233           if (addPath) {
234             // No one else is going to attempt to use this value, clear it
235             bestPath[diagonalPath - 1] = undefined;
236           }
237
238           var canAdd = addPath && addPath.newPos + 1 < newLen,
239               canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
240
241           if (!canAdd && !canRemove) {
242             // If this path is a terminal then prune
243             bestPath[diagonalPath] = undefined;
244             continue;
245           } // Select the diagonal that we want to branch from. We select the prior
246           // path whose position in the new string is the farthest from the origin
247           // and does not pass the bounds of the diff graph
248
249
250           if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
251             basePath = clonePath(removePath);
252             self.pushComponent(basePath.components, undefined, true);
253           } else {
254             basePath = addPath; // No need to clone, we've pulled it from the list
255
256             basePath.newPos++;
257             self.pushComponent(basePath.components, true, undefined);
258           }
259
260           _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
261
262           if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
263             return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
264           } else {
265             // Otherwise track this path as a potential candidate and continue.
266             bestPath[diagonalPath] = basePath;
267           }
268         }
269
270         editLength++;
271       } // Performs the length of edit iteration. Is a bit fugly as this has to support the
272       // sync and async mode which is never fun. Loops over execEditLength until a value
273       // is produced.
274
275
276       if (callback) {
277         (function exec() {
278           setTimeout(function () {
279             // This should not happen, but we want to be safe.
280
281             /* istanbul ignore next */
282             if (editLength > maxEditLength) {
283               return callback();
284             }
285
286             if (!execEditLength()) {
287               exec();
288             }
289           }, 0);
290         })();
291       } else {
292         while (editLength <= maxEditLength) {
293           var ret = execEditLength();
294
295           if (ret) {
296             return ret;
297           }
298         }
299       }
300     },
301     pushComponent: function pushComponent(components, added, removed) {
302       var last = components[components.length - 1];
303
304       if (last && last.added === added && last.removed === removed) {
305         // We need to clone here as the component clone operation is just
306         // as shallow array clone
307         components[components.length - 1] = {
308           count: last.count + 1,
309           added: added,
310           removed: removed
311         };
312       } else {
313         components.push({
314           count: 1,
315           added: added,
316           removed: removed
317         });
318       }
319     },
320     extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
321       var newLen = newString.length,
322           oldLen = oldString.length,
323           newPos = basePath.newPos,
324           oldPos = newPos - diagonalPath,
325           commonCount = 0;
326
327       while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
328         newPos++;
329         oldPos++;
330         commonCount++;
331       }
332
333       if (commonCount) {
334         basePath.components.push({
335           count: commonCount
336         });
337       }
338
339       basePath.newPos = newPos;
340       return oldPos;
341     },
342     equals: function equals(left, right) {
343       if (this.options.comparator) {
344         return this.options.comparator(left, right);
345       } else {
346         return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
347       }
348     },
349     removeEmpty: function removeEmpty(array) {
350       var ret = [];
351
352       for (var i = 0; i < array.length; i++) {
353         if (array[i]) {
354           ret.push(array[i]);
355         }
356       }
357
358       return ret;
359     },
360     castInput: function castInput(value) {
361       return value;
362     },
363     tokenize: function tokenize(value) {
364       return value.split('');
365     },
366     join: function join(chars) {
367       return chars.join('');
368     }
369   };
370
371   function buildValues(diff, components, newString, oldString, useLongestToken) {
372     var componentPos = 0,
373         componentLen = components.length,
374         newPos = 0,
375         oldPos = 0;
376
377     for (; componentPos < componentLen; componentPos++) {
378       var component = components[componentPos];
379
380       if (!component.removed) {
381         if (!component.added && useLongestToken) {
382           var value = newString.slice(newPos, newPos + component.count);
383           value = value.map(function (value, i) {
384             var oldValue = oldString[oldPos + i];
385             return oldValue.length > value.length ? oldValue : value;
386           });
387           component.value = diff.join(value);
388         } else {
389           component.value = diff.join(newString.slice(newPos, newPos + component.count));
390         }
391
392         newPos += component.count; // Common case
393
394         if (!component.added) {
395           oldPos += component.count;
396         }
397       } else {
398         component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
399         oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
400         // The diffing algorithm is tied to add then remove output and this is the simplest
401         // route to get the desired output with minimal overhead.
402
403         if (componentPos && components[componentPos - 1].added) {
404           var tmp = components[componentPos - 1];
405           components[componentPos - 1] = components[componentPos];
406           components[componentPos] = tmp;
407         }
408       }
409     } // Special case handle for when one terminal is ignored (i.e. whitespace).
410     // For this case we merge the terminal into the prior string and drop the change.
411     // This is only available for string mode.
412
413
414     var lastComponent = components[componentLen - 1];
415
416     if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
417       components[componentLen - 2].value += lastComponent.value;
418       components.pop();
419     }
420
421     return components;
422   }
423
424   function clonePath(path) {
425     return {
426       newPos: path.newPos,
427       components: path.components.slice(0)
428     };
429   }
430
431   var characterDiff = new Diff();
432
433   function diffChars(oldStr, newStr, options) {
434     return characterDiff.diff(oldStr, newStr, options);
435   }
436
437   function generateOptions(options, defaults) {
438     if (typeof options === 'function') {
439       defaults.callback = options;
440     } else if (options) {
441       for (var name in options) {
442         /* istanbul ignore else */
443         if (options.hasOwnProperty(name)) {
444           defaults[name] = options[name];
445         }
446       }
447     }
448
449     return defaults;
450   } //
451   // Ranges and exceptions:
452   // Latin-1 Supplement, 0080–00FF
453   //  - U+00D7  × Multiplication sign
454   //  - U+00F7  ÷ Division sign
455   // Latin Extended-A, 0100–017F
456   // Latin Extended-B, 0180–024F
457   // IPA Extensions, 0250–02AF
458   // Spacing Modifier Letters, 02B0–02FF
459   //  - U+02C7  ˇ &#711;  Caron
460   //  - U+02D8  ˘ &#728;  Breve
461   //  - U+02D9  ˙ &#729;  Dot Above
462   //  - U+02DA  ˚ &#730;  Ring Above
463   //  - U+02DB  ˛ &#731;  Ogonek
464   //  - U+02DC  ˜ &#732;  Small Tilde
465   //  - U+02DD  ˝ &#733;  Double Acute Accent
466   // Latin Extended Additional, 1E00–1EFF
467
468
469   var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
470   var reWhitespace = /\S/;
471   var wordDiff = new Diff();
472
473   wordDiff.equals = function (left, right) {
474     if (this.options.ignoreCase) {
475       left = left.toLowerCase();
476       right = right.toLowerCase();
477     }
478
479     return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
480   };
481
482   wordDiff.tokenize = function (value) {
483     var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
484
485     for (var i = 0; i < tokens.length - 1; i++) {
486       // If we have an empty string in the next field and we have only word chars before and after, merge
487       if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
488         tokens[i] += tokens[i + 2];
489         tokens.splice(i + 1, 2);
490         i--;
491       }
492     }
493
494     return tokens;
495   };
496
497   function diffWords(oldStr, newStr, options) {
498     options = generateOptions(options, {
499       ignoreWhitespace: true
500     });
501     return wordDiff.diff(oldStr, newStr, options);
502   }
503
504   function diffWordsWithSpace(oldStr, newStr, options) {
505     return wordDiff.diff(oldStr, newStr, options);
506   }
507
508   var lineDiff = new Diff();
509
510   lineDiff.tokenize = function (value) {
511     var retLines = [],
512         linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
513
514     if (!linesAndNewlines[linesAndNewlines.length - 1]) {
515       linesAndNewlines.pop();
516     } // Merge the content and line separators into single tokens
517
518
519     for (var i = 0; i < linesAndNewlines.length; i++) {
520       var line = linesAndNewlines[i];
521
522       if (i % 2 && !this.options.newlineIsToken) {
523         retLines[retLines.length - 1] += line;
524       } else {
525         if (this.options.ignoreWhitespace) {
526           line = line.trim();
527         }
528
529         retLines.push(line);
530       }
531     }
532
533     return retLines;
534   };
535
536   function diffLines(oldStr, newStr, callback) {
537     return lineDiff.diff(oldStr, newStr, callback);
538   }
539
540   function diffTrimmedLines(oldStr, newStr, callback) {
541     var options = generateOptions(callback, {
542       ignoreWhitespace: true
543     });
544     return lineDiff.diff(oldStr, newStr, options);
545   }
546
547   var sentenceDiff = new Diff();
548
549   sentenceDiff.tokenize = function (value) {
550     return value.split(/(\S.+?[.!?])(?=\s+|$)/);
551   };
552
553   function diffSentences(oldStr, newStr, callback) {
554     return sentenceDiff.diff(oldStr, newStr, callback);
555   }
556
557   var cssDiff = new Diff();
558
559   cssDiff.tokenize = function (value) {
560     return value.split(/([{}:;,]|\s+)/);
561   };
562
563   function diffCss(oldStr, newStr, callback) {
564     return cssDiff.diff(oldStr, newStr, callback);
565   }
566
567   function _typeof(obj) {
568     if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
569       _typeof = function _typeof(obj) {
570         return typeof obj;
571       };
572     } else {
573       _typeof = function _typeof(obj) {
574         return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
575       };
576     }
577
578     return _typeof(obj);
579   }
580
581   function _toConsumableArray(arr) {
582     return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
583   }
584
585   function _arrayWithoutHoles(arr) {
586     if (Array.isArray(arr)) {
587       for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
588
589       return arr2;
590     }
591   }
592
593   function _iterableToArray(iter) {
594     if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
595   }
596
597   function _nonIterableSpread() {
598     throw new TypeError("Invalid attempt to spread non-iterable instance");
599   }
600
601   var objectPrototypeToString = Object.prototype.toString;
602   var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
603   // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
604
605   jsonDiff.useLongestToken = true;
606   jsonDiff.tokenize = lineDiff.tokenize;
607
608   jsonDiff.castInput = function (value) {
609     var _this$options = this.options,
610         undefinedReplacement = _this$options.undefinedReplacement,
611         _this$options$stringi = _this$options.stringifyReplacer,
612         stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) {
613       return typeof v === 'undefined' ? undefinedReplacement : v;
614     } : _this$options$stringi;
615     return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, '  ');
616   };
617
618   jsonDiff.equals = function (left, right) {
619     return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
620   };
621
622   function diffJson(oldObj, newObj, options) {
623     return jsonDiff.diff(oldObj, newObj, options);
624   } // This function handles the presence of circular references by bailing out when encountering an
625   // object that is already on the "stack" of items being processed. Accepts an optional replacer
626
627
628   function canonicalize(obj, stack, replacementStack, replacer, key) {
629     stack = stack || [];
630     replacementStack = replacementStack || [];
631
632     if (replacer) {
633       obj = replacer(key, obj);
634     }
635
636     var i;
637
638     for (i = 0; i < stack.length; i += 1) {
639       if (stack[i] === obj) {
640         return replacementStack[i];
641       }
642     }
643
644     var canonicalizedObj;
645
646     if ('[object Array]' === objectPrototypeToString.call(obj)) {
647       stack.push(obj);
648       canonicalizedObj = new Array(obj.length);
649       replacementStack.push(canonicalizedObj);
650
651       for (i = 0; i < obj.length; i += 1) {
652         canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
653       }
654
655       stack.pop();
656       replacementStack.pop();
657       return canonicalizedObj;
658     }
659
660     if (obj && obj.toJSON) {
661       obj = obj.toJSON();
662     }
663
664     if (_typeof(obj) === 'object' && obj !== null) {
665       stack.push(obj);
666       canonicalizedObj = {};
667       replacementStack.push(canonicalizedObj);
668
669       var sortedKeys = [],
670           _key;
671
672       for (_key in obj) {
673         /* istanbul ignore else */
674         if (obj.hasOwnProperty(_key)) {
675           sortedKeys.push(_key);
676         }
677       }
678
679       sortedKeys.sort();
680
681       for (i = 0; i < sortedKeys.length; i += 1) {
682         _key = sortedKeys[i];
683         canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
684       }
685
686       stack.pop();
687       replacementStack.pop();
688     } else {
689       canonicalizedObj = obj;
690     }
691
692     return canonicalizedObj;
693   }
694
695   var arrayDiff = new Diff();
696
697   arrayDiff.tokenize = function (value) {
698     return value.slice();
699   };
700
701   arrayDiff.join = arrayDiff.removeEmpty = function (value) {
702     return value;
703   };
704
705   function diffArrays(oldArr, newArr, callback) {
706     return arrayDiff.diff(oldArr, newArr, callback);
707   }
708
709   function parsePatch(uniDiff) {
710     var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
711     var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
712         delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
713         list = [],
714         i = 0;
715
716     function parseIndex() {
717       var index = {};
718       list.push(index); // Parse diff metadata
719
720       while (i < diffstr.length) {
721         var line = diffstr[i]; // File header found, end parsing diff metadata
722
723         if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
724           break;
725         } // Diff index
726
727
728         var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
729
730         if (header) {
731           index.index = header[1];
732         }
733
734         i++;
735       } // Parse file headers if they are defined. Unified diff requires them, but
736       // there's no technical issues to have an isolated hunk without file header
737
738
739       parseFileHeader(index);
740       parseFileHeader(index); // Parse hunks
741
742       index.hunks = [];
743
744       while (i < diffstr.length) {
745         var _line = diffstr[i];
746
747         if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
748           break;
749         } else if (/^@@/.test(_line)) {
750           index.hunks.push(parseHunk());
751         } else if (_line && options.strict) {
752           // Ignore unexpected content unless in strict mode
753           throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
754         } else {
755           i++;
756         }
757       }
758     } // Parses the --- and +++ headers, if none are found, no lines
759     // are consumed.
760
761
762     function parseFileHeader(index) {
763       var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
764
765       if (fileHeader) {
766         var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
767         var data = fileHeader[2].split('\t', 2);
768         var fileName = data[0].replace(/\\\\/g, '\\');
769
770         if (/^".*"$/.test(fileName)) {
771           fileName = fileName.substr(1, fileName.length - 2);
772         }
773
774         index[keyPrefix + 'FileName'] = fileName;
775         index[keyPrefix + 'Header'] = (data[1] || '').trim();
776         i++;
777       }
778     } // Parses a hunk
779     // This assumes that we are at the start of a hunk.
780
781
782     function parseHunk() {
783       var chunkHeaderIndex = i,
784           chunkHeaderLine = diffstr[i++],
785           chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
786       var hunk = {
787         oldStart: +chunkHeader[1],
788         oldLines: +chunkHeader[2] || 1,
789         newStart: +chunkHeader[3],
790         newLines: +chunkHeader[4] || 1,
791         lines: [],
792         linedelimiters: []
793       };
794       var addCount = 0,
795           removeCount = 0;
796
797       for (; i < diffstr.length; i++) {
798         // Lines starting with '---' could be mistaken for the "remove line" operation
799         // But they could be the header for the next file. Therefore prune such cases out.
800         if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
801           break;
802         }
803
804         var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
805
806         if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
807           hunk.lines.push(diffstr[i]);
808           hunk.linedelimiters.push(delimiters[i] || '\n');
809
810           if (operation === '+') {
811             addCount++;
812           } else if (operation === '-') {
813             removeCount++;
814           } else if (operation === ' ') {
815             addCount++;
816             removeCount++;
817           }
818         } else {
819           break;
820         }
821       } // Handle the empty block count case
822
823
824       if (!addCount && hunk.newLines === 1) {
825         hunk.newLines = 0;
826       }
827
828       if (!removeCount && hunk.oldLines === 1) {
829         hunk.oldLines = 0;
830       } // Perform optional sanity checking
831
832
833       if (options.strict) {
834         if (addCount !== hunk.newLines) {
835           throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
836         }
837
838         if (removeCount !== hunk.oldLines) {
839           throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
840         }
841       }
842
843       return hunk;
844     }
845
846     while (i < diffstr.length) {
847       parseIndex();
848     }
849
850     return list;
851   } // Iterator that traverses in the range of [min, max], stepping
852   // by distance from a given start position. I.e. for [0, 4], with
853   // start of 2, this will iterate 2, 3, 1, 4, 0.
854
855
856   function distanceIterator(start, minLine, maxLine) {
857     var wantForward = true,
858         backwardExhausted = false,
859         forwardExhausted = false,
860         localOffset = 1;
861     return function iterator() {
862       if (wantForward && !forwardExhausted) {
863         if (backwardExhausted) {
864           localOffset++;
865         } else {
866           wantForward = false;
867         } // Check if trying to fit beyond text length, and if not, check it fits
868         // after offset location (or desired location on first iteration)
869
870
871         if (start + localOffset <= maxLine) {
872           return localOffset;
873         }
874
875         forwardExhausted = true;
876       }
877
878       if (!backwardExhausted) {
879         if (!forwardExhausted) {
880           wantForward = true;
881         } // Check if trying to fit before text beginning, and if not, check it fits
882         // before offset location
883
884
885         if (minLine <= start - localOffset) {
886           return -localOffset++;
887         }
888
889         backwardExhausted = true;
890         return iterator();
891       } // We tried to fit hunk before text beginning and beyond text length, then
892       // hunk can't fit on the text. Return undefined
893
894     };
895   }
896
897   function applyPatch(source, uniDiff) {
898     var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
899
900     if (typeof uniDiff === 'string') {
901       uniDiff = parsePatch(uniDiff);
902     }
903
904     if (Array.isArray(uniDiff)) {
905       if (uniDiff.length > 1) {
906         throw new Error('applyPatch only works with a single input.');
907       }
908
909       uniDiff = uniDiff[0];
910     } // Apply the diff to the input
911
912
913     var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
914         delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
915         hunks = uniDiff.hunks,
916         compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) {
917       return line === patchContent;
918     },
919         errorCount = 0,
920         fuzzFactor = options.fuzzFactor || 0,
921         minLine = 0,
922         offset = 0,
923         removeEOFNL,
924         addEOFNL;
925     /**
926      * Checks if the hunk exactly fits on the provided location
927      */
928
929
930     function hunkFits(hunk, toPos) {
931       for (var j = 0; j < hunk.lines.length; j++) {
932         var line = hunk.lines[j],
933             operation = line.length > 0 ? line[0] : ' ',
934             content = line.length > 0 ? line.substr(1) : line;
935
936         if (operation === ' ' || operation === '-') {
937           // Context sanity check
938           if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
939             errorCount++;
940
941             if (errorCount > fuzzFactor) {
942               return false;
943             }
944           }
945
946           toPos++;
947         }
948       }
949
950       return true;
951     } // Search best fit offsets for each hunk based on the previous ones
952
953
954     for (var i = 0; i < hunks.length; i++) {
955       var hunk = hunks[i],
956           maxLine = lines.length - hunk.oldLines,
957           localOffset = 0,
958           toPos = offset + hunk.oldStart - 1;
959       var iterator = distanceIterator(toPos, minLine, maxLine);
960
961       for (; localOffset !== undefined; localOffset = iterator()) {
962         if (hunkFits(hunk, toPos + localOffset)) {
963           hunk.offset = offset += localOffset;
964           break;
965         }
966       }
967
968       if (localOffset === undefined) {
969         return false;
970       } // Set lower text limit to end of the current hunk, so next ones don't try
971       // to fit over already patched text
972
973
974       minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
975     } // Apply patch hunks
976
977
978     var diffOffset = 0;
979
980     for (var _i = 0; _i < hunks.length; _i++) {
981       var _hunk = hunks[_i],
982           _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
983
984       diffOffset += _hunk.newLines - _hunk.oldLines;
985
986       if (_toPos < 0) {
987         // Creating a new file
988         _toPos = 0;
989       }
990
991       for (var j = 0; j < _hunk.lines.length; j++) {
992         var line = _hunk.lines[j],
993             operation = line.length > 0 ? line[0] : ' ',
994             content = line.length > 0 ? line.substr(1) : line,
995             delimiter = _hunk.linedelimiters[j];
996
997         if (operation === ' ') {
998           _toPos++;
999         } else if (operation === '-') {
1000           lines.splice(_toPos, 1);
1001           delimiters.splice(_toPos, 1);
1002           /* istanbul ignore else */
1003         } else if (operation === '+') {
1004           lines.splice(_toPos, 0, content);
1005           delimiters.splice(_toPos, 0, delimiter);
1006           _toPos++;
1007         } else if (operation === '\\') {
1008           var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
1009
1010           if (previousOperation === '+') {
1011             removeEOFNL = true;
1012           } else if (previousOperation === '-') {
1013             addEOFNL = true;
1014           }
1015         }
1016       }
1017     } // Handle EOFNL insertion/removal
1018
1019
1020     if (removeEOFNL) {
1021       while (!lines[lines.length - 1]) {
1022         lines.pop();
1023         delimiters.pop();
1024       }
1025     } else if (addEOFNL) {
1026       lines.push('');
1027       delimiters.push('\n');
1028     }
1029
1030     for (var _k = 0; _k < lines.length - 1; _k++) {
1031       lines[_k] = lines[_k] + delimiters[_k];
1032     }
1033
1034     return lines.join('');
1035   } // Wrapper that supports multiple file patches via callbacks.
1036
1037
1038   function applyPatches(uniDiff, options) {
1039     if (typeof uniDiff === 'string') {
1040       uniDiff = parsePatch(uniDiff);
1041     }
1042
1043     var currentIndex = 0;
1044
1045     function processIndex() {
1046       var index = uniDiff[currentIndex++];
1047
1048       if (!index) {
1049         return options.complete();
1050       }
1051
1052       options.loadFile(index, function (err, data) {
1053         if (err) {
1054           return options.complete(err);
1055         }
1056
1057         var updatedContent = applyPatch(data, index, options);
1058         options.patched(index, updatedContent, function (err) {
1059           if (err) {
1060             return options.complete(err);
1061           }
1062
1063           processIndex();
1064         });
1065       });
1066     }
1067
1068     processIndex();
1069   }
1070
1071   function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
1072     if (!options) {
1073       options = {};
1074     }
1075
1076     if (typeof options.context === 'undefined') {
1077       options.context = 4;
1078     }
1079
1080     var diff = diffLines(oldStr, newStr, options);
1081     diff.push({
1082       value: '',
1083       lines: []
1084     }); // Append an empty value to make cleanup easier
1085
1086     function contextLines(lines) {
1087       return lines.map(function (entry) {
1088         return ' ' + entry;
1089       });
1090     }
1091
1092     var hunks = [];
1093     var oldRangeStart = 0,
1094         newRangeStart = 0,
1095         curRange = [],
1096         oldLine = 1,
1097         newLine = 1;
1098
1099     var _loop = function _loop(i) {
1100       var current = diff[i],
1101           lines = current.lines || current.value.replace(/\n$/, '').split('\n');
1102       current.lines = lines;
1103
1104       if (current.added || current.removed) {
1105         var _curRange; // If we have previous context, start with that
1106
1107
1108         if (!oldRangeStart) {
1109           var prev = diff[i - 1];
1110           oldRangeStart = oldLine;
1111           newRangeStart = newLine;
1112
1113           if (prev) {
1114             curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
1115             oldRangeStart -= curRange.length;
1116             newRangeStart -= curRange.length;
1117           }
1118         } // Output our changes
1119
1120
1121         (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) {
1122           return (current.added ? '+' : '-') + entry;
1123         }))); // Track the updated file position
1124
1125
1126         if (current.added) {
1127           newLine += lines.length;
1128         } else {
1129           oldLine += lines.length;
1130         }
1131       } else {
1132         // Identical context lines. Track line changes
1133         if (oldRangeStart) {
1134           // Close out any changes that have been output (or join overlapping)
1135           if (lines.length <= options.context * 2 && i < diff.length - 2) {
1136             var _curRange2; // Overlapping
1137
1138
1139             (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
1140           } else {
1141             var _curRange3; // end the range and output
1142
1143
1144             var contextSize = Math.min(lines.length, options.context);
1145
1146             (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
1147
1148             var hunk = {
1149               oldStart: oldRangeStart,
1150               oldLines: oldLine - oldRangeStart + contextSize,
1151               newStart: newRangeStart,
1152               newLines: newLine - newRangeStart + contextSize,
1153               lines: curRange
1154             };
1155
1156             if (i >= diff.length - 2 && lines.length <= options.context) {
1157               // EOF is inside this hunk
1158               var oldEOFNewline = /\n$/.test(oldStr);
1159               var newEOFNewline = /\n$/.test(newStr);
1160               var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
1161
1162               if (!oldEOFNewline && noNlBeforeAdds) {
1163                 // special case: old has no eol and no trailing context; no-nl can end up before adds
1164                 curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
1165               }
1166
1167               if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
1168                 curRange.push('\\ No newline at end of file');
1169               }
1170             }
1171
1172             hunks.push(hunk);
1173             oldRangeStart = 0;
1174             newRangeStart = 0;
1175             curRange = [];
1176           }
1177         }
1178
1179         oldLine += lines.length;
1180         newLine += lines.length;
1181       }
1182     };
1183
1184     for (var i = 0; i < diff.length; i++) {
1185       _loop(i);
1186     }
1187
1188     return {
1189       oldFileName: oldFileName,
1190       newFileName: newFileName,
1191       oldHeader: oldHeader,
1192       newHeader: newHeader,
1193       hunks: hunks
1194     };
1195   }
1196
1197   function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
1198     var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
1199     var ret = [];
1200
1201     if (oldFileName == newFileName) {
1202       ret.push('Index: ' + oldFileName);
1203     }
1204
1205     ret.push('===================================================================');
1206     ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
1207     ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
1208
1209     for (var i = 0; i < diff.hunks.length; i++) {
1210       var hunk = diff.hunks[i];
1211       ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
1212       ret.push.apply(ret, hunk.lines);
1213     }
1214
1215     return ret.join('\n') + '\n';
1216   }
1217
1218   function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
1219     return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
1220   }
1221
1222   function arrayEqual(a, b) {
1223     if (a.length !== b.length) {
1224       return false;
1225     }
1226
1227     return arrayStartsWith(a, b);
1228   }
1229
1230   function arrayStartsWith(array, start) {
1231     if (start.length > array.length) {
1232       return false;
1233     }
1234
1235     for (var i = 0; i < start.length; i++) {
1236       if (start[i] !== array[i]) {
1237         return false;
1238       }
1239     }
1240
1241     return true;
1242   }
1243
1244   function calcLineCount(hunk) {
1245     var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines),
1246         oldLines = _calcOldNewLineCount.oldLines,
1247         newLines = _calcOldNewLineCount.newLines;
1248
1249     if (oldLines !== undefined) {
1250       hunk.oldLines = oldLines;
1251     } else {
1252       delete hunk.oldLines;
1253     }
1254
1255     if (newLines !== undefined) {
1256       hunk.newLines = newLines;
1257     } else {
1258       delete hunk.newLines;
1259     }
1260   }
1261
1262   function merge(mine, theirs, base) {
1263     mine = loadPatch(mine, base);
1264     theirs = loadPatch(theirs, base);
1265     var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning.
1266     // Leaving sanity checks on this to the API consumer that may know more about the
1267     // meaning in their own context.
1268
1269     if (mine.index || theirs.index) {
1270       ret.index = mine.index || theirs.index;
1271     }
1272
1273     if (mine.newFileName || theirs.newFileName) {
1274       if (!fileNameChanged(mine)) {
1275         // No header or no change in ours, use theirs (and ours if theirs does not exist)
1276         ret.oldFileName = theirs.oldFileName || mine.oldFileName;
1277         ret.newFileName = theirs.newFileName || mine.newFileName;
1278         ret.oldHeader = theirs.oldHeader || mine.oldHeader;
1279         ret.newHeader = theirs.newHeader || mine.newHeader;
1280       } else if (!fileNameChanged(theirs)) {
1281         // No header or no change in theirs, use ours
1282         ret.oldFileName = mine.oldFileName;
1283         ret.newFileName = mine.newFileName;
1284         ret.oldHeader = mine.oldHeader;
1285         ret.newHeader = mine.newHeader;
1286       } else {
1287         // Both changed... figure it out
1288         ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
1289         ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
1290         ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
1291         ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
1292       }
1293     }
1294
1295     ret.hunks = [];
1296     var mineIndex = 0,
1297         theirsIndex = 0,
1298         mineOffset = 0,
1299         theirsOffset = 0;
1300
1301     while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
1302       var mineCurrent = mine.hunks[mineIndex] || {
1303         oldStart: Infinity
1304       },
1305           theirsCurrent = theirs.hunks[theirsIndex] || {
1306         oldStart: Infinity
1307       };
1308
1309       if (hunkBefore(mineCurrent, theirsCurrent)) {
1310         // This patch does not overlap with any of the others, yay.
1311         ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
1312         mineIndex++;
1313         theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
1314       } else if (hunkBefore(theirsCurrent, mineCurrent)) {
1315         // This patch does not overlap with any of the others, yay.
1316         ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
1317         theirsIndex++;
1318         mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
1319       } else {
1320         // Overlap, merge as best we can
1321         var mergedHunk = {
1322           oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
1323           oldLines: 0,
1324           newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
1325           newLines: 0,
1326           lines: []
1327         };
1328         mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
1329         theirsIndex++;
1330         mineIndex++;
1331         ret.hunks.push(mergedHunk);
1332       }
1333     }
1334
1335     return ret;
1336   }
1337
1338   function loadPatch(param, base) {
1339     if (typeof param === 'string') {
1340       if (/^@@/m.test(param) || /^Index:/m.test(param)) {
1341         return parsePatch(param)[0];
1342       }
1343
1344       if (!base) {
1345         throw new Error('Must provide a base reference or pass in a patch');
1346       }
1347
1348       return structuredPatch(undefined, undefined, base, param);
1349     }
1350
1351     return param;
1352   }
1353
1354   function fileNameChanged(patch) {
1355     return patch.newFileName && patch.newFileName !== patch.oldFileName;
1356   }
1357
1358   function selectField(index, mine, theirs) {
1359     if (mine === theirs) {
1360       return mine;
1361     } else {
1362       index.conflict = true;
1363       return {
1364         mine: mine,
1365         theirs: theirs
1366       };
1367     }
1368   }
1369
1370   function hunkBefore(test, check) {
1371     return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
1372   }
1373
1374   function cloneHunk(hunk, offset) {
1375     return {
1376       oldStart: hunk.oldStart,
1377       oldLines: hunk.oldLines,
1378       newStart: hunk.newStart + offset,
1379       newLines: hunk.newLines,
1380       lines: hunk.lines
1381     };
1382   }
1383
1384   function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
1385     // This will generally result in a conflicted hunk, but there are cases where the context
1386     // is the only overlap where we can successfully merge the content here.
1387     var mine = {
1388       offset: mineOffset,
1389       lines: mineLines,
1390       index: 0
1391     },
1392         their = {
1393       offset: theirOffset,
1394       lines: theirLines,
1395       index: 0
1396     }; // Handle any leading content
1397
1398     insertLeading(hunk, mine, their);
1399     insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each.
1400
1401     while (mine.index < mine.lines.length && their.index < their.lines.length) {
1402       var mineCurrent = mine.lines[mine.index],
1403           theirCurrent = their.lines[their.index];
1404
1405       if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
1406         // Both modified ...
1407         mutualChange(hunk, mine, their);
1408       } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
1409         var _hunk$lines; // Mine inserted
1410
1411
1412         (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine)));
1413       } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
1414         var _hunk$lines2; // Theirs inserted
1415
1416
1417         (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their)));
1418       } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
1419         // Mine removed or edited
1420         removal(hunk, mine, their);
1421       } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
1422         // Their removed or edited
1423         removal(hunk, their, mine, true);
1424       } else if (mineCurrent === theirCurrent) {
1425         // Context identity
1426         hunk.lines.push(mineCurrent);
1427         mine.index++;
1428         their.index++;
1429       } else {
1430         // Context mismatch
1431         conflict(hunk, collectChange(mine), collectChange(their));
1432       }
1433     } // Now push anything that may be remaining
1434
1435
1436     insertTrailing(hunk, mine);
1437     insertTrailing(hunk, their);
1438     calcLineCount(hunk);
1439   }
1440
1441   function mutualChange(hunk, mine, their) {
1442     var myChanges = collectChange(mine),
1443         theirChanges = collectChange(their);
1444
1445     if (allRemoves(myChanges) && allRemoves(theirChanges)) {
1446       // Special case for remove changes that are supersets of one another
1447       if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
1448         var _hunk$lines3;
1449
1450         (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges));
1451
1452         return;
1453       } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
1454         var _hunk$lines4;
1455
1456         (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges));
1457
1458         return;
1459       }
1460     } else if (arrayEqual(myChanges, theirChanges)) {
1461       var _hunk$lines5;
1462
1463       (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges));
1464
1465       return;
1466     }
1467
1468     conflict(hunk, myChanges, theirChanges);
1469   }
1470
1471   function removal(hunk, mine, their, swap) {
1472     var myChanges = collectChange(mine),
1473         theirChanges = collectContext(their, myChanges);
1474
1475     if (theirChanges.merged) {
1476       var _hunk$lines6;
1477
1478       (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged));
1479     } else {
1480       conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
1481     }
1482   }
1483
1484   function conflict(hunk, mine, their) {
1485     hunk.conflict = true;
1486     hunk.lines.push({
1487       conflict: true,
1488       mine: mine,
1489       theirs: their
1490     });
1491   }
1492
1493   function insertLeading(hunk, insert, their) {
1494     while (insert.offset < their.offset && insert.index < insert.lines.length) {
1495       var line = insert.lines[insert.index++];
1496       hunk.lines.push(line);
1497       insert.offset++;
1498     }
1499   }
1500
1501   function insertTrailing(hunk, insert) {
1502     while (insert.index < insert.lines.length) {
1503       var line = insert.lines[insert.index++];
1504       hunk.lines.push(line);
1505     }
1506   }
1507
1508   function collectChange(state) {
1509     var ret = [],
1510         operation = state.lines[state.index][0];
1511
1512     while (state.index < state.lines.length) {
1513       var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
1514
1515       if (operation === '-' && line[0] === '+') {
1516         operation = '+';
1517       }
1518
1519       if (operation === line[0]) {
1520         ret.push(line);
1521         state.index++;
1522       } else {
1523         break;
1524       }
1525     }
1526
1527     return ret;
1528   }
1529
1530   function collectContext(state, matchChanges) {
1531     var changes = [],
1532         merged = [],
1533         matchIndex = 0,
1534         contextChanges = false,
1535         conflicted = false;
1536
1537     while (matchIndex < matchChanges.length && state.index < state.lines.length) {
1538       var change = state.lines[state.index],
1539           match = matchChanges[matchIndex]; // Once we've hit our add, then we are done
1540
1541       if (match[0] === '+') {
1542         break;
1543       }
1544
1545       contextChanges = contextChanges || change[0] !== ' ';
1546       merged.push(match);
1547       matchIndex++; // Consume any additions in the other block as a conflict to attempt
1548       // to pull in the remaining context after this
1549
1550       if (change[0] === '+') {
1551         conflicted = true;
1552
1553         while (change[0] === '+') {
1554           changes.push(change);
1555           change = state.lines[++state.index];
1556         }
1557       }
1558
1559       if (match.substr(1) === change.substr(1)) {
1560         changes.push(change);
1561         state.index++;
1562       } else {
1563         conflicted = true;
1564       }
1565     }
1566
1567     if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
1568       conflicted = true;
1569     }
1570
1571     if (conflicted) {
1572       return changes;
1573     }
1574
1575     while (matchIndex < matchChanges.length) {
1576       merged.push(matchChanges[matchIndex++]);
1577     }
1578
1579     return {
1580       merged: merged,
1581       changes: changes
1582     };
1583   }
1584
1585   function allRemoves(changes) {
1586     return changes.reduce(function (prev, change) {
1587       return prev && change[0] === '-';
1588     }, true);
1589   }
1590
1591   function skipRemoveSuperset(state, removeChanges, delta) {
1592     for (var i = 0; i < delta; i++) {
1593       var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
1594
1595       if (state.lines[state.index + i] !== ' ' + changeContent) {
1596         return false;
1597       }
1598     }
1599
1600     state.index += delta;
1601     return true;
1602   }
1603
1604   function calcOldNewLineCount(lines) {
1605     var oldLines = 0;
1606     var newLines = 0;
1607     lines.forEach(function (line) {
1608       if (typeof line !== 'string') {
1609         var myCount = calcOldNewLineCount(line.mine);
1610         var theirCount = calcOldNewLineCount(line.theirs);
1611
1612         if (oldLines !== undefined) {
1613           if (myCount.oldLines === theirCount.oldLines) {
1614             oldLines += myCount.oldLines;
1615           } else {
1616             oldLines = undefined;
1617           }
1618         }
1619
1620         if (newLines !== undefined) {
1621           if (myCount.newLines === theirCount.newLines) {
1622             newLines += myCount.newLines;
1623           } else {
1624             newLines = undefined;
1625           }
1626         }
1627       } else {
1628         if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
1629           newLines++;
1630         }
1631
1632         if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
1633           oldLines++;
1634         }
1635       }
1636     });
1637     return {
1638       oldLines: oldLines,
1639       newLines: newLines
1640     };
1641   } // See: http://code.google.com/p/google-diff-match-patch/wiki/API
1642
1643
1644   function convertChangesToDMP(changes) {
1645     var ret = [],
1646         change,
1647         operation;
1648
1649     for (var i = 0; i < changes.length; i++) {
1650       change = changes[i];
1651
1652       if (change.added) {
1653         operation = 1;
1654       } else if (change.removed) {
1655         operation = -1;
1656       } else {
1657         operation = 0;
1658       }
1659
1660       ret.push([operation, change.value]);
1661     }
1662
1663     return ret;
1664   }
1665
1666   function convertChangesToXML(changes) {
1667     var ret = [];
1668
1669     for (var i = 0; i < changes.length; i++) {
1670       var change = changes[i];
1671
1672       if (change.added) {
1673         ret.push('<ins>');
1674       } else if (change.removed) {
1675         ret.push('<del>');
1676       }
1677
1678       ret.push(escapeHTML(change.value));
1679
1680       if (change.added) {
1681         ret.push('</ins>');
1682       } else if (change.removed) {
1683         ret.push('</del>');
1684       }
1685     }
1686
1687     return ret.join('');
1688   }
1689
1690   function escapeHTML(s) {
1691     var n = s;
1692     n = n.replace(/&/g, '&amp;');
1693     n = n.replace(/</g, '&lt;');
1694     n = n.replace(/>/g, '&gt;');
1695     n = n.replace(/"/g, '&quot;');
1696     return n;
1697   }
1698
1699   var index_es6 = /*#__PURE__*/Object.freeze({
1700     __proto__: null,
1701     Diff: Diff,
1702     diffChars: diffChars,
1703     diffWords: diffWords,
1704     diffWordsWithSpace: diffWordsWithSpace,
1705     diffLines: diffLines,
1706     diffTrimmedLines: diffTrimmedLines,
1707     diffSentences: diffSentences,
1708     diffCss: diffCss,
1709     diffJson: diffJson,
1710     diffArrays: diffArrays,
1711     structuredPatch: structuredPatch,
1712     createTwoFilesPatch: createTwoFilesPatch,
1713     createPatch: createPatch,
1714     applyPatch: applyPatch,
1715     applyPatches: applyPatches,
1716     parsePatch: parsePatch,
1717     merge: merge,
1718     convertChangesToDMP: convertChangesToDMP,
1719     convertChangesToXML: convertChangesToXML,
1720     canonicalize: canonicalize
1721   });
1722
1723   var _shim_fs = {};
1724
1725   var _shim_fs$1 = /*#__PURE__*/Object.freeze({
1726     __proto__: null,
1727     'default': _shim_fs
1728   });
1729
1730   const sep = /[\\/]/;
1731   function extname(path) {
1732     const filename = basename(path);
1733     const dotIndex = filename.lastIndexOf(".");
1734     if (dotIndex === -1) return "";
1735     return filename.slice(dotIndex);
1736   }
1737   function basename(path) {
1738     return path.split(sep).pop();
1739   }
1740   function isAbsolute() {
1741     return true;
1742   }
1743
1744   var path = /*#__PURE__*/Object.freeze({
1745     __proto__: null,
1746     extname: extname,
1747     basename: basename,
1748     isAbsolute: isAbsolute
1749   });
1750
1751   var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
1752
1753   var lookup = [];
1754   var revLookup = [];
1755   var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
1756   var inited = false;
1757
1758   function init() {
1759     inited = true;
1760     var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
1761
1762     for (var i = 0, len = code.length; i < len; ++i) {
1763       lookup[i] = code[i];
1764       revLookup[code.charCodeAt(i)] = i;
1765     }
1766
1767     revLookup['-'.charCodeAt(0)] = 62;
1768     revLookup['_'.charCodeAt(0)] = 63;
1769   }
1770
1771   function toByteArray(b64) {
1772     if (!inited) {
1773       init();
1774     }
1775
1776     var i, j, l, tmp, placeHolders, arr;
1777     var len = b64.length;
1778
1779     if (len % 4 > 0) {
1780       throw new Error('Invalid string. Length must be a multiple of 4');
1781     } // the number of equal signs (place holders)
1782     // if there are two placeholders, than the two characters before it
1783     // represent one byte
1784     // if there is only one, then the three characters before it represent 2 bytes
1785     // this is just a cheap hack to not do indexOf twice
1786
1787
1788     placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; // base64 is 4/3 + up to two characters of the original data
1789
1790     arr = new Arr(len * 3 / 4 - placeHolders); // if there are placeholders, only get up to the last complete 4 chars
1791
1792     l = placeHolders > 0 ? len - 4 : len;
1793     var L = 0;
1794
1795     for (i = 0, j = 0; i < l; i += 4, j += 3) {
1796       tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
1797       arr[L++] = tmp >> 16 & 0xFF;
1798       arr[L++] = tmp >> 8 & 0xFF;
1799       arr[L++] = tmp & 0xFF;
1800     }
1801
1802     if (placeHolders === 2) {
1803       tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
1804       arr[L++] = tmp & 0xFF;
1805     } else if (placeHolders === 1) {
1806       tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
1807       arr[L++] = tmp >> 8 & 0xFF;
1808       arr[L++] = tmp & 0xFF;
1809     }
1810
1811     return arr;
1812   }
1813
1814   function tripletToBase64(num) {
1815     return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
1816   }
1817
1818   function encodeChunk(uint8, start, end) {
1819     var tmp;
1820     var output = [];
1821
1822     for (var i = start; i < end; i += 3) {
1823       tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
1824       output.push(tripletToBase64(tmp));
1825     }
1826
1827     return output.join('');
1828   }
1829
1830   function fromByteArray(uint8) {
1831     if (!inited) {
1832       init();
1833     }
1834
1835     var tmp;
1836     var len = uint8.length;
1837     var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
1838
1839     var output = '';
1840     var parts = [];
1841     var maxChunkLength = 16383; // must be multiple of 3
1842     // go through the array every three bytes, we'll deal with trailing stuff later
1843
1844     for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
1845       parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
1846     } // pad the end with zeros, but make sure to not forget the extra bytes
1847
1848
1849     if (extraBytes === 1) {
1850       tmp = uint8[len - 1];
1851       output += lookup[tmp >> 2];
1852       output += lookup[tmp << 4 & 0x3F];
1853       output += '==';
1854     } else if (extraBytes === 2) {
1855       tmp = (uint8[len - 2] << 8) + uint8[len - 1];
1856       output += lookup[tmp >> 10];
1857       output += lookup[tmp >> 4 & 0x3F];
1858       output += lookup[tmp << 2 & 0x3F];
1859       output += '=';
1860     }
1861
1862     parts.push(output);
1863     return parts.join('');
1864   }
1865
1866   function read(buffer, offset, isLE, mLen, nBytes) {
1867     var e, m;
1868     var eLen = nBytes * 8 - mLen - 1;
1869     var eMax = (1 << eLen) - 1;
1870     var eBias = eMax >> 1;
1871     var nBits = -7;
1872     var i = isLE ? nBytes - 1 : 0;
1873     var d = isLE ? -1 : 1;
1874     var s = buffer[offset + i];
1875     i += d;
1876     e = s & (1 << -nBits) - 1;
1877     s >>= -nBits;
1878     nBits += eLen;
1879
1880     for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
1881
1882     m = e & (1 << -nBits) - 1;
1883     e >>= -nBits;
1884     nBits += mLen;
1885
1886     for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
1887
1888     if (e === 0) {
1889       e = 1 - eBias;
1890     } else if (e === eMax) {
1891       return m ? NaN : (s ? -1 : 1) * Infinity;
1892     } else {
1893       m = m + Math.pow(2, mLen);
1894       e = e - eBias;
1895     }
1896
1897     return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
1898   }
1899   function write(buffer, value, offset, isLE, mLen, nBytes) {
1900     var e, m, c;
1901     var eLen = nBytes * 8 - mLen - 1;
1902     var eMax = (1 << eLen) - 1;
1903     var eBias = eMax >> 1;
1904     var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
1905     var i = isLE ? 0 : nBytes - 1;
1906     var d = isLE ? 1 : -1;
1907     var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
1908     value = Math.abs(value);
1909
1910     if (isNaN(value) || value === Infinity) {
1911       m = isNaN(value) ? 1 : 0;
1912       e = eMax;
1913     } else {
1914       e = Math.floor(Math.log(value) / Math.LN2);
1915
1916       if (value * (c = Math.pow(2, -e)) < 1) {
1917         e--;
1918         c *= 2;
1919       }
1920
1921       if (e + eBias >= 1) {
1922         value += rt / c;
1923       } else {
1924         value += rt * Math.pow(2, 1 - eBias);
1925       }
1926
1927       if (value * c >= 2) {
1928         e++;
1929         c /= 2;
1930       }
1931
1932       if (e + eBias >= eMax) {
1933         m = 0;
1934         e = eMax;
1935       } else if (e + eBias >= 1) {
1936         m = (value * c - 1) * Math.pow(2, mLen);
1937         e = e + eBias;
1938       } else {
1939         m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
1940         e = 0;
1941       }
1942     }
1943
1944     for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
1945
1946     e = e << mLen | m;
1947     eLen += mLen;
1948
1949     for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
1950
1951     buffer[offset + i - d] |= s * 128;
1952   }
1953
1954   var toString = {}.toString;
1955   var isArray = Array.isArray || function (arr) {
1956     return toString.call(arr) == '[object Array]';
1957   };
1958
1959   var INSPECT_MAX_BYTES = 50;
1960   /**
1961    * If `Buffer.TYPED_ARRAY_SUPPORT`:
1962    *   === true    Use Uint8Array implementation (fastest)
1963    *   === false   Use Object implementation (most compatible, even IE6)
1964    *
1965    * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
1966    * Opera 11.6+, iOS 4.2+.
1967    *
1968    * Due to various browser bugs, sometimes the Object implementation will be used even
1969    * when the browser supports typed arrays.
1970    *
1971    * Note:
1972    *
1973    *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
1974    *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
1975    *
1976    *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
1977    *
1978    *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
1979    *     incorrect length in some situations.
1980
1981    * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
1982    * get the Object implementation, which is slower but behaves correctly.
1983    */
1984
1985   Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined ? global$1.TYPED_ARRAY_SUPPORT : true;
1986
1987   function kMaxLength() {
1988     return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
1989   }
1990
1991   function createBuffer(that, length) {
1992     if (kMaxLength() < length) {
1993       throw new RangeError('Invalid typed array length');
1994     }
1995
1996     if (Buffer.TYPED_ARRAY_SUPPORT) {
1997       // Return an augmented `Uint8Array` instance, for best performance
1998       that = new Uint8Array(length);
1999       that.__proto__ = Buffer.prototype;
2000     } else {
2001       // Fallback: Return an object instance of the Buffer class
2002       if (that === null) {
2003         that = new Buffer(length);
2004       }
2005
2006       that.length = length;
2007     }
2008
2009     return that;
2010   }
2011   /**
2012    * The Buffer constructor returns instances of `Uint8Array` that have their
2013    * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
2014    * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
2015    * and the `Uint8Array` methods. Square bracket notation works as expected -- it
2016    * returns a single octet.
2017    *
2018    * The `Uint8Array` prototype remains unmodified.
2019    */
2020
2021
2022   function Buffer(arg, encodingOrOffset, length) {
2023     if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
2024       return new Buffer(arg, encodingOrOffset, length);
2025     } // Common case.
2026
2027
2028     if (typeof arg === 'number') {
2029       if (typeof encodingOrOffset === 'string') {
2030         throw new Error('If encoding is specified then the first argument must be a string');
2031       }
2032
2033       return allocUnsafe(this, arg);
2034     }
2035
2036     return from(this, arg, encodingOrOffset, length);
2037   }
2038   Buffer.poolSize = 8192; // not used by this implementation
2039   // TODO: Legacy, not needed anymore. Remove in next major version.
2040
2041   Buffer._augment = function (arr) {
2042     arr.__proto__ = Buffer.prototype;
2043     return arr;
2044   };
2045
2046   function from(that, value, encodingOrOffset, length) {
2047     if (typeof value === 'number') {
2048       throw new TypeError('"value" argument must not be a number');
2049     }
2050
2051     if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
2052       return fromArrayBuffer(that, value, encodingOrOffset, length);
2053     }
2054
2055     if (typeof value === 'string') {
2056       return fromString(that, value, encodingOrOffset);
2057     }
2058
2059     return fromObject(that, value);
2060   }
2061   /**
2062    * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
2063    * if value is a number.
2064    * Buffer.from(str[, encoding])
2065    * Buffer.from(array)
2066    * Buffer.from(buffer)
2067    * Buffer.from(arrayBuffer[, byteOffset[, length]])
2068    **/
2069
2070
2071   Buffer.from = function (value, encodingOrOffset, length) {
2072     return from(null, value, encodingOrOffset, length);
2073   };
2074
2075   if (Buffer.TYPED_ARRAY_SUPPORT) {
2076     Buffer.prototype.__proto__ = Uint8Array.prototype;
2077     Buffer.__proto__ = Uint8Array;
2078   }
2079
2080   function assertSize(size) {
2081     if (typeof size !== 'number') {
2082       throw new TypeError('"size" argument must be a number');
2083     } else if (size < 0) {
2084       throw new RangeError('"size" argument must not be negative');
2085     }
2086   }
2087
2088   function alloc(that, size, fill, encoding) {
2089     assertSize(size);
2090
2091     if (size <= 0) {
2092       return createBuffer(that, size);
2093     }
2094
2095     if (fill !== undefined) {
2096       // Only pay attention to encoding if it's a string. This
2097       // prevents accidentally sending in a number that would
2098       // be interpretted as a start offset.
2099       return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
2100     }
2101
2102     return createBuffer(that, size);
2103   }
2104   /**
2105    * Creates a new filled Buffer instance.
2106    * alloc(size[, fill[, encoding]])
2107    **/
2108
2109
2110   Buffer.alloc = function (size, fill, encoding) {
2111     return alloc(null, size, fill, encoding);
2112   };
2113
2114   function allocUnsafe(that, size) {
2115     assertSize(size);
2116     that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
2117
2118     if (!Buffer.TYPED_ARRAY_SUPPORT) {
2119       for (var i = 0; i < size; ++i) {
2120         that[i] = 0;
2121       }
2122     }
2123
2124     return that;
2125   }
2126   /**
2127    * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
2128    * */
2129
2130
2131   Buffer.allocUnsafe = function (size) {
2132     return allocUnsafe(null, size);
2133   };
2134   /**
2135    * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
2136    */
2137
2138
2139   Buffer.allocUnsafeSlow = function (size) {
2140     return allocUnsafe(null, size);
2141   };
2142
2143   function fromString(that, string, encoding) {
2144     if (typeof encoding !== 'string' || encoding === '') {
2145       encoding = 'utf8';
2146     }
2147
2148     if (!Buffer.isEncoding(encoding)) {
2149       throw new TypeError('"encoding" must be a valid string encoding');
2150     }
2151
2152     var length = byteLength(string, encoding) | 0;
2153     that = createBuffer(that, length);
2154     var actual = that.write(string, encoding);
2155
2156     if (actual !== length) {
2157       // Writing a hex string, for example, that contains invalid characters will
2158       // cause everything after the first invalid character to be ignored. (e.g.
2159       // 'abxxcd' will be treated as 'ab')
2160       that = that.slice(0, actual);
2161     }
2162
2163     return that;
2164   }
2165
2166   function fromArrayLike(that, array) {
2167     var length = array.length < 0 ? 0 : checked(array.length) | 0;
2168     that = createBuffer(that, length);
2169
2170     for (var i = 0; i < length; i += 1) {
2171       that[i] = array[i] & 255;
2172     }
2173
2174     return that;
2175   }
2176
2177   function fromArrayBuffer(that, array, byteOffset, length) {
2178     array.byteLength; // this throws if `array` is not a valid ArrayBuffer
2179
2180     if (byteOffset < 0 || array.byteLength < byteOffset) {
2181       throw new RangeError('\'offset\' is out of bounds');
2182     }
2183
2184     if (array.byteLength < byteOffset + (length || 0)) {
2185       throw new RangeError('\'length\' is out of bounds');
2186     }
2187
2188     if (byteOffset === undefined && length === undefined) {
2189       array = new Uint8Array(array);
2190     } else if (length === undefined) {
2191       array = new Uint8Array(array, byteOffset);
2192     } else {
2193       array = new Uint8Array(array, byteOffset, length);
2194     }
2195
2196     if (Buffer.TYPED_ARRAY_SUPPORT) {
2197       // Return an augmented `Uint8Array` instance, for best performance
2198       that = array;
2199       that.__proto__ = Buffer.prototype;
2200     } else {
2201       // Fallback: Return an object instance of the Buffer class
2202       that = fromArrayLike(that, array);
2203     }
2204
2205     return that;
2206   }
2207
2208   function fromObject(that, obj) {
2209     if (internalIsBuffer(obj)) {
2210       var len = checked(obj.length) | 0;
2211       that = createBuffer(that, len);
2212
2213       if (that.length === 0) {
2214         return that;
2215       }
2216
2217       obj.copy(that, 0, 0, len);
2218       return that;
2219     }
2220
2221     if (obj) {
2222       if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
2223         if (typeof obj.length !== 'number' || isnan(obj.length)) {
2224           return createBuffer(that, 0);
2225         }
2226
2227         return fromArrayLike(that, obj);
2228       }
2229
2230       if (obj.type === 'Buffer' && isArray(obj.data)) {
2231         return fromArrayLike(that, obj.data);
2232       }
2233     }
2234
2235     throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
2236   }
2237
2238   function checked(length) {
2239     // Note: cannot use `length < kMaxLength()` here because that fails when
2240     // length is NaN (which is otherwise coerced to zero.)
2241     if (length >= kMaxLength()) {
2242       throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
2243     }
2244
2245     return length | 0;
2246   }
2247   Buffer.isBuffer = isBuffer;
2248
2249   function internalIsBuffer(b) {
2250     return !!(b != null && b._isBuffer);
2251   }
2252
2253   Buffer.compare = function compare(a, b) {
2254     if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
2255       throw new TypeError('Arguments must be Buffers');
2256     }
2257
2258     if (a === b) return 0;
2259     var x = a.length;
2260     var y = b.length;
2261
2262     for (var i = 0, len = Math.min(x, y); i < len; ++i) {
2263       if (a[i] !== b[i]) {
2264         x = a[i];
2265         y = b[i];
2266         break;
2267       }
2268     }
2269
2270     if (x < y) return -1;
2271     if (y < x) return 1;
2272     return 0;
2273   };
2274
2275   Buffer.isEncoding = function isEncoding(encoding) {
2276     switch (String(encoding).toLowerCase()) {
2277       case 'hex':
2278       case 'utf8':
2279       case 'utf-8':
2280       case 'ascii':
2281       case 'latin1':
2282       case 'binary':
2283       case 'base64':
2284       case 'ucs2':
2285       case 'ucs-2':
2286       case 'utf16le':
2287       case 'utf-16le':
2288         return true;
2289
2290       default:
2291         return false;
2292     }
2293   };
2294
2295   Buffer.concat = function concat(list, length) {
2296     if (!isArray(list)) {
2297       throw new TypeError('"list" argument must be an Array of Buffers');
2298     }
2299
2300     if (list.length === 0) {
2301       return Buffer.alloc(0);
2302     }
2303
2304     var i;
2305
2306     if (length === undefined) {
2307       length = 0;
2308
2309       for (i = 0; i < list.length; ++i) {
2310         length += list[i].length;
2311       }
2312     }
2313
2314     var buffer = Buffer.allocUnsafe(length);
2315     var pos = 0;
2316
2317     for (i = 0; i < list.length; ++i) {
2318       var buf = list[i];
2319
2320       if (!internalIsBuffer(buf)) {
2321         throw new TypeError('"list" argument must be an Array of Buffers');
2322       }
2323
2324       buf.copy(buffer, pos);
2325       pos += buf.length;
2326     }
2327
2328     return buffer;
2329   };
2330
2331   function byteLength(string, encoding) {
2332     if (internalIsBuffer(string)) {
2333       return string.length;
2334     }
2335
2336     if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
2337       return string.byteLength;
2338     }
2339
2340     if (typeof string !== 'string') {
2341       string = '' + string;
2342     }
2343
2344     var len = string.length;
2345     if (len === 0) return 0; // Use a for loop to avoid recursion
2346
2347     var loweredCase = false;
2348
2349     for (;;) {
2350       switch (encoding) {
2351         case 'ascii':
2352         case 'latin1':
2353         case 'binary':
2354           return len;
2355
2356         case 'utf8':
2357         case 'utf-8':
2358         case undefined:
2359           return utf8ToBytes(string).length;
2360
2361         case 'ucs2':
2362         case 'ucs-2':
2363         case 'utf16le':
2364         case 'utf-16le':
2365           return len * 2;
2366
2367         case 'hex':
2368           return len >>> 1;
2369
2370         case 'base64':
2371           return base64ToBytes(string).length;
2372
2373         default:
2374           if (loweredCase) return utf8ToBytes(string).length; // assume utf8
2375
2376           encoding = ('' + encoding).toLowerCase();
2377           loweredCase = true;
2378       }
2379     }
2380   }
2381
2382   Buffer.byteLength = byteLength;
2383
2384   function slowToString(encoding, start, end) {
2385     var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
2386     // property of a typed array.
2387     // This behaves neither like String nor Uint8Array in that we set start/end
2388     // to their upper/lower bounds if the value passed is out of range.
2389     // undefined is handled specially as per ECMA-262 6th Edition,
2390     // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
2391
2392     if (start === undefined || start < 0) {
2393       start = 0;
2394     } // Return early if start > this.length. Done here to prevent potential uint32
2395     // coercion fail below.
2396
2397
2398     if (start > this.length) {
2399       return '';
2400     }
2401
2402     if (end === undefined || end > this.length) {
2403       end = this.length;
2404     }
2405
2406     if (end <= 0) {
2407       return '';
2408     } // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
2409
2410
2411     end >>>= 0;
2412     start >>>= 0;
2413
2414     if (end <= start) {
2415       return '';
2416     }
2417
2418     if (!encoding) encoding = 'utf8';
2419
2420     while (true) {
2421       switch (encoding) {
2422         case 'hex':
2423           return hexSlice(this, start, end);
2424
2425         case 'utf8':
2426         case 'utf-8':
2427           return utf8Slice(this, start, end);
2428
2429         case 'ascii':
2430           return asciiSlice(this, start, end);
2431
2432         case 'latin1':
2433         case 'binary':
2434           return latin1Slice(this, start, end);
2435
2436         case 'base64':
2437           return base64Slice(this, start, end);
2438
2439         case 'ucs2':
2440         case 'ucs-2':
2441         case 'utf16le':
2442         case 'utf-16le':
2443           return utf16leSlice(this, start, end);
2444
2445         default:
2446           if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
2447           encoding = (encoding + '').toLowerCase();
2448           loweredCase = true;
2449       }
2450     }
2451   } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
2452   // Buffer instances.
2453
2454
2455   Buffer.prototype._isBuffer = true;
2456
2457   function swap(b, n, m) {
2458     var i = b[n];
2459     b[n] = b[m];
2460     b[m] = i;
2461   }
2462
2463   Buffer.prototype.swap16 = function swap16() {
2464     var len = this.length;
2465
2466     if (len % 2 !== 0) {
2467       throw new RangeError('Buffer size must be a multiple of 16-bits');
2468     }
2469
2470     for (var i = 0; i < len; i += 2) {
2471       swap(this, i, i + 1);
2472     }
2473
2474     return this;
2475   };
2476
2477   Buffer.prototype.swap32 = function swap32() {
2478     var len = this.length;
2479
2480     if (len % 4 !== 0) {
2481       throw new RangeError('Buffer size must be a multiple of 32-bits');
2482     }
2483
2484     for (var i = 0; i < len; i += 4) {
2485       swap(this, i, i + 3);
2486       swap(this, i + 1, i + 2);
2487     }
2488
2489     return this;
2490   };
2491
2492   Buffer.prototype.swap64 = function swap64() {
2493     var len = this.length;
2494
2495     if (len % 8 !== 0) {
2496       throw new RangeError('Buffer size must be a multiple of 64-bits');
2497     }
2498
2499     for (var i = 0; i < len; i += 8) {
2500       swap(this, i, i + 7);
2501       swap(this, i + 1, i + 6);
2502       swap(this, i + 2, i + 5);
2503       swap(this, i + 3, i + 4);
2504     }
2505
2506     return this;
2507   };
2508
2509   Buffer.prototype.toString = function toString() {
2510     var length = this.length | 0;
2511     if (length === 0) return '';
2512     if (arguments.length === 0) return utf8Slice(this, 0, length);
2513     return slowToString.apply(this, arguments);
2514   };
2515
2516   Buffer.prototype.equals = function equals(b) {
2517     if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer');
2518     if (this === b) return true;
2519     return Buffer.compare(this, b) === 0;
2520   };
2521
2522   Buffer.prototype.inspect = function inspect() {
2523     var str = '';
2524     var max = INSPECT_MAX_BYTES;
2525
2526     if (this.length > 0) {
2527       str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
2528       if (this.length > max) str += ' ... ';
2529     }
2530
2531     return '<Buffer ' + str + '>';
2532   };
2533
2534   Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
2535     if (!internalIsBuffer(target)) {
2536       throw new TypeError('Argument must be a Buffer');
2537     }
2538
2539     if (start === undefined) {
2540       start = 0;
2541     }
2542
2543     if (end === undefined) {
2544       end = target ? target.length : 0;
2545     }
2546
2547     if (thisStart === undefined) {
2548       thisStart = 0;
2549     }
2550
2551     if (thisEnd === undefined) {
2552       thisEnd = this.length;
2553     }
2554
2555     if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
2556       throw new RangeError('out of range index');
2557     }
2558
2559     if (thisStart >= thisEnd && start >= end) {
2560       return 0;
2561     }
2562
2563     if (thisStart >= thisEnd) {
2564       return -1;
2565     }
2566
2567     if (start >= end) {
2568       return 1;
2569     }
2570
2571     start >>>= 0;
2572     end >>>= 0;
2573     thisStart >>>= 0;
2574     thisEnd >>>= 0;
2575     if (this === target) return 0;
2576     var x = thisEnd - thisStart;
2577     var y = end - start;
2578     var len = Math.min(x, y);
2579     var thisCopy = this.slice(thisStart, thisEnd);
2580     var targetCopy = target.slice(start, end);
2581
2582     for (var i = 0; i < len; ++i) {
2583       if (thisCopy[i] !== targetCopy[i]) {
2584         x = thisCopy[i];
2585         y = targetCopy[i];
2586         break;
2587       }
2588     }
2589
2590     if (x < y) return -1;
2591     if (y < x) return 1;
2592     return 0;
2593   }; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
2594   // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
2595   //
2596   // Arguments:
2597   // - buffer - a Buffer to search
2598   // - val - a string, Buffer, or number
2599   // - byteOffset - an index into `buffer`; will be clamped to an int32
2600   // - encoding - an optional encoding, relevant is val is a string
2601   // - dir - true for indexOf, false for lastIndexOf
2602
2603
2604   function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
2605     // Empty buffer means no match
2606     if (buffer.length === 0) return -1; // Normalize byteOffset
2607
2608     if (typeof byteOffset === 'string') {
2609       encoding = byteOffset;
2610       byteOffset = 0;
2611     } else if (byteOffset > 0x7fffffff) {
2612       byteOffset = 0x7fffffff;
2613     } else if (byteOffset < -0x80000000) {
2614       byteOffset = -0x80000000;
2615     }
2616
2617     byteOffset = +byteOffset; // Coerce to Number.
2618
2619     if (isNaN(byteOffset)) {
2620       // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
2621       byteOffset = dir ? 0 : buffer.length - 1;
2622     } // Normalize byteOffset: negative offsets start from the end of the buffer
2623
2624
2625     if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
2626
2627     if (byteOffset >= buffer.length) {
2628       if (dir) return -1;else byteOffset = buffer.length - 1;
2629     } else if (byteOffset < 0) {
2630       if (dir) byteOffset = 0;else return -1;
2631     } // Normalize val
2632
2633
2634     if (typeof val === 'string') {
2635       val = Buffer.from(val, encoding);
2636     } // Finally, search either indexOf (if dir is true) or lastIndexOf
2637
2638
2639     if (internalIsBuffer(val)) {
2640       // Special case: looking for empty string/buffer always fails
2641       if (val.length === 0) {
2642         return -1;
2643       }
2644
2645       return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
2646     } else if (typeof val === 'number') {
2647       val = val & 0xFF; // Search for a byte value [0-255]
2648
2649       if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
2650         if (dir) {
2651           return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
2652         } else {
2653           return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
2654         }
2655       }
2656
2657       return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
2658     }
2659
2660     throw new TypeError('val must be string, number or Buffer');
2661   }
2662
2663   function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
2664     var indexSize = 1;
2665     var arrLength = arr.length;
2666     var valLength = val.length;
2667
2668     if (encoding !== undefined) {
2669       encoding = String(encoding).toLowerCase();
2670
2671       if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
2672         if (arr.length < 2 || val.length < 2) {
2673           return -1;
2674         }
2675
2676         indexSize = 2;
2677         arrLength /= 2;
2678         valLength /= 2;
2679         byteOffset /= 2;
2680       }
2681     }
2682
2683     function read(buf, i) {
2684       if (indexSize === 1) {
2685         return buf[i];
2686       } else {
2687         return buf.readUInt16BE(i * indexSize);
2688       }
2689     }
2690
2691     var i;
2692
2693     if (dir) {
2694       var foundIndex = -1;
2695
2696       for (i = byteOffset; i < arrLength; i++) {
2697         if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
2698           if (foundIndex === -1) foundIndex = i;
2699           if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
2700         } else {
2701           if (foundIndex !== -1) i -= i - foundIndex;
2702           foundIndex = -1;
2703         }
2704       }
2705     } else {
2706       if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
2707
2708       for (i = byteOffset; i >= 0; i--) {
2709         var found = true;
2710
2711         for (var j = 0; j < valLength; j++) {
2712           if (read(arr, i + j) !== read(val, j)) {
2713             found = false;
2714             break;
2715           }
2716         }
2717
2718         if (found) return i;
2719       }
2720     }
2721
2722     return -1;
2723   }
2724
2725   Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
2726     return this.indexOf(val, byteOffset, encoding) !== -1;
2727   };
2728
2729   Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
2730     return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
2731   };
2732
2733   Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
2734     return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
2735   };
2736
2737   function hexWrite(buf, string, offset, length) {
2738     offset = Number(offset) || 0;
2739     var remaining = buf.length - offset;
2740
2741     if (!length) {
2742       length = remaining;
2743     } else {
2744       length = Number(length);
2745
2746       if (length > remaining) {
2747         length = remaining;
2748       }
2749     } // must be an even number of digits
2750
2751
2752     var strLen = string.length;
2753     if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
2754
2755     if (length > strLen / 2) {
2756       length = strLen / 2;
2757     }
2758
2759     for (var i = 0; i < length; ++i) {
2760       var parsed = parseInt(string.substr(i * 2, 2), 16);
2761       if (isNaN(parsed)) return i;
2762       buf[offset + i] = parsed;
2763     }
2764
2765     return i;
2766   }
2767
2768   function utf8Write(buf, string, offset, length) {
2769     return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
2770   }
2771
2772   function asciiWrite(buf, string, offset, length) {
2773     return blitBuffer(asciiToBytes(string), buf, offset, length);
2774   }
2775
2776   function latin1Write(buf, string, offset, length) {
2777     return asciiWrite(buf, string, offset, length);
2778   }
2779
2780   function base64Write(buf, string, offset, length) {
2781     return blitBuffer(base64ToBytes(string), buf, offset, length);
2782   }
2783
2784   function ucs2Write(buf, string, offset, length) {
2785     return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
2786   }
2787
2788   Buffer.prototype.write = function write(string, offset, length, encoding) {
2789     // Buffer#write(string)
2790     if (offset === undefined) {
2791       encoding = 'utf8';
2792       length = this.length;
2793       offset = 0; // Buffer#write(string, encoding)
2794     } else if (length === undefined && typeof offset === 'string') {
2795       encoding = offset;
2796       length = this.length;
2797       offset = 0; // Buffer#write(string, offset[, length][, encoding])
2798     } else if (isFinite(offset)) {
2799       offset = offset | 0;
2800
2801       if (isFinite(length)) {
2802         length = length | 0;
2803         if (encoding === undefined) encoding = 'utf8';
2804       } else {
2805         encoding = length;
2806         length = undefined;
2807       } // legacy write(string, encoding, offset, length) - remove in v0.13
2808
2809     } else {
2810       throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
2811     }
2812
2813     var remaining = this.length - offset;
2814     if (length === undefined || length > remaining) length = remaining;
2815
2816     if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
2817       throw new RangeError('Attempt to write outside buffer bounds');
2818     }
2819
2820     if (!encoding) encoding = 'utf8';
2821     var loweredCase = false;
2822
2823     for (;;) {
2824       switch (encoding) {
2825         case 'hex':
2826           return hexWrite(this, string, offset, length);
2827
2828         case 'utf8':
2829         case 'utf-8':
2830           return utf8Write(this, string, offset, length);
2831
2832         case 'ascii':
2833           return asciiWrite(this, string, offset, length);
2834
2835         case 'latin1':
2836         case 'binary':
2837           return latin1Write(this, string, offset, length);
2838
2839         case 'base64':
2840           // Warning: maxLength not taken into account in base64Write
2841           return base64Write(this, string, offset, length);
2842
2843         case 'ucs2':
2844         case 'ucs-2':
2845         case 'utf16le':
2846         case 'utf-16le':
2847           return ucs2Write(this, string, offset, length);
2848
2849         default:
2850           if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
2851           encoding = ('' + encoding).toLowerCase();
2852           loweredCase = true;
2853       }
2854     }
2855   };
2856
2857   Buffer.prototype.toJSON = function toJSON() {
2858     return {
2859       type: 'Buffer',
2860       data: Array.prototype.slice.call(this._arr || this, 0)
2861     };
2862   };
2863
2864   function base64Slice(buf, start, end) {
2865     if (start === 0 && end === buf.length) {
2866       return fromByteArray(buf);
2867     } else {
2868       return fromByteArray(buf.slice(start, end));
2869     }
2870   }
2871
2872   function utf8Slice(buf, start, end) {
2873     end = Math.min(buf.length, end);
2874     var res = [];
2875     var i = start;
2876
2877     while (i < end) {
2878       var firstByte = buf[i];
2879       var codePoint = null;
2880       var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
2881
2882       if (i + bytesPerSequence <= end) {
2883         var secondByte, thirdByte, fourthByte, tempCodePoint;
2884
2885         switch (bytesPerSequence) {
2886           case 1:
2887             if (firstByte < 0x80) {
2888               codePoint = firstByte;
2889             }
2890
2891             break;
2892
2893           case 2:
2894             secondByte = buf[i + 1];
2895
2896             if ((secondByte & 0xC0) === 0x80) {
2897               tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
2898
2899               if (tempCodePoint > 0x7F) {
2900                 codePoint = tempCodePoint;
2901               }
2902             }
2903
2904             break;
2905
2906           case 3:
2907             secondByte = buf[i + 1];
2908             thirdByte = buf[i + 2];
2909
2910             if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
2911               tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
2912
2913               if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
2914                 codePoint = tempCodePoint;
2915               }
2916             }
2917
2918             break;
2919
2920           case 4:
2921             secondByte = buf[i + 1];
2922             thirdByte = buf[i + 2];
2923             fourthByte = buf[i + 3];
2924
2925             if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
2926               tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
2927
2928               if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
2929                 codePoint = tempCodePoint;
2930               }
2931             }
2932
2933         }
2934       }
2935
2936       if (codePoint === null) {
2937         // we did not generate a valid codePoint so insert a
2938         // replacement char (U+FFFD) and advance only 1 byte
2939         codePoint = 0xFFFD;
2940         bytesPerSequence = 1;
2941       } else if (codePoint > 0xFFFF) {
2942         // encode to utf16 (surrogate pair dance)
2943         codePoint -= 0x10000;
2944         res.push(codePoint >>> 10 & 0x3FF | 0xD800);
2945         codePoint = 0xDC00 | codePoint & 0x3FF;
2946       }
2947
2948       res.push(codePoint);
2949       i += bytesPerSequence;
2950     }
2951
2952     return decodeCodePointsArray(res);
2953   } // Based on http://stackoverflow.com/a/22747272/680742, the browser with
2954   // the lowest limit is Chrome, with 0x10000 args.
2955   // We go 1 magnitude less, for safety
2956
2957
2958   var MAX_ARGUMENTS_LENGTH = 0x1000;
2959
2960   function decodeCodePointsArray(codePoints) {
2961     var len = codePoints.length;
2962
2963     if (len <= MAX_ARGUMENTS_LENGTH) {
2964       return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
2965     } // Decode in chunks to avoid "call stack size exceeded".
2966
2967
2968     var res = '';
2969     var i = 0;
2970
2971     while (i < len) {
2972       res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
2973     }
2974
2975     return res;
2976   }
2977
2978   function asciiSlice(buf, start, end) {
2979     var ret = '';
2980     end = Math.min(buf.length, end);
2981
2982     for (var i = start; i < end; ++i) {
2983       ret += String.fromCharCode(buf[i] & 0x7F);
2984     }
2985
2986     return ret;
2987   }
2988
2989   function latin1Slice(buf, start, end) {
2990     var ret = '';
2991     end = Math.min(buf.length, end);
2992
2993     for (var i = start; i < end; ++i) {
2994       ret += String.fromCharCode(buf[i]);
2995     }
2996
2997     return ret;
2998   }
2999
3000   function hexSlice(buf, start, end) {
3001     var len = buf.length;
3002     if (!start || start < 0) start = 0;
3003     if (!end || end < 0 || end > len) end = len;
3004     var out = '';
3005
3006     for (var i = start; i < end; ++i) {
3007       out += toHex(buf[i]);
3008     }
3009
3010     return out;
3011   }
3012
3013   function utf16leSlice(buf, start, end) {
3014     var bytes = buf.slice(start, end);
3015     var res = '';
3016
3017     for (var i = 0; i < bytes.length; i += 2) {
3018       res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
3019     }
3020
3021     return res;
3022   }
3023
3024   Buffer.prototype.slice = function slice(start, end) {
3025     var len = this.length;
3026     start = ~~start;
3027     end = end === undefined ? len : ~~end;
3028
3029     if (start < 0) {
3030       start += len;
3031       if (start < 0) start = 0;
3032     } else if (start > len) {
3033       start = len;
3034     }
3035
3036     if (end < 0) {
3037       end += len;
3038       if (end < 0) end = 0;
3039     } else if (end > len) {
3040       end = len;
3041     }
3042
3043     if (end < start) end = start;
3044     var newBuf;
3045
3046     if (Buffer.TYPED_ARRAY_SUPPORT) {
3047       newBuf = this.subarray(start, end);
3048       newBuf.__proto__ = Buffer.prototype;
3049     } else {
3050       var sliceLen = end - start;
3051       newBuf = new Buffer(sliceLen, undefined);
3052
3053       for (var i = 0; i < sliceLen; ++i) {
3054         newBuf[i] = this[i + start];
3055       }
3056     }
3057
3058     return newBuf;
3059   };
3060   /*
3061    * Need to make sure that buffer isn't trying to write out of bounds.
3062    */
3063
3064
3065   function checkOffset(offset, ext, length) {
3066     if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
3067     if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
3068   }
3069
3070   Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
3071     offset = offset | 0;
3072     byteLength = byteLength | 0;
3073     if (!noAssert) checkOffset(offset, byteLength, this.length);
3074     var val = this[offset];
3075     var mul = 1;
3076     var i = 0;
3077
3078     while (++i < byteLength && (mul *= 0x100)) {
3079       val += this[offset + i] * mul;
3080     }
3081
3082     return val;
3083   };
3084
3085   Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
3086     offset = offset | 0;
3087     byteLength = byteLength | 0;
3088
3089     if (!noAssert) {
3090       checkOffset(offset, byteLength, this.length);
3091     }
3092
3093     var val = this[offset + --byteLength];
3094     var mul = 1;
3095
3096     while (byteLength > 0 && (mul *= 0x100)) {
3097       val += this[offset + --byteLength] * mul;
3098     }
3099
3100     return val;
3101   };
3102
3103   Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
3104     if (!noAssert) checkOffset(offset, 1, this.length);
3105     return this[offset];
3106   };
3107
3108   Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
3109     if (!noAssert) checkOffset(offset, 2, this.length);
3110     return this[offset] | this[offset + 1] << 8;
3111   };
3112
3113   Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
3114     if (!noAssert) checkOffset(offset, 2, this.length);
3115     return this[offset] << 8 | this[offset + 1];
3116   };
3117
3118   Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
3119     if (!noAssert) checkOffset(offset, 4, this.length);
3120     return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
3121   };
3122
3123   Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
3124     if (!noAssert) checkOffset(offset, 4, this.length);
3125     return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
3126   };
3127
3128   Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
3129     offset = offset | 0;
3130     byteLength = byteLength | 0;
3131     if (!noAssert) checkOffset(offset, byteLength, this.length);
3132     var val = this[offset];
3133     var mul = 1;
3134     var i = 0;
3135
3136     while (++i < byteLength && (mul *= 0x100)) {
3137       val += this[offset + i] * mul;
3138     }
3139
3140     mul *= 0x80;
3141     if (val >= mul) val -= Math.pow(2, 8 * byteLength);
3142     return val;
3143   };
3144
3145   Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
3146     offset = offset | 0;
3147     byteLength = byteLength | 0;
3148     if (!noAssert) checkOffset(offset, byteLength, this.length);
3149     var i = byteLength;
3150     var mul = 1;
3151     var val = this[offset + --i];
3152
3153     while (i > 0 && (mul *= 0x100)) {
3154       val += this[offset + --i] * mul;
3155     }
3156
3157     mul *= 0x80;
3158     if (val >= mul) val -= Math.pow(2, 8 * byteLength);
3159     return val;
3160   };
3161
3162   Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
3163     if (!noAssert) checkOffset(offset, 1, this.length);
3164     if (!(this[offset] & 0x80)) return this[offset];
3165     return (0xff - this[offset] + 1) * -1;
3166   };
3167
3168   Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
3169     if (!noAssert) checkOffset(offset, 2, this.length);
3170     var val = this[offset] | this[offset + 1] << 8;
3171     return val & 0x8000 ? val | 0xFFFF0000 : val;
3172   };
3173
3174   Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
3175     if (!noAssert) checkOffset(offset, 2, this.length);
3176     var val = this[offset + 1] | this[offset] << 8;
3177     return val & 0x8000 ? val | 0xFFFF0000 : val;
3178   };
3179
3180   Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
3181     if (!noAssert) checkOffset(offset, 4, this.length);
3182     return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
3183   };
3184
3185   Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
3186     if (!noAssert) checkOffset(offset, 4, this.length);
3187     return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
3188   };
3189
3190   Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
3191     if (!noAssert) checkOffset(offset, 4, this.length);
3192     return read(this, offset, true, 23, 4);
3193   };
3194
3195   Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
3196     if (!noAssert) checkOffset(offset, 4, this.length);
3197     return read(this, offset, false, 23, 4);
3198   };
3199
3200   Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
3201     if (!noAssert) checkOffset(offset, 8, this.length);
3202     return read(this, offset, true, 52, 8);
3203   };
3204
3205   Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
3206     if (!noAssert) checkOffset(offset, 8, this.length);
3207     return read(this, offset, false, 52, 8);
3208   };
3209
3210   function checkInt(buf, value, offset, ext, max, min) {
3211     if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
3212     if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
3213     if (offset + ext > buf.length) throw new RangeError('Index out of range');
3214   }
3215
3216   Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
3217     value = +value;
3218     offset = offset | 0;
3219     byteLength = byteLength | 0;
3220
3221     if (!noAssert) {
3222       var maxBytes = Math.pow(2, 8 * byteLength) - 1;
3223       checkInt(this, value, offset, byteLength, maxBytes, 0);
3224     }
3225
3226     var mul = 1;
3227     var i = 0;
3228     this[offset] = value & 0xFF;
3229
3230     while (++i < byteLength && (mul *= 0x100)) {
3231       this[offset + i] = value / mul & 0xFF;
3232     }
3233
3234     return offset + byteLength;
3235   };
3236
3237   Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
3238     value = +value;
3239     offset = offset | 0;
3240     byteLength = byteLength | 0;
3241
3242     if (!noAssert) {
3243       var maxBytes = Math.pow(2, 8 * byteLength) - 1;
3244       checkInt(this, value, offset, byteLength, maxBytes, 0);
3245     }
3246
3247     var i = byteLength - 1;
3248     var mul = 1;
3249     this[offset + i] = value & 0xFF;
3250
3251     while (--i >= 0 && (mul *= 0x100)) {
3252       this[offset + i] = value / mul & 0xFF;
3253     }
3254
3255     return offset + byteLength;
3256   };
3257
3258   Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
3259     value = +value;
3260     offset = offset | 0;
3261     if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
3262     if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
3263     this[offset] = value & 0xff;
3264     return offset + 1;
3265   };
3266
3267   function objectWriteUInt16(buf, value, offset, littleEndian) {
3268     if (value < 0) value = 0xffff + value + 1;
3269
3270     for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
3271       buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
3272     }
3273   }
3274
3275   Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
3276     value = +value;
3277     offset = offset | 0;
3278     if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
3279
3280     if (Buffer.TYPED_ARRAY_SUPPORT) {
3281       this[offset] = value & 0xff;
3282       this[offset + 1] = value >>> 8;
3283     } else {
3284       objectWriteUInt16(this, value, offset, true);
3285     }
3286
3287     return offset + 2;
3288   };
3289
3290   Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
3291     value = +value;
3292     offset = offset | 0;
3293     if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
3294
3295     if (Buffer.TYPED_ARRAY_SUPPORT) {
3296       this[offset] = value >>> 8;
3297       this[offset + 1] = value & 0xff;
3298     } else {
3299       objectWriteUInt16(this, value, offset, false);
3300     }
3301
3302     return offset + 2;
3303   };
3304
3305   function objectWriteUInt32(buf, value, offset, littleEndian) {
3306     if (value < 0) value = 0xffffffff + value + 1;
3307
3308     for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
3309       buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
3310     }
3311   }
3312
3313   Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
3314     value = +value;
3315     offset = offset | 0;
3316     if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
3317
3318     if (Buffer.TYPED_ARRAY_SUPPORT) {
3319       this[offset + 3] = value >>> 24;
3320       this[offset + 2] = value >>> 16;
3321       this[offset + 1] = value >>> 8;
3322       this[offset] = value & 0xff;
3323     } else {
3324       objectWriteUInt32(this, value, offset, true);
3325     }
3326
3327     return offset + 4;
3328   };
3329
3330   Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
3331     value = +value;
3332     offset = offset | 0;
3333     if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
3334
3335     if (Buffer.TYPED_ARRAY_SUPPORT) {
3336       this[offset] = value >>> 24;
3337       this[offset + 1] = value >>> 16;
3338       this[offset + 2] = value >>> 8;
3339       this[offset + 3] = value & 0xff;
3340     } else {
3341       objectWriteUInt32(this, value, offset, false);
3342     }
3343
3344     return offset + 4;
3345   };
3346
3347   Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
3348     value = +value;
3349     offset = offset | 0;
3350
3351     if (!noAssert) {
3352       var limit = Math.pow(2, 8 * byteLength - 1);
3353       checkInt(this, value, offset, byteLength, limit - 1, -limit);
3354     }
3355
3356     var i = 0;
3357     var mul = 1;
3358     var sub = 0;
3359     this[offset] = value & 0xFF;
3360
3361     while (++i < byteLength && (mul *= 0x100)) {
3362       if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
3363         sub = 1;
3364       }
3365
3366       this[offset + i] = (value / mul >> 0) - sub & 0xFF;
3367     }
3368
3369     return offset + byteLength;
3370   };
3371
3372   Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
3373     value = +value;
3374     offset = offset | 0;
3375
3376     if (!noAssert) {
3377       var limit = Math.pow(2, 8 * byteLength - 1);
3378       checkInt(this, value, offset, byteLength, limit - 1, -limit);
3379     }
3380
3381     var i = byteLength - 1;
3382     var mul = 1;
3383     var sub = 0;
3384     this[offset + i] = value & 0xFF;
3385
3386     while (--i >= 0 && (mul *= 0x100)) {
3387       if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
3388         sub = 1;
3389       }
3390
3391       this[offset + i] = (value / mul >> 0) - sub & 0xFF;
3392     }
3393
3394     return offset + byteLength;
3395   };
3396
3397   Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
3398     value = +value;
3399     offset = offset | 0;
3400     if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
3401     if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
3402     if (value < 0) value = 0xff + value + 1;
3403     this[offset] = value & 0xff;
3404     return offset + 1;
3405   };
3406
3407   Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
3408     value = +value;
3409     offset = offset | 0;
3410     if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
3411
3412     if (Buffer.TYPED_ARRAY_SUPPORT) {
3413       this[offset] = value & 0xff;
3414       this[offset + 1] = value >>> 8;
3415     } else {
3416       objectWriteUInt16(this, value, offset, true);
3417     }
3418
3419     return offset + 2;
3420   };
3421
3422   Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
3423     value = +value;
3424     offset = offset | 0;
3425     if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
3426
3427     if (Buffer.TYPED_ARRAY_SUPPORT) {
3428       this[offset] = value >>> 8;
3429       this[offset + 1] = value & 0xff;
3430     } else {
3431       objectWriteUInt16(this, value, offset, false);
3432     }
3433
3434     return offset + 2;
3435   };
3436
3437   Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
3438     value = +value;
3439     offset = offset | 0;
3440     if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
3441
3442     if (Buffer.TYPED_ARRAY_SUPPORT) {
3443       this[offset] = value & 0xff;
3444       this[offset + 1] = value >>> 8;
3445       this[offset + 2] = value >>> 16;
3446       this[offset + 3] = value >>> 24;
3447     } else {
3448       objectWriteUInt32(this, value, offset, true);
3449     }
3450
3451     return offset + 4;
3452   };
3453
3454   Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
3455     value = +value;
3456     offset = offset | 0;
3457     if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
3458     if (value < 0) value = 0xffffffff + value + 1;
3459
3460     if (Buffer.TYPED_ARRAY_SUPPORT) {
3461       this[offset] = value >>> 24;
3462       this[offset + 1] = value >>> 16;
3463       this[offset + 2] = value >>> 8;
3464       this[offset + 3] = value & 0xff;
3465     } else {
3466       objectWriteUInt32(this, value, offset, false);
3467     }
3468
3469     return offset + 4;
3470   };
3471
3472   function checkIEEE754(buf, value, offset, ext, max, min) {
3473     if (offset + ext > buf.length) throw new RangeError('Index out of range');
3474     if (offset < 0) throw new RangeError('Index out of range');
3475   }
3476
3477   function writeFloat(buf, value, offset, littleEndian, noAssert) {
3478     if (!noAssert) {
3479       checkIEEE754(buf, value, offset, 4);
3480     }
3481
3482     write(buf, value, offset, littleEndian, 23, 4);
3483     return offset + 4;
3484   }
3485
3486   Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
3487     return writeFloat(this, value, offset, true, noAssert);
3488   };
3489
3490   Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
3491     return writeFloat(this, value, offset, false, noAssert);
3492   };
3493
3494   function writeDouble(buf, value, offset, littleEndian, noAssert) {
3495     if (!noAssert) {
3496       checkIEEE754(buf, value, offset, 8);
3497     }
3498
3499     write(buf, value, offset, littleEndian, 52, 8);
3500     return offset + 8;
3501   }
3502
3503   Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
3504     return writeDouble(this, value, offset, true, noAssert);
3505   };
3506
3507   Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
3508     return writeDouble(this, value, offset, false, noAssert);
3509   }; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
3510
3511
3512   Buffer.prototype.copy = function copy(target, targetStart, start, end) {
3513     if (!start) start = 0;
3514     if (!end && end !== 0) end = this.length;
3515     if (targetStart >= target.length) targetStart = target.length;
3516     if (!targetStart) targetStart = 0;
3517     if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done
3518
3519     if (end === start) return 0;
3520     if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions
3521
3522     if (targetStart < 0) {
3523       throw new RangeError('targetStart out of bounds');
3524     }
3525
3526     if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
3527     if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob?
3528
3529     if (end > this.length) end = this.length;
3530
3531     if (target.length - targetStart < end - start) {
3532       end = target.length - targetStart + start;
3533     }
3534
3535     var len = end - start;
3536     var i;
3537
3538     if (this === target && start < targetStart && targetStart < end) {
3539       // descending copy from end
3540       for (i = len - 1; i >= 0; --i) {
3541         target[i + targetStart] = this[i + start];
3542       }
3543     } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
3544       // ascending copy from start
3545       for (i = 0; i < len; ++i) {
3546         target[i + targetStart] = this[i + start];
3547       }
3548     } else {
3549       Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
3550     }
3551
3552     return len;
3553   }; // Usage:
3554   //    buffer.fill(number[, offset[, end]])
3555   //    buffer.fill(buffer[, offset[, end]])
3556   //    buffer.fill(string[, offset[, end]][, encoding])
3557
3558
3559   Buffer.prototype.fill = function fill(val, start, end, encoding) {
3560     // Handle string cases:
3561     if (typeof val === 'string') {
3562       if (typeof start === 'string') {
3563         encoding = start;
3564         start = 0;
3565         end = this.length;
3566       } else if (typeof end === 'string') {
3567         encoding = end;
3568         end = this.length;
3569       }
3570
3571       if (val.length === 1) {
3572         var code = val.charCodeAt(0);
3573
3574         if (code < 256) {
3575           val = code;
3576         }
3577       }
3578
3579       if (encoding !== undefined && typeof encoding !== 'string') {
3580         throw new TypeError('encoding must be a string');
3581       }
3582
3583       if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
3584         throw new TypeError('Unknown encoding: ' + encoding);
3585       }
3586     } else if (typeof val === 'number') {
3587       val = val & 255;
3588     } // Invalid ranges are not set to a default, so can range check early.
3589
3590
3591     if (start < 0 || this.length < start || this.length < end) {
3592       throw new RangeError('Out of range index');
3593     }
3594
3595     if (end <= start) {
3596       return this;
3597     }
3598
3599     start = start >>> 0;
3600     end = end === undefined ? this.length : end >>> 0;
3601     if (!val) val = 0;
3602     var i;
3603
3604     if (typeof val === 'number') {
3605       for (i = start; i < end; ++i) {
3606         this[i] = val;
3607       }
3608     } else {
3609       var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());
3610       var len = bytes.length;
3611
3612       for (i = 0; i < end - start; ++i) {
3613         this[i + start] = bytes[i % len];
3614       }
3615     }
3616
3617     return this;
3618   }; // HELPER FUNCTIONS
3619   // ================
3620
3621
3622   var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
3623
3624   function base64clean(str) {
3625     // Node strips out invalid characters like \n and \t from the string, base64-js does not
3626     str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''
3627
3628     if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
3629
3630     while (str.length % 4 !== 0) {
3631       str = str + '=';
3632     }
3633
3634     return str;
3635   }
3636
3637   function stringtrim(str) {
3638     if (str.trim) return str.trim();
3639     return str.replace(/^\s+|\s+$/g, '');
3640   }
3641
3642   function toHex(n) {
3643     if (n < 16) return '0' + n.toString(16);
3644     return n.toString(16);
3645   }
3646
3647   function utf8ToBytes(string, units) {
3648     units = units || Infinity;
3649     var codePoint;
3650     var length = string.length;
3651     var leadSurrogate = null;
3652     var bytes = [];
3653
3654     for (var i = 0; i < length; ++i) {
3655       codePoint = string.charCodeAt(i); // is surrogate component
3656
3657       if (codePoint > 0xD7FF && codePoint < 0xE000) {
3658         // last char was a lead
3659         if (!leadSurrogate) {
3660           // no lead yet
3661           if (codePoint > 0xDBFF) {
3662             // unexpected trail
3663             if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
3664             continue;
3665           } else if (i + 1 === length) {
3666             // unpaired lead
3667             if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
3668             continue;
3669           } // valid lead
3670
3671
3672           leadSurrogate = codePoint;
3673           continue;
3674         } // 2 leads in a row
3675
3676
3677         if (codePoint < 0xDC00) {
3678           if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
3679           leadSurrogate = codePoint;
3680           continue;
3681         } // valid surrogate pair
3682
3683
3684         codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
3685       } else if (leadSurrogate) {
3686         // valid bmp char, but last char was a lead
3687         if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
3688       }
3689
3690       leadSurrogate = null; // encode utf8
3691
3692       if (codePoint < 0x80) {
3693         if ((units -= 1) < 0) break;
3694         bytes.push(codePoint);
3695       } else if (codePoint < 0x800) {
3696         if ((units -= 2) < 0) break;
3697         bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
3698       } else if (codePoint < 0x10000) {
3699         if ((units -= 3) < 0) break;
3700         bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
3701       } else if (codePoint < 0x110000) {
3702         if ((units -= 4) < 0) break;
3703         bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
3704       } else {
3705         throw new Error('Invalid code point');
3706       }
3707     }
3708
3709     return bytes;
3710   }
3711
3712   function asciiToBytes(str) {
3713     var byteArray = [];
3714
3715     for (var i = 0; i < str.length; ++i) {
3716       // Node's code seems to be doing this and not & 0x7F..
3717       byteArray.push(str.charCodeAt(i) & 0xFF);
3718     }
3719
3720     return byteArray;
3721   }
3722
3723   function utf16leToBytes(str, units) {
3724     var c, hi, lo;
3725     var byteArray = [];
3726
3727     for (var i = 0; i < str.length; ++i) {
3728       if ((units -= 2) < 0) break;
3729       c = str.charCodeAt(i);
3730       hi = c >> 8;
3731       lo = c % 256;
3732       byteArray.push(lo);
3733       byteArray.push(hi);
3734     }
3735
3736     return byteArray;
3737   }
3738
3739   function base64ToBytes(str) {
3740     return toByteArray(base64clean(str));
3741   }
3742
3743   function blitBuffer(src, dst, offset, length) {
3744     for (var i = 0; i < length; ++i) {
3745       if (i + offset >= dst.length || i >= src.length) break;
3746       dst[i + offset] = src[i];
3747     }
3748
3749     return i;
3750   }
3751
3752   function isnan(val) {
3753     return val !== val; // eslint-disable-line no-self-compare
3754   } // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
3755   // The _isBuffer check is for Safari 5-7 support, because it's missing
3756   // Object.prototype.constructor. Remove this eventually
3757
3758
3759   function isBuffer(obj) {
3760     return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
3761   }
3762
3763   function isFastBuffer(obj) {
3764     return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
3765   } // For Node v0.10 support. Remove this eventually.
3766
3767
3768   function isSlowBuffer(obj) {
3769     return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0));
3770   }
3771
3772   var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3773
3774   function unwrapExports (x) {
3775         return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3776   }
3777
3778   function createCommonjsModule(fn, module) {
3779         return module = { exports: {} }, fn(module, module.exports), module.exports;
3780   }
3781
3782   function getCjsExportFromNamespace (n) {
3783         return n && n['default'] || n;
3784   }
3785
3786   var fs = getCjsExportFromNamespace(_shim_fs$1);
3787
3788   /**
3789    * @class
3790    */
3791
3792
3793   class LineByLine {
3794     constructor(file, options) {
3795       options = options || {};
3796       if (!options.readChunk) options.readChunk = 1024;
3797
3798       if (!options.newLineCharacter) {
3799         options.newLineCharacter = 0x0a; //linux line ending
3800       } else {
3801         options.newLineCharacter = options.newLineCharacter.charCodeAt(0);
3802       }
3803
3804       if (typeof file === 'number') {
3805         this.fd = file;
3806       } else {
3807         this.fd = fs.openSync(file, 'r');
3808       }
3809
3810       this.options = options;
3811       this.newLineCharacter = options.newLineCharacter;
3812       this.reset();
3813     }
3814
3815     _searchInBuffer(buffer, hexNeedle) {
3816       let found = -1;
3817
3818       for (let i = 0; i <= buffer.length; i++) {
3819         let b_byte = buffer[i];
3820
3821         if (b_byte === hexNeedle) {
3822           found = i;
3823           break;
3824         }
3825       }
3826
3827       return found;
3828     }
3829
3830     reset() {
3831       this.eofReached = false;
3832       this.linesCache = [];
3833       this.fdPosition = 0;
3834     }
3835
3836     close() {
3837       fs.closeSync(this.fd);
3838       this.fd = null;
3839     }
3840
3841     _extractLines(buffer) {
3842       let line;
3843       const lines = [];
3844       let bufferPosition = 0;
3845       let lastNewLineBufferPosition = 0;
3846
3847       while (true) {
3848         let bufferPositionValue = buffer[bufferPosition++];
3849
3850         if (bufferPositionValue === this.newLineCharacter) {
3851           line = buffer.slice(lastNewLineBufferPosition, bufferPosition);
3852           lines.push(line);
3853           lastNewLineBufferPosition = bufferPosition;
3854         } else if (!bufferPositionValue) {
3855           break;
3856         }
3857       }
3858
3859       let leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition);
3860
3861       if (leftovers.length) {
3862         lines.push(leftovers);
3863       }
3864
3865       return lines;
3866     }
3867
3868     _readChunk(lineLeftovers) {
3869       let totalBytesRead = 0;
3870       let bytesRead;
3871       const buffers = [];
3872
3873       do {
3874         const readBuffer = new Buffer(this.options.readChunk);
3875         bytesRead = fs.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
3876         totalBytesRead = totalBytesRead + bytesRead;
3877         this.fdPosition = this.fdPosition + bytesRead;
3878         buffers.push(readBuffer);
3879       } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
3880
3881       let bufferData = Buffer.concat(buffers);
3882
3883       if (bytesRead < this.options.readChunk) {
3884         this.eofReached = true;
3885         bufferData = bufferData.slice(0, totalBytesRead);
3886       }
3887
3888       if (totalBytesRead) {
3889         this.linesCache = this._extractLines(bufferData);
3890
3891         if (lineLeftovers) {
3892           this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
3893         }
3894       }
3895
3896       return totalBytesRead;
3897     }
3898
3899     next() {
3900       if (!this.fd) return false;
3901       let line = false;
3902
3903       if (this.eofReached && this.linesCache.length === 0) {
3904         return line;
3905       }
3906
3907       let bytesRead;
3908
3909       if (!this.linesCache.length) {
3910         bytesRead = this._readChunk();
3911       }
3912
3913       if (this.linesCache.length) {
3914         line = this.linesCache.shift();
3915         const lastLineCharacter = line[line.length - 1];
3916
3917         if (lastLineCharacter !== 0x0a) {
3918           bytesRead = this._readChunk(line);
3919
3920           if (bytesRead) {
3921             line = this.linesCache.shift();
3922           }
3923         }
3924       }
3925
3926       if (this.eofReached && this.linesCache.length === 0) {
3927         this.close();
3928       }
3929
3930       if (line && line[line.length - 1] === this.newLineCharacter) {
3931         line = line.slice(0, line.length - 1);
3932       }
3933
3934       return line;
3935     }
3936
3937   }
3938
3939   var readlines = LineByLine;
3940
3941   /**
3942    * The inverse of `_.toPairs`; this method returns an object composed
3943    * from key-value `pairs`.
3944    *
3945    * @static
3946    * @memberOf _
3947    * @since 4.0.0
3948    * @category Array
3949    * @param {Array} pairs The key-value pairs.
3950    * @returns {Object} Returns the new object.
3951    * @example
3952    *
3953    * _.fromPairs([['a', 1], ['b', 2]]);
3954    * // => { 'a': 1, 'b': 2 }
3955    */
3956   function fromPairs(pairs) {
3957     var index = -1,
3958         length = pairs == null ? 0 : pairs.length,
3959         result = {};
3960
3961     while (++index < length) {
3962       var pair = pairs[index];
3963       result[pair[0]] = pair[1];
3964     }
3965
3966     return result;
3967   }
3968
3969   var fromPairs_1 = fromPairs;
3970
3971   class ConfigError extends Error {}
3972
3973   class DebugError extends Error {}
3974
3975   class UndefinedParserError extends Error {}
3976
3977   var errors = {
3978     ConfigError,
3979     DebugError,
3980     UndefinedParserError
3981   };
3982
3983   function _objectWithoutPropertiesLoose(source, excluded) {
3984     if (source == null) return {};
3985     var target = {};
3986     var sourceKeys = Object.keys(source);
3987     var key, i;
3988
3989     for (i = 0; i < sourceKeys.length; i++) {
3990       key = sourceKeys[i];
3991       if (excluded.indexOf(key) >= 0) continue;
3992       target[key] = source[key];
3993     }
3994
3995     return target;
3996   }
3997
3998   function _taggedTemplateLiteral(strings, raw) {
3999     if (!raw) {
4000       raw = strings.slice(0);
4001     }
4002
4003     return Object.freeze(Object.defineProperties(strings, {
4004       raw: {
4005         value: Object.freeze(raw)
4006       }
4007     }));
4008   }
4009
4010   // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
4011
4012   function defaultSetTimout() {
4013     throw new Error('setTimeout has not been defined');
4014   }
4015
4016   function defaultClearTimeout() {
4017     throw new Error('clearTimeout has not been defined');
4018   }
4019
4020   var cachedSetTimeout = defaultSetTimout;
4021   var cachedClearTimeout = defaultClearTimeout;
4022
4023   if (typeof global$1.setTimeout === 'function') {
4024     cachedSetTimeout = setTimeout;
4025   }
4026
4027   if (typeof global$1.clearTimeout === 'function') {
4028     cachedClearTimeout = clearTimeout;
4029   }
4030
4031   function runTimeout(fun) {
4032     if (cachedSetTimeout === setTimeout) {
4033       //normal enviroments in sane situations
4034       return setTimeout(fun, 0);
4035     } // if setTimeout wasn't available but was latter defined
4036
4037
4038     if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
4039       cachedSetTimeout = setTimeout;
4040       return setTimeout(fun, 0);
4041     }
4042
4043     try {
4044       // when when somebody has screwed with setTimeout but no I.E. maddness
4045       return cachedSetTimeout(fun, 0);
4046     } catch (e) {
4047       try {
4048         // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
4049         return cachedSetTimeout.call(null, fun, 0);
4050       } catch (e) {
4051         // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
4052         return cachedSetTimeout.call(this, fun, 0);
4053       }
4054     }
4055   }
4056
4057   function runClearTimeout(marker) {
4058     if (cachedClearTimeout === clearTimeout) {
4059       //normal enviroments in sane situations
4060       return clearTimeout(marker);
4061     } // if clearTimeout wasn't available but was latter defined
4062
4063
4064     if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
4065       cachedClearTimeout = clearTimeout;
4066       return clearTimeout(marker);
4067     }
4068
4069     try {
4070       // when when somebody has screwed with setTimeout but no I.E. maddness
4071       return cachedClearTimeout(marker);
4072     } catch (e) {
4073       try {
4074         // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
4075         return cachedClearTimeout.call(null, marker);
4076       } catch (e) {
4077         // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
4078         // Some versions of I.E. have different rules for clearTimeout vs setTimeout
4079         return cachedClearTimeout.call(this, marker);
4080       }
4081     }
4082   }
4083
4084   var queue = [];
4085   var draining = false;
4086   var currentQueue;
4087   var queueIndex = -1;
4088
4089   function cleanUpNextTick() {
4090     if (!draining || !currentQueue) {
4091       return;
4092     }
4093
4094     draining = false;
4095
4096     if (currentQueue.length) {
4097       queue = currentQueue.concat(queue);
4098     } else {
4099       queueIndex = -1;
4100     }
4101
4102     if (queue.length) {
4103       drainQueue();
4104     }
4105   }
4106
4107   function drainQueue() {
4108     if (draining) {
4109       return;
4110     }
4111
4112     var timeout = runTimeout(cleanUpNextTick);
4113     draining = true;
4114     var len = queue.length;
4115
4116     while (len) {
4117       currentQueue = queue;
4118       queue = [];
4119
4120       while (++queueIndex < len) {
4121         if (currentQueue) {
4122           currentQueue[queueIndex].run();
4123         }
4124       }
4125
4126       queueIndex = -1;
4127       len = queue.length;
4128     }
4129
4130     currentQueue = null;
4131     draining = false;
4132     runClearTimeout(timeout);
4133   }
4134
4135   function nextTick(fun) {
4136     var args = new Array(arguments.length - 1);
4137
4138     if (arguments.length > 1) {
4139       for (var i = 1; i < arguments.length; i++) {
4140         args[i - 1] = arguments[i];
4141       }
4142     }
4143
4144     queue.push(new Item(fun, args));
4145
4146     if (queue.length === 1 && !draining) {
4147       runTimeout(drainQueue);
4148     }
4149   } // v8 likes predictible objects
4150
4151   function Item(fun, array) {
4152     this.fun = fun;
4153     this.array = array;
4154   }
4155
4156   Item.prototype.run = function () {
4157     this.fun.apply(null, this.array);
4158   };
4159
4160   var title = 'browser';
4161   var platform = 'browser';
4162   var browser = true;
4163   var env = {};
4164   var argv = [];
4165   var version$1 = ''; // empty string to avoid regexp issues
4166
4167   var versions = {};
4168   var release = {};
4169   var config = {};
4170
4171   function noop() {}
4172
4173   var on = noop;
4174   var addListener = noop;
4175   var once = noop;
4176   var off = noop;
4177   var removeListener = noop;
4178   var removeAllListeners = noop;
4179   var emit = noop;
4180   function binding(name) {
4181     throw new Error('process.binding is not supported');
4182   }
4183   function cwd() {
4184     return '/';
4185   }
4186   function chdir(dir) {
4187     throw new Error('process.chdir is not supported');
4188   }
4189   function umask() {
4190     return 0;
4191   } // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
4192
4193   var performance = global$1.performance || {};
4194
4195   var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function () {
4196     return new Date().getTime();
4197   }; // generate timestamp or delta
4198   // see http://nodejs.org/api/process.html#process_process_hrtime
4199
4200
4201   function hrtime(previousTimestamp) {
4202     var clocktime = performanceNow.call(performance) * 1e-3;
4203     var seconds = Math.floor(clocktime);
4204     var nanoseconds = Math.floor(clocktime % 1 * 1e9);
4205
4206     if (previousTimestamp) {
4207       seconds = seconds - previousTimestamp[0];
4208       nanoseconds = nanoseconds - previousTimestamp[1];
4209
4210       if (nanoseconds < 0) {
4211         seconds--;
4212         nanoseconds += 1e9;
4213       }
4214     }
4215
4216     return [seconds, nanoseconds];
4217   }
4218   var startTime = new Date();
4219   function uptime() {
4220     var currentTime = new Date();
4221     var dif = currentTime - startTime;
4222     return dif / 1000;
4223   }
4224   var process = {
4225     nextTick: nextTick,
4226     title: title,
4227     browser: browser,
4228     env: env,
4229     argv: argv,
4230     version: version$1,
4231     versions: versions,
4232     on: on,
4233     addListener: addListener,
4234     once: once,
4235     off: off,
4236     removeListener: removeListener,
4237     removeAllListeners: removeAllListeners,
4238     emit: emit,
4239     binding: binding,
4240     cwd: cwd,
4241     chdir: chdir,
4242     umask: umask,
4243     hrtime: hrtime,
4244     platform: platform,
4245     release: release,
4246     config: config,
4247     uptime: uptime
4248   };
4249
4250   const debug = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};
4251   var debug_1 = debug;
4252
4253   // Note: this is the semver.org version of the spec that it implements
4254   // Not necessarily the package version of this code.
4255   const SEMVER_SPEC_VERSION = '2.0.0';
4256   const MAX_LENGTH = 256;
4257   const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
4258   /* istanbul ignore next */
4259   9007199254740991; // Max safe segment length for coercion.
4260
4261   const MAX_SAFE_COMPONENT_LENGTH = 16;
4262   var constants = {
4263     SEMVER_SPEC_VERSION,
4264     MAX_LENGTH,
4265     MAX_SAFE_INTEGER,
4266     MAX_SAFE_COMPONENT_LENGTH
4267   };
4268
4269   var re_1 = createCommonjsModule(function (module, exports) {
4270     const {
4271       MAX_SAFE_COMPONENT_LENGTH
4272     } = constants;
4273     exports = module.exports = {}; // The actual regexps go on exports.re
4274
4275     const re = exports.re = [];
4276     const src = exports.src = [];
4277     const t = exports.t = {};
4278     let R = 0;
4279
4280     const createToken = (name, value, isGlobal) => {
4281       const index = R++;
4282       debug_1(index, value);
4283       t[name] = index;
4284       src[index] = value;
4285       re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
4286     }; // The following Regular Expressions can be used for tokenizing,
4287     // validating, and parsing SemVer version strings.
4288     // ## Numeric Identifier
4289     // A single `0`, or a non-zero digit followed by zero or more digits.
4290
4291
4292     createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
4293     createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); // ## Non-numeric Identifier
4294     // Zero or more digits, followed by a letter or hyphen, and then zero or
4295     // more letters, digits, or hyphens.
4296
4297     createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); // ## Main Version
4298     // Three dot-separated numeric identifiers.
4299
4300     createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")"));
4301     createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")")); // ## Pre-release Version Identifier
4302     // A numeric identifier, or a non-numeric identifier.
4303
4304     createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NUMERICIDENTIFIER], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
4305     createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NUMERICIDENTIFIERLOOSE], "|").concat(src[t.NONNUMERICIDENTIFIER], ")")); // ## Pre-release Version
4306     // Hyphen, followed by one or more dot-separated pre-release version
4307     // identifiers.
4308
4309     createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))"));
4310     createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))")); // ## Build Metadata Identifier
4311     // Any combination of digits, letters, or hyphens.
4312
4313     createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); // ## Build Metadata
4314     // Plus sign, followed by one or more period-separated build metadata
4315     // identifiers.
4316
4317     createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))")); // ## Full Version String
4318     // A main version, followed optionally by a pre-release version and
4319     // build metadata.
4320     // Note that the only major, minor, patch, and pre-release sections of
4321     // the version string are capturing groups.  The build metadata is not a
4322     // capturing group, because it should not ever be used in version
4323     // comparison.
4324
4325     createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?"));
4326     createToken('FULL', "^".concat(src[t.FULLPLAIN], "$")); // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
4327     // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
4328     // common in the npm registry.
4329
4330     createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?"));
4331     createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$"));
4332     createToken('GTLT', '((?:<|>)?=?)'); // Something like "2.*" or "1.2.x".
4333     // Note that "x.x" is a valid xRange identifer, meaning "any version"
4334     // Only the first item is strictly required.
4335
4336     createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*"));
4337     createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*"));
4338     createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?");
4339     createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?");
4340     createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$"));
4341     createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$")); // Coercion.
4342     // Extract anything that could conceivably be a part of a valid semver
4343
4344     createToken('COERCE', "".concat('(^|[^\\d])' + '(\\d{1,').concat(MAX_SAFE_COMPONENT_LENGTH, "})") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:$|[^\\d])");
4345     createToken('COERCERTL', src[t.COERCE], true); // Tilde ranges.
4346     // Meaning is "reasonably at or greater than"
4347
4348     createToken('LONETILDE', '(?:~>?)');
4349     createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true);
4350     exports.tildeTrimReplace = '$1~';
4351     createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$"));
4352     createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$")); // Caret ranges.
4353     // Meaning is "at least and backwards compatible with"
4354
4355     createToken('LONECARET', '(?:\\^)');
4356     createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true);
4357     exports.caretTrimReplace = '$1^';
4358     createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$"));
4359     createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$")); // A simple gt/lt/eq thing, or just "" to indicate "any version"
4360
4361     createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$"));
4362     createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$")); // An expression to strip any whitespace between the gtlt and the thing
4363     // it modifies, so that `> 1.2.3` ==> `>1.2.3`
4364
4365     createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true);
4366     exports.comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4`
4367     // Note that these all use the loose form, because they'll be
4368     // checked against either the strict or loose comparator form
4369     // later.
4370
4371     createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$");
4372     createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$"); // Star ranges basically just allow anything at all.
4373
4374     createToken('STAR', '(<|>)?=?\\s*\\*');
4375   });
4376   var re_2 = re_1.re;
4377   var re_3 = re_1.src;
4378   var re_4 = re_1.t;
4379   var re_5 = re_1.tildeTrimReplace;
4380   var re_6 = re_1.caretTrimReplace;
4381   var re_7 = re_1.comparatorTrimReplace;
4382
4383   const numeric = /^[0-9]+$/;
4384
4385   const compareIdentifiers = (a, b) => {
4386     const anum = numeric.test(a);
4387     const bnum = numeric.test(b);
4388
4389     if (anum && bnum) {
4390       a = +a;
4391       b = +b;
4392     }
4393
4394     return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
4395   };
4396
4397   const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
4398
4399   var identifiers = {
4400     compareIdentifiers,
4401     rcompareIdentifiers
4402   };
4403
4404   const {
4405     MAX_LENGTH: MAX_LENGTH$1,
4406     MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1
4407   } = constants;
4408   const {
4409     re,
4410     t
4411   } = re_1;
4412   const {
4413     compareIdentifiers: compareIdentifiers$1
4414   } = identifiers;
4415
4416   class SemVer {
4417     constructor(version, options) {
4418       if (!options || typeof options !== 'object') {
4419         options = {
4420           loose: !!options,
4421           includePrerelease: false
4422         };
4423       }
4424
4425       if (version instanceof SemVer) {
4426         if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
4427           return version;
4428         } else {
4429           version = version.version;
4430         }
4431       } else if (typeof version !== 'string') {
4432         throw new TypeError("Invalid Version: ".concat(version));
4433       }
4434
4435       if (version.length > MAX_LENGTH$1) {
4436         throw new TypeError("version is longer than ".concat(MAX_LENGTH$1, " characters"));
4437       }
4438
4439       debug_1('SemVer', version, options);
4440       this.options = options;
4441       this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we
4442       // don't run into trouble passing this.options around.
4443
4444       this.includePrerelease = !!options.includePrerelease;
4445       const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
4446
4447       if (!m) {
4448         throw new TypeError("Invalid Version: ".concat(version));
4449       }
4450
4451       this.raw = version; // these are actually numbers
4452
4453       this.major = +m[1];
4454       this.minor = +m[2];
4455       this.patch = +m[3];
4456
4457       if (this.major > MAX_SAFE_INTEGER$1 || this.major < 0) {
4458         throw new TypeError('Invalid major version');
4459       }
4460
4461       if (this.minor > MAX_SAFE_INTEGER$1 || this.minor < 0) {
4462         throw new TypeError('Invalid minor version');
4463       }
4464
4465       if (this.patch > MAX_SAFE_INTEGER$1 || this.patch < 0) {
4466         throw new TypeError('Invalid patch version');
4467       } // numberify any prerelease numeric ids
4468
4469
4470       if (!m[4]) {
4471         this.prerelease = [];
4472       } else {
4473         this.prerelease = m[4].split('.').map(id => {
4474           if (/^[0-9]+$/.test(id)) {
4475             const num = +id;
4476
4477             if (num >= 0 && num < MAX_SAFE_INTEGER$1) {
4478               return num;
4479             }
4480           }
4481
4482           return id;
4483         });
4484       }
4485
4486       this.build = m[5] ? m[5].split('.') : [];
4487       this.format();
4488     }
4489
4490     format() {
4491       this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
4492
4493       if (this.prerelease.length) {
4494         this.version += "-".concat(this.prerelease.join('.'));
4495       }
4496
4497       return this.version;
4498     }
4499
4500     toString() {
4501       return this.version;
4502     }
4503
4504     compare(other) {
4505       debug_1('SemVer.compare', this.version, this.options, other);
4506
4507       if (!(other instanceof SemVer)) {
4508         if (typeof other === 'string' && other === this.version) {
4509           return 0;
4510         }
4511
4512         other = new SemVer(other, this.options);
4513       }
4514
4515       if (other.version === this.version) {
4516         return 0;
4517       }
4518
4519       return this.compareMain(other) || this.comparePre(other);
4520     }
4521
4522     compareMain(other) {
4523       if (!(other instanceof SemVer)) {
4524         other = new SemVer(other, this.options);
4525       }
4526
4527       return compareIdentifiers$1(this.major, other.major) || compareIdentifiers$1(this.minor, other.minor) || compareIdentifiers$1(this.patch, other.patch);
4528     }
4529
4530     comparePre(other) {
4531       if (!(other instanceof SemVer)) {
4532         other = new SemVer(other, this.options);
4533       } // NOT having a prerelease is > having one
4534
4535
4536       if (this.prerelease.length && !other.prerelease.length) {
4537         return -1;
4538       } else if (!this.prerelease.length && other.prerelease.length) {
4539         return 1;
4540       } else if (!this.prerelease.length && !other.prerelease.length) {
4541         return 0;
4542       }
4543
4544       let i = 0;
4545
4546       do {
4547         const a = this.prerelease[i];
4548         const b = other.prerelease[i];
4549         debug_1('prerelease compare', i, a, b);
4550
4551         if (a === undefined && b === undefined) {
4552           return 0;
4553         } else if (b === undefined) {
4554           return 1;
4555         } else if (a === undefined) {
4556           return -1;
4557         } else if (a === b) {
4558           continue;
4559         } else {
4560           return compareIdentifiers$1(a, b);
4561         }
4562       } while (++i);
4563     }
4564
4565     compareBuild(other) {
4566       if (!(other instanceof SemVer)) {
4567         other = new SemVer(other, this.options);
4568       }
4569
4570       let i = 0;
4571
4572       do {
4573         const a = this.build[i];
4574         const b = other.build[i];
4575         debug_1('prerelease compare', i, a, b);
4576
4577         if (a === undefined && b === undefined) {
4578           return 0;
4579         } else if (b === undefined) {
4580           return 1;
4581         } else if (a === undefined) {
4582           return -1;
4583         } else if (a === b) {
4584           continue;
4585         } else {
4586           return compareIdentifiers$1(a, b);
4587         }
4588       } while (++i);
4589     } // preminor will bump the version up to the next minor release, and immediately
4590     // down to pre-release. premajor and prepatch work the same way.
4591
4592
4593     inc(release, identifier) {
4594       switch (release) {
4595         case 'premajor':
4596           this.prerelease.length = 0;
4597           this.patch = 0;
4598           this.minor = 0;
4599           this.major++;
4600           this.inc('pre', identifier);
4601           break;
4602
4603         case 'preminor':
4604           this.prerelease.length = 0;
4605           this.patch = 0;
4606           this.minor++;
4607           this.inc('pre', identifier);
4608           break;
4609
4610         case 'prepatch':
4611           // If this is already a prerelease, it will bump to the next version
4612           // drop any prereleases that might already exist, since they are not
4613           // relevant at this point.
4614           this.prerelease.length = 0;
4615           this.inc('patch', identifier);
4616           this.inc('pre', identifier);
4617           break;
4618         // If the input is a non-prerelease version, this acts the same as
4619         // prepatch.
4620
4621         case 'prerelease':
4622           if (this.prerelease.length === 0) {
4623             this.inc('patch', identifier);
4624           }
4625
4626           this.inc('pre', identifier);
4627           break;
4628
4629         case 'major':
4630           // If this is a pre-major version, bump up to the same major version.
4631           // Otherwise increment major.
4632           // 1.0.0-5 bumps to 1.0.0
4633           // 1.1.0 bumps to 2.0.0
4634           if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
4635             this.major++;
4636           }
4637
4638           this.minor = 0;
4639           this.patch = 0;
4640           this.prerelease = [];
4641           break;
4642
4643         case 'minor':
4644           // If this is a pre-minor version, bump up to the same minor version.
4645           // Otherwise increment minor.
4646           // 1.2.0-5 bumps to 1.2.0
4647           // 1.2.1 bumps to 1.3.0
4648           if (this.patch !== 0 || this.prerelease.length === 0) {
4649             this.minor++;
4650           }
4651
4652           this.patch = 0;
4653           this.prerelease = [];
4654           break;
4655
4656         case 'patch':
4657           // If this is not a pre-release version, it will increment the patch.
4658           // If it is a pre-release it will bump up to the same patch version.
4659           // 1.2.0-5 patches to 1.2.0
4660           // 1.2.0 patches to 1.2.1
4661           if (this.prerelease.length === 0) {
4662             this.patch++;
4663           }
4664
4665           this.prerelease = [];
4666           break;
4667         // This probably shouldn't be used publicly.
4668         // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
4669
4670         case 'pre':
4671           if (this.prerelease.length === 0) {
4672             this.prerelease = [0];
4673           } else {
4674             let i = this.prerelease.length;
4675
4676             while (--i >= 0) {
4677               if (typeof this.prerelease[i] === 'number') {
4678                 this.prerelease[i]++;
4679                 i = -2;
4680               }
4681             }
4682
4683             if (i === -1) {
4684               // didn't increment anything
4685               this.prerelease.push(0);
4686             }
4687           }
4688
4689           if (identifier) {
4690             // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
4691             // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
4692             if (this.prerelease[0] === identifier) {
4693               if (isNaN(this.prerelease[1])) {
4694                 this.prerelease = [identifier, 0];
4695               }
4696             } else {
4697               this.prerelease = [identifier, 0];
4698             }
4699           }
4700
4701           break;
4702
4703         default:
4704           throw new Error("invalid increment argument: ".concat(release));
4705       }
4706
4707       this.format();
4708       this.raw = this.version;
4709       return this;
4710     }
4711
4712   }
4713
4714   var semver = SemVer;
4715
4716   const compare = (a, b, loose) => new semver(a, loose).compare(new semver(b, loose));
4717
4718   var compare_1 = compare;
4719
4720   const lt = (a, b, loose) => compare_1(a, b, loose) < 0;
4721
4722   var lt_1 = lt;
4723
4724   const gte = (a, b, loose) => compare_1(a, b, loose) >= 0;
4725
4726   var gte_1 = gte;
4727
4728   var arrayify = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
4729     [keyName]: key
4730   }, value));
4731
4732   var dedent_1 = createCommonjsModule(function (module) {
4733
4734     function dedent(strings) {
4735       var raw = void 0;
4736
4737       if (typeof strings === "string") {
4738         // dedent can be used as a plain function
4739         raw = [strings];
4740       } else {
4741         raw = strings.raw;
4742       } // first, perform interpolation
4743
4744
4745       var result = "";
4746
4747       for (var i = 0; i < raw.length; i++) {
4748         result += raw[i]. // join lines when there is a suppressed newline
4749         replace(/\\\n[ \t]*/g, ""). // handle escaped backticks
4750         replace(/\\`/g, "`");
4751
4752         if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) {
4753           result += arguments.length <= i + 1 ? undefined : arguments[i + 1];
4754         }
4755       } // now strip indentation
4756
4757
4758       var lines = result.split("\n");
4759       var mindent = null;
4760       lines.forEach(function (l) {
4761         var m = l.match(/^(\s+)\S+/);
4762
4763         if (m) {
4764           var indent = m[1].length;
4765
4766           if (!mindent) {
4767             // this is the first indented line
4768             mindent = indent;
4769           } else {
4770             mindent = Math.min(mindent, indent);
4771           }
4772         }
4773       });
4774
4775       if (mindent !== null) {
4776         result = lines.map(function (l) {
4777           return l[0] === " " ? l.slice(mindent) : l;
4778         }).join("\n");
4779       } // dedent eats leading and trailing whitespace too
4780
4781
4782       result = result.trim(); // handle escaped newlines at the end to ensure they don't get stripped too
4783
4784       return result.replace(/\\n/g, "\n");
4785     }
4786
4787     {
4788       module.exports = dedent;
4789     }
4790   });
4791
4792   function _templateObject6() {
4793     const data = _taggedTemplateLiteral(["\n      Require either '@prettier' or '@format' to be present in the file's first docblock comment\n      in order for it to be formatted.\n    "]);
4794
4795     _templateObject6 = function _templateObject6() {
4796       return data;
4797     };
4798
4799     return data;
4800   }
4801
4802   function _templateObject5() {
4803     const data = _taggedTemplateLiteral(["\n      Format code starting at a given character offset.\n      The range will extend backwards to the start of the first line containing the selected statement.\n      This option cannot be used with --cursor-offset.\n    "]);
4804
4805     _templateObject5 = function _templateObject5() {
4806       return data;
4807     };
4808
4809     return data;
4810   }
4811
4812   function _templateObject4() {
4813     const data = _taggedTemplateLiteral(["\n      Format code ending at a given character offset (exclusive).\n      The range will extend forwards to the end of the selected statement.\n      This option cannot be used with --cursor-offset.\n    "]);
4814
4815     _templateObject4 = function _templateObject4() {
4816       return data;
4817     };
4818
4819     return data;
4820   }
4821
4822   function _templateObject3() {
4823     const data = _taggedTemplateLiteral(["\n      Custom directory that contains prettier plugins in node_modules subdirectory.\n      Overrides default behavior when plugins are searched relatively to the location of Prettier.\n      Multiple values are accepted.\n    "]);
4824
4825     _templateObject3 = function _templateObject3() {
4826       return data;
4827     };
4828
4829     return data;
4830   }
4831
4832   function _templateObject2() {
4833     const data = _taggedTemplateLiteral(["\n          Maintain existing\n          (mixed values within one file are normalised by looking at what's used after the first line)\n        "]);
4834
4835     _templateObject2 = function _templateObject2() {
4836       return data;
4837     };
4838
4839     return data;
4840   }
4841
4842   function _templateObject() {
4843     const data = _taggedTemplateLiteral(["\n      Print (to stderr) where a cursor at the given position would move to after formatting.\n      This option cannot be used with --range-start and --range-end.\n    "]);
4844
4845     _templateObject = function _templateObject() {
4846       return data;
4847     };
4848
4849     return data;
4850   }
4851
4852   const CATEGORY_CONFIG = "Config";
4853   const CATEGORY_EDITOR = "Editor";
4854   const CATEGORY_FORMAT = "Format";
4855   const CATEGORY_OTHER = "Other";
4856   const CATEGORY_OUTPUT = "Output";
4857   const CATEGORY_GLOBAL = "Global";
4858   const CATEGORY_SPECIAL = "Special";
4859   /**
4860    * @typedef {Object} OptionInfo
4861    * @property {string} [since] - available since version
4862    * @property {string} category
4863    * @property {'int' | 'boolean' | 'choice' | 'path'} type
4864    * @property {boolean} [array] - indicate it's an array of the specified type
4865    * @property {OptionValueInfo} [default]
4866    * @property {OptionRangeInfo} [range] - for type int
4867    * @property {string} description
4868    * @property {string} [deprecated] - deprecated since version
4869    * @property {OptionRedirectInfo} [redirect] - redirect deprecated option
4870    * @property {(value: any) => boolean} [exception]
4871    * @property {OptionChoiceInfo[]} [choices] - for type choice
4872    * @property {string} [cliName]
4873    * @property {string} [cliCategory]
4874    * @property {string} [cliDescription]
4875    *
4876    * @typedef {number | boolean | string} OptionValue
4877    * @typedef {OptionValue | [{ value: OptionValue[] }] | Array<{ since: string, value: OptionValue}>} OptionValueInfo
4878    *
4879    * @typedef {Object} OptionRedirectInfo
4880    * @property {string} option
4881    * @property {OptionValue} value
4882    *
4883    * @typedef {Object} OptionRangeInfo
4884    * @property {number} start - recommended range start
4885    * @property {number} end - recommended range end
4886    * @property {number} step - recommended range step
4887    *
4888    * @typedef {Object} OptionChoiceInfo
4889    * @property {boolean | string} value - boolean for the option that is originally boolean type
4890    * @property {string} description
4891    * @property {string} [since] - undefined if available since the first version of the option
4892    * @property {string} [deprecated] - deprecated since version
4893    * @property {OptionValueInfo} [redirect] - redirect deprecated value
4894    */
4895
4896   /** @type {{ [name: string]: OptionInfo }} */
4897
4898   const options = {
4899     cursorOffset: {
4900       since: "1.4.0",
4901       category: CATEGORY_SPECIAL,
4902       type: "int",
4903       default: -1,
4904       range: {
4905         start: -1,
4906         end: Infinity,
4907         step: 1
4908       },
4909       description: dedent_1(_templateObject()),
4910       cliCategory: CATEGORY_EDITOR
4911     },
4912     endOfLine: {
4913       since: "1.15.0",
4914       category: CATEGORY_GLOBAL,
4915       type: "choice",
4916       default: [{
4917         since: "1.15.0",
4918         value: "auto"
4919       }, {
4920         since: "2.0.0",
4921         value: "lf"
4922       }],
4923       description: "Which end of line characters to apply.",
4924       choices: [{
4925         value: "lf",
4926         description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
4927       }, {
4928         value: "crlf",
4929         description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
4930       }, {
4931         value: "cr",
4932         description: "Carriage Return character only (\\r), used very rarely"
4933       }, {
4934         value: "auto",
4935         description: dedent_1(_templateObject2())
4936       }]
4937     },
4938     filepath: {
4939       since: "1.4.0",
4940       category: CATEGORY_SPECIAL,
4941       type: "path",
4942       description: "Specify the input filepath. This will be used to do parser inference.",
4943       cliName: "stdin-filepath",
4944       cliCategory: CATEGORY_OTHER,
4945       cliDescription: "Path to the file to pretend that stdin comes from."
4946     },
4947     insertPragma: {
4948       since: "1.8.0",
4949       category: CATEGORY_SPECIAL,
4950       type: "boolean",
4951       default: false,
4952       description: "Insert @format pragma into file's first docblock comment.",
4953       cliCategory: CATEGORY_OTHER
4954     },
4955     parser: {
4956       since: "0.0.10",
4957       category: CATEGORY_GLOBAL,
4958       type: "choice",
4959       default: [{
4960         since: "0.0.10",
4961         value: "babylon"
4962       }, {
4963         since: "1.13.0",
4964         value: undefined
4965       }],
4966       description: "Which parser to use.",
4967       exception: value => typeof value === "string" || typeof value === "function",
4968       choices: [{
4969         value: "flow",
4970         description: "Flow"
4971       }, {
4972         value: "babel",
4973         since: "1.16.0",
4974         description: "JavaScript"
4975       }, {
4976         value: "babel-flow",
4977         since: "1.16.0",
4978         description: "Flow"
4979       }, {
4980         value: "babel-ts",
4981         since: "2.0.0",
4982         description: "TypeScript"
4983       }, {
4984         value: "typescript",
4985         since: "1.4.0",
4986         description: "TypeScript"
4987       }, {
4988         value: "css",
4989         since: "1.7.1",
4990         description: "CSS"
4991       }, {
4992         value: "less",
4993         since: "1.7.1",
4994         description: "Less"
4995       }, {
4996         value: "scss",
4997         since: "1.7.1",
4998         description: "SCSS"
4999       }, {
5000         value: "json",
5001         since: "1.5.0",
5002         description: "JSON"
5003       }, {
5004         value: "json5",
5005         since: "1.13.0",
5006         description: "JSON5"
5007       }, {
5008         value: "json-stringify",
5009         since: "1.13.0",
5010         description: "JSON.stringify"
5011       }, {
5012         value: "graphql",
5013         since: "1.5.0",
5014         description: "GraphQL"
5015       }, {
5016         value: "markdown",
5017         since: "1.8.0",
5018         description: "Markdown"
5019       }, {
5020         value: "mdx",
5021         since: "1.15.0",
5022         description: "MDX"
5023       }, {
5024         value: "vue",
5025         since: "1.10.0",
5026         description: "Vue"
5027       }, {
5028         value: "yaml",
5029         since: "1.14.0",
5030         description: "YAML"
5031       }, {
5032         value: "glimmer",
5033         since: null,
5034         description: "Handlebars"
5035       }, {
5036         value: "html",
5037         since: "1.15.0",
5038         description: "HTML"
5039       }, {
5040         value: "angular",
5041         since: "1.15.0",
5042         description: "Angular"
5043       }, {
5044         value: "lwc",
5045         since: "1.17.0",
5046         description: "Lightning Web Components"
5047       }]
5048     },
5049     plugins: {
5050       since: "1.10.0",
5051       type: "path",
5052       array: true,
5053       default: [{
5054         value: []
5055       }],
5056       category: CATEGORY_GLOBAL,
5057       description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
5058       exception: value => typeof value === "string" || typeof value === "object",
5059       cliName: "plugin",
5060       cliCategory: CATEGORY_CONFIG
5061     },
5062     pluginSearchDirs: {
5063       since: "1.13.0",
5064       type: "path",
5065       array: true,
5066       default: [{
5067         value: []
5068       }],
5069       category: CATEGORY_GLOBAL,
5070       description: dedent_1(_templateObject3()),
5071       exception: value => typeof value === "string" || typeof value === "object",
5072       cliName: "plugin-search-dir",
5073       cliCategory: CATEGORY_CONFIG
5074     },
5075     printWidth: {
5076       since: "0.0.0",
5077       category: CATEGORY_GLOBAL,
5078       type: "int",
5079       default: 80,
5080       description: "The line length where Prettier will try wrap.",
5081       range: {
5082         start: 0,
5083         end: Infinity,
5084         step: 1
5085       }
5086     },
5087     rangeEnd: {
5088       since: "1.4.0",
5089       category: CATEGORY_SPECIAL,
5090       type: "int",
5091       default: Infinity,
5092       range: {
5093         start: 0,
5094         end: Infinity,
5095         step: 1
5096       },
5097       description: dedent_1(_templateObject4()),
5098       cliCategory: CATEGORY_EDITOR
5099     },
5100     rangeStart: {
5101       since: "1.4.0",
5102       category: CATEGORY_SPECIAL,
5103       type: "int",
5104       default: 0,
5105       range: {
5106         start: 0,
5107         end: Infinity,
5108         step: 1
5109       },
5110       description: dedent_1(_templateObject5()),
5111       cliCategory: CATEGORY_EDITOR
5112     },
5113     requirePragma: {
5114       since: "1.7.0",
5115       category: CATEGORY_SPECIAL,
5116       type: "boolean",
5117       default: false,
5118       description: dedent_1(_templateObject6()),
5119       cliCategory: CATEGORY_OTHER
5120     },
5121     tabWidth: {
5122       type: "int",
5123       category: CATEGORY_GLOBAL,
5124       default: 2,
5125       description: "Number of spaces per indentation level.",
5126       range: {
5127         start: 0,
5128         end: Infinity,
5129         step: 1
5130       }
5131     },
5132     useTabs: {
5133       since: "1.0.0",
5134       category: CATEGORY_GLOBAL,
5135       type: "boolean",
5136       default: false,
5137       description: "Indent with tabs instead of spaces."
5138     }
5139   };
5140   var coreOptions = {
5141     CATEGORY_CONFIG,
5142     CATEGORY_EDITOR,
5143     CATEGORY_FORMAT,
5144     CATEGORY_OTHER,
5145     CATEGORY_OUTPUT,
5146     CATEGORY_GLOBAL,
5147     CATEGORY_SPECIAL,
5148     options
5149   };
5150
5151   var require$$0 = getCjsExportFromNamespace(_package$1);
5152
5153   const semver$1 = {
5154     compare: compare_1,
5155     lt: lt_1,
5156     gte: gte_1
5157   };
5158   const currentVersion = require$$0.version;
5159   const coreOptions$1 = coreOptions.options;
5160   /**
5161    * Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version
5162    * of this function created by `withPlugins`. Don't pass them here directly.
5163    * @param {object} param0
5164    * @param {(string | object)[]=} param0.plugins Strings are resolved by `withPlugins`.
5165    * @param {string[]=} param0.pluginSearchDirs Added by `withPlugins`.
5166    * @param {boolean=} param0.showUnreleased
5167    * @param {boolean=} param0.showDeprecated
5168    * @param {boolean=} param0.showInternal
5169    */
5170
5171   function getSupportInfo({
5172     plugins = [],
5173     showUnreleased = false,
5174     showDeprecated = false,
5175     showInternal = false
5176   } = {}) {
5177     // pre-release version is smaller than the normal version in semver,
5178     // we need to treat it as the normal one so as to test new features.
5179     const version = currentVersion.split("-", 1)[0];
5180     const options = arrayify(Object.assign({}, ...plugins.map(({
5181       options
5182     }) => options), coreOptions$1), "name").filter(option => filterSince(option) && filterDeprecated(option)).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1).map(mapInternal).map(option => {
5183       option = Object.assign({}, option);
5184
5185       if (Array.isArray(option.default)) {
5186         option.default = option.default.length === 1 ? option.default[0].value : option.default.filter(filterSince).sort((info1, info2) => semver$1.compare(info2.since, info1.since))[0].value;
5187       }
5188
5189       if (Array.isArray(option.choices)) {
5190         option.choices = option.choices.filter(option => filterSince(option) && filterDeprecated(option));
5191       }
5192
5193       const filteredPlugins = plugins.filter(plugin => plugin.defaultOptions && plugin.defaultOptions[option.name] !== undefined);
5194       const pluginDefaults = filteredPlugins.reduce((reduced, plugin) => {
5195         reduced[plugin.name] = plugin.defaultOptions[option.name];
5196         return reduced;
5197       }, {});
5198       return Object.assign({}, option, {
5199         pluginDefaults
5200       });
5201     });
5202     const languages = plugins.reduce((all, plugin) => all.concat(plugin.languages || []), []).filter(filterSince);
5203     return {
5204       languages,
5205       options
5206     };
5207
5208     function filterSince(object) {
5209       return showUnreleased || !("since" in object) || object.since && semver$1.gte(version, object.since);
5210     }
5211
5212     function filterDeprecated(object) {
5213       return showDeprecated || !("deprecated" in object) || object.deprecated && semver$1.lt(version, object.deprecated);
5214     }
5215
5216     function mapInternal(object) {
5217       if (showInternal) {
5218         return object;
5219       }
5220
5221       const newObject = _objectWithoutPropertiesLoose(object, ["cliName", "cliCategory", "cliDescription"]);
5222
5223       return newObject;
5224     }
5225   }
5226
5227   var support = {
5228     getSupportInfo
5229   };
5230
5231   /*! *****************************************************************************\r
5232   Copyright (c) Microsoft Corporation. All rights reserved.\r
5233   Licensed under the Apache License, Version 2.0 (the "License"); you may not use\r
5234   this file except in compliance with the License. You may obtain a copy of the\r
5235   License at http://www.apache.org/licenses/LICENSE-2.0\r
5236 \r
5237   THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
5238   KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r
5239   WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r
5240   MERCHANTABLITY OR NON-INFRINGEMENT.\r
5241 \r
5242   See the Apache Version 2.0 License for specific language governing permissions\r
5243   and limitations under the License.\r
5244   ***************************************************************************** */
5245
5246   /* global Reflect, Promise */
5247   var _extendStatics = function extendStatics(d, b) {
5248     _extendStatics = Object.setPrototypeOf || {
5249       __proto__: []
5250     } instanceof Array && function (d, b) {
5251       d.__proto__ = b;
5252     } || function (d, b) {
5253       for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
5254     };
5255
5256     return _extendStatics(d, b);
5257   };
5258
5259   function __extends(d, b) {
5260     _extendStatics(d, b);
5261
5262     function __() {
5263       this.constructor = d;
5264     }
5265
5266     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5267   }
5268
5269   var _assign = function __assign() {
5270     _assign = Object.assign || function __assign(t) {
5271       for (var s, i = 1, n = arguments.length; i < n; i++) {
5272         s = arguments[i];
5273
5274         for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
5275       }
5276
5277       return t;
5278     };
5279
5280     return _assign.apply(this, arguments);
5281   };
5282   function __rest(s, e) {
5283     var t = {};
5284
5285     for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
5286
5287     if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5288       if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
5289     }
5290     return t;
5291   }
5292   function __decorate(decorators, target, key, desc) {
5293     var c = arguments.length,
5294         r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
5295         d;
5296     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5297     return c > 3 && r && Object.defineProperty(target, key, r), r;
5298   }
5299   function __param(paramIndex, decorator) {
5300     return function (target, key) {
5301       decorator(target, key, paramIndex);
5302     };
5303   }
5304   function __metadata(metadataKey, metadataValue) {
5305     if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
5306   }
5307   function __awaiter(thisArg, _arguments, P, generator) {
5308     return new (P || (P = Promise))(function (resolve, reject) {
5309       function fulfilled(value) {
5310         try {
5311           step(generator.next(value));
5312         } catch (e) {
5313           reject(e);
5314         }
5315       }
5316
5317       function rejected(value) {
5318         try {
5319           step(generator["throw"](value));
5320         } catch (e) {
5321           reject(e);
5322         }
5323       }
5324
5325       function step(result) {
5326         result.done ? resolve(result.value) : new P(function (resolve) {
5327           resolve(result.value);
5328         }).then(fulfilled, rejected);
5329       }
5330
5331       step((generator = generator.apply(thisArg, _arguments || [])).next());
5332     });
5333   }
5334   function __generator(thisArg, body) {
5335     var _ = {
5336       label: 0,
5337       sent: function sent() {
5338         if (t[0] & 1) throw t[1];
5339         return t[1];
5340       },
5341       trys: [],
5342       ops: []
5343     },
5344         f,
5345         y,
5346         t,
5347         g;
5348     return g = {
5349       next: verb(0),
5350       "throw": verb(1),
5351       "return": verb(2)
5352     }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
5353       return this;
5354     }), g;
5355
5356     function verb(n) {
5357       return function (v) {
5358         return step([n, v]);
5359       };
5360     }
5361
5362     function step(op) {
5363       if (f) throw new TypeError("Generator is already executing.");
5364
5365       while (_) try {
5366         if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
5367         if (y = 0, t) op = [op[0] & 2, t.value];
5368
5369         switch (op[0]) {
5370           case 0:
5371           case 1:
5372             t = op;
5373             break;
5374
5375           case 4:
5376             _.label++;
5377             return {
5378               value: op[1],
5379               done: false
5380             };
5381
5382           case 5:
5383             _.label++;
5384             y = op[1];
5385             op = [0];
5386             continue;
5387
5388           case 7:
5389             op = _.ops.pop();
5390
5391             _.trys.pop();
5392
5393             continue;
5394
5395           default:
5396             if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
5397               _ = 0;
5398               continue;
5399             }
5400
5401             if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
5402               _.label = op[1];
5403               break;
5404             }
5405
5406             if (op[0] === 6 && _.label < t[1]) {
5407               _.label = t[1];
5408               t = op;
5409               break;
5410             }
5411
5412             if (t && _.label < t[2]) {
5413               _.label = t[2];
5414
5415               _.ops.push(op);
5416
5417               break;
5418             }
5419
5420             if (t[2]) _.ops.pop();
5421
5422             _.trys.pop();
5423
5424             continue;
5425         }
5426
5427         op = body.call(thisArg, _);
5428       } catch (e) {
5429         op = [6, e];
5430         y = 0;
5431       } finally {
5432         f = t = 0;
5433       }
5434
5435       if (op[0] & 5) throw op[1];
5436       return {
5437         value: op[0] ? op[1] : void 0,
5438         done: true
5439       };
5440     }
5441   }
5442   function __exportStar(m, exports) {
5443     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
5444   }
5445   function __values(o) {
5446     var m = typeof Symbol === "function" && o[Symbol.iterator],
5447         i = 0;
5448     if (m) return m.call(o);
5449     return {
5450       next: function next() {
5451         if (o && i >= o.length) o = void 0;
5452         return {
5453           value: o && o[i++],
5454           done: !o
5455         };
5456       }
5457     };
5458   }
5459   function __read(o, n) {
5460     var m = typeof Symbol === "function" && o[Symbol.iterator];
5461     if (!m) return o;
5462     var i = m.call(o),
5463         r,
5464         ar = [],
5465         e;
5466
5467     try {
5468       while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
5469     } catch (error) {
5470       e = {
5471         error: error
5472       };
5473     } finally {
5474       try {
5475         if (r && !r.done && (m = i["return"])) m.call(i);
5476       } finally {
5477         if (e) throw e.error;
5478       }
5479     }
5480
5481     return ar;
5482   }
5483   function __spread() {
5484     for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
5485
5486     return ar;
5487   }
5488   function __spreadArrays() {
5489     for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
5490
5491     for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
5492
5493     return r;
5494   }
5495   function __await(v) {
5496     return this instanceof __await ? (this.v = v, this) : new __await(v);
5497   }
5498   function __asyncGenerator(thisArg, _arguments, generator) {
5499     if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
5500     var g = generator.apply(thisArg, _arguments || []),
5501         i,
5502         q = [];
5503     return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
5504       return this;
5505     }, i;
5506
5507     function verb(n) {
5508       if (g[n]) i[n] = function (v) {
5509         return new Promise(function (a, b) {
5510           q.push([n, v, a, b]) > 1 || resume(n, v);
5511         });
5512       };
5513     }
5514
5515     function resume(n, v) {
5516       try {
5517         step(g[n](v));
5518       } catch (e) {
5519         settle(q[0][3], e);
5520       }
5521     }
5522
5523     function step(r) {
5524       r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
5525     }
5526
5527     function fulfill(value) {
5528       resume("next", value);
5529     }
5530
5531     function reject(value) {
5532       resume("throw", value);
5533     }
5534
5535     function settle(f, v) {
5536       if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
5537     }
5538   }
5539   function __asyncDelegator(o) {
5540     var i, p;
5541     return i = {}, verb("next"), verb("throw", function (e) {
5542       throw e;
5543     }), verb("return"), i[Symbol.iterator] = function () {
5544       return this;
5545     }, i;
5546
5547     function verb(n, f) {
5548       i[n] = o[n] ? function (v) {
5549         return (p = !p) ? {
5550           value: __await(o[n](v)),
5551           done: n === "return"
5552         } : f ? f(v) : v;
5553       } : f;
5554     }
5555   }
5556   function __asyncValues(o) {
5557     if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
5558     var m = o[Symbol.asyncIterator],
5559         i;
5560     return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
5561       return this;
5562     }, i);
5563
5564     function verb(n) {
5565       i[n] = o[n] && function (v) {
5566         return new Promise(function (resolve, reject) {
5567           v = o[n](v), settle(resolve, reject, v.done, v.value);
5568         });
5569       };
5570     }
5571
5572     function settle(resolve, reject, d, v) {
5573       Promise.resolve(v).then(function (v) {
5574         resolve({
5575           value: v,
5576           done: d
5577         });
5578       }, reject);
5579     }
5580   }
5581   function __makeTemplateObject(cooked, raw) {
5582     if (Object.defineProperty) {
5583       Object.defineProperty(cooked, "raw", {
5584         value: raw
5585       });
5586     } else {
5587       cooked.raw = raw;
5588     }
5589
5590     return cooked;
5591   }
5592   function __importStar(mod) {
5593     if (mod && mod.__esModule) return mod;
5594     var result = {};
5595     if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
5596     result.default = mod;
5597     return result;
5598   }
5599   function __importDefault(mod) {
5600     return mod && mod.__esModule ? mod : {
5601       default: mod
5602     };
5603   }
5604
5605   var tslib_es6 = /*#__PURE__*/Object.freeze({
5606     __proto__: null,
5607     __extends: __extends,
5608     get __assign () { return _assign; },
5609     __rest: __rest,
5610     __decorate: __decorate,
5611     __param: __param,
5612     __metadata: __metadata,
5613     __awaiter: __awaiter,
5614     __generator: __generator,
5615     __exportStar: __exportStar,
5616     __values: __values,
5617     __read: __read,
5618     __spread: __spread,
5619     __spreadArrays: __spreadArrays,
5620     __await: __await,
5621     __asyncGenerator: __asyncGenerator,
5622     __asyncDelegator: __asyncDelegator,
5623     __asyncValues: __asyncValues,
5624     __makeTemplateObject: __makeTemplateObject,
5625     __importStar: __importStar,
5626     __importDefault: __importDefault
5627   });
5628
5629   var api = createCommonjsModule(function (module, exports) {
5630
5631     Object.defineProperty(exports, "__esModule", {
5632       value: true
5633     });
5634     exports.apiDescriptor = {
5635       key: _key => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(_key) ? _key : JSON.stringify(_key),
5636
5637       value(value) {
5638         if (value === null || typeof value !== 'object') {
5639           return JSON.stringify(value);
5640         }
5641
5642         if (Array.isArray(value)) {
5643           return "[".concat(value.map(subValue => exports.apiDescriptor.value(subValue)).join(', '), "]");
5644         }
5645
5646         const keys = Object.keys(value);
5647         return keys.length === 0 ? '{}' : "{ ".concat(keys.map(key => "".concat(exports.apiDescriptor.key(key), ": ").concat(exports.apiDescriptor.value(value[key]))).join(', '), " }");
5648       },
5649
5650       pair: ({
5651         key,
5652         value
5653       }) => exports.apiDescriptor.value({
5654         [key]: value
5655       })
5656     };
5657   });
5658   unwrapExports(api);
5659   var api_1 = api.apiDescriptor;
5660
5661   var tslib_1 = getCjsExportFromNamespace(tslib_es6);
5662
5663   var descriptors = createCommonjsModule(function (module, exports) {
5664
5665     Object.defineProperty(exports, "__esModule", {
5666       value: true
5667     });
5668
5669     tslib_1.__exportStar(api, exports);
5670   });
5671   unwrapExports(descriptors);
5672
5673   var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
5674
5675   var escapeStringRegexp = function escapeStringRegexp(str) {
5676     if (typeof str !== 'string') {
5677       throw new TypeError('Expected a string');
5678     }
5679
5680     return str.replace(matchOperatorsRe, '\\$&');
5681   };
5682
5683   var colorName = {
5684     "aliceblue": [240, 248, 255],
5685     "antiquewhite": [250, 235, 215],
5686     "aqua": [0, 255, 255],
5687     "aquamarine": [127, 255, 212],
5688     "azure": [240, 255, 255],
5689     "beige": [245, 245, 220],
5690     "bisque": [255, 228, 196],
5691     "black": [0, 0, 0],
5692     "blanchedalmond": [255, 235, 205],
5693     "blue": [0, 0, 255],
5694     "blueviolet": [138, 43, 226],
5695     "brown": [165, 42, 42],
5696     "burlywood": [222, 184, 135],
5697     "cadetblue": [95, 158, 160],
5698     "chartreuse": [127, 255, 0],
5699     "chocolate": [210, 105, 30],
5700     "coral": [255, 127, 80],
5701     "cornflowerblue": [100, 149, 237],
5702     "cornsilk": [255, 248, 220],
5703     "crimson": [220, 20, 60],
5704     "cyan": [0, 255, 255],
5705     "darkblue": [0, 0, 139],
5706     "darkcyan": [0, 139, 139],
5707     "darkgoldenrod": [184, 134, 11],
5708     "darkgray": [169, 169, 169],
5709     "darkgreen": [0, 100, 0],
5710     "darkgrey": [169, 169, 169],
5711     "darkkhaki": [189, 183, 107],
5712     "darkmagenta": [139, 0, 139],
5713     "darkolivegreen": [85, 107, 47],
5714     "darkorange": [255, 140, 0],
5715     "darkorchid": [153, 50, 204],
5716     "darkred": [139, 0, 0],
5717     "darksalmon": [233, 150, 122],
5718     "darkseagreen": [143, 188, 143],
5719     "darkslateblue": [72, 61, 139],
5720     "darkslategray": [47, 79, 79],
5721     "darkslategrey": [47, 79, 79],
5722     "darkturquoise": [0, 206, 209],
5723     "darkviolet": [148, 0, 211],
5724     "deeppink": [255, 20, 147],
5725     "deepskyblue": [0, 191, 255],
5726     "dimgray": [105, 105, 105],
5727     "dimgrey": [105, 105, 105],
5728     "dodgerblue": [30, 144, 255],
5729     "firebrick": [178, 34, 34],
5730     "floralwhite": [255, 250, 240],
5731     "forestgreen": [34, 139, 34],
5732     "fuchsia": [255, 0, 255],
5733     "gainsboro": [220, 220, 220],
5734     "ghostwhite": [248, 248, 255],
5735     "gold": [255, 215, 0],
5736     "goldenrod": [218, 165, 32],
5737     "gray": [128, 128, 128],
5738     "green": [0, 128, 0],
5739     "greenyellow": [173, 255, 47],
5740     "grey": [128, 128, 128],
5741     "honeydew": [240, 255, 240],
5742     "hotpink": [255, 105, 180],
5743     "indianred": [205, 92, 92],
5744     "indigo": [75, 0, 130],
5745     "ivory": [255, 255, 240],
5746     "khaki": [240, 230, 140],
5747     "lavender": [230, 230, 250],
5748     "lavenderblush": [255, 240, 245],
5749     "lawngreen": [124, 252, 0],
5750     "lemonchiffon": [255, 250, 205],
5751     "lightblue": [173, 216, 230],
5752     "lightcoral": [240, 128, 128],
5753     "lightcyan": [224, 255, 255],
5754     "lightgoldenrodyellow": [250, 250, 210],
5755     "lightgray": [211, 211, 211],
5756     "lightgreen": [144, 238, 144],
5757     "lightgrey": [211, 211, 211],
5758     "lightpink": [255, 182, 193],
5759     "lightsalmon": [255, 160, 122],
5760     "lightseagreen": [32, 178, 170],
5761     "lightskyblue": [135, 206, 250],
5762     "lightslategray": [119, 136, 153],
5763     "lightslategrey": [119, 136, 153],
5764     "lightsteelblue": [176, 196, 222],
5765     "lightyellow": [255, 255, 224],
5766     "lime": [0, 255, 0],
5767     "limegreen": [50, 205, 50],
5768     "linen": [250, 240, 230],
5769     "magenta": [255, 0, 255],
5770     "maroon": [128, 0, 0],
5771     "mediumaquamarine": [102, 205, 170],
5772     "mediumblue": [0, 0, 205],
5773     "mediumorchid": [186, 85, 211],
5774     "mediumpurple": [147, 112, 219],
5775     "mediumseagreen": [60, 179, 113],
5776     "mediumslateblue": [123, 104, 238],
5777     "mediumspringgreen": [0, 250, 154],
5778     "mediumturquoise": [72, 209, 204],
5779     "mediumvioletred": [199, 21, 133],
5780     "midnightblue": [25, 25, 112],
5781     "mintcream": [245, 255, 250],
5782     "mistyrose": [255, 228, 225],
5783     "moccasin": [255, 228, 181],
5784     "navajowhite": [255, 222, 173],
5785     "navy": [0, 0, 128],
5786     "oldlace": [253, 245, 230],
5787     "olive": [128, 128, 0],
5788     "olivedrab": [107, 142, 35],
5789     "orange": [255, 165, 0],
5790     "orangered": [255, 69, 0],
5791     "orchid": [218, 112, 214],
5792     "palegoldenrod": [238, 232, 170],
5793     "palegreen": [152, 251, 152],
5794     "paleturquoise": [175, 238, 238],
5795     "palevioletred": [219, 112, 147],
5796     "papayawhip": [255, 239, 213],
5797     "peachpuff": [255, 218, 185],
5798     "peru": [205, 133, 63],
5799     "pink": [255, 192, 203],
5800     "plum": [221, 160, 221],
5801     "powderblue": [176, 224, 230],
5802     "purple": [128, 0, 128],
5803     "rebeccapurple": [102, 51, 153],
5804     "red": [255, 0, 0],
5805     "rosybrown": [188, 143, 143],
5806     "royalblue": [65, 105, 225],
5807     "saddlebrown": [139, 69, 19],
5808     "salmon": [250, 128, 114],
5809     "sandybrown": [244, 164, 96],
5810     "seagreen": [46, 139, 87],
5811     "seashell": [255, 245, 238],
5812     "sienna": [160, 82, 45],
5813     "silver": [192, 192, 192],
5814     "skyblue": [135, 206, 235],
5815     "slateblue": [106, 90, 205],
5816     "slategray": [112, 128, 144],
5817     "slategrey": [112, 128, 144],
5818     "snow": [255, 250, 250],
5819     "springgreen": [0, 255, 127],
5820     "steelblue": [70, 130, 180],
5821     "tan": [210, 180, 140],
5822     "teal": [0, 128, 128],
5823     "thistle": [216, 191, 216],
5824     "tomato": [255, 99, 71],
5825     "turquoise": [64, 224, 208],
5826     "violet": [238, 130, 238],
5827     "wheat": [245, 222, 179],
5828     "white": [255, 255, 255],
5829     "whitesmoke": [245, 245, 245],
5830     "yellow": [255, 255, 0],
5831     "yellowgreen": [154, 205, 50]
5832   };
5833
5834   var conversions = createCommonjsModule(function (module) {
5835     /* MIT license */
5836     // NOTE: conversions should only return primitive values (i.e. arrays, or
5837     //       values that give correct `typeof` results).
5838     //       do not use box values types (i.e. Number(), String(), etc.)
5839     var reverseKeywords = {};
5840
5841     for (var key in colorName) {
5842       if (colorName.hasOwnProperty(key)) {
5843         reverseKeywords[colorName[key]] = key;
5844       }
5845     }
5846
5847     var convert = module.exports = {
5848       rgb: {
5849         channels: 3,
5850         labels: 'rgb'
5851       },
5852       hsl: {
5853         channels: 3,
5854         labels: 'hsl'
5855       },
5856       hsv: {
5857         channels: 3,
5858         labels: 'hsv'
5859       },
5860       hwb: {
5861         channels: 3,
5862         labels: 'hwb'
5863       },
5864       cmyk: {
5865         channels: 4,
5866         labels: 'cmyk'
5867       },
5868       xyz: {
5869         channels: 3,
5870         labels: 'xyz'
5871       },
5872       lab: {
5873         channels: 3,
5874         labels: 'lab'
5875       },
5876       lch: {
5877         channels: 3,
5878         labels: 'lch'
5879       },
5880       hex: {
5881         channels: 1,
5882         labels: ['hex']
5883       },
5884       keyword: {
5885         channels: 1,
5886         labels: ['keyword']
5887       },
5888       ansi16: {
5889         channels: 1,
5890         labels: ['ansi16']
5891       },
5892       ansi256: {
5893         channels: 1,
5894         labels: ['ansi256']
5895       },
5896       hcg: {
5897         channels: 3,
5898         labels: ['h', 'c', 'g']
5899       },
5900       apple: {
5901         channels: 3,
5902         labels: ['r16', 'g16', 'b16']
5903       },
5904       gray: {
5905         channels: 1,
5906         labels: ['gray']
5907       }
5908     }; // hide .channels and .labels properties
5909
5910     for (var model in convert) {
5911       if (convert.hasOwnProperty(model)) {
5912         if (!('channels' in convert[model])) {
5913           throw new Error('missing channels property: ' + model);
5914         }
5915
5916         if (!('labels' in convert[model])) {
5917           throw new Error('missing channel labels property: ' + model);
5918         }
5919
5920         if (convert[model].labels.length !== convert[model].channels) {
5921           throw new Error('channel and label counts mismatch: ' + model);
5922         }
5923
5924         var channels = convert[model].channels;
5925         var labels = convert[model].labels;
5926         delete convert[model].channels;
5927         delete convert[model].labels;
5928         Object.defineProperty(convert[model], 'channels', {
5929           value: channels
5930         });
5931         Object.defineProperty(convert[model], 'labels', {
5932           value: labels
5933         });
5934       }
5935     }
5936
5937     convert.rgb.hsl = function (rgb) {
5938       var r = rgb[0] / 255;
5939       var g = rgb[1] / 255;
5940       var b = rgb[2] / 255;
5941       var min = Math.min(r, g, b);
5942       var max = Math.max(r, g, b);
5943       var delta = max - min;
5944       var h;
5945       var s;
5946       var l;
5947
5948       if (max === min) {
5949         h = 0;
5950       } else if (r === max) {
5951         h = (g - b) / delta;
5952       } else if (g === max) {
5953         h = 2 + (b - r) / delta;
5954       } else if (b === max) {
5955         h = 4 + (r - g) / delta;
5956       }
5957
5958       h = Math.min(h * 60, 360);
5959
5960       if (h < 0) {
5961         h += 360;
5962       }
5963
5964       l = (min + max) / 2;
5965
5966       if (max === min) {
5967         s = 0;
5968       } else if (l <= 0.5) {
5969         s = delta / (max + min);
5970       } else {
5971         s = delta / (2 - max - min);
5972       }
5973
5974       return [h, s * 100, l * 100];
5975     };
5976
5977     convert.rgb.hsv = function (rgb) {
5978       var rdif;
5979       var gdif;
5980       var bdif;
5981       var h;
5982       var s;
5983       var r = rgb[0] / 255;
5984       var g = rgb[1] / 255;
5985       var b = rgb[2] / 255;
5986       var v = Math.max(r, g, b);
5987       var diff = v - Math.min(r, g, b);
5988
5989       var diffc = function diffc(c) {
5990         return (v - c) / 6 / diff + 1 / 2;
5991       };
5992
5993       if (diff === 0) {
5994         h = s = 0;
5995       } else {
5996         s = diff / v;
5997         rdif = diffc(r);
5998         gdif = diffc(g);
5999         bdif = diffc(b);
6000
6001         if (r === v) {
6002           h = bdif - gdif;
6003         } else if (g === v) {
6004           h = 1 / 3 + rdif - bdif;
6005         } else if (b === v) {
6006           h = 2 / 3 + gdif - rdif;
6007         }
6008
6009         if (h < 0) {
6010           h += 1;
6011         } else if (h > 1) {
6012           h -= 1;
6013         }
6014       }
6015
6016       return [h * 360, s * 100, v * 100];
6017     };
6018
6019     convert.rgb.hwb = function (rgb) {
6020       var r = rgb[0];
6021       var g = rgb[1];
6022       var b = rgb[2];
6023       var h = convert.rgb.hsl(rgb)[0];
6024       var w = 1 / 255 * Math.min(r, Math.min(g, b));
6025       b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
6026       return [h, w * 100, b * 100];
6027     };
6028
6029     convert.rgb.cmyk = function (rgb) {
6030       var r = rgb[0] / 255;
6031       var g = rgb[1] / 255;
6032       var b = rgb[2] / 255;
6033       var c;
6034       var m;
6035       var y;
6036       var k;
6037       k = Math.min(1 - r, 1 - g, 1 - b);
6038       c = (1 - r - k) / (1 - k) || 0;
6039       m = (1 - g - k) / (1 - k) || 0;
6040       y = (1 - b - k) / (1 - k) || 0;
6041       return [c * 100, m * 100, y * 100, k * 100];
6042     };
6043     /**
6044      * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
6045      * */
6046
6047
6048     function comparativeDistance(x, y) {
6049       return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
6050     }
6051
6052     convert.rgb.keyword = function (rgb) {
6053       var reversed = reverseKeywords[rgb];
6054
6055       if (reversed) {
6056         return reversed;
6057       }
6058
6059       var currentClosestDistance = Infinity;
6060       var currentClosestKeyword;
6061
6062       for (var keyword in colorName) {
6063         if (colorName.hasOwnProperty(keyword)) {
6064           var value = colorName[keyword]; // Compute comparative distance
6065
6066           var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
6067
6068           if (distance < currentClosestDistance) {
6069             currentClosestDistance = distance;
6070             currentClosestKeyword = keyword;
6071           }
6072         }
6073       }
6074
6075       return currentClosestKeyword;
6076     };
6077
6078     convert.keyword.rgb = function (keyword) {
6079       return colorName[keyword];
6080     };
6081
6082     convert.rgb.xyz = function (rgb) {
6083       var r = rgb[0] / 255;
6084       var g = rgb[1] / 255;
6085       var b = rgb[2] / 255; // assume sRGB
6086
6087       r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
6088       g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
6089       b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
6090       var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
6091       var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
6092       var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
6093       return [x * 100, y * 100, z * 100];
6094     };
6095
6096     convert.rgb.lab = function (rgb) {
6097       var xyz = convert.rgb.xyz(rgb);
6098       var x = xyz[0];
6099       var y = xyz[1];
6100       var z = xyz[2];
6101       var l;
6102       var a;
6103       var b;
6104       x /= 95.047;
6105       y /= 100;
6106       z /= 108.883;
6107       x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
6108       y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
6109       z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
6110       l = 116 * y - 16;
6111       a = 500 * (x - y);
6112       b = 200 * (y - z);
6113       return [l, a, b];
6114     };
6115
6116     convert.hsl.rgb = function (hsl) {
6117       var h = hsl[0] / 360;
6118       var s = hsl[1] / 100;
6119       var l = hsl[2] / 100;
6120       var t1;
6121       var t2;
6122       var t3;
6123       var rgb;
6124       var val;
6125
6126       if (s === 0) {
6127         val = l * 255;
6128         return [val, val, val];
6129       }
6130
6131       if (l < 0.5) {
6132         t2 = l * (1 + s);
6133       } else {
6134         t2 = l + s - l * s;
6135       }
6136
6137       t1 = 2 * l - t2;
6138       rgb = [0, 0, 0];
6139
6140       for (var i = 0; i < 3; i++) {
6141         t3 = h + 1 / 3 * -(i - 1);
6142
6143         if (t3 < 0) {
6144           t3++;
6145         }
6146
6147         if (t3 > 1) {
6148           t3--;
6149         }
6150
6151         if (6 * t3 < 1) {
6152           val = t1 + (t2 - t1) * 6 * t3;
6153         } else if (2 * t3 < 1) {
6154           val = t2;
6155         } else if (3 * t3 < 2) {
6156           val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
6157         } else {
6158           val = t1;
6159         }
6160
6161         rgb[i] = val * 255;
6162       }
6163
6164       return rgb;
6165     };
6166
6167     convert.hsl.hsv = function (hsl) {
6168       var h = hsl[0];
6169       var s = hsl[1] / 100;
6170       var l = hsl[2] / 100;
6171       var smin = s;
6172       var lmin = Math.max(l, 0.01);
6173       var sv;
6174       var v;
6175       l *= 2;
6176       s *= l <= 1 ? l : 2 - l;
6177       smin *= lmin <= 1 ? lmin : 2 - lmin;
6178       v = (l + s) / 2;
6179       sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
6180       return [h, sv * 100, v * 100];
6181     };
6182
6183     convert.hsv.rgb = function (hsv) {
6184       var h = hsv[0] / 60;
6185       var s = hsv[1] / 100;
6186       var v = hsv[2] / 100;
6187       var hi = Math.floor(h) % 6;
6188       var f = h - Math.floor(h);
6189       var p = 255 * v * (1 - s);
6190       var q = 255 * v * (1 - s * f);
6191       var t = 255 * v * (1 - s * (1 - f));
6192       v *= 255;
6193
6194       switch (hi) {
6195         case 0:
6196           return [v, t, p];
6197
6198         case 1:
6199           return [q, v, p];
6200
6201         case 2:
6202           return [p, v, t];
6203
6204         case 3:
6205           return [p, q, v];
6206
6207         case 4:
6208           return [t, p, v];
6209
6210         case 5:
6211           return [v, p, q];
6212       }
6213     };
6214
6215     convert.hsv.hsl = function (hsv) {
6216       var h = hsv[0];
6217       var s = hsv[1] / 100;
6218       var v = hsv[2] / 100;
6219       var vmin = Math.max(v, 0.01);
6220       var lmin;
6221       var sl;
6222       var l;
6223       l = (2 - s) * v;
6224       lmin = (2 - s) * vmin;
6225       sl = s * vmin;
6226       sl /= lmin <= 1 ? lmin : 2 - lmin;
6227       sl = sl || 0;
6228       l /= 2;
6229       return [h, sl * 100, l * 100];
6230     }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
6231
6232
6233     convert.hwb.rgb = function (hwb) {
6234       var h = hwb[0] / 360;
6235       var wh = hwb[1] / 100;
6236       var bl = hwb[2] / 100;
6237       var ratio = wh + bl;
6238       var i;
6239       var v;
6240       var f;
6241       var n; // wh + bl cant be > 1
6242
6243       if (ratio > 1) {
6244         wh /= ratio;
6245         bl /= ratio;
6246       }
6247
6248       i = Math.floor(6 * h);
6249       v = 1 - bl;
6250       f = 6 * h - i;
6251
6252       if ((i & 0x01) !== 0) {
6253         f = 1 - f;
6254       }
6255
6256       n = wh + f * (v - wh); // linear interpolation
6257
6258       var r;
6259       var g;
6260       var b;
6261
6262       switch (i) {
6263         default:
6264         case 6:
6265         case 0:
6266           r = v;
6267           g = n;
6268           b = wh;
6269           break;
6270
6271         case 1:
6272           r = n;
6273           g = v;
6274           b = wh;
6275           break;
6276
6277         case 2:
6278           r = wh;
6279           g = v;
6280           b = n;
6281           break;
6282
6283         case 3:
6284           r = wh;
6285           g = n;
6286           b = v;
6287           break;
6288
6289         case 4:
6290           r = n;
6291           g = wh;
6292           b = v;
6293           break;
6294
6295         case 5:
6296           r = v;
6297           g = wh;
6298           b = n;
6299           break;
6300       }
6301
6302       return [r * 255, g * 255, b * 255];
6303     };
6304
6305     convert.cmyk.rgb = function (cmyk) {
6306       var c = cmyk[0] / 100;
6307       var m = cmyk[1] / 100;
6308       var y = cmyk[2] / 100;
6309       var k = cmyk[3] / 100;
6310       var r;
6311       var g;
6312       var b;
6313       r = 1 - Math.min(1, c * (1 - k) + k);
6314       g = 1 - Math.min(1, m * (1 - k) + k);
6315       b = 1 - Math.min(1, y * (1 - k) + k);
6316       return [r * 255, g * 255, b * 255];
6317     };
6318
6319     convert.xyz.rgb = function (xyz) {
6320       var x = xyz[0] / 100;
6321       var y = xyz[1] / 100;
6322       var z = xyz[2] / 100;
6323       var r;
6324       var g;
6325       var b;
6326       r = x * 3.2406 + y * -1.5372 + z * -0.4986;
6327       g = x * -0.9689 + y * 1.8758 + z * 0.0415;
6328       b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
6329
6330       r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
6331       g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
6332       b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
6333       r = Math.min(Math.max(0, r), 1);
6334       g = Math.min(Math.max(0, g), 1);
6335       b = Math.min(Math.max(0, b), 1);
6336       return [r * 255, g * 255, b * 255];
6337     };
6338
6339     convert.xyz.lab = function (xyz) {
6340       var x = xyz[0];
6341       var y = xyz[1];
6342       var z = xyz[2];
6343       var l;
6344       var a;
6345       var b;
6346       x /= 95.047;
6347       y /= 100;
6348       z /= 108.883;
6349       x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
6350       y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
6351       z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
6352       l = 116 * y - 16;
6353       a = 500 * (x - y);
6354       b = 200 * (y - z);
6355       return [l, a, b];
6356     };
6357
6358     convert.lab.xyz = function (lab) {
6359       var l = lab[0];
6360       var a = lab[1];
6361       var b = lab[2];
6362       var x;
6363       var y;
6364       var z;
6365       y = (l + 16) / 116;
6366       x = a / 500 + y;
6367       z = y - b / 200;
6368       var y2 = Math.pow(y, 3);
6369       var x2 = Math.pow(x, 3);
6370       var z2 = Math.pow(z, 3);
6371       y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
6372       x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
6373       z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
6374       x *= 95.047;
6375       y *= 100;
6376       z *= 108.883;
6377       return [x, y, z];
6378     };
6379
6380     convert.lab.lch = function (lab) {
6381       var l = lab[0];
6382       var a = lab[1];
6383       var b = lab[2];
6384       var hr;
6385       var h;
6386       var c;
6387       hr = Math.atan2(b, a);
6388       h = hr * 360 / 2 / Math.PI;
6389
6390       if (h < 0) {
6391         h += 360;
6392       }
6393
6394       c = Math.sqrt(a * a + b * b);
6395       return [l, c, h];
6396     };
6397
6398     convert.lch.lab = function (lch) {
6399       var l = lch[0];
6400       var c = lch[1];
6401       var h = lch[2];
6402       var a;
6403       var b;
6404       var hr;
6405       hr = h / 360 * 2 * Math.PI;
6406       a = c * Math.cos(hr);
6407       b = c * Math.sin(hr);
6408       return [l, a, b];
6409     };
6410
6411     convert.rgb.ansi16 = function (args) {
6412       var r = args[0];
6413       var g = args[1];
6414       var b = args[2];
6415       var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
6416
6417       value = Math.round(value / 50);
6418
6419       if (value === 0) {
6420         return 30;
6421       }
6422
6423       var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
6424
6425       if (value === 2) {
6426         ansi += 60;
6427       }
6428
6429       return ansi;
6430     };
6431
6432     convert.hsv.ansi16 = function (args) {
6433       // optimization here; we already know the value and don't need to get
6434       // it converted for us.
6435       return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
6436     };
6437
6438     convert.rgb.ansi256 = function (args) {
6439       var r = args[0];
6440       var g = args[1];
6441       var b = args[2]; // we use the extended greyscale palette here, with the exception of
6442       // black and white. normal palette only has 4 greyscale shades.
6443
6444       if (r === g && g === b) {
6445         if (r < 8) {
6446           return 16;
6447         }
6448
6449         if (r > 248) {
6450           return 231;
6451         }
6452
6453         return Math.round((r - 8) / 247 * 24) + 232;
6454       }
6455
6456       var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
6457       return ansi;
6458     };
6459
6460     convert.ansi16.rgb = function (args) {
6461       var color = args % 10; // handle greyscale
6462
6463       if (color === 0 || color === 7) {
6464         if (args > 50) {
6465           color += 3.5;
6466         }
6467
6468         color = color / 10.5 * 255;
6469         return [color, color, color];
6470       }
6471
6472       var mult = (~~(args > 50) + 1) * 0.5;
6473       var r = (color & 1) * mult * 255;
6474       var g = (color >> 1 & 1) * mult * 255;
6475       var b = (color >> 2 & 1) * mult * 255;
6476       return [r, g, b];
6477     };
6478
6479     convert.ansi256.rgb = function (args) {
6480       // handle greyscale
6481       if (args >= 232) {
6482         var c = (args - 232) * 10 + 8;
6483         return [c, c, c];
6484       }
6485
6486       args -= 16;
6487       var rem;
6488       var r = Math.floor(args / 36) / 5 * 255;
6489       var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
6490       var b = rem % 6 / 5 * 255;
6491       return [r, g, b];
6492     };
6493
6494     convert.rgb.hex = function (args) {
6495       var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
6496       var string = integer.toString(16).toUpperCase();
6497       return '000000'.substring(string.length) + string;
6498     };
6499
6500     convert.hex.rgb = function (args) {
6501       var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
6502
6503       if (!match) {
6504         return [0, 0, 0];
6505       }
6506
6507       var colorString = match[0];
6508
6509       if (match[0].length === 3) {
6510         colorString = colorString.split('').map(function (char) {
6511           return char + char;
6512         }).join('');
6513       }
6514
6515       var integer = parseInt(colorString, 16);
6516       var r = integer >> 16 & 0xFF;
6517       var g = integer >> 8 & 0xFF;
6518       var b = integer & 0xFF;
6519       return [r, g, b];
6520     };
6521
6522     convert.rgb.hcg = function (rgb) {
6523       var r = rgb[0] / 255;
6524       var g = rgb[1] / 255;
6525       var b = rgb[2] / 255;
6526       var max = Math.max(Math.max(r, g), b);
6527       var min = Math.min(Math.min(r, g), b);
6528       var chroma = max - min;
6529       var grayscale;
6530       var hue;
6531
6532       if (chroma < 1) {
6533         grayscale = min / (1 - chroma);
6534       } else {
6535         grayscale = 0;
6536       }
6537
6538       if (chroma <= 0) {
6539         hue = 0;
6540       } else if (max === r) {
6541         hue = (g - b) / chroma % 6;
6542       } else if (max === g) {
6543         hue = 2 + (b - r) / chroma;
6544       } else {
6545         hue = 4 + (r - g) / chroma + 4;
6546       }
6547
6548       hue /= 6;
6549       hue %= 1;
6550       return [hue * 360, chroma * 100, grayscale * 100];
6551     };
6552
6553     convert.hsl.hcg = function (hsl) {
6554       var s = hsl[1] / 100;
6555       var l = hsl[2] / 100;
6556       var c = 1;
6557       var f = 0;
6558
6559       if (l < 0.5) {
6560         c = 2.0 * s * l;
6561       } else {
6562         c = 2.0 * s * (1.0 - l);
6563       }
6564
6565       if (c < 1.0) {
6566         f = (l - 0.5 * c) / (1.0 - c);
6567       }
6568
6569       return [hsl[0], c * 100, f * 100];
6570     };
6571
6572     convert.hsv.hcg = function (hsv) {
6573       var s = hsv[1] / 100;
6574       var v = hsv[2] / 100;
6575       var c = s * v;
6576       var f = 0;
6577
6578       if (c < 1.0) {
6579         f = (v - c) / (1 - c);
6580       }
6581
6582       return [hsv[0], c * 100, f * 100];
6583     };
6584
6585     convert.hcg.rgb = function (hcg) {
6586       var h = hcg[0] / 360;
6587       var c = hcg[1] / 100;
6588       var g = hcg[2] / 100;
6589
6590       if (c === 0.0) {
6591         return [g * 255, g * 255, g * 255];
6592       }
6593
6594       var pure = [0, 0, 0];
6595       var hi = h % 1 * 6;
6596       var v = hi % 1;
6597       var w = 1 - v;
6598       var mg = 0;
6599
6600       switch (Math.floor(hi)) {
6601         case 0:
6602           pure[0] = 1;
6603           pure[1] = v;
6604           pure[2] = 0;
6605           break;
6606
6607         case 1:
6608           pure[0] = w;
6609           pure[1] = 1;
6610           pure[2] = 0;
6611           break;
6612
6613         case 2:
6614           pure[0] = 0;
6615           pure[1] = 1;
6616           pure[2] = v;
6617           break;
6618
6619         case 3:
6620           pure[0] = 0;
6621           pure[1] = w;
6622           pure[2] = 1;
6623           break;
6624
6625         case 4:
6626           pure[0] = v;
6627           pure[1] = 0;
6628           pure[2] = 1;
6629           break;
6630
6631         default:
6632           pure[0] = 1;
6633           pure[1] = 0;
6634           pure[2] = w;
6635       }
6636
6637       mg = (1.0 - c) * g;
6638       return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
6639     };
6640
6641     convert.hcg.hsv = function (hcg) {
6642       var c = hcg[1] / 100;
6643       var g = hcg[2] / 100;
6644       var v = c + g * (1.0 - c);
6645       var f = 0;
6646
6647       if (v > 0.0) {
6648         f = c / v;
6649       }
6650
6651       return [hcg[0], f * 100, v * 100];
6652     };
6653
6654     convert.hcg.hsl = function (hcg) {
6655       var c = hcg[1] / 100;
6656       var g = hcg[2] / 100;
6657       var l = g * (1.0 - c) + 0.5 * c;
6658       var s = 0;
6659
6660       if (l > 0.0 && l < 0.5) {
6661         s = c / (2 * l);
6662       } else if (l >= 0.5 && l < 1.0) {
6663         s = c / (2 * (1 - l));
6664       }
6665
6666       return [hcg[0], s * 100, l * 100];
6667     };
6668
6669     convert.hcg.hwb = function (hcg) {
6670       var c = hcg[1] / 100;
6671       var g = hcg[2] / 100;
6672       var v = c + g * (1.0 - c);
6673       return [hcg[0], (v - c) * 100, (1 - v) * 100];
6674     };
6675
6676     convert.hwb.hcg = function (hwb) {
6677       var w = hwb[1] / 100;
6678       var b = hwb[2] / 100;
6679       var v = 1 - b;
6680       var c = v - w;
6681       var g = 0;
6682
6683       if (c < 1) {
6684         g = (v - c) / (1 - c);
6685       }
6686
6687       return [hwb[0], c * 100, g * 100];
6688     };
6689
6690     convert.apple.rgb = function (apple) {
6691       return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
6692     };
6693
6694     convert.rgb.apple = function (rgb) {
6695       return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
6696     };
6697
6698     convert.gray.rgb = function (args) {
6699       return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
6700     };
6701
6702     convert.gray.hsl = convert.gray.hsv = function (args) {
6703       return [0, 0, args[0]];
6704     };
6705
6706     convert.gray.hwb = function (gray) {
6707       return [0, 100, gray[0]];
6708     };
6709
6710     convert.gray.cmyk = function (gray) {
6711       return [0, 0, 0, gray[0]];
6712     };
6713
6714     convert.gray.lab = function (gray) {
6715       return [gray[0], 0, 0];
6716     };
6717
6718     convert.gray.hex = function (gray) {
6719       var val = Math.round(gray[0] / 100 * 255) & 0xFF;
6720       var integer = (val << 16) + (val << 8) + val;
6721       var string = integer.toString(16).toUpperCase();
6722       return '000000'.substring(string.length) + string;
6723     };
6724
6725     convert.rgb.gray = function (rgb) {
6726       var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
6727       return [val / 255 * 100];
6728     };
6729   });
6730   var conversions_1 = conversions.rgb;
6731   var conversions_2 = conversions.hsl;
6732   var conversions_3 = conversions.hsv;
6733   var conversions_4 = conversions.hwb;
6734   var conversions_5 = conversions.cmyk;
6735   var conversions_6 = conversions.xyz;
6736   var conversions_7 = conversions.lab;
6737   var conversions_8 = conversions.lch;
6738   var conversions_9 = conversions.hex;
6739   var conversions_10 = conversions.keyword;
6740   var conversions_11 = conversions.ansi16;
6741   var conversions_12 = conversions.ansi256;
6742   var conversions_13 = conversions.hcg;
6743   var conversions_14 = conversions.apple;
6744   var conversions_15 = conversions.gray;
6745
6746   /*
6747         this function routes a model to all other models.
6748
6749         all functions that are routed have a property `.conversion` attached
6750         to the returned synthetic function. This property is an array
6751         of strings, each with the steps in between the 'from' and 'to'
6752         color models (inclusive).
6753
6754         conversions that are not possible simply are not included.
6755   */
6756
6757   function buildGraph() {
6758     var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
6759
6760     var models = Object.keys(conversions);
6761
6762     for (var len = models.length, i = 0; i < len; i++) {
6763       graph[models[i]] = {
6764         // http://jsperf.com/1-vs-infinity
6765         // micro-opt, but this is simple.
6766         distance: -1,
6767         parent: null
6768       };
6769     }
6770
6771     return graph;
6772   } // https://en.wikipedia.org/wiki/Breadth-first_search
6773
6774
6775   function deriveBFS(fromModel) {
6776     var graph = buildGraph();
6777     var queue = [fromModel]; // unshift -> queue -> pop
6778
6779     graph[fromModel].distance = 0;
6780
6781     while (queue.length) {
6782       var current = queue.pop();
6783       var adjacents = Object.keys(conversions[current]);
6784
6785       for (var len = adjacents.length, i = 0; i < len; i++) {
6786         var adjacent = adjacents[i];
6787         var node = graph[adjacent];
6788
6789         if (node.distance === -1) {
6790           node.distance = graph[current].distance + 1;
6791           node.parent = current;
6792           queue.unshift(adjacent);
6793         }
6794       }
6795     }
6796
6797     return graph;
6798   }
6799
6800   function link(from, to) {
6801     return function (args) {
6802       return to(from(args));
6803     };
6804   }
6805
6806   function wrapConversion(toModel, graph) {
6807     var path = [graph[toModel].parent, toModel];
6808     var fn = conversions[graph[toModel].parent][toModel];
6809     var cur = graph[toModel].parent;
6810
6811     while (graph[cur].parent) {
6812       path.unshift(graph[cur].parent);
6813       fn = link(conversions[graph[cur].parent][cur], fn);
6814       cur = graph[cur].parent;
6815     }
6816
6817     fn.conversion = path;
6818     return fn;
6819   }
6820
6821   var route = function route(fromModel) {
6822     var graph = deriveBFS(fromModel);
6823     var conversion = {};
6824     var models = Object.keys(graph);
6825
6826     for (var len = models.length, i = 0; i < len; i++) {
6827       var toModel = models[i];
6828       var node = graph[toModel];
6829
6830       if (node.parent === null) {
6831         // no possible conversion, or this node is the source model.
6832         continue;
6833       }
6834
6835       conversion[toModel] = wrapConversion(toModel, graph);
6836     }
6837
6838     return conversion;
6839   };
6840
6841   var convert = {};
6842   var models = Object.keys(conversions);
6843
6844   function wrapRaw(fn) {
6845     var wrappedFn = function wrappedFn(args) {
6846       if (args === undefined || args === null) {
6847         return args;
6848       }
6849
6850       if (arguments.length > 1) {
6851         args = Array.prototype.slice.call(arguments);
6852       }
6853
6854       return fn(args);
6855     }; // preserve .conversion property if there is one
6856
6857
6858     if ('conversion' in fn) {
6859       wrappedFn.conversion = fn.conversion;
6860     }
6861
6862     return wrappedFn;
6863   }
6864
6865   function wrapRounded(fn) {
6866     var wrappedFn = function wrappedFn(args) {
6867       if (args === undefined || args === null) {
6868         return args;
6869       }
6870
6871       if (arguments.length > 1) {
6872         args = Array.prototype.slice.call(arguments);
6873       }
6874
6875       var result = fn(args); // we're assuming the result is an array here.
6876       // see notice in conversions.js; don't use box types
6877       // in conversion functions.
6878
6879       if (typeof result === 'object') {
6880         for (var len = result.length, i = 0; i < len; i++) {
6881           result[i] = Math.round(result[i]);
6882         }
6883       }
6884
6885       return result;
6886     }; // preserve .conversion property if there is one
6887
6888
6889     if ('conversion' in fn) {
6890       wrappedFn.conversion = fn.conversion;
6891     }
6892
6893     return wrappedFn;
6894   }
6895
6896   models.forEach(function (fromModel) {
6897     convert[fromModel] = {};
6898     Object.defineProperty(convert[fromModel], 'channels', {
6899       value: conversions[fromModel].channels
6900     });
6901     Object.defineProperty(convert[fromModel], 'labels', {
6902       value: conversions[fromModel].labels
6903     });
6904     var routes = route(fromModel);
6905     var routeModels = Object.keys(routes);
6906     routeModels.forEach(function (toModel) {
6907       var fn = routes[toModel];
6908       convert[fromModel][toModel] = wrapRounded(fn);
6909       convert[fromModel][toModel].raw = wrapRaw(fn);
6910     });
6911   });
6912   var colorConvert = convert;
6913
6914   var ansiStyles = createCommonjsModule(function (module) {
6915
6916     const wrapAnsi16 = (fn, offset) => function () {
6917       const code = fn.apply(colorConvert, arguments);
6918       return "\x1B[".concat(code + offset, "m");
6919     };
6920
6921     const wrapAnsi256 = (fn, offset) => function () {
6922       const code = fn.apply(colorConvert, arguments);
6923       return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
6924     };
6925
6926     const wrapAnsi16m = (fn, offset) => function () {
6927       const rgb = fn.apply(colorConvert, arguments);
6928       return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
6929     };
6930
6931     function assembleStyles() {
6932       const codes = new Map();
6933       const styles = {
6934         modifier: {
6935           reset: [0, 0],
6936           // 21 isn't widely supported and 22 does the same thing
6937           bold: [1, 22],
6938           dim: [2, 22],
6939           italic: [3, 23],
6940           underline: [4, 24],
6941           inverse: [7, 27],
6942           hidden: [8, 28],
6943           strikethrough: [9, 29]
6944         },
6945         color: {
6946           black: [30, 39],
6947           red: [31, 39],
6948           green: [32, 39],
6949           yellow: [33, 39],
6950           blue: [34, 39],
6951           magenta: [35, 39],
6952           cyan: [36, 39],
6953           white: [37, 39],
6954           gray: [90, 39],
6955           // Bright color
6956           redBright: [91, 39],
6957           greenBright: [92, 39],
6958           yellowBright: [93, 39],
6959           blueBright: [94, 39],
6960           magentaBright: [95, 39],
6961           cyanBright: [96, 39],
6962           whiteBright: [97, 39]
6963         },
6964         bgColor: {
6965           bgBlack: [40, 49],
6966           bgRed: [41, 49],
6967           bgGreen: [42, 49],
6968           bgYellow: [43, 49],
6969           bgBlue: [44, 49],
6970           bgMagenta: [45, 49],
6971           bgCyan: [46, 49],
6972           bgWhite: [47, 49],
6973           // Bright color
6974           bgBlackBright: [100, 49],
6975           bgRedBright: [101, 49],
6976           bgGreenBright: [102, 49],
6977           bgYellowBright: [103, 49],
6978           bgBlueBright: [104, 49],
6979           bgMagentaBright: [105, 49],
6980           bgCyanBright: [106, 49],
6981           bgWhiteBright: [107, 49]
6982         }
6983       }; // Fix humans
6984
6985       styles.color.grey = styles.color.gray;
6986
6987       for (const groupName of Object.keys(styles)) {
6988         const group = styles[groupName];
6989
6990         for (const styleName of Object.keys(group)) {
6991           const style = group[styleName];
6992           styles[styleName] = {
6993             open: "\x1B[".concat(style[0], "m"),
6994             close: "\x1B[".concat(style[1], "m")
6995           };
6996           group[styleName] = styles[styleName];
6997           codes.set(style[0], style[1]);
6998         }
6999
7000         Object.defineProperty(styles, groupName, {
7001           value: group,
7002           enumerable: false
7003         });
7004         Object.defineProperty(styles, 'codes', {
7005           value: codes,
7006           enumerable: false
7007         });
7008       }
7009
7010       const ansi2ansi = n => n;
7011
7012       const rgb2rgb = (r, g, b) => [r, g, b];
7013
7014       styles.color.close = '\u001B[39m';
7015       styles.bgColor.close = '\u001B[49m';
7016       styles.color.ansi = {
7017         ansi: wrapAnsi16(ansi2ansi, 0)
7018       };
7019       styles.color.ansi256 = {
7020         ansi256: wrapAnsi256(ansi2ansi, 0)
7021       };
7022       styles.color.ansi16m = {
7023         rgb: wrapAnsi16m(rgb2rgb, 0)
7024       };
7025       styles.bgColor.ansi = {
7026         ansi: wrapAnsi16(ansi2ansi, 10)
7027       };
7028       styles.bgColor.ansi256 = {
7029         ansi256: wrapAnsi256(ansi2ansi, 10)
7030       };
7031       styles.bgColor.ansi16m = {
7032         rgb: wrapAnsi16m(rgb2rgb, 10)
7033       };
7034
7035       for (let key of Object.keys(colorConvert)) {
7036         if (typeof colorConvert[key] !== 'object') {
7037           continue;
7038         }
7039
7040         const suite = colorConvert[key];
7041
7042         if (key === 'ansi16') {
7043           key = 'ansi';
7044         }
7045
7046         if ('ansi16' in suite) {
7047           styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
7048           styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
7049         }
7050
7051         if ('ansi256' in suite) {
7052           styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
7053           styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
7054         }
7055
7056         if ('rgb' in suite) {
7057           styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
7058           styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
7059         }
7060       }
7061
7062       return styles;
7063     } // Make the export immutable
7064
7065
7066     Object.defineProperty(module, 'exports', {
7067       enumerable: true,
7068       get: assembleStyles
7069     });
7070   });
7071
7072   var require$$0$1 = {
7073     EOL: "\n"
7074   };
7075
7076   var hasFlag = (flag, argv) => {
7077     argv = argv || process.argv;
7078     const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
7079     const pos = argv.indexOf(prefix + flag);
7080     const terminatorPos = argv.indexOf('--');
7081     return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
7082   };
7083
7084   const env$1 = process.env;
7085   let forceColor;
7086
7087   if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
7088     forceColor = false;
7089   } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
7090     forceColor = true;
7091   }
7092
7093   if ('FORCE_COLOR' in env$1) {
7094     forceColor = env$1.FORCE_COLOR.length === 0 || parseInt(env$1.FORCE_COLOR, 10) !== 0;
7095   }
7096
7097   function translateLevel(level) {
7098     if (level === 0) {
7099       return false;
7100     }
7101
7102     return {
7103       level,
7104       hasBasic: true,
7105       has256: level >= 2,
7106       has16m: level >= 3
7107     };
7108   }
7109
7110   function supportsColor(stream) {
7111     if (forceColor === false) {
7112       return 0;
7113     }
7114
7115     if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
7116       return 3;
7117     }
7118
7119     if (hasFlag('color=256')) {
7120       return 2;
7121     }
7122
7123     if (stream && !stream.isTTY && forceColor !== true) {
7124       return 0;
7125     }
7126
7127     const min = forceColor ? 1 : 0;
7128
7129     if (process.platform === 'win32') {
7130       // Node.js 7.5.0 is the first version of Node.js to include a patch to
7131       // libuv that enables 256 color output on Windows. Anything earlier and it
7132       // won't work. However, here we target Node.js 8 at minimum as it is an LTS
7133       // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
7134       // release that supports 256 colors. Windows 10 build 14931 is the first release
7135       // that supports 16m/TrueColor.
7136       const osRelease = require$$0$1.release().split('.');
7137
7138       if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
7139         return Number(osRelease[2]) >= 14931 ? 3 : 2;
7140       }
7141
7142       return 1;
7143     }
7144
7145     if ('CI' in env$1) {
7146       if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') {
7147         return 1;
7148       }
7149
7150       return min;
7151     }
7152
7153     if ('TEAMCITY_VERSION' in env$1) {
7154       return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
7155     }
7156
7157     if (env$1.COLORTERM === 'truecolor') {
7158       return 3;
7159     }
7160
7161     if ('TERM_PROGRAM' in env$1) {
7162       const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
7163
7164       switch (env$1.TERM_PROGRAM) {
7165         case 'iTerm.app':
7166           return version >= 3 ? 3 : 2;
7167
7168         case 'Apple_Terminal':
7169           return 2;
7170         // No default
7171       }
7172     }
7173
7174     if (/-256(color)?$/i.test(env$1.TERM)) {
7175       return 2;
7176     }
7177
7178     if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
7179       return 1;
7180     }
7181
7182     if ('COLORTERM' in env$1) {
7183       return 1;
7184     }
7185
7186     if (env$1.TERM === 'dumb') {
7187       return min;
7188     }
7189
7190     return min;
7191   }
7192
7193   function getSupportLevel(stream) {
7194     const level = supportsColor(stream);
7195     return translateLevel(level);
7196   }
7197
7198   var supportsColor_1 = {
7199     supportsColor: getSupportLevel,
7200     stdout: getSupportLevel(process.stdout),
7201     stderr: getSupportLevel(process.stderr)
7202   };
7203
7204   const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
7205   const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
7206   const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
7207   const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
7208   const ESCAPES = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
7209
7210   function unescape(c) {
7211     if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
7212       return String.fromCharCode(parseInt(c.slice(1), 16));
7213     }
7214
7215     return ESCAPES.get(c) || c;
7216   }
7217
7218   function parseArguments(name, args) {
7219     const results = [];
7220     const chunks = args.trim().split(/\s*,\s*/g);
7221     let matches;
7222
7223     for (const chunk of chunks) {
7224       if (!isNaN(chunk)) {
7225         results.push(Number(chunk));
7226       } else if (matches = chunk.match(STRING_REGEX)) {
7227         results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
7228       } else {
7229         throw new Error("Invalid Chalk template style argument: ".concat(chunk, " (in style '").concat(name, "')"));
7230       }
7231     }
7232
7233     return results;
7234   }
7235
7236   function parseStyle(style) {
7237     STYLE_REGEX.lastIndex = 0;
7238     const results = [];
7239     let matches;
7240
7241     while ((matches = STYLE_REGEX.exec(style)) !== null) {
7242       const name = matches[1];
7243
7244       if (matches[2]) {
7245         const args = parseArguments(name, matches[2]);
7246         results.push([name].concat(args));
7247       } else {
7248         results.push([name]);
7249       }
7250     }
7251
7252     return results;
7253   }
7254
7255   function buildStyle(chalk, styles) {
7256     const enabled = {};
7257
7258     for (const layer of styles) {
7259       for (const style of layer.styles) {
7260         enabled[style[0]] = layer.inverse ? null : style.slice(1);
7261       }
7262     }
7263
7264     let current = chalk;
7265
7266     for (const styleName of Object.keys(enabled)) {
7267       if (Array.isArray(enabled[styleName])) {
7268         if (!(styleName in current)) {
7269           throw new Error("Unknown Chalk style: ".concat(styleName));
7270         }
7271
7272         if (enabled[styleName].length > 0) {
7273           current = current[styleName].apply(current, enabled[styleName]);
7274         } else {
7275           current = current[styleName];
7276         }
7277       }
7278     }
7279
7280     return current;
7281   }
7282
7283   var templates = (chalk, tmp) => {
7284     const styles = [];
7285     const chunks = [];
7286     let chunk = []; // eslint-disable-next-line max-params
7287
7288     tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
7289       if (escapeChar) {
7290         chunk.push(unescape(escapeChar));
7291       } else if (style) {
7292         const str = chunk.join('');
7293         chunk = [];
7294         chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
7295         styles.push({
7296           inverse,
7297           styles: parseStyle(style)
7298         });
7299       } else if (close) {
7300         if (styles.length === 0) {
7301           throw new Error('Found extraneous } in Chalk template literal');
7302         }
7303
7304         chunks.push(buildStyle(chalk, styles)(chunk.join('')));
7305         chunk = [];
7306         styles.pop();
7307       } else {
7308         chunk.push(chr);
7309       }
7310     });
7311     chunks.push(chunk.join(''));
7312
7313     if (styles.length > 0) {
7314       const errMsg = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
7315       throw new Error(errMsg);
7316     }
7317
7318     return chunks.join('');
7319   };
7320
7321   var chalk = createCommonjsModule(function (module) {
7322
7323     const stdoutColor = supportsColor_1.stdout;
7324     const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
7325
7326     const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
7327
7328     const skipModels = new Set(['gray']);
7329     const styles = Object.create(null);
7330
7331     function applyOptions(obj, options) {
7332       options = options || {}; // Detect level if not set manually
7333
7334       const scLevel = stdoutColor ? stdoutColor.level : 0;
7335       obj.level = options.level === undefined ? scLevel : options.level;
7336       obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
7337     }
7338
7339     function Chalk(options) {
7340       // We check for this.template here since calling `chalk.constructor()`
7341       // by itself will have a `this` of a previously constructed chalk object
7342       if (!this || !(this instanceof Chalk) || this.template) {
7343         const chalk = {};
7344         applyOptions(chalk, options);
7345
7346         chalk.template = function () {
7347           const args = [].slice.call(arguments);
7348           return chalkTag.apply(null, [chalk.template].concat(args));
7349         };
7350
7351         Object.setPrototypeOf(chalk, Chalk.prototype);
7352         Object.setPrototypeOf(chalk.template, chalk);
7353         chalk.template.constructor = Chalk;
7354         return chalk.template;
7355       }
7356
7357       applyOptions(this, options);
7358     } // Use bright blue on Windows as the normal blue color is illegible
7359
7360
7361     if (isSimpleWindowsTerm) {
7362       ansiStyles.blue.open = '\u001B[94m';
7363     }
7364
7365     for (const key of Object.keys(ansiStyles)) {
7366       ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
7367       styles[key] = {
7368         get() {
7369           const codes = ansiStyles[key];
7370           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
7371         }
7372
7373       };
7374     }
7375
7376     styles.visible = {
7377       get() {
7378         return build.call(this, this._styles || [], true, 'visible');
7379       }
7380
7381     };
7382     ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
7383
7384     for (const model of Object.keys(ansiStyles.color.ansi)) {
7385       if (skipModels.has(model)) {
7386         continue;
7387       }
7388
7389       styles[model] = {
7390         get() {
7391           const level = this.level;
7392           return function () {
7393             const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
7394             const codes = {
7395               open,
7396               close: ansiStyles.color.close,
7397               closeRe: ansiStyles.color.closeRe
7398             };
7399             return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
7400           };
7401         }
7402
7403       };
7404     }
7405
7406     ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
7407
7408     for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
7409       if (skipModels.has(model)) {
7410         continue;
7411       }
7412
7413       const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
7414       styles[bgModel] = {
7415         get() {
7416           const level = this.level;
7417           return function () {
7418             const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
7419             const codes = {
7420               open,
7421               close: ansiStyles.bgColor.close,
7422               closeRe: ansiStyles.bgColor.closeRe
7423             };
7424             return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
7425           };
7426         }
7427
7428       };
7429     }
7430
7431     const proto = Object.defineProperties(() => {}, styles);
7432
7433     function build(_styles, _empty, key) {
7434       const builder = function builder() {
7435         return applyStyle.apply(builder, arguments);
7436       };
7437
7438       builder._styles = _styles;
7439       builder._empty = _empty;
7440       const self = this;
7441       Object.defineProperty(builder, 'level', {
7442         enumerable: true,
7443
7444         get() {
7445           return self.level;
7446         },
7447
7448         set(level) {
7449           self.level = level;
7450         }
7451
7452       });
7453       Object.defineProperty(builder, 'enabled', {
7454         enumerable: true,
7455
7456         get() {
7457           return self.enabled;
7458         },
7459
7460         set(enabled) {
7461           self.enabled = enabled;
7462         }
7463
7464       }); // See below for fix regarding invisible grey/dim combination on Windows
7465
7466       builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
7467       // no way to create a function with a different prototype
7468
7469       builder.__proto__ = proto; // eslint-disable-line no-proto
7470
7471       return builder;
7472     }
7473
7474     function applyStyle() {
7475       // Support varags, but simply cast to string in case there's only one arg
7476       const args = arguments;
7477       const argsLen = args.length;
7478       let str = String(arguments[0]);
7479
7480       if (argsLen === 0) {
7481         return '';
7482       }
7483
7484       if (argsLen > 1) {
7485         // Don't slice `arguments`, it prevents V8 optimizations
7486         for (let a = 1; a < argsLen; a++) {
7487           str += ' ' + args[a];
7488         }
7489       }
7490
7491       if (!this.enabled || this.level <= 0 || !str) {
7492         return this._empty ? '' : str;
7493       } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
7494       // see https://github.com/chalk/chalk/issues/58
7495       // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
7496
7497
7498       const originalDim = ansiStyles.dim.open;
7499
7500       if (isSimpleWindowsTerm && this.hasGrey) {
7501         ansiStyles.dim.open = '';
7502       }
7503
7504       for (const code of this._styles.slice().reverse()) {
7505         // Replace any instances already present with a re-opening code
7506         // otherwise only the part of the string until said closing code
7507         // will be colored, and the rest will simply be 'plain'.
7508         str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
7509         // after next line to fix a bleed issue on macOS
7510         // https://github.com/chalk/chalk/pull/92
7511
7512         str = str.replace(/\r?\n/g, "".concat(code.close, "$&").concat(code.open));
7513       } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
7514
7515
7516       ansiStyles.dim.open = originalDim;
7517       return str;
7518     }
7519
7520     function chalkTag(chalk, strings) {
7521       if (!Array.isArray(strings)) {
7522         // If chalk() was called by itself or with a string,
7523         // return the string itself as a string.
7524         return [].slice.call(arguments, 1).join(' ');
7525       }
7526
7527       const args = [].slice.call(arguments, 2);
7528       const parts = [strings.raw[0]];
7529
7530       for (let i = 1; i < strings.length; i++) {
7531         parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
7532         parts.push(String(strings.raw[i]));
7533       }
7534
7535       return templates(chalk, parts.join(''));
7536     }
7537
7538     Object.defineProperties(Chalk.prototype, styles);
7539     module.exports = Chalk(); // eslint-disable-line new-cap
7540
7541     module.exports.supportsColor = stdoutColor;
7542     module.exports.default = module.exports; // For TypeScript
7543   });
7544   var chalk_1 = chalk.supportsColor;
7545
7546   var common = createCommonjsModule(function (module, exports) {
7547
7548     Object.defineProperty(exports, "__esModule", {
7549       value: true
7550     });
7551
7552     exports.commonDeprecatedHandler = (keyOrPair, redirectTo, {
7553       descriptor
7554     }) => {
7555       const messages = ["".concat(chalk.default.yellow(typeof keyOrPair === 'string' ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair)), " is deprecated")];
7556
7557       if (redirectTo) {
7558         messages.push("we now treat it as ".concat(chalk.default.blue(typeof redirectTo === 'string' ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))));
7559       }
7560
7561       return messages.join('; ') + '.';
7562     };
7563   });
7564   unwrapExports(common);
7565   var common_1 = common.commonDeprecatedHandler;
7566
7567   var deprecated = createCommonjsModule(function (module, exports) {
7568
7569     Object.defineProperty(exports, "__esModule", {
7570       value: true
7571     });
7572
7573     tslib_1.__exportStar(common, exports);
7574   });
7575   unwrapExports(deprecated);
7576
7577   var common$1 = createCommonjsModule(function (module, exports) {
7578
7579     Object.defineProperty(exports, "__esModule", {
7580       value: true
7581     });
7582
7583     exports.commonInvalidHandler = (key, value, utils) => ["Invalid ".concat(chalk.default.red(utils.descriptor.key(key)), " value."), "Expected ".concat(chalk.default.blue(utils.schemas[key].expected(utils)), ","), "but received ".concat(chalk.default.red(utils.descriptor.value(value)), ".")].join(' ');
7584   });
7585   unwrapExports(common$1);
7586   var common_1$1 = common$1.commonInvalidHandler;
7587
7588   var invalid = createCommonjsModule(function (module, exports) {
7589
7590     Object.defineProperty(exports, "__esModule", {
7591       value: true
7592     });
7593
7594     tslib_1.__exportStar(common$1, exports);
7595   });
7596   unwrapExports(invalid);
7597
7598   /* eslint-disable no-nested-ternary */
7599
7600   var arr = [];
7601   var charCodeCache = [];
7602
7603   var leven = function leven(a, b) {
7604     if (a === b) {
7605       return 0;
7606     }
7607
7608     var swap = a; // Swapping the strings if `a` is longer than `b` so we know which one is the
7609     // shortest & which one is the longest
7610
7611     if (a.length > b.length) {
7612       a = b;
7613       b = swap;
7614     }
7615
7616     var aLen = a.length;
7617     var bLen = b.length;
7618
7619     if (aLen === 0) {
7620       return bLen;
7621     }
7622
7623     if (bLen === 0) {
7624       return aLen;
7625     } // Performing suffix trimming:
7626     // We can linearly drop suffix common to both strings since they
7627     // don't increase distance at all
7628     // Note: `~-` is the bitwise way to perform a `- 1` operation
7629
7630
7631     while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) {
7632       aLen--;
7633       bLen--;
7634     }
7635
7636     if (aLen === 0) {
7637       return bLen;
7638     } // Performing prefix trimming
7639     // We can linearly drop prefix common to both strings since they
7640     // don't increase distance at all
7641
7642
7643     var start = 0;
7644
7645     while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) {
7646       start++;
7647     }
7648
7649     aLen -= start;
7650     bLen -= start;
7651
7652     if (aLen === 0) {
7653       return bLen;
7654     }
7655
7656     var bCharCode;
7657     var ret;
7658     var tmp;
7659     var tmp2;
7660     var i = 0;
7661     var j = 0;
7662
7663     while (i < aLen) {
7664       charCodeCache[start + i] = a.charCodeAt(start + i);
7665       arr[i] = ++i;
7666     }
7667
7668     while (j < bLen) {
7669       bCharCode = b.charCodeAt(start + j);
7670       tmp = j++;
7671       ret = j;
7672
7673       for (i = 0; i < aLen; i++) {
7674         tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
7675         tmp = arr[i];
7676         ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
7677       }
7678     }
7679
7680     return ret;
7681   };
7682
7683   var leven_1 = createCommonjsModule(function (module, exports) {
7684
7685     Object.defineProperty(exports, "__esModule", {
7686       value: true
7687     });
7688
7689     exports.levenUnknownHandler = (key, value, {
7690       descriptor,
7691       logger,
7692       schemas
7693     }) => {
7694       const messages = ["Ignored unknown option ".concat(chalk.default.yellow(descriptor.pair({
7695         key,
7696         value
7697       })), ".")];
7698       const suggestion = Object.keys(schemas).sort().find(knownKey => leven(key, knownKey) < 3);
7699
7700       if (suggestion) {
7701         messages.push("Did you mean ".concat(chalk.default.blue(descriptor.key(suggestion)), "?"));
7702       }
7703
7704       logger.warn(messages.join(' '));
7705     };
7706   });
7707   unwrapExports(leven_1);
7708   var leven_2 = leven_1.levenUnknownHandler;
7709
7710   var unknown = createCommonjsModule(function (module, exports) {
7711
7712     Object.defineProperty(exports, "__esModule", {
7713       value: true
7714     });
7715
7716     tslib_1.__exportStar(leven_1, exports);
7717   });
7718   unwrapExports(unknown);
7719
7720   var handlers = createCommonjsModule(function (module, exports) {
7721
7722     Object.defineProperty(exports, "__esModule", {
7723       value: true
7724     });
7725
7726     tslib_1.__exportStar(deprecated, exports);
7727
7728     tslib_1.__exportStar(invalid, exports);
7729
7730     tslib_1.__exportStar(unknown, exports);
7731   });
7732   unwrapExports(handlers);
7733
7734   var schema = createCommonjsModule(function (module, exports) {
7735
7736     Object.defineProperty(exports, "__esModule", {
7737       value: true
7738     });
7739     const HANDLER_KEYS = ['default', 'expected', 'validate', 'deprecated', 'forward', 'redirect', 'overlap', 'preprocess', 'postprocess'];
7740
7741     function createSchema(SchemaConstructor, parameters) {
7742       const schema = new SchemaConstructor(parameters);
7743       const subSchema = Object.create(schema);
7744
7745       for (const handlerKey of HANDLER_KEYS) {
7746         if (handlerKey in parameters) {
7747           subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length);
7748         }
7749       }
7750
7751       return subSchema;
7752     }
7753
7754     exports.createSchema = createSchema;
7755
7756     class Schema {
7757       constructor(parameters) {
7758         this.name = parameters.name;
7759       }
7760
7761       static create(parameters) {
7762         // @ts-ignore: https://github.com/Microsoft/TypeScript/issues/5863
7763         return createSchema(this, parameters);
7764       }
7765
7766       default(_utils) {
7767         return undefined;
7768       } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length`
7769
7770
7771       expected(_utils) {
7772         return 'nothing';
7773       } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length`
7774
7775
7776       validate(_value, _utils) {
7777         return false;
7778       }
7779
7780       deprecated(_value, _utils) {
7781         return false;
7782       }
7783
7784       forward(_value, _utils) {
7785         return undefined;
7786       }
7787
7788       redirect(_value, _utils) {
7789         return undefined;
7790       }
7791
7792       overlap(currentValue, _newValue, _utils) {
7793         return currentValue;
7794       }
7795
7796       preprocess(value, _utils) {
7797         return value;
7798       }
7799
7800       postprocess(value, _utils) {
7801         return value;
7802       }
7803
7804     }
7805
7806     exports.Schema = Schema;
7807
7808     function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
7809       return typeof handler === 'function' ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler;
7810     }
7811   });
7812   unwrapExports(schema);
7813   var schema_1 = schema.createSchema;
7814   var schema_2 = schema.Schema;
7815
7816   var alias = createCommonjsModule(function (module, exports) {
7817
7818     Object.defineProperty(exports, "__esModule", {
7819       value: true
7820     });
7821
7822     class AliasSchema extends schema.Schema {
7823       constructor(parameters) {
7824         super(parameters);
7825         this._sourceName = parameters.sourceName;
7826       }
7827
7828       expected(utils) {
7829         return utils.schemas[this._sourceName].expected(utils);
7830       }
7831
7832       validate(value, utils) {
7833         return utils.schemas[this._sourceName].validate(value, utils);
7834       }
7835
7836       redirect(_value, _utils) {
7837         return this._sourceName;
7838       }
7839
7840     }
7841
7842     exports.AliasSchema = AliasSchema;
7843   });
7844   unwrapExports(alias);
7845   var alias_1 = alias.AliasSchema;
7846
7847   var any = createCommonjsModule(function (module, exports) {
7848
7849     Object.defineProperty(exports, "__esModule", {
7850       value: true
7851     });
7852
7853     class AnySchema extends schema.Schema {
7854       expected() {
7855         return 'anything';
7856       }
7857
7858       validate() {
7859         return true;
7860       }
7861
7862     }
7863
7864     exports.AnySchema = AnySchema;
7865   });
7866   unwrapExports(any);
7867   var any_1 = any.AnySchema;
7868
7869   var array = createCommonjsModule(function (module, exports) {
7870
7871     Object.defineProperty(exports, "__esModule", {
7872       value: true
7873     });
7874
7875     class ArraySchema extends schema.Schema {
7876       constructor(_a) {
7877         var {
7878           valueSchema,
7879           name = valueSchema.name
7880         } = _a,
7881             handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
7882
7883         super(Object.assign({}, handlers, {
7884           name
7885         }));
7886         this._valueSchema = valueSchema;
7887       }
7888
7889       expected(utils) {
7890         return "an array of ".concat(this._valueSchema.expected(utils));
7891       }
7892
7893       validate(value, utils) {
7894         if (!Array.isArray(value)) {
7895           return false;
7896         }
7897
7898         const invalidValues = [];
7899
7900         for (const subValue of value) {
7901           const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
7902
7903           if (subValidateResult !== true) {
7904             invalidValues.push(subValidateResult.value);
7905           }
7906         }
7907
7908         return invalidValues.length === 0 ? true : {
7909           value: invalidValues
7910         };
7911       }
7912
7913       deprecated(value, utils) {
7914         const deprecatedResult = [];
7915
7916         for (const subValue of value) {
7917           const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
7918
7919           if (subDeprecatedResult !== false) {
7920             deprecatedResult.push(...subDeprecatedResult.map(({
7921               value: deprecatedValue
7922             }) => ({
7923               value: [deprecatedValue]
7924             })));
7925           }
7926         }
7927
7928         return deprecatedResult;
7929       }
7930
7931       forward(value, utils) {
7932         const forwardResult = [];
7933
7934         for (const subValue of value) {
7935           const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
7936           forwardResult.push(...subForwardResult.map(wrapTransferResult));
7937         }
7938
7939         return forwardResult;
7940       }
7941
7942       redirect(value, utils) {
7943         const remain = [];
7944         const redirect = [];
7945
7946         for (const subValue of value) {
7947           const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
7948
7949           if ('remain' in subRedirectResult) {
7950             remain.push(subRedirectResult.remain);
7951           }
7952
7953           redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
7954         }
7955
7956         return remain.length === 0 ? {
7957           redirect
7958         } : {
7959           redirect,
7960           remain
7961         };
7962       }
7963
7964       overlap(currentValue, newValue) {
7965         return currentValue.concat(newValue);
7966       }
7967
7968     }
7969
7970     exports.ArraySchema = ArraySchema;
7971
7972     function wrapTransferResult({
7973       from,
7974       to
7975     }) {
7976       return {
7977         from: [from],
7978         to
7979       };
7980     }
7981   });
7982   unwrapExports(array);
7983   var array_1 = array.ArraySchema;
7984
7985   var boolean_1 = createCommonjsModule(function (module, exports) {
7986
7987     Object.defineProperty(exports, "__esModule", {
7988       value: true
7989     });
7990
7991     class BooleanSchema extends schema.Schema {
7992       expected() {
7993         return 'true or false';
7994       }
7995
7996       validate(value) {
7997         return typeof value === 'boolean';
7998       }
7999
8000     }
8001
8002     exports.BooleanSchema = BooleanSchema;
8003   });
8004   unwrapExports(boolean_1);
8005   var boolean_2 = boolean_1.BooleanSchema;
8006
8007   var utils = createCommonjsModule(function (module, exports) {
8008
8009     Object.defineProperty(exports, "__esModule", {
8010       value: true
8011     });
8012
8013     function recordFromArray(array, mainKey) {
8014       const record = Object.create(null);
8015
8016       for (const value of array) {
8017         const key = value[mainKey]; // istanbul ignore next
8018
8019         if (record[key]) {
8020           throw new Error("Duplicate ".concat(mainKey, " ").concat(JSON.stringify(key)));
8021         } // @ts-ignore
8022
8023
8024         record[key] = value;
8025       }
8026
8027       return record;
8028     }
8029
8030     exports.recordFromArray = recordFromArray;
8031
8032     function mapFromArray(array, mainKey) {
8033       const map = new Map();
8034
8035       for (const value of array) {
8036         const key = value[mainKey]; // istanbul ignore next
8037
8038         if (map.has(key)) {
8039           throw new Error("Duplicate ".concat(mainKey, " ").concat(JSON.stringify(key)));
8040         }
8041
8042         map.set(key, value);
8043       }
8044
8045       return map;
8046     }
8047
8048     exports.mapFromArray = mapFromArray;
8049
8050     function createAutoChecklist() {
8051       const map = Object.create(null);
8052       return id => {
8053         const idString = JSON.stringify(id);
8054
8055         if (map[idString]) {
8056           return true;
8057         }
8058
8059         map[idString] = true;
8060         return false;
8061       };
8062     }
8063
8064     exports.createAutoChecklist = createAutoChecklist;
8065
8066     function partition(array, predicate) {
8067       const trueArray = [];
8068       const falseArray = [];
8069
8070       for (const value of array) {
8071         if (predicate(value)) {
8072           trueArray.push(value);
8073         } else {
8074           falseArray.push(value);
8075         }
8076       }
8077
8078       return [trueArray, falseArray];
8079     }
8080
8081     exports.partition = partition;
8082
8083     function isInt(value) {
8084       return value === Math.floor(value);
8085     }
8086
8087     exports.isInt = isInt;
8088
8089     function comparePrimitive(a, b) {
8090       if (a === b) {
8091         return 0;
8092       }
8093
8094       const typeofA = typeof a;
8095       const typeofB = typeof b;
8096       const orders = ['undefined', 'object', 'boolean', 'number', 'string'];
8097
8098       if (typeofA !== typeofB) {
8099         return orders.indexOf(typeofA) - orders.indexOf(typeofB);
8100       }
8101
8102       if (typeofA !== 'string') {
8103         return Number(a) - Number(b);
8104       }
8105
8106       return a.localeCompare(b);
8107     }
8108
8109     exports.comparePrimitive = comparePrimitive;
8110
8111     function normalizeDefaultResult(result) {
8112       return result === undefined ? {} : result;
8113     }
8114
8115     exports.normalizeDefaultResult = normalizeDefaultResult;
8116
8117     function normalizeValidateResult(result, value) {
8118       return result === true ? true : result === false ? {
8119         value
8120       } : result;
8121     }
8122
8123     exports.normalizeValidateResult = normalizeValidateResult;
8124
8125     function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
8126       return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
8127         value
8128       }] : 'value' in result ? [result] : result.length === 0 ? false : result;
8129     }
8130
8131     exports.normalizeDeprecatedResult = normalizeDeprecatedResult;
8132
8133     function normalizeTransferResult(result, value) {
8134       return typeof result === 'string' || 'key' in result ? {
8135         from: value,
8136         to: result
8137       } : 'from' in result ? {
8138         from: result.from,
8139         to: result.to
8140       } : {
8141         from: value,
8142         to: result.to
8143       };
8144     }
8145
8146     exports.normalizeTransferResult = normalizeTransferResult;
8147
8148     function normalizeForwardResult(result, value) {
8149       return result === undefined ? [] : Array.isArray(result) ? result.map(transferResult => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
8150     }
8151
8152     exports.normalizeForwardResult = normalizeForwardResult;
8153
8154     function normalizeRedirectResult(result, value) {
8155       const redirect = normalizeForwardResult(typeof result === 'object' && 'redirect' in result ? result.redirect : result, value);
8156       return redirect.length === 0 ? {
8157         remain: value,
8158         redirect
8159       } : typeof result === 'object' && 'remain' in result ? {
8160         remain: result.remain,
8161         redirect
8162       } : {
8163         redirect
8164       };
8165     }
8166
8167     exports.normalizeRedirectResult = normalizeRedirectResult;
8168   });
8169   unwrapExports(utils);
8170   var utils_1 = utils.recordFromArray;
8171   var utils_2 = utils.mapFromArray;
8172   var utils_3 = utils.createAutoChecklist;
8173   var utils_4 = utils.partition;
8174   var utils_5 = utils.isInt;
8175   var utils_6 = utils.comparePrimitive;
8176   var utils_7 = utils.normalizeDefaultResult;
8177   var utils_8 = utils.normalizeValidateResult;
8178   var utils_9 = utils.normalizeDeprecatedResult;
8179   var utils_10 = utils.normalizeTransferResult;
8180   var utils_11 = utils.normalizeForwardResult;
8181   var utils_12 = utils.normalizeRedirectResult;
8182
8183   var choice = createCommonjsModule(function (module, exports) {
8184
8185     Object.defineProperty(exports, "__esModule", {
8186       value: true
8187     });
8188
8189     class ChoiceSchema extends schema.Schema {
8190       constructor(parameters) {
8191         super(parameters);
8192         this._choices = utils.mapFromArray(parameters.choices.map(choice => choice && typeof choice === 'object' ? choice : {
8193           value: choice
8194         }), 'value');
8195       }
8196
8197       expected({
8198         descriptor
8199       }) {
8200         const choiceValues = Array.from(this._choices.keys()).map(value => this._choices.get(value)).filter(choiceInfo => !choiceInfo.deprecated).map(choiceInfo => choiceInfo.value).sort(utils.comparePrimitive).map(descriptor.value);
8201         const head = choiceValues.slice(0, -2);
8202         const tail = choiceValues.slice(-2);
8203         return head.concat(tail.join(' or ')).join(', ');
8204       }
8205
8206       validate(value) {
8207         return this._choices.has(value);
8208       }
8209
8210       deprecated(value) {
8211         const choiceInfo = this._choices.get(value);
8212
8213         return choiceInfo && choiceInfo.deprecated ? {
8214           value
8215         } : false;
8216       }
8217
8218       forward(value) {
8219         const choiceInfo = this._choices.get(value);
8220
8221         return choiceInfo ? choiceInfo.forward : undefined;
8222       }
8223
8224       redirect(value) {
8225         const choiceInfo = this._choices.get(value);
8226
8227         return choiceInfo ? choiceInfo.redirect : undefined;
8228       }
8229
8230     }
8231
8232     exports.ChoiceSchema = ChoiceSchema;
8233   });
8234   unwrapExports(choice);
8235   var choice_1 = choice.ChoiceSchema;
8236
8237   var number = createCommonjsModule(function (module, exports) {
8238
8239     Object.defineProperty(exports, "__esModule", {
8240       value: true
8241     });
8242
8243     class NumberSchema extends schema.Schema {
8244       expected() {
8245         return 'a number';
8246       }
8247
8248       validate(value, _utils) {
8249         return typeof value === 'number';
8250       }
8251
8252     }
8253
8254     exports.NumberSchema = NumberSchema;
8255   });
8256   unwrapExports(number);
8257   var number_1 = number.NumberSchema;
8258
8259   var integer = createCommonjsModule(function (module, exports) {
8260
8261     Object.defineProperty(exports, "__esModule", {
8262       value: true
8263     });
8264
8265     class IntegerSchema extends number.NumberSchema {
8266       expected() {
8267         return 'an integer';
8268       }
8269
8270       validate(value, utils$1) {
8271         return utils$1.normalizeValidateResult(super.validate(value, utils$1), value) === true && utils.isInt(value);
8272       }
8273
8274     }
8275
8276     exports.IntegerSchema = IntegerSchema;
8277   });
8278   unwrapExports(integer);
8279   var integer_1 = integer.IntegerSchema;
8280
8281   var string = createCommonjsModule(function (module, exports) {
8282
8283     Object.defineProperty(exports, "__esModule", {
8284       value: true
8285     });
8286
8287     class StringSchema extends schema.Schema {
8288       expected() {
8289         return 'a string';
8290       }
8291
8292       validate(value) {
8293         return typeof value === 'string';
8294       }
8295
8296     }
8297
8298     exports.StringSchema = StringSchema;
8299   });
8300   unwrapExports(string);
8301   var string_1 = string.StringSchema;
8302
8303   var schemas = createCommonjsModule(function (module, exports) {
8304
8305     Object.defineProperty(exports, "__esModule", {
8306       value: true
8307     });
8308
8309     tslib_1.__exportStar(alias, exports);
8310
8311     tslib_1.__exportStar(any, exports);
8312
8313     tslib_1.__exportStar(array, exports);
8314
8315     tslib_1.__exportStar(boolean_1, exports);
8316
8317     tslib_1.__exportStar(choice, exports);
8318
8319     tslib_1.__exportStar(integer, exports);
8320
8321     tslib_1.__exportStar(number, exports);
8322
8323     tslib_1.__exportStar(string, exports);
8324   });
8325   unwrapExports(schemas);
8326
8327   var defaults = createCommonjsModule(function (module, exports) {
8328
8329     Object.defineProperty(exports, "__esModule", {
8330       value: true
8331     });
8332     exports.defaultDescriptor = api.apiDescriptor;
8333     exports.defaultUnknownHandler = leven_1.levenUnknownHandler;
8334     exports.defaultInvalidHandler = invalid.commonInvalidHandler;
8335     exports.defaultDeprecatedHandler = common.commonDeprecatedHandler;
8336   });
8337   unwrapExports(defaults);
8338   var defaults_1 = defaults.defaultDescriptor;
8339   var defaults_2 = defaults.defaultUnknownHandler;
8340   var defaults_3 = defaults.defaultInvalidHandler;
8341   var defaults_4 = defaults.defaultDeprecatedHandler;
8342
8343   var normalize = createCommonjsModule(function (module, exports) {
8344
8345     Object.defineProperty(exports, "__esModule", {
8346       value: true
8347     });
8348
8349     exports.normalize = (options, schemas, opts) => new Normalizer(schemas, opts).normalize(options);
8350
8351     class Normalizer {
8352       constructor(schemas, opts) {
8353         // istanbul ignore next
8354         const {
8355           logger = console,
8356           descriptor = defaults.defaultDescriptor,
8357           unknown = defaults.defaultUnknownHandler,
8358           invalid = defaults.defaultInvalidHandler,
8359           deprecated = defaults.defaultDeprecatedHandler
8360         } = opts || {};
8361         this._utils = {
8362           descriptor,
8363           logger:
8364           /* istanbul ignore next */
8365           logger || {
8366             warn: () => {}
8367           },
8368           schemas: utils.recordFromArray(schemas, 'name'),
8369           normalizeDefaultResult: utils.normalizeDefaultResult,
8370           normalizeDeprecatedResult: utils.normalizeDeprecatedResult,
8371           normalizeForwardResult: utils.normalizeForwardResult,
8372           normalizeRedirectResult: utils.normalizeRedirectResult,
8373           normalizeValidateResult: utils.normalizeValidateResult
8374         };
8375         this._unknownHandler = unknown;
8376         this._invalidHandler = invalid;
8377         this._deprecatedHandler = deprecated;
8378         this.cleanHistory();
8379       }
8380
8381       cleanHistory() {
8382         this._hasDeprecationWarned = utils.createAutoChecklist();
8383       }
8384
8385       normalize(options) {
8386         const normalized = {};
8387         const restOptionsArray = [options];
8388
8389         const applyNormalization = () => {
8390           while (restOptionsArray.length !== 0) {
8391             const currentOptions = restOptionsArray.shift();
8392
8393             const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
8394
8395             restOptionsArray.push(...transferredOptionsArray);
8396           }
8397         };
8398
8399         applyNormalization();
8400
8401         for (const key of Object.keys(this._utils.schemas)) {
8402           const schema = this._utils.schemas[key];
8403
8404           if (!(key in normalized)) {
8405             const defaultResult = utils.normalizeDefaultResult(schema.default(this._utils));
8406
8407             if ('value' in defaultResult) {
8408               restOptionsArray.push({
8409                 [key]: defaultResult.value
8410               });
8411             }
8412           }
8413         }
8414
8415         applyNormalization();
8416
8417         for (const key of Object.keys(this._utils.schemas)) {
8418           const schema = this._utils.schemas[key];
8419
8420           if (key in normalized) {
8421             normalized[key] = schema.postprocess(normalized[key], this._utils);
8422           }
8423         }
8424
8425         return normalized;
8426       }
8427
8428       _applyNormalization(options, normalized) {
8429         const transferredOptionsArray = [];
8430         const [knownOptionNames, unknownOptionNames] = utils.partition(Object.keys(options), key => key in this._utils.schemas);
8431
8432         for (const key of knownOptionNames) {
8433           const schema = this._utils.schemas[key];
8434           const value = schema.preprocess(options[key], this._utils);
8435           const validateResult = utils.normalizeValidateResult(schema.validate(value, this._utils), value);
8436
8437           if (validateResult !== true) {
8438             const {
8439               value: invalidValue
8440             } = validateResult;
8441
8442             const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils);
8443
8444             throw typeof errorMessageOrError === 'string' ? new Error(errorMessageOrError) :
8445             /* istanbul ignore next*/
8446             errorMessageOrError;
8447           }
8448
8449           const appendTransferredOptions = ({
8450             from,
8451             to
8452           }) => {
8453             transferredOptionsArray.push(typeof to === 'string' ? {
8454               [to]: from
8455             } : {
8456               [to.key]: to.value
8457             });
8458           };
8459
8460           const warnDeprecated = ({
8461             value: currentValue,
8462             redirectTo
8463           }) => {
8464             const deprecatedResult = utils.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value,
8465             /* doNotNormalizeTrue */
8466             true);
8467
8468             if (deprecatedResult === false) {
8469               return;
8470             }
8471
8472             if (deprecatedResult === true) {
8473               if (!this._hasDeprecationWarned(key)) {
8474                 this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
8475               }
8476             } else {
8477               for (const {
8478                 value: deprecatedValue
8479               } of deprecatedResult) {
8480                 const pair = {
8481                   key,
8482                   value: deprecatedValue
8483                 };
8484
8485                 if (!this._hasDeprecationWarned(pair)) {
8486                   const redirectToPair = typeof redirectTo === 'string' ? {
8487                     key: redirectTo,
8488                     value: deprecatedValue
8489                   } : redirectTo;
8490
8491                   this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
8492                 }
8493               }
8494             }
8495           };
8496
8497           const forwardResult = utils.normalizeForwardResult(schema.forward(value, this._utils), value);
8498           forwardResult.forEach(appendTransferredOptions);
8499           const redirectResult = utils.normalizeRedirectResult(schema.redirect(value, this._utils), value);
8500           redirectResult.redirect.forEach(appendTransferredOptions);
8501
8502           if ('remain' in redirectResult) {
8503             const remainingValue = redirectResult.remain;
8504             normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue;
8505             warnDeprecated({
8506               value: remainingValue
8507             });
8508           }
8509
8510           for (const {
8511             from,
8512             to
8513           } of redirectResult.redirect) {
8514             warnDeprecated({
8515               value: from,
8516               redirectTo: to
8517             });
8518           }
8519         }
8520
8521         for (const key of unknownOptionNames) {
8522           const value = options[key];
8523
8524           const unknownResult = this._unknownHandler(key, value, this._utils);
8525
8526           if (unknownResult) {
8527             for (const unknownKey of Object.keys(unknownResult)) {
8528               const unknownOption = {
8529                 [unknownKey]: unknownResult[unknownKey]
8530               };
8531
8532               if (unknownKey in this._utils.schemas) {
8533                 transferredOptionsArray.push(unknownOption);
8534               } else {
8535                 Object.assign(normalized, unknownOption);
8536               }
8537             }
8538           }
8539         }
8540
8541         return transferredOptionsArray;
8542       }
8543
8544     }
8545
8546     exports.Normalizer = Normalizer;
8547   });
8548   unwrapExports(normalize);
8549   var normalize_1 = normalize.normalize;
8550   var normalize_2 = normalize.Normalizer;
8551
8552   var lib = createCommonjsModule(function (module, exports) {
8553
8554     Object.defineProperty(exports, "__esModule", {
8555       value: true
8556     });
8557
8558     tslib_1.__exportStar(descriptors, exports);
8559
8560     tslib_1.__exportStar(handlers, exports);
8561
8562     tslib_1.__exportStar(schemas, exports);
8563
8564     tslib_1.__exportStar(normalize, exports);
8565
8566     tslib_1.__exportStar(schema, exports);
8567   });
8568   unwrapExports(lib);
8569
8570   const array$1 = [];
8571   const charCodeCache$1 = [];
8572
8573   const leven$1 = (left, right) => {
8574     if (left === right) {
8575       return 0;
8576     }
8577
8578     const swap = left; // Swapping the strings if `a` is longer than `b` so we know which one is the
8579     // shortest & which one is the longest
8580
8581     if (left.length > right.length) {
8582       left = right;
8583       right = swap;
8584     }
8585
8586     let leftLength = left.length;
8587     let rightLength = right.length; // Performing suffix trimming:
8588     // We can linearly drop suffix common to both strings since they
8589     // don't increase distance at all
8590     // Note: `~-` is the bitwise way to perform a `- 1` operation
8591
8592     while (leftLength > 0 && left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength)) {
8593       leftLength--;
8594       rightLength--;
8595     } // Performing prefix trimming
8596     // We can linearly drop prefix common to both strings since they
8597     // don't increase distance at all
8598
8599
8600     let start = 0;
8601
8602     while (start < leftLength && left.charCodeAt(start) === right.charCodeAt(start)) {
8603       start++;
8604     }
8605
8606     leftLength -= start;
8607     rightLength -= start;
8608
8609     if (leftLength === 0) {
8610       return rightLength;
8611     }
8612
8613     let bCharCode;
8614     let result;
8615     let temp;
8616     let temp2;
8617     let i = 0;
8618     let j = 0;
8619
8620     while (i < leftLength) {
8621       charCodeCache$1[i] = left.charCodeAt(start + i);
8622       array$1[i] = ++i;
8623     }
8624
8625     while (j < rightLength) {
8626       bCharCode = right.charCodeAt(start + j);
8627       temp = j++;
8628       result = j;
8629
8630       for (i = 0; i < leftLength; i++) {
8631         temp2 = bCharCode === charCodeCache$1[i] ? temp : temp + 1;
8632         temp = array$1[i]; // eslint-disable-next-line no-multi-assign
8633
8634         result = array$1[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
8635       }
8636     }
8637
8638     return result;
8639   };
8640
8641   var leven_1$1 = leven$1; // TODO: Remove this for the next major release
8642
8643   var default_1 = leven$1;
8644   leven_1$1.default = default_1;
8645
8646   var colorName$1 = {
8647     "aliceblue": [240, 248, 255],
8648     "antiquewhite": [250, 235, 215],
8649     "aqua": [0, 255, 255],
8650     "aquamarine": [127, 255, 212],
8651     "azure": [240, 255, 255],
8652     "beige": [245, 245, 220],
8653     "bisque": [255, 228, 196],
8654     "black": [0, 0, 0],
8655     "blanchedalmond": [255, 235, 205],
8656     "blue": [0, 0, 255],
8657     "blueviolet": [138, 43, 226],
8658     "brown": [165, 42, 42],
8659     "burlywood": [222, 184, 135],
8660     "cadetblue": [95, 158, 160],
8661     "chartreuse": [127, 255, 0],
8662     "chocolate": [210, 105, 30],
8663     "coral": [255, 127, 80],
8664     "cornflowerblue": [100, 149, 237],
8665     "cornsilk": [255, 248, 220],
8666     "crimson": [220, 20, 60],
8667     "cyan": [0, 255, 255],
8668     "darkblue": [0, 0, 139],
8669     "darkcyan": [0, 139, 139],
8670     "darkgoldenrod": [184, 134, 11],
8671     "darkgray": [169, 169, 169],
8672     "darkgreen": [0, 100, 0],
8673     "darkgrey": [169, 169, 169],
8674     "darkkhaki": [189, 183, 107],
8675     "darkmagenta": [139, 0, 139],
8676     "darkolivegreen": [85, 107, 47],
8677     "darkorange": [255, 140, 0],
8678     "darkorchid": [153, 50, 204],
8679     "darkred": [139, 0, 0],
8680     "darksalmon": [233, 150, 122],
8681     "darkseagreen": [143, 188, 143],
8682     "darkslateblue": [72, 61, 139],
8683     "darkslategray": [47, 79, 79],
8684     "darkslategrey": [47, 79, 79],
8685     "darkturquoise": [0, 206, 209],
8686     "darkviolet": [148, 0, 211],
8687     "deeppink": [255, 20, 147],
8688     "deepskyblue": [0, 191, 255],
8689     "dimgray": [105, 105, 105],
8690     "dimgrey": [105, 105, 105],
8691     "dodgerblue": [30, 144, 255],
8692     "firebrick": [178, 34, 34],
8693     "floralwhite": [255, 250, 240],
8694     "forestgreen": [34, 139, 34],
8695     "fuchsia": [255, 0, 255],
8696     "gainsboro": [220, 220, 220],
8697     "ghostwhite": [248, 248, 255],
8698     "gold": [255, 215, 0],
8699     "goldenrod": [218, 165, 32],
8700     "gray": [128, 128, 128],
8701     "green": [0, 128, 0],
8702     "greenyellow": [173, 255, 47],
8703     "grey": [128, 128, 128],
8704     "honeydew": [240, 255, 240],
8705     "hotpink": [255, 105, 180],
8706     "indianred": [205, 92, 92],
8707     "indigo": [75, 0, 130],
8708     "ivory": [255, 255, 240],
8709     "khaki": [240, 230, 140],
8710     "lavender": [230, 230, 250],
8711     "lavenderblush": [255, 240, 245],
8712     "lawngreen": [124, 252, 0],
8713     "lemonchiffon": [255, 250, 205],
8714     "lightblue": [173, 216, 230],
8715     "lightcoral": [240, 128, 128],
8716     "lightcyan": [224, 255, 255],
8717     "lightgoldenrodyellow": [250, 250, 210],
8718     "lightgray": [211, 211, 211],
8719     "lightgreen": [144, 238, 144],
8720     "lightgrey": [211, 211, 211],
8721     "lightpink": [255, 182, 193],
8722     "lightsalmon": [255, 160, 122],
8723     "lightseagreen": [32, 178, 170],
8724     "lightskyblue": [135, 206, 250],
8725     "lightslategray": [119, 136, 153],
8726     "lightslategrey": [119, 136, 153],
8727     "lightsteelblue": [176, 196, 222],
8728     "lightyellow": [255, 255, 224],
8729     "lime": [0, 255, 0],
8730     "limegreen": [50, 205, 50],
8731     "linen": [250, 240, 230],
8732     "magenta": [255, 0, 255],
8733     "maroon": [128, 0, 0],
8734     "mediumaquamarine": [102, 205, 170],
8735     "mediumblue": [0, 0, 205],
8736     "mediumorchid": [186, 85, 211],
8737     "mediumpurple": [147, 112, 219],
8738     "mediumseagreen": [60, 179, 113],
8739     "mediumslateblue": [123, 104, 238],
8740     "mediumspringgreen": [0, 250, 154],
8741     "mediumturquoise": [72, 209, 204],
8742     "mediumvioletred": [199, 21, 133],
8743     "midnightblue": [25, 25, 112],
8744     "mintcream": [245, 255, 250],
8745     "mistyrose": [255, 228, 225],
8746     "moccasin": [255, 228, 181],
8747     "navajowhite": [255, 222, 173],
8748     "navy": [0, 0, 128],
8749     "oldlace": [253, 245, 230],
8750     "olive": [128, 128, 0],
8751     "olivedrab": [107, 142, 35],
8752     "orange": [255, 165, 0],
8753     "orangered": [255, 69, 0],
8754     "orchid": [218, 112, 214],
8755     "palegoldenrod": [238, 232, 170],
8756     "palegreen": [152, 251, 152],
8757     "paleturquoise": [175, 238, 238],
8758     "palevioletred": [219, 112, 147],
8759     "papayawhip": [255, 239, 213],
8760     "peachpuff": [255, 218, 185],
8761     "peru": [205, 133, 63],
8762     "pink": [255, 192, 203],
8763     "plum": [221, 160, 221],
8764     "powderblue": [176, 224, 230],
8765     "purple": [128, 0, 128],
8766     "rebeccapurple": [102, 51, 153],
8767     "red": [255, 0, 0],
8768     "rosybrown": [188, 143, 143],
8769     "royalblue": [65, 105, 225],
8770     "saddlebrown": [139, 69, 19],
8771     "salmon": [250, 128, 114],
8772     "sandybrown": [244, 164, 96],
8773     "seagreen": [46, 139, 87],
8774     "seashell": [255, 245, 238],
8775     "sienna": [160, 82, 45],
8776     "silver": [192, 192, 192],
8777     "skyblue": [135, 206, 235],
8778     "slateblue": [106, 90, 205],
8779     "slategray": [112, 128, 144],
8780     "slategrey": [112, 128, 144],
8781     "snow": [255, 250, 250],
8782     "springgreen": [0, 255, 127],
8783     "steelblue": [70, 130, 180],
8784     "tan": [210, 180, 140],
8785     "teal": [0, 128, 128],
8786     "thistle": [216, 191, 216],
8787     "tomato": [255, 99, 71],
8788     "turquoise": [64, 224, 208],
8789     "violet": [238, 130, 238],
8790     "wheat": [245, 222, 179],
8791     "white": [255, 255, 255],
8792     "whitesmoke": [245, 245, 245],
8793     "yellow": [255, 255, 0],
8794     "yellowgreen": [154, 205, 50]
8795   };
8796
8797   /* MIT license */
8798
8799   /* eslint-disable no-mixed-operators */
8800   // NOTE: conversions should only return primitive values (i.e. arrays, or
8801   //       values that give correct `typeof` results).
8802   //       do not use box values types (i.e. Number(), String(), etc.)
8803
8804   const reverseKeywords = {};
8805
8806   for (const key of Object.keys(colorName$1)) {
8807     reverseKeywords[colorName$1[key]] = key;
8808   }
8809
8810   const convert$1 = {
8811     rgb: {
8812       channels: 3,
8813       labels: 'rgb'
8814     },
8815     hsl: {
8816       channels: 3,
8817       labels: 'hsl'
8818     },
8819     hsv: {
8820       channels: 3,
8821       labels: 'hsv'
8822     },
8823     hwb: {
8824       channels: 3,
8825       labels: 'hwb'
8826     },
8827     cmyk: {
8828       channels: 4,
8829       labels: 'cmyk'
8830     },
8831     xyz: {
8832       channels: 3,
8833       labels: 'xyz'
8834     },
8835     lab: {
8836       channels: 3,
8837       labels: 'lab'
8838     },
8839     lch: {
8840       channels: 3,
8841       labels: 'lch'
8842     },
8843     hex: {
8844       channels: 1,
8845       labels: ['hex']
8846     },
8847     keyword: {
8848       channels: 1,
8849       labels: ['keyword']
8850     },
8851     ansi16: {
8852       channels: 1,
8853       labels: ['ansi16']
8854     },
8855     ansi256: {
8856       channels: 1,
8857       labels: ['ansi256']
8858     },
8859     hcg: {
8860       channels: 3,
8861       labels: ['h', 'c', 'g']
8862     },
8863     apple: {
8864       channels: 3,
8865       labels: ['r16', 'g16', 'b16']
8866     },
8867     gray: {
8868       channels: 1,
8869       labels: ['gray']
8870     }
8871   };
8872   var conversions$1 = convert$1; // Hide .channels and .labels properties
8873
8874   for (const model of Object.keys(convert$1)) {
8875     if (!('channels' in convert$1[model])) {
8876       throw new Error('missing channels property: ' + model);
8877     }
8878
8879     if (!('labels' in convert$1[model])) {
8880       throw new Error('missing channel labels property: ' + model);
8881     }
8882
8883     if (convert$1[model].labels.length !== convert$1[model].channels) {
8884       throw new Error('channel and label counts mismatch: ' + model);
8885     }
8886
8887     const {
8888       channels,
8889       labels
8890     } = convert$1[model];
8891     delete convert$1[model].channels;
8892     delete convert$1[model].labels;
8893     Object.defineProperty(convert$1[model], 'channels', {
8894       value: channels
8895     });
8896     Object.defineProperty(convert$1[model], 'labels', {
8897       value: labels
8898     });
8899   }
8900
8901   convert$1.rgb.hsl = function (rgb) {
8902     const r = rgb[0] / 255;
8903     const g = rgb[1] / 255;
8904     const b = rgb[2] / 255;
8905     const min = Math.min(r, g, b);
8906     const max = Math.max(r, g, b);
8907     const delta = max - min;
8908     let h;
8909     let s;
8910
8911     if (max === min) {
8912       h = 0;
8913     } else if (r === max) {
8914       h = (g - b) / delta;
8915     } else if (g === max) {
8916       h = 2 + (b - r) / delta;
8917     } else if (b === max) {
8918       h = 4 + (r - g) / delta;
8919     }
8920
8921     h = Math.min(h * 60, 360);
8922
8923     if (h < 0) {
8924       h += 360;
8925     }
8926
8927     const l = (min + max) / 2;
8928
8929     if (max === min) {
8930       s = 0;
8931     } else if (l <= 0.5) {
8932       s = delta / (max + min);
8933     } else {
8934       s = delta / (2 - max - min);
8935     }
8936
8937     return [h, s * 100, l * 100];
8938   };
8939
8940   convert$1.rgb.hsv = function (rgb) {
8941     let rdif;
8942     let gdif;
8943     let bdif;
8944     let h;
8945     let s;
8946     const r = rgb[0] / 255;
8947     const g = rgb[1] / 255;
8948     const b = rgb[2] / 255;
8949     const v = Math.max(r, g, b);
8950     const diff = v - Math.min(r, g, b);
8951
8952     const diffc = function diffc(c) {
8953       return (v - c) / 6 / diff + 1 / 2;
8954     };
8955
8956     if (diff === 0) {
8957       h = 0;
8958       s = 0;
8959     } else {
8960       s = diff / v;
8961       rdif = diffc(r);
8962       gdif = diffc(g);
8963       bdif = diffc(b);
8964
8965       if (r === v) {
8966         h = bdif - gdif;
8967       } else if (g === v) {
8968         h = 1 / 3 + rdif - bdif;
8969       } else if (b === v) {
8970         h = 2 / 3 + gdif - rdif;
8971       }
8972
8973       if (h < 0) {
8974         h += 1;
8975       } else if (h > 1) {
8976         h -= 1;
8977       }
8978     }
8979
8980     return [h * 360, s * 100, v * 100];
8981   };
8982
8983   convert$1.rgb.hwb = function (rgb) {
8984     const r = rgb[0];
8985     const g = rgb[1];
8986     let b = rgb[2];
8987     const h = convert$1.rgb.hsl(rgb)[0];
8988     const w = 1 / 255 * Math.min(r, Math.min(g, b));
8989     b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
8990     return [h, w * 100, b * 100];
8991   };
8992
8993   convert$1.rgb.cmyk = function (rgb) {
8994     const r = rgb[0] / 255;
8995     const g = rgb[1] / 255;
8996     const b = rgb[2] / 255;
8997     const k = Math.min(1 - r, 1 - g, 1 - b);
8998     const c = (1 - r - k) / (1 - k) || 0;
8999     const m = (1 - g - k) / (1 - k) || 0;
9000     const y = (1 - b - k) / (1 - k) || 0;
9001     return [c * 100, m * 100, y * 100, k * 100];
9002   };
9003
9004   function comparativeDistance(x, y) {
9005     /*
9006         See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
9007     */
9008     return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
9009   }
9010
9011   convert$1.rgb.keyword = function (rgb) {
9012     const reversed = reverseKeywords[rgb];
9013
9014     if (reversed) {
9015       return reversed;
9016     }
9017
9018     let currentClosestDistance = Infinity;
9019     let currentClosestKeyword;
9020
9021     for (const keyword of Object.keys(colorName$1)) {
9022       const value = colorName$1[keyword]; // Compute comparative distance
9023
9024       const distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
9025
9026       if (distance < currentClosestDistance) {
9027         currentClosestDistance = distance;
9028         currentClosestKeyword = keyword;
9029       }
9030     }
9031
9032     return currentClosestKeyword;
9033   };
9034
9035   convert$1.keyword.rgb = function (keyword) {
9036     return colorName$1[keyword];
9037   };
9038
9039   convert$1.rgb.xyz = function (rgb) {
9040     let r = rgb[0] / 255;
9041     let g = rgb[1] / 255;
9042     let b = rgb[2] / 255; // Assume sRGB
9043
9044     r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
9045     g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
9046     b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
9047     const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
9048     const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
9049     const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
9050     return [x * 100, y * 100, z * 100];
9051   };
9052
9053   convert$1.rgb.lab = function (rgb) {
9054     const xyz = convert$1.rgb.xyz(rgb);
9055     let x = xyz[0];
9056     let y = xyz[1];
9057     let z = xyz[2];
9058     x /= 95.047;
9059     y /= 100;
9060     z /= 108.883;
9061     x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
9062     y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
9063     z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
9064     const l = 116 * y - 16;
9065     const a = 500 * (x - y);
9066     const b = 200 * (y - z);
9067     return [l, a, b];
9068   };
9069
9070   convert$1.hsl.rgb = function (hsl) {
9071     const h = hsl[0] / 360;
9072     const s = hsl[1] / 100;
9073     const l = hsl[2] / 100;
9074     let t2;
9075     let t3;
9076     let val;
9077
9078     if (s === 0) {
9079       val = l * 255;
9080       return [val, val, val];
9081     }
9082
9083     if (l < 0.5) {
9084       t2 = l * (1 + s);
9085     } else {
9086       t2 = l + s - l * s;
9087     }
9088
9089     const t1 = 2 * l - t2;
9090     const rgb = [0, 0, 0];
9091
9092     for (let i = 0; i < 3; i++) {
9093       t3 = h + 1 / 3 * -(i - 1);
9094
9095       if (t3 < 0) {
9096         t3++;
9097       }
9098
9099       if (t3 > 1) {
9100         t3--;
9101       }
9102
9103       if (6 * t3 < 1) {
9104         val = t1 + (t2 - t1) * 6 * t3;
9105       } else if (2 * t3 < 1) {
9106         val = t2;
9107       } else if (3 * t3 < 2) {
9108         val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
9109       } else {
9110         val = t1;
9111       }
9112
9113       rgb[i] = val * 255;
9114     }
9115
9116     return rgb;
9117   };
9118
9119   convert$1.hsl.hsv = function (hsl) {
9120     const h = hsl[0];
9121     let s = hsl[1] / 100;
9122     let l = hsl[2] / 100;
9123     let smin = s;
9124     const lmin = Math.max(l, 0.01);
9125     l *= 2;
9126     s *= l <= 1 ? l : 2 - l;
9127     smin *= lmin <= 1 ? lmin : 2 - lmin;
9128     const v = (l + s) / 2;
9129     const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
9130     return [h, sv * 100, v * 100];
9131   };
9132
9133   convert$1.hsv.rgb = function (hsv) {
9134     const h = hsv[0] / 60;
9135     const s = hsv[1] / 100;
9136     let v = hsv[2] / 100;
9137     const hi = Math.floor(h) % 6;
9138     const f = h - Math.floor(h);
9139     const p = 255 * v * (1 - s);
9140     const q = 255 * v * (1 - s * f);
9141     const t = 255 * v * (1 - s * (1 - f));
9142     v *= 255;
9143
9144     switch (hi) {
9145       case 0:
9146         return [v, t, p];
9147
9148       case 1:
9149         return [q, v, p];
9150
9151       case 2:
9152         return [p, v, t];
9153
9154       case 3:
9155         return [p, q, v];
9156
9157       case 4:
9158         return [t, p, v];
9159
9160       case 5:
9161         return [v, p, q];
9162     }
9163   };
9164
9165   convert$1.hsv.hsl = function (hsv) {
9166     const h = hsv[0];
9167     const s = hsv[1] / 100;
9168     const v = hsv[2] / 100;
9169     const vmin = Math.max(v, 0.01);
9170     let sl;
9171     let l;
9172     l = (2 - s) * v;
9173     const lmin = (2 - s) * vmin;
9174     sl = s * vmin;
9175     sl /= lmin <= 1 ? lmin : 2 - lmin;
9176     sl = sl || 0;
9177     l /= 2;
9178     return [h, sl * 100, l * 100];
9179   }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
9180
9181
9182   convert$1.hwb.rgb = function (hwb) {
9183     const h = hwb[0] / 360;
9184     let wh = hwb[1] / 100;
9185     let bl = hwb[2] / 100;
9186     const ratio = wh + bl;
9187     let f; // Wh + bl cant be > 1
9188
9189     if (ratio > 1) {
9190       wh /= ratio;
9191       bl /= ratio;
9192     }
9193
9194     const i = Math.floor(6 * h);
9195     const v = 1 - bl;
9196     f = 6 * h - i;
9197
9198     if ((i & 0x01) !== 0) {
9199       f = 1 - f;
9200     }
9201
9202     const n = wh + f * (v - wh); // Linear interpolation
9203
9204     let r;
9205     let g;
9206     let b;
9207     /* eslint-disable max-statements-per-line,no-multi-spaces */
9208
9209     switch (i) {
9210       default:
9211       case 6:
9212       case 0:
9213         r = v;
9214         g = n;
9215         b = wh;
9216         break;
9217
9218       case 1:
9219         r = n;
9220         g = v;
9221         b = wh;
9222         break;
9223
9224       case 2:
9225         r = wh;
9226         g = v;
9227         b = n;
9228         break;
9229
9230       case 3:
9231         r = wh;
9232         g = n;
9233         b = v;
9234         break;
9235
9236       case 4:
9237         r = n;
9238         g = wh;
9239         b = v;
9240         break;
9241
9242       case 5:
9243         r = v;
9244         g = wh;
9245         b = n;
9246         break;
9247     }
9248     /* eslint-enable max-statements-per-line,no-multi-spaces */
9249
9250
9251     return [r * 255, g * 255, b * 255];
9252   };
9253
9254   convert$1.cmyk.rgb = function (cmyk) {
9255     const c = cmyk[0] / 100;
9256     const m = cmyk[1] / 100;
9257     const y = cmyk[2] / 100;
9258     const k = cmyk[3] / 100;
9259     const r = 1 - Math.min(1, c * (1 - k) + k);
9260     const g = 1 - Math.min(1, m * (1 - k) + k);
9261     const b = 1 - Math.min(1, y * (1 - k) + k);
9262     return [r * 255, g * 255, b * 255];
9263   };
9264
9265   convert$1.xyz.rgb = function (xyz) {
9266     const x = xyz[0] / 100;
9267     const y = xyz[1] / 100;
9268     const z = xyz[2] / 100;
9269     let r;
9270     let g;
9271     let b;
9272     r = x * 3.2406 + y * -1.5372 + z * -0.4986;
9273     g = x * -0.9689 + y * 1.8758 + z * 0.0415;
9274     b = x * 0.0557 + y * -0.2040 + z * 1.0570; // Assume sRGB
9275
9276     r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92;
9277     g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92;
9278     b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92;
9279     r = Math.min(Math.max(0, r), 1);
9280     g = Math.min(Math.max(0, g), 1);
9281     b = Math.min(Math.max(0, b), 1);
9282     return [r * 255, g * 255, b * 255];
9283   };
9284
9285   convert$1.xyz.lab = function (xyz) {
9286     let x = xyz[0];
9287     let y = xyz[1];
9288     let z = xyz[2];
9289     x /= 95.047;
9290     y /= 100;
9291     z /= 108.883;
9292     x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
9293     y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
9294     z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
9295     const l = 116 * y - 16;
9296     const a = 500 * (x - y);
9297     const b = 200 * (y - z);
9298     return [l, a, b];
9299   };
9300
9301   convert$1.lab.xyz = function (lab) {
9302     const l = lab[0];
9303     const a = lab[1];
9304     const b = lab[2];
9305     let x;
9306     let y;
9307     let z;
9308     y = (l + 16) / 116;
9309     x = a / 500 + y;
9310     z = y - b / 200;
9311     const y2 = y ** 3;
9312     const x2 = x ** 3;
9313     const z2 = z ** 3;
9314     y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
9315     x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
9316     z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
9317     x *= 95.047;
9318     y *= 100;
9319     z *= 108.883;
9320     return [x, y, z];
9321   };
9322
9323   convert$1.lab.lch = function (lab) {
9324     const l = lab[0];
9325     const a = lab[1];
9326     const b = lab[2];
9327     let h;
9328     const hr = Math.atan2(b, a);
9329     h = hr * 360 / 2 / Math.PI;
9330
9331     if (h < 0) {
9332       h += 360;
9333     }
9334
9335     const c = Math.sqrt(a * a + b * b);
9336     return [l, c, h];
9337   };
9338
9339   convert$1.lch.lab = function (lch) {
9340     const l = lch[0];
9341     const c = lch[1];
9342     const h = lch[2];
9343     const hr = h / 360 * 2 * Math.PI;
9344     const a = c * Math.cos(hr);
9345     const b = c * Math.sin(hr);
9346     return [l, a, b];
9347   };
9348
9349   convert$1.rgb.ansi16 = function (args, saturation = null) {
9350     const [r, g, b] = args;
9351     let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
9352
9353     value = Math.round(value / 50);
9354
9355     if (value === 0) {
9356       return 30;
9357     }
9358
9359     let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
9360
9361     if (value === 2) {
9362       ansi += 60;
9363     }
9364
9365     return ansi;
9366   };
9367
9368   convert$1.hsv.ansi16 = function (args) {
9369     // Optimization here; we already know the value and don't need to get
9370     // it converted for us.
9371     return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
9372   };
9373
9374   convert$1.rgb.ansi256 = function (args) {
9375     const r = args[0];
9376     const g = args[1];
9377     const b = args[2]; // We use the extended greyscale palette here, with the exception of
9378     // black and white. normal palette only has 4 greyscale shades.
9379
9380     if (r === g && g === b) {
9381       if (r < 8) {
9382         return 16;
9383       }
9384
9385       if (r > 248) {
9386         return 231;
9387       }
9388
9389       return Math.round((r - 8) / 247 * 24) + 232;
9390     }
9391
9392     const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
9393     return ansi;
9394   };
9395
9396   convert$1.ansi16.rgb = function (args) {
9397     let color = args % 10; // Handle greyscale
9398
9399     if (color === 0 || color === 7) {
9400       if (args > 50) {
9401         color += 3.5;
9402       }
9403
9404       color = color / 10.5 * 255;
9405       return [color, color, color];
9406     }
9407
9408     const mult = (~~(args > 50) + 1) * 0.5;
9409     const r = (color & 1) * mult * 255;
9410     const g = (color >> 1 & 1) * mult * 255;
9411     const b = (color >> 2 & 1) * mult * 255;
9412     return [r, g, b];
9413   };
9414
9415   convert$1.ansi256.rgb = function (args) {
9416     // Handle greyscale
9417     if (args >= 232) {
9418       const c = (args - 232) * 10 + 8;
9419       return [c, c, c];
9420     }
9421
9422     args -= 16;
9423     let rem;
9424     const r = Math.floor(args / 36) / 5 * 255;
9425     const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
9426     const b = rem % 6 / 5 * 255;
9427     return [r, g, b];
9428   };
9429
9430   convert$1.rgb.hex = function (args) {
9431     const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
9432     const string = integer.toString(16).toUpperCase();
9433     return '000000'.substring(string.length) + string;
9434   };
9435
9436   convert$1.hex.rgb = function (args) {
9437     const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
9438
9439     if (!match) {
9440       return [0, 0, 0];
9441     }
9442
9443     let colorString = match[0];
9444
9445     if (match[0].length === 3) {
9446       colorString = colorString.split('').map(char => {
9447         return char + char;
9448       }).join('');
9449     }
9450
9451     const integer = parseInt(colorString, 16);
9452     const r = integer >> 16 & 0xFF;
9453     const g = integer >> 8 & 0xFF;
9454     const b = integer & 0xFF;
9455     return [r, g, b];
9456   };
9457
9458   convert$1.rgb.hcg = function (rgb) {
9459     const r = rgb[0] / 255;
9460     const g = rgb[1] / 255;
9461     const b = rgb[2] / 255;
9462     const max = Math.max(Math.max(r, g), b);
9463     const min = Math.min(Math.min(r, g), b);
9464     const chroma = max - min;
9465     let grayscale;
9466     let hue;
9467
9468     if (chroma < 1) {
9469       grayscale = min / (1 - chroma);
9470     } else {
9471       grayscale = 0;
9472     }
9473
9474     if (chroma <= 0) {
9475       hue = 0;
9476     } else if (max === r) {
9477       hue = (g - b) / chroma % 6;
9478     } else if (max === g) {
9479       hue = 2 + (b - r) / chroma;
9480     } else {
9481       hue = 4 + (r - g) / chroma;
9482     }
9483
9484     hue /= 6;
9485     hue %= 1;
9486     return [hue * 360, chroma * 100, grayscale * 100];
9487   };
9488
9489   convert$1.hsl.hcg = function (hsl) {
9490     const s = hsl[1] / 100;
9491     const l = hsl[2] / 100;
9492     const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
9493     let f = 0;
9494
9495     if (c < 1.0) {
9496       f = (l - 0.5 * c) / (1.0 - c);
9497     }
9498
9499     return [hsl[0], c * 100, f * 100];
9500   };
9501
9502   convert$1.hsv.hcg = function (hsv) {
9503     const s = hsv[1] / 100;
9504     const v = hsv[2] / 100;
9505     const c = s * v;
9506     let f = 0;
9507
9508     if (c < 1.0) {
9509       f = (v - c) / (1 - c);
9510     }
9511
9512     return [hsv[0], c * 100, f * 100];
9513   };
9514
9515   convert$1.hcg.rgb = function (hcg) {
9516     const h = hcg[0] / 360;
9517     const c = hcg[1] / 100;
9518     const g = hcg[2] / 100;
9519
9520     if (c === 0.0) {
9521       return [g * 255, g * 255, g * 255];
9522     }
9523
9524     const pure = [0, 0, 0];
9525     const hi = h % 1 * 6;
9526     const v = hi % 1;
9527     const w = 1 - v;
9528     let mg = 0;
9529     /* eslint-disable max-statements-per-line */
9530
9531     switch (Math.floor(hi)) {
9532       case 0:
9533         pure[0] = 1;
9534         pure[1] = v;
9535         pure[2] = 0;
9536         break;
9537
9538       case 1:
9539         pure[0] = w;
9540         pure[1] = 1;
9541         pure[2] = 0;
9542         break;
9543
9544       case 2:
9545         pure[0] = 0;
9546         pure[1] = 1;
9547         pure[2] = v;
9548         break;
9549
9550       case 3:
9551         pure[0] = 0;
9552         pure[1] = w;
9553         pure[2] = 1;
9554         break;
9555
9556       case 4:
9557         pure[0] = v;
9558         pure[1] = 0;
9559         pure[2] = 1;
9560         break;
9561
9562       default:
9563         pure[0] = 1;
9564         pure[1] = 0;
9565         pure[2] = w;
9566     }
9567     /* eslint-enable max-statements-per-line */
9568
9569
9570     mg = (1.0 - c) * g;
9571     return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
9572   };
9573
9574   convert$1.hcg.hsv = function (hcg) {
9575     const c = hcg[1] / 100;
9576     const g = hcg[2] / 100;
9577     const v = c + g * (1.0 - c);
9578     let f = 0;
9579
9580     if (v > 0.0) {
9581       f = c / v;
9582     }
9583
9584     return [hcg[0], f * 100, v * 100];
9585   };
9586
9587   convert$1.hcg.hsl = function (hcg) {
9588     const c = hcg[1] / 100;
9589     const g = hcg[2] / 100;
9590     const l = g * (1.0 - c) + 0.5 * c;
9591     let s = 0;
9592
9593     if (l > 0.0 && l < 0.5) {
9594       s = c / (2 * l);
9595     } else if (l >= 0.5 && l < 1.0) {
9596       s = c / (2 * (1 - l));
9597     }
9598
9599     return [hcg[0], s * 100, l * 100];
9600   };
9601
9602   convert$1.hcg.hwb = function (hcg) {
9603     const c = hcg[1] / 100;
9604     const g = hcg[2] / 100;
9605     const v = c + g * (1.0 - c);
9606     return [hcg[0], (v - c) * 100, (1 - v) * 100];
9607   };
9608
9609   convert$1.hwb.hcg = function (hwb) {
9610     const w = hwb[1] / 100;
9611     const b = hwb[2] / 100;
9612     const v = 1 - b;
9613     const c = v - w;
9614     let g = 0;
9615
9616     if (c < 1) {
9617       g = (v - c) / (1 - c);
9618     }
9619
9620     return [hwb[0], c * 100, g * 100];
9621   };
9622
9623   convert$1.apple.rgb = function (apple) {
9624     return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
9625   };
9626
9627   convert$1.rgb.apple = function (rgb) {
9628     return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
9629   };
9630
9631   convert$1.gray.rgb = function (args) {
9632     return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
9633   };
9634
9635   convert$1.gray.hsl = function (args) {
9636     return [0, 0, args[0]];
9637   };
9638
9639   convert$1.gray.hsv = convert$1.gray.hsl;
9640
9641   convert$1.gray.hwb = function (gray) {
9642     return [0, 100, gray[0]];
9643   };
9644
9645   convert$1.gray.cmyk = function (gray) {
9646     return [0, 0, 0, gray[0]];
9647   };
9648
9649   convert$1.gray.lab = function (gray) {
9650     return [gray[0], 0, 0];
9651   };
9652
9653   convert$1.gray.hex = function (gray) {
9654     const val = Math.round(gray[0] / 100 * 255) & 0xFF;
9655     const integer = (val << 16) + (val << 8) + val;
9656     const string = integer.toString(16).toUpperCase();
9657     return '000000'.substring(string.length) + string;
9658   };
9659
9660   convert$1.rgb.gray = function (rgb) {
9661     const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
9662     return [val / 255 * 100];
9663   };
9664
9665   /*
9666         This function routes a model to all other models.
9667
9668         all functions that are routed have a property `.conversion` attached
9669         to the returned synthetic function. This property is an array
9670         of strings, each with the steps in between the 'from' and 'to'
9671         color models (inclusive).
9672
9673         conversions that are not possible simply are not included.
9674   */
9675
9676   function buildGraph$1() {
9677     const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
9678
9679     const models = Object.keys(conversions$1);
9680
9681     for (let len = models.length, i = 0; i < len; i++) {
9682       graph[models[i]] = {
9683         // http://jsperf.com/1-vs-infinity
9684         // micro-opt, but this is simple.
9685         distance: -1,
9686         parent: null
9687       };
9688     }
9689
9690     return graph;
9691   } // https://en.wikipedia.org/wiki/Breadth-first_search
9692
9693
9694   function deriveBFS$1(fromModel) {
9695     const graph = buildGraph$1();
9696     const queue = [fromModel]; // Unshift -> queue -> pop
9697
9698     graph[fromModel].distance = 0;
9699
9700     while (queue.length) {
9701       const current = queue.pop();
9702       const adjacents = Object.keys(conversions$1[current]);
9703
9704       for (let len = adjacents.length, i = 0; i < len; i++) {
9705         const adjacent = adjacents[i];
9706         const node = graph[adjacent];
9707
9708         if (node.distance === -1) {
9709           node.distance = graph[current].distance + 1;
9710           node.parent = current;
9711           queue.unshift(adjacent);
9712         }
9713       }
9714     }
9715
9716     return graph;
9717   }
9718
9719   function link$1(from, to) {
9720     return function (args) {
9721       return to(from(args));
9722     };
9723   }
9724
9725   function wrapConversion$1(toModel, graph) {
9726     const path = [graph[toModel].parent, toModel];
9727     let fn = conversions$1[graph[toModel].parent][toModel];
9728     let cur = graph[toModel].parent;
9729
9730     while (graph[cur].parent) {
9731       path.unshift(graph[cur].parent);
9732       fn = link$1(conversions$1[graph[cur].parent][cur], fn);
9733       cur = graph[cur].parent;
9734     }
9735
9736     fn.conversion = path;
9737     return fn;
9738   }
9739
9740   var route$1 = function route(fromModel) {
9741     const graph = deriveBFS$1(fromModel);
9742     const conversion = {};
9743     const models = Object.keys(graph);
9744
9745     for (let len = models.length, i = 0; i < len; i++) {
9746       const toModel = models[i];
9747       const node = graph[toModel];
9748
9749       if (node.parent === null) {
9750         // No possible conversion, or this node is the source model.
9751         continue;
9752       }
9753
9754       conversion[toModel] = wrapConversion$1(toModel, graph);
9755     }
9756
9757     return conversion;
9758   };
9759
9760   const convert$2 = {};
9761   const models$1 = Object.keys(conversions$1);
9762
9763   function wrapRaw$1(fn) {
9764     const wrappedFn = function wrappedFn(...args) {
9765       const arg0 = args[0];
9766
9767       if (arg0 === undefined || arg0 === null) {
9768         return arg0;
9769       }
9770
9771       if (arg0.length > 1) {
9772         args = arg0;
9773       }
9774
9775       return fn(args);
9776     }; // Preserve .conversion property if there is one
9777
9778
9779     if ('conversion' in fn) {
9780       wrappedFn.conversion = fn.conversion;
9781     }
9782
9783     return wrappedFn;
9784   }
9785
9786   function wrapRounded$1(fn) {
9787     const wrappedFn = function wrappedFn(...args) {
9788       const arg0 = args[0];
9789
9790       if (arg0 === undefined || arg0 === null) {
9791         return arg0;
9792       }
9793
9794       if (arg0.length > 1) {
9795         args = arg0;
9796       }
9797
9798       const result = fn(args); // We're assuming the result is an array here.
9799       // see notice in conversions.js; don't use box types
9800       // in conversion functions.
9801
9802       if (typeof result === 'object') {
9803         for (let len = result.length, i = 0; i < len; i++) {
9804           result[i] = Math.round(result[i]);
9805         }
9806       }
9807
9808       return result;
9809     }; // Preserve .conversion property if there is one
9810
9811
9812     if ('conversion' in fn) {
9813       wrappedFn.conversion = fn.conversion;
9814     }
9815
9816     return wrappedFn;
9817   }
9818
9819   models$1.forEach(fromModel => {
9820     convert$2[fromModel] = {};
9821     Object.defineProperty(convert$2[fromModel], 'channels', {
9822       value: conversions$1[fromModel].channels
9823     });
9824     Object.defineProperty(convert$2[fromModel], 'labels', {
9825       value: conversions$1[fromModel].labels
9826     });
9827     const routes = route$1(fromModel);
9828     const routeModels = Object.keys(routes);
9829     routeModels.forEach(toModel => {
9830       const fn = routes[toModel];
9831       convert$2[fromModel][toModel] = wrapRounded$1(fn);
9832       convert$2[fromModel][toModel].raw = wrapRaw$1(fn);
9833     });
9834   });
9835   var colorConvert$1 = convert$2;
9836
9837   var ansiStyles$1 = createCommonjsModule(function (module) {
9838
9839     const wrapAnsi16 = (fn, offset) => (...args) => {
9840       const code = fn(...args);
9841       return "\x1B[".concat(code + offset, "m");
9842     };
9843
9844     const wrapAnsi256 = (fn, offset) => (...args) => {
9845       const code = fn(...args);
9846       return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
9847     };
9848
9849     const wrapAnsi16m = (fn, offset) => (...args) => {
9850       const rgb = fn(...args);
9851       return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
9852     };
9853
9854     const ansi2ansi = n => n;
9855
9856     const rgb2rgb = (r, g, b) => [r, g, b];
9857
9858     const setLazyProperty = (object, property, _get) => {
9859       Object.defineProperty(object, property, {
9860         get: () => {
9861           const value = _get();
9862
9863           Object.defineProperty(object, property, {
9864             value,
9865             enumerable: true,
9866             configurable: true
9867           });
9868           return value;
9869         },
9870         enumerable: true,
9871         configurable: true
9872       });
9873     };
9874     /** @type {typeof import('color-convert')} */
9875
9876
9877     let colorConvert;
9878
9879     const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
9880       if (colorConvert === undefined) {
9881         colorConvert = colorConvert$1;
9882       }
9883
9884       const offset = isBackground ? 10 : 0;
9885       const styles = {};
9886
9887       for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
9888         const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
9889
9890         if (sourceSpace === targetSpace) {
9891           styles[name] = wrap(identity, offset);
9892         } else if (typeof suite === 'object') {
9893           styles[name] = wrap(suite[targetSpace], offset);
9894         }
9895       }
9896
9897       return styles;
9898     };
9899
9900     function assembleStyles() {
9901       const codes = new Map();
9902       const styles = {
9903         modifier: {
9904           reset: [0, 0],
9905           // 21 isn't widely supported and 22 does the same thing
9906           bold: [1, 22],
9907           dim: [2, 22],
9908           italic: [3, 23],
9909           underline: [4, 24],
9910           inverse: [7, 27],
9911           hidden: [8, 28],
9912           strikethrough: [9, 29]
9913         },
9914         color: {
9915           black: [30, 39],
9916           red: [31, 39],
9917           green: [32, 39],
9918           yellow: [33, 39],
9919           blue: [34, 39],
9920           magenta: [35, 39],
9921           cyan: [36, 39],
9922           white: [37, 39],
9923           // Bright color
9924           blackBright: [90, 39],
9925           redBright: [91, 39],
9926           greenBright: [92, 39],
9927           yellowBright: [93, 39],
9928           blueBright: [94, 39],
9929           magentaBright: [95, 39],
9930           cyanBright: [96, 39],
9931           whiteBright: [97, 39]
9932         },
9933         bgColor: {
9934           bgBlack: [40, 49],
9935           bgRed: [41, 49],
9936           bgGreen: [42, 49],
9937           bgYellow: [43, 49],
9938           bgBlue: [44, 49],
9939           bgMagenta: [45, 49],
9940           bgCyan: [46, 49],
9941           bgWhite: [47, 49],
9942           // Bright color
9943           bgBlackBright: [100, 49],
9944           bgRedBright: [101, 49],
9945           bgGreenBright: [102, 49],
9946           bgYellowBright: [103, 49],
9947           bgBlueBright: [104, 49],
9948           bgMagentaBright: [105, 49],
9949           bgCyanBright: [106, 49],
9950           bgWhiteBright: [107, 49]
9951         }
9952       }; // Alias bright black as gray (and grey)
9953
9954       styles.color.gray = styles.color.blackBright;
9955       styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
9956       styles.color.grey = styles.color.blackBright;
9957       styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
9958
9959       for (const [groupName, group] of Object.entries(styles)) {
9960         for (const [styleName, style] of Object.entries(group)) {
9961           styles[styleName] = {
9962             open: "\x1B[".concat(style[0], "m"),
9963             close: "\x1B[".concat(style[1], "m")
9964           };
9965           group[styleName] = styles[styleName];
9966           codes.set(style[0], style[1]);
9967         }
9968
9969         Object.defineProperty(styles, groupName, {
9970           value: group,
9971           enumerable: false
9972         });
9973       }
9974
9975       Object.defineProperty(styles, 'codes', {
9976         value: codes,
9977         enumerable: false
9978       });
9979       styles.color.close = '\u001B[39m';
9980       styles.bgColor.close = '\u001B[49m';
9981       setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
9982       setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
9983       setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
9984       setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
9985       setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
9986       setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
9987       return styles;
9988     } // Make the export immutable
9989
9990
9991     Object.defineProperty(module, 'exports', {
9992       enumerable: true,
9993       get: assembleStyles
9994     });
9995   });
9996
9997   var tty = {
9998     isatty() {
9999       return false;
10000     }
10001
10002   };
10003
10004   var hasFlag$1 = (flag, argv = process.argv) => {
10005     const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
10006     const position = argv.indexOf(prefix + flag);
10007     const terminatorPosition = argv.indexOf('--');
10008     return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
10009   };
10010
10011   const {
10012     env: env$2
10013   } = process;
10014   let forceColor$1;
10015
10016   if (hasFlag$1('no-color') || hasFlag$1('no-colors') || hasFlag$1('color=false') || hasFlag$1('color=never')) {
10017     forceColor$1 = 0;
10018   } else if (hasFlag$1('color') || hasFlag$1('colors') || hasFlag$1('color=true') || hasFlag$1('color=always')) {
10019     forceColor$1 = 1;
10020   }
10021
10022   if ('FORCE_COLOR' in env$2) {
10023     if (env$2.FORCE_COLOR === 'true') {
10024       forceColor$1 = 1;
10025     } else if (env$2.FORCE_COLOR === 'false') {
10026       forceColor$1 = 0;
10027     } else {
10028       forceColor$1 = env$2.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$2.FORCE_COLOR, 10), 3);
10029     }
10030   }
10031
10032   function translateLevel$1(level) {
10033     if (level === 0) {
10034       return false;
10035     }
10036
10037     return {
10038       level,
10039       hasBasic: true,
10040       has256: level >= 2,
10041       has16m: level >= 3
10042     };
10043   }
10044
10045   function supportsColor$1(haveStream, streamIsTTY) {
10046     if (forceColor$1 === 0) {
10047       return 0;
10048     }
10049
10050     if (hasFlag$1('color=16m') || hasFlag$1('color=full') || hasFlag$1('color=truecolor')) {
10051       return 3;
10052     }
10053
10054     if (hasFlag$1('color=256')) {
10055       return 2;
10056     }
10057
10058     if (haveStream && !streamIsTTY && forceColor$1 === undefined) {
10059       return 0;
10060     }
10061
10062     const min = forceColor$1 || 0;
10063
10064     if (env$2.TERM === 'dumb') {
10065       return min;
10066     }
10067
10068     if (process.platform === 'win32') {
10069       // Windows 10 build 10586 is the first Windows release that supports 256 colors.
10070       // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
10071       const osRelease = require$$0$1.release().split('.');
10072
10073       if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
10074         return Number(osRelease[2]) >= 14931 ? 3 : 2;
10075       }
10076
10077       return 1;
10078     }
10079
10080     if ('CI' in env$2) {
10081       if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$2) || env$2.CI_NAME === 'codeship') {
10082         return 1;
10083       }
10084
10085       return min;
10086     }
10087
10088     if ('TEAMCITY_VERSION' in env$2) {
10089       return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$2.TEAMCITY_VERSION) ? 1 : 0;
10090     }
10091
10092     if ('GITHUB_ACTIONS' in env$2) {
10093       return 1;
10094     }
10095
10096     if (env$2.COLORTERM === 'truecolor') {
10097       return 3;
10098     }
10099
10100     if ('TERM_PROGRAM' in env$2) {
10101       const version = parseInt((env$2.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
10102
10103       switch (env$2.TERM_PROGRAM) {
10104         case 'iTerm.app':
10105           return version >= 3 ? 3 : 2;
10106
10107         case 'Apple_Terminal':
10108           return 2;
10109         // No default
10110       }
10111     }
10112
10113     if (/-256(color)?$/i.test(env$2.TERM)) {
10114       return 2;
10115     }
10116
10117     if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$2.TERM)) {
10118       return 1;
10119     }
10120
10121     if ('COLORTERM' in env$2) {
10122       return 1;
10123     }
10124
10125     return min;
10126   }
10127
10128   function getSupportLevel$1(stream) {
10129     const level = supportsColor$1(stream, stream && stream.isTTY);
10130     return translateLevel$1(level);
10131   }
10132
10133   var supportsColor_1$1 = {
10134     supportsColor: getSupportLevel$1,
10135     stdout: translateLevel$1(supportsColor$1(true, tty.isatty(1))),
10136     stderr: translateLevel$1(supportsColor$1(true, tty.isatty(2)))
10137   };
10138
10139   const stringReplaceAll = (string, substring, replacer) => {
10140     let index = string.indexOf(substring);
10141
10142     if (index === -1) {
10143       return string;
10144     }
10145
10146     const substringLength = substring.length;
10147     let endIndex = 0;
10148     let returnValue = '';
10149
10150     do {
10151       returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
10152       endIndex = index + substringLength;
10153       index = string.indexOf(substring, endIndex);
10154     } while (index !== -1);
10155
10156     returnValue += string.substr(endIndex);
10157     return returnValue;
10158   };
10159
10160   const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
10161     let endIndex = 0;
10162     let returnValue = '';
10163
10164     do {
10165       const gotCR = string[index - 1] === '\r';
10166       returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
10167       endIndex = index + 1;
10168       index = string.indexOf('\n', endIndex);
10169     } while (index !== -1);
10170
10171     returnValue += string.substr(endIndex);
10172     return returnValue;
10173   };
10174
10175   var util = {
10176     stringReplaceAll,
10177     stringEncaseCRLFWithFirstIndex
10178   };
10179
10180   const TEMPLATE_REGEX$1 = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
10181   const STYLE_REGEX$1 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
10182   const STRING_REGEX$1 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
10183   const ESCAPE_REGEX$1 = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
10184   const ESCAPES$1 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
10185
10186   function unescape$1(c) {
10187     const u = c[0] === 'u';
10188     const bracket = c[1] === '{';
10189
10190     if (u && !bracket && c.length === 5 || c[0] === 'x' && c.length === 3) {
10191       return String.fromCharCode(parseInt(c.slice(1), 16));
10192     }
10193
10194     if (u && bracket) {
10195       return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
10196     }
10197
10198     return ESCAPES$1.get(c) || c;
10199   }
10200
10201   function parseArguments$1(name, arguments_) {
10202     const results = [];
10203     const chunks = arguments_.trim().split(/\s*,\s*/g);
10204     let matches;
10205
10206     for (const chunk of chunks) {
10207       const number = Number(chunk);
10208
10209       if (!Number.isNaN(number)) {
10210         results.push(number);
10211       } else if (matches = chunk.match(STRING_REGEX$1)) {
10212         results.push(matches[2].replace(ESCAPE_REGEX$1, (m, escape, character) => escape ? unescape$1(escape) : character));
10213       } else {
10214         throw new Error("Invalid Chalk template style argument: ".concat(chunk, " (in style '").concat(name, "')"));
10215       }
10216     }
10217
10218     return results;
10219   }
10220
10221   function parseStyle$1(style) {
10222     STYLE_REGEX$1.lastIndex = 0;
10223     const results = [];
10224     let matches;
10225
10226     while ((matches = STYLE_REGEX$1.exec(style)) !== null) {
10227       const name = matches[1];
10228
10229       if (matches[2]) {
10230         const args = parseArguments$1(name, matches[2]);
10231         results.push([name].concat(args));
10232       } else {
10233         results.push([name]);
10234       }
10235     }
10236
10237     return results;
10238   }
10239
10240   function buildStyle$1(chalk, styles) {
10241     const enabled = {};
10242
10243     for (const layer of styles) {
10244       for (const style of layer.styles) {
10245         enabled[style[0]] = layer.inverse ? null : style.slice(1);
10246       }
10247     }
10248
10249     let current = chalk;
10250
10251     for (const [styleName, styles] of Object.entries(enabled)) {
10252       if (!Array.isArray(styles)) {
10253         continue;
10254       }
10255
10256       if (!(styleName in current)) {
10257         throw new Error("Unknown Chalk style: ".concat(styleName));
10258       }
10259
10260       current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
10261     }
10262
10263     return current;
10264   }
10265
10266   var templates$1 = (chalk, temporary) => {
10267     const styles = [];
10268     const chunks = [];
10269     let chunk = []; // eslint-disable-next-line max-params
10270
10271     temporary.replace(TEMPLATE_REGEX$1, (m, escapeCharacter, inverse, style, close, character) => {
10272       if (escapeCharacter) {
10273         chunk.push(unescape$1(escapeCharacter));
10274       } else if (style) {
10275         const string = chunk.join('');
10276         chunk = [];
10277         chunks.push(styles.length === 0 ? string : buildStyle$1(chalk, styles)(string));
10278         styles.push({
10279           inverse,
10280           styles: parseStyle$1(style)
10281         });
10282       } else if (close) {
10283         if (styles.length === 0) {
10284           throw new Error('Found extraneous } in Chalk template literal');
10285         }
10286
10287         chunks.push(buildStyle$1(chalk, styles)(chunk.join('')));
10288         chunk = [];
10289         styles.pop();
10290       } else {
10291         chunk.push(character);
10292       }
10293     });
10294     chunks.push(chunk.join(''));
10295
10296     if (styles.length > 0) {
10297       const errMessage = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
10298       throw new Error(errMessage);
10299     }
10300
10301     return chunks.join('');
10302   };
10303
10304   const {
10305     stdout: stdoutColor,
10306     stderr: stderrColor
10307   } = supportsColor_1$1;
10308   const {
10309     stringReplaceAll: stringReplaceAll$1,
10310     stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
10311   } = util; // `supportsColor.level` → `ansiStyles.color[name]` mapping
10312
10313   const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
10314   const styles = Object.create(null);
10315
10316   const applyOptions = (object, options = {}) => {
10317     if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
10318       throw new Error('The `level` option should be an integer from 0 to 3');
10319     } // Detect level if not set manually
10320
10321
10322     const colorLevel = stdoutColor ? stdoutColor.level : 0;
10323     object.level = options.level === undefined ? colorLevel : options.level;
10324   };
10325
10326   class ChalkClass {
10327     constructor(options) {
10328       // eslint-disable-next-line no-constructor-return
10329       return chalkFactory(options);
10330     }
10331
10332   }
10333
10334   const chalkFactory = options => {
10335     const chalk = {};
10336     applyOptions(chalk, options);
10337
10338     chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
10339
10340     Object.setPrototypeOf(chalk, Chalk.prototype);
10341     Object.setPrototypeOf(chalk.template, chalk);
10342
10343     chalk.template.constructor = () => {
10344       throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
10345     };
10346
10347     chalk.template.Instance = ChalkClass;
10348     return chalk.template;
10349   };
10350
10351   function Chalk(options) {
10352     return chalkFactory(options);
10353   }
10354
10355   for (const [styleName, style] of Object.entries(ansiStyles$1)) {
10356     styles[styleName] = {
10357       get() {
10358         const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
10359         Object.defineProperty(this, styleName, {
10360           value: builder
10361         });
10362         return builder;
10363       }
10364
10365     };
10366   }
10367
10368   styles.visible = {
10369     get() {
10370       const builder = createBuilder(this, this._styler, true);
10371       Object.defineProperty(this, 'visible', {
10372         value: builder
10373       });
10374       return builder;
10375     }
10376
10377   };
10378   const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
10379
10380   for (const model of usedModels) {
10381     styles[model] = {
10382       get() {
10383         const {
10384           level
10385         } = this;
10386         return function (...arguments_) {
10387           const styler = createStyler(ansiStyles$1.color[levelMapping[level]][model](...arguments_), ansiStyles$1.color.close, this._styler);
10388           return createBuilder(this, styler, this._isEmpty);
10389         };
10390       }
10391
10392     };
10393   }
10394
10395   for (const model of usedModels) {
10396     const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
10397     styles[bgModel] = {
10398       get() {
10399         const {
10400           level
10401         } = this;
10402         return function (...arguments_) {
10403           const styler = createStyler(ansiStyles$1.bgColor[levelMapping[level]][model](...arguments_), ansiStyles$1.bgColor.close, this._styler);
10404           return createBuilder(this, styler, this._isEmpty);
10405         };
10406       }
10407
10408     };
10409   }
10410
10411   const proto = Object.defineProperties(() => {}, Object.assign({}, styles, {
10412     level: {
10413       enumerable: true,
10414
10415       get() {
10416         return this._generator.level;
10417       },
10418
10419       set(level) {
10420         this._generator.level = level;
10421       }
10422
10423     }
10424   }));
10425
10426   const createStyler = (open, close, parent) => {
10427     let openAll;
10428     let closeAll;
10429
10430     if (parent === undefined) {
10431       openAll = open;
10432       closeAll = close;
10433     } else {
10434       openAll = parent.openAll + open;
10435       closeAll = close + parent.closeAll;
10436     }
10437
10438     return {
10439       open,
10440       close,
10441       openAll,
10442       closeAll,
10443       parent
10444     };
10445   };
10446
10447   const createBuilder = (self, _styler, _isEmpty) => {
10448     const builder = (...arguments_) => {
10449       // Single argument is hot path, implicit coercion is faster than anything
10450       // eslint-disable-next-line no-implicit-coercion
10451       return applyStyle(builder, arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' '));
10452     }; // We alter the prototype because we must return a function, but there is
10453     // no way to create a function with a different prototype
10454
10455
10456     Object.setPrototypeOf(builder, proto);
10457     builder._generator = self;
10458     builder._styler = _styler;
10459     builder._isEmpty = _isEmpty;
10460     return builder;
10461   };
10462
10463   const applyStyle = (self, string) => {
10464     if (self.level <= 0 || !string) {
10465       return self._isEmpty ? '' : string;
10466     }
10467
10468     let styler = self._styler;
10469
10470     if (styler === undefined) {
10471       return string;
10472     }
10473
10474     const {
10475       openAll,
10476       closeAll
10477     } = styler;
10478
10479     if (string.indexOf('\u001B') !== -1) {
10480       while (styler !== undefined) {
10481         // Replace any instances already present with a re-opening code
10482         // otherwise only the part of the string until said closing code
10483         // will be colored, and the rest will simply be 'plain'.
10484         string = stringReplaceAll$1(string, styler.close, styler.open);
10485         styler = styler.parent;
10486       }
10487     } // We can move both next actions out of loop, because remaining actions in loop won't have
10488     // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
10489     // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
10490
10491
10492     const lfIndex = string.indexOf('\n');
10493
10494     if (lfIndex !== -1) {
10495       string = stringEncaseCRLFWithFirstIndex$1(string, closeAll, openAll, lfIndex);
10496     }
10497
10498     return openAll + string + closeAll;
10499   };
10500
10501   let template;
10502
10503   const chalkTag = (chalk, ...strings) => {
10504     const [firstString] = strings;
10505
10506     if (!Array.isArray(firstString)) {
10507       // If chalk() was called by itself or with a string,
10508       // return the string itself as a string.
10509       return strings.join(' ');
10510     }
10511
10512     const arguments_ = strings.slice(1);
10513     const parts = [firstString.raw[0]];
10514
10515     for (let i = 1; i < firstString.length; i++) {
10516       parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), String(firstString.raw[i]));
10517     }
10518
10519     if (template === undefined) {
10520       template = templates$1;
10521     }
10522
10523     return template(chalk, parts.join(''));
10524   };
10525
10526   Object.defineProperties(Chalk.prototype, styles);
10527   const chalk$1 = Chalk(); // eslint-disable-line new-cap
10528
10529   chalk$1.supportsColor = stdoutColor;
10530   chalk$1.stderr = Chalk({
10531     level: stderrColor ? stderrColor.level : 0
10532   }); // eslint-disable-line new-cap
10533
10534   chalk$1.stderr.supportsColor = stderrColor;
10535   var source = chalk$1;
10536
10537   const cliDescriptor = {
10538     key: _key => _key.length === 1 ? "-".concat(_key) : "--".concat(_key),
10539     value: _value => lib.apiDescriptor.value(_value),
10540     pair: ({
10541       key,
10542       value
10543     }) => value === false ? "--no-".concat(key) : value === true ? cliDescriptor.key(key) : value === "" ? "".concat(cliDescriptor.key(key), " without an argument") : "".concat(cliDescriptor.key(key), "=").concat(value)
10544   };
10545
10546   class FlagSchema extends lib.ChoiceSchema {
10547     constructor({
10548       name,
10549       flags
10550     }) {
10551       super({
10552         name,
10553         choices: flags
10554       });
10555       this._flags = flags.slice().sort();
10556     }
10557
10558     preprocess(value, utils) {
10559       if (typeof value === "string" && value.length !== 0 && !this._flags.includes(value)) {
10560         const suggestion = this._flags.find(flag => leven_1$1(flag, value) < 3);
10561
10562         if (suggestion) {
10563           utils.logger.warn(["Unknown flag ".concat(source.yellow(utils.descriptor.value(value)), ","), "did you mean ".concat(source.blue(utils.descriptor.value(suggestion)), "?")].join(" "));
10564           return suggestion;
10565         }
10566       }
10567
10568       return value;
10569     }
10570
10571     expected() {
10572       return "a flag";
10573     }
10574
10575   }
10576
10577   let hasDeprecationWarned;
10578
10579   function normalizeOptions(options, optionInfos, {
10580     logger,
10581     isCLI = false,
10582     passThrough = false
10583   } = {}) {
10584     const unknown = !passThrough ? lib.levenUnknownHandler : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? undefined : {
10585       [key]: value
10586     } : (key, value) => ({
10587       [key]: value
10588     });
10589     const descriptor = isCLI ? cliDescriptor : lib.apiDescriptor;
10590     const schemas = optionInfosToSchemas(optionInfos, {
10591       isCLI
10592     });
10593     const normalizer = new lib.Normalizer(schemas, {
10594       logger,
10595       unknown,
10596       descriptor
10597     });
10598     const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
10599
10600     if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
10601       normalizer._hasDeprecationWarned = hasDeprecationWarned;
10602     }
10603
10604     const normalized = normalizer.normalize(options);
10605
10606     if (shouldSuppressDuplicateDeprecationWarnings) {
10607       hasDeprecationWarned = normalizer._hasDeprecationWarned;
10608     }
10609
10610     return normalized;
10611   }
10612
10613   function optionInfosToSchemas(optionInfos, {
10614     isCLI
10615   }) {
10616     const schemas = [];
10617
10618     if (isCLI) {
10619       schemas.push(lib.AnySchema.create({
10620         name: "_"
10621       }));
10622     }
10623
10624     for (const optionInfo of optionInfos) {
10625       schemas.push(optionInfoToSchema(optionInfo, {
10626         isCLI,
10627         optionInfos
10628       }));
10629
10630       if (optionInfo.alias && isCLI) {
10631         schemas.push(lib.AliasSchema.create({
10632           name: optionInfo.alias,
10633           sourceName: optionInfo.name
10634         }));
10635       }
10636     }
10637
10638     return schemas;
10639   }
10640
10641   function optionInfoToSchema(optionInfo, {
10642     isCLI,
10643     optionInfos
10644   }) {
10645     let SchemaConstructor;
10646     const parameters = {
10647       name: optionInfo.name
10648     };
10649     const handlers = {};
10650
10651     switch (optionInfo.type) {
10652       case "int":
10653         SchemaConstructor = lib.IntegerSchema;
10654
10655         if (isCLI) {
10656           parameters.preprocess = value => Number(value);
10657         }
10658
10659         break;
10660
10661       case "string":
10662         SchemaConstructor = lib.StringSchema;
10663         break;
10664
10665       case "choice":
10666         SchemaConstructor = lib.ChoiceSchema;
10667         parameters.choices = optionInfo.choices.map(choiceInfo => typeof choiceInfo === "object" && choiceInfo.redirect ? Object.assign({}, choiceInfo, {
10668           redirect: {
10669             to: {
10670               key: optionInfo.name,
10671               value: choiceInfo.redirect
10672             }
10673           }
10674         }) : choiceInfo);
10675         break;
10676
10677       case "boolean":
10678         SchemaConstructor = lib.BooleanSchema;
10679         break;
10680
10681       case "flag":
10682         SchemaConstructor = FlagSchema;
10683         parameters.flags = optionInfos.map(optionInfo => [].concat(optionInfo.alias || [], optionInfo.description ? optionInfo.name : [], optionInfo.oppositeDescription ? "no-".concat(optionInfo.name) : [])).reduce((a, b) => a.concat(b), []);
10684         break;
10685
10686       case "path":
10687         SchemaConstructor = lib.StringSchema;
10688         break;
10689
10690       default:
10691         throw new Error("Unexpected type ".concat(optionInfo.type));
10692     }
10693
10694     if (optionInfo.exception) {
10695       parameters.validate = (value, schema, utils) => {
10696         return optionInfo.exception(value) || schema.validate(value, utils);
10697       };
10698     } else {
10699       parameters.validate = (value, schema, utils) => {
10700         return value === undefined || schema.validate(value, utils);
10701       };
10702     }
10703
10704     if (optionInfo.redirect) {
10705       handlers.redirect = value => !value ? undefined : {
10706         to: {
10707           key: optionInfo.redirect.option,
10708           value: optionInfo.redirect.value
10709         }
10710       };
10711     }
10712
10713     if (optionInfo.deprecated) {
10714       handlers.deprecated = true;
10715     } // allow CLI overriding, e.g., prettier package.json --tab-width 1 --tab-width 2
10716
10717
10718     if (isCLI && !optionInfo.array) {
10719       const originalPreprocess = parameters.preprocess || (x => x);
10720
10721       parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? value[value.length - 1] : value), utils);
10722     }
10723
10724     return optionInfo.array ? lib.ArraySchema.create(Object.assign({}, isCLI ? {
10725       preprocess: v => [].concat(v)
10726     } : {}, {}, handlers, {
10727       valueSchema: SchemaConstructor.create(parameters)
10728     })) : SchemaConstructor.create(Object.assign({}, parameters, {}, handlers));
10729   }
10730
10731   function normalizeApiOptions(options, optionInfos, opts) {
10732     return normalizeOptions(options, optionInfos, opts);
10733   }
10734
10735   function normalizeCliOptions(options, optionInfos, opts) {
10736     return normalizeOptions(options, optionInfos, Object.assign({
10737       isCLI: true
10738     }, opts));
10739   }
10740
10741   var optionsNormalizer = {
10742     normalizeApiOptions,
10743     normalizeCliOptions
10744   };
10745
10746   var getLast = arr => arr[arr.length - 1];
10747
10748   function locStart(node, opts) {
10749     opts = opts || {}; // Handle nodes with decorators. They should start at the first decorator
10750
10751     if (!opts.ignoreDecorators && node.declaration && node.declaration.decorators && node.declaration.decorators.length > 0) {
10752       return locStart(node.declaration.decorators[0]);
10753     }
10754
10755     if (!opts.ignoreDecorators && node.decorators && node.decorators.length > 0) {
10756       return locStart(node.decorators[0]);
10757     }
10758
10759     if (node.__location) {
10760       return node.__location.startOffset;
10761     }
10762
10763     if (node.range) {
10764       return node.range[0];
10765     }
10766
10767     if (typeof node.start === "number") {
10768       return node.start;
10769     }
10770
10771     if (node.loc) {
10772       return node.loc.start;
10773     }
10774
10775     return null;
10776   }
10777
10778   function locEnd(node) {
10779     const endNode = node.nodes && getLast(node.nodes);
10780
10781     if (endNode && node.source && !node.source.end) {
10782       node = endNode;
10783     }
10784
10785     if (node.__location) {
10786       return node.__location.endOffset;
10787     }
10788
10789     const loc = node.range ? node.range[1] : typeof node.end === "number" ? node.end : null;
10790
10791     if (node.typeAnnotation) {
10792       return Math.max(loc, locEnd(node.typeAnnotation));
10793     }
10794
10795     if (node.loc && !loc) {
10796       return node.loc.end;
10797     }
10798
10799     return loc;
10800   }
10801
10802   function composeLoc(startNode, endNodeOrLength = startNode) {
10803     const length = typeof endNodeOrLength === "number" ? endNodeOrLength : -1;
10804     const start = locStart(startNode);
10805     const end = length !== -1 ? start + length : locEnd(endNodeOrLength);
10806     const startLoc = startNode.loc.start;
10807     return {
10808       start,
10809       end,
10810       range: [start, end],
10811       loc: {
10812         start: startLoc,
10813         end: length !== -1 ? {
10814           line: startLoc.line,
10815           column: startLoc.column + length
10816         } : endNodeOrLength.loc.end
10817       }
10818     };
10819   }
10820
10821   var loc = {
10822     locStart,
10823     locEnd,
10824     composeLoc
10825   };
10826
10827   var jsTokens = createCommonjsModule(function (module, exports) {
10828     // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
10829     // License: MIT. (See LICENSE.)
10830     Object.defineProperty(exports, "__esModule", {
10831       value: true
10832     }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
10833     // (run `npm run build`).
10834
10835     exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
10836
10837     exports.matchToToken = function (match) {
10838       var token = {
10839         type: "invalid",
10840         value: match[0],
10841         closed: undefined
10842       };
10843       if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
10844       return token;
10845     };
10846   });
10847   unwrapExports(jsTokens);
10848   var jsTokens_1 = jsTokens.matchToToken;
10849
10850   var ast = createCommonjsModule(function (module) {
10851     /*
10852       Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
10853     
10854       Redistribution and use in source and binary forms, with or without
10855       modification, are permitted provided that the following conditions are met:
10856     
10857         * Redistributions of source code must retain the above copyright
10858           notice, this list of conditions and the following disclaimer.
10859         * Redistributions in binary form must reproduce the above copyright
10860           notice, this list of conditions and the following disclaimer in the
10861           documentation and/or other materials provided with the distribution.
10862     
10863       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
10864       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
10865       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
10866       ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
10867       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
10868       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
10869       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
10870       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10871       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
10872       THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10873     */
10874     (function () {
10875
10876       function isExpression(node) {
10877         if (node == null) {
10878           return false;
10879         }
10880
10881         switch (node.type) {
10882           case 'ArrayExpression':
10883           case 'AssignmentExpression':
10884           case 'BinaryExpression':
10885           case 'CallExpression':
10886           case 'ConditionalExpression':
10887           case 'FunctionExpression':
10888           case 'Identifier':
10889           case 'Literal':
10890           case 'LogicalExpression':
10891           case 'MemberExpression':
10892           case 'NewExpression':
10893           case 'ObjectExpression':
10894           case 'SequenceExpression':
10895           case 'ThisExpression':
10896           case 'UnaryExpression':
10897           case 'UpdateExpression':
10898             return true;
10899         }
10900
10901         return false;
10902       }
10903
10904       function isIterationStatement(node) {
10905         if (node == null) {
10906           return false;
10907         }
10908
10909         switch (node.type) {
10910           case 'DoWhileStatement':
10911           case 'ForInStatement':
10912           case 'ForStatement':
10913           case 'WhileStatement':
10914             return true;
10915         }
10916
10917         return false;
10918       }
10919
10920       function isStatement(node) {
10921         if (node == null) {
10922           return false;
10923         }
10924
10925         switch (node.type) {
10926           case 'BlockStatement':
10927           case 'BreakStatement':
10928           case 'ContinueStatement':
10929           case 'DebuggerStatement':
10930           case 'DoWhileStatement':
10931           case 'EmptyStatement':
10932           case 'ExpressionStatement':
10933           case 'ForInStatement':
10934           case 'ForStatement':
10935           case 'IfStatement':
10936           case 'LabeledStatement':
10937           case 'ReturnStatement':
10938           case 'SwitchStatement':
10939           case 'ThrowStatement':
10940           case 'TryStatement':
10941           case 'VariableDeclaration':
10942           case 'WhileStatement':
10943           case 'WithStatement':
10944             return true;
10945         }
10946
10947         return false;
10948       }
10949
10950       function isSourceElement(node) {
10951         return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
10952       }
10953
10954       function trailingStatement(node) {
10955         switch (node.type) {
10956           case 'IfStatement':
10957             if (node.alternate != null) {
10958               return node.alternate;
10959             }
10960
10961             return node.consequent;
10962
10963           case 'LabeledStatement':
10964           case 'ForStatement':
10965           case 'ForInStatement':
10966           case 'WhileStatement':
10967           case 'WithStatement':
10968             return node.body;
10969         }
10970
10971         return null;
10972       }
10973
10974       function isProblematicIfStatement(node) {
10975         var current;
10976
10977         if (node.type !== 'IfStatement') {
10978           return false;
10979         }
10980
10981         if (node.alternate == null) {
10982           return false;
10983         }
10984
10985         current = node.consequent;
10986
10987         do {
10988           if (current.type === 'IfStatement') {
10989             if (current.alternate == null) {
10990               return true;
10991             }
10992           }
10993
10994           current = trailingStatement(current);
10995         } while (current);
10996
10997         return false;
10998       }
10999
11000       module.exports = {
11001         isExpression: isExpression,
11002         isStatement: isStatement,
11003         isIterationStatement: isIterationStatement,
11004         isSourceElement: isSourceElement,
11005         isProblematicIfStatement: isProblematicIfStatement,
11006         trailingStatement: trailingStatement
11007       };
11008     })();
11009     /* vim: set sw=4 ts=4 et tw=80 : */
11010
11011   });
11012   var ast_1 = ast.isExpression;
11013   var ast_2 = ast.isStatement;
11014   var ast_3 = ast.isIterationStatement;
11015   var ast_4 = ast.isSourceElement;
11016   var ast_5 = ast.isProblematicIfStatement;
11017   var ast_6 = ast.trailingStatement;
11018
11019   var code = createCommonjsModule(function (module) {
11020     /*
11021       Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
11022       Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
11023     
11024       Redistribution and use in source and binary forms, with or without
11025       modification, are permitted provided that the following conditions are met:
11026     
11027         * Redistributions of source code must retain the above copyright
11028           notice, this list of conditions and the following disclaimer.
11029         * Redistributions in binary form must reproduce the above copyright
11030           notice, this list of conditions and the following disclaimer in the
11031           documentation and/or other materials provided with the distribution.
11032     
11033       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11034       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11035       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11036       ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
11037       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11038       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
11039       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
11040       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11041       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11042       THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11043     */
11044     (function () {
11045
11046       var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`.
11047
11048       ES5Regex = {
11049         // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart:
11050         NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
11051         // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart:
11052         NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
11053       };
11054       ES6Regex = {
11055         // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart:
11056         NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
11057         // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart:
11058         NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
11059       };
11060
11061       function isDecimalDigit(ch) {
11062         return 0x30 <= ch && ch <= 0x39; // 0..9
11063       }
11064
11065       function isHexDigit(ch) {
11066         return 0x30 <= ch && ch <= 0x39 || // 0..9
11067         0x61 <= ch && ch <= 0x66 || // a..f
11068         0x41 <= ch && ch <= 0x46; // A..F
11069       }
11070
11071       function isOctalDigit(ch) {
11072         return ch >= 0x30 && ch <= 0x37; // 0..7
11073       } // 7.2 White Space
11074
11075
11076       NON_ASCII_WHITESPACES = [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF];
11077
11078       function isWhiteSpace(ch) {
11079         return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
11080       } // 7.3 Line Terminators
11081
11082
11083       function isLineTerminator(ch) {
11084         return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
11085       } // 7.6 Identifier Names and Identifiers
11086
11087
11088       function fromCodePoint(cp) {
11089         if (cp <= 0xFFFF) {
11090           return String.fromCharCode(cp);
11091         }
11092
11093         var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
11094         var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00);
11095         return cu1 + cu2;
11096       }
11097
11098       IDENTIFIER_START = new Array(0x80);
11099
11100       for (ch = 0; ch < 0x80; ++ch) {
11101         IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
11102         ch >= 0x41 && ch <= 0x5A || // A..Z
11103         ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
11104       }
11105
11106       IDENTIFIER_PART = new Array(0x80);
11107
11108       for (ch = 0; ch < 0x80; ++ch) {
11109         IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
11110         ch >= 0x41 && ch <= 0x5A || // A..Z
11111         ch >= 0x30 && ch <= 0x39 || // 0..9
11112         ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
11113       }
11114
11115       function isIdentifierStartES5(ch) {
11116         return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
11117       }
11118
11119       function isIdentifierPartES5(ch) {
11120         return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
11121       }
11122
11123       function isIdentifierStartES6(ch) {
11124         return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
11125       }
11126
11127       function isIdentifierPartES6(ch) {
11128         return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
11129       }
11130
11131       module.exports = {
11132         isDecimalDigit: isDecimalDigit,
11133         isHexDigit: isHexDigit,
11134         isOctalDigit: isOctalDigit,
11135         isWhiteSpace: isWhiteSpace,
11136         isLineTerminator: isLineTerminator,
11137         isIdentifierStartES5: isIdentifierStartES5,
11138         isIdentifierPartES5: isIdentifierPartES5,
11139         isIdentifierStartES6: isIdentifierStartES6,
11140         isIdentifierPartES6: isIdentifierPartES6
11141       };
11142     })();
11143     /* vim: set sw=4 ts=4 et tw=80 : */
11144
11145   });
11146   var code_1 = code.isDecimalDigit;
11147   var code_2 = code.isHexDigit;
11148   var code_3 = code.isOctalDigit;
11149   var code_4 = code.isWhiteSpace;
11150   var code_5 = code.isLineTerminator;
11151   var code_6 = code.isIdentifierStartES5;
11152   var code_7 = code.isIdentifierPartES5;
11153   var code_8 = code.isIdentifierStartES6;
11154   var code_9 = code.isIdentifierPartES6;
11155
11156   var keyword = createCommonjsModule(function (module) {
11157     /*
11158       Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
11159     
11160       Redistribution and use in source and binary forms, with or without
11161       modification, are permitted provided that the following conditions are met:
11162     
11163         * Redistributions of source code must retain the above copyright
11164           notice, this list of conditions and the following disclaimer.
11165         * Redistributions in binary form must reproduce the above copyright
11166           notice, this list of conditions and the following disclaimer in the
11167           documentation and/or other materials provided with the distribution.
11168     
11169       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11170       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11171       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11172       ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
11173       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11174       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
11175       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
11176       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11177       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11178       THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11179     */
11180     (function () {
11181
11182       var code$1 = code;
11183
11184       function isStrictModeReservedWordES6(id) {
11185         switch (id) {
11186           case 'implements':
11187           case 'interface':
11188           case 'package':
11189           case 'private':
11190           case 'protected':
11191           case 'public':
11192           case 'static':
11193           case 'let':
11194             return true;
11195
11196           default:
11197             return false;
11198         }
11199       }
11200
11201       function isKeywordES5(id, strict) {
11202         // yield should not be treated as keyword under non-strict mode.
11203         if (!strict && id === 'yield') {
11204           return false;
11205         }
11206
11207         return isKeywordES6(id, strict);
11208       }
11209
11210       function isKeywordES6(id, strict) {
11211         if (strict && isStrictModeReservedWordES6(id)) {
11212           return true;
11213         }
11214
11215         switch (id.length) {
11216           case 2:
11217             return id === 'if' || id === 'in' || id === 'do';
11218
11219           case 3:
11220             return id === 'var' || id === 'for' || id === 'new' || id === 'try';
11221
11222           case 4:
11223             return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum';
11224
11225           case 5:
11226             return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super';
11227
11228           case 6:
11229             return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import';
11230
11231           case 7:
11232             return id === 'default' || id === 'finally' || id === 'extends';
11233
11234           case 8:
11235             return id === 'function' || id === 'continue' || id === 'debugger';
11236
11237           case 10:
11238             return id === 'instanceof';
11239
11240           default:
11241             return false;
11242         }
11243       }
11244
11245       function isReservedWordES5(id, strict) {
11246         return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
11247       }
11248
11249       function isReservedWordES6(id, strict) {
11250         return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
11251       }
11252
11253       function isRestrictedWord(id) {
11254         return id === 'eval' || id === 'arguments';
11255       }
11256
11257       function isIdentifierNameES5(id) {
11258         var i, iz, ch;
11259
11260         if (id.length === 0) {
11261           return false;
11262         }
11263
11264         ch = id.charCodeAt(0);
11265
11266         if (!code$1.isIdentifierStartES5(ch)) {
11267           return false;
11268         }
11269
11270         for (i = 1, iz = id.length; i < iz; ++i) {
11271           ch = id.charCodeAt(i);
11272
11273           if (!code$1.isIdentifierPartES5(ch)) {
11274             return false;
11275           }
11276         }
11277
11278         return true;
11279       }
11280
11281       function decodeUtf16(lead, trail) {
11282         return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
11283       }
11284
11285       function isIdentifierNameES6(id) {
11286         var i, iz, ch, lowCh, check;
11287
11288         if (id.length === 0) {
11289           return false;
11290         }
11291
11292         check = code$1.isIdentifierStartES6;
11293
11294         for (i = 0, iz = id.length; i < iz; ++i) {
11295           ch = id.charCodeAt(i);
11296
11297           if (0xD800 <= ch && ch <= 0xDBFF) {
11298             ++i;
11299
11300             if (i >= iz) {
11301               return false;
11302             }
11303
11304             lowCh = id.charCodeAt(i);
11305
11306             if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
11307               return false;
11308             }
11309
11310             ch = decodeUtf16(ch, lowCh);
11311           }
11312
11313           if (!check(ch)) {
11314             return false;
11315           }
11316
11317           check = code$1.isIdentifierPartES6;
11318         }
11319
11320         return true;
11321       }
11322
11323       function isIdentifierES5(id, strict) {
11324         return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
11325       }
11326
11327       function isIdentifierES6(id, strict) {
11328         return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
11329       }
11330
11331       module.exports = {
11332         isKeywordES5: isKeywordES5,
11333         isKeywordES6: isKeywordES6,
11334         isReservedWordES5: isReservedWordES5,
11335         isReservedWordES6: isReservedWordES6,
11336         isRestrictedWord: isRestrictedWord,
11337         isIdentifierNameES5: isIdentifierNameES5,
11338         isIdentifierNameES6: isIdentifierNameES6,
11339         isIdentifierES5: isIdentifierES5,
11340         isIdentifierES6: isIdentifierES6
11341       };
11342     })();
11343     /* vim: set sw=4 ts=4 et tw=80 : */
11344
11345   });
11346   var keyword_1 = keyword.isKeywordES5;
11347   var keyword_2 = keyword.isKeywordES6;
11348   var keyword_3 = keyword.isReservedWordES5;
11349   var keyword_4 = keyword.isReservedWordES6;
11350   var keyword_5 = keyword.isRestrictedWord;
11351   var keyword_6 = keyword.isIdentifierNameES5;
11352   var keyword_7 = keyword.isIdentifierNameES6;
11353   var keyword_8 = keyword.isIdentifierES5;
11354   var keyword_9 = keyword.isIdentifierES6;
11355
11356   var utils$1 = createCommonjsModule(function (module, exports) {
11357     /*
11358       Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
11359     
11360       Redistribution and use in source and binary forms, with or without
11361       modification, are permitted provided that the following conditions are met:
11362     
11363         * Redistributions of source code must retain the above copyright
11364           notice, this list of conditions and the following disclaimer.
11365         * Redistributions in binary form must reproduce the above copyright
11366           notice, this list of conditions and the following disclaimer in the
11367           documentation and/or other materials provided with the distribution.
11368     
11369       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11370       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11371       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11372       ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
11373       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11374       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
11375       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
11376       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11377       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11378       THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11379     */
11380     (function () {
11381
11382       exports.ast = ast;
11383       exports.code = code;
11384       exports.keyword = keyword;
11385     })();
11386     /* vim: set sw=4 ts=4 et tw=80 : */
11387
11388   });
11389   var utils_1$1 = utils$1.ast;
11390   var utils_2$1 = utils$1.code;
11391   var utils_3$1 = utils$1.keyword;
11392
11393   var matchOperatorsRe$1 = /[|\\{}()[\]^$+*?.]/g;
11394
11395   var escapeStringRegexp$1 = function escapeStringRegexp(str) {
11396     if (typeof str !== 'string') {
11397       throw new TypeError('Expected a string');
11398     }
11399
11400     return str.replace(matchOperatorsRe$1, '\\$&');
11401   };
11402
11403   var colorName$2 = {
11404     "aliceblue": [240, 248, 255],
11405     "antiquewhite": [250, 235, 215],
11406     "aqua": [0, 255, 255],
11407     "aquamarine": [127, 255, 212],
11408     "azure": [240, 255, 255],
11409     "beige": [245, 245, 220],
11410     "bisque": [255, 228, 196],
11411     "black": [0, 0, 0],
11412     "blanchedalmond": [255, 235, 205],
11413     "blue": [0, 0, 255],
11414     "blueviolet": [138, 43, 226],
11415     "brown": [165, 42, 42],
11416     "burlywood": [222, 184, 135],
11417     "cadetblue": [95, 158, 160],
11418     "chartreuse": [127, 255, 0],
11419     "chocolate": [210, 105, 30],
11420     "coral": [255, 127, 80],
11421     "cornflowerblue": [100, 149, 237],
11422     "cornsilk": [255, 248, 220],
11423     "crimson": [220, 20, 60],
11424     "cyan": [0, 255, 255],
11425     "darkblue": [0, 0, 139],
11426     "darkcyan": [0, 139, 139],
11427     "darkgoldenrod": [184, 134, 11],
11428     "darkgray": [169, 169, 169],
11429     "darkgreen": [0, 100, 0],
11430     "darkgrey": [169, 169, 169],
11431     "darkkhaki": [189, 183, 107],
11432     "darkmagenta": [139, 0, 139],
11433     "darkolivegreen": [85, 107, 47],
11434     "darkorange": [255, 140, 0],
11435     "darkorchid": [153, 50, 204],
11436     "darkred": [139, 0, 0],
11437     "darksalmon": [233, 150, 122],
11438     "darkseagreen": [143, 188, 143],
11439     "darkslateblue": [72, 61, 139],
11440     "darkslategray": [47, 79, 79],
11441     "darkslategrey": [47, 79, 79],
11442     "darkturquoise": [0, 206, 209],
11443     "darkviolet": [148, 0, 211],
11444     "deeppink": [255, 20, 147],
11445     "deepskyblue": [0, 191, 255],
11446     "dimgray": [105, 105, 105],
11447     "dimgrey": [105, 105, 105],
11448     "dodgerblue": [30, 144, 255],
11449     "firebrick": [178, 34, 34],
11450     "floralwhite": [255, 250, 240],
11451     "forestgreen": [34, 139, 34],
11452     "fuchsia": [255, 0, 255],
11453     "gainsboro": [220, 220, 220],
11454     "ghostwhite": [248, 248, 255],
11455     "gold": [255, 215, 0],
11456     "goldenrod": [218, 165, 32],
11457     "gray": [128, 128, 128],
11458     "green": [0, 128, 0],
11459     "greenyellow": [173, 255, 47],
11460     "grey": [128, 128, 128],
11461     "honeydew": [240, 255, 240],
11462     "hotpink": [255, 105, 180],
11463     "indianred": [205, 92, 92],
11464     "indigo": [75, 0, 130],
11465     "ivory": [255, 255, 240],
11466     "khaki": [240, 230, 140],
11467     "lavender": [230, 230, 250],
11468     "lavenderblush": [255, 240, 245],
11469     "lawngreen": [124, 252, 0],
11470     "lemonchiffon": [255, 250, 205],
11471     "lightblue": [173, 216, 230],
11472     "lightcoral": [240, 128, 128],
11473     "lightcyan": [224, 255, 255],
11474     "lightgoldenrodyellow": [250, 250, 210],
11475     "lightgray": [211, 211, 211],
11476     "lightgreen": [144, 238, 144],
11477     "lightgrey": [211, 211, 211],
11478     "lightpink": [255, 182, 193],
11479     "lightsalmon": [255, 160, 122],
11480     "lightseagreen": [32, 178, 170],
11481     "lightskyblue": [135, 206, 250],
11482     "lightslategray": [119, 136, 153],
11483     "lightslategrey": [119, 136, 153],
11484     "lightsteelblue": [176, 196, 222],
11485     "lightyellow": [255, 255, 224],
11486     "lime": [0, 255, 0],
11487     "limegreen": [50, 205, 50],
11488     "linen": [250, 240, 230],
11489     "magenta": [255, 0, 255],
11490     "maroon": [128, 0, 0],
11491     "mediumaquamarine": [102, 205, 170],
11492     "mediumblue": [0, 0, 205],
11493     "mediumorchid": [186, 85, 211],
11494     "mediumpurple": [147, 112, 219],
11495     "mediumseagreen": [60, 179, 113],
11496     "mediumslateblue": [123, 104, 238],
11497     "mediumspringgreen": [0, 250, 154],
11498     "mediumturquoise": [72, 209, 204],
11499     "mediumvioletred": [199, 21, 133],
11500     "midnightblue": [25, 25, 112],
11501     "mintcream": [245, 255, 250],
11502     "mistyrose": [255, 228, 225],
11503     "moccasin": [255, 228, 181],
11504     "navajowhite": [255, 222, 173],
11505     "navy": [0, 0, 128],
11506     "oldlace": [253, 245, 230],
11507     "olive": [128, 128, 0],
11508     "olivedrab": [107, 142, 35],
11509     "orange": [255, 165, 0],
11510     "orangered": [255, 69, 0],
11511     "orchid": [218, 112, 214],
11512     "palegoldenrod": [238, 232, 170],
11513     "palegreen": [152, 251, 152],
11514     "paleturquoise": [175, 238, 238],
11515     "palevioletred": [219, 112, 147],
11516     "papayawhip": [255, 239, 213],
11517     "peachpuff": [255, 218, 185],
11518     "peru": [205, 133, 63],
11519     "pink": [255, 192, 203],
11520     "plum": [221, 160, 221],
11521     "powderblue": [176, 224, 230],
11522     "purple": [128, 0, 128],
11523     "rebeccapurple": [102, 51, 153],
11524     "red": [255, 0, 0],
11525     "rosybrown": [188, 143, 143],
11526     "royalblue": [65, 105, 225],
11527     "saddlebrown": [139, 69, 19],
11528     "salmon": [250, 128, 114],
11529     "sandybrown": [244, 164, 96],
11530     "seagreen": [46, 139, 87],
11531     "seashell": [255, 245, 238],
11532     "sienna": [160, 82, 45],
11533     "silver": [192, 192, 192],
11534     "skyblue": [135, 206, 235],
11535     "slateblue": [106, 90, 205],
11536     "slategray": [112, 128, 144],
11537     "slategrey": [112, 128, 144],
11538     "snow": [255, 250, 250],
11539     "springgreen": [0, 255, 127],
11540     "steelblue": [70, 130, 180],
11541     "tan": [210, 180, 140],
11542     "teal": [0, 128, 128],
11543     "thistle": [216, 191, 216],
11544     "tomato": [255, 99, 71],
11545     "turquoise": [64, 224, 208],
11546     "violet": [238, 130, 238],
11547     "wheat": [245, 222, 179],
11548     "white": [255, 255, 255],
11549     "whitesmoke": [245, 245, 245],
11550     "yellow": [255, 255, 0],
11551     "yellowgreen": [154, 205, 50]
11552   };
11553
11554   var conversions$2 = createCommonjsModule(function (module) {
11555     /* MIT license */
11556     // NOTE: conversions should only return primitive values (i.e. arrays, or
11557     //       values that give correct `typeof` results).
11558     //       do not use box values types (i.e. Number(), String(), etc.)
11559     var reverseKeywords = {};
11560
11561     for (var key in colorName$2) {
11562       if (colorName$2.hasOwnProperty(key)) {
11563         reverseKeywords[colorName$2[key]] = key;
11564       }
11565     }
11566
11567     var convert = module.exports = {
11568       rgb: {
11569         channels: 3,
11570         labels: 'rgb'
11571       },
11572       hsl: {
11573         channels: 3,
11574         labels: 'hsl'
11575       },
11576       hsv: {
11577         channels: 3,
11578         labels: 'hsv'
11579       },
11580       hwb: {
11581         channels: 3,
11582         labels: 'hwb'
11583       },
11584       cmyk: {
11585         channels: 4,
11586         labels: 'cmyk'
11587       },
11588       xyz: {
11589         channels: 3,
11590         labels: 'xyz'
11591       },
11592       lab: {
11593         channels: 3,
11594         labels: 'lab'
11595       },
11596       lch: {
11597         channels: 3,
11598         labels: 'lch'
11599       },
11600       hex: {
11601         channels: 1,
11602         labels: ['hex']
11603       },
11604       keyword: {
11605         channels: 1,
11606         labels: ['keyword']
11607       },
11608       ansi16: {
11609         channels: 1,
11610         labels: ['ansi16']
11611       },
11612       ansi256: {
11613         channels: 1,
11614         labels: ['ansi256']
11615       },
11616       hcg: {
11617         channels: 3,
11618         labels: ['h', 'c', 'g']
11619       },
11620       apple: {
11621         channels: 3,
11622         labels: ['r16', 'g16', 'b16']
11623       },
11624       gray: {
11625         channels: 1,
11626         labels: ['gray']
11627       }
11628     }; // hide .channels and .labels properties
11629
11630     for (var model in convert) {
11631       if (convert.hasOwnProperty(model)) {
11632         if (!('channels' in convert[model])) {
11633           throw new Error('missing channels property: ' + model);
11634         }
11635
11636         if (!('labels' in convert[model])) {
11637           throw new Error('missing channel labels property: ' + model);
11638         }
11639
11640         if (convert[model].labels.length !== convert[model].channels) {
11641           throw new Error('channel and label counts mismatch: ' + model);
11642         }
11643
11644         var channels = convert[model].channels;
11645         var labels = convert[model].labels;
11646         delete convert[model].channels;
11647         delete convert[model].labels;
11648         Object.defineProperty(convert[model], 'channels', {
11649           value: channels
11650         });
11651         Object.defineProperty(convert[model], 'labels', {
11652           value: labels
11653         });
11654       }
11655     }
11656
11657     convert.rgb.hsl = function (rgb) {
11658       var r = rgb[0] / 255;
11659       var g = rgb[1] / 255;
11660       var b = rgb[2] / 255;
11661       var min = Math.min(r, g, b);
11662       var max = Math.max(r, g, b);
11663       var delta = max - min;
11664       var h;
11665       var s;
11666       var l;
11667
11668       if (max === min) {
11669         h = 0;
11670       } else if (r === max) {
11671         h = (g - b) / delta;
11672       } else if (g === max) {
11673         h = 2 + (b - r) / delta;
11674       } else if (b === max) {
11675         h = 4 + (r - g) / delta;
11676       }
11677
11678       h = Math.min(h * 60, 360);
11679
11680       if (h < 0) {
11681         h += 360;
11682       }
11683
11684       l = (min + max) / 2;
11685
11686       if (max === min) {
11687         s = 0;
11688       } else if (l <= 0.5) {
11689         s = delta / (max + min);
11690       } else {
11691         s = delta / (2 - max - min);
11692       }
11693
11694       return [h, s * 100, l * 100];
11695     };
11696
11697     convert.rgb.hsv = function (rgb) {
11698       var rdif;
11699       var gdif;
11700       var bdif;
11701       var h;
11702       var s;
11703       var r = rgb[0] / 255;
11704       var g = rgb[1] / 255;
11705       var b = rgb[2] / 255;
11706       var v = Math.max(r, g, b);
11707       var diff = v - Math.min(r, g, b);
11708
11709       var diffc = function diffc(c) {
11710         return (v - c) / 6 / diff + 1 / 2;
11711       };
11712
11713       if (diff === 0) {
11714         h = s = 0;
11715       } else {
11716         s = diff / v;
11717         rdif = diffc(r);
11718         gdif = diffc(g);
11719         bdif = diffc(b);
11720
11721         if (r === v) {
11722           h = bdif - gdif;
11723         } else if (g === v) {
11724           h = 1 / 3 + rdif - bdif;
11725         } else if (b === v) {
11726           h = 2 / 3 + gdif - rdif;
11727         }
11728
11729         if (h < 0) {
11730           h += 1;
11731         } else if (h > 1) {
11732           h -= 1;
11733         }
11734       }
11735
11736       return [h * 360, s * 100, v * 100];
11737     };
11738
11739     convert.rgb.hwb = function (rgb) {
11740       var r = rgb[0];
11741       var g = rgb[1];
11742       var b = rgb[2];
11743       var h = convert.rgb.hsl(rgb)[0];
11744       var w = 1 / 255 * Math.min(r, Math.min(g, b));
11745       b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
11746       return [h, w * 100, b * 100];
11747     };
11748
11749     convert.rgb.cmyk = function (rgb) {
11750       var r = rgb[0] / 255;
11751       var g = rgb[1] / 255;
11752       var b = rgb[2] / 255;
11753       var c;
11754       var m;
11755       var y;
11756       var k;
11757       k = Math.min(1 - r, 1 - g, 1 - b);
11758       c = (1 - r - k) / (1 - k) || 0;
11759       m = (1 - g - k) / (1 - k) || 0;
11760       y = (1 - b - k) / (1 - k) || 0;
11761       return [c * 100, m * 100, y * 100, k * 100];
11762     };
11763     /**
11764      * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
11765      * */
11766
11767
11768     function comparativeDistance(x, y) {
11769       return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
11770     }
11771
11772     convert.rgb.keyword = function (rgb) {
11773       var reversed = reverseKeywords[rgb];
11774
11775       if (reversed) {
11776         return reversed;
11777       }
11778
11779       var currentClosestDistance = Infinity;
11780       var currentClosestKeyword;
11781
11782       for (var keyword in colorName$2) {
11783         if (colorName$2.hasOwnProperty(keyword)) {
11784           var value = colorName$2[keyword]; // Compute comparative distance
11785
11786           var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
11787
11788           if (distance < currentClosestDistance) {
11789             currentClosestDistance = distance;
11790             currentClosestKeyword = keyword;
11791           }
11792         }
11793       }
11794
11795       return currentClosestKeyword;
11796     };
11797
11798     convert.keyword.rgb = function (keyword) {
11799       return colorName$2[keyword];
11800     };
11801
11802     convert.rgb.xyz = function (rgb) {
11803       var r = rgb[0] / 255;
11804       var g = rgb[1] / 255;
11805       var b = rgb[2] / 255; // assume sRGB
11806
11807       r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
11808       g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
11809       b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
11810       var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
11811       var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
11812       var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
11813       return [x * 100, y * 100, z * 100];
11814     };
11815
11816     convert.rgb.lab = function (rgb) {
11817       var xyz = convert.rgb.xyz(rgb);
11818       var x = xyz[0];
11819       var y = xyz[1];
11820       var z = xyz[2];
11821       var l;
11822       var a;
11823       var b;
11824       x /= 95.047;
11825       y /= 100;
11826       z /= 108.883;
11827       x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
11828       y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
11829       z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
11830       l = 116 * y - 16;
11831       a = 500 * (x - y);
11832       b = 200 * (y - z);
11833       return [l, a, b];
11834     };
11835
11836     convert.hsl.rgb = function (hsl) {
11837       var h = hsl[0] / 360;
11838       var s = hsl[1] / 100;
11839       var l = hsl[2] / 100;
11840       var t1;
11841       var t2;
11842       var t3;
11843       var rgb;
11844       var val;
11845
11846       if (s === 0) {
11847         val = l * 255;
11848         return [val, val, val];
11849       }
11850
11851       if (l < 0.5) {
11852         t2 = l * (1 + s);
11853       } else {
11854         t2 = l + s - l * s;
11855       }
11856
11857       t1 = 2 * l - t2;
11858       rgb = [0, 0, 0];
11859
11860       for (var i = 0; i < 3; i++) {
11861         t3 = h + 1 / 3 * -(i - 1);
11862
11863         if (t3 < 0) {
11864           t3++;
11865         }
11866
11867         if (t3 > 1) {
11868           t3--;
11869         }
11870
11871         if (6 * t3 < 1) {
11872           val = t1 + (t2 - t1) * 6 * t3;
11873         } else if (2 * t3 < 1) {
11874           val = t2;
11875         } else if (3 * t3 < 2) {
11876           val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
11877         } else {
11878           val = t1;
11879         }
11880
11881         rgb[i] = val * 255;
11882       }
11883
11884       return rgb;
11885     };
11886
11887     convert.hsl.hsv = function (hsl) {
11888       var h = hsl[0];
11889       var s = hsl[1] / 100;
11890       var l = hsl[2] / 100;
11891       var smin = s;
11892       var lmin = Math.max(l, 0.01);
11893       var sv;
11894       var v;
11895       l *= 2;
11896       s *= l <= 1 ? l : 2 - l;
11897       smin *= lmin <= 1 ? lmin : 2 - lmin;
11898       v = (l + s) / 2;
11899       sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
11900       return [h, sv * 100, v * 100];
11901     };
11902
11903     convert.hsv.rgb = function (hsv) {
11904       var h = hsv[0] / 60;
11905       var s = hsv[1] / 100;
11906       var v = hsv[2] / 100;
11907       var hi = Math.floor(h) % 6;
11908       var f = h - Math.floor(h);
11909       var p = 255 * v * (1 - s);
11910       var q = 255 * v * (1 - s * f);
11911       var t = 255 * v * (1 - s * (1 - f));
11912       v *= 255;
11913
11914       switch (hi) {
11915         case 0:
11916           return [v, t, p];
11917
11918         case 1:
11919           return [q, v, p];
11920
11921         case 2:
11922           return [p, v, t];
11923
11924         case 3:
11925           return [p, q, v];
11926
11927         case 4:
11928           return [t, p, v];
11929
11930         case 5:
11931           return [v, p, q];
11932       }
11933     };
11934
11935     convert.hsv.hsl = function (hsv) {
11936       var h = hsv[0];
11937       var s = hsv[1] / 100;
11938       var v = hsv[2] / 100;
11939       var vmin = Math.max(v, 0.01);
11940       var lmin;
11941       var sl;
11942       var l;
11943       l = (2 - s) * v;
11944       lmin = (2 - s) * vmin;
11945       sl = s * vmin;
11946       sl /= lmin <= 1 ? lmin : 2 - lmin;
11947       sl = sl || 0;
11948       l /= 2;
11949       return [h, sl * 100, l * 100];
11950     }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
11951
11952
11953     convert.hwb.rgb = function (hwb) {
11954       var h = hwb[0] / 360;
11955       var wh = hwb[1] / 100;
11956       var bl = hwb[2] / 100;
11957       var ratio = wh + bl;
11958       var i;
11959       var v;
11960       var f;
11961       var n; // wh + bl cant be > 1
11962
11963       if (ratio > 1) {
11964         wh /= ratio;
11965         bl /= ratio;
11966       }
11967
11968       i = Math.floor(6 * h);
11969       v = 1 - bl;
11970       f = 6 * h - i;
11971
11972       if ((i & 0x01) !== 0) {
11973         f = 1 - f;
11974       }
11975
11976       n = wh + f * (v - wh); // linear interpolation
11977
11978       var r;
11979       var g;
11980       var b;
11981
11982       switch (i) {
11983         default:
11984         case 6:
11985         case 0:
11986           r = v;
11987           g = n;
11988           b = wh;
11989           break;
11990
11991         case 1:
11992           r = n;
11993           g = v;
11994           b = wh;
11995           break;
11996
11997         case 2:
11998           r = wh;
11999           g = v;
12000           b = n;
12001           break;
12002
12003         case 3:
12004           r = wh;
12005           g = n;
12006           b = v;
12007           break;
12008
12009         case 4:
12010           r = n;
12011           g = wh;
12012           b = v;
12013           break;
12014
12015         case 5:
12016           r = v;
12017           g = wh;
12018           b = n;
12019           break;
12020       }
12021
12022       return [r * 255, g * 255, b * 255];
12023     };
12024
12025     convert.cmyk.rgb = function (cmyk) {
12026       var c = cmyk[0] / 100;
12027       var m = cmyk[1] / 100;
12028       var y = cmyk[2] / 100;
12029       var k = cmyk[3] / 100;
12030       var r;
12031       var g;
12032       var b;
12033       r = 1 - Math.min(1, c * (1 - k) + k);
12034       g = 1 - Math.min(1, m * (1 - k) + k);
12035       b = 1 - Math.min(1, y * (1 - k) + k);
12036       return [r * 255, g * 255, b * 255];
12037     };
12038
12039     convert.xyz.rgb = function (xyz) {
12040       var x = xyz[0] / 100;
12041       var y = xyz[1] / 100;
12042       var z = xyz[2] / 100;
12043       var r;
12044       var g;
12045       var b;
12046       r = x * 3.2406 + y * -1.5372 + z * -0.4986;
12047       g = x * -0.9689 + y * 1.8758 + z * 0.0415;
12048       b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
12049
12050       r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
12051       g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
12052       b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
12053       r = Math.min(Math.max(0, r), 1);
12054       g = Math.min(Math.max(0, g), 1);
12055       b = Math.min(Math.max(0, b), 1);
12056       return [r * 255, g * 255, b * 255];
12057     };
12058
12059     convert.xyz.lab = function (xyz) {
12060       var x = xyz[0];
12061       var y = xyz[1];
12062       var z = xyz[2];
12063       var l;
12064       var a;
12065       var b;
12066       x /= 95.047;
12067       y /= 100;
12068       z /= 108.883;
12069       x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
12070       y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
12071       z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
12072       l = 116 * y - 16;
12073       a = 500 * (x - y);
12074       b = 200 * (y - z);
12075       return [l, a, b];
12076     };
12077
12078     convert.lab.xyz = function (lab) {
12079       var l = lab[0];
12080       var a = lab[1];
12081       var b = lab[2];
12082       var x;
12083       var y;
12084       var z;
12085       y = (l + 16) / 116;
12086       x = a / 500 + y;
12087       z = y - b / 200;
12088       var y2 = Math.pow(y, 3);
12089       var x2 = Math.pow(x, 3);
12090       var z2 = Math.pow(z, 3);
12091       y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
12092       x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
12093       z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
12094       x *= 95.047;
12095       y *= 100;
12096       z *= 108.883;
12097       return [x, y, z];
12098     };
12099
12100     convert.lab.lch = function (lab) {
12101       var l = lab[0];
12102       var a = lab[1];
12103       var b = lab[2];
12104       var hr;
12105       var h;
12106       var c;
12107       hr = Math.atan2(b, a);
12108       h = hr * 360 / 2 / Math.PI;
12109
12110       if (h < 0) {
12111         h += 360;
12112       }
12113
12114       c = Math.sqrt(a * a + b * b);
12115       return [l, c, h];
12116     };
12117
12118     convert.lch.lab = function (lch) {
12119       var l = lch[0];
12120       var c = lch[1];
12121       var h = lch[2];
12122       var a;
12123       var b;
12124       var hr;
12125       hr = h / 360 * 2 * Math.PI;
12126       a = c * Math.cos(hr);
12127       b = c * Math.sin(hr);
12128       return [l, a, b];
12129     };
12130
12131     convert.rgb.ansi16 = function (args) {
12132       var r = args[0];
12133       var g = args[1];
12134       var b = args[2];
12135       var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
12136
12137       value = Math.round(value / 50);
12138
12139       if (value === 0) {
12140         return 30;
12141       }
12142
12143       var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
12144
12145       if (value === 2) {
12146         ansi += 60;
12147       }
12148
12149       return ansi;
12150     };
12151
12152     convert.hsv.ansi16 = function (args) {
12153       // optimization here; we already know the value and don't need to get
12154       // it converted for us.
12155       return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
12156     };
12157
12158     convert.rgb.ansi256 = function (args) {
12159       var r = args[0];
12160       var g = args[1];
12161       var b = args[2]; // we use the extended greyscale palette here, with the exception of
12162       // black and white. normal palette only has 4 greyscale shades.
12163
12164       if (r === g && g === b) {
12165         if (r < 8) {
12166           return 16;
12167         }
12168
12169         if (r > 248) {
12170           return 231;
12171         }
12172
12173         return Math.round((r - 8) / 247 * 24) + 232;
12174       }
12175
12176       var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
12177       return ansi;
12178     };
12179
12180     convert.ansi16.rgb = function (args) {
12181       var color = args % 10; // handle greyscale
12182
12183       if (color === 0 || color === 7) {
12184         if (args > 50) {
12185           color += 3.5;
12186         }
12187
12188         color = color / 10.5 * 255;
12189         return [color, color, color];
12190       }
12191
12192       var mult = (~~(args > 50) + 1) * 0.5;
12193       var r = (color & 1) * mult * 255;
12194       var g = (color >> 1 & 1) * mult * 255;
12195       var b = (color >> 2 & 1) * mult * 255;
12196       return [r, g, b];
12197     };
12198
12199     convert.ansi256.rgb = function (args) {
12200       // handle greyscale
12201       if (args >= 232) {
12202         var c = (args - 232) * 10 + 8;
12203         return [c, c, c];
12204       }
12205
12206       args -= 16;
12207       var rem;
12208       var r = Math.floor(args / 36) / 5 * 255;
12209       var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
12210       var b = rem % 6 / 5 * 255;
12211       return [r, g, b];
12212     };
12213
12214     convert.rgb.hex = function (args) {
12215       var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
12216       var string = integer.toString(16).toUpperCase();
12217       return '000000'.substring(string.length) + string;
12218     };
12219
12220     convert.hex.rgb = function (args) {
12221       var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
12222
12223       if (!match) {
12224         return [0, 0, 0];
12225       }
12226
12227       var colorString = match[0];
12228
12229       if (match[0].length === 3) {
12230         colorString = colorString.split('').map(function (char) {
12231           return char + char;
12232         }).join('');
12233       }
12234
12235       var integer = parseInt(colorString, 16);
12236       var r = integer >> 16 & 0xFF;
12237       var g = integer >> 8 & 0xFF;
12238       var b = integer & 0xFF;
12239       return [r, g, b];
12240     };
12241
12242     convert.rgb.hcg = function (rgb) {
12243       var r = rgb[0] / 255;
12244       var g = rgb[1] / 255;
12245       var b = rgb[2] / 255;
12246       var max = Math.max(Math.max(r, g), b);
12247       var min = Math.min(Math.min(r, g), b);
12248       var chroma = max - min;
12249       var grayscale;
12250       var hue;
12251
12252       if (chroma < 1) {
12253         grayscale = min / (1 - chroma);
12254       } else {
12255         grayscale = 0;
12256       }
12257
12258       if (chroma <= 0) {
12259         hue = 0;
12260       } else if (max === r) {
12261         hue = (g - b) / chroma % 6;
12262       } else if (max === g) {
12263         hue = 2 + (b - r) / chroma;
12264       } else {
12265         hue = 4 + (r - g) / chroma + 4;
12266       }
12267
12268       hue /= 6;
12269       hue %= 1;
12270       return [hue * 360, chroma * 100, grayscale * 100];
12271     };
12272
12273     convert.hsl.hcg = function (hsl) {
12274       var s = hsl[1] / 100;
12275       var l = hsl[2] / 100;
12276       var c = 1;
12277       var f = 0;
12278
12279       if (l < 0.5) {
12280         c = 2.0 * s * l;
12281       } else {
12282         c = 2.0 * s * (1.0 - l);
12283       }
12284
12285       if (c < 1.0) {
12286         f = (l - 0.5 * c) / (1.0 - c);
12287       }
12288
12289       return [hsl[0], c * 100, f * 100];
12290     };
12291
12292     convert.hsv.hcg = function (hsv) {
12293       var s = hsv[1] / 100;
12294       var v = hsv[2] / 100;
12295       var c = s * v;
12296       var f = 0;
12297
12298       if (c < 1.0) {
12299         f = (v - c) / (1 - c);
12300       }
12301
12302       return [hsv[0], c * 100, f * 100];
12303     };
12304
12305     convert.hcg.rgb = function (hcg) {
12306       var h = hcg[0] / 360;
12307       var c = hcg[1] / 100;
12308       var g = hcg[2] / 100;
12309
12310       if (c === 0.0) {
12311         return [g * 255, g * 255, g * 255];
12312       }
12313
12314       var pure = [0, 0, 0];
12315       var hi = h % 1 * 6;
12316       var v = hi % 1;
12317       var w = 1 - v;
12318       var mg = 0;
12319
12320       switch (Math.floor(hi)) {
12321         case 0:
12322           pure[0] = 1;
12323           pure[1] = v;
12324           pure[2] = 0;
12325           break;
12326
12327         case 1:
12328           pure[0] = w;
12329           pure[1] = 1;
12330           pure[2] = 0;
12331           break;
12332
12333         case 2:
12334           pure[0] = 0;
12335           pure[1] = 1;
12336           pure[2] = v;
12337           break;
12338
12339         case 3:
12340           pure[0] = 0;
12341           pure[1] = w;
12342           pure[2] = 1;
12343           break;
12344
12345         case 4:
12346           pure[0] = v;
12347           pure[1] = 0;
12348           pure[2] = 1;
12349           break;
12350
12351         default:
12352           pure[0] = 1;
12353           pure[1] = 0;
12354           pure[2] = w;
12355       }
12356
12357       mg = (1.0 - c) * g;
12358       return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
12359     };
12360
12361     convert.hcg.hsv = function (hcg) {
12362       var c = hcg[1] / 100;
12363       var g = hcg[2] / 100;
12364       var v = c + g * (1.0 - c);
12365       var f = 0;
12366
12367       if (v > 0.0) {
12368         f = c / v;
12369       }
12370
12371       return [hcg[0], f * 100, v * 100];
12372     };
12373
12374     convert.hcg.hsl = function (hcg) {
12375       var c = hcg[1] / 100;
12376       var g = hcg[2] / 100;
12377       var l = g * (1.0 - c) + 0.5 * c;
12378       var s = 0;
12379
12380       if (l > 0.0 && l < 0.5) {
12381         s = c / (2 * l);
12382       } else if (l >= 0.5 && l < 1.0) {
12383         s = c / (2 * (1 - l));
12384       }
12385
12386       return [hcg[0], s * 100, l * 100];
12387     };
12388
12389     convert.hcg.hwb = function (hcg) {
12390       var c = hcg[1] / 100;
12391       var g = hcg[2] / 100;
12392       var v = c + g * (1.0 - c);
12393       return [hcg[0], (v - c) * 100, (1 - v) * 100];
12394     };
12395
12396     convert.hwb.hcg = function (hwb) {
12397       var w = hwb[1] / 100;
12398       var b = hwb[2] / 100;
12399       var v = 1 - b;
12400       var c = v - w;
12401       var g = 0;
12402
12403       if (c < 1) {
12404         g = (v - c) / (1 - c);
12405       }
12406
12407       return [hwb[0], c * 100, g * 100];
12408     };
12409
12410     convert.apple.rgb = function (apple) {
12411       return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
12412     };
12413
12414     convert.rgb.apple = function (rgb) {
12415       return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
12416     };
12417
12418     convert.gray.rgb = function (args) {
12419       return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
12420     };
12421
12422     convert.gray.hsl = convert.gray.hsv = function (args) {
12423       return [0, 0, args[0]];
12424     };
12425
12426     convert.gray.hwb = function (gray) {
12427       return [0, 100, gray[0]];
12428     };
12429
12430     convert.gray.cmyk = function (gray) {
12431       return [0, 0, 0, gray[0]];
12432     };
12433
12434     convert.gray.lab = function (gray) {
12435       return [gray[0], 0, 0];
12436     };
12437
12438     convert.gray.hex = function (gray) {
12439       var val = Math.round(gray[0] / 100 * 255) & 0xFF;
12440       var integer = (val << 16) + (val << 8) + val;
12441       var string = integer.toString(16).toUpperCase();
12442       return '000000'.substring(string.length) + string;
12443     };
12444
12445     convert.rgb.gray = function (rgb) {
12446       var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
12447       return [val / 255 * 100];
12448     };
12449   });
12450   var conversions_1$1 = conversions$2.rgb;
12451   var conversions_2$1 = conversions$2.hsl;
12452   var conversions_3$1 = conversions$2.hsv;
12453   var conversions_4$1 = conversions$2.hwb;
12454   var conversions_5$1 = conversions$2.cmyk;
12455   var conversions_6$1 = conversions$2.xyz;
12456   var conversions_7$1 = conversions$2.lab;
12457   var conversions_8$1 = conversions$2.lch;
12458   var conversions_9$1 = conversions$2.hex;
12459   var conversions_10$1 = conversions$2.keyword;
12460   var conversions_11$1 = conversions$2.ansi16;
12461   var conversions_12$1 = conversions$2.ansi256;
12462   var conversions_13$1 = conversions$2.hcg;
12463   var conversions_14$1 = conversions$2.apple;
12464   var conversions_15$1 = conversions$2.gray;
12465
12466   /*
12467         this function routes a model to all other models.
12468
12469         all functions that are routed have a property `.conversion` attached
12470         to the returned synthetic function. This property is an array
12471         of strings, each with the steps in between the 'from' and 'to'
12472         color models (inclusive).
12473
12474         conversions that are not possible simply are not included.
12475   */
12476
12477   function buildGraph$2() {
12478     var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
12479
12480     var models = Object.keys(conversions$2);
12481
12482     for (var len = models.length, i = 0; i < len; i++) {
12483       graph[models[i]] = {
12484         // http://jsperf.com/1-vs-infinity
12485         // micro-opt, but this is simple.
12486         distance: -1,
12487         parent: null
12488       };
12489     }
12490
12491     return graph;
12492   } // https://en.wikipedia.org/wiki/Breadth-first_search
12493
12494
12495   function deriveBFS$2(fromModel) {
12496     var graph = buildGraph$2();
12497     var queue = [fromModel]; // unshift -> queue -> pop
12498
12499     graph[fromModel].distance = 0;
12500
12501     while (queue.length) {
12502       var current = queue.pop();
12503       var adjacents = Object.keys(conversions$2[current]);
12504
12505       for (var len = adjacents.length, i = 0; i < len; i++) {
12506         var adjacent = adjacents[i];
12507         var node = graph[adjacent];
12508
12509         if (node.distance === -1) {
12510           node.distance = graph[current].distance + 1;
12511           node.parent = current;
12512           queue.unshift(adjacent);
12513         }
12514       }
12515     }
12516
12517     return graph;
12518   }
12519
12520   function link$2(from, to) {
12521     return function (args) {
12522       return to(from(args));
12523     };
12524   }
12525
12526   function wrapConversion$2(toModel, graph) {
12527     var path = [graph[toModel].parent, toModel];
12528     var fn = conversions$2[graph[toModel].parent][toModel];
12529     var cur = graph[toModel].parent;
12530
12531     while (graph[cur].parent) {
12532       path.unshift(graph[cur].parent);
12533       fn = link$2(conversions$2[graph[cur].parent][cur], fn);
12534       cur = graph[cur].parent;
12535     }
12536
12537     fn.conversion = path;
12538     return fn;
12539   }
12540
12541   var route$2 = function route(fromModel) {
12542     var graph = deriveBFS$2(fromModel);
12543     var conversion = {};
12544     var models = Object.keys(graph);
12545
12546     for (var len = models.length, i = 0; i < len; i++) {
12547       var toModel = models[i];
12548       var node = graph[toModel];
12549
12550       if (node.parent === null) {
12551         // no possible conversion, or this node is the source model.
12552         continue;
12553       }
12554
12555       conversion[toModel] = wrapConversion$2(toModel, graph);
12556     }
12557
12558     return conversion;
12559   };
12560
12561   var convert$3 = {};
12562   var models$2 = Object.keys(conversions$2);
12563
12564   function wrapRaw$2(fn) {
12565     var wrappedFn = function wrappedFn(args) {
12566       if (args === undefined || args === null) {
12567         return args;
12568       }
12569
12570       if (arguments.length > 1) {
12571         args = Array.prototype.slice.call(arguments);
12572       }
12573
12574       return fn(args);
12575     }; // preserve .conversion property if there is one
12576
12577
12578     if ('conversion' in fn) {
12579       wrappedFn.conversion = fn.conversion;
12580     }
12581
12582     return wrappedFn;
12583   }
12584
12585   function wrapRounded$2(fn) {
12586     var wrappedFn = function wrappedFn(args) {
12587       if (args === undefined || args === null) {
12588         return args;
12589       }
12590
12591       if (arguments.length > 1) {
12592         args = Array.prototype.slice.call(arguments);
12593       }
12594
12595       var result = fn(args); // we're assuming the result is an array here.
12596       // see notice in conversions.js; don't use box types
12597       // in conversion functions.
12598
12599       if (typeof result === 'object') {
12600         for (var len = result.length, i = 0; i < len; i++) {
12601           result[i] = Math.round(result[i]);
12602         }
12603       }
12604
12605       return result;
12606     }; // preserve .conversion property if there is one
12607
12608
12609     if ('conversion' in fn) {
12610       wrappedFn.conversion = fn.conversion;
12611     }
12612
12613     return wrappedFn;
12614   }
12615
12616   models$2.forEach(function (fromModel) {
12617     convert$3[fromModel] = {};
12618     Object.defineProperty(convert$3[fromModel], 'channels', {
12619       value: conversions$2[fromModel].channels
12620     });
12621     Object.defineProperty(convert$3[fromModel], 'labels', {
12622       value: conversions$2[fromModel].labels
12623     });
12624     var routes = route$2(fromModel);
12625     var routeModels = Object.keys(routes);
12626     routeModels.forEach(function (toModel) {
12627       var fn = routes[toModel];
12628       convert$3[fromModel][toModel] = wrapRounded$2(fn);
12629       convert$3[fromModel][toModel].raw = wrapRaw$2(fn);
12630     });
12631   });
12632   var colorConvert$2 = convert$3;
12633
12634   var ansiStyles$2 = createCommonjsModule(function (module) {
12635
12636     const wrapAnsi16 = (fn, offset) => function () {
12637       const code = fn.apply(colorConvert$2, arguments);
12638       return "\x1B[".concat(code + offset, "m");
12639     };
12640
12641     const wrapAnsi256 = (fn, offset) => function () {
12642       const code = fn.apply(colorConvert$2, arguments);
12643       return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
12644     };
12645
12646     const wrapAnsi16m = (fn, offset) => function () {
12647       const rgb = fn.apply(colorConvert$2, arguments);
12648       return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
12649     };
12650
12651     function assembleStyles() {
12652       const codes = new Map();
12653       const styles = {
12654         modifier: {
12655           reset: [0, 0],
12656           // 21 isn't widely supported and 22 does the same thing
12657           bold: [1, 22],
12658           dim: [2, 22],
12659           italic: [3, 23],
12660           underline: [4, 24],
12661           inverse: [7, 27],
12662           hidden: [8, 28],
12663           strikethrough: [9, 29]
12664         },
12665         color: {
12666           black: [30, 39],
12667           red: [31, 39],
12668           green: [32, 39],
12669           yellow: [33, 39],
12670           blue: [34, 39],
12671           magenta: [35, 39],
12672           cyan: [36, 39],
12673           white: [37, 39],
12674           gray: [90, 39],
12675           // Bright color
12676           redBright: [91, 39],
12677           greenBright: [92, 39],
12678           yellowBright: [93, 39],
12679           blueBright: [94, 39],
12680           magentaBright: [95, 39],
12681           cyanBright: [96, 39],
12682           whiteBright: [97, 39]
12683         },
12684         bgColor: {
12685           bgBlack: [40, 49],
12686           bgRed: [41, 49],
12687           bgGreen: [42, 49],
12688           bgYellow: [43, 49],
12689           bgBlue: [44, 49],
12690           bgMagenta: [45, 49],
12691           bgCyan: [46, 49],
12692           bgWhite: [47, 49],
12693           // Bright color
12694           bgBlackBright: [100, 49],
12695           bgRedBright: [101, 49],
12696           bgGreenBright: [102, 49],
12697           bgYellowBright: [103, 49],
12698           bgBlueBright: [104, 49],
12699           bgMagentaBright: [105, 49],
12700           bgCyanBright: [106, 49],
12701           bgWhiteBright: [107, 49]
12702         }
12703       }; // Fix humans
12704
12705       styles.color.grey = styles.color.gray;
12706
12707       for (const groupName of Object.keys(styles)) {
12708         const group = styles[groupName];
12709
12710         for (const styleName of Object.keys(group)) {
12711           const style = group[styleName];
12712           styles[styleName] = {
12713             open: "\x1B[".concat(style[0], "m"),
12714             close: "\x1B[".concat(style[1], "m")
12715           };
12716           group[styleName] = styles[styleName];
12717           codes.set(style[0], style[1]);
12718         }
12719
12720         Object.defineProperty(styles, groupName, {
12721           value: group,
12722           enumerable: false
12723         });
12724         Object.defineProperty(styles, 'codes', {
12725           value: codes,
12726           enumerable: false
12727         });
12728       }
12729
12730       const ansi2ansi = n => n;
12731
12732       const rgb2rgb = (r, g, b) => [r, g, b];
12733
12734       styles.color.close = '\u001B[39m';
12735       styles.bgColor.close = '\u001B[49m';
12736       styles.color.ansi = {
12737         ansi: wrapAnsi16(ansi2ansi, 0)
12738       };
12739       styles.color.ansi256 = {
12740         ansi256: wrapAnsi256(ansi2ansi, 0)
12741       };
12742       styles.color.ansi16m = {
12743         rgb: wrapAnsi16m(rgb2rgb, 0)
12744       };
12745       styles.bgColor.ansi = {
12746         ansi: wrapAnsi16(ansi2ansi, 10)
12747       };
12748       styles.bgColor.ansi256 = {
12749         ansi256: wrapAnsi256(ansi2ansi, 10)
12750       };
12751       styles.bgColor.ansi16m = {
12752         rgb: wrapAnsi16m(rgb2rgb, 10)
12753       };
12754
12755       for (let key of Object.keys(colorConvert$2)) {
12756         if (typeof colorConvert$2[key] !== 'object') {
12757           continue;
12758         }
12759
12760         const suite = colorConvert$2[key];
12761
12762         if (key === 'ansi16') {
12763           key = 'ansi';
12764         }
12765
12766         if ('ansi16' in suite) {
12767           styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
12768           styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
12769         }
12770
12771         if ('ansi256' in suite) {
12772           styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
12773           styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
12774         }
12775
12776         if ('rgb' in suite) {
12777           styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
12778           styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
12779         }
12780       }
12781
12782       return styles;
12783     } // Make the export immutable
12784
12785
12786     Object.defineProperty(module, 'exports', {
12787       enumerable: true,
12788       get: assembleStyles
12789     });
12790   });
12791
12792   const env$3 = process.env;
12793   let forceColor$2;
12794
12795   if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
12796     forceColor$2 = false;
12797   } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
12798     forceColor$2 = true;
12799   }
12800
12801   if ('FORCE_COLOR' in env$3) {
12802     forceColor$2 = env$3.FORCE_COLOR.length === 0 || parseInt(env$3.FORCE_COLOR, 10) !== 0;
12803   }
12804
12805   function translateLevel$2(level) {
12806     if (level === 0) {
12807       return false;
12808     }
12809
12810     return {
12811       level,
12812       hasBasic: true,
12813       has256: level >= 2,
12814       has16m: level >= 3
12815     };
12816   }
12817
12818   function supportsColor$2(stream) {
12819     if (forceColor$2 === false) {
12820       return 0;
12821     }
12822
12823     if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
12824       return 3;
12825     }
12826
12827     if (hasFlag('color=256')) {
12828       return 2;
12829     }
12830
12831     if (stream && !stream.isTTY && forceColor$2 !== true) {
12832       return 0;
12833     }
12834
12835     const min = forceColor$2 ? 1 : 0;
12836
12837     if (process.platform === 'win32') {
12838       // Node.js 7.5.0 is the first version of Node.js to include a patch to
12839       // libuv that enables 256 color output on Windows. Anything earlier and it
12840       // won't work. However, here we target Node.js 8 at minimum as it is an LTS
12841       // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
12842       // release that supports 256 colors. Windows 10 build 14931 is the first release
12843       // that supports 16m/TrueColor.
12844       const osRelease = require$$0$1.release().split('.');
12845
12846       if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
12847         return Number(osRelease[2]) >= 14931 ? 3 : 2;
12848       }
12849
12850       return 1;
12851     }
12852
12853     if ('CI' in env$3) {
12854       if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$3) || env$3.CI_NAME === 'codeship') {
12855         return 1;
12856       }
12857
12858       return min;
12859     }
12860
12861     if ('TEAMCITY_VERSION' in env$3) {
12862       return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$3.TEAMCITY_VERSION) ? 1 : 0;
12863     }
12864
12865     if (env$3.COLORTERM === 'truecolor') {
12866       return 3;
12867     }
12868
12869     if ('TERM_PROGRAM' in env$3) {
12870       const version = parseInt((env$3.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
12871
12872       switch (env$3.TERM_PROGRAM) {
12873         case 'iTerm.app':
12874           return version >= 3 ? 3 : 2;
12875
12876         case 'Apple_Terminal':
12877           return 2;
12878         // No default
12879       }
12880     }
12881
12882     if (/-256(color)?$/i.test(env$3.TERM)) {
12883       return 2;
12884     }
12885
12886     if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$3.TERM)) {
12887       return 1;
12888     }
12889
12890     if ('COLORTERM' in env$3) {
12891       return 1;
12892     }
12893
12894     if (env$3.TERM === 'dumb') {
12895       return min;
12896     }
12897
12898     return min;
12899   }
12900
12901   function getSupportLevel$2(stream) {
12902     const level = supportsColor$2(stream);
12903     return translateLevel$2(level);
12904   }
12905
12906   var supportsColor_1$2 = {
12907     supportsColor: getSupportLevel$2,
12908     stdout: getSupportLevel$2(process.stdout),
12909     stderr: getSupportLevel$2(process.stderr)
12910   };
12911
12912   const TEMPLATE_REGEX$2 = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
12913   const STYLE_REGEX$2 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
12914   const STRING_REGEX$2 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
12915   const ESCAPE_REGEX$2 = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
12916   const ESCAPES$2 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
12917
12918   function unescape$2(c) {
12919     if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
12920       return String.fromCharCode(parseInt(c.slice(1), 16));
12921     }
12922
12923     return ESCAPES$2.get(c) || c;
12924   }
12925
12926   function parseArguments$2(name, args) {
12927     const results = [];
12928     const chunks = args.trim().split(/\s*,\s*/g);
12929     let matches;
12930
12931     for (const chunk of chunks) {
12932       if (!isNaN(chunk)) {
12933         results.push(Number(chunk));
12934       } else if (matches = chunk.match(STRING_REGEX$2)) {
12935         results.push(matches[2].replace(ESCAPE_REGEX$2, (m, escape, chr) => escape ? unescape$2(escape) : chr));
12936       } else {
12937         throw new Error("Invalid Chalk template style argument: ".concat(chunk, " (in style '").concat(name, "')"));
12938       }
12939     }
12940
12941     return results;
12942   }
12943
12944   function parseStyle$2(style) {
12945     STYLE_REGEX$2.lastIndex = 0;
12946     const results = [];
12947     let matches;
12948
12949     while ((matches = STYLE_REGEX$2.exec(style)) !== null) {
12950       const name = matches[1];
12951
12952       if (matches[2]) {
12953         const args = parseArguments$2(name, matches[2]);
12954         results.push([name].concat(args));
12955       } else {
12956         results.push([name]);
12957       }
12958     }
12959
12960     return results;
12961   }
12962
12963   function buildStyle$2(chalk, styles) {
12964     const enabled = {};
12965
12966     for (const layer of styles) {
12967       for (const style of layer.styles) {
12968         enabled[style[0]] = layer.inverse ? null : style.slice(1);
12969       }
12970     }
12971
12972     let current = chalk;
12973
12974     for (const styleName of Object.keys(enabled)) {
12975       if (Array.isArray(enabled[styleName])) {
12976         if (!(styleName in current)) {
12977           throw new Error("Unknown Chalk style: ".concat(styleName));
12978         }
12979
12980         if (enabled[styleName].length > 0) {
12981           current = current[styleName].apply(current, enabled[styleName]);
12982         } else {
12983           current = current[styleName];
12984         }
12985       }
12986     }
12987
12988     return current;
12989   }
12990
12991   var templates$2 = (chalk, tmp) => {
12992     const styles = [];
12993     const chunks = [];
12994     let chunk = []; // eslint-disable-next-line max-params
12995
12996     tmp.replace(TEMPLATE_REGEX$2, (m, escapeChar, inverse, style, close, chr) => {
12997       if (escapeChar) {
12998         chunk.push(unescape$2(escapeChar));
12999       } else if (style) {
13000         const str = chunk.join('');
13001         chunk = [];
13002         chunks.push(styles.length === 0 ? str : buildStyle$2(chalk, styles)(str));
13003         styles.push({
13004           inverse,
13005           styles: parseStyle$2(style)
13006         });
13007       } else if (close) {
13008         if (styles.length === 0) {
13009           throw new Error('Found extraneous } in Chalk template literal');
13010         }
13011
13012         chunks.push(buildStyle$2(chalk, styles)(chunk.join('')));
13013         chunk = [];
13014         styles.pop();
13015       } else {
13016         chunk.push(chr);
13017       }
13018     });
13019     chunks.push(chunk.join(''));
13020
13021     if (styles.length > 0) {
13022       const errMsg = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
13023       throw new Error(errMsg);
13024     }
13025
13026     return chunks.join('');
13027   };
13028
13029   var chalk$2 = createCommonjsModule(function (module) {
13030
13031     const stdoutColor = supportsColor_1$2.stdout;
13032     const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
13033
13034     const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
13035
13036     const skipModels = new Set(['gray']);
13037     const styles = Object.create(null);
13038
13039     function applyOptions(obj, options) {
13040       options = options || {}; // Detect level if not set manually
13041
13042       const scLevel = stdoutColor ? stdoutColor.level : 0;
13043       obj.level = options.level === undefined ? scLevel : options.level;
13044       obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
13045     }
13046
13047     function Chalk(options) {
13048       // We check for this.template here since calling `chalk.constructor()`
13049       // by itself will have a `this` of a previously constructed chalk object
13050       if (!this || !(this instanceof Chalk) || this.template) {
13051         const chalk = {};
13052         applyOptions(chalk, options);
13053
13054         chalk.template = function () {
13055           const args = [].slice.call(arguments);
13056           return chalkTag.apply(null, [chalk.template].concat(args));
13057         };
13058
13059         Object.setPrototypeOf(chalk, Chalk.prototype);
13060         Object.setPrototypeOf(chalk.template, chalk);
13061         chalk.template.constructor = Chalk;
13062         return chalk.template;
13063       }
13064
13065       applyOptions(this, options);
13066     } // Use bright blue on Windows as the normal blue color is illegible
13067
13068
13069     if (isSimpleWindowsTerm) {
13070       ansiStyles$2.blue.open = '\u001B[94m';
13071     }
13072
13073     for (const key of Object.keys(ansiStyles$2)) {
13074       ansiStyles$2[key].closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2[key].close), 'g');
13075       styles[key] = {
13076         get() {
13077           const codes = ansiStyles$2[key];
13078           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
13079         }
13080
13081       };
13082     }
13083
13084     styles.visible = {
13085       get() {
13086         return build.call(this, this._styles || [], true, 'visible');
13087       }
13088
13089     };
13090     ansiStyles$2.color.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2.color.close), 'g');
13091
13092     for (const model of Object.keys(ansiStyles$2.color.ansi)) {
13093       if (skipModels.has(model)) {
13094         continue;
13095       }
13096
13097       styles[model] = {
13098         get() {
13099           const level = this.level;
13100           return function () {
13101             const open = ansiStyles$2.color[levelMapping[level]][model].apply(null, arguments);
13102             const codes = {
13103               open,
13104               close: ansiStyles$2.color.close,
13105               closeRe: ansiStyles$2.color.closeRe
13106             };
13107             return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
13108           };
13109         }
13110
13111       };
13112     }
13113
13114     ansiStyles$2.bgColor.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2.bgColor.close), 'g');
13115
13116     for (const model of Object.keys(ansiStyles$2.bgColor.ansi)) {
13117       if (skipModels.has(model)) {
13118         continue;
13119       }
13120
13121       const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
13122       styles[bgModel] = {
13123         get() {
13124           const level = this.level;
13125           return function () {
13126             const open = ansiStyles$2.bgColor[levelMapping[level]][model].apply(null, arguments);
13127             const codes = {
13128               open,
13129               close: ansiStyles$2.bgColor.close,
13130               closeRe: ansiStyles$2.bgColor.closeRe
13131             };
13132             return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
13133           };
13134         }
13135
13136       };
13137     }
13138
13139     const proto = Object.defineProperties(() => {}, styles);
13140
13141     function build(_styles, _empty, key) {
13142       const builder = function builder() {
13143         return applyStyle.apply(builder, arguments);
13144       };
13145
13146       builder._styles = _styles;
13147       builder._empty = _empty;
13148       const self = this;
13149       Object.defineProperty(builder, 'level', {
13150         enumerable: true,
13151
13152         get() {
13153           return self.level;
13154         },
13155
13156         set(level) {
13157           self.level = level;
13158         }
13159
13160       });
13161       Object.defineProperty(builder, 'enabled', {
13162         enumerable: true,
13163
13164         get() {
13165           return self.enabled;
13166         },
13167
13168         set(enabled) {
13169           self.enabled = enabled;
13170         }
13171
13172       }); // See below for fix regarding invisible grey/dim combination on Windows
13173
13174       builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
13175       // no way to create a function with a different prototype
13176
13177       builder.__proto__ = proto; // eslint-disable-line no-proto
13178
13179       return builder;
13180     }
13181
13182     function applyStyle() {
13183       // Support varags, but simply cast to string in case there's only one arg
13184       const args = arguments;
13185       const argsLen = args.length;
13186       let str = String(arguments[0]);
13187
13188       if (argsLen === 0) {
13189         return '';
13190       }
13191
13192       if (argsLen > 1) {
13193         // Don't slice `arguments`, it prevents V8 optimizations
13194         for (let a = 1; a < argsLen; a++) {
13195           str += ' ' + args[a];
13196         }
13197       }
13198
13199       if (!this.enabled || this.level <= 0 || !str) {
13200         return this._empty ? '' : str;
13201       } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
13202       // see https://github.com/chalk/chalk/issues/58
13203       // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
13204
13205
13206       const originalDim = ansiStyles$2.dim.open;
13207
13208       if (isSimpleWindowsTerm && this.hasGrey) {
13209         ansiStyles$2.dim.open = '';
13210       }
13211
13212       for (const code of this._styles.slice().reverse()) {
13213         // Replace any instances already present with a re-opening code
13214         // otherwise only the part of the string until said closing code
13215         // will be colored, and the rest will simply be 'plain'.
13216         str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
13217         // after next line to fix a bleed issue on macOS
13218         // https://github.com/chalk/chalk/pull/92
13219
13220         str = str.replace(/\r?\n/g, "".concat(code.close, "$&").concat(code.open));
13221       } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
13222
13223
13224       ansiStyles$2.dim.open = originalDim;
13225       return str;
13226     }
13227
13228     function chalkTag(chalk, strings) {
13229       if (!Array.isArray(strings)) {
13230         // If chalk() was called by itself or with a string,
13231         // return the string itself as a string.
13232         return [].slice.call(arguments, 1).join(' ');
13233       }
13234
13235       const args = [].slice.call(arguments, 2);
13236       const parts = [strings.raw[0]];
13237
13238       for (let i = 1; i < strings.length; i++) {
13239         parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
13240         parts.push(String(strings.raw[i]));
13241       }
13242
13243       return templates$2(chalk, parts.join(''));
13244     }
13245
13246     Object.defineProperties(Chalk.prototype, styles);
13247     module.exports = Chalk(); // eslint-disable-line new-cap
13248
13249     module.exports.supportsColor = stdoutColor;
13250     module.exports.default = module.exports; // For TypeScript
13251   });
13252   var chalk_1$1 = chalk$2.supportsColor;
13253
13254   var lib$1 = createCommonjsModule(function (module, exports) {
13255
13256     Object.defineProperty(exports, "__esModule", {
13257       value: true
13258     });
13259     exports.shouldHighlight = shouldHighlight;
13260     exports.getChalk = getChalk;
13261     exports.default = highlight;
13262
13263     var _jsTokens = _interopRequireWildcard(jsTokens);
13264
13265     var _esutils = _interopRequireDefault(utils$1);
13266
13267     var _chalk = _interopRequireDefault(chalk$2);
13268
13269     function _interopRequireDefault(obj) {
13270       return obj && obj.__esModule ? obj : {
13271         default: obj
13272       };
13273     }
13274
13275     function _getRequireWildcardCache() {
13276       if (typeof WeakMap !== "function") return null;
13277       var cache = new WeakMap();
13278
13279       _getRequireWildcardCache = function _getRequireWildcardCache() {
13280         return cache;
13281       };
13282
13283       return cache;
13284     }
13285
13286     function _interopRequireWildcard(obj) {
13287       if (obj && obj.__esModule) {
13288         return obj;
13289       }
13290
13291       if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
13292         return {
13293           default: obj
13294         };
13295       }
13296
13297       var cache = _getRequireWildcardCache();
13298
13299       if (cache && cache.has(obj)) {
13300         return cache.get(obj);
13301       }
13302
13303       var newObj = {};
13304       var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
13305
13306       for (var key in obj) {
13307         if (Object.prototype.hasOwnProperty.call(obj, key)) {
13308           var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
13309
13310           if (desc && (desc.get || desc.set)) {
13311             Object.defineProperty(newObj, key, desc);
13312           } else {
13313             newObj[key] = obj[key];
13314           }
13315         }
13316       }
13317
13318       newObj.default = obj;
13319
13320       if (cache) {
13321         cache.set(obj, newObj);
13322       }
13323
13324       return newObj;
13325     }
13326
13327     function getDefs(chalk) {
13328       return {
13329         keyword: chalk.cyan,
13330         capitalized: chalk.yellow,
13331         jsx_tag: chalk.yellow,
13332         punctuator: chalk.yellow,
13333         number: chalk.magenta,
13334         string: chalk.green,
13335         regex: chalk.magenta,
13336         comment: chalk.grey,
13337         invalid: chalk.white.bgRed.bold
13338       };
13339     }
13340
13341     const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
13342     const JSX_TAG = /^[a-z][\w-]*$/i;
13343     const BRACKET = /^[()[\]{}]$/;
13344
13345     function getTokenType(match) {
13346       const [offset, text] = match.slice(-2);
13347       const token = (0, _jsTokens.matchToToken)(match);
13348
13349       if (token.type === "name") {
13350         if (_esutils.default.keyword.isReservedWordES6(token.value)) {
13351           return "keyword";
13352         }
13353
13354         if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
13355           return "jsx_tag";
13356         }
13357
13358         if (token.value[0] !== token.value[0].toLowerCase()) {
13359           return "capitalized";
13360         }
13361       }
13362
13363       if (token.type === "punctuator" && BRACKET.test(token.value)) {
13364         return "bracket";
13365       }
13366
13367       if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
13368         return "punctuator";
13369       }
13370
13371       return token.type;
13372     }
13373
13374     function highlightTokens(defs, text) {
13375       return text.replace(_jsTokens.default, function (...args) {
13376         const type = getTokenType(args);
13377         const colorize = defs[type];
13378
13379         if (colorize) {
13380           return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
13381         } else {
13382           return args[0];
13383         }
13384       });
13385     }
13386
13387     function shouldHighlight(options) {
13388       return _chalk.default.supportsColor || options.forceColor;
13389     }
13390
13391     function getChalk(options) {
13392       let chalk = _chalk.default;
13393
13394       if (options.forceColor) {
13395         chalk = new _chalk.default.constructor({
13396           enabled: true,
13397           level: 1
13398         });
13399       }
13400
13401       return chalk;
13402     }
13403
13404     function highlight(code, options = {}) {
13405       if (shouldHighlight(options)) {
13406         const chalk = getChalk(options);
13407         const defs = getDefs(chalk);
13408         return highlightTokens(defs, code);
13409       } else {
13410         return code;
13411       }
13412     }
13413   });
13414   unwrapExports(lib$1);
13415   var lib_1 = lib$1.shouldHighlight;
13416   var lib_2 = lib$1.getChalk;
13417
13418   var lib$2 = createCommonjsModule(function (module, exports) {
13419
13420     Object.defineProperty(exports, "__esModule", {
13421       value: true
13422     });
13423     exports.codeFrameColumns = codeFrameColumns;
13424     exports.default = _default;
13425
13426     var _highlight = _interopRequireWildcard(lib$1);
13427
13428     function _getRequireWildcardCache() {
13429       if (typeof WeakMap !== "function") return null;
13430       var cache = new WeakMap();
13431
13432       _getRequireWildcardCache = function _getRequireWildcardCache() {
13433         return cache;
13434       };
13435
13436       return cache;
13437     }
13438
13439     function _interopRequireWildcard(obj) {
13440       if (obj && obj.__esModule) {
13441         return obj;
13442       }
13443
13444       if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
13445         return {
13446           default: obj
13447         };
13448       }
13449
13450       var cache = _getRequireWildcardCache();
13451
13452       if (cache && cache.has(obj)) {
13453         return cache.get(obj);
13454       }
13455
13456       var newObj = {};
13457       var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
13458
13459       for (var key in obj) {
13460         if (Object.prototype.hasOwnProperty.call(obj, key)) {
13461           var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
13462
13463           if (desc && (desc.get || desc.set)) {
13464             Object.defineProperty(newObj, key, desc);
13465           } else {
13466             newObj[key] = obj[key];
13467           }
13468         }
13469       }
13470
13471       newObj.default = obj;
13472
13473       if (cache) {
13474         cache.set(obj, newObj);
13475       }
13476
13477       return newObj;
13478     }
13479
13480     let deprecationWarningShown = false;
13481
13482     function getDefs(chalk) {
13483       return {
13484         gutter: chalk.grey,
13485         marker: chalk.red.bold,
13486         message: chalk.red.bold
13487       };
13488     }
13489
13490     const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
13491
13492     function getMarkerLines(loc, source, opts) {
13493       const startLoc = Object.assign({
13494         column: 0,
13495         line: -1
13496       }, loc.start);
13497       const endLoc = Object.assign({}, startLoc, {}, loc.end);
13498       const {
13499         linesAbove = 2,
13500         linesBelow = 3
13501       } = opts || {};
13502       const startLine = startLoc.line;
13503       const startColumn = startLoc.column;
13504       const endLine = endLoc.line;
13505       const endColumn = endLoc.column;
13506       let start = Math.max(startLine - (linesAbove + 1), 0);
13507       let end = Math.min(source.length, endLine + linesBelow);
13508
13509       if (startLine === -1) {
13510         start = 0;
13511       }
13512
13513       if (endLine === -1) {
13514         end = source.length;
13515       }
13516
13517       const lineDiff = endLine - startLine;
13518       const markerLines = {};
13519
13520       if (lineDiff) {
13521         for (let i = 0; i <= lineDiff; i++) {
13522           const lineNumber = i + startLine;
13523
13524           if (!startColumn) {
13525             markerLines[lineNumber] = true;
13526           } else if (i === 0) {
13527             const sourceLength = source[lineNumber - 1].length;
13528             markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
13529           } else if (i === lineDiff) {
13530             markerLines[lineNumber] = [0, endColumn];
13531           } else {
13532             const sourceLength = source[lineNumber - i].length;
13533             markerLines[lineNumber] = [0, sourceLength];
13534           }
13535         }
13536       } else {
13537         if (startColumn === endColumn) {
13538           if (startColumn) {
13539             markerLines[startLine] = [startColumn, 0];
13540           } else {
13541             markerLines[startLine] = true;
13542           }
13543         } else {
13544           markerLines[startLine] = [startColumn, endColumn - startColumn];
13545         }
13546       }
13547
13548       return {
13549         start,
13550         end,
13551         markerLines
13552       };
13553     }
13554
13555     function codeFrameColumns(rawLines, loc, opts = {}) {
13556       const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
13557       const chalk = (0, _highlight.getChalk)(opts);
13558       const defs = getDefs(chalk);
13559
13560       const maybeHighlight = (chalkFn, string) => {
13561         return highlighted ? chalkFn(string) : string;
13562       };
13563
13564       const lines = rawLines.split(NEWLINE);
13565       const {
13566         start,
13567         end,
13568         markerLines
13569       } = getMarkerLines(loc, lines, opts);
13570       const hasColumns = loc.start && typeof loc.start.column === "number";
13571       const numberMaxWidth = String(end).length;
13572       const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
13573       let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
13574         const number = start + 1 + index;
13575         const paddedNumber = " ".concat(number).slice(-numberMaxWidth);
13576         const gutter = " ".concat(paddedNumber, " | ");
13577         const hasMarker = markerLines[number];
13578         const lastMarkerLine = !markerLines[number + 1];
13579
13580         if (hasMarker) {
13581           let markerLine = "";
13582
13583           if (Array.isArray(hasMarker)) {
13584             const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
13585             const numberOfMarkers = hasMarker[1] || 1;
13586             markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
13587
13588             if (lastMarkerLine && opts.message) {
13589               markerLine += " " + maybeHighlight(defs.message, opts.message);
13590             }
13591           }
13592
13593           return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
13594         } else {
13595           return " ".concat(maybeHighlight(defs.gutter, gutter)).concat(line);
13596         }
13597       }).join("\n");
13598
13599       if (opts.message && !hasColumns) {
13600         frame = "".concat(" ".repeat(numberMaxWidth + 1)).concat(opts.message, "\n").concat(frame);
13601       }
13602
13603       if (highlighted) {
13604         return chalk.reset(frame);
13605       } else {
13606         return frame;
13607       }
13608     }
13609
13610     function _default(rawLines, lineNumber, colNumber, opts = {}) {
13611       if (!deprecationWarningShown) {
13612         deprecationWarningShown = true;
13613         const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
13614
13615         if (process.emitWarning) {
13616           process.emitWarning(message, "DeprecationWarning");
13617         } else {
13618           const deprecationError = new Error(message);
13619           deprecationError.name = "DeprecationWarning";
13620           console.warn(new Error(message));
13621         }
13622       }
13623
13624       colNumber = Math.max(colNumber, 0);
13625       const location = {
13626         start: {
13627           column: colNumber,
13628           line: lineNumber
13629         }
13630       };
13631       return codeFrameColumns(rawLines, location, opts);
13632     }
13633   });
13634   unwrapExports(lib$2);
13635   var lib_1$1 = lib$2.codeFrameColumns;
13636
13637   const {
13638     ConfigError: ConfigError$1
13639   } = errors;
13640   const {
13641     locStart: locStart$1,
13642     locEnd: locEnd$1
13643   } = loc; // Use defineProperties()/getOwnPropertyDescriptor() to prevent
13644   // triggering the parsers getters.
13645
13646   const ownNames = Object.getOwnPropertyNames;
13647   const ownDescriptor = Object.getOwnPropertyDescriptor;
13648
13649   function getParsers(options) {
13650     const parsers = {};
13651
13652     for (const plugin of options.plugins) {
13653       if (!plugin.parsers) {
13654         continue;
13655       }
13656
13657       for (const name of ownNames(plugin.parsers)) {
13658         Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
13659       }
13660     }
13661
13662     return parsers;
13663   }
13664
13665   function resolveParser(opts, parsers) {
13666     parsers = parsers || getParsers(opts);
13667
13668     if (typeof opts.parser === "function") {
13669       // Custom parser API always works with JavaScript.
13670       return {
13671         parse: opts.parser,
13672         astFormat: "estree",
13673         locStart: locStart$1,
13674         locEnd: locEnd$1
13675       };
13676     }
13677
13678     if (typeof opts.parser === "string") {
13679       if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) {
13680         return parsers[opts.parser];
13681       }
13682       /* istanbul ignore next */
13683
13684
13685       {
13686         throw new ConfigError$1("Couldn't resolve parser \"".concat(opts.parser, "\". Parsers must be explicitly added to the standalone bundle."));
13687       }
13688     }
13689   }
13690
13691   function parse(text, opts) {
13692     const parsers = getParsers(opts); // Create a new object {parserName: parseFn}. Uses defineProperty() to only call
13693     // the parsers getters when actually calling the parser `parse` function.
13694
13695     const parsersForCustomParserApi = Object.keys(parsers).reduce((object, parserName) => Object.defineProperty(object, parserName, {
13696       enumerable: true,
13697
13698       get() {
13699         return parsers[parserName].parse;
13700       }
13701
13702     }), {});
13703     const parser = resolveParser(opts, parsers);
13704
13705     try {
13706       if (parser.preprocess) {
13707         text = parser.preprocess(text, opts);
13708       }
13709
13710       return {
13711         text,
13712         ast: parser.parse(text, parsersForCustomParserApi, opts)
13713       };
13714     } catch (error) {
13715       const {
13716         loc
13717       } = error;
13718
13719       if (loc) {
13720         const codeFrame = lib$2;
13721         error.codeFrame = codeFrame.codeFrameColumns(text, loc, {
13722           highlightCode: true
13723         });
13724         error.message += "\n" + error.codeFrame;
13725         throw error;
13726       }
13727       /* istanbul ignore next */
13728
13729
13730       throw error.stack;
13731     }
13732   }
13733
13734   var parser = {
13735     parse,
13736     resolveParser
13737   };
13738
13739   const {
13740     UndefinedParserError: UndefinedParserError$1
13741   } = errors;
13742   const {
13743     getSupportInfo: getSupportInfo$1
13744   } = support;
13745   const {
13746     resolveParser: resolveParser$1
13747   } = parser;
13748   const hiddenDefaults = {
13749     astFormat: "estree",
13750     printer: {},
13751     originalText: undefined,
13752     locStart: null,
13753     locEnd: null
13754   }; // Copy options and fill in default values.
13755
13756   function normalize$1(options, opts) {
13757     opts = opts || {};
13758     const rawOptions = Object.assign({}, options);
13759     const supportOptions = getSupportInfo$1({
13760       plugins: options.plugins,
13761       showUnreleased: true,
13762       showDeprecated: true
13763     }).options;
13764     const defaults = Object.assign({}, hiddenDefaults, {}, fromPairs_1(supportOptions.filter(optionInfo => optionInfo.default !== undefined).map(option => [option.name, option.default])));
13765
13766     if (!rawOptions.parser) {
13767       if (!rawOptions.filepath) {
13768         const logger = opts.logger || console;
13769         logger.warn("No parser and no filepath given, using 'babel' the parser now " + "but this will throw an error in the future. " + "Please specify a parser or a filepath so one can be inferred.");
13770         rawOptions.parser = "babel";
13771       } else {
13772         rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins);
13773
13774         if (!rawOptions.parser) {
13775           throw new UndefinedParserError$1("No parser could be inferred for file: ".concat(rawOptions.filepath));
13776         }
13777       }
13778     }
13779
13780     const parser = resolveParser$1(optionsNormalizer.normalizeApiOptions(rawOptions, [supportOptions.find(x => x.name === "parser")], {
13781       passThrough: true,
13782       logger: false
13783     }));
13784     rawOptions.astFormat = parser.astFormat;
13785     rawOptions.locEnd = parser.locEnd;
13786     rawOptions.locStart = parser.locStart;
13787     const plugin = getPlugin(rawOptions);
13788     rawOptions.printer = plugin.printers[rawOptions.astFormat];
13789     const pluginDefaults = supportOptions.filter(optionInfo => optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== undefined).reduce((reduced, optionInfo) => Object.assign(reduced, {
13790       [optionInfo.name]: optionInfo.pluginDefaults[plugin.name]
13791     }), {});
13792     const mixedDefaults = Object.assign({}, defaults, {}, pluginDefaults);
13793     Object.keys(mixedDefaults).forEach(k => {
13794       if (rawOptions[k] == null) {
13795         rawOptions[k] = mixedDefaults[k];
13796       }
13797     });
13798
13799     if (rawOptions.parser === "json") {
13800       rawOptions.trailingComma = "none";
13801     }
13802
13803     return optionsNormalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({
13804       passThrough: Object.keys(hiddenDefaults)
13805     }, opts));
13806   }
13807
13808   function getPlugin(options) {
13809     const {
13810       astFormat
13811     } = options;
13812
13813     if (!astFormat) {
13814       throw new Error("getPlugin() requires astFormat to be set");
13815     }
13816
13817     const printerPlugin = options.plugins.find(plugin => plugin.printers && plugin.printers[astFormat]);
13818
13819     if (!printerPlugin) {
13820       throw new Error("Couldn't find plugin for AST format \"".concat(astFormat, "\""));
13821     }
13822
13823     return printerPlugin;
13824   }
13825
13826   function getInterpreter(filepath) {
13827     if (typeof filepath !== "string") {
13828       return "";
13829     }
13830
13831     let fd;
13832
13833     try {
13834       fd = fs.openSync(filepath, "r");
13835     } catch (err) {
13836       // istanbul ignore next
13837       return "";
13838     }
13839
13840     try {
13841       const liner = new readlines(fd);
13842       const firstLine = liner.next().toString("utf8"); // #!/bin/env node, #!/usr/bin/env node
13843
13844       const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
13845
13846       if (m1) {
13847         return m1[1];
13848       } // #!/bin/node, #!/usr/bin/node, #!/usr/local/bin/node
13849
13850
13851       const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
13852
13853       if (m2) {
13854         return m2[1];
13855       }
13856
13857       return "";
13858     } catch (err) {
13859       // There are some weird cases where paths are missing, causing Jest
13860       // failures. It's unclear what these correspond to in the real world.
13861       return "";
13862     } finally {
13863       try {
13864         // There are some weird cases where paths are missing, causing Jest
13865         // failures. It's unclear what these correspond to in the real world.
13866         fs.closeSync(fd);
13867       } catch (err) {// nop
13868       }
13869     }
13870   }
13871
13872   function inferParser(filepath, plugins) {
13873     const filename = path.basename(filepath).toLowerCase();
13874     const languages = getSupportInfo$1({
13875       plugins
13876     }).languages.filter(language => language.since !== null); // If the file has no extension, we can try to infer the language from the
13877     // interpreter in the shebang line, if any; but since this requires FS access,
13878     // do it last.
13879
13880     let language = languages.find(language => language.extensions && language.extensions.some(extension => filename.endsWith(extension)) || language.filenames && language.filenames.find(name => name.toLowerCase() === filename));
13881
13882     if (!language && !filename.includes(".")) {
13883       const interpreter = getInterpreter(filepath);
13884       language = languages.find(language => language.interpreters && language.interpreters.includes(interpreter));
13885     }
13886
13887     return language && language.parsers[0];
13888   }
13889
13890   var options$1 = {
13891     normalize: normalize$1,
13892     hiddenDefaults,
13893     inferParser
13894   };
13895
13896   function massageAST(ast, options, parent) {
13897     if (Array.isArray(ast)) {
13898       return ast.map(e => massageAST(e, options, parent)).filter(Boolean);
13899     }
13900
13901     if (!ast || typeof ast !== "object") {
13902       return ast;
13903     }
13904
13905     const newObj = {};
13906
13907     for (const key of Object.keys(ast)) {
13908       if (typeof ast[key] !== "function") {
13909         newObj[key] = massageAST(ast[key], options, ast);
13910       }
13911     }
13912
13913     if (options.printer.massageAstNode) {
13914       const result = options.printer.massageAstNode(ast, newObj, parent);
13915
13916       if (result === null) {
13917         return undefined;
13918       }
13919
13920       if (result) {
13921         return result;
13922       }
13923     }
13924
13925     return newObj;
13926   }
13927
13928   var massageAst = massageAST;
13929
13930   function assert() {}
13931
13932   assert.ok = function () {};
13933
13934   assert.strictEqual = function () {};
13935
13936   /**
13937    * @param {Doc[]} parts
13938    * @returns Doc
13939    */
13940
13941
13942   function concat(parts) {
13943     // access the internals of a document directly.
13944     // if(parts.length === 1) {
13945     //   // If it's a single document, no need to concat it.
13946     //   return parts[0];
13947     // }
13948
13949
13950     return {
13951       type: "concat",
13952       parts
13953     };
13954   }
13955   /**
13956    * @param {Doc} contents
13957    * @returns Doc
13958    */
13959
13960
13961   function indent(contents) {
13962
13963     return {
13964       type: "indent",
13965       contents
13966     };
13967   }
13968   /**
13969    * @param {number} n
13970    * @param {Doc} contents
13971    * @returns Doc
13972    */
13973
13974
13975   function align(n, contents) {
13976
13977     return {
13978       type: "align",
13979       contents,
13980       n
13981     };
13982   }
13983   /**
13984    * @param {Doc} contents
13985    * @param {object} [opts] - TBD ???
13986    * @returns Doc
13987    */
13988
13989
13990   function group(contents, opts) {
13991     opts = opts || {};
13992
13993     return {
13994       type: "group",
13995       id: opts.id,
13996       contents,
13997       break: !!opts.shouldBreak,
13998       expandedStates: opts.expandedStates
13999     };
14000   }
14001   /**
14002    * @param {Doc} contents
14003    * @returns Doc
14004    */
14005
14006
14007   function dedentToRoot(contents) {
14008     return align(-Infinity, contents);
14009   }
14010   /**
14011    * @param {Doc} contents
14012    * @returns Doc
14013    */
14014
14015
14016   function markAsRoot(contents) {
14017     // @ts-ignore - TBD ???:
14018     return align({
14019       type: "root"
14020     }, contents);
14021   }
14022   /**
14023    * @param {Doc} contents
14024    * @returns Doc
14025    */
14026
14027
14028   function dedent(contents) {
14029     return align(-1, contents);
14030   }
14031   /**
14032    * @param {Doc[]} states
14033    * @param {object} [opts] - TBD ???
14034    * @returns Doc
14035    */
14036
14037
14038   function conditionalGroup(states, opts) {
14039     return group(states[0], Object.assign({}, opts, {
14040       expandedStates: states
14041     }));
14042   }
14043   /**
14044    * @param {Doc[]} parts
14045    * @returns Doc
14046    */
14047
14048
14049   function fill(parts) {
14050
14051     return {
14052       type: "fill",
14053       parts
14054     };
14055   }
14056   /**
14057    * @param {Doc} [breakContents]
14058    * @param {Doc} [flatContents]
14059    * @param {object} [opts] - TBD ???
14060    * @returns Doc
14061    */
14062
14063
14064   function ifBreak(breakContents, flatContents, opts) {
14065     opts = opts || {};
14066
14067     return {
14068       type: "if-break",
14069       breakContents,
14070       flatContents,
14071       groupId: opts.groupId
14072     };
14073   }
14074   /**
14075    * @param {Doc} contents
14076    * @returns Doc
14077    */
14078
14079
14080   function lineSuffix(contents) {
14081
14082     return {
14083       type: "line-suffix",
14084       contents
14085     };
14086   }
14087
14088   const lineSuffixBoundary = {
14089     type: "line-suffix-boundary"
14090   };
14091   const breakParent = {
14092     type: "break-parent"
14093   };
14094   const trim = {
14095     type: "trim"
14096   };
14097   const line = {
14098     type: "line"
14099   };
14100   const softline = {
14101     type: "line",
14102     soft: true
14103   };
14104   const hardline = concat([{
14105     type: "line",
14106     hard: true
14107   }, breakParent]);
14108   const literalline = concat([{
14109     type: "line",
14110     hard: true,
14111     literal: true
14112   }, breakParent]);
14113   const cursor = {
14114     type: "cursor",
14115     placeholder: Symbol("cursor")
14116   };
14117   /**
14118    * @param {Doc} sep
14119    * @param {Doc[]} arr
14120    * @returns Doc
14121    */
14122
14123   function join(sep, arr) {
14124     const res = [];
14125
14126     for (let i = 0; i < arr.length; i++) {
14127       if (i !== 0) {
14128         res.push(sep);
14129       }
14130
14131       res.push(arr[i]);
14132     }
14133
14134     return concat(res);
14135   }
14136   /**
14137    * @param {Doc} doc
14138    * @param {number} size
14139    * @param {number} tabWidth
14140    */
14141
14142
14143   function addAlignmentToDoc(doc, size, tabWidth) {
14144     let aligned = doc;
14145
14146     if (size > 0) {
14147       // Use indent to add tabs for all the levels of tabs we need
14148       for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
14149         aligned = indent(aligned);
14150       } // Use align for all the spaces that are needed
14151
14152
14153       aligned = align(size % tabWidth, aligned); // size is absolute from 0 and not relative to the current
14154       // indentation, so we use -Infinity to reset the indentation to 0
14155
14156       aligned = align(-Infinity, aligned);
14157     }
14158
14159     return aligned;
14160   }
14161
14162   var docBuilders = {
14163     concat,
14164     join,
14165     line,
14166     softline,
14167     hardline,
14168     literalline,
14169     group,
14170     conditionalGroup,
14171     fill,
14172     lineSuffix,
14173     lineSuffixBoundary,
14174     cursor,
14175     breakParent,
14176     ifBreak,
14177     trim,
14178     indent,
14179     align,
14180     addAlignmentToDoc,
14181     markAsRoot,
14182     dedentToRoot,
14183     dedent
14184   };
14185
14186   var ansiRegex = ({
14187     onlyFirst = false
14188   } = {}) => {
14189     const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
14190     return new RegExp(pattern, onlyFirst ? undefined : 'g');
14191   };
14192
14193   var stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
14194
14195   /* eslint-disable yoda */
14196
14197   const isFullwidthCodePoint = codePoint => {
14198     if (Number.isNaN(codePoint)) {
14199       return false;
14200     } // Code points are derived from:
14201     // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
14202
14203
14204     if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
14205     codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
14206     codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
14207     // CJK Radicals Supplement .. Enclosed CJK Letters and Months
14208     0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
14209     0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals
14210     0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A
14211     0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables
14212     0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs
14213     0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms
14214     0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants
14215     0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms
14216     0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement
14217     0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement
14218     0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
14219     0x20000 <= codePoint && codePoint <= 0x3FFFD)) {
14220       return true;
14221     }
14222
14223     return false;
14224   };
14225
14226   var isFullwidthCodePoint_1 = isFullwidthCodePoint;
14227   var default_1$1 = isFullwidthCodePoint;
14228   isFullwidthCodePoint_1.default = default_1$1;
14229
14230   var emojiRegex = function emojiRegex() {
14231     // https://mths.be/emoji
14232     return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\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\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])|\uD83C[\uDF3E\uDF73\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])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\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\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*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\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\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\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[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
14233   };
14234
14235   const stringWidth = string => {
14236     string = string.replace(emojiRegex(), '  ');
14237
14238     if (typeof string !== 'string' || string.length === 0) {
14239       return 0;
14240     }
14241
14242     string = stripAnsi(string);
14243     let width = 0;
14244
14245     for (let i = 0; i < string.length; i++) {
14246       const code = string.codePointAt(i); // Ignore control characters
14247
14248       if (code <= 0x1F || code >= 0x7F && code <= 0x9F) {
14249         continue;
14250       } // Ignore combining characters
14251
14252
14253       if (code >= 0x300 && code <= 0x36F) {
14254         continue;
14255       } // Surrogates
14256
14257
14258       if (code > 0xFFFF) {
14259         i++;
14260       }
14261
14262       width += isFullwidthCodePoint_1(code) ? 2 : 1;
14263     }
14264
14265     return width;
14266   };
14267
14268   var stringWidth_1 = stringWidth; // TODO: remove this in the next major version
14269
14270   var default_1$2 = stringWidth;
14271   stringWidth_1.default = default_1$2;
14272
14273   const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
14274
14275   var escapeStringRegexp$2 = string => {
14276     if (typeof string !== 'string') {
14277       throw new TypeError('Expected a string');
14278     }
14279
14280     return string.replace(matchOperatorsRegex, '\\$&');
14281   };
14282
14283   const notAsciiRegex = /[^\x20-\x7F]/;
14284
14285   function getPenultimate(arr) {
14286     if (arr.length > 1) {
14287       return arr[arr.length - 2];
14288     }
14289
14290     return null;
14291   }
14292   /**
14293    * @typedef {{backwards?: boolean}} SkipOptions
14294    */
14295
14296   /**
14297    * @param {string | RegExp} chars
14298    * @returns {(text: string, index: number | false, opts?: SkipOptions) => number | false}
14299    */
14300
14301
14302   function skip(chars) {
14303     return (text, index, opts) => {
14304       const backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having
14305       // to check for failures (did someone say monads?).
14306
14307       if (index === false) {
14308         return false;
14309       }
14310
14311       const {
14312         length
14313       } = text;
14314       let cursor = index;
14315
14316       while (cursor >= 0 && cursor < length) {
14317         const c = text.charAt(cursor);
14318
14319         if (chars instanceof RegExp) {
14320           if (!chars.test(c)) {
14321             return cursor;
14322           }
14323         } else if (!chars.includes(c)) {
14324           return cursor;
14325         }
14326
14327         backwards ? cursor-- : cursor++;
14328       }
14329
14330       if (cursor === -1 || cursor === length) {
14331         // If we reached the beginning or end of the file, return the
14332         // out-of-bounds cursor. It's up to the caller to handle this
14333         // correctly. We don't want to indicate `false` though if it
14334         // actually skipped valid characters.
14335         return cursor;
14336       }
14337
14338       return false;
14339     };
14340   }
14341   /**
14342    * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
14343    */
14344
14345
14346   const skipWhitespace = skip(/\s/);
14347   /**
14348    * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
14349    */
14350
14351   const skipSpaces = skip(" \t");
14352   /**
14353    * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
14354    */
14355
14356   const skipToLineEnd = skip(",; \t");
14357   /**
14358    * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
14359    */
14360
14361   const skipEverythingButNewLine = skip(/[^\r\n]/);
14362   /**
14363    * @param {string} text
14364    * @param {number | false} index
14365    * @returns {number | false}
14366    */
14367
14368   function skipInlineComment(text, index) {
14369     if (index === false) {
14370       return false;
14371     }
14372
14373     if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
14374       for (let i = index + 2; i < text.length; ++i) {
14375         if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
14376           return i + 2;
14377         }
14378       }
14379     }
14380
14381     return index;
14382   }
14383   /**
14384    * @param {string} text
14385    * @param {number | false} index
14386    * @returns {number | false}
14387    */
14388
14389
14390   function skipTrailingComment(text, index) {
14391     if (index === false) {
14392       return false;
14393     }
14394
14395     if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
14396       return skipEverythingButNewLine(text, index);
14397     }
14398
14399     return index;
14400   } // This one doesn't use the above helper function because it wants to
14401   // test \r\n in order and `skip` doesn't support ordering and we only
14402   // want to skip one newline. It's simple to implement.
14403
14404   /**
14405    * @param {string} text
14406    * @param {number | false} index
14407    * @param {SkipOptions=} opts
14408    * @returns {number | false}
14409    */
14410
14411
14412   function skipNewline(text, index, opts) {
14413     const backwards = opts && opts.backwards;
14414
14415     if (index === false) {
14416       return false;
14417     }
14418
14419     const atIndex = text.charAt(index);
14420
14421     if (backwards) {
14422       if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
14423         return index - 2;
14424       }
14425
14426       if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
14427         return index - 1;
14428       }
14429     } else {
14430       if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
14431         return index + 2;
14432       }
14433
14434       if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
14435         return index + 1;
14436       }
14437     }
14438
14439     return index;
14440   }
14441   /**
14442    * @param {string} text
14443    * @param {number} index
14444    * @param {SkipOptions=} opts
14445    * @returns {boolean}
14446    */
14447
14448
14449   function hasNewline(text, index, opts) {
14450     opts = opts || {};
14451     const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
14452     const idx2 = skipNewline(text, idx, opts);
14453     return idx !== idx2;
14454   }
14455   /**
14456    * @param {string} text
14457    * @param {number} start
14458    * @param {number} end
14459    * @returns {boolean}
14460    */
14461
14462
14463   function hasNewlineInRange(text, start, end) {
14464     for (let i = start; i < end; ++i) {
14465       if (text.charAt(i) === "\n") {
14466         return true;
14467       }
14468     }
14469
14470     return false;
14471   } // Note: this function doesn't ignore leading comments unlike isNextLineEmpty
14472
14473   /**
14474    * @template N
14475    * @param {string} text
14476    * @param {N} node
14477    * @param {(node: N) => number} locStart
14478    */
14479
14480
14481   function isPreviousLineEmpty(text, node, locStart) {
14482     /** @type {number | false} */
14483     let idx = locStart(node) - 1;
14484     idx = skipSpaces(text, idx, {
14485       backwards: true
14486     });
14487     idx = skipNewline(text, idx, {
14488       backwards: true
14489     });
14490     idx = skipSpaces(text, idx, {
14491       backwards: true
14492     });
14493     const idx2 = skipNewline(text, idx, {
14494       backwards: true
14495     });
14496     return idx !== idx2;
14497   }
14498   /**
14499    * @param {string} text
14500    * @param {number} index
14501    * @returns {boolean}
14502    */
14503
14504
14505   function isNextLineEmptyAfterIndex(text, index) {
14506     /** @type {number | false} */
14507     let oldIdx = null;
14508     /** @type {number | false} */
14509
14510     let idx = index;
14511
14512     while (idx !== oldIdx) {
14513       // We need to skip all the potential trailing inline comments
14514       oldIdx = idx;
14515       idx = skipToLineEnd(text, idx);
14516       idx = skipInlineComment(text, idx);
14517       idx = skipSpaces(text, idx);
14518     }
14519
14520     idx = skipTrailingComment(text, idx);
14521     idx = skipNewline(text, idx);
14522     return idx !== false && hasNewline(text, idx);
14523   }
14524   /**
14525    * @template N
14526    * @param {string} text
14527    * @param {N} node
14528    * @param {(node: N) => number} locEnd
14529    * @returns {boolean}
14530    */
14531
14532
14533   function isNextLineEmpty(text, node, locEnd) {
14534     return isNextLineEmptyAfterIndex(text, locEnd(node));
14535   }
14536   /**
14537    * @param {string} text
14538    * @param {number} idx
14539    * @returns {number | false}
14540    */
14541
14542
14543   function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) {
14544     /** @type {number | false} */
14545     let oldIdx = null;
14546     /** @type {number | false} */
14547
14548     let nextIdx = idx;
14549
14550     while (nextIdx !== oldIdx) {
14551       oldIdx = nextIdx;
14552       nextIdx = skipSpaces(text, nextIdx);
14553       nextIdx = skipInlineComment(text, nextIdx);
14554       nextIdx = skipTrailingComment(text, nextIdx);
14555       nextIdx = skipNewline(text, nextIdx);
14556     }
14557
14558     return nextIdx;
14559   }
14560   /**
14561    * @template N
14562    * @param {string} text
14563    * @param {N} node
14564    * @param {(node: N) => number} locEnd
14565    * @returns {number | false}
14566    */
14567
14568
14569   function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
14570     return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node));
14571   }
14572   /**
14573    * @template N
14574    * @param {string} text
14575    * @param {N} node
14576    * @param {(node: N) => number} locEnd
14577    * @returns {string}
14578    */
14579
14580
14581   function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
14582     return text.charAt( // @ts-ignore => TBD: can return false, should we define a fallback?
14583     getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
14584   }
14585   /**
14586    * @param {string} text
14587    * @param {number} index
14588    * @param {SkipOptions=} opts
14589    * @returns {boolean}
14590    */
14591
14592
14593   function hasSpaces(text, index, opts) {
14594     opts = opts || {};
14595     const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
14596     return idx !== index;
14597   }
14598   /**
14599    * @param {{range?: [number, number], start?: number}} node
14600    * @param {number} index
14601    */
14602
14603
14604   function setLocStart(node, index) {
14605     if (node.range) {
14606       node.range[0] = index;
14607     } else {
14608       node.start = index;
14609     }
14610   }
14611   /**
14612    * @param {{range?: [number, number], end?: number}} node
14613    * @param {number} index
14614    */
14615
14616
14617   function setLocEnd(node, index) {
14618     if (node.range) {
14619       node.range[1] = index;
14620     } else {
14621       node.end = index;
14622     }
14623   }
14624
14625   const PRECEDENCE = {};
14626   [["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].forEach((tier, i) => {
14627     tier.forEach(op => {
14628       PRECEDENCE[op] = i;
14629     });
14630   });
14631
14632   function getPrecedence(op) {
14633     return PRECEDENCE[op];
14634   }
14635
14636   const equalityOperators = {
14637     "==": true,
14638     "!=": true,
14639     "===": true,
14640     "!==": true
14641   };
14642   const multiplicativeOperators = {
14643     "*": true,
14644     "/": true,
14645     "%": true
14646   };
14647   const bitshiftOperators = {
14648     ">>": true,
14649     ">>>": true,
14650     "<<": true
14651   };
14652
14653   function shouldFlatten(parentOp, nodeOp) {
14654     if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
14655       return false;
14656     } // ** is right-associative
14657     // x ** y ** z --> x ** (y ** z)
14658
14659
14660     if (parentOp === "**") {
14661       return false;
14662     } // x == y == z --> (x == y) == z
14663
14664
14665     if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
14666       return false;
14667     } // x * y % z --> (x * y) % z
14668
14669
14670     if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
14671       return false;
14672     } // x * y / z --> (x * y) / z
14673     // x / y * z --> (x / y) * z
14674
14675
14676     if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
14677       return false;
14678     } // x << y << z --> (x << y) << z
14679
14680
14681     if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
14682       return false;
14683     }
14684
14685     return true;
14686   }
14687
14688   function isBitwiseOperator(operator) {
14689     return !!bitshiftOperators[operator] || operator === "|" || operator === "^" || operator === "&";
14690   } // Tests if an expression starts with `{`, or (if forbidFunctionClassAndDoExpr
14691   // holds) `function`, `class`, or `do {}`. Will be overzealous if there's
14692   // already necessary grouping parentheses.
14693
14694
14695   function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
14696     node = getLeftMost(node);
14697
14698     switch (node.type) {
14699       case "FunctionExpression":
14700       case "ClassExpression":
14701       case "DoExpression":
14702         return forbidFunctionClassAndDoExpr;
14703
14704       case "ObjectExpression":
14705         return true;
14706
14707       case "MemberExpression":
14708       case "OptionalMemberExpression":
14709         return startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
14710
14711       case "TaggedTemplateExpression":
14712         if (node.tag.type === "FunctionExpression") {
14713           // IIFEs are always already parenthesized
14714           return false;
14715         }
14716
14717         return startsWithNoLookaheadToken(node.tag, forbidFunctionClassAndDoExpr);
14718
14719       case "CallExpression":
14720       case "OptionalCallExpression":
14721         if (node.callee.type === "FunctionExpression") {
14722           // IIFEs are always already parenthesized
14723           return false;
14724         }
14725
14726         return startsWithNoLookaheadToken(node.callee, forbidFunctionClassAndDoExpr);
14727
14728       case "ConditionalExpression":
14729         return startsWithNoLookaheadToken(node.test, forbidFunctionClassAndDoExpr);
14730
14731       case "UpdateExpression":
14732         return !node.prefix && startsWithNoLookaheadToken(node.argument, forbidFunctionClassAndDoExpr);
14733
14734       case "BindExpression":
14735         return node.object && startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
14736
14737       case "SequenceExpression":
14738         return startsWithNoLookaheadToken(node.expressions[0], forbidFunctionClassAndDoExpr);
14739
14740       case "TSAsExpression":
14741         return startsWithNoLookaheadToken(node.expression, forbidFunctionClassAndDoExpr);
14742
14743       default:
14744         return false;
14745     }
14746   }
14747
14748   function getLeftMost(node) {
14749     if (node.left) {
14750       return getLeftMost(node.left);
14751     }
14752
14753     return node;
14754   }
14755   /**
14756    * @param {string} value
14757    * @param {number} tabWidth
14758    * @param {number=} startIndex
14759    * @returns {number}
14760    */
14761
14762
14763   function getAlignmentSize(value, tabWidth, startIndex) {
14764     startIndex = startIndex || 0;
14765     let size = 0;
14766
14767     for (let i = startIndex; i < value.length; ++i) {
14768       if (value[i] === "\t") {
14769         // Tabs behave in a way that they are aligned to the nearest
14770         // multiple of tabWidth:
14771         // 0 -> 4, 1 -> 4, 2 -> 4, 3 -> 4
14772         // 4 -> 8, 5 -> 8, 6 -> 8, 7 -> 8 ...
14773         size = size + tabWidth - size % tabWidth;
14774       } else {
14775         size++;
14776       }
14777     }
14778
14779     return size;
14780   }
14781   /**
14782    * @param {string} value
14783    * @param {number} tabWidth
14784    * @returns {number}
14785    */
14786
14787
14788   function getIndentSize(value, tabWidth) {
14789     const lastNewlineIndex = value.lastIndexOf("\n");
14790
14791     if (lastNewlineIndex === -1) {
14792       return 0;
14793     }
14794
14795     return getAlignmentSize( // All the leading whitespaces
14796     value.slice(lastNewlineIndex + 1).match(/^[ \t]*/)[0], tabWidth);
14797   }
14798   /**
14799    * @typedef {'"' | "'"} Quote
14800    */
14801
14802   /**
14803    *
14804    * @param {string} raw
14805    * @param {Quote} preferredQuote
14806    * @returns {Quote}
14807    */
14808
14809
14810   function getPreferredQuote(raw, preferredQuote) {
14811     // `rawContent` is the string exactly like it appeared in the input source
14812     // code, without its enclosing quotes.
14813     const rawContent = raw.slice(1, -1);
14814     /** @type {{ quote: '"', regex: RegExp }} */
14815
14816     const double = {
14817       quote: '"',
14818       regex: /"/g
14819     };
14820     /** @type {{ quote: "'", regex: RegExp }} */
14821
14822     const single = {
14823       quote: "'",
14824       regex: /'/g
14825     };
14826     const preferred = preferredQuote === "'" ? single : double;
14827     const alternate = preferred === single ? double : single;
14828     let result = preferred.quote; // If `rawContent` contains at least one of the quote preferred for enclosing
14829     // the string, we might want to enclose with the alternate quote instead, to
14830     // minimize the number of escaped quotes.
14831
14832     if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {
14833       const numPreferredQuotes = (rawContent.match(preferred.regex) || []).length;
14834       const numAlternateQuotes = (rawContent.match(alternate.regex) || []).length;
14835       result = numPreferredQuotes > numAlternateQuotes ? alternate.quote : preferred.quote;
14836     }
14837
14838     return result;
14839   }
14840
14841   function printString(raw, options, isDirectiveLiteral) {
14842     // `rawContent` is the string exactly like it appeared in the input source
14843     // code, without its enclosing quotes.
14844     const rawContent = raw.slice(1, -1); // Check for the alternate quote, to determine if we're allowed to swap
14845     // the quotes on a DirectiveLiteral.
14846
14847     const canChangeDirectiveQuotes = !rawContent.includes('"') && !rawContent.includes("'");
14848     /** @type {Quote} */
14849
14850     const enclosingQuote = options.parser === "json" ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote(raw, options.singleQuote ? "'" : '"'); // Directives are exact code unit sequences, which means that you can't
14851     // change the escape sequences they use.
14852     // See https://github.com/prettier/prettier/issues/1555
14853     // and https://tc39.github.io/ecma262/#directive-prologue
14854
14855     if (isDirectiveLiteral) {
14856       if (canChangeDirectiveQuotes) {
14857         return enclosingQuote + rawContent + enclosingQuote;
14858       }
14859
14860       return raw;
14861     } // It might sound unnecessary to use `makeString` even if the string already
14862     // is enclosed with `enclosingQuote`, but it isn't. The string could contain
14863     // unnecessary escapes (such as in `"\'"`). Always using `makeString` makes
14864     // sure that we consistently output the minimum amount of escaped quotes.
14865
14866
14867     return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.embeddedInHtml));
14868   }
14869   /**
14870    * @param {string} rawContent
14871    * @param {Quote} enclosingQuote
14872    * @param {boolean=} unescapeUnnecessaryEscapes
14873    * @returns {string}
14874    */
14875
14876
14877   function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
14878     const otherQuote = enclosingQuote === '"' ? "'" : '"'; // Matches _any_ escape and unescaped quotes (both single and double).
14879
14880     const regex = /\\([\s\S])|(['"])/g; // Escape and unescape single and double quotes as needed to be able to
14881     // enclose `rawContent` with `enclosingQuote`.
14882
14883     const newContent = rawContent.replace(regex, (match, escaped, quote) => {
14884       // If we matched an escape, and the escaped character is a quote of the
14885       // other type than we intend to enclose the string with, there's no need for
14886       // it to be escaped, so return it _without_ the backslash.
14887       if (escaped === otherQuote) {
14888         return escaped;
14889       } // If we matched an unescaped quote and it is of the _same_ type as we
14890       // intend to enclose the string with, it must be escaped, so return it with
14891       // a backslash.
14892
14893
14894       if (quote === enclosingQuote) {
14895         return "\\" + quote;
14896       }
14897
14898       if (quote) {
14899         return quote;
14900       } // Unescape any unnecessarily escaped character.
14901       // Adapted from https://github.com/eslint/eslint/blob/de0b4ad7bd820ade41b1f606008bea68683dc11a/lib/rules/no-useless-escape.js#L27
14902
14903
14904       return unescapeUnnecessaryEscapes && /^[^\\nrvtbfux\r\n\u2028\u2029"'0-7]$/.test(escaped) ? escaped : "\\" + escaped;
14905     });
14906     return enclosingQuote + newContent + enclosingQuote;
14907   }
14908
14909   function printNumber(rawNumber) {
14910     return rawNumber.toLowerCase() // Remove unnecessary plus and zeroes from scientific notation.
14911     .replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3") // Remove unnecessary scientific notation (1e0).
14912     .replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1") // Make sure numbers always start with a digit.
14913     .replace(/^([+-])?\./, "$10.") // Remove extraneous trailing decimal zeroes.
14914     .replace(/(\.\d+?)0+(?=e|$)/, "$1") // Remove trailing dot.
14915     .replace(/\.(?=e|$)/, "");
14916   }
14917   /**
14918    * @param {string} str
14919    * @param {string} target
14920    * @returns {number}
14921    */
14922
14923
14924   function getMaxContinuousCount(str, target) {
14925     const results = str.match(new RegExp("(".concat(escapeStringRegexp$2(target), ")+"), "g"));
14926
14927     if (results === null) {
14928       return 0;
14929     }
14930
14931     return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0);
14932   }
14933
14934   function getMinNotPresentContinuousCount(str, target) {
14935     const matches = str.match(new RegExp("(".concat(escapeStringRegexp$2(target), ")+"), "g"));
14936
14937     if (matches === null) {
14938       return 0;
14939     }
14940
14941     const countPresent = new Map();
14942     let max = 0;
14943
14944     for (const match of matches) {
14945       const count = match.length / target.length;
14946       countPresent.set(count, true);
14947
14948       if (count > max) {
14949         max = count;
14950       }
14951     }
14952
14953     for (let i = 1; i < max; i++) {
14954       if (!countPresent.get(i)) {
14955         return i;
14956       }
14957     }
14958
14959     return max + 1;
14960   }
14961   /**
14962    * @param {string} text
14963    * @returns {number}
14964    */
14965
14966
14967   function getStringWidth(text) {
14968     if (!text) {
14969       return 0;
14970     } // shortcut to avoid needless string `RegExp`s, replacements, and allocations within `string-width`
14971
14972
14973     if (!notAsciiRegex.test(text)) {
14974       return text.length;
14975     }
14976
14977     return stringWidth_1(text);
14978   }
14979
14980   function hasIgnoreComment(path) {
14981     const node = path.getValue();
14982     return hasNodeIgnoreComment(node);
14983   }
14984
14985   function hasNodeIgnoreComment(node) {
14986     return node && (node.comments && node.comments.length > 0 && node.comments.some(comment => isNodeIgnoreComment(comment) && !comment.unignore) || node.prettierIgnore);
14987   }
14988
14989   function isNodeIgnoreComment(comment) {
14990     return comment.value.trim() === "prettier-ignore";
14991   }
14992
14993   function addCommentHelper(node, comment) {
14994     const comments = node.comments || (node.comments = []);
14995     comments.push(comment);
14996     comment.printed = false; // For some reason, TypeScript parses `// x` inside of JSXText as a comment
14997     // We already "print" it via the raw text, we don't need to re-print it as a
14998     // comment
14999
15000     if (node.type === "JSXText") {
15001       comment.printed = true;
15002     }
15003   }
15004
15005   function addLeadingComment(node, comment) {
15006     comment.leading = true;
15007     comment.trailing = false;
15008     addCommentHelper(node, comment);
15009   }
15010
15011   function addDanglingComment(node, comment) {
15012     comment.leading = false;
15013     comment.trailing = false;
15014     addCommentHelper(node, comment);
15015   }
15016
15017   function addTrailingComment(node, comment) {
15018     comment.leading = false;
15019     comment.trailing = true;
15020     addCommentHelper(node, comment);
15021   }
15022
15023   function isWithinParentArrayProperty(path, propertyName) {
15024     const node = path.getValue();
15025     const parent = path.getParentNode();
15026
15027     if (parent == null) {
15028       return false;
15029     }
15030
15031     if (!Array.isArray(parent[propertyName])) {
15032       return false;
15033     }
15034
15035     const key = path.getName();
15036     return parent[propertyName][key] === node;
15037   }
15038
15039   function replaceEndOfLineWith(text, replacement) {
15040     const parts = [];
15041
15042     for (const part of text.split("\n")) {
15043       if (parts.length !== 0) {
15044         parts.push(replacement);
15045       }
15046
15047       parts.push(part);
15048     }
15049
15050     return parts;
15051   }
15052
15053   var util$1 = {
15054     replaceEndOfLineWith,
15055     getStringWidth,
15056     getMaxContinuousCount,
15057     getMinNotPresentContinuousCount,
15058     getPrecedence,
15059     shouldFlatten,
15060     isBitwiseOperator,
15061     getPenultimate,
15062     getLast,
15063     getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
15064     getNextNonSpaceNonCommentCharacterIndex,
15065     getNextNonSpaceNonCommentCharacter,
15066     skip,
15067     skipWhitespace,
15068     skipSpaces,
15069     skipToLineEnd,
15070     skipEverythingButNewLine,
15071     skipInlineComment,
15072     skipTrailingComment,
15073     skipNewline,
15074     isNextLineEmptyAfterIndex,
15075     isNextLineEmpty,
15076     isPreviousLineEmpty,
15077     hasNewline,
15078     hasNewlineInRange,
15079     hasSpaces,
15080     setLocStart,
15081     setLocEnd,
15082     startsWithNoLookaheadToken,
15083     getAlignmentSize,
15084     getIndentSize,
15085     getPreferredQuote,
15086     printString,
15087     printNumber,
15088     hasIgnoreComment,
15089     hasNodeIgnoreComment,
15090     isNodeIgnoreComment,
15091     makeString,
15092     addLeadingComment,
15093     addDanglingComment,
15094     addTrailingComment,
15095     isWithinParentArrayProperty
15096   };
15097
15098   function guessEndOfLine(text) {
15099     const index = text.indexOf("\r");
15100
15101     if (index >= 0) {
15102       return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
15103     }
15104
15105     return "lf";
15106   }
15107
15108   function convertEndOfLineToChars(value) {
15109     switch (value) {
15110       case "cr":
15111         return "\r";
15112
15113       case "crlf":
15114         return "\r\n";
15115
15116       default:
15117         return "\n";
15118     }
15119   }
15120
15121   var endOfLine = {
15122     guessEndOfLine,
15123     convertEndOfLineToChars
15124   };
15125
15126   const {
15127     getStringWidth: getStringWidth$1
15128   } = util$1;
15129   const {
15130     convertEndOfLineToChars: convertEndOfLineToChars$1
15131   } = endOfLine;
15132   const {
15133     concat: concat$1,
15134     fill: fill$1,
15135     cursor: cursor$1
15136   } = docBuilders;
15137   /** @type {Record<symbol, typeof MODE_BREAK | typeof MODE_FLAT>} */
15138
15139   let groupModeMap;
15140   const MODE_BREAK = 1;
15141   const MODE_FLAT = 2;
15142
15143   function rootIndent() {
15144     return {
15145       value: "",
15146       length: 0,
15147       queue: []
15148     };
15149   }
15150
15151   function makeIndent(ind, options) {
15152     return generateInd(ind, {
15153       type: "indent"
15154     }, options);
15155   }
15156
15157   function makeAlign(ind, n, options) {
15158     return n === -Infinity ? ind.root || rootIndent() : n < 0 ? generateInd(ind, {
15159       type: "dedent"
15160     }, options) : !n ? ind : n.type === "root" ? Object.assign({}, ind, {
15161       root: ind
15162     }) : typeof n === "string" ? generateInd(ind, {
15163       type: "stringAlign",
15164       n
15165     }, options) : generateInd(ind, {
15166       type: "numberAlign",
15167       n
15168     }, options);
15169   }
15170
15171   function generateInd(ind, newPart, options) {
15172     const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : ind.queue.concat(newPart);
15173     let value = "";
15174     let length = 0;
15175     let lastTabs = 0;
15176     let lastSpaces = 0;
15177
15178     for (const part of queue) {
15179       switch (part.type) {
15180         case "indent":
15181           flush();
15182
15183           if (options.useTabs) {
15184             addTabs(1);
15185           } else {
15186             addSpaces(options.tabWidth);
15187           }
15188
15189           break;
15190
15191         case "stringAlign":
15192           flush();
15193           value += part.n;
15194           length += part.n.length;
15195           break;
15196
15197         case "numberAlign":
15198           lastTabs += 1;
15199           lastSpaces += part.n;
15200           break;
15201
15202         /* istanbul ignore next */
15203
15204         default:
15205           throw new Error("Unexpected type '".concat(part.type, "'"));
15206       }
15207     }
15208
15209     flushSpaces();
15210     return Object.assign({}, ind, {
15211       value,
15212       length,
15213       queue
15214     });
15215
15216     function addTabs(count) {
15217       value += "\t".repeat(count);
15218       length += options.tabWidth * count;
15219     }
15220
15221     function addSpaces(count) {
15222       value += " ".repeat(count);
15223       length += count;
15224     }
15225
15226     function flush() {
15227       if (options.useTabs) {
15228         flushTabs();
15229       } else {
15230         flushSpaces();
15231       }
15232     }
15233
15234     function flushTabs() {
15235       if (lastTabs > 0) {
15236         addTabs(lastTabs);
15237       }
15238
15239       resetLast();
15240     }
15241
15242     function flushSpaces() {
15243       if (lastSpaces > 0) {
15244         addSpaces(lastSpaces);
15245       }
15246
15247       resetLast();
15248     }
15249
15250     function resetLast() {
15251       lastTabs = 0;
15252       lastSpaces = 0;
15253     }
15254   }
15255
15256   function trim$1(out) {
15257     if (out.length === 0) {
15258       return 0;
15259     }
15260
15261     let trimCount = 0; // Trim whitespace at the end of line
15262
15263     while (out.length > 0 && typeof out[out.length - 1] === "string" && out[out.length - 1].match(/^[ \t]*$/)) {
15264       trimCount += out.pop().length;
15265     }
15266
15267     if (out.length && typeof out[out.length - 1] === "string") {
15268       const trimmed = out[out.length - 1].replace(/[ \t]*$/, "");
15269       trimCount += out[out.length - 1].length - trimmed.length;
15270       out[out.length - 1] = trimmed;
15271     }
15272
15273     return trimCount;
15274   }
15275
15276   function fits(next, restCommands, width, options, mustBeFlat) {
15277     let restIdx = restCommands.length;
15278     const cmds = [next]; // `out` is only used for width counting because `trim` requires to look
15279     // backwards for space characters.
15280
15281     const out = [];
15282
15283     while (width >= 0) {
15284       if (cmds.length === 0) {
15285         if (restIdx === 0) {
15286           return true;
15287         }
15288
15289         cmds.push(restCommands[restIdx - 1]);
15290         restIdx--;
15291         continue;
15292       }
15293
15294       const [ind, mode, doc] = cmds.pop();
15295
15296       if (typeof doc === "string") {
15297         out.push(doc);
15298         width -= getStringWidth$1(doc);
15299       } else {
15300         switch (doc.type) {
15301           case "concat":
15302             for (let i = doc.parts.length - 1; i >= 0; i--) {
15303               cmds.push([ind, mode, doc.parts[i]]);
15304             }
15305
15306             break;
15307
15308           case "indent":
15309             cmds.push([makeIndent(ind, options), mode, doc.contents]);
15310             break;
15311
15312           case "align":
15313             cmds.push([makeAlign(ind, doc.n, options), mode, doc.contents]);
15314             break;
15315
15316           case "trim":
15317             width += trim$1(out);
15318             break;
15319
15320           case "group":
15321             if (mustBeFlat && doc.break) {
15322               return false;
15323             }
15324
15325             cmds.push([ind, doc.break ? MODE_BREAK : mode, doc.contents]);
15326
15327             if (doc.id) {
15328               groupModeMap[doc.id] = cmds[cmds.length - 1][1];
15329             }
15330
15331             break;
15332
15333           case "fill":
15334             for (let i = doc.parts.length - 1; i >= 0; i--) {
15335               cmds.push([ind, mode, doc.parts[i]]);
15336             }
15337
15338             break;
15339
15340           case "if-break":
15341             {
15342               const groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode;
15343
15344               if (groupMode === MODE_BREAK) {
15345                 if (doc.breakContents) {
15346                   cmds.push([ind, mode, doc.breakContents]);
15347                 }
15348               }
15349
15350               if (groupMode === MODE_FLAT) {
15351                 if (doc.flatContents) {
15352                   cmds.push([ind, mode, doc.flatContents]);
15353                 }
15354               }
15355
15356               break;
15357             }
15358
15359           case "line":
15360             switch (mode) {
15361               // fallthrough
15362               case MODE_FLAT:
15363                 if (!doc.hard) {
15364                   if (!doc.soft) {
15365                     out.push(" ");
15366                     width -= 1;
15367                   }
15368
15369                   break;
15370                 }
15371
15372                 return true;
15373
15374               case MODE_BREAK:
15375                 return true;
15376             }
15377
15378             break;
15379         }
15380       }
15381     }
15382
15383     return false;
15384   }
15385
15386   function printDocToString(doc, options) {
15387     groupModeMap = {};
15388     const width = options.printWidth;
15389     const newLine = convertEndOfLineToChars$1(options.endOfLine);
15390     let pos = 0; // cmds is basically a stack. We've turned a recursive call into a
15391     // while loop which is much faster. The while loop below adds new
15392     // cmds to the array instead of recursively calling `print`.
15393
15394     const cmds = [[rootIndent(), MODE_BREAK, doc]];
15395     const out = [];
15396     let shouldRemeasure = false;
15397     let lineSuffix = [];
15398
15399     while (cmds.length !== 0) {
15400       const [ind, mode, doc] = cmds.pop();
15401
15402       if (typeof doc === "string") {
15403         const formatted = newLine !== "\n" && doc.includes("\n") ? doc.replace(/\n/g, newLine) : doc;
15404         out.push(formatted);
15405         pos += getStringWidth$1(formatted);
15406       } else {
15407         switch (doc.type) {
15408           case "cursor":
15409             out.push(cursor$1.placeholder);
15410             break;
15411
15412           case "concat":
15413             for (let i = doc.parts.length - 1; i >= 0; i--) {
15414               cmds.push([ind, mode, doc.parts[i]]);
15415             }
15416
15417             break;
15418
15419           case "indent":
15420             cmds.push([makeIndent(ind, options), mode, doc.contents]);
15421             break;
15422
15423           case "align":
15424             cmds.push([makeAlign(ind, doc.n, options), mode, doc.contents]);
15425             break;
15426
15427           case "trim":
15428             pos -= trim$1(out);
15429             break;
15430
15431           case "group":
15432             switch (mode) {
15433               case MODE_FLAT:
15434                 if (!shouldRemeasure) {
15435                   cmds.push([ind, doc.break ? MODE_BREAK : MODE_FLAT, doc.contents]);
15436                   break;
15437                 }
15438
15439               // fallthrough
15440
15441               case MODE_BREAK:
15442                 {
15443                   shouldRemeasure = false;
15444                   const next = [ind, MODE_FLAT, doc.contents];
15445                   const rem = width - pos;
15446
15447                   if (!doc.break && fits(next, cmds, rem, options)) {
15448                     cmds.push(next);
15449                   } else {
15450                     // Expanded states are a rare case where a document
15451                     // can manually provide multiple representations of
15452                     // itself. It provides an array of documents
15453                     // going from the least expanded (most flattened)
15454                     // representation first to the most expanded. If a
15455                     // group has these, we need to manually go through
15456                     // these states and find the first one that fits.
15457                     if (doc.expandedStates) {
15458                       const mostExpanded = doc.expandedStates[doc.expandedStates.length - 1];
15459
15460                       if (doc.break) {
15461                         cmds.push([ind, MODE_BREAK, mostExpanded]);
15462                         break;
15463                       } else {
15464                         for (let i = 1; i < doc.expandedStates.length + 1; i++) {
15465                           if (i >= doc.expandedStates.length) {
15466                             cmds.push([ind, MODE_BREAK, mostExpanded]);
15467                             break;
15468                           } else {
15469                             const state = doc.expandedStates[i];
15470                             const cmd = [ind, MODE_FLAT, state];
15471
15472                             if (fits(cmd, cmds, rem, options)) {
15473                               cmds.push(cmd);
15474                               break;
15475                             }
15476                           }
15477                         }
15478                       }
15479                     } else {
15480                       cmds.push([ind, MODE_BREAK, doc.contents]);
15481                     }
15482                   }
15483
15484                   break;
15485                 }
15486             }
15487
15488             if (doc.id) {
15489               groupModeMap[doc.id] = cmds[cmds.length - 1][1];
15490             }
15491
15492             break;
15493           // Fills each line with as much code as possible before moving to a new
15494           // line with the same indentation.
15495           //
15496           // Expects doc.parts to be an array of alternating content and
15497           // whitespace. The whitespace contains the linebreaks.
15498           //
15499           // For example:
15500           //   ["I", line, "love", line, "monkeys"]
15501           // or
15502           //   [{ type: group, ... }, softline, { type: group, ... }]
15503           //
15504           // It uses this parts structure to handle three main layout cases:
15505           // * The first two content items fit on the same line without
15506           //   breaking
15507           //   -> output the first content item and the whitespace "flat".
15508           // * Only the first content item fits on the line without breaking
15509           //   -> output the first content item "flat" and the whitespace with
15510           //   "break".
15511           // * Neither content item fits on the line without breaking
15512           //   -> output the first content item and the whitespace with "break".
15513
15514           case "fill":
15515             {
15516               const rem = width - pos;
15517               const {
15518                 parts
15519               } = doc;
15520
15521               if (parts.length === 0) {
15522                 break;
15523               }
15524
15525               const [content, whitespace] = parts;
15526               const contentFlatCmd = [ind, MODE_FLAT, content];
15527               const contentBreakCmd = [ind, MODE_BREAK, content];
15528               const contentFits = fits(contentFlatCmd, [], rem, options, true);
15529
15530               if (parts.length === 1) {
15531                 if (contentFits) {
15532                   cmds.push(contentFlatCmd);
15533                 } else {
15534                   cmds.push(contentBreakCmd);
15535                 }
15536
15537                 break;
15538               }
15539
15540               const whitespaceFlatCmd = [ind, MODE_FLAT, whitespace];
15541               const whitespaceBreakCmd = [ind, MODE_BREAK, whitespace];
15542
15543               if (parts.length === 2) {
15544                 if (contentFits) {
15545                   cmds.push(whitespaceFlatCmd);
15546                   cmds.push(contentFlatCmd);
15547                 } else {
15548                   cmds.push(whitespaceBreakCmd);
15549                   cmds.push(contentBreakCmd);
15550                 }
15551
15552                 break;
15553               } // At this point we've handled the first pair (context, separator)
15554               // and will create a new fill doc for the rest of the content.
15555               // Ideally we wouldn't mutate the array here but copying all the
15556               // elements to a new array would make this algorithm quadratic,
15557               // which is unusable for large arrays (e.g. large texts in JSX).
15558
15559
15560               parts.splice(0, 2);
15561               const remainingCmd = [ind, mode, fill$1(parts)];
15562               const secondContent = parts[0];
15563               const firstAndSecondContentFlatCmd = [ind, MODE_FLAT, concat$1([content, whitespace, secondContent])];
15564               const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, options, true);
15565
15566               if (firstAndSecondContentFits) {
15567                 cmds.push(remainingCmd);
15568                 cmds.push(whitespaceFlatCmd);
15569                 cmds.push(contentFlatCmd);
15570               } else if (contentFits) {
15571                 cmds.push(remainingCmd);
15572                 cmds.push(whitespaceBreakCmd);
15573                 cmds.push(contentFlatCmd);
15574               } else {
15575                 cmds.push(remainingCmd);
15576                 cmds.push(whitespaceBreakCmd);
15577                 cmds.push(contentBreakCmd);
15578               }
15579
15580               break;
15581             }
15582
15583           case "if-break":
15584             {
15585               const groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode;
15586
15587               if (groupMode === MODE_BREAK) {
15588                 if (doc.breakContents) {
15589                   cmds.push([ind, mode, doc.breakContents]);
15590                 }
15591               }
15592
15593               if (groupMode === MODE_FLAT) {
15594                 if (doc.flatContents) {
15595                   cmds.push([ind, mode, doc.flatContents]);
15596                 }
15597               }
15598
15599               break;
15600             }
15601
15602           case "line-suffix":
15603             lineSuffix.push([ind, mode, doc.contents]);
15604             break;
15605
15606           case "line-suffix-boundary":
15607             if (lineSuffix.length > 0) {
15608               cmds.push([ind, mode, {
15609                 type: "line",
15610                 hard: true
15611               }]);
15612             }
15613
15614             break;
15615
15616           case "line":
15617             switch (mode) {
15618               case MODE_FLAT:
15619                 if (!doc.hard) {
15620                   if (!doc.soft) {
15621                     out.push(" ");
15622                     pos += 1;
15623                   }
15624
15625                   break;
15626                 } else {
15627                   // This line was forced into the output even if we
15628                   // were in flattened mode, so we need to tell the next
15629                   // group that no matter what, it needs to remeasure
15630                   // because the previous measurement didn't accurately
15631                   // capture the entire expression (this is necessary
15632                   // for nested groups)
15633                   shouldRemeasure = true;
15634                 }
15635
15636               // fallthrough
15637
15638               case MODE_BREAK:
15639                 if (lineSuffix.length) {
15640                   cmds.push([ind, mode, doc]);
15641                   cmds.push(...lineSuffix.reverse());
15642                   lineSuffix = [];
15643                   break;
15644                 }
15645
15646                 if (doc.literal) {
15647                   if (ind.root) {
15648                     out.push(newLine, ind.root.value);
15649                     pos = ind.root.length;
15650                   } else {
15651                     out.push(newLine);
15652                     pos = 0;
15653                   }
15654                 } else {
15655                   pos -= trim$1(out);
15656                   out.push(newLine + ind.value);
15657                   pos = ind.length;
15658                 }
15659
15660                 break;
15661             }
15662
15663             break;
15664         }
15665       }
15666     }
15667
15668     const cursorPlaceholderIndex = out.indexOf(cursor$1.placeholder);
15669
15670     if (cursorPlaceholderIndex !== -1) {
15671       const otherCursorPlaceholderIndex = out.indexOf(cursor$1.placeholder, cursorPlaceholderIndex + 1);
15672       const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
15673       const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
15674       const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
15675       return {
15676         formatted: beforeCursor + aroundCursor + afterCursor,
15677         cursorNodeStart: beforeCursor.length,
15678         cursorNodeText: aroundCursor
15679       };
15680     }
15681
15682     return {
15683       formatted: out.join("")
15684     };
15685   }
15686
15687   var docPrinter = {
15688     printDocToString
15689   };
15690
15691   const traverseDocOnExitStackMarker = {};
15692
15693   function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
15694     const docsStack = [doc];
15695
15696     while (docsStack.length !== 0) {
15697       const doc = docsStack.pop();
15698
15699       if (doc === traverseDocOnExitStackMarker) {
15700         onExit(docsStack.pop());
15701         continue;
15702       }
15703
15704       let shouldRecurse = true;
15705
15706       if (onEnter) {
15707         if (onEnter(doc) === false) {
15708           shouldRecurse = false;
15709         }
15710       }
15711
15712       if (onExit) {
15713         docsStack.push(doc);
15714         docsStack.push(traverseDocOnExitStackMarker);
15715       }
15716
15717       if (shouldRecurse) {
15718         // When there are multiple parts to process,
15719         // the parts need to be pushed onto the stack in reverse order,
15720         // so that they are processed in the original order
15721         // when the stack is popped.
15722         if (doc.type === "concat" || doc.type === "fill") {
15723           for (let ic = doc.parts.length, i = ic - 1; i >= 0; --i) {
15724             docsStack.push(doc.parts[i]);
15725           }
15726         } else if (doc.type === "if-break") {
15727           if (doc.flatContents) {
15728             docsStack.push(doc.flatContents);
15729           }
15730
15731           if (doc.breakContents) {
15732             docsStack.push(doc.breakContents);
15733           }
15734         } else if (doc.type === "group" && doc.expandedStates) {
15735           if (shouldTraverseConditionalGroups) {
15736             for (let ic = doc.expandedStates.length, i = ic - 1; i >= 0; --i) {
15737               docsStack.push(doc.expandedStates[i]);
15738             }
15739           } else {
15740             docsStack.push(doc.contents);
15741           }
15742         } else if (doc.contents) {
15743           docsStack.push(doc.contents);
15744         }
15745       }
15746     }
15747   }
15748
15749   function mapDoc(doc, cb) {
15750     if (doc.type === "concat" || doc.type === "fill") {
15751       const parts = doc.parts.map(part => mapDoc(part, cb));
15752       return cb(Object.assign({}, doc, {
15753         parts
15754       }));
15755     } else if (doc.type === "if-break") {
15756       const breakContents = doc.breakContents && mapDoc(doc.breakContents, cb);
15757       const flatContents = doc.flatContents && mapDoc(doc.flatContents, cb);
15758       return cb(Object.assign({}, doc, {
15759         breakContents,
15760         flatContents
15761       }));
15762     } else if (doc.contents) {
15763       const contents = mapDoc(doc.contents, cb);
15764       return cb(Object.assign({}, doc, {
15765         contents
15766       }));
15767     }
15768
15769     return cb(doc);
15770   }
15771
15772   function findInDoc(doc, fn, defaultValue) {
15773     let result = defaultValue;
15774     let hasStopped = false;
15775
15776     function findInDocOnEnterFn(doc) {
15777       const maybeResult = fn(doc);
15778
15779       if (maybeResult !== undefined) {
15780         hasStopped = true;
15781         result = maybeResult;
15782       }
15783
15784       if (hasStopped) {
15785         return false;
15786       }
15787     }
15788
15789     traverseDoc(doc, findInDocOnEnterFn);
15790     return result;
15791   }
15792
15793   function isEmpty(n) {
15794     return typeof n === "string" && n.length === 0;
15795   }
15796
15797   function isLineNextFn(doc) {
15798     if (typeof doc === "string") {
15799       return false;
15800     }
15801
15802     if (doc.type === "line") {
15803       return true;
15804     }
15805   }
15806
15807   function isLineNext(doc) {
15808     return findInDoc(doc, isLineNextFn, false);
15809   }
15810
15811   function willBreakFn(doc) {
15812     if (doc.type === "group" && doc.break) {
15813       return true;
15814     }
15815
15816     if (doc.type === "line" && doc.hard) {
15817       return true;
15818     }
15819
15820     if (doc.type === "break-parent") {
15821       return true;
15822     }
15823   }
15824
15825   function willBreak(doc) {
15826     return findInDoc(doc, willBreakFn, false);
15827   }
15828
15829   function breakParentGroup(groupStack) {
15830     if (groupStack.length > 0) {
15831       const parentGroup = groupStack[groupStack.length - 1]; // Breaks are not propagated through conditional groups because
15832       // the user is expected to manually handle what breaks.
15833
15834       if (!parentGroup.expandedStates) {
15835         parentGroup.break = true;
15836       }
15837     }
15838
15839     return null;
15840   }
15841
15842   function propagateBreaks(doc) {
15843     const alreadyVisitedSet = new Set();
15844     const groupStack = [];
15845
15846     function propagateBreaksOnEnterFn(doc) {
15847       if (doc.type === "break-parent") {
15848         breakParentGroup(groupStack);
15849       }
15850
15851       if (doc.type === "group") {
15852         groupStack.push(doc);
15853
15854         if (alreadyVisitedSet.has(doc)) {
15855           return false;
15856         }
15857
15858         alreadyVisitedSet.add(doc);
15859       }
15860     }
15861
15862     function propagateBreaksOnExitFn(doc) {
15863       if (doc.type === "group") {
15864         const group = groupStack.pop();
15865
15866         if (group.break) {
15867           breakParentGroup(groupStack);
15868         }
15869       }
15870     }
15871
15872     traverseDoc(doc, propagateBreaksOnEnterFn, propagateBreaksOnExitFn,
15873     /* shouldTraverseConditionalGroups */
15874     true);
15875   }
15876
15877   function removeLinesFn(doc) {
15878     // Force this doc into flat mode by statically converting all
15879     // lines into spaces (or soft lines into nothing). Hard lines
15880     // should still output because there's too great of a chance
15881     // of breaking existing assumptions otherwise.
15882     if (doc.type === "line" && !doc.hard) {
15883       return doc.soft ? "" : " ";
15884     } else if (doc.type === "if-break") {
15885       return doc.flatContents || "";
15886     }
15887
15888     return doc;
15889   }
15890
15891   function removeLines(doc) {
15892     return mapDoc(doc, removeLinesFn);
15893   }
15894
15895   function stripTrailingHardline(doc) {
15896     // HACK remove ending hardline, original PR: #1984
15897     if (doc.type === "concat" && doc.parts.length !== 0) {
15898       const lastPart = doc.parts[doc.parts.length - 1];
15899
15900       if (lastPart.type === "concat") {
15901         if (lastPart.parts.length === 2 && lastPart.parts[0].hard && lastPart.parts[1].type === "break-parent") {
15902           return {
15903             type: "concat",
15904             parts: doc.parts.slice(0, -1)
15905           };
15906         }
15907
15908         return {
15909           type: "concat",
15910           parts: doc.parts.slice(0, -1).concat(stripTrailingHardline(lastPart))
15911         };
15912       }
15913     }
15914
15915     return doc;
15916   }
15917
15918   var docUtils = {
15919     isEmpty,
15920     willBreak,
15921     isLineNext,
15922     traverseDoc,
15923     findInDoc,
15924     mapDoc,
15925     propagateBreaks,
15926     removeLines,
15927     stripTrailingHardline
15928   };
15929
15930   function flattenDoc(doc) {
15931     if (doc.type === "concat") {
15932       const res = [];
15933
15934       for (let i = 0; i < doc.parts.length; ++i) {
15935         const doc2 = doc.parts[i];
15936
15937         if (typeof doc2 !== "string" && doc2.type === "concat") {
15938           res.push(...flattenDoc(doc2).parts);
15939         } else {
15940           const flattened = flattenDoc(doc2);
15941
15942           if (flattened !== "") {
15943             res.push(flattened);
15944           }
15945         }
15946       }
15947
15948       return Object.assign({}, doc, {
15949         parts: res
15950       });
15951     } else if (doc.type === "if-break") {
15952       return Object.assign({}, doc, {
15953         breakContents: doc.breakContents != null ? flattenDoc(doc.breakContents) : null,
15954         flatContents: doc.flatContents != null ? flattenDoc(doc.flatContents) : null
15955       });
15956     } else if (doc.type === "group") {
15957       return Object.assign({}, doc, {
15958         contents: flattenDoc(doc.contents),
15959         expandedStates: doc.expandedStates ? doc.expandedStates.map(flattenDoc) : doc.expandedStates
15960       });
15961     } else if (doc.contents) {
15962       return Object.assign({}, doc, {
15963         contents: flattenDoc(doc.contents)
15964       });
15965     }
15966
15967     return doc;
15968   }
15969
15970   function printDoc(doc) {
15971     if (typeof doc === "string") {
15972       return JSON.stringify(doc);
15973     }
15974
15975     if (doc.type === "line") {
15976       if (doc.literal) {
15977         return "literalline";
15978       }
15979
15980       if (doc.hard) {
15981         return "hardline";
15982       }
15983
15984       if (doc.soft) {
15985         return "softline";
15986       }
15987
15988       return "line";
15989     }
15990
15991     if (doc.type === "break-parent") {
15992       return "breakParent";
15993     }
15994
15995     if (doc.type === "trim") {
15996       return "trim";
15997     }
15998
15999     if (doc.type === "concat") {
16000       return "[" + doc.parts.map(printDoc).join(", ") + "]";
16001     }
16002
16003     if (doc.type === "indent") {
16004       return "indent(" + printDoc(doc.contents) + ")";
16005     }
16006
16007     if (doc.type === "align") {
16008       return doc.n === -Infinity ? "dedentToRoot(" + printDoc(doc.contents) + ")" : doc.n < 0 ? "dedent(" + printDoc(doc.contents) + ")" : doc.n.type === "root" ? "markAsRoot(" + printDoc(doc.contents) + ")" : "align(" + JSON.stringify(doc.n) + ", " + printDoc(doc.contents) + ")";
16009     }
16010
16011     if (doc.type === "if-break") {
16012       return "ifBreak(" + printDoc(doc.breakContents) + (doc.flatContents ? ", " + printDoc(doc.flatContents) : "") + ")";
16013     }
16014
16015     if (doc.type === "group") {
16016       if (doc.expandedStates) {
16017         return "conditionalGroup(" + "[" + doc.expandedStates.map(printDoc).join(",") + "])";
16018       }
16019
16020       return (doc.break ? "wrappedGroup" : "group") + "(" + printDoc(doc.contents) + ")";
16021     }
16022
16023     if (doc.type === "fill") {
16024       return "fill" + "(" + doc.parts.map(printDoc).join(", ") + ")";
16025     }
16026
16027     if (doc.type === "line-suffix") {
16028       return "lineSuffix(" + printDoc(doc.contents) + ")";
16029     }
16030
16031     if (doc.type === "line-suffix-boundary") {
16032       return "lineSuffixBoundary";
16033     }
16034
16035     throw new Error("Unknown doc type " + doc.type);
16036   }
16037
16038   var docDebug = {
16039     printDocToDebug(doc) {
16040       return printDoc(flattenDoc(doc));
16041     }
16042
16043   };
16044
16045   var document = {
16046     builders: docBuilders,
16047     printer: docPrinter,
16048     utils: docUtils,
16049     debug: docDebug
16050   };
16051
16052   const {
16053     getMaxContinuousCount: getMaxContinuousCount$1,
16054     getStringWidth: getStringWidth$2,
16055     getAlignmentSize: getAlignmentSize$1,
16056     getIndentSize: getIndentSize$1,
16057     skip: skip$1,
16058     skipWhitespace: skipWhitespace$1,
16059     skipSpaces: skipSpaces$1,
16060     skipNewline: skipNewline$1,
16061     skipToLineEnd: skipToLineEnd$1,
16062     skipEverythingButNewLine: skipEverythingButNewLine$1,
16063     skipInlineComment: skipInlineComment$1,
16064     skipTrailingComment: skipTrailingComment$1,
16065     hasNewline: hasNewline$1,
16066     hasNewlineInRange: hasNewlineInRange$1,
16067     hasSpaces: hasSpaces$1,
16068     isNextLineEmpty: isNextLineEmpty$1,
16069     isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$1,
16070     isPreviousLineEmpty: isPreviousLineEmpty$1,
16071     getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1,
16072     makeString: makeString$1,
16073     addLeadingComment: addLeadingComment$1,
16074     addDanglingComment: addDanglingComment$1,
16075     addTrailingComment: addTrailingComment$1
16076   } = util$1;
16077   var utilShared = {
16078     getMaxContinuousCount: getMaxContinuousCount$1,
16079     getStringWidth: getStringWidth$2,
16080     getAlignmentSize: getAlignmentSize$1,
16081     getIndentSize: getIndentSize$1,
16082     skip: skip$1,
16083     skipWhitespace: skipWhitespace$1,
16084     skipSpaces: skipSpaces$1,
16085     skipNewline: skipNewline$1,
16086     skipToLineEnd: skipToLineEnd$1,
16087     skipEverythingButNewLine: skipEverythingButNewLine$1,
16088     skipInlineComment: skipInlineComment$1,
16089     skipTrailingComment: skipTrailingComment$1,
16090     hasNewline: hasNewline$1,
16091     hasNewlineInRange: hasNewlineInRange$1,
16092     hasSpaces: hasSpaces$1,
16093     isNextLineEmpty: isNextLineEmpty$1,
16094     isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$1,
16095     isPreviousLineEmpty: isPreviousLineEmpty$1,
16096     getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1,
16097     makeString: makeString$1,
16098     addLeadingComment: addLeadingComment$1,
16099     addDanglingComment: addDanglingComment$1,
16100     addTrailingComment: addTrailingComment$1
16101   };
16102
16103   const {
16104     concat: concat$2,
16105     line: line$1,
16106     hardline: hardline$1,
16107     breakParent: breakParent$1,
16108     indent: indent$1,
16109     lineSuffix: lineSuffix$1,
16110     join: join$1,
16111     cursor: cursor$2
16112   } = document.builders;
16113   const {
16114     hasNewline: hasNewline$2,
16115     skipNewline: skipNewline$2,
16116     isPreviousLineEmpty: isPreviousLineEmpty$2
16117   } = util$1;
16118   const {
16119     addLeadingComment: addLeadingComment$2,
16120     addDanglingComment: addDanglingComment$2,
16121     addTrailingComment: addTrailingComment$2
16122   } = utilShared;
16123   const childNodesCacheKey = Symbol("child-nodes");
16124
16125   function getSortedChildNodes(node, options, resultArray) {
16126     if (!node) {
16127       return;
16128     }
16129
16130     const {
16131       printer,
16132       locStart,
16133       locEnd
16134     } = options;
16135
16136     if (resultArray) {
16137       if (printer.canAttachComment && printer.canAttachComment(node)) {
16138         // This reverse insertion sort almost always takes constant
16139         // time because we almost always (maybe always?) append the
16140         // nodes in order anyway.
16141         let i;
16142
16143         for (i = resultArray.length - 1; i >= 0; --i) {
16144           if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) {
16145             break;
16146           }
16147         }
16148
16149         resultArray.splice(i + 1, 0, node);
16150         return;
16151       }
16152     } else if (node[childNodesCacheKey]) {
16153       return node[childNodesCacheKey];
16154     }
16155
16156     const childNodes = printer.getCommentChildNodes && printer.getCommentChildNodes(node, options) || typeof node === "object" && Object.keys(node).filter(n => n !== "enclosingNode" && n !== "precedingNode" && n !== "followingNode").map(n => node[n]);
16157
16158     if (!childNodes) {
16159       return;
16160     }
16161
16162     if (!resultArray) {
16163       Object.defineProperty(node, childNodesCacheKey, {
16164         value: resultArray = [],
16165         enumerable: false
16166       });
16167     }
16168
16169     childNodes.forEach(childNode => {
16170       getSortedChildNodes(childNode, options, resultArray);
16171     });
16172     return resultArray;
16173   } // As efficiently as possible, decorate the comment object with
16174   // .precedingNode, .enclosingNode, and/or .followingNode properties, at
16175   // least one of which is guaranteed to be defined.
16176
16177
16178   function decorateComment(node, comment, options) {
16179     const {
16180       locStart,
16181       locEnd
16182     } = options;
16183     const childNodes = getSortedChildNodes(node, options);
16184     let precedingNode;
16185     let followingNode; // Time to dust off the old binary search robes and wizard hat.
16186
16187     let left = 0;
16188     let right = childNodes.length;
16189
16190     while (left < right) {
16191       const middle = left + right >> 1;
16192       const child = childNodes[middle];
16193
16194       if (locStart(child) - locStart(comment) <= 0 && locEnd(comment) - locEnd(child) <= 0) {
16195         // The comment is completely contained by this child node.
16196         comment.enclosingNode = child;
16197         decorateComment(child, comment, options);
16198         return; // Abandon the binary search at this level.
16199       }
16200
16201       if (locEnd(child) - locStart(comment) <= 0) {
16202         // This child node falls completely before the comment.
16203         // Because we will never consider this node or any nodes
16204         // before it again, this node must be the closest preceding
16205         // node we have encountered so far.
16206         precedingNode = child;
16207         left = middle + 1;
16208         continue;
16209       }
16210
16211       if (locEnd(comment) - locStart(child) <= 0) {
16212         // This child node falls completely after the comment.
16213         // Because we will never consider this node or any nodes after
16214         // it again, this node must be the closest following node we
16215         // have encountered so far.
16216         followingNode = child;
16217         right = middle;
16218         continue;
16219       }
16220       /* istanbul ignore next */
16221
16222
16223       throw new Error("Comment location overlaps with node location");
16224     } // We don't want comments inside of different expressions inside of the same
16225     // template literal to move to another expression.
16226
16227
16228     if (comment.enclosingNode && comment.enclosingNode.type === "TemplateLiteral") {
16229       const {
16230         quasis
16231       } = comment.enclosingNode;
16232       const commentIndex = findExpressionIndexForComment(quasis, comment, options);
16233
16234       if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) {
16235         precedingNode = null;
16236       }
16237
16238       if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) {
16239         followingNode = null;
16240       }
16241     }
16242
16243     if (precedingNode) {
16244       comment.precedingNode = precedingNode;
16245     }
16246
16247     if (followingNode) {
16248       comment.followingNode = followingNode;
16249     }
16250   }
16251
16252   function attach(comments, ast, text, options) {
16253     if (!Array.isArray(comments)) {
16254       return;
16255     }
16256
16257     const tiesToBreak = [];
16258     const {
16259       locStart,
16260       locEnd
16261     } = options;
16262     comments.forEach((comment, i) => {
16263       if (options.parser === "json" || options.parser === "json5" || options.parser === "__js_expression" || options.parser === "__vue_expression") {
16264         if (locStart(comment) - locStart(ast) <= 0) {
16265           addLeadingComment$2(ast, comment);
16266           return;
16267         }
16268
16269         if (locEnd(comment) - locEnd(ast) >= 0) {
16270           addTrailingComment$2(ast, comment);
16271           return;
16272         }
16273       }
16274
16275       decorateComment(ast, comment, options);
16276       const {
16277         precedingNode,
16278         enclosingNode,
16279         followingNode
16280       } = comment;
16281       const pluginHandleOwnLineComment = options.printer.handleComments && options.printer.handleComments.ownLine ? options.printer.handleComments.ownLine : () => false;
16282       const pluginHandleEndOfLineComment = options.printer.handleComments && options.printer.handleComments.endOfLine ? options.printer.handleComments.endOfLine : () => false;
16283       const pluginHandleRemainingComment = options.printer.handleComments && options.printer.handleComments.remaining ? options.printer.handleComments.remaining : () => false;
16284       const isLastComment = comments.length - 1 === i;
16285
16286       if (hasNewline$2(text, locStart(comment), {
16287         backwards: true
16288       })) {
16289         // If a comment exists on its own line, prefer a leading comment.
16290         // We also need to check if it's the first line of the file.
16291         if (pluginHandleOwnLineComment(comment, text, options, ast, isLastComment)) ; else if (followingNode) {
16292           // Always a leading comment.
16293           addLeadingComment$2(followingNode, comment);
16294         } else if (precedingNode) {
16295           addTrailingComment$2(precedingNode, comment);
16296         } else if (enclosingNode) {
16297           addDanglingComment$2(enclosingNode, comment);
16298         } else {
16299           // There are no nodes, let's attach it to the root of the ast
16300
16301           /* istanbul ignore next */
16302           addDanglingComment$2(ast, comment);
16303         }
16304       } else if (hasNewline$2(text, locEnd(comment))) {
16305         if (pluginHandleEndOfLineComment(comment, text, options, ast, isLastComment)) ; else if (precedingNode) {
16306           // There is content before this comment on the same line, but
16307           // none after it, so prefer a trailing comment of the previous node.
16308           addTrailingComment$2(precedingNode, comment);
16309         } else if (followingNode) {
16310           addLeadingComment$2(followingNode, comment);
16311         } else if (enclosingNode) {
16312           addDanglingComment$2(enclosingNode, comment);
16313         } else {
16314           // There are no nodes, let's attach it to the root of the ast
16315
16316           /* istanbul ignore next */
16317           addDanglingComment$2(ast, comment);
16318         }
16319       } else {
16320         if (pluginHandleRemainingComment(comment, text, options, ast, isLastComment)) ; else if (precedingNode && followingNode) {
16321           // Otherwise, text exists both before and after the comment on
16322           // the same line. If there is both a preceding and following
16323           // node, use a tie-breaking algorithm to determine if it should
16324           // be attached to the next or previous node. In the last case,
16325           // simply attach the right node;
16326           const tieCount = tiesToBreak.length;
16327
16328           if (tieCount > 0) {
16329             const lastTie = tiesToBreak[tieCount - 1];
16330
16331             if (lastTie.followingNode !== comment.followingNode) {
16332               breakTies(tiesToBreak, text, options);
16333             }
16334           }
16335
16336           tiesToBreak.push(comment);
16337         } else if (precedingNode) {
16338           addTrailingComment$2(precedingNode, comment);
16339         } else if (followingNode) {
16340           addLeadingComment$2(followingNode, comment);
16341         } else if (enclosingNode) {
16342           addDanglingComment$2(enclosingNode, comment);
16343         } else {
16344           // There are no nodes, let's attach it to the root of the ast
16345
16346           /* istanbul ignore next */
16347           addDanglingComment$2(ast, comment);
16348         }
16349       }
16350     });
16351     breakTies(tiesToBreak, text, options);
16352     comments.forEach(comment => {
16353       // These node references were useful for breaking ties, but we
16354       // don't need them anymore, and they create cycles in the AST that
16355       // may lead to infinite recursion if we don't delete them here.
16356       delete comment.precedingNode;
16357       delete comment.enclosingNode;
16358       delete comment.followingNode;
16359     });
16360   }
16361
16362   function breakTies(tiesToBreak, text, options) {
16363     const tieCount = tiesToBreak.length;
16364
16365     if (tieCount === 0) {
16366       return;
16367     }
16368
16369     const {
16370       precedingNode,
16371       followingNode,
16372       enclosingNode
16373     } = tiesToBreak[0];
16374     const gapRegExp = options.printer.getGapRegex && options.printer.getGapRegex(enclosingNode) || /^[\s(]*$/;
16375     let gapEndPos = options.locStart(followingNode); // Iterate backwards through tiesToBreak, examining the gaps
16376     // between the tied comments. In order to qualify as leading, a
16377     // comment must be separated from followingNode by an unbroken series of
16378     // gaps (or other comments). Gaps should only contain whitespace or open
16379     // parentheses.
16380
16381     let indexOfFirstLeadingComment;
16382
16383     for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
16384       const comment = tiesToBreak[indexOfFirstLeadingComment - 1];
16385       assert.strictEqual(comment.precedingNode, precedingNode);
16386       assert.strictEqual(comment.followingNode, followingNode);
16387       const gap = text.slice(options.locEnd(comment), gapEndPos);
16388
16389       if (gapRegExp.test(gap)) {
16390         gapEndPos = options.locStart(comment);
16391       } else {
16392         // The gap string contained something other than whitespace or open
16393         // parentheses.
16394         break;
16395       }
16396     }
16397
16398     tiesToBreak.forEach((comment, i) => {
16399       if (i < indexOfFirstLeadingComment) {
16400         addTrailingComment$2(precedingNode, comment);
16401       } else {
16402         addLeadingComment$2(followingNode, comment);
16403       }
16404     });
16405     tiesToBreak.length = 0;
16406   }
16407
16408   function printComment(commentPath, options) {
16409     const comment = commentPath.getValue();
16410     comment.printed = true;
16411     return options.printer.printComment(commentPath, options);
16412   }
16413
16414   function findExpressionIndexForComment(quasis, comment, options) {
16415     const startPos = options.locStart(comment) - 1;
16416
16417     for (let i = 1; i < quasis.length; ++i) {
16418       if (startPos < getQuasiRange(quasis[i]).start) {
16419         return i - 1;
16420       }
16421     } // We haven't found it, it probably means that some of the locations are off.
16422     // Let's just return the first one.
16423
16424     /* istanbul ignore next */
16425
16426
16427     return 0;
16428   }
16429
16430   function getQuasiRange(expr) {
16431     if (expr.start !== undefined) {
16432       // Babel
16433       return {
16434         start: expr.start,
16435         end: expr.end
16436       };
16437     } // Flow
16438
16439
16440     return {
16441       start: expr.range[0],
16442       end: expr.range[1]
16443     };
16444   }
16445
16446   function printLeadingComment(commentPath, print, options) {
16447     const comment = commentPath.getValue();
16448     const contents = printComment(commentPath, options);
16449
16450     if (!contents) {
16451       return "";
16452     }
16453
16454     const isBlock = options.printer.isBlockComment && options.printer.isBlockComment(comment); // Leading block comments should see if they need to stay on the
16455     // same line or not.
16456
16457     if (isBlock) {
16458       const lineBreak = hasNewline$2(options.originalText, options.locEnd(comment)) ? hasNewline$2(options.originalText, options.locStart(comment), {
16459         backwards: true
16460       }) ? hardline$1 : line$1 : " ";
16461       return concat$2([contents, lineBreak]);
16462     }
16463
16464     return concat$2([contents, hardline$1]);
16465   }
16466
16467   function printTrailingComment(commentPath, print, options) {
16468     const comment = commentPath.getValue();
16469     const contents = printComment(commentPath, options);
16470
16471     if (!contents) {
16472       return "";
16473     }
16474
16475     const isBlock = options.printer.isBlockComment && options.printer.isBlockComment(comment); // We don't want the line to break
16476     // when the parentParentNode is a ClassDeclaration/-Expression
16477     // And the parentNode is in the superClass property
16478
16479     const parentNode = commentPath.getNode(1);
16480     const parentParentNode = commentPath.getNode(2);
16481     const isParentSuperClass = parentParentNode && (parentParentNode.type === "ClassDeclaration" || parentParentNode.type === "ClassExpression") && parentParentNode.superClass === parentNode;
16482
16483     if (hasNewline$2(options.originalText, options.locStart(comment), {
16484       backwards: true
16485     })) {
16486       // This allows comments at the end of nested structures:
16487       // {
16488       //   x: 1,
16489       //   y: 2
16490       //   // A comment
16491       // }
16492       // Those kinds of comments are almost always leading comments, but
16493       // here it doesn't go "outside" the block and turns it into a
16494       // trailing comment for `2`. We can simulate the above by checking
16495       // if this a comment on its own line; normal trailing comments are
16496       // always at the end of another expression.
16497       const isLineBeforeEmpty = isPreviousLineEmpty$2(options.originalText, comment, options.locStart);
16498       return lineSuffix$1(concat$2([hardline$1, isLineBeforeEmpty ? hardline$1 : "", contents]));
16499     } else if (isBlock || isParentSuperClass) {
16500       // Trailing block comments never need a newline
16501       return concat$2([" ", contents]);
16502     }
16503
16504     return concat$2([lineSuffix$1(concat$2([" ", contents])), !isBlock ? breakParent$1 : ""]);
16505   }
16506
16507   function printDanglingComments(path, options, sameIndent, filter) {
16508     const parts = [];
16509     const node = path.getValue();
16510
16511     if (!node || !node.comments) {
16512       return "";
16513     }
16514
16515     path.each(commentPath => {
16516       const comment = commentPath.getValue();
16517
16518       if (comment && !comment.leading && !comment.trailing && (!filter || filter(comment))) {
16519         parts.push(printComment(commentPath, options));
16520       }
16521     }, "comments");
16522
16523     if (parts.length === 0) {
16524       return "";
16525     }
16526
16527     if (sameIndent) {
16528       return join$1(hardline$1, parts);
16529     }
16530
16531     return indent$1(concat$2([hardline$1, join$1(hardline$1, parts)]));
16532   }
16533
16534   function prependCursorPlaceholder(path, options, printed) {
16535     if (path.getNode() === options.cursorNode && path.getValue()) {
16536       return concat$2([cursor$2, printed, cursor$2]);
16537     }
16538
16539     return printed;
16540   }
16541
16542   function printComments(path, print, options, needsSemi) {
16543     const value = path.getValue();
16544     const printed = print(path);
16545     const comments = value && value.comments;
16546
16547     if (!comments || comments.length === 0) {
16548       return prependCursorPlaceholder(path, options, printed);
16549     }
16550
16551     const leadingParts = [];
16552     const trailingParts = [needsSemi ? ";" : "", printed];
16553     path.each(commentPath => {
16554       const comment = commentPath.getValue();
16555       const {
16556         leading,
16557         trailing
16558       } = comment;
16559
16560       if (leading) {
16561         const contents = printLeadingComment(commentPath, print, options);
16562
16563         if (!contents) {
16564           return;
16565         }
16566
16567         leadingParts.push(contents);
16568         const text = options.originalText;
16569         const index = skipNewline$2(text, options.locEnd(comment));
16570
16571         if (index !== false && hasNewline$2(text, index)) {
16572           leadingParts.push(hardline$1);
16573         }
16574       } else if (trailing) {
16575         trailingParts.push(printTrailingComment(commentPath, print, options));
16576       }
16577     }, "comments");
16578     return prependCursorPlaceholder(path, options, concat$2(leadingParts.concat(trailingParts)));
16579   }
16580
16581   var comments = {
16582     attach,
16583     printComments,
16584     printDanglingComments,
16585     getSortedChildNodes
16586   };
16587
16588   function getNodeHelper(path, count) {
16589     const stackIndex = getNodeStackIndexHelper(path.stack, count);
16590     return stackIndex === -1 ? null : path.stack[stackIndex];
16591   }
16592
16593   function getNodeStackIndexHelper(stack, count) {
16594     for (let i = stack.length - 1; i >= 0; i -= 2) {
16595       const value = stack[i];
16596
16597       if (value && !Array.isArray(value) && --count < 0) {
16598         return i;
16599       }
16600     }
16601
16602     return -1;
16603   }
16604
16605   class FastPath {
16606     constructor(value) {
16607       this.stack = [value];
16608     } // The name of the current property is always the penultimate element of
16609     // this.stack, and always a String.
16610
16611
16612     getName() {
16613       const {
16614         stack
16615       } = this;
16616       const {
16617         length
16618       } = stack;
16619
16620       if (length > 1) {
16621         return stack[length - 2];
16622       } // Since the name is always a string, null is a safe sentinel value to
16623       // return if we do not know the name of the (root) value.
16624
16625       /* istanbul ignore next */
16626
16627
16628       return null;
16629     } // The value of the current property is always the final element of
16630     // this.stack.
16631
16632
16633     getValue() {
16634       return getLast(this.stack);
16635     }
16636
16637     getNode(count = 0) {
16638       return getNodeHelper(this, count);
16639     }
16640
16641     getParentNode(count = 0) {
16642       return getNodeHelper(this, count + 1);
16643     } // Temporarily push properties named by string arguments given after the
16644     // callback function onto this.stack, then call the callback with a
16645     // reference to this (modified) FastPath object. Note that the stack will
16646     // be restored to its original state after the callback is finished, so it
16647     // is probably a mistake to retain a reference to the path.
16648
16649
16650     call(callback, ...names) {
16651       const {
16652         stack
16653       } = this;
16654       const {
16655         length
16656       } = stack;
16657       let value = getLast(stack);
16658
16659       for (const name of names) {
16660         value = value[name];
16661         stack.push(name, value);
16662       }
16663
16664       const result = callback(this);
16665       stack.length = length;
16666       return result;
16667     }
16668
16669     callParent(callback, count = 0) {
16670       const stackIndex = getNodeStackIndexHelper(this.stack, count + 1);
16671       const parentValues = this.stack.splice(stackIndex + 1);
16672       const result = callback(this);
16673       this.stack.push(...parentValues);
16674       return result;
16675     } // Similar to FastPath.prototype.call, except that the value obtained by
16676     // accessing this.getValue()[name1][name2]... should be array-like. The
16677     // callback will be called with a reference to this path object for each
16678     // element of the array.
16679
16680
16681     each(callback, ...names) {
16682       const {
16683         stack
16684       } = this;
16685       const {
16686         length
16687       } = stack;
16688       let value = getLast(stack);
16689
16690       for (const name of names) {
16691         value = value[name];
16692         stack.push(name, value);
16693       }
16694
16695       for (let i = 0; i < value.length; ++i) {
16696         if (i in value) {
16697           stack.push(i, value[i]); // If the callback needs to know the value of i, call
16698           // path.getName(), assuming path is the parameter name.
16699
16700           callback(this);
16701           stack.length -= 2;
16702         }
16703       }
16704
16705       stack.length = length;
16706     } // Similar to FastPath.prototype.each, except that the results of the
16707     // callback function invocations are stored in an array and returned at
16708     // the end of the iteration.
16709
16710
16711     map(callback, ...names) {
16712       const {
16713         stack
16714       } = this;
16715       const {
16716         length
16717       } = stack;
16718       let value = getLast(stack);
16719
16720       for (const name of names) {
16721         value = value[name];
16722         stack.push(name, value);
16723       }
16724
16725       const result = new Array(value.length);
16726
16727       for (let i = 0; i < value.length; ++i) {
16728         if (i in value) {
16729           stack.push(i, value[i]);
16730           result[i] = callback(this, i);
16731           stack.length -= 2;
16732         }
16733       }
16734
16735       stack.length = length;
16736       return result;
16737     }
16738     /**
16739      * @param {...(
16740      *   | ((node: any, name: string | null, number: number | null) => boolean)
16741      *   | undefined
16742      * )} predicates
16743      */
16744
16745
16746     match(...predicates) {
16747       let stackPointer = this.stack.length - 1;
16748       let name = null;
16749       let node = this.stack[stackPointer--];
16750
16751       for (const predicate of predicates) {
16752         if (node === undefined) {
16753           return false;
16754         } // skip index/array
16755
16756
16757         let number = null;
16758
16759         if (typeof name === "number") {
16760           number = name;
16761           name = this.stack[stackPointer--];
16762           node = this.stack[stackPointer--];
16763         }
16764
16765         if (predicate && !predicate(node, name, number)) {
16766           return false;
16767         }
16768
16769         name = this.stack[stackPointer--];
16770         node = this.stack[stackPointer--];
16771       }
16772
16773       return true;
16774     }
16775
16776   }
16777
16778   var fastPath = FastPath;
16779
16780   const {
16781     normalize: normalize$2
16782   } = options$1;
16783
16784   function printSubtree(path, print, options, printAstToDoc) {
16785     if (options.printer.embed) {
16786       return options.printer.embed(path, print, (text, partialNextOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc), options);
16787     }
16788   }
16789
16790   function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc) {
16791     const nextOptions = normalize$2(Object.assign({}, parentOptions, {}, partialNextOptions, {
16792       parentParser: parentOptions.parser,
16793       embeddedInHtml: !!(parentOptions.embeddedInHtml || parentOptions.parser === "html" || parentOptions.parser === "vue" || parentOptions.parser === "angular" || parentOptions.parser === "lwc"),
16794       originalText: text
16795     }), {
16796       passThrough: true
16797     });
16798     const result = parser.parse(text, nextOptions);
16799     const {
16800       ast
16801     } = result;
16802     text = result.text;
16803     const astComments = ast.comments;
16804     delete ast.comments;
16805     comments.attach(astComments, ast, text, nextOptions);
16806     return printAstToDoc(ast, nextOptions);
16807   }
16808
16809   var multiparser = {
16810     printSubtree
16811   };
16812
16813   const doc = document;
16814   const docBuilders$1 = doc.builders;
16815   const {
16816     concat: concat$3,
16817     hardline: hardline$2,
16818     addAlignmentToDoc: addAlignmentToDoc$1
16819   } = docBuilders$1;
16820   const docUtils$1 = doc.utils;
16821   /**
16822    * Takes an abstract syntax tree (AST) and recursively converts it to a
16823    * document (series of printing primitives).
16824    *
16825    * This is done by descending down the AST recursively. The recursion
16826    * involves two functions that call each other:
16827    *
16828    * 1. printGenerically(), which is defined as an inner function here.
16829    *    It basically takes care of node caching.
16830    * 2. callPluginPrintFunction(), which checks for some options, and
16831    *    ultimately calls the print() function provided by the plugin.
16832    *
16833    * The plugin function will call printGenerically() again for child nodes
16834    * of the current node, which will do its housekeeping, then call the
16835    * plugin function again, and so on.
16836    *
16837    * All the while, these functions pass a "path" variable around, which
16838    * is a stack-like data structure (FastPath) that maintains the current
16839    * state of the recursion. It is called "path", because it represents
16840    * the path to the current node through the Abstract Syntax Tree.
16841    */
16842
16843   function printAstToDoc(ast, options, alignmentSize = 0) {
16844     const {
16845       printer
16846     } = options;
16847
16848     if (printer.preprocess) {
16849       ast = printer.preprocess(ast, options);
16850     }
16851
16852     const cache = new Map();
16853
16854     function printGenerically(path, args) {
16855       const node = path.getValue();
16856       const shouldCache = node && typeof node === "object" && args === undefined;
16857
16858       if (shouldCache && cache.has(node)) {
16859         return cache.get(node);
16860       } // We let JSXElement print its comments itself because it adds () around
16861       // UnionTypeAnnotation has to align the child without the comments
16862
16863
16864       let res;
16865
16866       if (printer.willPrintOwnComments && printer.willPrintOwnComments(path, options)) {
16867         res = callPluginPrintFunction(path, options, printGenerically, args);
16868       } else {
16869         // printComments will call the plugin print function and check for
16870         // comments to print
16871         res = comments.printComments(path, p => callPluginPrintFunction(p, options, printGenerically, args), options, args && args.needsSemi);
16872       }
16873
16874       if (shouldCache) {
16875         cache.set(node, res);
16876       }
16877
16878       return res;
16879     }
16880
16881     let doc = printGenerically(new fastPath(ast));
16882
16883     if (alignmentSize > 0) {
16884       // Add a hardline to make the indents take effect
16885       // It should be removed in index.js format()
16886       doc = addAlignmentToDoc$1(concat$3([hardline$2, doc]), alignmentSize, options.tabWidth);
16887     }
16888
16889     docUtils$1.propagateBreaks(doc);
16890     return doc;
16891   }
16892
16893   function callPluginPrintFunction(path, options, printPath, args) {
16894     assert.ok(path instanceof fastPath);
16895     const node = path.getValue();
16896     const {
16897       printer
16898     } = options; // Escape hatch
16899
16900     if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
16901       return options.originalText.slice(options.locStart(node), options.locEnd(node));
16902     }
16903
16904     if (node) {
16905       try {
16906         // Potentially switch to a different parser
16907         const sub = multiparser.printSubtree(path, printPath, options, printAstToDoc);
16908
16909         if (sub) {
16910           return sub;
16911         }
16912       } catch (error) {
16913         /* istanbul ignore if */
16914         if (commonjsGlobal.PRETTIER_DEBUG) {
16915           throw error;
16916         } // Continue with current parser
16917
16918       }
16919     }
16920
16921     return printer.print(path, options, printPath, args);
16922   }
16923
16924   var astToDoc = printAstToDoc;
16925
16926   function findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts) {
16927     let resultStartNode = startNodeAndParents.node;
16928     let resultEndNode = endNodeAndParents.node;
16929
16930     if (resultStartNode === resultEndNode) {
16931       return {
16932         startNode: resultStartNode,
16933         endNode: resultEndNode
16934       };
16935     }
16936
16937     for (const endParent of endNodeAndParents.parentNodes) {
16938       if (endParent.type !== "Program" && endParent.type !== "File" && opts.locStart(endParent) >= opts.locStart(startNodeAndParents.node)) {
16939         resultEndNode = endParent;
16940       } else {
16941         break;
16942       }
16943     }
16944
16945     for (const startParent of startNodeAndParents.parentNodes) {
16946       if (startParent.type !== "Program" && startParent.type !== "File" && opts.locEnd(startParent) <= opts.locEnd(endNodeAndParents.node)) {
16947         resultStartNode = startParent;
16948       } else {
16949         break;
16950       }
16951     }
16952
16953     return {
16954       startNode: resultStartNode,
16955       endNode: resultEndNode
16956     };
16957   }
16958
16959   function findNodeAtOffset(node, offset, options, predicate, parentNodes) {
16960     predicate = predicate || (() => true);
16961
16962     parentNodes = parentNodes || [];
16963     const start = options.locStart(node, options.locStart);
16964     const end = options.locEnd(node, options.locEnd);
16965
16966     if (start <= offset && offset <= end) {
16967       for (const childNode of comments.getSortedChildNodes(node, options)) {
16968         const childResult = findNodeAtOffset(childNode, offset, options, predicate, [node].concat(parentNodes));
16969
16970         if (childResult) {
16971           return childResult;
16972         }
16973       }
16974
16975       if (predicate(node)) {
16976         return {
16977           node,
16978           parentNodes
16979         };
16980       }
16981     }
16982   } // See https://www.ecma-international.org/ecma-262/5.1/#sec-A.5
16983
16984
16985   function isSourceElement(opts, node) {
16986     if (node == null) {
16987       return false;
16988     } // JS and JS like to avoid repetitions
16989
16990
16991     const jsSourceElements = ["FunctionDeclaration", "BlockStatement", "BreakStatement", "ContinueStatement", "DebuggerStatement", "DoWhileStatement", "EmptyStatement", "ExpressionStatement", "ForInStatement", "ForStatement", "IfStatement", "LabeledStatement", "ReturnStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "VariableDeclaration", "WhileStatement", "WithStatement", "ClassDeclaration", // ES 2015
16992     "ImportDeclaration", // Module
16993     "ExportDefaultDeclaration", // Module
16994     "ExportNamedDeclaration", // Module
16995     "ExportAllDeclaration", // Module
16996     "TypeAlias", // Flow
16997     "InterfaceDeclaration", // Flow, TypeScript
16998     "TypeAliasDeclaration", // TypeScript
16999     "ExportAssignment", // TypeScript
17000     "ExportDeclaration" // TypeScript
17001     ];
17002     const jsonSourceElements = ["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral"];
17003     const graphqlSourceElements = ["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"];
17004
17005     switch (opts.parser) {
17006       case "flow":
17007       case "babel":
17008       case "babel-flow":
17009       case "babel-ts":
17010       case "typescript":
17011         return jsSourceElements.includes(node.type);
17012
17013       case "json":
17014         return jsonSourceElements.includes(node.type);
17015
17016       case "graphql":
17017         return graphqlSourceElements.includes(node.kind);
17018
17019       case "vue":
17020         return node.tag !== "root";
17021     }
17022
17023     return false;
17024   }
17025
17026   function calculateRange(text, opts, ast) {
17027     // Contract the range so that it has non-whitespace characters at its endpoints.
17028     // This ensures we can format a range that doesn't end on a node.
17029     const rangeStringOrig = text.slice(opts.rangeStart, opts.rangeEnd);
17030     const startNonWhitespace = Math.max(opts.rangeStart + rangeStringOrig.search(/\S/), opts.rangeStart);
17031     let endNonWhitespace;
17032
17033     for (endNonWhitespace = opts.rangeEnd; endNonWhitespace > opts.rangeStart; --endNonWhitespace) {
17034       if (text[endNonWhitespace - 1].match(/\S/)) {
17035         break;
17036       }
17037     }
17038
17039     const startNodeAndParents = findNodeAtOffset(ast, startNonWhitespace, opts, node => isSourceElement(opts, node));
17040     const endNodeAndParents = findNodeAtOffset(ast, endNonWhitespace, opts, node => isSourceElement(opts, node));
17041
17042     if (!startNodeAndParents || !endNodeAndParents) {
17043       return {
17044         rangeStart: 0,
17045         rangeEnd: 0
17046       };
17047     }
17048
17049     const siblingAncestors = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts);
17050     const {
17051       startNode,
17052       endNode
17053     } = siblingAncestors;
17054     const rangeStart = Math.min(opts.locStart(startNode, opts.locStart), opts.locStart(endNode, opts.locStart));
17055     const rangeEnd = Math.max(opts.locEnd(startNode, opts.locEnd), opts.locEnd(endNode, opts.locEnd));
17056     return {
17057       rangeStart,
17058       rangeEnd
17059     };
17060   }
17061
17062   var rangeUtil = {
17063     calculateRange,
17064     findNodeAtOffset
17065   };
17066
17067   var diff = getCjsExportFromNamespace(index_es6);
17068
17069   const normalizeOptions$1 = options$1.normalize;
17070   const {
17071     guessEndOfLine: guessEndOfLine$1,
17072     convertEndOfLineToChars: convertEndOfLineToChars$2
17073   } = endOfLine;
17074   const {
17075     printer: {
17076       printDocToString: printDocToString$1
17077     },
17078     debug: {
17079       printDocToDebug
17080     }
17081   } = document;
17082   const BOM = "\uFEFF";
17083   const CURSOR = Symbol("cursor");
17084   const PLACEHOLDERS = {
17085     cursorOffset: "<<<PRETTIER_CURSOR>>>",
17086     rangeStart: "<<<PRETTIER_RANGE_START>>>",
17087     rangeEnd: "<<<PRETTIER_RANGE_END>>>"
17088   };
17089
17090   function ensureAllCommentsPrinted(astComments) {
17091     if (!astComments) {
17092       return;
17093     }
17094
17095     for (let i = 0; i < astComments.length; ++i) {
17096       if (util$1.isNodeIgnoreComment(astComments[i])) {
17097         // If there's a prettier-ignore, we're not printing that sub-tree so we
17098         // don't know if the comments was printed or not.
17099         return;
17100       }
17101     }
17102
17103     astComments.forEach(comment => {
17104       if (!comment.printed) {
17105         throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!');
17106       }
17107
17108       delete comment.printed;
17109     });
17110   }
17111
17112   function attachComments(text, ast, opts) {
17113     const astComments = ast.comments;
17114
17115     if (astComments) {
17116       delete ast.comments;
17117       comments.attach(astComments, ast, text, opts);
17118     }
17119
17120     ast.tokens = [];
17121     opts.originalText = opts.parser === "yaml" ? text : text.trimEnd();
17122     return astComments;
17123   }
17124
17125   function coreFormat(text, opts, addAlignmentSize) {
17126     if (!text || !text.trim().length) {
17127       return {
17128         formatted: "",
17129         cursorOffset: 0
17130       };
17131     }
17132
17133     addAlignmentSize = addAlignmentSize || 0;
17134     const parsed = parser.parse(text, opts);
17135     const {
17136       ast
17137     } = parsed;
17138     text = parsed.text;
17139
17140     if (opts.cursorOffset >= 0) {
17141       const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
17142
17143       if (nodeResult && nodeResult.node) {
17144         opts.cursorNode = nodeResult.node;
17145       }
17146     }
17147
17148     const astComments = attachComments(text, ast, opts);
17149     const doc = astToDoc(ast, opts, addAlignmentSize);
17150     const result = printDocToString$1(doc, opts);
17151     ensureAllCommentsPrinted(astComments); // Remove extra leading indentation as well as the added indentation after last newline
17152
17153     if (addAlignmentSize > 0) {
17154       const trimmed = result.formatted.trim();
17155
17156       if (result.cursorNodeStart !== undefined) {
17157         result.cursorNodeStart -= result.formatted.indexOf(trimmed);
17158       }
17159
17160       result.formatted = trimmed + convertEndOfLineToChars$2(opts.endOfLine);
17161     }
17162
17163     if (opts.cursorOffset >= 0) {
17164       let oldCursorNodeStart;
17165       let oldCursorNodeText;
17166       let cursorOffsetRelativeToOldCursorNode;
17167       let newCursorNodeStart;
17168       let newCursorNodeText;
17169
17170       if (opts.cursorNode && result.cursorNodeText) {
17171         oldCursorNodeStart = opts.locStart(opts.cursorNode);
17172         oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
17173         cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
17174         newCursorNodeStart = result.cursorNodeStart;
17175         newCursorNodeText = result.cursorNodeText;
17176       } else {
17177         oldCursorNodeStart = 0;
17178         oldCursorNodeText = text;
17179         cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
17180         newCursorNodeStart = 0;
17181         newCursorNodeText = result.formatted;
17182       }
17183
17184       if (oldCursorNodeText === newCursorNodeText) {
17185         return {
17186           formatted: result.formatted,
17187           cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode
17188         };
17189       } // diff old and new cursor node texts, with a special cursor
17190       // symbol inserted to find out where it moves to
17191
17192
17193       const oldCursorNodeCharArray = oldCursorNodeText.split("");
17194       oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
17195       const newCursorNodeCharArray = newCursorNodeText.split("");
17196       const cursorNodeDiff = diff.diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
17197       let cursorOffset = newCursorNodeStart;
17198
17199       for (const entry of cursorNodeDiff) {
17200         if (entry.removed) {
17201           if (entry.value.includes(CURSOR)) {
17202             break;
17203           }
17204         } else {
17205           cursorOffset += entry.count;
17206         }
17207       }
17208
17209       return {
17210         formatted: result.formatted,
17211         cursorOffset
17212       };
17213     }
17214
17215     return {
17216       formatted: result.formatted
17217     };
17218   }
17219
17220   function formatRange(text, opts) {
17221     const parsed = parser.parse(text, opts);
17222     const {
17223       ast
17224     } = parsed;
17225     text = parsed.text;
17226     const range = rangeUtil.calculateRange(text, opts, ast);
17227     const {
17228       rangeStart,
17229       rangeEnd
17230     } = range;
17231     const rangeString = text.slice(rangeStart, rangeEnd); // Try to extend the range backwards to the beginning of the line.
17232     // This is so we can detect indentation correctly and restore it.
17233     // Use `Math.min` since `lastIndexOf` returns 0 when `rangeStart` is 0
17234
17235     const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
17236     const indentString = text.slice(rangeStart2, rangeStart);
17237     const alignmentSize = util$1.getAlignmentSize(indentString, opts.tabWidth);
17238     const rangeResult = coreFormat(rangeString, Object.assign({}, opts, {
17239       rangeStart: 0,
17240       rangeEnd: Infinity,
17241       // track the cursor offset only if it's within our range
17242       cursorOffset: opts.cursorOffset >= rangeStart && opts.cursorOffset < rangeEnd ? opts.cursorOffset - rangeStart : -1
17243     }), alignmentSize); // Since the range contracts to avoid trailing whitespace,
17244     // we need to remove the newline that was inserted by the `format` call.
17245
17246     const rangeTrimmed = rangeResult.formatted.trimEnd();
17247     const rangeLeft = text.slice(0, rangeStart);
17248     const rangeRight = text.slice(rangeEnd);
17249     let {
17250       cursorOffset
17251     } = opts;
17252
17253     if (opts.cursorOffset >= rangeEnd) {
17254       // handle the case where the cursor was past the end of the range
17255       cursorOffset = opts.cursorOffset - rangeEnd + (rangeStart + rangeTrimmed.length);
17256     } else if (rangeResult.cursorOffset !== undefined) {
17257       // handle the case where the cursor was in the range
17258       cursorOffset = rangeResult.cursorOffset + rangeStart;
17259     } // keep the cursor as it was if it was before the start of the range
17260
17261
17262     let formatted;
17263
17264     if (opts.endOfLine === "lf") {
17265       formatted = rangeLeft + rangeTrimmed + rangeRight;
17266     } else {
17267       const eol = convertEndOfLineToChars$2(opts.endOfLine);
17268
17269       if (cursorOffset >= 0) {
17270         const parts = [rangeLeft, rangeTrimmed, rangeRight];
17271         let partIndex = 0;
17272         let partOffset = cursorOffset;
17273
17274         while (partIndex < parts.length) {
17275           const part = parts[partIndex];
17276
17277           if (partOffset < part.length) {
17278             parts[partIndex] = parts[partIndex].slice(0, partOffset) + PLACEHOLDERS.cursorOffset + parts[partIndex].slice(partOffset);
17279             break;
17280           }
17281
17282           partIndex++;
17283           partOffset -= part.length;
17284         }
17285
17286         const [newRangeLeft, newRangeTrimmed, newRangeRight] = parts;
17287         formatted = (newRangeLeft.replace(/\n/g, eol) + newRangeTrimmed + newRangeRight.replace(/\n/g, eol)).replace(PLACEHOLDERS.cursorOffset, (_, index) => {
17288           cursorOffset = index;
17289           return "";
17290         });
17291       } else {
17292         formatted = rangeLeft.replace(/\n/g, eol) + rangeTrimmed + rangeRight.replace(/\n/g, eol);
17293       }
17294     }
17295
17296     return {
17297       formatted,
17298       cursorOffset
17299     };
17300   }
17301
17302   function format(text, opts) {
17303     const selectedParser = parser.resolveParser(opts);
17304     const hasPragma = !selectedParser.hasPragma || selectedParser.hasPragma(text);
17305
17306     if (opts.requirePragma && !hasPragma) {
17307       return {
17308         formatted: text
17309       };
17310     }
17311
17312     if (opts.endOfLine === "auto") {
17313       opts.endOfLine = guessEndOfLine$1(text);
17314     }
17315
17316     const hasCursor = opts.cursorOffset >= 0;
17317     const hasRangeStart = opts.rangeStart > 0;
17318     const hasRangeEnd = opts.rangeEnd < text.length; // get rid of CR/CRLF parsing
17319
17320     if (text.includes("\r")) {
17321       const offsetKeys = [hasCursor && "cursorOffset", hasRangeStart && "rangeStart", hasRangeEnd && "rangeEnd"].filter(Boolean).sort((aKey, bKey) => opts[aKey] - opts[bKey]);
17322
17323       for (let i = offsetKeys.length - 1; i >= 0; i--) {
17324         const key = offsetKeys[i];
17325         text = text.slice(0, opts[key]) + PLACEHOLDERS[key] + text.slice(opts[key]);
17326       }
17327
17328       text = text.replace(/\r\n?/g, "\n");
17329
17330       for (let i = 0; i < offsetKeys.length; i++) {
17331         const key = offsetKeys[i];
17332         text = text.replace(PLACEHOLDERS[key], (_, index) => {
17333           opts[key] = index;
17334           return "";
17335         });
17336       }
17337     }
17338
17339     const hasUnicodeBOM = text.charAt(0) === BOM;
17340
17341     if (hasUnicodeBOM) {
17342       text = text.slice(1);
17343
17344       if (hasCursor) {
17345         opts.cursorOffset++;
17346       }
17347
17348       if (hasRangeStart) {
17349         opts.rangeStart++;
17350       }
17351
17352       if (hasRangeEnd) {
17353         opts.rangeEnd++;
17354       }
17355     }
17356
17357     if (!hasCursor) {
17358       opts.cursorOffset = -1;
17359     }
17360
17361     if (opts.rangeStart < 0) {
17362       opts.rangeStart = 0;
17363     }
17364
17365     if (opts.rangeEnd > text.length) {
17366       opts.rangeEnd = text.length;
17367     }
17368
17369     const result = hasRangeStart || hasRangeEnd ? formatRange(text, opts) : coreFormat(opts.insertPragma && opts.printer.insertPragma && !hasPragma ? opts.printer.insertPragma(text) : text, opts);
17370
17371     if (hasUnicodeBOM) {
17372       result.formatted = BOM + result.formatted;
17373
17374       if (hasCursor) {
17375         result.cursorOffset++;
17376       }
17377     }
17378
17379     return result;
17380   }
17381
17382   var core = {
17383     formatWithCursor(text, opts) {
17384       opts = normalizeOptions$1(opts);
17385       return format(text, opts);
17386     },
17387
17388     parse(text, opts, massage) {
17389       opts = normalizeOptions$1(opts);
17390
17391       if (text.includes("\r")) {
17392         text = text.replace(/\r\n?/g, "\n");
17393       }
17394
17395       const parsed = parser.parse(text, opts);
17396
17397       if (massage) {
17398         parsed.ast = massageAst(parsed.ast, opts);
17399       }
17400
17401       return parsed;
17402     },
17403
17404     formatAST(ast, opts) {
17405       opts = normalizeOptions$1(opts);
17406       const doc = astToDoc(ast, opts);
17407       return printDocToString$1(doc, opts);
17408     },
17409
17410     // Doesn't handle shebang for now
17411     formatDoc(doc, opts) {
17412       const debug = printDocToDebug(doc);
17413       opts = normalizeOptions$1(Object.assign({}, opts, {
17414         parser: "babel"
17415       }));
17416       return format(debug, opts).formatted;
17417     },
17418
17419     printToDoc(text, opts) {
17420       opts = normalizeOptions$1(opts);
17421       const parsed = parser.parse(text, opts);
17422       const {
17423         ast
17424       } = parsed;
17425       text = parsed.text;
17426       attachComments(text, ast, opts);
17427       return astToDoc(ast, opts);
17428     },
17429
17430     printDocToString(doc, opts) {
17431       return printDocToString$1(doc, normalizeOptions$1(opts));
17432     }
17433
17434   };
17435
17436   function clean(ast, newObj, parent) {
17437     ["raw", // front-matter
17438     "raws", "sourceIndex", "source", "before", "after", "trailingComma"].forEach(name => {
17439       delete newObj[name];
17440     });
17441
17442     if (ast.type === "yaml") {
17443       delete newObj.value;
17444     } // --insert-pragma
17445
17446
17447     if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length !== 0 && ( // first non-front-matter comment
17448     parent.nodes[0] === ast || (parent.nodes[0].type === "yaml" || parent.nodes[0].type === "toml") && parent.nodes[1] === ast)) {
17449       /**
17450        * something
17451        *
17452        * @format
17453        */
17454       delete newObj.text; // standalone pragma
17455
17456       if (/^\*\s*@(format|prettier)\s*$/.test(ast.text)) {
17457         return null;
17458       }
17459     }
17460
17461     if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
17462       delete newObj.value;
17463     }
17464
17465     if (ast.type === "css-rule") {
17466       delete newObj.params;
17467     }
17468
17469     if (ast.type === "selector-combinator") {
17470       newObj.value = newObj.value.replace(/\s+/g, " ");
17471     }
17472
17473     if (ast.type === "media-feature") {
17474       newObj.value = newObj.value.replace(/ /g, "");
17475     }
17476
17477     if (ast.type === "value-word" && (ast.isColor && ast.isHex || ["initial", "inherit", "unset", "revert"].includes(newObj.value.replace().toLowerCase())) || ast.type === "media-feature" || ast.type === "selector-root-invalid" || ast.type === "selector-pseudo") {
17478       newObj.value = newObj.value.toLowerCase();
17479     }
17480
17481     if (ast.type === "css-decl") {
17482       newObj.prop = newObj.prop.toLowerCase();
17483     }
17484
17485     if (ast.type === "css-atrule" || ast.type === "css-import") {
17486       newObj.name = newObj.name.toLowerCase();
17487     }
17488
17489     if (ast.type === "value-number") {
17490       newObj.unit = newObj.unit.toLowerCase();
17491     }
17492
17493     if ((ast.type === "media-feature" || ast.type === "media-keyword" || ast.type === "media-type" || ast.type === "media-unknown" || ast.type === "media-url" || ast.type === "media-value" || ast.type === "selector-attribute" || ast.type === "selector-string" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "value-string") && newObj.value) {
17494       newObj.value = cleanCSSStrings(newObj.value);
17495     }
17496
17497     if (ast.type === "selector-attribute") {
17498       newObj.attribute = newObj.attribute.trim();
17499
17500       if (newObj.namespace) {
17501         if (typeof newObj.namespace === "string") {
17502           newObj.namespace = newObj.namespace.trim();
17503
17504           if (newObj.namespace.length === 0) {
17505             newObj.namespace = true;
17506           }
17507         }
17508       }
17509
17510       if (newObj.value) {
17511         newObj.value = newObj.value.trim().replace(/^['"]|['"]$/g, "");
17512         delete newObj.quoted;
17513       }
17514     }
17515
17516     if ((ast.type === "media-value" || ast.type === "media-type" || ast.type === "value-number" || ast.type === "selector-root-invalid" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "selector-tag") && newObj.value) {
17517       newObj.value = newObj.value.replace(/([\d.eE+-]+)([a-zA-Z]*)/g, (match, numStr, unit) => {
17518         const num = Number(numStr);
17519         return isNaN(num) ? match : num + unit.toLowerCase();
17520       });
17521     }
17522
17523     if (ast.type === "selector-tag") {
17524       const lowercasedValue = ast.value.toLowerCase();
17525
17526       if (["from", "to"].includes(lowercasedValue)) {
17527         newObj.value = lowercasedValue;
17528       }
17529     } // Workaround when `postcss-values-parser` parse `not`, `and` or `or` keywords as `value-func`
17530
17531
17532     if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") {
17533       delete newObj.value;
17534     } // Workaround for SCSS nested properties
17535
17536
17537     if (ast.type === "selector-unknown") {
17538       delete newObj.value;
17539     }
17540   }
17541
17542   function cleanCSSStrings(value) {
17543     return value.replace(/'/g, '"').replace(/\\([^a-fA-F\d])/g, "$1");
17544   }
17545
17546   var clean_1 = clean;
17547
17548   const {
17549     builders: {
17550       hardline: hardline$3,
17551       literalline: literalline$1,
17552       concat: concat$4,
17553       markAsRoot: markAsRoot$1
17554     },
17555     utils: {
17556       mapDoc: mapDoc$1
17557     }
17558   } = document;
17559
17560   function embed(path, print, textToDoc
17561   /*, options */
17562   ) {
17563     const node = path.getValue();
17564
17565     if (node.type === "yaml") {
17566       return markAsRoot$1(concat$4(["---", hardline$3, node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, {
17567         parser: "yaml"
17568       })) : "", "---", hardline$3]));
17569     }
17570
17571     return null;
17572
17573     function replaceNewlinesWithLiterallines(doc) {
17574       return mapDoc$1(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$4(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$1)) : currentDoc);
17575     }
17576   }
17577
17578   var embed_1 = embed;
17579
17580   const detectNewline = string => {
17581     if (typeof string !== 'string') {
17582       throw new TypeError('Expected a string');
17583     }
17584
17585     const newlines = string.match(/(?:\r?\n)/g) || [];
17586
17587     if (newlines.length === 0) {
17588       return;
17589     }
17590
17591     const crlf = newlines.filter(newline => newline === '\r\n').length;
17592     const lf = newlines.length - crlf;
17593     return crlf > lf ? '\r\n' : '\n';
17594   };
17595
17596   var detectNewline_1 = detectNewline;
17597
17598   var graceful = string => typeof string === 'string' && detectNewline(string) || '\n';
17599   detectNewline_1.graceful = graceful;
17600
17601   var build = createCommonjsModule(function (module, exports) {
17602
17603     Object.defineProperty(exports, '__esModule', {
17604       value: true
17605     });
17606     exports.extract = extract;
17607     exports.strip = strip;
17608     exports.parse = parse;
17609     exports.parseWithComments = parseWithComments;
17610     exports.print = print;
17611
17612     function _os() {
17613       const data = require$$0$1;
17614
17615       _os = function _os() {
17616         return data;
17617       };
17618
17619       return data;
17620     }
17621
17622     function _detectNewline() {
17623       const data = _interopRequireDefault(detectNewline_1);
17624
17625       _detectNewline = function _detectNewline() {
17626         return data;
17627       };
17628
17629       return data;
17630     }
17631
17632     function _interopRequireDefault(obj) {
17633       return obj && obj.__esModule ? obj : {
17634         default: obj
17635       };
17636     }
17637     /**
17638      * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
17639      *
17640      * This source code is licensed under the MIT license found in the
17641      * LICENSE file in the root directory of this source tree.
17642      */
17643
17644
17645     const commentEndRe = /\*\/$/;
17646     const commentStartRe = /^\/\*\*/;
17647     const docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
17648     const lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
17649     const ltrimNewlineRe = /^(\r?\n)+/;
17650     const multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
17651     const propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
17652     const stringStartRe = /(\r?\n|^) *\* ?/g;
17653
17654     function extract(contents) {
17655       const match = contents.match(docblockRe);
17656       return match ? match[0].trimLeft() : '';
17657     }
17658
17659     function strip(contents) {
17660       const match = contents.match(docblockRe);
17661       return match && match[0] ? contents.substring(match[0].length) : contents;
17662     }
17663
17664     function parse(docblock) {
17665       return parseWithComments(docblock).pragmas;
17666     }
17667
17668     function parseWithComments(docblock) {
17669       const line = (0, _detectNewline().default)(docblock) || _os().EOL;
17670
17671       docblock = docblock.replace(commentStartRe, '').replace(commentEndRe, '').replace(stringStartRe, '$1'); // Normalize multi-line directives
17672
17673       let prev = '';
17674
17675       while (prev !== docblock) {
17676         prev = docblock;
17677         docblock = docblock.replace(multilineRe, "".concat(line, "$1 $2").concat(line));
17678       }
17679
17680       docblock = docblock.replace(ltrimNewlineRe, '').trimRight();
17681       const result = Object.create(null);
17682       const comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').trimRight();
17683       let match;
17684
17685       while (match = propertyRe.exec(docblock)) {
17686         // strip linecomments from pragmas
17687         const nextPragma = match[2].replace(lineCommentRe, '');
17688
17689         if (typeof result[match[1]] === 'string' || Array.isArray(result[match[1]])) {
17690           result[match[1]] = [].concat(result[match[1]], nextPragma);
17691         } else {
17692           result[match[1]] = nextPragma;
17693         }
17694       }
17695
17696       return {
17697         comments,
17698         pragmas: result
17699       };
17700     }
17701
17702     function print({
17703       comments = '',
17704       pragmas = {}
17705     }) {
17706       const line = (0, _detectNewline().default)(comments) || _os().EOL;
17707
17708       const head = '/**';
17709       const start = ' *';
17710       const tail = ' */';
17711       const keys = Object.keys(pragmas);
17712       const printedObject = keys.map(key => printKeyValues(key, pragmas[key])).reduce((arr, next) => arr.concat(next), []).map(keyValue => start + ' ' + keyValue + line).join('');
17713
17714       if (!comments) {
17715         if (keys.length === 0) {
17716           return '';
17717         }
17718
17719         if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
17720           const value = pragmas[keys[0]];
17721           return "".concat(head, " ").concat(printKeyValues(keys[0], value)[0]).concat(tail);
17722         }
17723       }
17724
17725       const printedComments = comments.split(line).map(textLine => "".concat(start, " ").concat(textLine)).join(line) + line;
17726       return head + line + (comments ? printedComments : '') + (comments && keys.length ? start + line : '') + printedObject + tail;
17727     }
17728
17729     function printKeyValues(key, valueOrArray) {
17730       return [].concat(valueOrArray).map(value => "@".concat(key, " ").concat(value).trim());
17731     }
17732   });
17733   unwrapExports(build);
17734   var build_1 = build.extract;
17735   var build_2 = build.strip;
17736   var build_3 = build.parse;
17737   var build_4 = build.parseWithComments;
17738   var build_5 = build.print;
17739
17740   function hasPragma(text) {
17741     const pragmas = Object.keys(build.parse(build.extract(text)));
17742     return pragmas.includes("prettier") || pragmas.includes("format");
17743   }
17744
17745   function insertPragma(text) {
17746     const parsedDocblock = build.parseWithComments(build.extract(text));
17747     const pragmas = Object.assign({
17748       format: ""
17749     }, parsedDocblock.pragmas);
17750     const newDocblock = build.print({
17751       pragmas,
17752       comments: parsedDocblock.comments.replace(/^(\s+?\r?\n)+/, "") // remove leading newlines
17753
17754     }).replace(/(\r\n|\r)/g, "\n"); // normalise newlines (mitigate use of os.EOL by jest-docblock)
17755
17756     const strippedText = build.strip(text);
17757     const separatingNewlines = strippedText.startsWith("\n") ? "\n" : "\n\n";
17758     return newDocblock + separatingNewlines + strippedText;
17759   }
17760
17761   var pragma = {
17762     hasPragma,
17763     insertPragma
17764   };
17765
17766   const DELIMITER_MAP = {
17767     "---": "yaml",
17768     "+++": "toml"
17769   };
17770
17771   function parse$1(text) {
17772     const delimiterRegex = Object.keys(DELIMITER_MAP).map(escapeStringRegexp$2).join("|");
17773     const match = text.match( // trailing spaces after delimiters are allowed
17774     new RegExp("^(".concat(delimiterRegex, ")[^\\n\\S]*\\n(?:([\\s\\S]*?)\\n)?\\1[^\\n\\S]*(\\n|$)")));
17775
17776     if (match === null) {
17777       return {
17778         frontMatter: null,
17779         content: text
17780       };
17781     }
17782
17783     const [raw, delimiter, value] = match;
17784     return {
17785       frontMatter: {
17786         type: DELIMITER_MAP[delimiter],
17787         value,
17788         raw: raw.replace(/\n$/, "")
17789       },
17790       content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length)
17791     };
17792   }
17793
17794   var frontMatter = parse$1;
17795
17796   function hasPragma$1(text) {
17797     return pragma.hasPragma(frontMatter(text).content);
17798   }
17799
17800   function insertPragma$1(text) {
17801     const {
17802       frontMatter: frontMatter$1,
17803       content
17804     } = frontMatter(text);
17805     return (frontMatter$1 ? frontMatter$1.raw + "\n\n" : "") + pragma.insertPragma(content);
17806   }
17807
17808   var pragma$1 = {
17809     hasPragma: hasPragma$1,
17810     insertPragma: insertPragma$1
17811   };
17812
17813   var lineColumnToIndex = function lineColumnToIndex(lineColumn, text) {
17814     let index = 0;
17815
17816     for (let i = 0; i < lineColumn.line - 1; ++i) {
17817       index = text.indexOf("\n", index) + 1;
17818
17819       if (index === -1) {
17820         return -1;
17821       }
17822     }
17823
17824     return index + lineColumn.column;
17825   };
17826
17827   const {
17828     getLast: getLast$1,
17829     skipEverythingButNewLine: skipEverythingButNewLine$2
17830   } = util$1;
17831
17832   function calculateLocStart(node, text) {
17833     if (node.source) {
17834       return lineColumnToIndex(node.source.start, text) - 1;
17835     }
17836
17837     return null;
17838   }
17839
17840   function calculateLocEnd(node, text) {
17841     if (node.type === "css-comment" && node.inline) {
17842       return skipEverythingButNewLine$2(text, node.source.startOffset);
17843     }
17844
17845     const endNode = node.nodes && getLast$1(node.nodes);
17846
17847     if (endNode && node.source && !node.source.end) {
17848       node = endNode;
17849     }
17850
17851     if (node.source && node.source.end) {
17852       return lineColumnToIndex(node.source.end, text);
17853     }
17854
17855     return null;
17856   }
17857
17858   function calculateLoc(node, text) {
17859     if (node && typeof node === "object") {
17860       if (node.source) {
17861         node.source.startOffset = calculateLocStart(node, text);
17862         node.source.endOffset = calculateLocEnd(node, text);
17863       }
17864
17865       for (const key in node) {
17866         calculateLoc(node[key], text);
17867       }
17868     }
17869   }
17870   /**
17871    * Workaround for a bug: quotes in inline comments corrupt loc data of subsequent nodes.
17872    * This function replaces the quotes with U+FFFE and U+FFFF. Later, when the comments are printed,
17873    * their content is extracted from the original text or restored by replacing the placeholder
17874    * characters back with quotes.
17875    * - https://github.com/prettier/prettier/issues/7780
17876    * - https://github.com/shellscape/postcss-less/issues/145
17877    * - About noncharacters (U+FFFE and U+FFFF): http://www.unicode.org/faq/private_use.html#nonchar1
17878    * @param text {string}
17879    */
17880
17881
17882   function replaceQuotesInInlineComments(text) {
17883     /** @typedef { 'initial' | 'single-quotes' | 'double-quotes' | 'url' | 'comment-block' | 'comment-inline' } State */
17884
17885     /** @type {State} */
17886     let state = "initial";
17887     /** @type {State} */
17888
17889     let stateToReturnFromQuotes = "initial";
17890     let inlineCommentStartIndex;
17891     let inlineCommentContainsQuotes = false;
17892     const inlineCommentsToReplace = [];
17893
17894     for (let i = 0; i < text.length; i++) {
17895       const c = text[i];
17896
17897       switch (state) {
17898         case "initial":
17899           if (c === "'") {
17900             state = "single-quotes";
17901             continue;
17902           }
17903
17904           if (c === '"') {
17905             state = "double-quotes";
17906             continue;
17907           }
17908
17909           if ((c === "u" || c === "U") && text.slice(i, i + 4).toLowerCase() === "url(") {
17910             state = "url";
17911             i += 3;
17912             continue;
17913           }
17914
17915           if (c === "*" && text[i - 1] === "/") {
17916             state = "comment-block";
17917             continue;
17918           }
17919
17920           if (c === "/" && text[i - 1] === "/") {
17921             state = "comment-inline";
17922             inlineCommentStartIndex = i - 1;
17923             continue;
17924           }
17925
17926           continue;
17927
17928         case "single-quotes":
17929           if (c === "'" && text[i - 1] !== "\\") {
17930             state = stateToReturnFromQuotes;
17931             stateToReturnFromQuotes = "initial";
17932           }
17933
17934           if (c === "\n" || c === "\r") {
17935             return text; // invalid input
17936           }
17937
17938           continue;
17939
17940         case "double-quotes":
17941           if (c === '"' && text[i - 1] !== "\\") {
17942             state = stateToReturnFromQuotes;
17943             stateToReturnFromQuotes = "initial";
17944           }
17945
17946           if (c === "\n" || c === "\r") {
17947             return text; // invalid input
17948           }
17949
17950           continue;
17951
17952         case "url":
17953           if (c === ")") {
17954             state = "initial";
17955           }
17956
17957           if (c === "\n" || c === "\r") {
17958             return text; // invalid input
17959           }
17960
17961           if (c === "'") {
17962             state = "single-quotes";
17963             stateToReturnFromQuotes = "url";
17964             continue;
17965           }
17966
17967           if (c === '"') {
17968             state = "double-quotes";
17969             stateToReturnFromQuotes = "url";
17970             continue;
17971           }
17972
17973           continue;
17974
17975         case "comment-block":
17976           if (c === "/" && text[i - 1] === "*") {
17977             state = "initial";
17978           }
17979
17980           continue;
17981
17982         case "comment-inline":
17983           if (c === '"' || c === "'") {
17984             inlineCommentContainsQuotes = true;
17985           }
17986
17987           if (c === "\n" || c === "\r") {
17988             if (inlineCommentContainsQuotes) {
17989               inlineCommentsToReplace.push([inlineCommentStartIndex, i]);
17990             }
17991
17992             state = "initial";
17993             inlineCommentContainsQuotes = false;
17994           }
17995
17996           continue;
17997       }
17998     }
17999
18000     for (const [start, end] of inlineCommentsToReplace) {
18001       text = text.slice(0, start) + text.slice(start, end).replace(/'/g, "\ufffe").replace(/"/g, "\uffff") + text.slice(end);
18002     }
18003
18004     return text;
18005   }
18006
18007   function restoreQuotesInInlineComments(text) {
18008     return text.replace(/\ufffe/g, "'").replace(/\uffff/g, '"');
18009   }
18010
18011   var loc$1 = {
18012     calculateLoc,
18013     replaceQuotesInInlineComments,
18014     restoreQuotesInInlineComments
18015   };
18016
18017   const colorAdjusterFunctions = ["red", "green", "blue", "alpha", "a", "rgb", "hue", "h", "saturation", "s", "lightness", "l", "whiteness", "w", "blackness", "b", "tint", "shade", "blend", "blenda", "contrast", "hsl", "hsla", "hwb", "hwba"];
18018
18019   function getAncestorCounter(path, typeOrTypes) {
18020     const types = [].concat(typeOrTypes);
18021     let counter = -1;
18022     let ancestorNode;
18023
18024     while (ancestorNode = path.getParentNode(++counter)) {
18025       if (types.includes(ancestorNode.type)) {
18026         return counter;
18027       }
18028     }
18029
18030     return -1;
18031   }
18032
18033   function getAncestorNode(path, typeOrTypes) {
18034     const counter = getAncestorCounter(path, typeOrTypes);
18035     return counter === -1 ? null : path.getParentNode(counter);
18036   }
18037
18038   function getPropOfDeclNode(path) {
18039     const declAncestorNode = getAncestorNode(path, "css-decl");
18040     return declAncestorNode && declAncestorNode.prop && declAncestorNode.prop.toLowerCase();
18041   }
18042
18043   function isSCSS(parser, text) {
18044     const hasExplicitParserChoice = parser === "less" || parser === "scss";
18045     const IS_POSSIBLY_SCSS = /(\w\s*:\s*[^}:]+|#){|@import[^\n]+(?:url|,)/;
18046     return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
18047   }
18048
18049   function isWideKeywords(value) {
18050     return ["initial", "inherit", "unset", "revert"].includes(value.toLowerCase());
18051   }
18052
18053   function isKeyframeAtRuleKeywords(path, value) {
18054     const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
18055     return atRuleAncestorNode && atRuleAncestorNode.name && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].includes(value.toLowerCase());
18056   }
18057
18058   function maybeToLowerCase(value) {
18059     return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
18060   }
18061
18062   function insideValueFunctionNode(path, functionName) {
18063     const funcAncestorNode = getAncestorNode(path, "value-func");
18064     return funcAncestorNode && funcAncestorNode.value && funcAncestorNode.value.toLowerCase() === functionName;
18065   }
18066
18067   function insideICSSRuleNode(path) {
18068     const ruleAncestorNode = getAncestorNode(path, "css-rule");
18069     return ruleAncestorNode && ruleAncestorNode.raws && ruleAncestorNode.raws.selector && (ruleAncestorNode.raws.selector.startsWith(":import") || ruleAncestorNode.raws.selector.startsWith(":export"));
18070   }
18071
18072   function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
18073     const atRuleNames = [].concat(atRuleNameOrAtRuleNames);
18074     const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
18075     return atRuleAncestorNode && atRuleNames.includes(atRuleAncestorNode.name.toLowerCase());
18076   }
18077
18078   function insideURLFunctionInImportAtRuleNode(path) {
18079     const node = path.getValue();
18080     const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
18081     return atRuleAncestorNode && atRuleAncestorNode.name === "import" && node.groups[0].value === "url" && node.groups.length === 2;
18082   }
18083
18084   function isURLFunctionNode(node) {
18085     return node.type === "value-func" && node.value.toLowerCase() === "url";
18086   }
18087
18088   function isLastNode(path, node) {
18089     const parentNode = path.getParentNode();
18090
18091     if (!parentNode) {
18092       return false;
18093     }
18094
18095     const {
18096       nodes
18097     } = parentNode;
18098     return nodes && nodes.indexOf(node) === nodes.length - 1;
18099   }
18100
18101   function isDetachedRulesetDeclarationNode(node) {
18102     // If a Less file ends up being parsed with the SCSS parser, Less
18103     // variable declarations will be parsed as atrules with names ending
18104     // with a colon, so keep the original case then.
18105     if (!node.selector) {
18106       return false;
18107     }
18108
18109     return typeof node.selector === "string" && /^@.+:.*$/.test(node.selector) || node.selector.value && /^@.+:.*$/.test(node.selector.value);
18110   }
18111
18112   function isForKeywordNode(node) {
18113     return node.type === "value-word" && ["from", "through", "end"].includes(node.value);
18114   }
18115
18116   function isIfElseKeywordNode(node) {
18117     return node.type === "value-word" && ["and", "or", "not"].includes(node.value);
18118   }
18119
18120   function isEachKeywordNode(node) {
18121     return node.type === "value-word" && node.value === "in";
18122   }
18123
18124   function isMultiplicationNode(node) {
18125     return node.type === "value-operator" && node.value === "*";
18126   }
18127
18128   function isDivisionNode(node) {
18129     return node.type === "value-operator" && node.value === "/";
18130   }
18131
18132   function isAdditionNode(node) {
18133     return node.type === "value-operator" && node.value === "+";
18134   }
18135
18136   function isSubtractionNode(node) {
18137     return node.type === "value-operator" && node.value === "-";
18138   }
18139
18140   function isModuloNode(node) {
18141     return node.type === "value-operator" && node.value === "%";
18142   }
18143
18144   function isMathOperatorNode(node) {
18145     return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node);
18146   }
18147
18148   function isEqualityOperatorNode(node) {
18149     return node.type === "value-word" && ["==", "!="].includes(node.value);
18150   }
18151
18152   function isRelationalOperatorNode(node) {
18153     return node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value);
18154   }
18155
18156   function isSCSSControlDirectiveNode(node) {
18157     return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].includes(node.name);
18158   }
18159
18160   function isSCSSNestedPropertyNode(node) {
18161     if (!node.selector) {
18162       return false;
18163     }
18164
18165     return node.selector.replace(/\/\*.*?\*\//, "").replace(/\/\/.*?\n/, "").trim().endsWith(":");
18166   }
18167
18168   function isDetachedRulesetCallNode(node) {
18169     return node.raws && node.raws.params && /^\(\s*\)$/.test(node.raws.params);
18170   }
18171
18172   function isTemplatePlaceholderNode(node) {
18173     return node.name.startsWith("prettier-placeholder");
18174   }
18175
18176   function isTemplatePropNode(node) {
18177     return node.prop.startsWith("@prettier-placeholder");
18178   }
18179
18180   function isPostcssSimpleVarNode(currentNode, nextNode) {
18181     return currentNode.value === "$$" && currentNode.type === "value-func" && nextNode && nextNode.type === "value-word" && !nextNode.raws.before;
18182   }
18183
18184   function hasComposesNode(node) {
18185     return node.value && node.value.type === "value-root" && node.value.group && node.value.group.type === "value-value" && node.prop.toLowerCase() === "composes";
18186   }
18187
18188   function hasParensAroundNode(node) {
18189     return node.value && node.value.group && node.value.group.group && node.value.group.group.type === "value-paren_group" && node.value.group.group.open !== null && node.value.group.group.close !== null;
18190   }
18191
18192   function hasEmptyRawBefore(node) {
18193     return node.raws && node.raws.before === "";
18194   }
18195
18196   function isKeyValuePairNode(node) {
18197     return node.type === "value-comma_group" && node.groups && node.groups[1] && node.groups[1].type === "value-colon";
18198   }
18199
18200   function isKeyValuePairInParenGroupNode(node) {
18201     return node.type === "value-paren_group" && node.groups && node.groups[0] && isKeyValuePairNode(node.groups[0]);
18202   }
18203
18204   function isSCSSMapItemNode(path) {
18205     const node = path.getValue(); // Ignore empty item (i.e. `$key: ()`)
18206
18207     if (node.groups.length === 0) {
18208       return false;
18209     }
18210
18211     const parentParentNode = path.getParentNode(1); // Check open parens contain key/value pair (i.e. `(key: value)` and `(key: (value, other-value)`)
18212
18213     if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
18214       return false;
18215     }
18216
18217     const declNode = getAncestorNode(path, "css-decl"); // SCSS map declaration (i.e. `$map: (key: value, other-key: other-value)`)
18218
18219     if (declNode && declNode.prop && declNode.prop.startsWith("$")) {
18220       return true;
18221     } // List as value of key inside SCSS map (i.e. `$map: (key: (value other-value other-other-value))`)
18222
18223
18224     if (isKeyValuePairInParenGroupNode(parentParentNode)) {
18225       return true;
18226     } // SCSS Map is argument of function (i.e. `func((key: value, other-key: other-value))`)
18227
18228
18229     if (parentParentNode.type === "value-func") {
18230       return true;
18231     }
18232
18233     return false;
18234   }
18235
18236   function isInlineValueCommentNode(node) {
18237     return node.type === "value-comment" && node.inline;
18238   }
18239
18240   function isHashNode(node) {
18241     return node.type === "value-word" && node.value === "#";
18242   }
18243
18244   function isLeftCurlyBraceNode(node) {
18245     return node.type === "value-word" && node.value === "{";
18246   }
18247
18248   function isRightCurlyBraceNode(node) {
18249     return node.type === "value-word" && node.value === "}";
18250   }
18251
18252   function isWordNode(node) {
18253     return ["value-word", "value-atword"].includes(node.type);
18254   }
18255
18256   function isColonNode(node) {
18257     return node.type === "value-colon";
18258   }
18259
18260   function isMediaAndSupportsKeywords(node) {
18261     return node.value && ["not", "and", "or"].includes(node.value.toLowerCase());
18262   }
18263
18264   function isColorAdjusterFuncNode(node) {
18265     if (node.type !== "value-func") {
18266       return false;
18267     }
18268
18269     return colorAdjusterFunctions.includes(node.value.toLowerCase());
18270   } // TODO: only check `less` when we don't use `less` to parse `css`
18271
18272
18273   function isLessParser(options) {
18274     return options.parser === "css" || options.parser === "less";
18275   }
18276
18277   function lastLineHasInlineComment(text) {
18278     return /\/\//.test(text.split(/[\r\n]/).pop());
18279   }
18280
18281   var utils$2 = {
18282     getAncestorCounter,
18283     getAncestorNode,
18284     getPropOfDeclNode,
18285     maybeToLowerCase,
18286     insideValueFunctionNode,
18287     insideICSSRuleNode,
18288     insideAtRuleNode,
18289     insideURLFunctionInImportAtRuleNode,
18290     isKeyframeAtRuleKeywords,
18291     isWideKeywords,
18292     isSCSS,
18293     isLastNode,
18294     isLessParser,
18295     isSCSSControlDirectiveNode,
18296     isDetachedRulesetDeclarationNode,
18297     isRelationalOperatorNode,
18298     isEqualityOperatorNode,
18299     isMultiplicationNode,
18300     isDivisionNode,
18301     isAdditionNode,
18302     isSubtractionNode,
18303     isModuloNode,
18304     isMathOperatorNode,
18305     isEachKeywordNode,
18306     isForKeywordNode,
18307     isURLFunctionNode,
18308     isIfElseKeywordNode,
18309     hasComposesNode,
18310     hasParensAroundNode,
18311     hasEmptyRawBefore,
18312     isSCSSNestedPropertyNode,
18313     isDetachedRulesetCallNode,
18314     isTemplatePlaceholderNode,
18315     isTemplatePropNode,
18316     isPostcssSimpleVarNode,
18317     isKeyValuePairNode,
18318     isKeyValuePairInParenGroupNode,
18319     isSCSSMapItemNode,
18320     isInlineValueCommentNode,
18321     isHashNode,
18322     isLeftCurlyBraceNode,
18323     isRightCurlyBraceNode,
18324     isWordNode,
18325     isColonNode,
18326     isMediaAndSupportsKeywords,
18327     isColorAdjusterFuncNode,
18328     lastLineHasInlineComment
18329   };
18330
18331   const {
18332     insertPragma: insertPragma$2
18333   } = pragma$1;
18334   const {
18335     printNumber: printNumber$1,
18336     printString: printString$1,
18337     hasIgnoreComment: hasIgnoreComment$1,
18338     hasNewline: hasNewline$3
18339   } = util$1;
18340   const {
18341     isNextLineEmpty: isNextLineEmpty$2
18342   } = utilShared;
18343   const {
18344     restoreQuotesInInlineComments: restoreQuotesInInlineComments$1
18345   } = loc$1;
18346   const {
18347     builders: {
18348       concat: concat$5,
18349       join: join$2,
18350       line: line$2,
18351       hardline: hardline$4,
18352       softline: softline$1,
18353       group: group$1,
18354       fill: fill$2,
18355       indent: indent$2,
18356       dedent: dedent$1,
18357       ifBreak: ifBreak$1
18358     },
18359     utils: {
18360       removeLines: removeLines$1
18361     }
18362   } = document;
18363   const {
18364     getAncestorNode: getAncestorNode$1,
18365     getPropOfDeclNode: getPropOfDeclNode$1,
18366     maybeToLowerCase: maybeToLowerCase$1,
18367     insideValueFunctionNode: insideValueFunctionNode$1,
18368     insideICSSRuleNode: insideICSSRuleNode$1,
18369     insideAtRuleNode: insideAtRuleNode$1,
18370     insideURLFunctionInImportAtRuleNode: insideURLFunctionInImportAtRuleNode$1,
18371     isKeyframeAtRuleKeywords: isKeyframeAtRuleKeywords$1,
18372     isWideKeywords: isWideKeywords$1,
18373     isSCSS: isSCSS$1,
18374     isLastNode: isLastNode$1,
18375     isLessParser: isLessParser$1,
18376     isSCSSControlDirectiveNode: isSCSSControlDirectiveNode$1,
18377     isDetachedRulesetDeclarationNode: isDetachedRulesetDeclarationNode$1,
18378     isRelationalOperatorNode: isRelationalOperatorNode$1,
18379     isEqualityOperatorNode: isEqualityOperatorNode$1,
18380     isMultiplicationNode: isMultiplicationNode$1,
18381     isDivisionNode: isDivisionNode$1,
18382     isAdditionNode: isAdditionNode$1,
18383     isSubtractionNode: isSubtractionNode$1,
18384     isMathOperatorNode: isMathOperatorNode$1,
18385     isEachKeywordNode: isEachKeywordNode$1,
18386     isForKeywordNode: isForKeywordNode$1,
18387     isURLFunctionNode: isURLFunctionNode$1,
18388     isIfElseKeywordNode: isIfElseKeywordNode$1,
18389     hasComposesNode: hasComposesNode$1,
18390     hasParensAroundNode: hasParensAroundNode$1,
18391     hasEmptyRawBefore: hasEmptyRawBefore$1,
18392     isKeyValuePairNode: isKeyValuePairNode$1,
18393     isDetachedRulesetCallNode: isDetachedRulesetCallNode$1,
18394     isTemplatePlaceholderNode: isTemplatePlaceholderNode$1,
18395     isTemplatePropNode: isTemplatePropNode$1,
18396     isPostcssSimpleVarNode: isPostcssSimpleVarNode$1,
18397     isSCSSMapItemNode: isSCSSMapItemNode$1,
18398     isInlineValueCommentNode: isInlineValueCommentNode$1,
18399     isHashNode: isHashNode$1,
18400     isLeftCurlyBraceNode: isLeftCurlyBraceNode$1,
18401     isRightCurlyBraceNode: isRightCurlyBraceNode$1,
18402     isWordNode: isWordNode$1,
18403     isColonNode: isColonNode$1,
18404     isMediaAndSupportsKeywords: isMediaAndSupportsKeywords$1,
18405     isColorAdjusterFuncNode: isColorAdjusterFuncNode$1,
18406     lastLineHasInlineComment: lastLineHasInlineComment$1
18407   } = utils$2;
18408
18409   function shouldPrintComma(options) {
18410     switch (options.trailingComma) {
18411       case "all":
18412       case "es5":
18413         return true;
18414
18415       case "none":
18416       default:
18417         return false;
18418     }
18419   }
18420
18421   function genericPrint(path, options, print) {
18422     const node = path.getValue();
18423     /* istanbul ignore if */
18424
18425     if (!node) {
18426       return "";
18427     }
18428
18429     if (typeof node === "string") {
18430       return node;
18431     }
18432
18433     switch (node.type) {
18434       case "yaml":
18435       case "toml":
18436         return concat$5([node.raw, hardline$4]);
18437
18438       case "css-root":
18439         {
18440           const nodes = printNodeSequence(path, options, print);
18441
18442           if (nodes.parts.length) {
18443             return concat$5([nodes, options.__isHTMLStyleAttribute ? "" : hardline$4]);
18444           }
18445
18446           return nodes;
18447         }
18448
18449       case "css-comment":
18450         {
18451           const isInlineComment = node.inline || node.raws.inline;
18452           const text = options.originalText.slice(options.locStart(node), options.locEnd(node));
18453           return isInlineComment ? text.trimEnd() : text;
18454         }
18455
18456       case "css-rule":
18457         {
18458           return concat$5([path.call(print, "selector"), node.important ? " !important" : "", node.nodes ? concat$5([node.selector && node.selector.type === "selector-unknown" && lastLineHasInlineComment$1(node.selector.value) ? line$2 : " ", "{", node.nodes.length > 0 ? indent$2(concat$5([hardline$4, printNodeSequence(path, options, print)])) : "", hardline$4, "}", isDetachedRulesetDeclarationNode$1(node) ? ";" : ""]) : ";"]);
18459         }
18460
18461       case "css-decl":
18462         {
18463           const parentNode = path.getParentNode();
18464           return concat$5([node.raws.before.replace(/[\s;]/g, ""), insideICSSRuleNode$1(path) ? node.prop : maybeToLowerCase$1(node.prop), node.raws.between.trim() === ":" ? ":" : node.raws.between.trim(), node.extend ? "" : " ", hasComposesNode$1(node) ? removeLines$1(path.call(print, "value")) : path.call(print, "value"), node.raws.important ? node.raws.important.replace(/\s*!\s*important/i, " !important") : node.important ? " !important" : "", node.raws.scssDefault ? node.raws.scssDefault.replace(/\s*!default/i, " !default") : node.scssDefault ? " !default" : "", node.raws.scssGlobal ? node.raws.scssGlobal.replace(/\s*!global/i, " !global") : node.scssGlobal ? " !global" : "", node.nodes ? concat$5([" {", indent$2(concat$5([softline$1, printNodeSequence(path, options, print)])), softline$1, "}"]) : isTemplatePropNode$1(node) && !parentNode.raws.semicolon && options.originalText[options.locEnd(node) - 1] !== ";" ? "" : ";"]);
18465         }
18466
18467       case "css-atrule":
18468         {
18469           const parentNode = path.getParentNode();
18470           const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode$1(node) && !parentNode.raws.semicolon && options.originalText[options.locEnd(node) - 1] !== ";";
18471
18472           if (isLessParser$1(options)) {
18473             if (node.mixin) {
18474               return concat$5([path.call(print, "selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
18475             }
18476
18477             if (node.function) {
18478               return concat$5([node.name, concat$5([path.call(print, "params")]), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
18479             }
18480
18481             if (node.variable) {
18482               return concat$5(["@", node.name, ": ", node.value ? concat$5([path.call(print, "value")]) : "", node.raws.between.trim() ? node.raws.between.trim() + " " : "", node.nodes ? concat$5(["{", indent$2(concat$5([node.nodes.length > 0 ? softline$1 : "", printNodeSequence(path, options, print)])), softline$1, "}"]) : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
18483             }
18484           }
18485
18486           return concat$5(["@", // If a Less file ends up being parsed with the SCSS parser, Less
18487           // variable declarations will be parsed as at-rules with names ending
18488           // with a colon, so keep the original case then.
18489           isDetachedRulesetCallNode$1(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase$1(node.name), node.params ? concat$5([isDetachedRulesetCallNode$1(node) ? "" : isTemplatePlaceholderNode$1(node) ? node.raws.afterName === "" ? "" : node.name.endsWith(":") ? " " : /^\s*\n\s*\n/.test(node.raws.afterName) ? concat$5([hardline$4, hardline$4]) : /^\s*\n/.test(node.raws.afterName) ? hardline$4 : " " : " ", path.call(print, "params")]) : "", node.selector ? indent$2(concat$5([" ", path.call(print, "selector")])) : "", node.value ? group$1(concat$5([" ", path.call(print, "value"), isSCSSControlDirectiveNode$1(node) ? hasParensAroundNode$1(node) ? " " : line$2 : ""])) : node.name === "else" ? " " : "", node.nodes ? concat$5([isSCSSControlDirectiveNode$1(node) ? "" : " ", "{", indent$2(concat$5([node.nodes.length > 0 ? softline$1 : "", printNodeSequence(path, options, print)])), softline$1, "}"]) : isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
18490         }
18491       // postcss-media-query-parser
18492
18493       case "media-query-list":
18494         {
18495           const parts = [];
18496           path.each(childPath => {
18497             const node = childPath.getValue();
18498
18499             if (node.type === "media-query" && node.value === "") {
18500               return;
18501             }
18502
18503             parts.push(childPath.call(print));
18504           }, "nodes");
18505           return group$1(indent$2(join$2(line$2, parts)));
18506         }
18507
18508       case "media-query":
18509         {
18510           return concat$5([join$2(" ", path.map(print, "nodes")), isLastNode$1(path, node) ? "" : ","]);
18511         }
18512
18513       case "media-type":
18514         {
18515           return adjustNumbers(adjustStrings(node.value, options));
18516         }
18517
18518       case "media-feature-expression":
18519         {
18520           if (!node.nodes) {
18521             return node.value;
18522           }
18523
18524           return concat$5(["(", concat$5(path.map(print, "nodes")), ")"]);
18525         }
18526
18527       case "media-feature":
18528         {
18529           return maybeToLowerCase$1(adjustStrings(node.value.replace(/ +/g, " "), options));
18530         }
18531
18532       case "media-colon":
18533         {
18534           return concat$5([node.value, " "]);
18535         }
18536
18537       case "media-value":
18538         {
18539           return adjustNumbers(adjustStrings(node.value, options));
18540         }
18541
18542       case "media-keyword":
18543         {
18544           return adjustStrings(node.value, options);
18545         }
18546
18547       case "media-url":
18548         {
18549           return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/gi, ")"), options);
18550         }
18551
18552       case "media-unknown":
18553         {
18554           return node.value;
18555         }
18556       // postcss-selector-parser
18557
18558       case "selector-root":
18559         {
18560           return group$1(concat$5([insideAtRuleNode$1(path, "custom-selector") ? concat$5([getAncestorNode$1(path, "css-atrule").customSelector, line$2]) : "", join$2(concat$5([",", insideAtRuleNode$1(path, ["extend", "custom-selector", "nest"]) ? line$2 : hardline$4]), path.map(print, "nodes"))]));
18561         }
18562
18563       case "selector-selector":
18564         {
18565           return group$1(indent$2(concat$5(path.map(print, "nodes"))));
18566         }
18567
18568       case "selector-comment":
18569         {
18570           return node.value;
18571         }
18572
18573       case "selector-string":
18574         {
18575           return adjustStrings(node.value, options);
18576         }
18577
18578       case "selector-tag":
18579         {
18580           const parentNode = path.getParentNode();
18581           const index = parentNode && parentNode.nodes.indexOf(node);
18582           const prevNode = index && parentNode.nodes[index - 1];
18583           return concat$5([node.namespace ? concat$5([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", prevNode.type === "selector-nesting" ? node.value : adjustNumbers(isKeyframeAtRuleKeywords$1(path, node.value) ? node.value.toLowerCase() : node.value)]);
18584         }
18585
18586       case "selector-id":
18587         {
18588           return concat$5(["#", node.value]);
18589         }
18590
18591       case "selector-class":
18592         {
18593           return concat$5([".", adjustNumbers(adjustStrings(node.value, options))]);
18594         }
18595
18596       case "selector-attribute":
18597         {
18598           return concat$5(["[", node.namespace ? concat$5([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.attribute.trim(), node.operator ? node.operator : "", node.value ? quoteAttributeValue(adjustStrings(node.value.trim(), options), options) : "", node.insensitive ? " i" : "", "]"]);
18599         }
18600
18601       case "selector-combinator":
18602         {
18603           if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
18604             const parentNode = path.getParentNode();
18605             const leading = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line$2;
18606             return concat$5([leading, node.value, isLastNode$1(path, node) ? "" : " "]);
18607           }
18608
18609           const leading = node.value.trim().startsWith("(") ? line$2 : "";
18610           const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line$2;
18611           return concat$5([leading, value]);
18612         }
18613
18614       case "selector-universal":
18615         {
18616           return concat$5([node.namespace ? concat$5([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.value]);
18617         }
18618
18619       case "selector-pseudo":
18620         {
18621           return concat$5([maybeToLowerCase$1(node.value), node.nodes && node.nodes.length > 0 ? concat$5(["(", join$2(", ", path.map(print, "nodes")), ")"]) : ""]);
18622         }
18623
18624       case "selector-nesting":
18625         {
18626           return node.value;
18627         }
18628
18629       case "selector-unknown":
18630         {
18631           const ruleAncestorNode = getAncestorNode$1(path, "css-rule"); // Nested SCSS property
18632
18633           if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) {
18634             return adjustNumbers(adjustStrings(maybeToLowerCase$1(node.value), options));
18635           } // originalText has to be used for Less, see replaceQuotesInInlineComments in loc.js
18636
18637
18638           const parentNode = path.getParentNode();
18639
18640           if (parentNode.raws && parentNode.raws.selector) {
18641             const start = options.locStart(parentNode);
18642             const end = start + parentNode.raws.selector.length;
18643             return options.originalText.slice(start, end).trim();
18644           }
18645
18646           return node.value;
18647         }
18648       // postcss-values-parser
18649
18650       case "value-value":
18651       case "value-root":
18652         {
18653           return path.call(print, "group");
18654         }
18655
18656       case "value-comment":
18657         {
18658           return concat$5([node.inline ? "//" : "/*", // see replaceQuotesInInlineComments in loc.js
18659           // value-* nodes don't have correct location data, so we have to rely on placeholder characters.
18660           restoreQuotesInInlineComments$1(node.value), node.inline ? "" : "*/"]);
18661         }
18662
18663       case "value-comma_group":
18664         {
18665           const parentNode = path.getParentNode();
18666           const parentParentNode = path.getParentNode(1);
18667           const declAncestorProp = getPropOfDeclNode$1(path);
18668           const isGridValue = declAncestorProp && parentNode.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template"));
18669           const atRuleAncestorNode = getAncestorNode$1(path, "css-atrule");
18670           const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode$1(atRuleAncestorNode);
18671           const printed = path.map(print, "groups");
18672           const parts = [];
18673           const insideURLFunction = insideValueFunctionNode$1(path, "url");
18674           let insideSCSSInterpolationInString = false;
18675           let didBreak = false;
18676
18677           for (let i = 0; i < node.groups.length; ++i) {
18678             parts.push(printed[i]);
18679             const iPrevNode = node.groups[i - 1];
18680             const iNode = node.groups[i];
18681             const iNextNode = node.groups[i + 1];
18682             const iNextNextNode = node.groups[i + 2];
18683
18684             if (insideURLFunction) {
18685               if (iNextNode && isAdditionNode$1(iNextNode) || isAdditionNode$1(iNode)) {
18686                 parts.push(" ");
18687               }
18688
18689               continue;
18690             } // Ignore after latest node (i.e. before semicolon)
18691
18692
18693             if (!iNextNode) {
18694               continue;
18695             } // styled.div` background: var(--${one}); `
18696
18697
18698             if (!iPrevNode && iNode.value === "--" && iNextNode.type === "value-atword") {
18699               continue;
18700             } // Ignore spaces before/after string interpolation (i.e. `"#{my-fn("_")}"`)
18701
18702
18703             const isStartSCSSInterpolationInString = iNode.type === "value-string" && iNode.value.startsWith("#{");
18704             const isEndingSCSSInterpolationInString = insideSCSSInterpolationInString && iNextNode.type === "value-string" && iNextNode.value.endsWith("}");
18705
18706             if (isStartSCSSInterpolationInString || isEndingSCSSInterpolationInString) {
18707               insideSCSSInterpolationInString = !insideSCSSInterpolationInString;
18708               continue;
18709             }
18710
18711             if (insideSCSSInterpolationInString) {
18712               continue;
18713             } // Ignore colon (i.e. `:`)
18714
18715
18716             if (isColonNode$1(iNode) || isColonNode$1(iNextNode)) {
18717               continue;
18718             } // Ignore `@` in Less (i.e. `@@var;`)
18719
18720
18721             if (iNode.type === "value-atword" && iNode.value === "") {
18722               continue;
18723             } // Ignore `~` in Less (i.e. `content: ~"^//* some horrible but needed css hack";`)
18724
18725
18726             if (iNode.value === "~") {
18727               continue;
18728             } // Ignore escape `\`
18729
18730
18731             if (iNode.value && iNode.value.includes("\\") && iNextNode && iNextNode.type !== "value-comment") {
18732               continue;
18733             } // Ignore escaped `/`
18734
18735
18736             if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") {
18737               continue;
18738             } // Ignore `\` (i.e. `$variable: \@small;`)
18739
18740
18741             if (iNode.value === "\\") {
18742               continue;
18743             } // Ignore `$$` (i.e. `background-color: $$(style)Color;`)
18744
18745
18746             if (isPostcssSimpleVarNode$1(iNode, iNextNode)) {
18747               continue;
18748             } // Ignore spaces after `#` and after `{` and before `}` in SCSS interpolation (i.e. `#{variable}`)
18749
18750
18751             if (isHashNode$1(iNode) || isLeftCurlyBraceNode$1(iNode) || isRightCurlyBraceNode$1(iNextNode) || isLeftCurlyBraceNode$1(iNextNode) && hasEmptyRawBefore$1(iNextNode) || isRightCurlyBraceNode$1(iNode) && hasEmptyRawBefore$1(iNextNode)) {
18752               continue;
18753             } // Ignore css variables and interpolation in SCSS (i.e. `--#{$var}`)
18754
18755
18756             if (iNode.value === "--" && isHashNode$1(iNextNode)) {
18757               continue;
18758             } // Formatting math operations
18759
18760
18761             const isMathOperator = isMathOperatorNode$1(iNode);
18762             const isNextMathOperator = isMathOperatorNode$1(iNextNode); // Print spaces before and after math operators beside SCSS interpolation as is
18763             // (i.e. `#{$var}+5`, `#{$var} +5`, `#{$var}+ 5`, `#{$var} + 5`)
18764             // (i.e. `5+#{$var}`, `5 +#{$var}`, `5+ #{$var}`, `5 + #{$var}`)
18765
18766             if ((isMathOperator && isHashNode$1(iNextNode) || isNextMathOperator && isRightCurlyBraceNode$1(iNode)) && hasEmptyRawBefore$1(iNextNode)) {
18767               continue;
18768             } // Print spaces before and after addition and subtraction math operators as is in `calc` function
18769             // due to the fact that it is not valid syntax
18770             // (i.e. `calc(1px+1px)`, `calc(1px+ 1px)`, `calc(1px +1px)`, `calc(1px + 1px)`)
18771
18772
18773             if (insideValueFunctionNode$1(path, "calc") && (isAdditionNode$1(iNode) || isAdditionNode$1(iNextNode) || isSubtractionNode$1(iNode) || isSubtractionNode$1(iNextNode)) && hasEmptyRawBefore$1(iNextNode)) {
18774               continue;
18775             } // Print spaces after `+` and `-` in color adjuster functions as is (e.g. `color(red l(+ 20%))`)
18776             // Adjusters with signed numbers (e.g. `color(red l(+20%))`) output as-is.
18777
18778
18779             const isColorAdjusterNode = (isAdditionNode$1(iNode) || isSubtractionNode$1(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode$1(parentParentNode) && !hasEmptyRawBefore$1(iNextNode);
18780             const requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode$1(iNextNextNode) || iNode.type === "value-func" || isWordNode$1(iNode);
18781             const requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode$1(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode$1(iPrevNode); // Formatting `/`, `+`, `-` sign
18782
18783             if (!(isMultiplicationNode$1(iNextNode) || isMultiplicationNode$1(iNode)) && !insideValueFunctionNode$1(path, "calc") && !isColorAdjusterNode && (isDivisionNode$1(iNextNode) && !requireSpaceBeforeOperator || isDivisionNode$1(iNode) && !requireSpaceAfterOperator || isAdditionNode$1(iNextNode) && !requireSpaceBeforeOperator || isAdditionNode$1(iNode) && !requireSpaceAfterOperator || isSubtractionNode$1(iNextNode) || isSubtractionNode$1(iNode)) && (hasEmptyRawBefore$1(iNextNode) || isMathOperator && (!iPrevNode || iPrevNode && isMathOperatorNode$1(iPrevNode)))) {
18784               continue;
18785             } // Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`)
18786
18787
18788             if (isInlineValueCommentNode$1(iNode)) {
18789               parts.push(hardline$4);
18790               continue;
18791             } // Handle keywords in SCSS control directive
18792
18793
18794             if (isControlDirective && (isEqualityOperatorNode$1(iNextNode) || isRelationalOperatorNode$1(iNextNode) || isIfElseKeywordNode$1(iNextNode) || isEachKeywordNode$1(iNode) || isForKeywordNode$1(iNode))) {
18795               parts.push(" ");
18796               continue;
18797             } // At-rule `namespace` should be in one line
18798
18799
18800             if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") {
18801               parts.push(" ");
18802               continue;
18803             } // Formatting `grid` property
18804
18805
18806             if (isGridValue) {
18807               if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) {
18808                 parts.push(hardline$4);
18809                 didBreak = true;
18810               } else {
18811                 parts.push(" ");
18812               }
18813
18814               continue;
18815             } // Add `space` before next math operation
18816             // Note: `grip` property have `/` delimiter and it is not math operation, so
18817             // `grid` property handles above
18818
18819
18820             if (isNextMathOperator) {
18821               parts.push(" ");
18822               continue;
18823             } // Be default all values go through `line`
18824
18825
18826             parts.push(line$2);
18827           }
18828
18829           if (didBreak) {
18830             parts.unshift(hardline$4);
18831           }
18832
18833           if (isControlDirective) {
18834             return group$1(indent$2(concat$5(parts)));
18835           } // Indent is not needed for import url when url is very long
18836           // and node has two groups
18837           // when type is value-comma_group
18838           // example @import url("verylongurl") projection,tv
18839
18840
18841           if (insideURLFunctionInImportAtRuleNode$1(path)) {
18842             return group$1(fill$2(parts));
18843           }
18844
18845           return group$1(indent$2(fill$2(parts)));
18846         }
18847
18848       case "value-paren_group":
18849         {
18850           const parentNode = path.getParentNode();
18851
18852           if (parentNode && isURLFunctionNode$1(parentNode) && (node.groups.length === 1 || node.groups.length > 0 && node.groups[0].type === "value-comma_group" && node.groups[0].groups.length > 0 && node.groups[0].groups[0].type === "value-word" && node.groups[0].groups[0].value.startsWith("data:"))) {
18853             return concat$5([node.open ? path.call(print, "open") : "", join$2(",", path.map(print, "groups")), node.close ? path.call(print, "close") : ""]);
18854           }
18855
18856           if (!node.open) {
18857             const printed = path.map(print, "groups");
18858             const res = [];
18859
18860             for (let i = 0; i < printed.length; i++) {
18861               if (i !== 0) {
18862                 res.push(concat$5([",", line$2]));
18863               }
18864
18865               res.push(printed[i]);
18866             }
18867
18868             return group$1(indent$2(fill$2(res)));
18869           }
18870
18871           const isSCSSMapItem = isSCSSMapItemNode$1(path);
18872           const lastItem = node.groups[node.groups.length - 1];
18873           const isLastItemComment = lastItem && lastItem.type === "value-comment";
18874           return group$1(concat$5([node.open ? path.call(print, "open") : "", indent$2(concat$5([softline$1, join$2(concat$5([",", line$2]), path.map(childPath => {
18875             const node = childPath.getValue();
18876             const printed = print(childPath); // Key/Value pair in open paren already indented
18877
18878             if (isKeyValuePairNode$1(node) && node.type === "value-comma_group" && node.groups && node.groups[2] && node.groups[2].type === "value-paren_group") {
18879               printed.contents.contents.parts[1] = group$1(printed.contents.contents.parts[1]);
18880               return group$1(dedent$1(printed));
18881             }
18882
18883             return printed;
18884           }, "groups"))])), ifBreak$1(!isLastItemComment && isSCSS$1(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline$1, node.close ? path.call(print, "close") : ""]), {
18885             shouldBreak: isSCSSMapItem
18886           });
18887         }
18888
18889       case "value-func":
18890         {
18891           return concat$5([node.value, insideAtRuleNode$1(path, "supports") && isMediaAndSupportsKeywords$1(node) ? " " : "", path.call(print, "group")]);
18892         }
18893
18894       case "value-paren":
18895         {
18896           return node.value;
18897         }
18898
18899       case "value-number":
18900         {
18901           return concat$5([printCssNumber(node.value), maybeToLowerCase$1(node.unit)]);
18902         }
18903
18904       case "value-operator":
18905         {
18906           return node.value;
18907         }
18908
18909       case "value-word":
18910         {
18911           if (node.isColor && node.isHex || isWideKeywords$1(node.value)) {
18912             return node.value.toLowerCase();
18913           }
18914
18915           return node.value;
18916         }
18917
18918       case "value-colon":
18919         {
18920           return concat$5([node.value, // Don't add spaces on `:` in `url` function (i.e. `url(fbglyph: cross-outline, fig-white)`)
18921           insideValueFunctionNode$1(path, "url") ? "" : line$2]);
18922         }
18923
18924       case "value-comma":
18925         {
18926           return concat$5([node.value, " "]);
18927         }
18928
18929       case "value-string":
18930         {
18931           return printString$1(node.raws.quote + node.value + node.raws.quote, options);
18932         }
18933
18934       case "value-atword":
18935         {
18936           return concat$5(["@", node.value]);
18937         }
18938
18939       case "value-unicode-range":
18940         {
18941           return node.value;
18942         }
18943
18944       case "value-unknown":
18945         {
18946           return node.value;
18947         }
18948
18949       default:
18950         /* istanbul ignore next */
18951         throw new Error("Unknown postcss type ".concat(JSON.stringify(node.type)));
18952     }
18953   }
18954
18955   function printNodeSequence(path, options, print) {
18956     const node = path.getValue();
18957     const parts = [];
18958     let i = 0;
18959     path.map(pathChild => {
18960       const prevNode = node.nodes[i - 1];
18961
18962       if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") {
18963         const childNode = pathChild.getValue();
18964         parts.push(options.originalText.slice(options.locStart(childNode), options.locEnd(childNode)));
18965       } else {
18966         parts.push(pathChild.call(print));
18967       }
18968
18969       if (i !== node.nodes.length - 1) {
18970         if (node.nodes[i + 1].type === "css-comment" && !hasNewline$3(options.originalText, options.locStart(node.nodes[i + 1]), {
18971           backwards: true
18972         }) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml" || node.nodes[i + 1].type === "css-atrule" && node.nodes[i + 1].name === "else" && node.nodes[i].type !== "css-comment") {
18973           parts.push(" ");
18974         } else {
18975           parts.push(options.__isHTMLStyleAttribute ? line$2 : hardline$4);
18976
18977           if (isNextLineEmpty$2(options.originalText, pathChild.getValue(), options.locEnd) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml") {
18978             parts.push(hardline$4);
18979           }
18980         }
18981       }
18982
18983       i++;
18984     }, "nodes");
18985     return concat$5(parts);
18986   }
18987
18988   const STRING_REGEX$3 = /(['"])(?:(?!\1)[^\\]|\\[\s\S])*\1/g;
18989   const NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g;
18990   const STANDARD_UNIT_REGEX = /[a-zA-Z]+/g;
18991   const WORD_PART_REGEX = /[$@]?[a-zA-Z_\u0080-\uFFFF][\w\-\u0080-\uFFFF]*/g;
18992   const ADJUST_NUMBERS_REGEX = new RegExp(STRING_REGEX$3.source + "|" + "(".concat(WORD_PART_REGEX.source, ")?") + "(".concat(NUMBER_REGEX.source, ")") + "(".concat(STANDARD_UNIT_REGEX.source, ")?"), "g");
18993
18994   function adjustStrings(value, options) {
18995     return value.replace(STRING_REGEX$3, match => printString$1(match, options));
18996   }
18997
18998   function quoteAttributeValue(value, options) {
18999     const quote = options.singleQuote ? "'" : '"';
19000     return value.includes('"') || value.includes("'") ? value : quote + value + quote;
19001   }
19002
19003   function adjustNumbers(value) {
19004     return value.replace(ADJUST_NUMBERS_REGEX, (match, quote, wordPart, number, unit) => !wordPart && number ? printCssNumber(number) + maybeToLowerCase$1(unit || "") : match);
19005   }
19006
19007   function printCssNumber(rawNumber) {
19008     return printNumber$1(rawNumber) // Remove trailing `.0`.
19009     .replace(/\.0(?=$|e)/, "");
19010   }
19011
19012   var printerPostcss = {
19013     print: genericPrint,
19014     embed: embed_1,
19015     insertPragma: insertPragma$2,
19016     hasPrettierIgnore: hasIgnoreComment$1,
19017     massageAstNode: clean_1
19018   };
19019
19020   const CATEGORY_COMMON = "Common"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
19021
19022   var commonOptions = {
19023     bracketSpacing: {
19024       since: "0.0.0",
19025       category: CATEGORY_COMMON,
19026       type: "boolean",
19027       default: true,
19028       description: "Print spaces between brackets.",
19029       oppositeDescription: "Do not print spaces between brackets."
19030     },
19031     singleQuote: {
19032       since: "0.0.0",
19033       category: CATEGORY_COMMON,
19034       type: "boolean",
19035       default: false,
19036       description: "Use single quotes instead of double quotes."
19037     },
19038     proseWrap: {
19039       since: "1.8.2",
19040       category: CATEGORY_COMMON,
19041       type: "choice",
19042       default: [{
19043         since: "1.8.2",
19044         value: true
19045       }, {
19046         since: "1.9.0",
19047         value: "preserve"
19048       }],
19049       description: "How to wrap prose.",
19050       choices: [{
19051         since: "1.9.0",
19052         value: "always",
19053         description: "Wrap prose if it exceeds the print width."
19054       }, {
19055         since: "1.9.0",
19056         value: "never",
19057         description: "Do not wrap prose."
19058       }, {
19059         since: "1.9.0",
19060         value: "preserve",
19061         description: "Wrap prose as-is."
19062       }]
19063     }
19064   };
19065
19066   var options$2 = {
19067     singleQuote: commonOptions.singleQuote
19068   };
19069
19070   var createLanguage = function createLanguage(linguistData, override) {
19071     const {
19072       languageId
19073     } = linguistData,
19074           rest = _objectWithoutPropertiesLoose(linguistData, ["languageId"]);
19075
19076     return Object.assign({
19077       linguistLanguageId: languageId
19078     }, rest, {}, override(linguistData));
19079   };
19080
19081   var name$1 = "CSS";
19082   var type = "markup";
19083   var tmScope = "source.css";
19084   var aceMode = "css";
19085   var codemirrorMode = "css";
19086   var codemirrorMimeType = "text/css";
19087   var color = "#563d7c";
19088   var extensions = [
19089         ".css"
19090   ];
19091   var languageId = 50;
19092   var CSS = {
19093         name: name$1,
19094         type: type,
19095         tmScope: tmScope,
19096         aceMode: aceMode,
19097         codemirrorMode: codemirrorMode,
19098         codemirrorMimeType: codemirrorMimeType,
19099         color: color,
19100         extensions: extensions,
19101         languageId: languageId
19102   };
19103
19104   var CSS$1 = /*#__PURE__*/Object.freeze({
19105     __proto__: null,
19106     name: name$1,
19107     type: type,
19108     tmScope: tmScope,
19109     aceMode: aceMode,
19110     codemirrorMode: codemirrorMode,
19111     codemirrorMimeType: codemirrorMimeType,
19112     color: color,
19113     extensions: extensions,
19114     languageId: languageId,
19115     'default': CSS
19116   });
19117
19118   var name$2 = "PostCSS";
19119   var type$1 = "markup";
19120   var tmScope$1 = "source.postcss";
19121   var group$2 = "CSS";
19122   var extensions$1 = [
19123         ".pcss",
19124         ".postcss"
19125   ];
19126   var aceMode$1 = "text";
19127   var languageId$1 = 262764437;
19128   var PostCSS = {
19129         name: name$2,
19130         type: type$1,
19131         tmScope: tmScope$1,
19132         group: group$2,
19133         extensions: extensions$1,
19134         aceMode: aceMode$1,
19135         languageId: languageId$1
19136   };
19137
19138   var PostCSS$1 = /*#__PURE__*/Object.freeze({
19139     __proto__: null,
19140     name: name$2,
19141     type: type$1,
19142     tmScope: tmScope$1,
19143     group: group$2,
19144     extensions: extensions$1,
19145     aceMode: aceMode$1,
19146     languageId: languageId$1,
19147     'default': PostCSS
19148   });
19149
19150   var name$3 = "Less";
19151   var type$2 = "markup";
19152   var group$3 = "CSS";
19153   var extensions$2 = [
19154         ".less"
19155   ];
19156   var tmScope$2 = "source.css.less";
19157   var aceMode$2 = "less";
19158   var codemirrorMode$1 = "css";
19159   var codemirrorMimeType$1 = "text/css";
19160   var languageId$2 = 198;
19161   var Less = {
19162         name: name$3,
19163         type: type$2,
19164         group: group$3,
19165         extensions: extensions$2,
19166         tmScope: tmScope$2,
19167         aceMode: aceMode$2,
19168         codemirrorMode: codemirrorMode$1,
19169         codemirrorMimeType: codemirrorMimeType$1,
19170         languageId: languageId$2
19171   };
19172
19173   var Less$1 = /*#__PURE__*/Object.freeze({
19174     __proto__: null,
19175     name: name$3,
19176     type: type$2,
19177     group: group$3,
19178     extensions: extensions$2,
19179     tmScope: tmScope$2,
19180     aceMode: aceMode$2,
19181     codemirrorMode: codemirrorMode$1,
19182     codemirrorMimeType: codemirrorMimeType$1,
19183     languageId: languageId$2,
19184     'default': Less
19185   });
19186
19187   var name$4 = "SCSS";
19188   var type$3 = "markup";
19189   var tmScope$3 = "source.css.scss";
19190   var group$4 = "CSS";
19191   var aceMode$3 = "scss";
19192   var codemirrorMode$2 = "css";
19193   var codemirrorMimeType$2 = "text/x-scss";
19194   var extensions$3 = [
19195         ".scss"
19196   ];
19197   var languageId$3 = 329;
19198   var SCSS = {
19199         name: name$4,
19200         type: type$3,
19201         tmScope: tmScope$3,
19202         group: group$4,
19203         aceMode: aceMode$3,
19204         codemirrorMode: codemirrorMode$2,
19205         codemirrorMimeType: codemirrorMimeType$2,
19206         extensions: extensions$3,
19207         languageId: languageId$3
19208   };
19209
19210   var SCSS$1 = /*#__PURE__*/Object.freeze({
19211     __proto__: null,
19212     name: name$4,
19213     type: type$3,
19214     tmScope: tmScope$3,
19215     group: group$4,
19216     aceMode: aceMode$3,
19217     codemirrorMode: codemirrorMode$2,
19218     codemirrorMimeType: codemirrorMimeType$2,
19219     extensions: extensions$3,
19220     languageId: languageId$3,
19221     'default': SCSS
19222   });
19223
19224   var require$$0$2 = getCjsExportFromNamespace(CSS$1);
19225
19226   var require$$1 = getCjsExportFromNamespace(PostCSS$1);
19227
19228   var require$$2 = getCjsExportFromNamespace(Less$1);
19229
19230   var require$$3 = getCjsExportFromNamespace(SCSS$1);
19231
19232   const languages = [createLanguage(require$$0$2, () => ({
19233     since: "1.4.0",
19234     parsers: ["css"],
19235     vscodeLanguageIds: ["css"]
19236   })), createLanguage(require$$1, () => ({
19237     since: "1.4.0",
19238     parsers: ["css"],
19239     vscodeLanguageIds: ["postcss"]
19240   })), createLanguage(require$$2, () => ({
19241     since: "1.4.0",
19242     parsers: ["less"],
19243     vscodeLanguageIds: ["less"]
19244   })), createLanguage(require$$3, () => ({
19245     since: "1.4.0",
19246     parsers: ["scss"],
19247     vscodeLanguageIds: ["scss"]
19248   }))];
19249   const printers = {
19250     postcss: printerPostcss
19251   };
19252   var languageCss = {
19253     languages,
19254     options: options$2,
19255     printers
19256   };
19257
19258   function hasPragma$2(text) {
19259     return /^\s*#[^\n\S]*@(format|prettier)\s*(\n|$)/.test(text);
19260   }
19261
19262   function insertPragma$3(text) {
19263     return "# @format\n\n" + text;
19264   }
19265
19266   var pragma$2 = {
19267     hasPragma: hasPragma$2,
19268     insertPragma: insertPragma$3
19269   };
19270
19271   const {
19272     concat: concat$6,
19273     join: join$3,
19274     hardline: hardline$5,
19275     line: line$3,
19276     softline: softline$2,
19277     group: group$5,
19278     indent: indent$3,
19279     ifBreak: ifBreak$2
19280   } = document.builders;
19281   const {
19282     hasIgnoreComment: hasIgnoreComment$2
19283   } = util$1;
19284   const {
19285     isNextLineEmpty: isNextLineEmpty$3
19286   } = utilShared;
19287   const {
19288     insertPragma: insertPragma$4
19289   } = pragma$2;
19290
19291   function genericPrint$1(path, options, print) {
19292     const n = path.getValue();
19293
19294     if (!n) {
19295       return "";
19296     }
19297
19298     if (typeof n === "string") {
19299       return n;
19300     }
19301
19302     switch (n.kind) {
19303       case "Document":
19304         {
19305           const parts = [];
19306           path.map((pathChild, index) => {
19307             parts.push(concat$6([pathChild.call(print)]));
19308
19309             if (index !== n.definitions.length - 1) {
19310               parts.push(hardline$5);
19311
19312               if (isNextLineEmpty$3(options.originalText, pathChild.getValue(), options.locEnd)) {
19313                 parts.push(hardline$5);
19314               }
19315             }
19316           }, "definitions");
19317           return concat$6([concat$6(parts), hardline$5]);
19318         }
19319
19320       case "OperationDefinition":
19321         {
19322           const hasOperation = options.originalText[options.locStart(n)] !== "{";
19323           const hasName = !!n.name;
19324           return concat$6([hasOperation ? n.operation : "", hasOperation && hasName ? concat$6([" ", path.call(print, "name")]) : "", n.variableDefinitions && n.variableDefinitions.length ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "variableDefinitions"))])), softline$2, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? !hasOperation && !hasName ? "" : " " : "", path.call(print, "selectionSet")]);
19325         }
19326
19327       case "FragmentDefinition":
19328         {
19329           return concat$6(["fragment ", path.call(print, "name"), n.variableDefinitions && n.variableDefinitions.length ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "variableDefinitions"))])), softline$2, ")"])) : "", " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
19330         }
19331
19332       case "SelectionSet":
19333         {
19334           return concat$6(["{", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(selectionsPath => printSequence(selectionsPath, options, print), "selections"))])), hardline$5, "}"]);
19335         }
19336
19337       case "Field":
19338         {
19339           return group$5(concat$6([n.alias ? concat$6([path.call(print, "alias"), ": "]) : "", path.call(print, "name"), n.arguments.length > 0 ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$2, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? " " : "", path.call(print, "selectionSet")]));
19340         }
19341
19342       case "Name":
19343         {
19344           return n.value;
19345         }
19346
19347       case "StringValue":
19348         {
19349           if (n.block) {
19350             return concat$6(['"""', hardline$5, join$3(hardline$5, n.value.replace(/"""/g, "\\$&").split("\n")), hardline$5, '"""']);
19351           }
19352
19353           return concat$6(['"', n.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"']);
19354         }
19355
19356       case "IntValue":
19357       case "FloatValue":
19358       case "EnumValue":
19359         {
19360           return n.value;
19361         }
19362
19363       case "BooleanValue":
19364         {
19365           return n.value ? "true" : "false";
19366         }
19367
19368       case "NullValue":
19369         {
19370           return "null";
19371         }
19372
19373       case "Variable":
19374         {
19375           return concat$6(["$", path.call(print, "name")]);
19376         }
19377
19378       case "ListValue":
19379         {
19380           return group$5(concat$6(["[", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "values"))])), softline$2, "]"]));
19381         }
19382
19383       case "ObjectValue":
19384         {
19385           return group$5(concat$6(["{", options.bracketSpacing && n.fields.length > 0 ? " " : "", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "fields"))])), softline$2, ifBreak$2("", options.bracketSpacing && n.fields.length > 0 ? " " : ""), "}"]));
19386         }
19387
19388       case "ObjectField":
19389       case "Argument":
19390         {
19391           return concat$6([path.call(print, "name"), ": ", path.call(print, "value")]);
19392         }
19393
19394       case "Directive":
19395         {
19396           return concat$6(["@", path.call(print, "name"), n.arguments.length > 0 ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$2, ")"])) : ""]);
19397         }
19398
19399       case "NamedType":
19400         {
19401           return path.call(print, "name");
19402         }
19403
19404       case "VariableDefinition":
19405         {
19406           return concat$6([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$6([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
19407         }
19408
19409       case "TypeExtensionDefinition":
19410         {
19411           return concat$6(["extend ", path.call(print, "definition")]);
19412         }
19413
19414       case "ObjectTypeExtension":
19415       case "ObjectTypeDefinition":
19416         {
19417           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "ObjectTypeExtension" ? "extend " : "", "type ", path.call(print, "name"), n.interfaces.length > 0 ? concat$6([" implements ", concat$6(printInterfaces(path, options, print))]) : "", printDirectives(path, print, n), n.fields.length > 0 ? concat$6([" {", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$5, "}"]) : ""]);
19418         }
19419
19420       case "FieldDefinition":
19421         {
19422           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", path.call(print, "name"), n.arguments.length > 0 ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$2, ")"])) : "", ": ", path.call(print, "type"), printDirectives(path, print, n)]);
19423         }
19424
19425       case "DirectiveDefinition":
19426         {
19427           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", "directive ", "@", path.call(print, "name"), n.arguments.length > 0 ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$2, ")"])) : "", n.repeatable ? " repeatable" : "", concat$6([" on ", join$3(" | ", path.map(print, "locations"))])]);
19428         }
19429
19430       case "EnumTypeExtension":
19431       case "EnumTypeDefinition":
19432         {
19433           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "EnumTypeExtension" ? "extend " : "", "enum ", path.call(print, "name"), printDirectives(path, print, n), n.values.length > 0 ? concat$6([" {", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(valuesPath => printSequence(valuesPath, options, print), "values"))])), hardline$5, "}"]) : ""]);
19434         }
19435
19436       case "EnumValueDefinition":
19437         {
19438           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", path.call(print, "name"), printDirectives(path, print, n)]);
19439         }
19440
19441       case "InputValueDefinition":
19442         {
19443           return concat$6([path.call(print, "description"), n.description ? n.description.block ? hardline$5 : line$3 : "", path.call(print, "name"), ": ", path.call(print, "type"), n.defaultValue ? concat$6([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
19444         }
19445
19446       case "InputObjectTypeExtension":
19447       case "InputObjectTypeDefinition":
19448         {
19449           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$6([" {", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$5, "}"]) : ""]);
19450         }
19451
19452       case "SchemaDefinition":
19453         {
19454           return concat$6(["schema", printDirectives(path, print, n), " {", n.operationTypes.length > 0 ? indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(opsPath => printSequence(opsPath, options, print), "operationTypes"))])) : "", hardline$5, "}"]);
19455         }
19456
19457       case "OperationTypeDefinition":
19458         {
19459           return concat$6([path.call(print, "operation"), ": ", path.call(print, "type")]);
19460         }
19461
19462       case "InterfaceTypeExtension":
19463       case "InterfaceTypeDefinition":
19464         {
19465           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$6([" {", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$5, "}"]) : ""]);
19466         }
19467
19468       case "FragmentSpread":
19469         {
19470           return concat$6(["...", path.call(print, "name"), printDirectives(path, print, n)]);
19471         }
19472
19473       case "InlineFragment":
19474         {
19475           return concat$6(["...", n.typeCondition ? concat$6([" on ", path.call(print, "typeCondition")]) : "", printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
19476         }
19477
19478       case "UnionTypeExtension":
19479       case "UnionTypeDefinition":
19480         {
19481           return group$5(concat$6([path.call(print, "description"), n.description ? hardline$5 : "", group$5(concat$6([n.kind === "UnionTypeExtension" ? "extend " : "", "union ", path.call(print, "name"), printDirectives(path, print, n), n.types.length > 0 ? concat$6([" =", ifBreak$2("", " "), indent$3(concat$6([ifBreak$2(concat$6([line$3, "  "])), join$3(concat$6([line$3, "| "]), path.map(print, "types"))]))]) : ""]))]));
19482         }
19483
19484       case "ScalarTypeExtension":
19485       case "ScalarTypeDefinition":
19486         {
19487           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", path.call(print, "name"), printDirectives(path, print, n)]);
19488         }
19489
19490       case "NonNullType":
19491         {
19492           return concat$6([path.call(print, "type"), "!"]);
19493         }
19494
19495       case "ListType":
19496         {
19497           return concat$6(["[", path.call(print, "type"), "]"]);
19498         }
19499
19500       default:
19501         /* istanbul ignore next */
19502         throw new Error("unknown graphql type: " + JSON.stringify(n.kind));
19503     }
19504   }
19505
19506   function printDirectives(path, print, n) {
19507     if (n.directives.length === 0) {
19508       return "";
19509     }
19510
19511     return concat$6([" ", group$5(indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", " "), softline$2]), path.map(print, "directives"))])))]);
19512   }
19513
19514   function printSequence(sequencePath, options, print) {
19515     const count = sequencePath.getValue().length;
19516     return sequencePath.map((path, i) => {
19517       const printed = print(path);
19518
19519       if (isNextLineEmpty$3(options.originalText, path.getValue(), options.locEnd) && i < count - 1) {
19520         return concat$6([printed, hardline$5]);
19521       }
19522
19523       return printed;
19524     });
19525   }
19526
19527   function canAttachComment(node) {
19528     return node.kind && node.kind !== "Comment";
19529   }
19530
19531   function printComment$1(commentPath) {
19532     const comment = commentPath.getValue();
19533
19534     if (comment.kind === "Comment") {
19535       return "#" + comment.value.trimEnd();
19536     }
19537
19538     throw new Error("Not a comment: " + JSON.stringify(comment));
19539   }
19540
19541   function determineInterfaceSeparatorBetween(first, second, options) {
19542     const textBetween = options.originalText.slice(first.loc.end, second.loc.start).replace(/#.*/g, "").trim();
19543     return textBetween === "," ? ", " : " & ";
19544   }
19545
19546   function printInterfaces(path, options, print) {
19547     const node = path.getNode();
19548     const parts = [];
19549     const {
19550       interfaces
19551     } = node;
19552     const printed = path.map(node => print(node), "interfaces");
19553
19554     for (let index = 0; index < interfaces.length; index++) {
19555       const interfaceNode = interfaces[index];
19556
19557       if (index > 0) {
19558         parts.push(determineInterfaceSeparatorBetween(interfaces[index - 1], interfaceNode, options));
19559       }
19560
19561       parts.push(printed[index]);
19562     }
19563
19564     return parts;
19565   }
19566
19567   function clean$1(node, newNode
19568   /*, parent*/
19569   ) {
19570     delete newNode.loc;
19571     delete newNode.comments;
19572   }
19573
19574   var printerGraphql = {
19575     print: genericPrint$1,
19576     massageAstNode: clean$1,
19577     hasPrettierIgnore: hasIgnoreComment$2,
19578     insertPragma: insertPragma$4,
19579     printComment: printComment$1,
19580     canAttachComment
19581   };
19582
19583   var options$3 = {
19584     bracketSpacing: commonOptions.bracketSpacing
19585   };
19586
19587   var name$5 = "GraphQL";
19588   var type$4 = "data";
19589   var extensions$4 = [
19590         ".graphql",
19591         ".gql",
19592         ".graphqls"
19593   ];
19594   var tmScope$4 = "source.graphql";
19595   var aceMode$4 = "text";
19596   var languageId$4 = 139;
19597   var GraphQL = {
19598         name: name$5,
19599         type: type$4,
19600         extensions: extensions$4,
19601         tmScope: tmScope$4,
19602         aceMode: aceMode$4,
19603         languageId: languageId$4
19604   };
19605
19606   var GraphQL$1 = /*#__PURE__*/Object.freeze({
19607     __proto__: null,
19608     name: name$5,
19609     type: type$4,
19610     extensions: extensions$4,
19611     tmScope: tmScope$4,
19612     aceMode: aceMode$4,
19613     languageId: languageId$4,
19614     'default': GraphQL
19615   });
19616
19617   var require$$0$3 = getCjsExportFromNamespace(GraphQL$1);
19618
19619   const languages$1 = [createLanguage(require$$0$3, () => ({
19620     since: "1.5.0",
19621     parsers: ["graphql"],
19622     vscodeLanguageIds: ["graphql"]
19623   }))];
19624   const printers$1 = {
19625     graphql: printerGraphql
19626   };
19627   var languageGraphql = {
19628     languages: languages$1,
19629     options: options$3,
19630     printers: printers$1
19631   };
19632
19633   var clean$2 = function clean(ast, newNode) {
19634     delete newNode.loc;
19635     delete newNode.selfClosing; // (Glimmer/HTML) ignore TextNode whitespace
19636
19637     if (ast.type === "TextNode") {
19638       const trimmed = ast.chars.trim();
19639
19640       if (!trimmed) {
19641         return null;
19642       }
19643
19644       newNode.chars = trimmed;
19645     }
19646   };
19647
19648   function isUppercase(string) {
19649     return string.toUpperCase() === string;
19650   }
19651
19652   function isGlimmerComponent(node) {
19653     return isNodeOfSomeType(node, ["ElementNode"]) && typeof node.tag === "string" && (isUppercase(node.tag[0]) || node.tag.includes("."));
19654   }
19655
19656   function isWhitespaceNode(node) {
19657     return isNodeOfSomeType(node, ["TextNode"]) && !/\S/.test(node.chars);
19658   }
19659
19660   function isNodeOfSomeType(node, types) {
19661     return node && types.some(type => node.type === type);
19662   }
19663
19664   function isParentOfSomeType(path, types) {
19665     const parentNode = path.getParentNode(0);
19666     return isNodeOfSomeType(parentNode, types);
19667   }
19668
19669   function isPreviousNodeOfSomeType(path, types) {
19670     const previousNode = getPreviousNode(path);
19671     return isNodeOfSomeType(previousNode, types);
19672   }
19673
19674   function isNextNodeOfSomeType(path, types) {
19675     const nextNode = getNextNode(path);
19676     return isNodeOfSomeType(nextNode, types);
19677   }
19678
19679   function getSiblingNode(path, offset) {
19680     const node = path.getValue();
19681     const parentNode = path.getParentNode(0) || {};
19682     const children = parentNode.children || parentNode.body || [];
19683     const index = children.indexOf(node);
19684     return index !== -1 && children[index + offset];
19685   }
19686
19687   function getPreviousNode(path, lookBack = 1) {
19688     return getSiblingNode(path, -lookBack);
19689   }
19690
19691   function getNextNode(path) {
19692     return getSiblingNode(path, 1);
19693   }
19694
19695   function isPrettierIgnoreNode(node) {
19696     return isNodeOfSomeType(node, ["MustacheCommentStatement"]) && typeof node.value === "string" && node.value.trim() === "prettier-ignore";
19697   }
19698
19699   function hasPrettierIgnore(path) {
19700     const node = path.getValue();
19701     const previousPreviousNode = getPreviousNode(path, 2);
19702     return isPrettierIgnoreNode(node) || isPrettierIgnoreNode(previousPreviousNode);
19703   }
19704
19705   var utils$3 = {
19706     getNextNode,
19707     getPreviousNode,
19708     hasPrettierIgnore,
19709     isGlimmerComponent,
19710     isNextNodeOfSomeType,
19711     isNodeOfSomeType,
19712     isParentOfSomeType,
19713     isPreviousNodeOfSomeType,
19714     isWhitespaceNode
19715   };
19716
19717   const {
19718     concat: concat$7,
19719     join: join$4,
19720     softline: softline$3,
19721     hardline: hardline$6,
19722     line: line$4,
19723     group: group$6,
19724     indent: indent$4,
19725     ifBreak: ifBreak$3
19726   } = document.builders;
19727   const {
19728     getNextNode: getNextNode$1,
19729     getPreviousNode: getPreviousNode$1,
19730     hasPrettierIgnore: hasPrettierIgnore$1,
19731     isGlimmerComponent: isGlimmerComponent$1,
19732     isNextNodeOfSomeType: isNextNodeOfSomeType$1,
19733     isParentOfSomeType: isParentOfSomeType$1,
19734     isPreviousNodeOfSomeType: isPreviousNodeOfSomeType$1,
19735     isWhitespaceNode: isWhitespaceNode$1
19736   } = utils$3; // http://w3c.github.io/html/single-page.html#void-elements
19737
19738   const voidTags = ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]; // Formatter based on @glimmerjs/syntax's built-in test formatter:
19739   // https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/syntax/lib/generation/print.ts
19740
19741   function print(path, options, print) {
19742     const n = path.getValue();
19743     /* istanbul ignore if*/
19744
19745     if (!n) {
19746       return "";
19747     }
19748
19749     if (hasPrettierIgnore$1(path)) {
19750       const startOffset = locationToOffset(options.originalText, n.loc.start.line - 1, n.loc.start.column);
19751       const endOffset = locationToOffset(options.originalText, n.loc.end.line - 1, n.loc.end.column);
19752       const ignoredText = options.originalText.slice(startOffset, endOffset);
19753       return ignoredText;
19754     }
19755
19756     switch (n.type) {
19757       case "Block":
19758       case "Program":
19759       case "Template":
19760         {
19761           return group$6(concat$7(path.map(print, "body")));
19762         }
19763
19764       case "ElementNode":
19765         {
19766           const hasChildren = n.children.length > 0;
19767           const hasNonWhitespaceChildren = n.children.some(n => !isWhitespaceNode$1(n));
19768           const isVoid = isGlimmerComponent$1(n) && (!hasChildren || !hasNonWhitespaceChildren) || voidTags.includes(n.tag);
19769           const closeTagForNoBreak = isVoid ? concat$7([" />", softline$3]) : ">";
19770           const closeTagForBreak = isVoid ? "/>" : ">";
19771
19772           const printParams = (path, print) => indent$4(concat$7([n.attributes.length ? line$4 : "", join$4(line$4, path.map(print, "attributes")), n.modifiers.length ? line$4 : "", join$4(line$4, path.map(print, "modifiers")), n.comments.length ? line$4 : "", join$4(line$4, path.map(print, "comments"))]));
19773
19774           const nextNode = getNextNode$1(path);
19775           return concat$7([group$6(concat$7(["<", n.tag, printParams(path, print), n.blockParams.length ? " as |".concat(n.blockParams.join(" "), "|") : "", ifBreak$3(softline$3, ""), ifBreak$3(closeTagForBreak, closeTagForNoBreak)])), !isVoid ? group$6(concat$7([hasNonWhitespaceChildren ? indent$4(printChildren(path, options, print)) : "", ifBreak$3(hasChildren ? hardline$6 : "", ""), concat$7(["</", n.tag, ">"])])) : "", nextNode && nextNode.type === "ElementNode" ? hardline$6 : ""]);
19776         }
19777
19778       case "BlockStatement":
19779         {
19780           const pp = path.getParentNode(1);
19781           const isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
19782           const hasElseIf = n.inverse && n.inverse.body.length === 1 && n.inverse.body[0].type === "BlockStatement" && n.inverse.body[0].path.parts[0] === "if";
19783           const indentElse = hasElseIf ? a => a : indent$4;
19784           const inverseElseStatement = (n.inverseStrip.open ? "{{~" : "{{") + "else" + (n.inverseStrip.close ? "~}}" : "}}");
19785
19786           if (n.inverse) {
19787             return concat$7([isElseIf ? concat$7([n.openStrip.open ? "{{~else " : "{{else ", printPathParams(path, print), n.openStrip.close ? "~}}" : "}}"]) : printOpenBlock(path, print, n.openStrip), indent$4(concat$7([hardline$6, path.call(print, "program")])), n.inverse && !hasElseIf ? concat$7([hardline$6, inverseElseStatement]) : "", n.inverse ? indentElse(concat$7([hardline$6, path.call(print, "inverse")])) : "", isElseIf ? "" : concat$7([hardline$6, printCloseBlock(path, print, n.closeStrip)])]);
19788           } else if (isElseIf) {
19789             return concat$7([concat$7([n.openStrip.open ? "{{~else" : "{{else ", printPathParams(path, print), n.openStrip.close ? "~}}" : "}}"]), indent$4(concat$7([hardline$6, path.call(print, "program")]))]);
19790           }
19791
19792           const hasNonWhitespaceChildren = n.program.body.some(n => !isWhitespaceNode$1(n));
19793           return concat$7([printOpenBlock(path, print, n.openStrip), group$6(concat$7([indent$4(concat$7([softline$3, path.call(print, "program")])), hasNonWhitespaceChildren ? hardline$6 : softline$3, printCloseBlock(path, print, n.closeStrip)]))]);
19794         }
19795
19796       case "ElementModifierStatement":
19797         {
19798           return group$6(concat$7(["{{", printPathParams(path, print), softline$3, "}}"]));
19799         }
19800
19801       case "MustacheStatement":
19802         {
19803           const isEscaped = n.escaped === false;
19804           const {
19805             open: openStrip,
19806             close: closeStrip
19807           } = n.strip;
19808           const opening = (isEscaped ? "{{{" : "{{") + (openStrip ? "~" : "");
19809           const closing = (closeStrip ? "~" : "") + (isEscaped ? "}}}" : "}}");
19810           const leading = isParentOfSomeType$1(path, ["AttrNode", "ConcatStatement", "ElementNode"]) ? [opening, indent$4(softline$3)] : [opening];
19811           return group$6(concat$7([...leading, printPathParams(path, print), softline$3, closing]));
19812         }
19813
19814       case "SubExpression":
19815         {
19816           const params = printParams(path, print);
19817           const printedParams = params.length > 0 ? indent$4(concat$7([line$4, group$6(join$4(line$4, params))])) : "";
19818           return group$6(concat$7(["(", printPath(path, print), printedParams, softline$3, ")"]));
19819         }
19820
19821       case "AttrNode":
19822         {
19823           const isText = n.value.type === "TextNode";
19824           const isEmptyText = isText && n.value.chars === ""; // If the text is empty and the value's loc start and end columns are the
19825           // same, there is no value for this AttrNode and it should be printed
19826           // without the `=""`. Example: `<img data-test>` -> `<img data-test>`
19827
19828           const isEmptyValue = isEmptyText && n.value.loc.start.column === n.value.loc.end.column;
19829
19830           if (isEmptyValue) {
19831             return concat$7([n.name]);
19832           }
19833
19834           const value = path.call(print, "value");
19835           const quotedValue = isText ? printStringLiteral(value.parts.join(), options) : value;
19836           return concat$7([n.name, "=", quotedValue]);
19837         }
19838
19839       case "ConcatStatement":
19840         {
19841           return concat$7(['"', concat$7(path.map(partPath => print(partPath), "parts").filter(a => a !== "")), '"']);
19842         }
19843
19844       case "Hash":
19845         {
19846           return concat$7([join$4(line$4, path.map(print, "pairs"))]);
19847         }
19848
19849       case "HashPair":
19850         {
19851           return concat$7([n.key, "=", path.call(print, "value")]);
19852         }
19853
19854       case "TextNode":
19855         {
19856           const maxLineBreaksToPreserve = 2;
19857           const isFirstElement = !getPreviousNode$1(path);
19858           const isLastElement = !getNextNode$1(path);
19859           const isWhitespaceOnly = !/\S/.test(n.chars);
19860           const lineBreaksCount = countNewLines(n.chars);
19861           const hasBlockParent = path.getParentNode(0).type === "Block";
19862           const hasElementParent = path.getParentNode(0).type === "ElementNode";
19863           const hasTemplateParent = path.getParentNode(0).type === "Template";
19864           let leadingLineBreaksCount = countLeadingNewLines(n.chars);
19865           let trailingLineBreaksCount = countTrailingNewLines(n.chars);
19866
19867           if ((isFirstElement || isLastElement) && isWhitespaceOnly && (hasBlockParent || hasElementParent || hasTemplateParent)) {
19868             return "";
19869           }
19870
19871           if (isWhitespaceOnly && lineBreaksCount) {
19872             leadingLineBreaksCount = Math.min(lineBreaksCount, maxLineBreaksToPreserve);
19873             trailingLineBreaksCount = 0;
19874           } else {
19875             if (isNextNodeOfSomeType$1(path, ["BlockStatement", "ElementNode"])) {
19876               trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1);
19877             }
19878
19879             if (isPreviousNodeOfSomeType$1(path, ["ElementNode"]) || isPreviousNodeOfSomeType$1(path, ["BlockStatement"])) {
19880               leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1);
19881             }
19882           }
19883
19884           let leadingSpace = "";
19885           let trailingSpace = ""; // preserve a space inside of an attribute node where whitespace present,
19886           // when next to mustache statement.
19887
19888           const inAttrNode = path.stack.includes("attributes");
19889
19890           if (inAttrNode) {
19891             const parentNode = path.getParentNode(0);
19892             const isConcat = parentNode.type === "ConcatStatement";
19893
19894             if (isConcat) {
19895               const {
19896                 parts
19897               } = parentNode;
19898               const partIndex = parts.indexOf(n);
19899
19900               if (partIndex > 0) {
19901                 const partType = parts[partIndex - 1].type;
19902                 const isMustache = partType === "MustacheStatement";
19903
19904                 if (isMustache) {
19905                   leadingSpace = " ";
19906                 }
19907               }
19908
19909               if (partIndex < parts.length - 1) {
19910                 const partType = parts[partIndex + 1].type;
19911                 const isMustache = partType === "MustacheStatement";
19912
19913                 if (isMustache) {
19914                   trailingSpace = " ";
19915                 }
19916               }
19917             }
19918           } else {
19919             if (trailingLineBreaksCount === 0 && isNextNodeOfSomeType$1(path, ["MustacheStatement"])) {
19920               trailingSpace = " ";
19921             }
19922
19923             if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType$1(path, ["MustacheStatement"])) {
19924               leadingSpace = " ";
19925             }
19926
19927             if (isFirstElement) {
19928               leadingLineBreaksCount = 0;
19929               leadingSpace = "";
19930             }
19931
19932             if (isLastElement) {
19933               trailingLineBreaksCount = 0;
19934               trailingSpace = "";
19935             }
19936           }
19937
19938           return concat$7([...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve), n.chars.replace(/^[\s ]+/g, leadingSpace).replace(/[\s ]+$/, trailingSpace), ...generateHardlines(trailingLineBreaksCount, maxLineBreaksToPreserve)].filter(Boolean));
19939         }
19940
19941       case "MustacheCommentStatement":
19942         {
19943           const dashes = n.value.includes("}}") ? "--" : "";
19944           return concat$7(["{{!", dashes, n.value, dashes, "}}"]);
19945         }
19946
19947       case "PathExpression":
19948         {
19949           return n.original;
19950         }
19951
19952       case "BooleanLiteral":
19953         {
19954           return String(n.value);
19955         }
19956
19957       case "CommentStatement":
19958         {
19959           return concat$7(["<!--", n.value, "-->"]);
19960         }
19961
19962       case "StringLiteral":
19963         {
19964           return printStringLiteral(n.value, options);
19965         }
19966
19967       case "NumberLiteral":
19968         {
19969           return String(n.value);
19970         }
19971
19972       case "UndefinedLiteral":
19973         {
19974           return "undefined";
19975         }
19976
19977       case "NullLiteral":
19978         {
19979           return "null";
19980         }
19981
19982       /* istanbul ignore next */
19983
19984       default:
19985         throw new Error("unknown glimmer type: " + JSON.stringify(n.type));
19986     }
19987   }
19988
19989   function printChildren(path, options, print) {
19990     return concat$7(path.map((childPath, childIndex) => {
19991       const childNode = path.getValue();
19992       const isFirstNode = childIndex === 0;
19993       const isLastNode = childIndex === path.getParentNode(0).children.length - 1;
19994       const isLastNodeInMultiNodeList = isLastNode && !isFirstNode;
19995       const isWhitespace = isWhitespaceNode$1(childNode);
19996
19997       if (isWhitespace && isLastNodeInMultiNodeList) {
19998         return print(childPath, options, print);
19999       } else if (isFirstNode) {
20000         return concat$7([softline$3, print(childPath, options, print)]);
20001       }
20002
20003       return print(childPath, options, print);
20004     }, "children"));
20005   }
20006   /**
20007    * Prints a string literal with the correct surrounding quotes based on
20008    * `options.singleQuote` and the number of escaped quotes contained in
20009    * the string literal. This function is the glimmer equivalent of `printString`
20010    * in `common/util`, but has differences because of the way escaped characters
20011    * are treated in hbs string literals.
20012    * @param {string} stringLiteral - the string literal value
20013    * @param {object} options - the prettier options object
20014    */
20015
20016
20017   function printStringLiteral(stringLiteral, options) {
20018     const double = {
20019       quote: '"',
20020       regex: /"/g
20021     };
20022     const single = {
20023       quote: "'",
20024       regex: /'/g
20025     };
20026     const preferred = options.singleQuote ? single : double;
20027     const alternate = preferred === single ? double : single;
20028     let shouldUseAlternateQuote = false; // If `stringLiteral` contains at least one of the quote preferred for
20029     // enclosing the string, we might want to enclose with the alternate quote
20030     // instead, to minimize the number of escaped quotes.
20031
20032     if (stringLiteral.includes(preferred.quote) || stringLiteral.includes(alternate.quote)) {
20033       const numPreferredQuotes = (stringLiteral.match(preferred.regex) || []).length;
20034       const numAlternateQuotes = (stringLiteral.match(alternate.regex) || []).length;
20035       shouldUseAlternateQuote = numPreferredQuotes > numAlternateQuotes;
20036     }
20037
20038     const enclosingQuote = shouldUseAlternateQuote ? alternate : preferred;
20039     const escapedStringLiteral = stringLiteral.replace(enclosingQuote.regex, "\\".concat(enclosingQuote.quote));
20040     return concat$7([enclosingQuote.quote, escapedStringLiteral, enclosingQuote.quote]);
20041   }
20042
20043   function printPath(path, print) {
20044     return path.call(print, "path");
20045   }
20046
20047   function printParams(path, print) {
20048     const node = path.getValue();
20049     let parts = [];
20050
20051     if (node.params.length > 0) {
20052       parts = parts.concat(path.map(print, "params"));
20053     }
20054
20055     if (node.hash && node.hash.pairs.length > 0) {
20056       parts.push(path.call(print, "hash"));
20057     }
20058
20059     return parts;
20060   }
20061
20062   function printPathParams(path, print) {
20063     const printedPath = printPath(path, print);
20064     const printedParams = printParams(path, print);
20065     const parts = [printedPath, ...printedParams];
20066     return indent$4(group$6(join$4(line$4, parts)));
20067   }
20068
20069   function printBlockParams(path) {
20070     const block = path.getValue();
20071
20072     if (!block.program || !block.program.blockParams.length) {
20073       return "";
20074     }
20075
20076     return concat$7([" as |", block.program.blockParams.join(" "), "|"]);
20077   }
20078
20079   function printOpenBlock(path, print, {
20080     open: isOpenStrip = false,
20081     close: isCloseStrip = false
20082   } = {}) {
20083     return group$6(concat$7([isOpenStrip ? "{{~#" : "{{#", printPathParams(path, print), printBlockParams(path), softline$3, isCloseStrip ? "~}}" : "}}"]));
20084   }
20085
20086   function printCloseBlock(path, print, {
20087     open: isOpenStrip = false,
20088     close: isCloseStrip = false
20089   } = {}) {
20090     return concat$7([isOpenStrip ? "{{~/" : "{{/", path.call(print, "path"), isCloseStrip ? "~}}" : "}}"]);
20091   }
20092
20093   function countNewLines(string) {
20094     /* istanbul ignore next */
20095     string = typeof string === "string" ? string : "";
20096     return string.split("\n").length - 1;
20097   }
20098
20099   function countLeadingNewLines(string) {
20100     /* istanbul ignore next */
20101     string = typeof string === "string" ? string : "";
20102     const newLines = (string.match(/^([^\S\r\n]*[\r\n])+/g) || [])[0] || "";
20103     return countNewLines(newLines);
20104   }
20105
20106   function countTrailingNewLines(string) {
20107     /* istanbul ignore next */
20108     string = typeof string === "string" ? string : "";
20109     const newLines = (string.match(/([\r\n][^\S\r\n]*)+$/g) || [])[0] || "";
20110     return countNewLines(newLines);
20111   }
20112
20113   function generateHardlines(number = 0, max = 0) {
20114     return new Array(Math.min(number, max)).fill(hardline$6);
20115   }
20116   /* istanbul ignore next
20117      https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/compiler/lib/location.ts#L5-L29
20118   */
20119
20120
20121   function locationToOffset(source, line, column) {
20122     let seenLines = 0;
20123     let seenChars = 0; // eslint-disable-next-line no-constant-condition
20124
20125     while (true) {
20126       if (seenChars === source.length) {
20127         return null;
20128       }
20129
20130       let nextLine = source.indexOf("\n", seenChars);
20131
20132       if (nextLine === -1) {
20133         nextLine = source.length;
20134       }
20135
20136       if (seenLines === line) {
20137         if (seenChars + column > nextLine) {
20138           return null;
20139         }
20140
20141         return seenChars + column;
20142       } else if (nextLine === -1) {
20143         return null;
20144       }
20145
20146       seenLines += 1;
20147       seenChars = nextLine + 1;
20148     }
20149   }
20150
20151   var printerGlimmer = {
20152     print,
20153     massageAstNode: clean$2
20154   };
20155
20156   var name$6 = "Handlebars";
20157   var type$5 = "markup";
20158   var group$7 = "HTML";
20159   var aliases = [
20160         "hbs",
20161         "htmlbars"
20162   ];
20163   var extensions$5 = [
20164         ".handlebars",
20165         ".hbs"
20166   ];
20167   var tmScope$5 = "text.html.handlebars";
20168   var aceMode$5 = "handlebars";
20169   var languageId$5 = 155;
20170   var Handlebars = {
20171         name: name$6,
20172         type: type$5,
20173         group: group$7,
20174         aliases: aliases,
20175         extensions: extensions$5,
20176         tmScope: tmScope$5,
20177         aceMode: aceMode$5,
20178         languageId: languageId$5
20179   };
20180
20181   var Handlebars$1 = /*#__PURE__*/Object.freeze({
20182     __proto__: null,
20183     name: name$6,
20184     type: type$5,
20185     group: group$7,
20186     aliases: aliases,
20187     extensions: extensions$5,
20188     tmScope: tmScope$5,
20189     aceMode: aceMode$5,
20190     languageId: languageId$5,
20191     'default': Handlebars
20192   });
20193
20194   var require$$0$4 = getCjsExportFromNamespace(Handlebars$1);
20195
20196   const languages$2 = [createLanguage(require$$0$4, () => ({
20197     since: null,
20198     // unreleased
20199     parsers: ["glimmer"],
20200     vscodeLanguageIds: ["handlebars"]
20201   }))];
20202   const printers$2 = {
20203     glimmer: printerGlimmer
20204   };
20205   var languageHandlebars = {
20206     languages: languages$2,
20207     printers: printers$2
20208   };
20209
20210   var clean$3 = function clean(ast, newNode) {
20211     delete newNode.sourceSpan;
20212     delete newNode.startSourceSpan;
20213     delete newNode.endSourceSpan;
20214     delete newNode.nameSpan;
20215     delete newNode.valueSpan;
20216
20217     if (ast.type === "text" || ast.type === "comment") {
20218       return null;
20219     } // may be formatted by multiparser
20220
20221
20222     if (ast.type === "yaml" || ast.type === "toml") {
20223       return null;
20224     }
20225
20226     if (ast.type === "attribute") {
20227       delete newNode.value;
20228     }
20229
20230     if (ast.type === "docType") {
20231       delete newNode.value;
20232     }
20233   };
20234
20235   var json = {
20236     "CSS_DISPLAY_TAGS": {
20237       "area": "none",
20238       "base": "none",
20239       "basefont": "none",
20240       "datalist": "none",
20241       "head": "none",
20242       "link": "none",
20243       "meta": "none",
20244       "noembed": "none",
20245       "noframes": "none",
20246       "param": "none",
20247       "rp": "none",
20248       "script": "block",
20249       "source": "block",
20250       "style": "none",
20251       "template": "inline",
20252       "track": "block",
20253       "title": "none",
20254       "html": "block",
20255       "body": "block",
20256       "address": "block",
20257       "blockquote": "block",
20258       "center": "block",
20259       "div": "block",
20260       "figure": "block",
20261       "figcaption": "block",
20262       "footer": "block",
20263       "form": "block",
20264       "header": "block",
20265       "hr": "block",
20266       "legend": "block",
20267       "listing": "block",
20268       "main": "block",
20269       "p": "block",
20270       "plaintext": "block",
20271       "pre": "block",
20272       "xmp": "block",
20273       "slot": "contents",
20274       "ruby": "ruby",
20275       "rt": "ruby-text",
20276       "article": "block",
20277       "aside": "block",
20278       "h1": "block",
20279       "h2": "block",
20280       "h3": "block",
20281       "h4": "block",
20282       "h5": "block",
20283       "h6": "block",
20284       "hgroup": "block",
20285       "nav": "block",
20286       "section": "block",
20287       "dir": "block",
20288       "dd": "block",
20289       "dl": "block",
20290       "dt": "block",
20291       "ol": "block",
20292       "ul": "block",
20293       "li": "list-item",
20294       "table": "table",
20295       "caption": "table-caption",
20296       "colgroup": "table-column-group",
20297       "col": "table-column",
20298       "thead": "table-header-group",
20299       "tbody": "table-row-group",
20300       "tfoot": "table-footer-group",
20301       "tr": "table-row",
20302       "td": "table-cell",
20303       "th": "table-cell",
20304       "fieldset": "block",
20305       "button": "inline-block",
20306       "video": "inline-block",
20307       "audio": "inline-block"
20308     },
20309     "CSS_DISPLAY_DEFAULT": "inline",
20310     "CSS_WHITE_SPACE_TAGS": {
20311       "listing": "pre",
20312       "plaintext": "pre",
20313       "pre": "pre",
20314       "xmp": "pre",
20315       "nobr": "nowrap",
20316       "table": "initial",
20317       "textarea": "pre-wrap"
20318     },
20319     "CSS_WHITE_SPACE_DEFAULT": "normal"
20320   };
20321
20322   var index = [
20323         "a",
20324         "abbr",
20325         "acronym",
20326         "address",
20327         "applet",
20328         "area",
20329         "article",
20330         "aside",
20331         "audio",
20332         "b",
20333         "base",
20334         "basefont",
20335         "bdi",
20336         "bdo",
20337         "bgsound",
20338         "big",
20339         "blink",
20340         "blockquote",
20341         "body",
20342         "br",
20343         "button",
20344         "canvas",
20345         "caption",
20346         "center",
20347         "cite",
20348         "code",
20349         "col",
20350         "colgroup",
20351         "command",
20352         "content",
20353         "data",
20354         "datalist",
20355         "dd",
20356         "del",
20357         "details",
20358         "dfn",
20359         "dialog",
20360         "dir",
20361         "div",
20362         "dl",
20363         "dt",
20364         "element",
20365         "em",
20366         "embed",
20367         "fieldset",
20368         "figcaption",
20369         "figure",
20370         "font",
20371         "footer",
20372         "form",
20373         "frame",
20374         "frameset",
20375         "h1",
20376         "h2",
20377         "h3",
20378         "h4",
20379         "h5",
20380         "h6",
20381         "head",
20382         "header",
20383         "hgroup",
20384         "hr",
20385         "html",
20386         "i",
20387         "iframe",
20388         "image",
20389         "img",
20390         "input",
20391         "ins",
20392         "isindex",
20393         "kbd",
20394         "keygen",
20395         "label",
20396         "legend",
20397         "li",
20398         "link",
20399         "listing",
20400         "main",
20401         "map",
20402         "mark",
20403         "marquee",
20404         "math",
20405         "menu",
20406         "menuitem",
20407         "meta",
20408         "meter",
20409         "multicol",
20410         "nav",
20411         "nextid",
20412         "nobr",
20413         "noembed",
20414         "noframes",
20415         "noscript",
20416         "object",
20417         "ol",
20418         "optgroup",
20419         "option",
20420         "output",
20421         "p",
20422         "param",
20423         "picture",
20424         "plaintext",
20425         "pre",
20426         "progress",
20427         "q",
20428         "rb",
20429         "rbc",
20430         "rp",
20431         "rt",
20432         "rtc",
20433         "ruby",
20434         "s",
20435         "samp",
20436         "script",
20437         "section",
20438         "select",
20439         "shadow",
20440         "slot",
20441         "small",
20442         "source",
20443         "spacer",
20444         "span",
20445         "strike",
20446         "strong",
20447         "style",
20448         "sub",
20449         "summary",
20450         "sup",
20451         "svg",
20452         "table",
20453         "tbody",
20454         "td",
20455         "template",
20456         "textarea",
20457         "tfoot",
20458         "th",
20459         "thead",
20460         "time",
20461         "title",
20462         "tr",
20463         "track",
20464         "tt",
20465         "u",
20466         "ul",
20467         "var",
20468         "video",
20469         "wbr",
20470         "xmp"
20471   ];
20472
20473   var htmlTagNames = /*#__PURE__*/Object.freeze({
20474     __proto__: null,
20475     'default': index
20476   });
20477
20478   var a = [
20479         "accesskey",
20480         "charset",
20481         "coords",
20482         "download",
20483         "href",
20484         "hreflang",
20485         "name",
20486         "ping",
20487         "referrerpolicy",
20488         "rel",
20489         "rev",
20490         "shape",
20491         "tabindex",
20492         "target",
20493         "type"
20494   ];
20495   var abbr = [
20496         "title"
20497   ];
20498   var applet = [
20499         "align",
20500         "alt",
20501         "archive",
20502         "code",
20503         "codebase",
20504         "height",
20505         "hspace",
20506         "name",
20507         "object",
20508         "vspace",
20509         "width"
20510   ];
20511   var area = [
20512         "accesskey",
20513         "alt",
20514         "coords",
20515         "download",
20516         "href",
20517         "hreflang",
20518         "nohref",
20519         "ping",
20520         "referrerpolicy",
20521         "rel",
20522         "shape",
20523         "tabindex",
20524         "target",
20525         "type"
20526   ];
20527   var audio = [
20528         "autoplay",
20529         "controls",
20530         "crossorigin",
20531         "loop",
20532         "muted",
20533         "preload",
20534         "src"
20535   ];
20536   var base = [
20537         "href",
20538         "target"
20539   ];
20540   var basefont = [
20541         "color",
20542         "face",
20543         "size"
20544   ];
20545   var bdo = [
20546         "dir"
20547   ];
20548   var blockquote = [
20549         "cite"
20550   ];
20551   var body = [
20552         "alink",
20553         "background",
20554         "bgcolor",
20555         "link",
20556         "text",
20557         "vlink"
20558   ];
20559   var br = [
20560         "clear"
20561   ];
20562   var button = [
20563         "accesskey",
20564         "autofocus",
20565         "disabled",
20566         "form",
20567         "formaction",
20568         "formenctype",
20569         "formmethod",
20570         "formnovalidate",
20571         "formtarget",
20572         "name",
20573         "tabindex",
20574         "type",
20575         "value"
20576   ];
20577   var canvas = [
20578         "height",
20579         "width"
20580   ];
20581   var caption = [
20582         "align"
20583   ];
20584   var col = [
20585         "align",
20586         "char",
20587         "charoff",
20588         "span",
20589         "valign",
20590         "width"
20591   ];
20592   var colgroup = [
20593         "align",
20594         "char",
20595         "charoff",
20596         "span",
20597         "valign",
20598         "width"
20599   ];
20600   var data = [
20601         "value"
20602   ];
20603   var del = [
20604         "cite",
20605         "datetime"
20606   ];
20607   var details = [
20608         "open"
20609   ];
20610   var dfn = [
20611         "title"
20612   ];
20613   var dialog = [
20614         "open"
20615   ];
20616   var dir = [
20617         "compact"
20618   ];
20619   var div = [
20620         "align"
20621   ];
20622   var dl = [
20623         "compact"
20624   ];
20625   var embed$1 = [
20626         "height",
20627         "src",
20628         "type",
20629         "width"
20630   ];
20631   var fieldset = [
20632         "disabled",
20633         "form",
20634         "name"
20635   ];
20636   var font = [
20637         "color",
20638         "face",
20639         "size"
20640   ];
20641   var form = [
20642         "accept",
20643         "accept-charset",
20644         "action",
20645         "autocomplete",
20646         "enctype",
20647         "method",
20648         "name",
20649         "novalidate",
20650         "target"
20651   ];
20652   var frame = [
20653         "frameborder",
20654         "longdesc",
20655         "marginheight",
20656         "marginwidth",
20657         "name",
20658         "noresize",
20659         "scrolling",
20660         "src"
20661   ];
20662   var frameset = [
20663         "cols",
20664         "rows"
20665   ];
20666   var h1 = [
20667         "align"
20668   ];
20669   var h2 = [
20670         "align"
20671   ];
20672   var h3 = [
20673         "align"
20674   ];
20675   var h4 = [
20676         "align"
20677   ];
20678   var h5 = [
20679         "align"
20680   ];
20681   var h6 = [
20682         "align"
20683   ];
20684   var head = [
20685         "profile"
20686   ];
20687   var hr = [
20688         "align",
20689         "noshade",
20690         "size",
20691         "width"
20692   ];
20693   var html = [
20694         "manifest",
20695         "version"
20696   ];
20697   var iframe = [
20698         "align",
20699         "allow",
20700         "allowfullscreen",
20701         "allowpaymentrequest",
20702         "allowusermedia",
20703         "frameborder",
20704         "height",
20705         "longdesc",
20706         "marginheight",
20707         "marginwidth",
20708         "name",
20709         "referrerpolicy",
20710         "sandbox",
20711         "scrolling",
20712         "src",
20713         "srcdoc",
20714         "width"
20715   ];
20716   var img = [
20717         "align",
20718         "alt",
20719         "border",
20720         "crossorigin",
20721         "decoding",
20722         "height",
20723         "hspace",
20724         "ismap",
20725         "longdesc",
20726         "name",
20727         "referrerpolicy",
20728         "sizes",
20729         "src",
20730         "srcset",
20731         "usemap",
20732         "vspace",
20733         "width"
20734   ];
20735   var input = [
20736         "accept",
20737         "accesskey",
20738         "align",
20739         "alt",
20740         "autocomplete",
20741         "autofocus",
20742         "checked",
20743         "dirname",
20744         "disabled",
20745         "form",
20746         "formaction",
20747         "formenctype",
20748         "formmethod",
20749         "formnovalidate",
20750         "formtarget",
20751         "height",
20752         "ismap",
20753         "list",
20754         "max",
20755         "maxlength",
20756         "min",
20757         "minlength",
20758         "multiple",
20759         "name",
20760         "pattern",
20761         "placeholder",
20762         "readonly",
20763         "required",
20764         "size",
20765         "src",
20766         "step",
20767         "tabindex",
20768         "title",
20769         "type",
20770         "usemap",
20771         "value",
20772         "width"
20773   ];
20774   var ins = [
20775         "cite",
20776         "datetime"
20777   ];
20778   var isindex = [
20779         "prompt"
20780   ];
20781   var label = [
20782         "accesskey",
20783         "for",
20784         "form"
20785   ];
20786   var legend = [
20787         "accesskey",
20788         "align"
20789   ];
20790   var li = [
20791         "type",
20792         "value"
20793   ];
20794   var link$3 = [
20795         "as",
20796         "charset",
20797         "color",
20798         "crossorigin",
20799         "href",
20800         "hreflang",
20801         "imagesizes",
20802         "imagesrcset",
20803         "integrity",
20804         "media",
20805         "nonce",
20806         "referrerpolicy",
20807         "rel",
20808         "rev",
20809         "sizes",
20810         "target",
20811         "title",
20812         "type"
20813   ];
20814   var map = [
20815         "name"
20816   ];
20817   var menu = [
20818         "compact"
20819   ];
20820   var meta = [
20821         "charset",
20822         "content",
20823         "http-equiv",
20824         "name",
20825         "scheme"
20826   ];
20827   var meter = [
20828         "high",
20829         "low",
20830         "max",
20831         "min",
20832         "optimum",
20833         "value"
20834   ];
20835   var object = [
20836         "align",
20837         "archive",
20838         "border",
20839         "classid",
20840         "codebase",
20841         "codetype",
20842         "data",
20843         "declare",
20844         "form",
20845         "height",
20846         "hspace",
20847         "name",
20848         "standby",
20849         "tabindex",
20850         "type",
20851         "typemustmatch",
20852         "usemap",
20853         "vspace",
20854         "width"
20855   ];
20856   var ol = [
20857         "compact",
20858         "reversed",
20859         "start",
20860         "type"
20861   ];
20862   var optgroup = [
20863         "disabled",
20864         "label"
20865   ];
20866   var option = [
20867         "disabled",
20868         "label",
20869         "selected",
20870         "value"
20871   ];
20872   var output = [
20873         "for",
20874         "form",
20875         "name"
20876   ];
20877   var p = [
20878         "align"
20879   ];
20880   var param = [
20881         "name",
20882         "type",
20883         "value",
20884         "valuetype"
20885   ];
20886   var pre = [
20887         "width"
20888   ];
20889   var progress = [
20890         "max",
20891         "value"
20892   ];
20893   var q = [
20894         "cite"
20895   ];
20896   var script = [
20897         "async",
20898         "charset",
20899         "crossorigin",
20900         "defer",
20901         "integrity",
20902         "language",
20903         "nomodule",
20904         "nonce",
20905         "referrerpolicy",
20906         "src",
20907         "type"
20908   ];
20909   var select = [
20910         "autocomplete",
20911         "autofocus",
20912         "disabled",
20913         "form",
20914         "multiple",
20915         "name",
20916         "required",
20917         "size",
20918         "tabindex"
20919   ];
20920   var slot = [
20921         "name"
20922   ];
20923   var source$1 = [
20924         "media",
20925         "sizes",
20926         "src",
20927         "srcset",
20928         "type"
20929   ];
20930   var style = [
20931         "media",
20932         "nonce",
20933         "title",
20934         "type"
20935   ];
20936   var table = [
20937         "align",
20938         "bgcolor",
20939         "border",
20940         "cellpadding",
20941         "cellspacing",
20942         "frame",
20943         "rules",
20944         "summary",
20945         "width"
20946   ];
20947   var tbody = [
20948         "align",
20949         "char",
20950         "charoff",
20951         "valign"
20952   ];
20953   var td = [
20954         "abbr",
20955         "align",
20956         "axis",
20957         "bgcolor",
20958         "char",
20959         "charoff",
20960         "colspan",
20961         "headers",
20962         "height",
20963         "nowrap",
20964         "rowspan",
20965         "scope",
20966         "valign",
20967         "width"
20968   ];
20969   var textarea = [
20970         "accesskey",
20971         "autocomplete",
20972         "autofocus",
20973         "cols",
20974         "dirname",
20975         "disabled",
20976         "form",
20977         "maxlength",
20978         "minlength",
20979         "name",
20980         "placeholder",
20981         "readonly",
20982         "required",
20983         "rows",
20984         "tabindex",
20985         "wrap"
20986   ];
20987   var tfoot = [
20988         "align",
20989         "char",
20990         "charoff",
20991         "valign"
20992   ];
20993   var th = [
20994         "abbr",
20995         "align",
20996         "axis",
20997         "bgcolor",
20998         "char",
20999         "charoff",
21000         "colspan",
21001         "headers",
21002         "height",
21003         "nowrap",
21004         "rowspan",
21005         "scope",
21006         "valign",
21007         "width"
21008   ];
21009   var thead = [
21010         "align",
21011         "char",
21012         "charoff",
21013         "valign"
21014   ];
21015   var time = [
21016         "datetime"
21017   ];
21018   var tr = [
21019         "align",
21020         "bgcolor",
21021         "char",
21022         "charoff",
21023         "valign"
21024   ];
21025   var track = [
21026         "default",
21027         "kind",
21028         "label",
21029         "src",
21030         "srclang"
21031   ];
21032   var ul = [
21033         "compact",
21034         "type"
21035   ];
21036   var video = [
21037         "autoplay",
21038         "controls",
21039         "crossorigin",
21040         "height",
21041         "loop",
21042         "muted",
21043         "playsinline",
21044         "poster",
21045         "preload",
21046         "src",
21047         "width"
21048   ];
21049   var index$1 = {
21050         "*": [
21051         "accesskey",
21052         "autocapitalize",
21053         "autofocus",
21054         "class",
21055         "contenteditable",
21056         "dir",
21057         "draggable",
21058         "enterkeyhint",
21059         "hidden",
21060         "id",
21061         "inputmode",
21062         "is",
21063         "itemid",
21064         "itemprop",
21065         "itemref",
21066         "itemscope",
21067         "itemtype",
21068         "lang",
21069         "nonce",
21070         "slot",
21071         "spellcheck",
21072         "style",
21073         "tabindex",
21074         "title",
21075         "translate"
21076   ],
21077         a: a,
21078         abbr: abbr,
21079         applet: applet,
21080         area: area,
21081         audio: audio,
21082         base: base,
21083         basefont: basefont,
21084         bdo: bdo,
21085         blockquote: blockquote,
21086         body: body,
21087         br: br,
21088         button: button,
21089         canvas: canvas,
21090         caption: caption,
21091         col: col,
21092         colgroup: colgroup,
21093         data: data,
21094         del: del,
21095         details: details,
21096         dfn: dfn,
21097         dialog: dialog,
21098         dir: dir,
21099         div: div,
21100         dl: dl,
21101         embed: embed$1,
21102         fieldset: fieldset,
21103         font: font,
21104         form: form,
21105         frame: frame,
21106         frameset: frameset,
21107         h1: h1,
21108         h2: h2,
21109         h3: h3,
21110         h4: h4,
21111         h5: h5,
21112         h6: h6,
21113         head: head,
21114         hr: hr,
21115         html: html,
21116         iframe: iframe,
21117         img: img,
21118         input: input,
21119         ins: ins,
21120         isindex: isindex,
21121         label: label,
21122         legend: legend,
21123         li: li,
21124         link: link$3,
21125         map: map,
21126         menu: menu,
21127         meta: meta,
21128         meter: meter,
21129         object: object,
21130         ol: ol,
21131         optgroup: optgroup,
21132         option: option,
21133         output: output,
21134         p: p,
21135         param: param,
21136         pre: pre,
21137         progress: progress,
21138         q: q,
21139         script: script,
21140         select: select,
21141         slot: slot,
21142         source: source$1,
21143         style: style,
21144         table: table,
21145         tbody: tbody,
21146         td: td,
21147         textarea: textarea,
21148         tfoot: tfoot,
21149         th: th,
21150         thead: thead,
21151         time: time,
21152         tr: tr,
21153         track: track,
21154         ul: ul,
21155         video: video
21156   };
21157
21158   var htmlElementAttributes = /*#__PURE__*/Object.freeze({
21159     __proto__: null,
21160     a: a,
21161     abbr: abbr,
21162     applet: applet,
21163     area: area,
21164     audio: audio,
21165     base: base,
21166     basefont: basefont,
21167     bdo: bdo,
21168     blockquote: blockquote,
21169     body: body,
21170     br: br,
21171     button: button,
21172     canvas: canvas,
21173     caption: caption,
21174     col: col,
21175     colgroup: colgroup,
21176     data: data,
21177     del: del,
21178     details: details,
21179     dfn: dfn,
21180     dialog: dialog,
21181     dir: dir,
21182     div: div,
21183     dl: dl,
21184     embed: embed$1,
21185     fieldset: fieldset,
21186     font: font,
21187     form: form,
21188     frame: frame,
21189     frameset: frameset,
21190     h1: h1,
21191     h2: h2,
21192     h3: h3,
21193     h4: h4,
21194     h5: h5,
21195     h6: h6,
21196     head: head,
21197     hr: hr,
21198     html: html,
21199     iframe: iframe,
21200     img: img,
21201     input: input,
21202     ins: ins,
21203     isindex: isindex,
21204     label: label,
21205     legend: legend,
21206     li: li,
21207     link: link$3,
21208     map: map,
21209     menu: menu,
21210     meta: meta,
21211     meter: meter,
21212     object: object,
21213     ol: ol,
21214     optgroup: optgroup,
21215     option: option,
21216     output: output,
21217     p: p,
21218     param: param,
21219     pre: pre,
21220     progress: progress,
21221     q: q,
21222     script: script,
21223     select: select,
21224     slot: slot,
21225     source: source$1,
21226     style: style,
21227     table: table,
21228     tbody: tbody,
21229     td: td,
21230     textarea: textarea,
21231     tfoot: tfoot,
21232     th: th,
21233     thead: thead,
21234     time: time,
21235     tr: tr,
21236     track: track,
21237     ul: ul,
21238     video: video,
21239     'default': index$1
21240   });
21241
21242   var htmlTagNames$1 = getCjsExportFromNamespace(htmlTagNames);
21243
21244   var htmlElementAttributes$1 = getCjsExportFromNamespace(htmlElementAttributes);
21245
21246   const {
21247     CSS_DISPLAY_TAGS,
21248     CSS_DISPLAY_DEFAULT,
21249     CSS_WHITE_SPACE_TAGS,
21250     CSS_WHITE_SPACE_DEFAULT
21251   } = json;
21252   const HTML_TAGS = arrayToMap(htmlTagNames$1);
21253   const HTML_ELEMENT_ATTRIBUTES = mapObject(htmlElementAttributes$1, arrayToMap);
21254
21255   function arrayToMap(array) {
21256     const map = Object.create(null);
21257
21258     for (const value of array) {
21259       map[value] = true;
21260     }
21261
21262     return map;
21263   }
21264
21265   function mapObject(object, fn) {
21266     const newObject = Object.create(null);
21267
21268     for (const key of Object.keys(object)) {
21269       newObject[key] = fn(object[key], key);
21270     }
21271
21272     return newObject;
21273   }
21274
21275   function shouldPreserveContent(node, options) {
21276     if (!node.endSourceSpan) {
21277       return false;
21278     }
21279
21280     if (node.type === "element" && node.fullName === "template" && node.attrMap.lang && node.attrMap.lang !== "html") {
21281       return true;
21282     } // unterminated node in ie conditional comment
21283     // e.g. <!--[if lt IE 9]><html><![endif]-->
21284
21285
21286     if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) {
21287       return true;
21288     } // incomplete html in ie conditional comment
21289     // e.g. <!--[if lt IE 9]></div><![endif]-->
21290
21291
21292     if (node.type === "ieConditionalComment" && !node.complete) {
21293       return true;
21294     } // top-level elements (excluding <template>, <style> and <script>) in Vue SFC are considered custom block
21295     // custom blocks can be written in other languages so we should preserve them to not break the code
21296
21297
21298     if (options.parser === "vue" && node.type === "element" && node.parent.type === "root" && !["template", "style", "script", // vue parser can be used for vue dom template as well, so we should still format top-level <html>
21299     "html"].includes(node.fullName)) {
21300       return true;
21301     } // TODO: handle non-text children in <pre>
21302
21303
21304     if (isPreLikeNode(node) && node.children.some(child => child.type !== "text" && child.type !== "interpolation")) {
21305       return true;
21306     }
21307
21308     return false;
21309   }
21310
21311   function hasPrettierIgnore$2(node) {
21312     if (node.type === "attribute") {
21313       return false;
21314     }
21315
21316     if (!node.parent) {
21317       return false;
21318     }
21319
21320     if (typeof node.index !== "number" || node.index === 0) {
21321       return false;
21322     }
21323
21324     const prevNode = node.parent.children[node.index - 1];
21325     return isPrettierIgnore(prevNode);
21326   }
21327
21328   function isPrettierIgnore(node) {
21329     return node.type === "comment" && node.value.trim() === "prettier-ignore";
21330   }
21331
21332   function getPrettierIgnoreAttributeCommentData(value) {
21333     const match = value.trim().match(/^prettier-ignore-attribute(?:\s+([^]+))?$/);
21334
21335     if (!match) {
21336       return false;
21337     }
21338
21339     if (!match[1]) {
21340       return true;
21341     }
21342
21343     return match[1].split(/\s+/);
21344   }
21345   /** there's no opening/closing tag or it's considered not breakable */
21346
21347
21348   function isTextLikeNode(node) {
21349     return node.type === "text" || node.type === "comment";
21350   }
21351
21352   function isScriptLikeTag(node) {
21353     return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style"));
21354   }
21355
21356   function isFrontMatterNode(node) {
21357     return node.type === "yaml" || node.type === "toml";
21358   }
21359
21360   function canHaveInterpolation(node) {
21361     return node.children && !isScriptLikeTag(node);
21362   }
21363
21364   function isWhitespaceSensitiveNode(node) {
21365     return isScriptLikeTag(node) || node.type === "interpolation" || isIndentationSensitiveNode(node);
21366   }
21367
21368   function isIndentationSensitiveNode(node) {
21369     return getNodeCssStyleWhiteSpace(node).startsWith("pre");
21370   }
21371
21372   function isLeadingSpaceSensitiveNode(node) {
21373     const isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
21374
21375     if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
21376       return node.type === "interpolation";
21377     }
21378
21379     return isLeadingSpaceSensitive;
21380
21381     function _isLeadingSpaceSensitiveNode() {
21382       if (isFrontMatterNode(node)) {
21383         return false;
21384       }
21385
21386       if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
21387         return true;
21388       }
21389
21390       if (!node.parent || node.parent.cssDisplay === "none") {
21391         return false;
21392       }
21393
21394       if (isPreLikeNode(node.parent)) {
21395         return true;
21396       }
21397
21398       if (!node.prev && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
21399         return false;
21400       }
21401
21402       if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
21403         return false;
21404       }
21405
21406       return true;
21407     }
21408   }
21409
21410   function isTrailingSpaceSensitiveNode(node) {
21411     if (isFrontMatterNode(node)) {
21412       return false;
21413     }
21414
21415     if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) {
21416       return true;
21417     }
21418
21419     if (!node.parent || node.parent.cssDisplay === "none") {
21420       return false;
21421     }
21422
21423     if (isPreLikeNode(node.parent)) {
21424       return true;
21425     }
21426
21427     if (!node.next && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || !isLastChildTrailingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
21428       return false;
21429     }
21430
21431     if (node.next && !isPrevTrailingSpaceSensitiveCssDisplay(node.next.cssDisplay)) {
21432       return false;
21433     }
21434
21435     return true;
21436   }
21437
21438   function isDanglingSpaceSensitiveNode(node) {
21439     return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag(node);
21440   }
21441
21442   function forceNextEmptyLine(node) {
21443     return isFrontMatterNode(node) || node.next && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line;
21444   }
21445   /** firstChild leadingSpaces and lastChild trailingSpaces */
21446
21447
21448   function forceBreakContent(node) {
21449     return forceBreakChildren(node) || node.type === "element" && node.children.length !== 0 && (["body", "script", "style"].includes(node.name) || node.children.some(child => hasNonTextChild(child))) || node.firstChild && node.firstChild === node.lastChild && hasLeadingLineBreak(node.firstChild) && (!node.lastChild.isTrailingSpaceSensitive || hasTrailingLineBreak(node.lastChild));
21450   }
21451   /** spaces between children */
21452
21453
21454   function forceBreakChildren(node) {
21455     return node.type === "element" && node.children.length !== 0 && (["html", "head", "ul", "ol", "select"].includes(node.name) || node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell");
21456   }
21457
21458   function preferHardlineAsLeadingSpaces(node) {
21459     return preferHardlineAsSurroundingSpaces(node) || node.prev && preferHardlineAsTrailingSpaces(node.prev) || hasSurroundingLineBreak(node);
21460   }
21461
21462   function preferHardlineAsTrailingSpaces(node) {
21463     return preferHardlineAsSurroundingSpaces(node) || node.type === "element" && node.fullName === "br" || hasSurroundingLineBreak(node);
21464   }
21465
21466   function hasSurroundingLineBreak(node) {
21467     return hasLeadingLineBreak(node) && hasTrailingLineBreak(node);
21468   }
21469
21470   function hasLeadingLineBreak(node) {
21471     return node.hasLeadingSpaces && (node.prev ? node.prev.sourceSpan.end.line < node.sourceSpan.start.line : node.parent.type === "root" || node.parent.startSourceSpan.end.line < node.sourceSpan.start.line);
21472   }
21473
21474   function hasTrailingLineBreak(node) {
21475     return node.hasTrailingSpaces && (node.next ? node.next.sourceSpan.start.line > node.sourceSpan.end.line : node.parent.type === "root" || node.parent.endSourceSpan && node.parent.endSourceSpan.start.line > node.sourceSpan.end.line);
21476   }
21477
21478   function preferHardlineAsSurroundingSpaces(node) {
21479     switch (node.type) {
21480       case "ieConditionalComment":
21481       case "comment":
21482       case "directive":
21483         return true;
21484
21485       case "element":
21486         return ["script", "select"].includes(node.name);
21487     }
21488
21489     return false;
21490   }
21491
21492   function getLastDescendant(node) {
21493     return node.lastChild ? getLastDescendant(node.lastChild) : node;
21494   }
21495
21496   function hasNonTextChild(node) {
21497     return node.children && node.children.some(child => child.type !== "text");
21498   }
21499
21500   function inferScriptParser(node) {
21501     if (node.name === "script" && !node.attrMap.src) {
21502       if (!node.attrMap.lang && !node.attrMap.type || node.attrMap.type === "module" || node.attrMap.type === "text/javascript" || node.attrMap.type === "text/babel" || node.attrMap.type === "application/javascript" || node.attrMap.lang === "jsx") {
21503         return "babel";
21504       }
21505
21506       if (node.attrMap.type === "application/x-typescript" || node.attrMap.lang === "ts" || node.attrMap.lang === "tsx") {
21507         return "typescript";
21508       }
21509
21510       if (node.attrMap.type === "text/markdown") {
21511         return "markdown";
21512       }
21513
21514       if (node.attrMap.type.endsWith("json") || node.attrMap.type.endsWith("importmap")) {
21515         return "json";
21516       }
21517
21518       if (node.attrMap.type === "text/x-handlebars-template") {
21519         return "glimmer";
21520       }
21521     }
21522
21523     if (node.name === "style") {
21524       if (!node.attrMap.lang || node.attrMap.lang === "postcss" || node.attrMap.lang === "css") {
21525         return "css";
21526       }
21527
21528       if (node.attrMap.lang === "scss") {
21529         return "scss";
21530       }
21531
21532       if (node.attrMap.lang === "less") {
21533         return "less";
21534       }
21535     }
21536
21537     return null;
21538   }
21539
21540   function isBlockLikeCssDisplay(cssDisplay) {
21541     return cssDisplay === "block" || cssDisplay === "list-item" || cssDisplay.startsWith("table");
21542   }
21543
21544   function isFirstChildLeadingSpaceSensitiveCssDisplay(cssDisplay) {
21545     return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
21546   }
21547
21548   function isLastChildTrailingSpaceSensitiveCssDisplay(cssDisplay) {
21549     return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
21550   }
21551
21552   function isPrevTrailingSpaceSensitiveCssDisplay(cssDisplay) {
21553     return !isBlockLikeCssDisplay(cssDisplay);
21554   }
21555
21556   function isNextLeadingSpaceSensitiveCssDisplay(cssDisplay) {
21557     return !isBlockLikeCssDisplay(cssDisplay);
21558   }
21559
21560   function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
21561     return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
21562   }
21563
21564   function isPreLikeNode(node) {
21565     return getNodeCssStyleWhiteSpace(node).startsWith("pre");
21566   }
21567
21568   function countParents(path, predicate = () => true) {
21569     let counter = 0;
21570
21571     for (let i = path.stack.length - 1; i >= 0; i--) {
21572       const value = path.stack[i];
21573
21574       if (value && typeof value === "object" && !Array.isArray(value) && predicate(value)) {
21575         counter++;
21576       }
21577     }
21578
21579     return counter;
21580   }
21581
21582   function hasParent(node, fn) {
21583     let current = node;
21584
21585     while (current) {
21586       if (fn(current)) {
21587         return true;
21588       }
21589
21590       current = current.parent;
21591     }
21592
21593     return false;
21594   }
21595
21596   function getNodeCssStyleDisplay(node, options) {
21597     if (node.prev && node.prev.type === "comment") {
21598       // <!-- display: block -->
21599       const match = node.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);
21600
21601       if (match) {
21602         return match[1];
21603       }
21604     }
21605
21606     let isInSvgForeignObject = false;
21607
21608     if (node.type === "element" && node.namespace === "svg") {
21609       if (hasParent(node, parent => parent.fullName === "svg:foreignObject")) {
21610         isInSvgForeignObject = true;
21611       } else {
21612         return node.name === "svg" ? "inline-block" : "block";
21613       }
21614     }
21615
21616     switch (options.htmlWhitespaceSensitivity) {
21617       case "strict":
21618         return "inline";
21619
21620       case "ignore":
21621         return "block";
21622
21623       default:
21624         return node.type === "element" && (!node.namespace || isInSvgForeignObject || isUnknownNamespace(node)) && CSS_DISPLAY_TAGS[node.name] || CSS_DISPLAY_DEFAULT;
21625     }
21626   }
21627
21628   function isUnknownNamespace(node) {
21629     return node.type === "element" && !node.hasExplicitNamespace && !["html", "svg"].includes(node.namespace);
21630   }
21631
21632   function getNodeCssStyleWhiteSpace(node) {
21633     return node.type === "element" && (!node.namespace || isUnknownNamespace(node)) && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
21634   }
21635
21636   function getMinIndentation(text) {
21637     let minIndentation = Infinity;
21638
21639     for (const lineText of text.split("\n")) {
21640       if (lineText.length === 0) {
21641         continue;
21642       }
21643
21644       if (/\S/.test(lineText[0])) {
21645         return 0;
21646       }
21647
21648       const indentation = lineText.match(/^\s*/)[0].length;
21649
21650       if (lineText.length === indentation) {
21651         continue;
21652       }
21653
21654       if (indentation < minIndentation) {
21655         minIndentation = indentation;
21656       }
21657     }
21658
21659     return minIndentation === Infinity ? 0 : minIndentation;
21660   }
21661
21662   function dedentString(text, minIndent = getMinIndentation(text)) {
21663     return minIndent === 0 ? text : text.split("\n").map(lineText => lineText.slice(minIndent)).join("\n");
21664   }
21665
21666   function normalizeParts(parts) {
21667     const newParts = [];
21668     const restParts = parts.slice();
21669
21670     while (restParts.length !== 0) {
21671       const part = restParts.shift();
21672
21673       if (!part) {
21674         continue;
21675       }
21676
21677       if (part.type === "concat") {
21678         restParts.unshift(...part.parts);
21679         continue;
21680       }
21681
21682       if (newParts.length !== 0 && typeof newParts[newParts.length - 1] === "string" && typeof part === "string") {
21683         newParts.push(newParts.pop() + part);
21684         continue;
21685       }
21686
21687       newParts.push(part);
21688     }
21689
21690     return newParts;
21691   }
21692
21693   function identity(x) {
21694     return x;
21695   }
21696
21697   function shouldNotPrintClosingTag(node, options) {
21698     return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore$2(node) || shouldPreserveContent(node.parent, options));
21699   }
21700
21701   function countChars(text, char) {
21702     let counter = 0;
21703
21704     for (let i = 0; i < text.length; i++) {
21705       if (text[i] === char) {
21706         counter++;
21707       }
21708     }
21709
21710     return counter;
21711   }
21712
21713   function unescapeQuoteEntities(text) {
21714     return text.replace(/&apos;/g, "'").replace(/&quot;/g, '"');
21715   }
21716
21717   var utils$4 = {
21718     HTML_ELEMENT_ATTRIBUTES,
21719     HTML_TAGS,
21720     canHaveInterpolation,
21721     countChars,
21722     countParents,
21723     dedentString,
21724     forceBreakChildren,
21725     forceBreakContent,
21726     forceNextEmptyLine,
21727     getLastDescendant,
21728     getNodeCssStyleDisplay,
21729     getNodeCssStyleWhiteSpace,
21730     getPrettierIgnoreAttributeCommentData,
21731     hasPrettierIgnore: hasPrettierIgnore$2,
21732     identity,
21733     inferScriptParser,
21734     isDanglingSpaceSensitiveNode,
21735     isFrontMatterNode,
21736     isIndentationSensitiveNode,
21737     isLeadingSpaceSensitiveNode,
21738     isPreLikeNode,
21739     isScriptLikeTag,
21740     isTextLikeNode,
21741     isTrailingSpaceSensitiveNode,
21742     isWhitespaceSensitiveNode,
21743     isUnknownNamespace,
21744     normalizeParts,
21745     preferHardlineAsLeadingSpaces,
21746     preferHardlineAsTrailingSpaces,
21747     shouldNotPrintClosingTag,
21748     shouldPreserveContent,
21749     unescapeQuoteEntities
21750   };
21751
21752   const {
21753     canHaveInterpolation: canHaveInterpolation$1,
21754     getNodeCssStyleDisplay: getNodeCssStyleDisplay$1,
21755     isDanglingSpaceSensitiveNode: isDanglingSpaceSensitiveNode$1,
21756     isIndentationSensitiveNode: isIndentationSensitiveNode$1,
21757     isLeadingSpaceSensitiveNode: isLeadingSpaceSensitiveNode$1,
21758     isTrailingSpaceSensitiveNode: isTrailingSpaceSensitiveNode$1,
21759     isWhitespaceSensitiveNode: isWhitespaceSensitiveNode$1
21760   } = utils$4;
21761   const PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIeConditonalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText];
21762
21763   function preprocess(ast, options) {
21764     for (const fn of PREPROCESS_PIPELINE) {
21765       ast = fn(ast, options);
21766     }
21767
21768     return ast;
21769   }
21770
21771   function removeIgnorableFirstLf(ast
21772   /*, options */
21773   ) {
21774     return ast.map(node => {
21775       if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length !== 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
21776         const [text, ...rest] = node.children;
21777         return node.clone({
21778           children: text.value.length === 1 ? rest : [text.clone({
21779             value: text.value.slice(1)
21780           }), ...rest]
21781         });
21782       }
21783
21784       return node;
21785     });
21786   }
21787
21788   function mergeIeConditonalStartEndCommentIntoElementOpeningTag(ast
21789   /*, options */
21790   ) {
21791     /**
21792      *     <!--[if ...]><!--><target><!--<![endif]-->
21793      */
21794     const isTarget = node => node.type === "element" && node.prev && node.prev.type === "ieConditionalStartComment" && node.prev.sourceSpan.end.offset === node.startSourceSpan.start.offset && node.firstChild && node.firstChild.type === "ieConditionalEndComment" && node.firstChild.sourceSpan.start.offset === node.startSourceSpan.end.offset;
21795
21796     return ast.map(node => {
21797       if (node.children) {
21798         const isTargetResults = node.children.map(isTarget);
21799
21800         if (isTargetResults.some(Boolean)) {
21801           const newChildren = [];
21802
21803           for (let i = 0; i < node.children.length; i++) {
21804             const child = node.children[i];
21805
21806             if (isTargetResults[i + 1]) {
21807               // ieConditionalStartComment
21808               continue;
21809             }
21810
21811             if (isTargetResults[i]) {
21812               const ieConditionalStartComment = child.prev;
21813               const ieConditionalEndComment = child.firstChild;
21814               const ParseSourceSpan = child.sourceSpan.constructor;
21815               const startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
21816               const sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
21817               newChildren.push(child.clone({
21818                 condition: ieConditionalStartComment.condition,
21819                 sourceSpan,
21820                 startSourceSpan,
21821                 children: child.children.slice(1)
21822               }));
21823               continue;
21824             }
21825
21826             newChildren.push(child);
21827           }
21828
21829           return node.clone({
21830             children: newChildren
21831           });
21832         }
21833       }
21834
21835       return node;
21836     });
21837   }
21838
21839   function mergeNodeIntoText(ast, shouldMerge, getValue) {
21840     return ast.map(node => {
21841       if (node.children) {
21842         const shouldMergeResults = node.children.map(shouldMerge);
21843
21844         if (shouldMergeResults.some(Boolean)) {
21845           const newChildren = [];
21846
21847           for (let i = 0; i < node.children.length; i++) {
21848             const child = node.children[i];
21849
21850             if (child.type !== "text" && !shouldMergeResults[i]) {
21851               newChildren.push(child);
21852               continue;
21853             }
21854
21855             const newChild = child.type === "text" ? child : child.clone({
21856               type: "text",
21857               value: getValue(child)
21858             });
21859
21860             if (newChildren.length === 0 || newChildren[newChildren.length - 1].type !== "text") {
21861               newChildren.push(newChild);
21862               continue;
21863             }
21864
21865             const lastChild = newChildren.pop();
21866             const ParseSourceSpan = lastChild.sourceSpan.constructor;
21867             newChildren.push(lastChild.clone({
21868               value: lastChild.value + newChild.value,
21869               sourceSpan: new ParseSourceSpan(lastChild.sourceSpan.start, newChild.sourceSpan.end)
21870             }));
21871           }
21872
21873           return node.clone({
21874             children: newChildren
21875           });
21876         }
21877       }
21878
21879       return node;
21880     });
21881   }
21882
21883   function mergeCdataIntoText(ast
21884   /*, options */
21885   ) {
21886     return mergeNodeIntoText(ast, node => node.type === "cdata", node => "<![CDATA[".concat(node.value, "]]>"));
21887   }
21888
21889   function mergeSimpleElementIntoText(ast
21890   /*, options */
21891   ) {
21892     const isSimpleElement = node => node.type === "element" && node.attrs.length === 0 && node.children.length === 1 && node.firstChild.type === "text" && // \xA0: non-breaking whitespace
21893     !/[^\S\xA0]/.test(node.children[0].value) && !node.firstChild.hasLeadingSpaces && !node.firstChild.hasTrailingSpaces && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces && node.prev && node.prev.type === "text" && node.next && node.next.type === "text";
21894
21895     return ast.map(node => {
21896       if (node.children) {
21897         const isSimpleElementResults = node.children.map(isSimpleElement);
21898
21899         if (isSimpleElementResults.some(Boolean)) {
21900           const newChildren = [];
21901
21902           for (let i = 0; i < node.children.length; i++) {
21903             const child = node.children[i];
21904
21905             if (isSimpleElementResults[i]) {
21906               const lastChild = newChildren.pop();
21907               const nextChild = node.children[++i];
21908               const ParseSourceSpan = node.sourceSpan.constructor;
21909               const {
21910                 isTrailingSpaceSensitive,
21911                 hasTrailingSpaces
21912               } = nextChild;
21913               newChildren.push(lastChild.clone({
21914                 value: lastChild.value + "<".concat(child.rawName, ">") + child.firstChild.value + "</".concat(child.rawName, ">") + nextChild.value,
21915                 sourceSpan: new ParseSourceSpan(lastChild.sourceSpan.start, nextChild.sourceSpan.end),
21916                 isTrailingSpaceSensitive,
21917                 hasTrailingSpaces
21918               }));
21919             } else {
21920               newChildren.push(child);
21921             }
21922           }
21923
21924           return node.clone({
21925             children: newChildren
21926           });
21927         }
21928       }
21929
21930       return node;
21931     });
21932   }
21933
21934   function extractInterpolation(ast, options) {
21935     if (options.parser === "html") {
21936       return ast;
21937     }
21938
21939     const interpolationRegex = /\{\{([\s\S]+?)\}\}/g;
21940     return ast.map(node => {
21941       if (!canHaveInterpolation$1(node)) {
21942         return node;
21943       }
21944
21945       const newChildren = [];
21946
21947       for (const child of node.children) {
21948         if (child.type !== "text") {
21949           newChildren.push(child);
21950           continue;
21951         }
21952
21953         const ParseSourceSpan = child.sourceSpan.constructor;
21954         let startSourceSpan = child.sourceSpan.start;
21955         let endSourceSpan = null;
21956         const components = child.value.split(interpolationRegex);
21957
21958         for (let i = 0; i < components.length; i++, startSourceSpan = endSourceSpan) {
21959           const value = components[i];
21960
21961           if (i % 2 === 0) {
21962             endSourceSpan = startSourceSpan.moveBy(value.length);
21963
21964             if (value.length !== 0) {
21965               newChildren.push({
21966                 type: "text",
21967                 value,
21968                 sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan)
21969               });
21970             }
21971
21972             continue;
21973           }
21974
21975           endSourceSpan = startSourceSpan.moveBy(value.length + 4); // `{{` + `}}`
21976
21977           newChildren.push({
21978             type: "interpolation",
21979             sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan),
21980             children: value.length === 0 ? [] : [{
21981               type: "text",
21982               value,
21983               sourceSpan: new ParseSourceSpan(startSourceSpan.moveBy(2), endSourceSpan.moveBy(-2))
21984             }]
21985           });
21986         }
21987       }
21988
21989       return node.clone({
21990         children: newChildren
21991       });
21992     });
21993   }
21994   /**
21995    * - add `hasLeadingSpaces` field
21996    * - add `hasTrailingSpaces` field
21997    * - add `hasDanglingSpaces` field for parent nodes
21998    * - add `isWhitespaceSensitive`, `isIndentationSensitive` field for text nodes
21999    * - remove insensitive whitespaces
22000    */
22001
22002
22003   function extractWhitespaces(ast
22004   /*, options*/
22005   ) {
22006     const TYPE_WHITESPACE = "whitespace";
22007     return ast.map(node => {
22008       if (!node.children) {
22009         return node;
22010       }
22011
22012       if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && node.children[0].value.trim().length === 0) {
22013         return node.clone({
22014           children: [],
22015           hasDanglingSpaces: node.children.length !== 0
22016         });
22017       }
22018
22019       const isWhitespaceSensitive = isWhitespaceSensitiveNode$1(node);
22020       const isIndentationSensitive = isIndentationSensitiveNode$1(node);
22021       return node.clone({
22022         isWhitespaceSensitive,
22023         isIndentationSensitive,
22024         children: node.children // extract whitespace nodes
22025         .reduce((newChildren, child) => {
22026           if (child.type !== "text" || isWhitespaceSensitive) {
22027             return newChildren.concat(child);
22028           }
22029
22030           const localChildren = [];
22031           const [, leadingSpaces, text, trailingSpaces] = child.value.match(/^(\s*)([\s\S]*?)(\s*)$/);
22032
22033           if (leadingSpaces) {
22034             localChildren.push({
22035               type: TYPE_WHITESPACE
22036             });
22037           }
22038
22039           const ParseSourceSpan = child.sourceSpan.constructor;
22040
22041           if (text) {
22042             localChildren.push({
22043               type: "text",
22044               value: text,
22045               sourceSpan: new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingSpaces.length), child.sourceSpan.end.moveBy(-trailingSpaces.length))
22046             });
22047           }
22048
22049           if (trailingSpaces) {
22050             localChildren.push({
22051               type: TYPE_WHITESPACE
22052             });
22053           }
22054
22055           return newChildren.concat(localChildren);
22056         }, []) // set hasLeadingSpaces/hasTrailingSpaces and filter whitespace nodes
22057         .reduce((newChildren, child, i, children) => {
22058           if (child.type === TYPE_WHITESPACE) {
22059             return newChildren;
22060           }
22061
22062           const hasLeadingSpaces = i !== 0 && children[i - 1].type === TYPE_WHITESPACE;
22063           const hasTrailingSpaces = i !== children.length - 1 && children[i + 1].type === TYPE_WHITESPACE;
22064           return newChildren.concat(Object.assign({}, child, {
22065             hasLeadingSpaces,
22066             hasTrailingSpaces
22067           }));
22068         }, [])
22069       });
22070     });
22071   }
22072
22073   function addIsSelfClosing(ast
22074   /*, options */
22075   ) {
22076     return ast.map(node => Object.assign(node, {
22077       isSelfClosing: !node.children || node.type === "element" && (node.tagDefinition.isVoid || // self-closing
22078       node.startSourceSpan === node.endSourceSpan)
22079     }));
22080   }
22081
22082   function addHasHtmComponentClosingTag(ast, options) {
22083     return ast.map(node => node.type !== "element" ? node : Object.assign(node, {
22084       hasHtmComponentClosingTag: node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset))
22085     }));
22086   }
22087
22088   function addCssDisplay(ast, options) {
22089     return ast.map(node => Object.assign(node, {
22090       cssDisplay: getNodeCssStyleDisplay$1(node, options)
22091     }));
22092   }
22093   /**
22094    * - add `isLeadingSpaceSensitive` field
22095    * - add `isTrailingSpaceSensitive` field
22096    * - add `isDanglingSpaceSensitive` field for parent nodes
22097    */
22098
22099
22100   function addIsSpaceSensitive(ast
22101   /*, options */
22102   ) {
22103     return ast.map(node => {
22104       if (!node.children) {
22105         return node;
22106       }
22107
22108       if (node.children.length === 0) {
22109         return node.clone({
22110           isDanglingSpaceSensitive: isDanglingSpaceSensitiveNode$1(node)
22111         });
22112       }
22113
22114       return node.clone({
22115         children: node.children.map(child => {
22116           return Object.assign({}, child, {
22117             isLeadingSpaceSensitive: isLeadingSpaceSensitiveNode$1(child),
22118             isTrailingSpaceSensitive: isTrailingSpaceSensitiveNode$1(child)
22119           });
22120         }).map((child, index, children) => Object.assign({}, child, {
22121           isLeadingSpaceSensitive: index === 0 ? child.isLeadingSpaceSensitive : children[index - 1].isTrailingSpaceSensitive && child.isLeadingSpaceSensitive,
22122           isTrailingSpaceSensitive: index === children.length - 1 ? child.isTrailingSpaceSensitive : children[index + 1].isLeadingSpaceSensitive && child.isTrailingSpaceSensitive
22123         }))
22124       });
22125     });
22126   }
22127
22128   var preprocess_1 = preprocess;
22129
22130   function hasPragma$3(text) {
22131     return /^\s*<!--\s*@(format|prettier)\s*-->/.test(text);
22132   }
22133
22134   function insertPragma$5(text) {
22135     return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
22136   }
22137
22138   var pragma$3 = {
22139     hasPragma: hasPragma$3,
22140     insertPragma: insertPragma$5
22141   };
22142
22143   const {
22144     builders: {
22145       concat: concat$8,
22146       group: group$8
22147     }
22148   } = document;
22149   /**
22150    *     v-for="... in ..."
22151    *     v-for="... of ..."
22152    *     v-for="(..., ...) in ..."
22153    *     v-for="(..., ...) of ..."
22154    */
22155
22156   function printVueFor(value, textToDoc) {
22157     const {
22158       left,
22159       operator,
22160       right
22161     } = parseVueFor(value);
22162     return concat$8([group$8(textToDoc("function _(".concat(left, ") {}"), {
22163       parser: "babel",
22164       __isVueForBindingLeft: true
22165     })), " ", operator, " ", textToDoc(right, {
22166       parser: "__js_expression"
22167     })]);
22168   } // modified from https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/parser/index.js#L370-L387
22169
22170
22171   function parseVueFor(value) {
22172     const forAliasRE = /([^]*?)\s+(in|of)\s+([^]*)/;
22173     const forIteratorRE = /,([^,}\]]*)(?:,([^,}\]]*))?$/;
22174     const stripParensRE = /^\(|\)$/g;
22175     const inMatch = value.match(forAliasRE);
22176
22177     if (!inMatch) {
22178       return;
22179     }
22180
22181     const res = {};
22182     res.for = inMatch[3].trim();
22183     const alias = inMatch[1].trim().replace(stripParensRE, "");
22184     const iteratorMatch = alias.match(forIteratorRE);
22185
22186     if (iteratorMatch) {
22187       res.alias = alias.replace(forIteratorRE, "");
22188       res.iterator1 = iteratorMatch[1].trim();
22189
22190       if (iteratorMatch[2]) {
22191         res.iterator2 = iteratorMatch[2].trim();
22192       }
22193     } else {
22194       res.alias = alias;
22195     }
22196
22197     return {
22198       left: "".concat([res.alias, res.iterator1, res.iterator2].filter(Boolean).join(",")),
22199       operator: inMatch[2],
22200       right: res.for
22201     };
22202   }
22203
22204   function printVueSlotScope(value, textToDoc) {
22205     return textToDoc("function _(".concat(value, ") {}"), {
22206       parser: "babel",
22207       __isVueSlotScope: true
22208     });
22209   }
22210
22211   function isVueEventBindingExpression(eventBindingValue) {
22212     // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/codegen/events.js#L3-L4
22213     // arrow function or anonymous function
22214     const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/; // simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b])
22215
22216     const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/; // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/helpers.js#L104
22217
22218     const value = eventBindingValue.trim();
22219     return fnExpRE.test(value) || simplePathRE.test(value);
22220   }
22221
22222   var syntaxVue = {
22223     isVueEventBindingExpression,
22224     printVueFor,
22225     printVueSlotScope
22226   };
22227
22228   const integerRegex = /^\d+$/;
22229
22230   function deepUnique(array) {
22231     return array.sort().filter((element, index) => {
22232       return JSON.stringify(element) !== JSON.stringify(array[index - 1]);
22233     });
22234   }
22235
22236   var parse$2 = string => {
22237     return deepUnique(string.split(',').map(part => {
22238       const result = {};
22239       part.trim().split(/\s+/).forEach((element, index) => {
22240         if (index === 0) {
22241           result.url = element;
22242           return;
22243         }
22244
22245         const value = element.slice(0, element.length - 1);
22246         const postfix = element[element.length - 1];
22247         const integerValue = parseInt(value, 10);
22248         const floatValue = parseFloat(value);
22249
22250         if (postfix === 'w' && integerRegex.test(value)) {
22251           result.width = integerValue;
22252         } else if (postfix === 'h' && integerRegex.test(value)) {
22253           result.height = integerValue;
22254         } else if (postfix === 'x' && !Number.isNaN(floatValue)) {
22255           result.density = floatValue;
22256         } else {
22257           throw new Error("Invalid srcset descriptor: ".concat(element));
22258         }
22259       });
22260       return result;
22261     }));
22262   };
22263
22264   var stringify = array => {
22265     return [...new Set(array.map(element => {
22266       if (!element.url) {
22267         throw new Error('URL is required');
22268       }
22269
22270       const result = [element.url];
22271
22272       if (element.width) {
22273         result.push("".concat(element.width, "w"));
22274       }
22275
22276       if (element.height) {
22277         result.push("".concat(element.height, "h"));
22278       }
22279
22280       if (element.density) {
22281         result.push("".concat(element.density, "x"));
22282       }
22283
22284       return result.join(' ');
22285     }))].join(', ');
22286   };
22287
22288   var srcset = {
22289     parse: parse$2,
22290     stringify: stringify
22291   };
22292
22293   const {
22294     builders: {
22295       concat: concat$9,
22296       ifBreak: ifBreak$4,
22297       join: join$5,
22298       line: line$5
22299     }
22300   } = document;
22301   const parseSrcset = srcset.parse;
22302
22303   function printImgSrcset(value) {
22304     const srcset = parseSrcset(value);
22305     const hasW = srcset.some(src => src.width);
22306     const hasH = srcset.some(src => src.height);
22307     const hasX = srcset.some(src => src.density);
22308
22309     if (hasW + hasH + hasX > 1) {
22310       throw new Error("Mixed descriptor in srcset is not supported");
22311     }
22312
22313     const key = hasW ? "width" : hasH ? "height" : "density";
22314     const unit = hasW ? "w" : hasH ? "h" : "x";
22315
22316     const getMax = values => Math.max(...values);
22317
22318     const urls = srcset.map(src => src.url);
22319     const maxUrlLength = getMax(urls.map(url => url.length));
22320     const descriptors = srcset.map(src => src[key]).map(descriptor => descriptor ? descriptor.toString() : "");
22321     const descriptorLeftLengths = descriptors.map(descriptor => {
22322       const index = descriptor.indexOf(".");
22323       return index === -1 ? descriptor.length : index;
22324     });
22325     const maxDescriptorLeftLength = getMax(descriptorLeftLengths);
22326     return join$5(concat$9([",", line$5]), urls.map((url, index) => {
22327       const parts = [url];
22328       const descriptor = descriptors[index];
22329
22330       if (descriptor) {
22331         const urlPadding = maxUrlLength - url.length + 1;
22332         const descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
22333         const alignment = " ".repeat(urlPadding + descriptorPadding);
22334         parts.push(ifBreak$4(alignment, " "), descriptor + unit);
22335       }
22336
22337       return concat$9(parts);
22338     }));
22339   }
22340
22341   function printClassNames(value) {
22342     return value.trim().split(/\s+/).join(" ");
22343   }
22344
22345   var syntaxAttribute = {
22346     printImgSrcset,
22347     printClassNames
22348   };
22349
22350   const {
22351     builders,
22352     utils: {
22353       stripTrailingHardline: stripTrailingHardline$1,
22354       mapDoc: mapDoc$2
22355     }
22356   } = document;
22357   const {
22358     breakParent: breakParent$2,
22359     dedentToRoot: dedentToRoot$1,
22360     fill: fill$3,
22361     group: group$9,
22362     hardline: hardline$7,
22363     ifBreak: ifBreak$5,
22364     indent: indent$5,
22365     join: join$6,
22366     line: line$6,
22367     literalline: literalline$2,
22368     markAsRoot: markAsRoot$2,
22369     softline: softline$4
22370   } = builders;
22371   const {
22372     countChars: countChars$1,
22373     countParents: countParents$1,
22374     dedentString: dedentString$1,
22375     forceBreakChildren: forceBreakChildren$1,
22376     forceBreakContent: forceBreakContent$1,
22377     forceNextEmptyLine: forceNextEmptyLine$1,
22378     getLastDescendant: getLastDescendant$1,
22379     getPrettierIgnoreAttributeCommentData: getPrettierIgnoreAttributeCommentData$1,
22380     hasPrettierIgnore: hasPrettierIgnore$3,
22381     inferScriptParser: inferScriptParser$1,
22382     isScriptLikeTag: isScriptLikeTag$1,
22383     isTextLikeNode: isTextLikeNode$1,
22384     normalizeParts: normalizeParts$1,
22385     preferHardlineAsLeadingSpaces: preferHardlineAsLeadingSpaces$1,
22386     shouldNotPrintClosingTag: shouldNotPrintClosingTag$1,
22387     shouldPreserveContent: shouldPreserveContent$1,
22388     unescapeQuoteEntities: unescapeQuoteEntities$1
22389   } = utils$4;
22390   const {
22391     replaceEndOfLineWith: replaceEndOfLineWith$1
22392   } = util$1;
22393   const {
22394     insertPragma: insertPragma$6
22395   } = pragma$3;
22396   const {
22397     printVueFor: printVueFor$1,
22398     printVueSlotScope: printVueSlotScope$1,
22399     isVueEventBindingExpression: isVueEventBindingExpression$1
22400   } = syntaxVue;
22401   const {
22402     printImgSrcset: printImgSrcset$1,
22403     printClassNames: printClassNames$1
22404   } = syntaxAttribute;
22405
22406   function concat$a(parts) {
22407     const newParts = normalizeParts$1(parts);
22408     return newParts.length === 0 ? "" : newParts.length === 1 ? newParts[0] : builders.concat(newParts);
22409   }
22410
22411   function embed$2(path, print, textToDoc, options) {
22412     const node = path.getValue();
22413
22414     switch (node.type) {
22415       case "text":
22416         {
22417           if (isScriptLikeTag$1(node.parent)) {
22418             const parser = inferScriptParser$1(node.parent);
22419
22420             if (parser) {
22421               const value = parser === "markdown" ? dedentString$1(node.value.replace(/^[^\S\n]*?\n/, "")) : node.value;
22422               return builders.concat([concat$a([breakParent$2, printOpeningTagPrefix(node, options), stripTrailingHardline$1(textToDoc(value, {
22423                 parser
22424               })), printClosingTagSuffix(node, options)])]);
22425             }
22426           } else if (node.parent.type === "interpolation") {
22427             return concat$a([indent$5(concat$a([line$6, textToDoc(node.value, Object.assign({
22428               __isInHtmlInterpolation: true
22429             }, options.parser === "angular" ? {
22430               parser: "__ng_interpolation",
22431               trailingComma: "none"
22432             } : options.parser === "vue" ? {
22433               parser: "__vue_expression"
22434             } : {
22435               parser: "__js_expression"
22436             }))])), node.parent.next && needsToBorrowPrevClosingTagEndMarker(node.parent.next) ? " " : line$6]);
22437           }
22438
22439           break;
22440         }
22441
22442       case "attribute":
22443         {
22444           if (!node.value) {
22445             break;
22446           } // lit-html: html`<my-element obj=${obj}></my-element>`
22447
22448
22449           if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
22450             return concat$a([node.rawName, "=", node.value]);
22451           } // lwc: html`<my-element data-for={value}></my-element>`
22452
22453
22454           if (options.parser === "lwc") {
22455             const interpolationRegex = /^\{[\s\S]*\}$/;
22456
22457             if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
22458               return concat$a([node.rawName, "=", node.value]);
22459             }
22460           }
22461
22462           const embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, (code, opts) => // strictly prefer single quote to avoid unnecessary html entity escape
22463           textToDoc(code, Object.assign({
22464             __isInHtmlAttribute: true
22465           }, opts)), options);
22466
22467           if (embeddedAttributeValueDoc) {
22468             return concat$a([node.rawName, '="', group$9(mapDoc$2(embeddedAttributeValueDoc, doc => typeof doc === "string" ? doc.replace(/"/g, "&quot;") : doc)), '"']);
22469           }
22470
22471           break;
22472         }
22473
22474       case "yaml":
22475         return markAsRoot$2(concat$a(["---", hardline$7, node.value.trim().length === 0 ? "" : textToDoc(node.value, {
22476           parser: "yaml"
22477         }), "---"]));
22478     }
22479   }
22480
22481   function genericPrint$2(path, options, print) {
22482     const node = path.getValue();
22483
22484     switch (node.type) {
22485       case "root":
22486         if (options.__onHtmlRoot) {
22487           options.__onHtmlRoot(node);
22488         } // use original concat to not break stripTrailingHardline
22489
22490
22491         return builders.concat([group$9(printChildren$1(path, options, print)), hardline$7]);
22492
22493       case "element":
22494       case "ieConditionalComment":
22495         {
22496           /**
22497            * do not break:
22498            *
22499            *     <div>{{
22500            *         ~
22501            *       interpolation
22502            *     }}</div>
22503            *            ~
22504            *
22505            * exception: break if the opening tag breaks
22506            *
22507            *     <div
22508            *       long
22509            *           ~
22510            *       >{{
22511            *         interpolation
22512            *       }}</div
22513            *              ~
22514            *     >
22515            */
22516           const shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
22517           const attrGroupId = Symbol("element-attr-group-id");
22518           return concat$a([group$9(concat$a([group$9(printOpeningTag(path, options, print), {
22519             id: attrGroupId
22520           }), node.children.length === 0 ? node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line$6 : "" : concat$a([forceBreakContent$1(node) ? breakParent$2 : "", (childrenDoc => shouldHugContent ? ifBreak$5(indent$5(childrenDoc), childrenDoc, {
22521             groupId: attrGroupId
22522           }) : isScriptLikeTag$1(node) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle ? childrenDoc : indent$5(childrenDoc))(concat$a([shouldHugContent ? ifBreak$5(softline$4, "", {
22523             groupId: attrGroupId
22524           }) : node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive ? line$6 : node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive ? dedentToRoot$1(softline$4) : softline$4, printChildren$1(path, options, print)])), (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? " " : "" : shouldHugContent ? ifBreak$5(softline$4, "", {
22525             groupId: attrGroupId
22526           }) : node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? line$6 : (node.lastChild.type === "comment" || node.lastChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) && new RegExp("\\n\\s{".concat(options.tabWidth * countParents$1(path, n => n.parent && n.parent.type !== "root"), "}$")).test(node.lastChild.value) ?
22527           /**
22528            *     <div>
22529            *       <pre>
22530            *         something
22531            *       </pre>
22532            *            ~
22533            *     </div>
22534            */
22535           "" : softline$4])])), printClosingTag(node, options)]);
22536         }
22537
22538       case "ieConditionalStartComment":
22539       case "ieConditionalEndComment":
22540         return concat$a([printOpeningTagStart(node), printClosingTagEnd(node)]);
22541
22542       case "interpolation":
22543         return concat$a([printOpeningTagStart(node, options), concat$a(path.map(print, "children")), printClosingTagEnd(node, options)]);
22544
22545       case "text":
22546         {
22547           if (node.parent.type === "interpolation") {
22548             // replace the trailing literalline with hardline for better readability
22549             const trailingNewlineRegex = /\n[^\S\n]*?$/;
22550             const hasTrailingNewline = trailingNewlineRegex.test(node.value);
22551             const value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
22552             return concat$a([concat$a(replaceEndOfLineWith$1(value, literalline$2)), hasTrailingNewline ? hardline$7 : ""]);
22553           }
22554
22555           return fill$3(normalizeParts$1([].concat(printOpeningTagPrefix(node, options), getTextValueParts(node), printClosingTagSuffix(node, options))));
22556         }
22557
22558       case "docType":
22559         return concat$a([group$9(concat$a([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")])), printClosingTagEnd(node, options)]);
22560
22561       case "comment":
22562         {
22563           return concat$a([printOpeningTagPrefix(node, options), concat$a(replaceEndOfLineWith$1(options.originalText.slice(options.locStart(node), options.locEnd(node)), literalline$2)), printClosingTagSuffix(node, options)]);
22564         }
22565
22566       case "attribute":
22567         {
22568           if (node.value === null) {
22569             return node.rawName;
22570           }
22571
22572           const value = unescapeQuoteEntities$1(node.value);
22573           const singleQuoteCount = countChars$1(value, "'");
22574           const doubleQuoteCount = countChars$1(value, '"');
22575           const quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
22576           return concat$a([node.rawName, concat$a(["=", quote, concat$a(replaceEndOfLineWith$1(quote === '"' ? value.replace(/"/g, "&quot;") : value.replace(/'/g, "&apos;"), literalline$2)), quote])]);
22577         }
22578
22579       case "yaml":
22580       case "toml":
22581         return concat$a(replaceEndOfLineWith$1(node.raw, literalline$2));
22582
22583       default:
22584         throw new Error("Unexpected node type ".concat(node.type));
22585     }
22586   }
22587
22588   function printChildren$1(path, options, print) {
22589     const node = path.getValue();
22590
22591     if (forceBreakChildren$1(node)) {
22592       return concat$a([breakParent$2, concat$a(path.map(childPath => {
22593         const childNode = childPath.getValue();
22594         const prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
22595         return concat$a([!prevBetweenLine ? "" : concat$a([prevBetweenLine, forceNextEmptyLine$1(childNode.prev) ? hardline$7 : ""]), printChild(childPath)]);
22596       }, "children"))]);
22597     }
22598
22599     const groupIds = node.children.map(() => Symbol(""));
22600     return concat$a(path.map((childPath, childIndex) => {
22601       const childNode = childPath.getValue();
22602
22603       if (isTextLikeNode$1(childNode)) {
22604         if (childNode.prev && isTextLikeNode$1(childNode.prev)) {
22605           const prevBetweenLine = printBetweenLine(childNode.prev, childNode);
22606
22607           if (prevBetweenLine) {
22608             if (forceNextEmptyLine$1(childNode.prev)) {
22609               return concat$a([hardline$7, hardline$7, printChild(childPath)]);
22610             }
22611
22612             return concat$a([prevBetweenLine, printChild(childPath)]);
22613           }
22614         }
22615
22616         return printChild(childPath);
22617       }
22618
22619       const prevParts = [];
22620       const leadingParts = [];
22621       const trailingParts = [];
22622       const nextParts = [];
22623       const prevBetweenLine = childNode.prev ? printBetweenLine(childNode.prev, childNode) : "";
22624       const nextBetweenLine = childNode.next ? printBetweenLine(childNode, childNode.next) : "";
22625
22626       if (prevBetweenLine) {
22627         if (forceNextEmptyLine$1(childNode.prev)) {
22628           prevParts.push(hardline$7, hardline$7);
22629         } else if (prevBetweenLine === hardline$7) {
22630           prevParts.push(hardline$7);
22631         } else {
22632           if (isTextLikeNode$1(childNode.prev)) {
22633             leadingParts.push(prevBetweenLine);
22634           } else {
22635             leadingParts.push(ifBreak$5("", softline$4, {
22636               groupId: groupIds[childIndex - 1]
22637             }));
22638           }
22639         }
22640       }
22641
22642       if (nextBetweenLine) {
22643         if (forceNextEmptyLine$1(childNode)) {
22644           if (isTextLikeNode$1(childNode.next)) {
22645             nextParts.push(hardline$7, hardline$7);
22646           }
22647         } else if (nextBetweenLine === hardline$7) {
22648           if (isTextLikeNode$1(childNode.next)) {
22649             nextParts.push(hardline$7);
22650           }
22651         } else {
22652           trailingParts.push(nextBetweenLine);
22653         }
22654       }
22655
22656       return concat$a([].concat(prevParts, group$9(concat$a([concat$a(leadingParts), group$9(concat$a([printChild(childPath), concat$a(trailingParts)]), {
22657         id: groupIds[childIndex]
22658       })])), nextParts));
22659     }, "children"));
22660
22661     function printChild(childPath) {
22662       const child = childPath.getValue();
22663
22664       if (hasPrettierIgnore$3(child)) {
22665         return concat$a([].concat(printOpeningTagPrefix(child, options), replaceEndOfLineWith$1(options.originalText.slice(options.locStart(child) + (child.prev && needsToBorrowNextOpeningTagStartMarker(child.prev) ? printOpeningTagStartMarker(child).length : 0), options.locEnd(child) - (child.next && needsToBorrowPrevClosingTagEndMarker(child.next) ? printClosingTagEndMarker(child, options).length : 0)), literalline$2), printClosingTagSuffix(child, options)));
22666       }
22667
22668       if (shouldPreserveContent$1(child, options)) {
22669         return concat$a([].concat(printOpeningTagPrefix(child, options), group$9(printOpeningTag(childPath, options, print)), replaceEndOfLineWith$1(options.originalText.slice(child.startSourceSpan.end.offset + (child.firstChild && needsToBorrowParentOpeningTagEndMarker(child.firstChild) ? -printOpeningTagEndMarker(child).length : 0), child.endSourceSpan.start.offset + (child.lastChild && needsToBorrowParentClosingTagStartMarker(child.lastChild) ? printClosingTagStartMarker(child, options).length : needsToBorrowLastChildClosingTagEndMarker(child) ? -printClosingTagEndMarker(child.lastChild, options).length : 0)), literalline$2), printClosingTag(child, options), printClosingTagSuffix(child, options)));
22670       }
22671
22672       return print(childPath);
22673     }
22674
22675     function printBetweenLine(prevNode, nextNode) {
22676       return isTextLikeNode$1(prevNode) && isTextLikeNode$1(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces$1(nextNode) ? hardline$7 : line$6 : "" : preferHardlineAsLeadingSpaces$1(nextNode) ? hardline$7 : softline$4 : needsToBorrowNextOpeningTagStartMarker(prevNode) && (hasPrettierIgnore$3(nextNode) ||
22677       /**
22678        *     123<a
22679        *          ~
22680        *       ><b>
22681        */
22682       nextNode.firstChild ||
22683       /**
22684        *     123<!--
22685        *            ~
22686        *     -->
22687        */
22688       nextNode.isSelfClosing ||
22689       /**
22690        *     123<span
22691        *             ~
22692        *       attr
22693        */
22694       nextNode.type === "element" && nextNode.attrs.length !== 0) ||
22695       /**
22696        *     <img
22697        *       src="long"
22698        *                 ~
22699        *     />123
22700        */
22701       prevNode.type === "element" && prevNode.isSelfClosing && needsToBorrowPrevClosingTagEndMarker(nextNode) ? "" : !nextNode.isLeadingSpaceSensitive || preferHardlineAsLeadingSpaces$1(nextNode) ||
22702       /**
22703        *       Want to write us a letter? Use our<a
22704        *         ><b><a>mailing address</a></b></a
22705        *                                          ~
22706        *       >.
22707        */
22708       needsToBorrowPrevClosingTagEndMarker(nextNode) && prevNode.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild) && prevNode.lastChild.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild.lastChild) ? hardline$7 : nextNode.hasLeadingSpaces ? line$6 : softline$4;
22709     }
22710   }
22711
22712   function printOpeningTag(path, options, print) {
22713     const node = path.getValue();
22714     const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
22715     return concat$a([printOpeningTagStart(node, options), !node.attrs || node.attrs.length === 0 ? node.isSelfClosing ?
22716     /**
22717      *     <br />
22718      *        ^
22719      */
22720     " " : "" : concat$a([indent$5(concat$a([forceNotToBreakAttrContent ? " " : line$6, join$6(line$6, (ignoreAttributeData => {
22721       const hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? () => ignoreAttributeData : Array.isArray(ignoreAttributeData) ? attr => ignoreAttributeData.includes(attr.rawName) : () => false;
22722       return path.map(attrPath => {
22723         const attr = attrPath.getValue();
22724         return hasPrettierIgnoreAttribute(attr) ? concat$a(replaceEndOfLineWith$1(options.originalText.slice(options.locStart(attr), options.locEnd(attr)), literalline$2)) : print(attrPath);
22725       }, "attrs");
22726     })(node.prev && node.prev.type === "comment" && getPrettierIgnoreAttributeCommentData$1(node.prev.value)))])),
22727     /**
22728      *     123<a
22729      *       attr
22730      *           ~
22731      *       >456
22732      */
22733     node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ||
22734     /**
22735      *     <span
22736      *       >123<meta
22737      *                ~
22738      *     /></span>
22739      */
22740     node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) ? node.isSelfClosing ? " " : "" : node.isSelfClosing ? forceNotToBreakAttrContent ? " " : line$6 : forceNotToBreakAttrContent ? "" : softline$4]), node.isSelfClosing ? "" : printOpeningTagEnd(node)]);
22741   }
22742
22743   function printOpeningTagStart(node, options) {
22744     return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$a([printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)]);
22745   }
22746
22747   function printOpeningTagEnd(node) {
22748     return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
22749   }
22750
22751   function printClosingTag(node, options) {
22752     return concat$a([node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)]);
22753   }
22754
22755   function printClosingTagStart(node, options) {
22756     return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$a([printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)]);
22757   }
22758
22759   function printClosingTagEnd(node, options) {
22760     return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$a([printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)]);
22761   }
22762
22763   function needsToBorrowNextOpeningTagStartMarker(node) {
22764     /**
22765      *     123<p
22766      *        ^^
22767      *     >
22768      */
22769     return node.next && !isTextLikeNode$1(node.next) && isTextLikeNode$1(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
22770   }
22771
22772   function needsToBorrowParentOpeningTagEndMarker(node) {
22773     /**
22774      *     <p
22775      *       >123
22776      *       ^
22777      *
22778      *     <p
22779      *       ><a
22780      *       ^
22781      */
22782     return !node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
22783   }
22784
22785   function needsToBorrowPrevClosingTagEndMarker(node) {
22786     /**
22787      *     <p></p
22788      *     >123
22789      *     ^
22790      *
22791      *     <p></p
22792      *     ><a
22793      *     ^
22794      */
22795     return node.prev && !isTextLikeNode$1(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
22796   }
22797
22798   function needsToBorrowLastChildClosingTagEndMarker(node) {
22799     /**
22800      *     <p
22801      *       ><a></a
22802      *       ></p
22803      *       ^
22804      *     >
22805      */
22806     return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode$1(getLastDescendant$1(node.lastChild));
22807   }
22808
22809   function needsToBorrowParentClosingTagStartMarker(node) {
22810     /**
22811      *     <p>
22812      *       123</p
22813      *          ^^^
22814      *     >
22815      *
22816      *         123</b
22817      *       ></a
22818      *        ^^^
22819      *     >
22820      */
22821     return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode$1(getLastDescendant$1(node));
22822   }
22823
22824   function printOpeningTagPrefix(node, options) {
22825     return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
22826   }
22827
22828   function printClosingTagPrefix(node, options) {
22829     return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
22830   }
22831
22832   function printClosingTagSuffix(node, options) {
22833     return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
22834   }
22835
22836   function printOpeningTagStartMarker(node) {
22837     switch (node.type) {
22838       case "ieConditionalComment":
22839       case "ieConditionalStartComment":
22840         return "<!--[if ".concat(node.condition);
22841
22842       case "ieConditionalEndComment":
22843         return "<!--<!";
22844
22845       case "interpolation":
22846         return "{{";
22847
22848       case "docType":
22849         return "<!DOCTYPE";
22850
22851       case "element":
22852         if (node.condition) {
22853           return "<!--[if ".concat(node.condition, "]><!--><").concat(node.rawName);
22854         }
22855
22856       // fall through
22857
22858       default:
22859         return "<".concat(node.rawName);
22860     }
22861   }
22862
22863   function printOpeningTagEndMarker(node) {
22864     assert(!node.isSelfClosing);
22865
22866     switch (node.type) {
22867       case "ieConditionalComment":
22868         return "]>";
22869
22870       case "element":
22871         if (node.condition) {
22872           return "><!--<![endif]-->";
22873         }
22874
22875       // fall through
22876
22877       default:
22878         return ">";
22879     }
22880   }
22881
22882   function printClosingTagStartMarker(node, options) {
22883     assert(!node.isSelfClosing);
22884
22885     if (shouldNotPrintClosingTag$1(node, options)) {
22886       return "";
22887     }
22888
22889     switch (node.type) {
22890       case "ieConditionalComment":
22891         return "<!";
22892
22893       case "element":
22894         if (node.hasHtmComponentClosingTag) {
22895           return "<//";
22896         }
22897
22898       // fall through
22899
22900       default:
22901         return "</".concat(node.rawName);
22902     }
22903   }
22904
22905   function printClosingTagEndMarker(node, options) {
22906     if (shouldNotPrintClosingTag$1(node, options)) {
22907       return "";
22908     }
22909
22910     switch (node.type) {
22911       case "ieConditionalComment":
22912       case "ieConditionalEndComment":
22913         return "[endif]-->";
22914
22915       case "ieConditionalStartComment":
22916         return "]><!-->";
22917
22918       case "interpolation":
22919         return "}}";
22920
22921       case "element":
22922         if (node.isSelfClosing) {
22923           return "/>";
22924         }
22925
22926       // fall through
22927
22928       default:
22929         return ">";
22930     }
22931   }
22932
22933   function getTextValueParts(node, value = node.value) {
22934     return node.parent.isWhitespaceSensitive ? node.parent.isIndentationSensitive ? replaceEndOfLineWith$1(value, literalline$2) : replaceEndOfLineWith$1(dedentString$1(value.replace(/^\s*?\n|\n\s*?$/g, "")), hardline$7) : // https://infra.spec.whatwg.org/#ascii-whitespace
22935     join$6(line$6, value.split(/[\t\n\f\r ]+/)).parts;
22936   }
22937
22938   function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
22939     const isKeyMatched = patterns => new RegExp(patterns.join("|")).test(node.fullName);
22940
22941     const getValue = () => unescapeQuoteEntities$1(node.value);
22942
22943     let shouldHug = false;
22944
22945     const __onHtmlBindingRoot = (root, options) => {
22946       const rootNode = root.type === "NGRoot" ? root.node.type === "NGMicrosyntax" && root.node.body.length === 1 && root.node.body[0].type === "NGMicrosyntaxExpression" ? root.node.body[0].expression : root.node : root.type === "JsExpressionRoot" ? root.node : root;
22947
22948       if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression" || options.parser === "__vue_expression" && (rootNode.type === "TemplateLiteral" || rootNode.type === "StringLiteral"))) {
22949         shouldHug = true;
22950       }
22951     };
22952
22953     const printHug = doc => group$9(doc);
22954
22955     const printExpand = (doc, canHaveTrailingWhitespace = true) => group$9(concat$a([indent$5(concat$a([softline$4, doc])), canHaveTrailingWhitespace ? softline$4 : ""]));
22956
22957     const printMaybeHug = doc => shouldHug ? printHug(doc) : printExpand(doc);
22958
22959     const textToDoc = (code, opts) => originalTextToDoc(code, Object.assign({
22960       __onHtmlBindingRoot
22961     }, opts));
22962
22963     if (node.fullName === "srcset" && (node.parent.fullName === "img" || node.parent.fullName === "source")) {
22964       return printExpand(printImgSrcset$1(getValue()));
22965     }
22966
22967     if (node.fullName === "class" && !options.parentParser) {
22968       const value = getValue();
22969
22970       if (!value.includes("{{")) {
22971         return printClassNames$1(value);
22972       }
22973     }
22974
22975     if (node.fullName === "style" && !options.parentParser) {
22976       const value = getValue();
22977
22978       if (!value.includes("{{")) {
22979         return printExpand(textToDoc(value, {
22980           parser: "css",
22981           __isHTMLStyleAttribute: true
22982         }));
22983       }
22984     }
22985
22986     if (options.parser === "vue") {
22987       if (node.fullName === "v-for") {
22988         return printVueFor$1(getValue(), textToDoc);
22989       }
22990
22991       if (node.fullName === "slot-scope") {
22992         return printVueSlotScope$1(getValue(), textToDoc);
22993       }
22994       /**
22995        *     @click="jsStatement"
22996        *     @click="jsExpression"
22997        *     v-on:click="jsStatement"
22998        *     v-on:click="jsExpression"
22999        */
23000
23001
23002       const vueEventBindingPatterns = ["^@", "^v-on:"];
23003       /**
23004        *     :class="vueExpression"
23005        *     v-bind:id="vueExpression"
23006        */
23007
23008       const vueExpressionBindingPatterns = ["^:", "^v-bind:"];
23009       /**
23010        *     v-if="jsExpression"
23011        */
23012
23013       const jsExpressionBindingPatterns = ["^v-"];
23014
23015       if (isKeyMatched(vueEventBindingPatterns)) {
23016         const value = getValue();
23017         return printMaybeHug(isVueEventBindingExpression$1(value) ? textToDoc(value, {
23018           parser: "__js_expression"
23019         }) : stripTrailingHardline$1(textToDoc(value, {
23020           parser: "__vue_event_binding"
23021         })));
23022       }
23023
23024       if (isKeyMatched(vueExpressionBindingPatterns)) {
23025         return printMaybeHug(textToDoc(getValue(), {
23026           parser: "__vue_expression"
23027         }));
23028       }
23029
23030       if (isKeyMatched(jsExpressionBindingPatterns)) {
23031         return printMaybeHug(textToDoc(getValue(), {
23032           parser: "__js_expression"
23033         }));
23034       }
23035     }
23036
23037     if (options.parser === "angular") {
23038       const ngTextToDoc = (code, opts) => // angular does not allow trailing comma
23039       textToDoc(code, Object.assign({}, opts, {
23040         trailingComma: "none"
23041       }));
23042       /**
23043        *     *directive="angularDirective"
23044        */
23045
23046
23047       const ngDirectiveBindingPatterns = ["^\\*"];
23048       /**
23049        *     (click)="angularStatement"
23050        *     on-click="angularStatement"
23051        */
23052
23053       const ngStatementBindingPatterns = ["^\\(.+\\)$", "^on-"];
23054       /**
23055        *     [target]="angularExpression"
23056        *     bind-target="angularExpression"
23057        *     [(target)]="angularExpression"
23058        *     bindon-target="angularExpression"
23059        */
23060
23061       const ngExpressionBindingPatterns = ["^\\[.+\\]$", "^bind(on)?-", // Unofficial rudimentary support for some of the most used directives of AngularJS 1.x
23062       "^ng-(if|show|hide|class|style)$"];
23063       /**
23064        *     i18n="longDescription"
23065        *     i18n-attr="longDescription"
23066        */
23067
23068       const ngI18nPatterns = ["^i18n(-.+)?$"];
23069
23070       if (isKeyMatched(ngStatementBindingPatterns)) {
23071         return printMaybeHug(ngTextToDoc(getValue(), {
23072           parser: "__ng_action"
23073         }));
23074       }
23075
23076       if (isKeyMatched(ngExpressionBindingPatterns)) {
23077         return printMaybeHug(ngTextToDoc(getValue(), {
23078           parser: "__ng_binding"
23079         }));
23080       }
23081
23082       if (isKeyMatched(ngI18nPatterns)) {
23083         const value = getValue().trim();
23084         return printExpand(fill$3(getTextValueParts(node, value)), !value.includes("@@"));
23085       }
23086
23087       if (isKeyMatched(ngDirectiveBindingPatterns)) {
23088         return printMaybeHug(ngTextToDoc(getValue(), {
23089           parser: "__ng_directive"
23090         }));
23091       }
23092
23093       const interpolationRegex = /\{\{([\s\S]+?)\}\}/g;
23094       const value = getValue();
23095
23096       if (interpolationRegex.test(value)) {
23097         const parts = [];
23098         value.split(interpolationRegex).forEach((part, index) => {
23099           if (index % 2 === 0) {
23100             parts.push(concat$a(replaceEndOfLineWith$1(part, literalline$2)));
23101           } else {
23102             try {
23103               parts.push(group$9(concat$a(["{{", indent$5(concat$a([line$6, ngTextToDoc(part, {
23104                 parser: "__ng_interpolation",
23105                 __isInHtmlInterpolation: true // to avoid unexpected `}}`
23106
23107               })])), line$6, "}}"])));
23108             } catch (e) {
23109               parts.push("{{", concat$a(replaceEndOfLineWith$1(part, literalline$2)), "}}");
23110             }
23111           }
23112         });
23113         return group$9(concat$a(parts));
23114       }
23115     }
23116
23117     return null;
23118   }
23119
23120   var printerHtml = {
23121     preprocess: preprocess_1,
23122     print: genericPrint$2,
23123     insertPragma: insertPragma$6,
23124     massageAstNode: clean$3,
23125     embed: embed$2
23126   };
23127
23128   const CATEGORY_HTML = "HTML"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
23129
23130   var options$4 = {
23131     htmlWhitespaceSensitivity: {
23132       since: "1.15.0",
23133       category: CATEGORY_HTML,
23134       type: "choice",
23135       default: "css",
23136       description: "How to handle whitespaces in HTML.",
23137       choices: [{
23138         value: "css",
23139         description: "Respect the default value of CSS display property."
23140       }, {
23141         value: "strict",
23142         description: "Whitespaces are considered sensitive."
23143       }, {
23144         value: "ignore",
23145         description: "Whitespaces are considered insensitive."
23146       }]
23147     },
23148     vueIndentScriptAndStyle: {
23149       since: "1.19.0",
23150       category: CATEGORY_HTML,
23151       type: "boolean",
23152       default: false,
23153       description: "Indent script and style tags in Vue files."
23154     }
23155   };
23156
23157   var name$7 = "HTML";
23158   var type$6 = "markup";
23159   var tmScope$6 = "text.html.basic";
23160   var aceMode$6 = "html";
23161   var codemirrorMode$3 = "htmlmixed";
23162   var codemirrorMimeType$3 = "text/html";
23163   var color$1 = "#e34c26";
23164   var aliases$1 = [
23165         "xhtml"
23166   ];
23167   var extensions$6 = [
23168         ".html",
23169         ".htm",
23170         ".html.hl",
23171         ".inc",
23172         ".st",
23173         ".xht",
23174         ".xhtml"
23175   ];
23176   var languageId$6 = 146;
23177   var HTML = {
23178         name: name$7,
23179         type: type$6,
23180         tmScope: tmScope$6,
23181         aceMode: aceMode$6,
23182         codemirrorMode: codemirrorMode$3,
23183         codemirrorMimeType: codemirrorMimeType$3,
23184         color: color$1,
23185         aliases: aliases$1,
23186         extensions: extensions$6,
23187         languageId: languageId$6
23188   };
23189
23190   var HTML$1 = /*#__PURE__*/Object.freeze({
23191     __proto__: null,
23192     name: name$7,
23193     type: type$6,
23194     tmScope: tmScope$6,
23195     aceMode: aceMode$6,
23196     codemirrorMode: codemirrorMode$3,
23197     codemirrorMimeType: codemirrorMimeType$3,
23198     color: color$1,
23199     aliases: aliases$1,
23200     extensions: extensions$6,
23201     languageId: languageId$6,
23202     'default': HTML
23203   });
23204
23205   var name$8 = "Vue";
23206   var type$7 = "markup";
23207   var color$2 = "#2c3e50";
23208   var extensions$7 = [
23209         ".vue"
23210   ];
23211   var tmScope$7 = "text.html.vue";
23212   var aceMode$7 = "html";
23213   var languageId$7 = 391;
23214   var Vue = {
23215         name: name$8,
23216         type: type$7,
23217         color: color$2,
23218         extensions: extensions$7,
23219         tmScope: tmScope$7,
23220         aceMode: aceMode$7,
23221         languageId: languageId$7
23222   };
23223
23224   var Vue$1 = /*#__PURE__*/Object.freeze({
23225     __proto__: null,
23226     name: name$8,
23227     type: type$7,
23228     color: color$2,
23229     extensions: extensions$7,
23230     tmScope: tmScope$7,
23231     aceMode: aceMode$7,
23232     languageId: languageId$7,
23233     'default': Vue
23234   });
23235
23236   var require$$0$5 = getCjsExportFromNamespace(HTML$1);
23237
23238   var require$$1$1 = getCjsExportFromNamespace(Vue$1);
23239
23240   const languages$3 = [createLanguage(require$$0$5, () => ({
23241     name: "Angular",
23242     since: "1.15.0",
23243     parsers: ["angular"],
23244     vscodeLanguageIds: ["html"],
23245     extensions: [".component.html"],
23246     filenames: []
23247   })), createLanguage(require$$0$5, data => ({
23248     since: "1.15.0",
23249     parsers: ["html"],
23250     vscodeLanguageIds: ["html"],
23251     extensions: data.extensions.concat([".mjml" // MJML is considered XML in Linguist but it should be formatted as HTML
23252     ])
23253   })), createLanguage(require$$0$5, () => ({
23254     name: "Lightning Web Components",
23255     since: "1.17.0",
23256     parsers: ["lwc"],
23257     vscodeLanguageIds: ["html"],
23258     extensions: [],
23259     filenames: []
23260   })), createLanguage(require$$1$1, () => ({
23261     since: "1.10.0",
23262     parsers: ["vue"],
23263     vscodeLanguageIds: ["vue"]
23264   }))];
23265   const printers$3 = {
23266     html: printerHtml
23267   };
23268   var languageHtml = {
23269     languages: languages$3,
23270     printers: printers$3,
23271     options: options$4
23272   };
23273
23274   const {
23275     addLeadingComment: addLeadingComment$3,
23276     addTrailingComment: addTrailingComment$3,
23277     addDanglingComment: addDanglingComment$3,
23278     getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$2
23279   } = utilShared;
23280
23281   function handleOwnLineComment(comment, text, options, ast, isLastComment) {
23282     const {
23283       precedingNode,
23284       enclosingNode,
23285       followingNode
23286     } = comment;
23287     return handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleMemberExpressionComments(enclosingNode, followingNode, comment) || handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) || handleClassComments(enclosingNode, precedingNode, followingNode, comment) || handleImportSpecifierComments(enclosingNode, comment) || handleForComments(enclosingNode, precedingNode, comment) || handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleImportDeclarationComments(text, enclosingNode, precedingNode, comment, options) || handleAssignmentPatternComments(enclosingNode, comment) || handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) || handleLabeledStatementComments(enclosingNode, comment);
23288   }
23289
23290   function handleEndOfLineComment(comment, text, options, ast, isLastComment) {
23291     const {
23292       precedingNode,
23293       enclosingNode,
23294       followingNode
23295     } = comment;
23296     return handleClosureTypeCastComments(followingNode, comment) || handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleConditionalExpressionComments(enclosingNode, precedingNode, followingNode, comment, text, options) || handleImportSpecifierComments(enclosingNode, comment) || handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) || handleClassComments(enclosingNode, precedingNode, followingNode, comment) || handleLabeledStatementComments(enclosingNode, comment) || handleCallExpressionComments(precedingNode, enclosingNode, comment) || handlePropertyComments(enclosingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleTypeAliasComments(enclosingNode, followingNode, comment) || handleVariableDeclaratorComments(enclosingNode, followingNode, comment);
23297   }
23298
23299   function handleRemainingComment(comment, text, options, ast, isLastComment) {
23300     const {
23301       precedingNode,
23302       enclosingNode,
23303       followingNode
23304     } = comment;
23305
23306     if (handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) || handleCommentInEmptyParens(text, enclosingNode, comment, options) || handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleCommentAfterArrowParams(text, enclosingNode, comment, options) || handleFunctionNameComments(text, enclosingNode, precedingNode, comment, options) || handleTSMappedTypeComments(text, enclosingNode, precedingNode, followingNode, comment) || handleBreakAndContinueStatementComments(enclosingNode, comment) || handleTSFunctionTrailingComments(text, enclosingNode, followingNode, comment, options)) {
23307       return true;
23308     }
23309
23310     return false;
23311   }
23312
23313   function addBlockStatementFirstComment(node, comment) {
23314     const body = node.body.filter(n => n.type !== "EmptyStatement");
23315
23316     if (body.length === 0) {
23317       addDanglingComment$3(node, comment);
23318     } else {
23319       addLeadingComment$3(body[0], comment);
23320     }
23321   }
23322
23323   function addBlockOrNotComment(node, comment) {
23324     if (node.type === "BlockStatement") {
23325       addBlockStatementFirstComment(node, comment);
23326     } else {
23327       addLeadingComment$3(node, comment);
23328     }
23329   }
23330
23331   function handleClosureTypeCastComments(followingNode, comment) {
23332     if (followingNode && isTypeCastComment(comment)) {
23333       addLeadingComment$3(followingNode, comment);
23334       return true;
23335     }
23336
23337     return false;
23338   } // There are often comments before the else clause of if statements like
23339   //
23340   //   if (1) { ... }
23341   //   // comment
23342   //   else { ... }
23343   //
23344   // They are being attached as leading comments of the BlockExpression which
23345   // is not well printed. What we want is to instead move the comment inside
23346   // of the block and make it leadingComment of the first element of the block
23347   // or dangling comment of the block if there is nothing inside
23348   //
23349   //   if (1) { ... }
23350   //   else {
23351   //     // comment
23352   //     ...
23353   //   }
23354
23355
23356   function handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
23357     if (!enclosingNode || enclosingNode.type !== "IfStatement" || !followingNode) {
23358       return false;
23359     } // We unfortunately have no way using the AST or location of nodes to know
23360     // if the comment is positioned before the condition parenthesis:
23361     //   if (a /* comment */) {}
23362     // The only workaround I found is to look at the next character to see if
23363     // it is a ).
23364
23365
23366     const nextCharacter = util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd);
23367
23368     if (nextCharacter === ")") {
23369       addTrailingComment$3(precedingNode, comment);
23370       return true;
23371     } // Comments before `else`:
23372     // - treat as trailing comments of the consequent, if it's a BlockStatement
23373     // - treat as a dangling comment otherwise
23374
23375
23376     if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) {
23377       if (precedingNode.type === "BlockStatement") {
23378         addTrailingComment$3(precedingNode, comment);
23379       } else {
23380         addDanglingComment$3(enclosingNode, comment);
23381       }
23382
23383       return true;
23384     }
23385
23386     if (followingNode.type === "BlockStatement") {
23387       addBlockStatementFirstComment(followingNode, comment);
23388       return true;
23389     }
23390
23391     if (followingNode.type === "IfStatement") {
23392       addBlockOrNotComment(followingNode.consequent, comment);
23393       return true;
23394     } // For comments positioned after the condition parenthesis in an if statement
23395     // before the consequent without brackets on, such as
23396     // if (a) /* comment */ true,
23397     // we look at the next character to see if the following node
23398     // is the consequent for the if statement
23399
23400
23401     if (enclosingNode.consequent === followingNode) {
23402       addLeadingComment$3(followingNode, comment);
23403       return true;
23404     }
23405
23406     return false;
23407   }
23408
23409   function handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
23410     if (!enclosingNode || enclosingNode.type !== "WhileStatement" || !followingNode) {
23411       return false;
23412     } // We unfortunately have no way using the AST or location of nodes to know
23413     // if the comment is positioned before the condition parenthesis:
23414     //   while (a /* comment */) {}
23415     // The only workaround I found is to look at the next character to see if
23416     // it is a ).
23417
23418
23419     const nextCharacter = util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd);
23420
23421     if (nextCharacter === ")") {
23422       addTrailingComment$3(precedingNode, comment);
23423       return true;
23424     }
23425
23426     if (followingNode.type === "BlockStatement") {
23427       addBlockStatementFirstComment(followingNode, comment);
23428       return true;
23429     }
23430
23431     return false;
23432   } // Same as IfStatement but for TryStatement
23433
23434
23435   function handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) {
23436     if (!enclosingNode || enclosingNode.type !== "TryStatement" && enclosingNode.type !== "CatchClause" || !followingNode) {
23437       return false;
23438     }
23439
23440     if (enclosingNode.type === "CatchClause" && precedingNode) {
23441       addTrailingComment$3(precedingNode, comment);
23442       return true;
23443     }
23444
23445     if (followingNode.type === "BlockStatement") {
23446       addBlockStatementFirstComment(followingNode, comment);
23447       return true;
23448     }
23449
23450     if (followingNode.type === "TryStatement") {
23451       addBlockOrNotComment(followingNode.finalizer, comment);
23452       return true;
23453     }
23454
23455     if (followingNode.type === "CatchClause") {
23456       addBlockOrNotComment(followingNode.body, comment);
23457       return true;
23458     }
23459
23460     return false;
23461   }
23462
23463   function handleMemberExpressionComments(enclosingNode, followingNode, comment) {
23464     if (enclosingNode && (enclosingNode.type === "MemberExpression" || enclosingNode.type === "OptionalMemberExpression") && followingNode && followingNode.type === "Identifier") {
23465       addLeadingComment$3(enclosingNode, comment);
23466       return true;
23467     }
23468
23469     return false;
23470   }
23471
23472   function handleConditionalExpressionComments(enclosingNode, precedingNode, followingNode, comment, text, options) {
23473     const isSameLineAsPrecedingNode = precedingNode && !util$1.hasNewlineInRange(text, options.locEnd(precedingNode), options.locStart(comment));
23474
23475     if ((!precedingNode || !isSameLineAsPrecedingNode) && enclosingNode && enclosingNode.type === "ConditionalExpression" && followingNode) {
23476       addLeadingComment$3(followingNode, comment);
23477       return true;
23478     }
23479
23480     return false;
23481   }
23482
23483   function handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) {
23484     if (enclosingNode && (enclosingNode.type === "ObjectProperty" || enclosingNode.type === "Property") && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") {
23485       addTrailingComment$3(enclosingNode.value.left, comment);
23486       return true;
23487     }
23488
23489     return false;
23490   }
23491
23492   function handleClassComments(enclosingNode, precedingNode, followingNode, comment) {
23493     if (enclosingNode && (enclosingNode.type === "ClassDeclaration" || enclosingNode.type === "ClassExpression") && enclosingNode.decorators && enclosingNode.decorators.length > 0 && !(followingNode && followingNode.type === "Decorator")) {
23494       if (!enclosingNode.decorators || enclosingNode.decorators.length === 0) {
23495         addLeadingComment$3(enclosingNode, comment);
23496       } else {
23497         addTrailingComment$3(enclosingNode.decorators[enclosingNode.decorators.length - 1], comment);
23498       }
23499
23500       return true;
23501     }
23502
23503     return false;
23504   }
23505
23506   function handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) {
23507     // This is only needed for estree parsers (flow, typescript) to attach
23508     // after a method name:
23509     // obj = { fn /*comment*/() {} };
23510     if (enclosingNode && precedingNode && ( // "MethodDefinition" is handled in getCommentChildNodes
23511     enclosingNode.type === "Property" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "TSAbstractMethodDefinition") && precedingNode.type === "Identifier" && enclosingNode.key === precedingNode && // special Property case: { key: /*comment*/(value) };
23512     // comment should be attached to value instead of key
23513     util$1.getNextNonSpaceNonCommentCharacter(text, precedingNode, options.locEnd) !== ":") {
23514       addTrailingComment$3(precedingNode, comment);
23515       return true;
23516     } // Print comments between decorators and class methods as a trailing comment
23517     // on the decorator node instead of the method node
23518
23519
23520     if (precedingNode && enclosingNode && precedingNode.type === "Decorator" && (enclosingNode.type === "ClassMethod" || enclosingNode.type === "ClassProperty" || enclosingNode.type === "TSAbstractClassProperty" || enclosingNode.type === "TSAbstractMethodDefinition" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "MethodDefinition")) {
23521       addTrailingComment$3(precedingNode, comment);
23522       return true;
23523     }
23524
23525     return false;
23526   }
23527
23528   function handleFunctionNameComments(text, enclosingNode, precedingNode, comment, options) {
23529     if (util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== "(") {
23530       return false;
23531     }
23532
23533     if (precedingNode && enclosingNode && (enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ClassMethod" || enclosingNode.type === "MethodDefinition" || enclosingNode.type === "ObjectMethod")) {
23534       addTrailingComment$3(precedingNode, comment);
23535       return true;
23536     }
23537
23538     return false;
23539   }
23540
23541   function handleCommentAfterArrowParams(text, enclosingNode, comment, options) {
23542     if (!(enclosingNode && enclosingNode.type === "ArrowFunctionExpression")) {
23543       return false;
23544     }
23545
23546     const index = getNextNonSpaceNonCommentCharacterIndex$2(text, comment, options.locEnd);
23547
23548     if (text.slice(index, index + 2) === "=>") {
23549       addDanglingComment$3(enclosingNode, comment);
23550       return true;
23551     }
23552
23553     return false;
23554   }
23555
23556   function handleCommentInEmptyParens(text, enclosingNode, comment, options) {
23557     if (util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== ")") {
23558       return false;
23559     } // Only add dangling comments to fix the case when no params are present,
23560     // i.e. a function without any argument.
23561
23562
23563     if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && // `params` vs `parameters` - see https://github.com/babel/babel/issues/9231
23564     (enclosingNode.params || enclosingNode.parameters).length === 0 || (enclosingNode.type === "CallExpression" || enclosingNode.type === "OptionalCallExpression" || enclosingNode.type === "NewExpression") && enclosingNode.arguments.length === 0)) {
23565       addDanglingComment$3(enclosingNode, comment);
23566       return true;
23567     }
23568
23569     if (enclosingNode && enclosingNode.type === "MethodDefinition" && enclosingNode.value.params.length === 0) {
23570       addDanglingComment$3(enclosingNode.value, comment);
23571       return true;
23572     }
23573
23574     return false;
23575   }
23576
23577   function handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
23578     // Flow function type definitions
23579     if (precedingNode && precedingNode.type === "FunctionTypeParam" && enclosingNode && enclosingNode.type === "FunctionTypeAnnotation" && followingNode && followingNode.type !== "FunctionTypeParam") {
23580       addTrailingComment$3(precedingNode, comment);
23581       return true;
23582     } // Real functions and TypeScript function type definitions
23583
23584
23585     if (precedingNode && (precedingNode.type === "Identifier" || precedingNode.type === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ")") {
23586       addTrailingComment$3(precedingNode, comment);
23587       return true;
23588     }
23589
23590     if (enclosingNode && enclosingNode.type === "FunctionDeclaration" && followingNode && followingNode.type === "BlockStatement") {
23591       const functionParamRightParenIndex = (() => {
23592         if ((enclosingNode.params || enclosingNode.parameters).length !== 0) {
23593           return util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, options.locEnd(util$1.getLast(enclosingNode.params || enclosingNode.parameters)));
23594         }
23595
23596         const functionParamLeftParenIndex = util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, options.locEnd(enclosingNode.id));
23597         return util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1);
23598       })();
23599
23600       if (options.locStart(comment) > functionParamRightParenIndex) {
23601         addBlockStatementFirstComment(followingNode, comment);
23602         return true;
23603       }
23604     }
23605
23606     return false;
23607   }
23608
23609   function handleImportSpecifierComments(enclosingNode, comment) {
23610     if (enclosingNode && enclosingNode.type === "ImportSpecifier") {
23611       addLeadingComment$3(enclosingNode, comment);
23612       return true;
23613     }
23614
23615     return false;
23616   }
23617
23618   function handleLabeledStatementComments(enclosingNode, comment) {
23619     if (enclosingNode && enclosingNode.type === "LabeledStatement") {
23620       addLeadingComment$3(enclosingNode, comment);
23621       return true;
23622     }
23623
23624     return false;
23625   }
23626
23627   function handleBreakAndContinueStatementComments(enclosingNode, comment) {
23628     if (enclosingNode && (enclosingNode.type === "ContinueStatement" || enclosingNode.type === "BreakStatement") && !enclosingNode.label) {
23629       addTrailingComment$3(enclosingNode, comment);
23630       return true;
23631     }
23632
23633     return false;
23634   }
23635
23636   function handleCallExpressionComments(precedingNode, enclosingNode, comment) {
23637     if (enclosingNode && (enclosingNode.type === "CallExpression" || enclosingNode.type === "OptionalCallExpression") && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) {
23638       addLeadingComment$3(enclosingNode.arguments[0], comment);
23639       return true;
23640     }
23641
23642     return false;
23643   }
23644
23645   function handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) {
23646     if (enclosingNode && (enclosingNode.type === "UnionTypeAnnotation" || enclosingNode.type === "TSUnionType")) {
23647       if (util$1.isNodeIgnoreComment(comment)) {
23648         followingNode.prettierIgnore = true;
23649         comment.unignore = true;
23650       }
23651
23652       if (precedingNode) {
23653         addTrailingComment$3(precedingNode, comment);
23654         return true;
23655       }
23656
23657       return false;
23658     }
23659
23660     if (followingNode && (followingNode.type === "UnionTypeAnnotation" || followingNode.type === "TSUnionType") && util$1.isNodeIgnoreComment(comment)) {
23661       followingNode.types[0].prettierIgnore = true;
23662       comment.unignore = true;
23663     }
23664
23665     return false;
23666   }
23667
23668   function handlePropertyComments(enclosingNode, comment) {
23669     if (enclosingNode && (enclosingNode.type === "Property" || enclosingNode.type === "ObjectProperty")) {
23670       addLeadingComment$3(enclosingNode, comment);
23671       return true;
23672     }
23673
23674     return false;
23675   }
23676
23677   function handleOnlyComments(enclosingNode, ast, comment, isLastComment) {
23678     // With Flow the enclosingNode is undefined so use the AST instead.
23679     if (ast && ast.body && ast.body.length === 0) {
23680       if (isLastComment) {
23681         addDanglingComment$3(ast, comment);
23682       } else {
23683         addLeadingComment$3(ast, comment);
23684       }
23685
23686       return true;
23687     } else if (enclosingNode && enclosingNode.type === "Program" && enclosingNode.body.length === 0 && enclosingNode.directives && enclosingNode.directives.length === 0) {
23688       if (isLastComment) {
23689         addDanglingComment$3(enclosingNode, comment);
23690       } else {
23691         addLeadingComment$3(enclosingNode, comment);
23692       }
23693
23694       return true;
23695     }
23696
23697     return false;
23698   }
23699
23700   function handleForComments(enclosingNode, precedingNode, comment) {
23701     if (enclosingNode && (enclosingNode.type === "ForInStatement" || enclosingNode.type === "ForOfStatement")) {
23702       addLeadingComment$3(enclosingNode, comment);
23703       return true;
23704     }
23705
23706     return false;
23707   }
23708
23709   function handleImportDeclarationComments(text, enclosingNode, precedingNode, comment, options) {
23710     if (precedingNode && precedingNode.type === "ImportSpecifier" && enclosingNode && enclosingNode.type === "ImportDeclaration" && util$1.hasNewline(text, options.locEnd(comment))) {
23711       addTrailingComment$3(precedingNode, comment);
23712       return true;
23713     }
23714
23715     return false;
23716   }
23717
23718   function handleAssignmentPatternComments(enclosingNode, comment) {
23719     if (enclosingNode && enclosingNode.type === "AssignmentPattern") {
23720       addLeadingComment$3(enclosingNode, comment);
23721       return true;
23722     }
23723
23724     return false;
23725   }
23726
23727   function handleTypeAliasComments(enclosingNode, followingNode, comment) {
23728     if (enclosingNode && enclosingNode.type === "TypeAlias") {
23729       addLeadingComment$3(enclosingNode, comment);
23730       return true;
23731     }
23732
23733     return false;
23734   }
23735
23736   function handleVariableDeclaratorComments(enclosingNode, followingNode, comment) {
23737     if (enclosingNode && (enclosingNode.type === "VariableDeclarator" || enclosingNode.type === "AssignmentExpression") && followingNode && (followingNode.type === "ObjectExpression" || followingNode.type === "ArrayExpression" || followingNode.type === "TemplateLiteral" || followingNode.type === "TaggedTemplateExpression" || isBlockComment(comment))) {
23738       addLeadingComment$3(followingNode, comment);
23739       return true;
23740     }
23741
23742     return false;
23743   }
23744
23745   function handleTSFunctionTrailingComments(text, enclosingNode, followingNode, comment, options) {
23746     if (!followingNode && enclosingNode && (enclosingNode.type === "TSMethodSignature" || enclosingNode.type === "TSDeclareFunction" || enclosingNode.type === "TSAbstractMethodDefinition") && util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ";") {
23747       addTrailingComment$3(enclosingNode, comment);
23748       return true;
23749     }
23750
23751     return false;
23752   }
23753
23754   function handleTSMappedTypeComments(text, enclosingNode, precedingNode, followingNode, comment) {
23755     if (!enclosingNode || enclosingNode.type !== "TSMappedType") {
23756       return false;
23757     }
23758
23759     if (followingNode && followingNode.type === "TSTypeParameter" && followingNode.name) {
23760       addLeadingComment$3(followingNode.name, comment);
23761       return true;
23762     }
23763
23764     if (precedingNode && precedingNode.type === "TSTypeParameter" && precedingNode.constraint) {
23765       addTrailingComment$3(precedingNode.constraint, comment);
23766       return true;
23767     }
23768
23769     return false;
23770   }
23771
23772   function isBlockComment(comment) {
23773     return comment.type === "Block" || comment.type === "CommentBlock";
23774   }
23775
23776   function hasLeadingComment(node, fn = () => true) {
23777     if (node.leadingComments) {
23778       return node.leadingComments.some(fn);
23779     }
23780
23781     if (node.comments) {
23782       return node.comments.some(comment => comment.leading && fn(comment));
23783     }
23784
23785     return false;
23786   }
23787
23788   function isRealFunctionLikeNode(node) {
23789     return node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration" || node.type === "ObjectMethod" || node.type === "ClassMethod" || node.type === "TSDeclareFunction" || node.type === "TSCallSignatureDeclaration" || node.type === "TSConstructSignatureDeclaration" || node.type === "TSConstructSignatureDeclaration" || node.type === "TSMethodSignature" || node.type === "TSConstructorType" || node.type === "TSFunctionType" || node.type === "TSDeclareMethod";
23790   }
23791
23792   function getGapRegex(enclosingNode) {
23793     if (enclosingNode && enclosingNode.type !== "BinaryExpression" && enclosingNode.type !== "LogicalExpression") {
23794       // Support degenerate single-element unions and intersections.
23795       // E.g.: `type A = /* 1 */ & B`
23796       return /^[\s(&|]*$/;
23797     }
23798   }
23799
23800   function getCommentChildNodes(node, options) {
23801     // Prevent attaching comments to FunctionExpression in this case:
23802     //     class Foo {
23803     //       bar() // comment
23804     //       {
23805     //         baz();
23806     //       }
23807     //     }
23808     if ((options.parser === "typescript" || options.parser === "flow") && node.type === "MethodDefinition" && node.value && node.value.type === "FunctionExpression" && node.value.params.length === 0 && !node.value.returnType && (!node.value.typeParameters || node.value.typeParameters.length === 0) && node.value.body) {
23809       return [...(node.decorators || []), node.key, node.value.body];
23810     }
23811   }
23812
23813   function isTypeCastComment(comment) {
23814     return isBlockComment(comment) && comment.value[0] === "*" && // TypeScript expects the type to be enclosed in curly brackets, however
23815     // Closure Compiler accepts types in parens and even without any delimiters at all.
23816     // That's why we just search for "@type".
23817     /@type\b/.test(comment.value);
23818   }
23819
23820   var comments$1 = {
23821     handleOwnLineComment,
23822     handleEndOfLineComment,
23823     handleRemainingComment,
23824     hasLeadingComment,
23825     isBlockComment,
23826     isTypeCastComment,
23827     getGapRegex,
23828     getCommentChildNodes
23829   };
23830
23831   const {
23832     isBlockComment: isBlockComment$1,
23833     hasLeadingComment: hasLeadingComment$1
23834   } = comments$1;
23835   const {
23836     builders: {
23837       indent: indent$6,
23838       join: join$7,
23839       line: line$7,
23840       hardline: hardline$8,
23841       softline: softline$5,
23842       literalline: literalline$3,
23843       concat: concat$b,
23844       group: group$a,
23845       dedentToRoot: dedentToRoot$2
23846     },
23847     utils: {
23848       mapDoc: mapDoc$3,
23849       stripTrailingHardline: stripTrailingHardline$2
23850     }
23851   } = document;
23852
23853   function embed$3(path, print, textToDoc, options) {
23854     const node = path.getValue();
23855     const parent = path.getParentNode();
23856     const parentParent = path.getParentNode(1);
23857
23858     switch (node.type) {
23859       case "TemplateLiteral":
23860         {
23861           const isCss = [isStyledJsx, isStyledComponents, isCssProp, isAngularComponentStyles].some(isIt => isIt(path));
23862
23863           if (isCss) {
23864             // Get full template literal with expressions replaced by placeholders
23865             const rawQuasis = node.quasis.map(q => q.value.raw);
23866             let placeholderID = 0;
23867             const text = rawQuasis.reduce((prevVal, currVal, idx) => {
23868               return idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal;
23869             }, "");
23870             const doc = textToDoc(text, {
23871               parser: "scss"
23872             });
23873             return transformCssDoc(doc, path, print);
23874           }
23875           /*
23876            * react-relay and graphql-tag
23877            * graphql`...`
23878            * graphql.experimental`...`
23879            * gql`...`
23880            *
23881            * This intentionally excludes Relay Classic tags, as Prettier does not
23882            * support Relay Classic formatting.
23883            */
23884
23885
23886           if (isGraphQL(path)) {
23887             const expressionDocs = node.expressions ? path.map(print, "expressions") : [];
23888             const numQuasis = node.quasis.length;
23889
23890             if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") {
23891               return "``";
23892             }
23893
23894             const parts = [];
23895
23896             for (let i = 0; i < numQuasis; i++) {
23897               const templateElement = node.quasis[i];
23898               const isFirst = i === 0;
23899               const isLast = i === numQuasis - 1;
23900               const text = templateElement.value.cooked; // Bail out if any of the quasis have an invalid escape sequence
23901               // (which would make the `cooked` value be `null` or `undefined`)
23902
23903               if (typeof text !== "string") {
23904                 return null;
23905               }
23906
23907               const lines = text.split("\n");
23908               const numLines = lines.length;
23909               const expressionDoc = expressionDocs[i];
23910               const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
23911               const endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === "";
23912               const commentsAndWhitespaceOnly = lines.every(line => /^\s*(?:#[^\r\n]*)?$/.test(line)); // Bail out if an interpolation occurs within a comment.
23913
23914               if (!isLast && /#[^\r\n]*$/.test(lines[numLines - 1])) {
23915                 return null;
23916               }
23917
23918               let doc = null;
23919
23920               if (commentsAndWhitespaceOnly) {
23921                 doc = printGraphqlComments(lines);
23922               } else {
23923                 doc = stripTrailingHardline$2(textToDoc(text, {
23924                   parser: "graphql"
23925                 }));
23926               }
23927
23928               if (doc) {
23929                 doc = escapeTemplateCharacters(doc, false);
23930
23931                 if (!isFirst && startsWithBlankLine) {
23932                   parts.push("");
23933                 }
23934
23935                 parts.push(doc);
23936
23937                 if (!isLast && endsWithBlankLine) {
23938                   parts.push("");
23939                 }
23940               } else if (!isFirst && !isLast && startsWithBlankLine) {
23941                 parts.push("");
23942               }
23943
23944               if (expressionDoc) {
23945                 parts.push(concat$b(["${", expressionDoc, "}"]));
23946               }
23947             }
23948
23949             return concat$b(["`", indent$6(concat$b([hardline$8, join$7(hardline$8, parts)])), hardline$8, "`"]);
23950           }
23951
23952           const htmlParser = isHtml(path) ? "html" : isAngularComponentTemplate(path) ? "angular" : undefined;
23953
23954           if (htmlParser) {
23955             return printHtmlTemplateLiteral(path, print, textToDoc, htmlParser, options);
23956           }
23957
23958           break;
23959         }
23960
23961       case "TemplateElement":
23962         {
23963           /**
23964            * md`...`
23965            * markdown`...`
23966            */
23967           if (parentParent && parentParent.type === "TaggedTemplateExpression" && parent.quasis.length === 1 && parentParent.tag.type === "Identifier" && (parentParent.tag.name === "md" || parentParent.tag.name === "markdown")) {
23968             const text = parent.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
23969             const indentation = getIndentation(text);
23970             const hasIndent = indentation !== "";
23971             return concat$b([hasIndent ? indent$6(concat$b([softline$5, printMarkdown(text.replace(new RegExp("^".concat(indentation), "gm"), ""))])) : concat$b([literalline$3, dedentToRoot$2(printMarkdown(text))]), softline$5]);
23972           }
23973
23974           break;
23975         }
23976     }
23977
23978     function printMarkdown(text) {
23979       const doc = textToDoc(text, {
23980         parser: "markdown",
23981         __inJsTemplate: true
23982       });
23983       return stripTrailingHardline$2(escapeTemplateCharacters(doc, true));
23984     }
23985   }
23986
23987   function getIndentation(str) {
23988     const firstMatchedIndent = str.match(/^([^\S\n]*)\S/m);
23989     return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
23990   }
23991
23992   function uncook(cookedValue) {
23993     return cookedValue.replace(/([\\`]|\$\{)/g, "\\$1");
23994   }
23995
23996   function escapeTemplateCharacters(doc, raw) {
23997     return mapDoc$3(doc, currentDoc => {
23998       if (!currentDoc.parts) {
23999         return currentDoc;
24000       }
24001
24002       const parts = [];
24003       currentDoc.parts.forEach(part => {
24004         if (typeof part === "string") {
24005           parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : uncook(part));
24006         } else {
24007           parts.push(part);
24008         }
24009       });
24010       return Object.assign({}, currentDoc, {
24011         parts
24012       });
24013     });
24014   }
24015
24016   function transformCssDoc(quasisDoc, path, print) {
24017     const parentNode = path.getValue();
24018     const isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim();
24019
24020     if (isEmpty) {
24021       return "``";
24022     }
24023
24024     const expressionDocs = parentNode.expressions ? path.map(print, "expressions") : [];
24025     const newDoc = replacePlaceholders(quasisDoc, expressionDocs);
24026     /* istanbul ignore if */
24027
24028     if (!newDoc) {
24029       throw new Error("Couldn't insert all the expressions");
24030     }
24031
24032     return concat$b(["`", indent$6(concat$b([hardline$8, stripTrailingHardline$2(newDoc)])), softline$5, "`"]);
24033   } // Search all the placeholders in the quasisDoc tree
24034   // and replace them with the expression docs one by one
24035   // returns a new doc with all the placeholders replaced,
24036   // or null if it couldn't replace any expression
24037
24038
24039   function replacePlaceholders(quasisDoc, expressionDocs) {
24040     if (!expressionDocs || !expressionDocs.length) {
24041       return quasisDoc;
24042     }
24043
24044     const expressions = expressionDocs.slice();
24045     let replaceCounter = 0;
24046     const newDoc = mapDoc$3(quasisDoc, doc => {
24047       if (!doc || !doc.parts || !doc.parts.length) {
24048         return doc;
24049       }
24050
24051       let {
24052         parts
24053       } = doc;
24054       const atIndex = parts.indexOf("@");
24055       const placeholderIndex = atIndex + 1;
24056
24057       if (atIndex > -1 && typeof parts[placeholderIndex] === "string" && parts[placeholderIndex].startsWith("prettier-placeholder")) {
24058         // If placeholder is split, join it
24059         const at = parts[atIndex];
24060         const placeholder = parts[placeholderIndex];
24061         const rest = parts.slice(placeholderIndex + 1);
24062         parts = parts.slice(0, atIndex).concat([at + placeholder]).concat(rest);
24063       }
24064
24065       const atPlaceholderIndex = parts.findIndex(part => typeof part === "string" && part.startsWith("@prettier-placeholder"));
24066
24067       if (atPlaceholderIndex > -1) {
24068         const placeholder = parts[atPlaceholderIndex];
24069         const rest = parts.slice(atPlaceholderIndex + 1);
24070         const placeholderMatch = placeholder.match(/@prettier-placeholder-(.+)-id([\s\S]*)/);
24071         const placeholderID = placeholderMatch[1]; // When the expression has a suffix appended, like:
24072         // animation: linear ${time}s ease-out;
24073
24074         const suffix = placeholderMatch[2];
24075         const expression = expressions[placeholderID];
24076         replaceCounter++;
24077         parts = parts.slice(0, atPlaceholderIndex).concat(["${", expression, "}" + suffix]).concat(rest);
24078       }
24079
24080       return Object.assign({}, doc, {
24081         parts
24082       });
24083     });
24084     return expressions.length === replaceCounter ? newDoc : null;
24085   }
24086
24087   function printGraphqlComments(lines) {
24088     const parts = [];
24089     let seenComment = false;
24090     lines.map(textLine => textLine.trim()).forEach((textLine, i, array) => {
24091       // Lines are either whitespace only, or a comment (with potential whitespace
24092       // around it). Drop whitespace-only lines.
24093       if (textLine === "") {
24094         return;
24095       }
24096
24097       if (array[i - 1] === "" && seenComment) {
24098         // If a non-first comment is preceded by a blank (whitespace only) line,
24099         // add in a blank line.
24100         parts.push(concat$b([hardline$8, textLine]));
24101       } else {
24102         parts.push(textLine);
24103       }
24104
24105       seenComment = true;
24106     }); // If `lines` was whitespace only, return `null`.
24107
24108     return parts.length === 0 ? null : join$7(hardline$8, parts);
24109   }
24110   /**
24111    * Template literal in these contexts:
24112    * <style jsx>{`div{color:red}`}</style>
24113    * css``
24114    * css.global``
24115    * css.resolve``
24116    */
24117
24118
24119   function isStyledJsx(path) {
24120     const node = path.getValue();
24121     const parent = path.getParentNode();
24122     const parentParent = path.getParentNode(1);
24123     return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some(attribute => attribute.name.name === "jsx") || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "Identifier" && parent.tag.name === "css" || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "MemberExpression" && parent.tag.object.name === "css" && (parent.tag.property.name === "global" || parent.tag.property.name === "resolve");
24124   }
24125   /**
24126    * Angular Components can have:
24127    * - Inline HTML template
24128    * - Inline CSS styles
24129    *
24130    * ...which are both within template literals somewhere
24131    * inside of the Component decorator factory.
24132    *
24133    * E.g.
24134    * @Component({
24135    *  template: `<div>...</div>`,
24136    *  styles: [`h1 { color: blue; }`]
24137    * })
24138    */
24139
24140
24141   function isAngularComponentStyles(path) {
24142     return path.match(node => node.type === "TemplateLiteral", (node, name) => node.type === "ArrayExpression" && name === "elements", (node, name) => (node.type === "Property" || node.type === "ObjectProperty") && node.key.type === "Identifier" && node.key.name === "styles" && name === "value", ...angularComponentObjectExpressionPredicates);
24143   }
24144
24145   function isAngularComponentTemplate(path) {
24146     return path.match(node => node.type === "TemplateLiteral", (node, name) => (node.type === "Property" || node.type === "ObjectProperty") && node.key.type === "Identifier" && node.key.name === "template" && name === "value", ...angularComponentObjectExpressionPredicates);
24147   }
24148
24149   const angularComponentObjectExpressionPredicates = [(node, name) => node.type === "ObjectExpression" && name === "properties", (node, name) => node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "Component" && name === "arguments", (node, name) => node.type === "Decorator" && name === "expression"];
24150   /**
24151    * styled-components template literals
24152    */
24153
24154   function isStyledComponents(path) {
24155     const parent = path.getParentNode();
24156
24157     if (!parent || parent.type !== "TaggedTemplateExpression") {
24158       return false;
24159     }
24160
24161     const {
24162       tag
24163     } = parent;
24164
24165     switch (tag.type) {
24166       case "MemberExpression":
24167         return (// styled.foo``
24168           isStyledIdentifier(tag.object) || // Component.extend``
24169           isStyledExtend(tag)
24170         );
24171
24172       case "CallExpression":
24173         return (// styled(Component)``
24174           isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.attrs({})``
24175           isStyledIdentifier(tag.callee.object.object) || // Component.extend.attrs({})``
24176           isStyledExtend(tag.callee.object)) || // styled(Component).attrs({})``
24177           tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee))
24178         );
24179
24180       case "Identifier":
24181         // css``
24182         return tag.name === "css";
24183
24184       default:
24185         return false;
24186     }
24187   }
24188   /**
24189    * JSX element with CSS prop
24190    */
24191
24192
24193   function isCssProp(path) {
24194     const parent = path.getParentNode();
24195     const parentParent = path.getParentNode(1);
24196     return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css";
24197   }
24198
24199   function isStyledIdentifier(node) {
24200     return node.type === "Identifier" && node.name === "styled";
24201   }
24202
24203   function isStyledExtend(node) {
24204     return /^[A-Z]/.test(node.object.name) && node.property.name === "extend";
24205   }
24206   /*
24207    * react-relay and graphql-tag
24208    * graphql`...`
24209    * graphql.experimental`...`
24210    * gql`...`
24211    * GraphQL comment block
24212    *
24213    * This intentionally excludes Relay Classic tags, as Prettier does not
24214    * support Relay Classic formatting.
24215    */
24216
24217
24218   function isGraphQL(path) {
24219     const node = path.getValue();
24220     const parent = path.getParentNode();
24221     return hasLanguageComment(node, "GraphQL") || parent && (parent.type === "TaggedTemplateExpression" && (parent.tag.type === "MemberExpression" && parent.tag.object.name === "graphql" && parent.tag.property.name === "experimental" || parent.tag.type === "Identifier" && (parent.tag.name === "gql" || parent.tag.name === "graphql")) || parent.type === "CallExpression" && parent.callee.type === "Identifier" && parent.callee.name === "graphql");
24222   }
24223
24224   function hasLanguageComment(node, languageName) {
24225     // This checks for a leading comment that is exactly `/* GraphQL */`
24226     // In order to be in line with other implementations of this comment tag
24227     // we will not trim the comment value and we will expect exactly one space on
24228     // either side of the GraphQL string
24229     // Also see ./clean.js
24230     return hasLeadingComment$1(node, comment => isBlockComment$1(comment) && comment.value === " ".concat(languageName, " "));
24231   }
24232   /**
24233    *     - html`...`
24234    *     - HTML comment block
24235    */
24236
24237
24238   function isHtml(path) {
24239     return hasLanguageComment(path.getValue(), "HTML") || path.match(node => node.type === "TemplateLiteral", (node, name) => node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi");
24240   } // The counter is needed to distinguish nested embeds.
24241
24242
24243   let htmlTemplateLiteralCounter = 0;
24244
24245   function printHtmlTemplateLiteral(path, print, textToDoc, parser, options) {
24246     const node = path.getValue();
24247     const counter = htmlTemplateLiteralCounter;
24248     htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
24249
24250     const composePlaceholder = index => "PRETTIER_HTML_PLACEHOLDER_".concat(index, "_").concat(counter, "_IN_JS");
24251
24252     const text = node.quasis.map((quasi, index, quasis) => index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index)).join("");
24253     const expressionDocs = path.map(print, "expressions");
24254
24255     if (expressionDocs.length === 0 && text.trim().length === 0) {
24256       return "``";
24257     }
24258
24259     const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
24260     let topLevelCount = 0;
24261     const contentDoc = mapDoc$3(stripTrailingHardline$2(textToDoc(text, {
24262       parser,
24263
24264       __onHtmlRoot(root) {
24265         topLevelCount = root.children.length;
24266       }
24267
24268     })), doc => {
24269       if (typeof doc !== "string") {
24270         return doc;
24271       }
24272
24273       const parts = [];
24274       const components = doc.split(placeholderRegex);
24275
24276       for (let i = 0; i < components.length; i++) {
24277         let component = components[i];
24278
24279         if (i % 2 === 0) {
24280           if (component) {
24281             component = uncook(component);
24282
24283             if (options.embeddedInHtml) {
24284               component = component.replace(/<\/(script)\b/gi, "<\\/$1");
24285             }
24286
24287             parts.push(component);
24288           }
24289
24290           continue;
24291         }
24292
24293         const placeholderIndex = +component;
24294         parts.push(concat$b(["${", group$a(expressionDocs[placeholderIndex]), "}"]));
24295       }
24296
24297       return concat$b(parts);
24298     });
24299     const leadingWhitespace = /^\s/.test(text) ? " " : "";
24300     const trailingWhitespace = /\s$/.test(text) ? " " : "";
24301     const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline$8 : leadingWhitespace && trailingWhitespace ? line$7 : null;
24302
24303     if (linebreak) {
24304       return group$a(concat$b(["`", indent$6(concat$b([linebreak, group$a(contentDoc)])), linebreak, "`"]));
24305     }
24306
24307     return group$a(concat$b(["`", leadingWhitespace, topLevelCount > 1 ? indent$6(group$a(contentDoc)) : group$a(contentDoc), trailingWhitespace, "`"]));
24308   }
24309
24310   var embed_1$1 = embed$3;
24311
24312   function clean$4(ast, newObj, parent) {
24313     ["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "flags", "errors"].forEach(name => {
24314       delete newObj[name];
24315     });
24316
24317     if (ast.loc && ast.loc.source === null) {
24318       delete newObj.loc.source;
24319     }
24320
24321     if (ast.type === "BigIntLiteral") {
24322       newObj.value = newObj.value.toLowerCase();
24323     } // We remove extra `;` and add them when needed
24324
24325
24326     if (ast.type === "EmptyStatement") {
24327       return null;
24328     } // We move text around, including whitespaces and add {" "}
24329
24330
24331     if (ast.type === "JSXText") {
24332       return null;
24333     }
24334
24335     if (ast.type === "JSXExpressionContainer" && ast.expression.type === "Literal" && ast.expression.value === " ") {
24336       return null;
24337     } // (TypeScript) Ignore `static` in `constructor(static p) {}`
24338     // and `export` in `constructor(export p) {}`
24339
24340
24341     if (ast.type === "TSParameterProperty" && ast.accessibility === null && !ast.readonly) {
24342       return {
24343         type: "Identifier",
24344         name: ast.parameter.name,
24345         typeAnnotation: newObj.parameter.typeAnnotation,
24346         decorators: newObj.decorators
24347       };
24348     } // (TypeScript) ignore empty `specifiers` array
24349
24350
24351     if (ast.type === "TSNamespaceExportDeclaration" && ast.specifiers && ast.specifiers.length === 0) {
24352       delete newObj.specifiers;
24353     } // We convert <div></div> to <div />
24354
24355
24356     if (ast.type === "JSXOpeningElement") {
24357       delete newObj.selfClosing;
24358     }
24359
24360     if (ast.type === "JSXElement") {
24361       delete newObj.closingElement;
24362     } // We change {'key': value} into {key: value}
24363
24364
24365     if ((ast.type === "Property" || ast.type === "ObjectProperty" || ast.type === "MethodDefinition" || ast.type === "ClassProperty" || ast.type === "TSPropertySignature" || ast.type === "ObjectTypeProperty") && typeof ast.key === "object" && ast.key && (ast.key.type === "Literal" || ast.key.type === "StringLiteral" || ast.key.type === "Identifier")) {
24366       delete newObj.key;
24367     }
24368
24369     if (ast.type === "OptionalMemberExpression" && ast.optional === false) {
24370       newObj.type = "MemberExpression";
24371       delete newObj.optional;
24372     } // Remove raw and cooked values from TemplateElement when it's CSS
24373     // styled-jsx
24374
24375
24376     if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some(attr => attr.name.name === "jsx")) {
24377       const templateLiterals = newObj.children.filter(child => child.type === "JSXExpressionContainer" && child.expression.type === "TemplateLiteral").map(container => container.expression);
24378       const quasis = templateLiterals.reduce((quasis, templateLiteral) => quasis.concat(templateLiteral.quasis), []);
24379       quasis.forEach(q => delete q.value);
24380     } // CSS template literals in css prop
24381
24382
24383     if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") {
24384       newObj.value.expression.quasis.forEach(q => delete q.value);
24385     } // Angular Components: Inline HTML template and Inline CSS styles
24386
24387
24388     const expression = ast.expression || ast.callee;
24389
24390     if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) {
24391       const astProps = ast.expression.arguments[0].properties;
24392       newObj.expression.arguments[0].properties.forEach((prop, index) => {
24393         let templateLiteral = null;
24394
24395         switch (astProps[index].key.name) {
24396           case "styles":
24397             if (prop.value.type === "ArrayExpression") {
24398               templateLiteral = prop.value.elements[0];
24399             }
24400
24401             break;
24402
24403           case "template":
24404             if (prop.value.type === "TemplateLiteral") {
24405               templateLiteral = prop.value;
24406             }
24407
24408             break;
24409         }
24410
24411         if (templateLiteral) {
24412           templateLiteral.quasis.forEach(q => delete q.value);
24413         }
24414       });
24415     } // styled-components, graphql, markdown
24416
24417
24418     if (ast.type === "TaggedTemplateExpression" && (ast.tag.type === "MemberExpression" || ast.tag.type === "Identifier" && (ast.tag.name === "gql" || ast.tag.name === "graphql" || ast.tag.name === "css" || ast.tag.name === "md" || ast.tag.name === "markdown" || ast.tag.name === "html") || ast.tag.type === "CallExpression")) {
24419       newObj.quasi.quasis.forEach(quasi => delete quasi.value);
24420     }
24421
24422     if (ast.type === "TemplateLiteral") {
24423       // This checks for a leading comment that is exactly `/* GraphQL */`
24424       // In order to be in line with other implementations of this comment tag
24425       // we will not trim the comment value and we will expect exactly one space on
24426       // either side of the GraphQL string
24427       // Also see ./embed.js
24428       const hasLanguageComment = ast.leadingComments && ast.leadingComments.some(comment => comment.type === "CommentBlock" && ["GraphQL", "HTML"].some(languageName => comment.value === " ".concat(languageName, " ")));
24429
24430       if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql") {
24431         newObj.quasis.forEach(quasi => delete quasi.value);
24432       }
24433     }
24434   }
24435
24436   var clean_1$1 = clean$4;
24437
24438   const {
24439     getLast: getLast$2,
24440     hasNewline: hasNewline$4,
24441     hasNewlineInRange: hasNewlineInRange$2,
24442     hasIgnoreComment: hasIgnoreComment$3,
24443     hasNodeIgnoreComment: hasNodeIgnoreComment$1,
24444     skipWhitespace: skipWhitespace$2
24445   } = util$1;
24446   const isIdentifierName = utils$1.keyword.isIdentifierNameES5; // We match any whitespace except line terminators because
24447   // Flow annotation comments cannot be split across lines. For example:
24448   //
24449   // (this /*
24450   // : any */).foo = 5;
24451   //
24452   // is not picked up by Flow (see https://github.com/facebook/flow/issues/7050), so
24453   // removing the newline would create a type annotation that the user did not intend
24454   // to create.
24455
24456   const NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)";
24457   const FLOW_SHORTHAND_ANNOTATION = new RegExp("^".concat(NON_LINE_TERMINATING_WHITE_SPACE, "*:"));
24458   const FLOW_ANNOTATION = new RegExp("^".concat(NON_LINE_TERMINATING_WHITE_SPACE, "*::"));
24459
24460   function hasFlowShorthandAnnotationComment(node) {
24461     // https://flow.org/en/docs/types/comments/
24462     // Syntax example: const r = new (window.Request /*: Class<Request> */)("");
24463     return node.extra && node.extra.parenthesized && node.trailingComments && node.trailingComments[0].value.match(FLOW_SHORTHAND_ANNOTATION);
24464   }
24465
24466   function hasFlowAnnotationComment(comments) {
24467     return comments && comments[0].value.match(FLOW_ANNOTATION);
24468   }
24469
24470   function hasNode(node, fn) {
24471     if (!node || typeof node !== "object") {
24472       return false;
24473     }
24474
24475     if (Array.isArray(node)) {
24476       return node.some(value => hasNode(value, fn));
24477     }
24478
24479     const result = fn(node);
24480     return typeof result === "boolean" ? result : Object.keys(node).some(key => hasNode(node[key], fn));
24481   }
24482
24483   function hasNakedLeftSide(node) {
24484     return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || node.type === "TSAsExpression" || node.type === "TSNonNullExpression";
24485   }
24486
24487   function getLeftSide(node) {
24488     if (node.expressions) {
24489       return node.expressions[0];
24490     }
24491
24492     return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
24493   }
24494
24495   function getLeftSidePathName(path, node) {
24496     if (node.expressions) {
24497       return ["expressions", 0];
24498     }
24499
24500     if (node.left) {
24501       return ["left"];
24502     }
24503
24504     if (node.test) {
24505       return ["test"];
24506     }
24507
24508     if (node.object) {
24509       return ["object"];
24510     }
24511
24512     if (node.callee) {
24513       return ["callee"];
24514     }
24515
24516     if (node.tag) {
24517       return ["tag"];
24518     }
24519
24520     if (node.argument) {
24521       return ["argument"];
24522     }
24523
24524     if (node.expression) {
24525       return ["expression"];
24526     }
24527
24528     throw new Error("Unexpected node has no left side", node);
24529   }
24530
24531   const exportDeclarationTypes = new Set(["ExportDefaultDeclaration", "ExportDefaultSpecifier", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
24532
24533   function isExportDeclaration(node) {
24534     return node && exportDeclarationTypes.has(node.type);
24535   }
24536
24537   function getParentExportDeclaration(path) {
24538     const parentNode = path.getParentNode();
24539
24540     if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
24541       return parentNode;
24542     }
24543
24544     return null;
24545   }
24546
24547   function isLiteral(node) {
24548     return node.type === "BooleanLiteral" || node.type === "DirectiveLiteral" || node.type === "Literal" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "TemplateLiteral" || node.type === "TSTypeLiteral" || node.type === "JSXText";
24549   }
24550
24551   function isNumericLiteral(node) {
24552     return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
24553   }
24554
24555   function isStringLiteral(node) {
24556     return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string";
24557   }
24558
24559   function isObjectType(n) {
24560     return n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral";
24561   }
24562
24563   function isFunctionOrArrowExpression(node) {
24564     return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
24565   }
24566
24567   function isFunctionOrArrowExpressionWithBody(node) {
24568     return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement";
24569   }
24570
24571   function isTemplateLiteral(node) {
24572     return node.type === "TemplateLiteral";
24573   } // `inject` is used in AngularJS 1.x, `async` in Angular 2+
24574   // example: https://docs.angularjs.org/guide/unit-testing#using-beforeall-
24575
24576
24577   function isAngularTestWrapper(node) {
24578     return (node.type === "CallExpression" || node.type === "OptionalCallExpression") && node.callee.type === "Identifier" && (node.callee.name === "async" || node.callee.name === "inject" || node.callee.name === "fakeAsync");
24579   }
24580
24581   function isJSXNode(node) {
24582     return node.type === "JSXElement" || node.type === "JSXFragment";
24583   }
24584
24585   function isTheOnlyJSXElementInMarkdown(options, path) {
24586     if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
24587       return false;
24588     }
24589
24590     const node = path.getNode();
24591
24592     if (!node.expression || !isJSXNode(node.expression)) {
24593       return false;
24594     }
24595
24596     const parent = path.getParentNode();
24597     return parent.type === "Program" && parent.body.length === 1;
24598   } // Detect an expression node representing `{" "}`
24599
24600
24601   function isJSXWhitespaceExpression(node) {
24602     return node.type === "JSXExpressionContainer" && isLiteral(node.expression) && node.expression.value === " " && !node.expression.comments;
24603   }
24604
24605   function isMemberExpressionChain(node) {
24606     if (node.type !== "MemberExpression" && node.type !== "OptionalMemberExpression") {
24607       return false;
24608     }
24609
24610     if (node.object.type === "Identifier") {
24611       return true;
24612     }
24613
24614     return isMemberExpressionChain(node.object);
24615   }
24616
24617   function isGetterOrSetter(node) {
24618     return node.kind === "get" || node.kind === "set";
24619   }
24620
24621   function sameLocStart(nodeA, nodeB, options) {
24622     return options.locStart(nodeA) === options.locStart(nodeB);
24623   } // TODO: This is a bad hack and we need a better way to distinguish between
24624   // arrow functions and otherwise
24625
24626
24627   function isFunctionNotation(node, options) {
24628     return isGetterOrSetter(node) || sameLocStart(node, node.value, options);
24629   } // Hack to differentiate between the following two which have the same ast
24630   // type T = { method: () => void };
24631   // type T = { method(): void };
24632
24633
24634   function isObjectTypePropertyAFunction(node, options) {
24635     return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation(node, options);
24636   } // Hack to differentiate between the following two which have the same ast
24637   // declare function f(a): void;
24638   // var f: (a) => void;
24639
24640
24641   function isTypeAnnotationAFunction(node, options) {
24642     return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !sameLocStart(node, node.typeAnnotation, options);
24643   }
24644
24645   const binaryishNodeTypes = new Set(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
24646
24647   function isBinaryish(node) {
24648     return binaryishNodeTypes.has(node.type);
24649   }
24650
24651   function isMemberish(node) {
24652     return node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "BindExpression" && node.object;
24653   }
24654
24655   function isSimpleFlowType(node) {
24656     const flowTypeAnnotations = ["AnyTypeAnnotation", "NullLiteralTypeAnnotation", "GenericTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation", "BooleanTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringTypeAnnotation"];
24657     return node && flowTypeAnnotations.includes(node.type) && !(node.type === "GenericTypeAnnotation" && node.typeParameters);
24658   }
24659
24660   const unitTestRe = /^(skip|[fx]?(it|describe|test))$/;
24661
24662   function isSkipOrOnlyBlock(node) {
24663     return (node.callee.type === "MemberExpression" || node.callee.type === "OptionalMemberExpression") && node.callee.object.type === "Identifier" && node.callee.property.type === "Identifier" && unitTestRe.test(node.callee.object.name) && (node.callee.property.name === "only" || node.callee.property.name === "skip");
24664   }
24665
24666   function isUnitTestSetUp(n) {
24667     const unitTestSetUpRe = /^(before|after)(Each|All)$/;
24668     return n.callee.type === "Identifier" && unitTestSetUpRe.test(n.callee.name) && n.arguments.length === 1;
24669   } // eg; `describe("some string", (done) => {})`
24670
24671
24672   function isTestCall(n, parent) {
24673     if (n.type !== "CallExpression") {
24674       return false;
24675     }
24676
24677     if (n.arguments.length === 1) {
24678       if (isAngularTestWrapper(n) && parent && isTestCall(parent)) {
24679         return isFunctionOrArrowExpression(n.arguments[0]);
24680       }
24681
24682       if (isUnitTestSetUp(n)) {
24683         return isAngularTestWrapper(n.arguments[0]);
24684       }
24685     } else if (n.arguments.length === 2 || n.arguments.length === 3) {
24686       if ((n.callee.type === "Identifier" && unitTestRe.test(n.callee.name) || isSkipOrOnlyBlock(n)) && (isTemplateLiteral(n.arguments[0]) || isStringLiteral(n.arguments[0]))) {
24687         // it("name", () => { ... }, 2500)
24688         if (n.arguments[2] && !isNumericLiteral(n.arguments[2])) {
24689           return false;
24690         }
24691
24692         return (n.arguments.length === 2 ? isFunctionOrArrowExpression(n.arguments[1]) : isFunctionOrArrowExpressionWithBody(n.arguments[1]) && n.arguments[1].params.length <= 1) || isAngularTestWrapper(n.arguments[1]);
24693       }
24694     }
24695
24696     return false;
24697   }
24698
24699   function hasLeadingComment$2(node) {
24700     return node.comments && node.comments.some(comment => comment.leading);
24701   }
24702
24703   function hasTrailingComment(node) {
24704     return node.comments && node.comments.some(comment => comment.trailing);
24705   }
24706
24707   function isCallOrOptionalCallExpression(node) {
24708     return node.type === "CallExpression" || node.type === "OptionalCallExpression";
24709   }
24710
24711   function hasDanglingComments(node) {
24712     return node.comments && node.comments.some(comment => !comment.leading && !comment.trailing);
24713   }
24714   /** identify if an angular expression seems to have side effects */
24715
24716
24717   function hasNgSideEffect(path) {
24718     return hasNode(path.getValue(), node => {
24719       switch (node.type) {
24720         case undefined:
24721           return false;
24722
24723         case "CallExpression":
24724         case "OptionalCallExpression":
24725         case "AssignmentExpression":
24726           return true;
24727       }
24728     });
24729   }
24730
24731   function isNgForOf(node, index, parentNode) {
24732     return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
24733   }
24734   /** @param node {import("estree").TemplateLiteral} */
24735
24736
24737   function isSimpleTemplateLiteral(node) {
24738     if (node.expressions.length === 0) {
24739       return false;
24740     }
24741
24742     return node.expressions.every(expr => {
24743       // Disallow comments since printDocToString can't print them here
24744       if (expr.comments) {
24745         return false;
24746       } // Allow `x` and `this`
24747
24748
24749       if (expr.type === "Identifier" || expr.type === "ThisExpression") {
24750         return true;
24751       } // Allow `a.b.c`, `a.b[c]`, and `this.x.y`
24752
24753
24754       if (expr.type === "MemberExpression" || expr.type === "OptionalMemberExpression") {
24755         let head = expr;
24756
24757         while (head.type === "MemberExpression" || head.type === "OptionalMemberExpression") {
24758           if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") {
24759             return false;
24760           }
24761
24762           head = head.object;
24763
24764           if (head.comments) {
24765             return false;
24766           }
24767         }
24768
24769         if (head.type === "Identifier" || head.type === "ThisExpression") {
24770           return true;
24771         }
24772
24773         return false;
24774       }
24775
24776       return false;
24777     });
24778   }
24779
24780   function getFlowVariance(path) {
24781     if (!path.variance) {
24782       return null;
24783     } // Babel 7.0 currently uses variance node type, and flow should
24784     // follow suit soon:
24785     // https://github.com/babel/babel/issues/4722
24786
24787
24788     const variance = path.variance.kind || path.variance;
24789
24790     switch (variance) {
24791       case "plus":
24792         return "+";
24793
24794       case "minus":
24795         return "-";
24796
24797       default:
24798         /* istanbul ignore next */
24799         return variance;
24800     }
24801   }
24802
24803   function classPropMayCauseASIProblems(path) {
24804     const node = path.getNode();
24805
24806     if (node.type !== "ClassProperty") {
24807       return false;
24808     }
24809
24810     const name = node.key && node.key.name; // this isn't actually possible yet with most parsers available today
24811     // so isn't properly tested yet.
24812
24813     if ((name === "static" || name === "get" || name === "set") && !node.value && !node.typeAnnotation) {
24814       return true;
24815     }
24816   }
24817
24818   function classChildNeedsASIProtection(node) {
24819     if (!node) {
24820       return;
24821     }
24822
24823     if (node.static || node.accessibility // TypeScript
24824     ) {
24825         return false;
24826       }
24827
24828     if (!node.computed) {
24829       const name = node.key && node.key.name;
24830
24831       if (name === "in" || name === "instanceof") {
24832         return true;
24833       }
24834     }
24835
24836     switch (node.type) {
24837       case "ClassProperty":
24838       case "TSAbstractClassProperty":
24839         return node.computed;
24840
24841       case "MethodDefinition": // Flow
24842
24843       case "TSAbstractMethodDefinition": // TypeScript
24844
24845       case "ClassMethod":
24846       case "ClassPrivateMethod":
24847         {
24848           // Babel
24849           const isAsync = node.value ? node.value.async : node.async;
24850           const isGenerator = node.value ? node.value.generator : node.generator;
24851
24852           if (isAsync || node.kind === "get" || node.kind === "set") {
24853             return false;
24854           }
24855
24856           if (node.computed || isGenerator) {
24857             return true;
24858           }
24859
24860           return false;
24861         }
24862
24863       case "TSIndexSignature":
24864         return true;
24865
24866       default:
24867         /* istanbul ignore next */
24868         return false;
24869     }
24870   }
24871
24872   function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
24873     if (tokenNode === "+") {
24874       return "+" + keyword;
24875     } else if (tokenNode === "-") {
24876       return "-" + keyword;
24877     }
24878
24879     return keyword;
24880   }
24881
24882   function hasNewlineBetweenOrAfterDecorators(node, options) {
24883     return hasNewlineInRange$2(options.originalText, options.locStart(node.decorators[0]), options.locEnd(getLast$2(node.decorators))) || hasNewline$4(options.originalText, options.locEnd(getLast$2(node.decorators)));
24884   } // Only space, newline, carriage return, and tab are treated as whitespace
24885   // inside JSX.
24886
24887
24888   const jsxWhitespaceChars = " \n\r\t";
24889   const matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
24890   const containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]"); // Meaningful if it contains non-whitespace characters,
24891   // or it contains whitespace without a new line.
24892
24893   function isMeaningfulJSXText(node) {
24894     return isLiteral(node) && (containsNonJsxWhitespaceRegex.test(rawText(node)) || !/\n/.test(rawText(node)));
24895   }
24896
24897   function hasJsxIgnoreComment(path) {
24898     const node = path.getValue();
24899     const parent = path.getParentNode();
24900
24901     if (!parent || !node || !isJSXNode(node) || !isJSXNode(parent)) {
24902       return false;
24903     } // Lookup the previous sibling, ignoring any empty JSXText elements
24904
24905
24906     const index = parent.children.indexOf(node);
24907     let prevSibling = null;
24908
24909     for (let i = index; i > 0; i--) {
24910       const candidate = parent.children[i - 1];
24911
24912       if (candidate.type === "JSXText" && !isMeaningfulJSXText(candidate)) {
24913         continue;
24914       }
24915
24916       prevSibling = candidate;
24917       break;
24918     }
24919
24920     return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && prevSibling.expression.comments && prevSibling.expression.comments.find(comment => comment.value.trim() === "prettier-ignore");
24921   }
24922
24923   function isEmptyJSXElement(node) {
24924     if (node.children.length === 0) {
24925       return true;
24926     }
24927
24928     if (node.children.length > 1) {
24929       return false;
24930     } // if there is one text child and does not contain any meaningful text
24931     // we can treat the element as empty.
24932
24933
24934     const child = node.children[0];
24935     return isLiteral(child) && !isMeaningfulJSXText(child);
24936   }
24937
24938   function hasPrettierIgnore$4(path) {
24939     return hasIgnoreComment$3(path) || hasJsxIgnoreComment(path);
24940   }
24941
24942   function isLastStatement(path) {
24943     const parent = path.getParentNode();
24944
24945     if (!parent) {
24946       return true;
24947     }
24948
24949     const node = path.getValue();
24950     const body = (parent.body || parent.consequent).filter(stmt => stmt.type !== "EmptyStatement");
24951     return body && body[body.length - 1] === node;
24952   }
24953
24954   function isFlowAnnotationComment(text, typeAnnotation, options) {
24955     const start = options.locStart(typeAnnotation);
24956     const end = skipWhitespace$2(text, options.locEnd(typeAnnotation));
24957     return text.slice(start, start + 2) === "/*" && text.slice(end, end + 2) === "*/";
24958   }
24959
24960   function hasLeadingOwnLineComment(text, node, options) {
24961     if (isJSXNode(node)) {
24962       return hasNodeIgnoreComment$1(node);
24963     }
24964
24965     const res = node.comments && node.comments.some(comment => comment.leading && hasNewline$4(text, options.locEnd(comment)));
24966     return res;
24967   } // This recurses the return argument, looking for the first token
24968   // (the leftmost leaf node) and, if it (or its parents) has any
24969   // leadingComments, returns true (so it can be wrapped in parens).
24970
24971
24972   function returnArgumentHasLeadingComment(options, argument) {
24973     if (hasLeadingOwnLineComment(options.originalText, argument, options)) {
24974       return true;
24975     }
24976
24977     if (hasNakedLeftSide(argument)) {
24978       let leftMost = argument;
24979       let newLeftMost;
24980
24981       while (newLeftMost = getLeftSide(leftMost)) {
24982         leftMost = newLeftMost;
24983
24984         if (hasLeadingOwnLineComment(options.originalText, leftMost, options)) {
24985           return true;
24986         }
24987       }
24988     }
24989
24990     return false;
24991   }
24992
24993   function isStringPropSafeToCoerceToIdentifier(node, options) {
24994     return isStringLiteral(node.key) && isIdentifierName(node.key.value) && options.parser !== "json" && // With `--strictPropertyInitialization`, TS treats properties with quoted names differently than unquoted ones.
24995     // See https://github.com/microsoft/TypeScript/pull/20075
24996     !((options.parser === "typescript" || options.parser === "babel-ts") && node.type === "ClassProperty");
24997   }
24998
24999   function isJestEachTemplateLiteral(node, parentNode) {
25000     /**
25001      * describe.each`table`(name, fn)
25002      * describe.only.each`table`(name, fn)
25003      * describe.skip.each`table`(name, fn)
25004      * test.each`table`(name, fn)
25005      * test.only.each`table`(name, fn)
25006      * test.skip.each`table`(name, fn)
25007      *
25008      * Ref: https://github.com/facebook/jest/pull/6102
25009      */
25010     const jestEachTriggerRegex = /^[xf]?(describe|it|test)$/;
25011     return parentNode.type === "TaggedTemplateExpression" && parentNode.quasi === node && parentNode.tag.type === "MemberExpression" && parentNode.tag.property.type === "Identifier" && parentNode.tag.property.name === "each" && (parentNode.tag.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.name) || parentNode.tag.object.type === "MemberExpression" && parentNode.tag.object.property.type === "Identifier" && (parentNode.tag.object.property.name === "only" || parentNode.tag.object.property.name === "skip") && parentNode.tag.object.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.object.name));
25012   }
25013
25014   function templateLiteralHasNewLines(template) {
25015     return template.quasis.some(quasi => quasi.value.raw.includes("\n"));
25016   }
25017
25018   function isTemplateOnItsOwnLine(n, text, options) {
25019     return (n.type === "TemplateLiteral" && templateLiteralHasNewLines(n) || n.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(n.quasi)) && !hasNewline$4(text, options.locStart(n), {
25020       backwards: true
25021     });
25022   }
25023
25024   function needsHardlineAfterDanglingComment(node) {
25025     if (!node.comments) {
25026       return false;
25027     }
25028
25029     const lastDanglingComment = getLast$2(node.comments.filter(comment => !comment.leading && !comment.trailing));
25030     return lastDanglingComment && !comments$1.isBlockComment(lastDanglingComment);
25031   } // If we have nested conditional expressions, we want to print them in JSX mode
25032   // if there's at least one JSXElement somewhere in the tree.
25033   //
25034   // A conditional expression chain like this should be printed in normal mode,
25035   // because there aren't JSXElements anywhere in it:
25036   //
25037   // isA ? "A" : isB ? "B" : isC ? "C" : "Unknown";
25038   //
25039   // But a conditional expression chain like this should be printed in JSX mode,
25040   // because there is a JSXElement in the last ConditionalExpression:
25041   //
25042   // isA ? "A" : isB ? "B" : isC ? "C" : <span className="warning">Unknown</span>;
25043   //
25044   // This type of ConditionalExpression chain is structured like this in the AST:
25045   //
25046   // ConditionalExpression {
25047   //   test: ...,
25048   //   consequent: ...,
25049   //   alternate: ConditionalExpression {
25050   //     test: ...,
25051   //     consequent: ...,
25052   //     alternate: ConditionalExpression {
25053   //       test: ...,
25054   //       consequent: ...,
25055   //       alternate: ...,
25056   //     }
25057   //   }
25058   // }
25059   //
25060   // We want to traverse over that shape and convert it into a flat structure so
25061   // that we can find if there's a JSXElement somewhere inside.
25062
25063
25064   function getConditionalChainContents(node) {
25065     // Given this code:
25066     //
25067     // // Using a ConditionalExpression as the consequent is uncommon, but should
25068     // // be handled.
25069     // A ? B : C ? D : E ? F ? G : H : I
25070     //
25071     // which has this AST:
25072     //
25073     // ConditionalExpression {
25074     //   test: Identifier(A),
25075     //   consequent: Identifier(B),
25076     //   alternate: ConditionalExpression {
25077     //     test: Identifier(C),
25078     //     consequent: Identifier(D),
25079     //     alternate: ConditionalExpression {
25080     //       test: Identifier(E),
25081     //       consequent: ConditionalExpression {
25082     //         test: Identifier(F),
25083     //         consequent: Identifier(G),
25084     //         alternate: Identifier(H),
25085     //       },
25086     //       alternate: Identifier(I),
25087     //     }
25088     //   }
25089     // }
25090     //
25091     // we should return this Array:
25092     //
25093     // [
25094     //   Identifier(A),
25095     //   Identifier(B),
25096     //   Identifier(C),
25097     //   Identifier(D),
25098     //   Identifier(E),
25099     //   Identifier(F),
25100     //   Identifier(G),
25101     //   Identifier(H),
25102     //   Identifier(I)
25103     // ];
25104     //
25105     // This loses the information about whether each node was the test,
25106     // consequent, or alternate, but we don't care about that here- we are only
25107     // flattening this structure to find if there's any JSXElements inside.
25108     const nonConditionalExpressions = [];
25109
25110     function recurse(node) {
25111       if (node.type === "ConditionalExpression") {
25112         recurse(node.test);
25113         recurse(node.consequent);
25114         recurse(node.alternate);
25115       } else {
25116         nonConditionalExpressions.push(node);
25117       }
25118     }
25119
25120     recurse(node);
25121     return nonConditionalExpressions;
25122   }
25123
25124   function conditionalExpressionChainContainsJSX(node) {
25125     return Boolean(getConditionalChainContents(node).find(isJSXNode));
25126   } // Logic to check for args with multiple anonymous functions. For instance,
25127   // the following call should be split on multiple lines for readability:
25128   // source.pipe(map((x) => x + x), filter((x) => x % 2 === 0))
25129
25130
25131   function isFunctionCompositionArgs(args) {
25132     if (args.length <= 1) {
25133       return false;
25134     }
25135
25136     let count = 0;
25137
25138     for (const arg of args) {
25139       if (isFunctionOrArrowExpression(arg)) {
25140         count += 1;
25141
25142         if (count > 1) {
25143           return true;
25144         }
25145       } else if (isCallOrOptionalCallExpression(arg)) {
25146         for (const childArg of arg.arguments) {
25147           if (isFunctionOrArrowExpression(childArg)) {
25148             return true;
25149           }
25150         }
25151       }
25152     }
25153
25154     return false;
25155   } // Logic to determine if a call is a “long curried function call”.
25156   // See https://github.com/prettier/prettier/issues/1420.
25157   //
25158   // `connect(a, b, c)(d)`
25159   // In the above call expression, the second call is the parent node and the
25160   // first call is the current node.
25161
25162
25163   function isLongCurriedCallExpression(path) {
25164     const node = path.getValue();
25165     const parent = path.getParentNode();
25166     return isCallOrOptionalCallExpression(node) && isCallOrOptionalCallExpression(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0;
25167   }
25168   /**
25169    * @param {import('estree').Node} node
25170    * @param {number} depth
25171    * @returns {boolean}
25172    */
25173
25174
25175   function isSimpleCallArgument(node, depth) {
25176     if (depth >= 2) {
25177       return false;
25178     }
25179
25180     const isChildSimple = child => isSimpleCallArgument(child, depth + 1);
25181
25182     const regexpPattern = node.type === "Literal" && node.regex && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
25183
25184     if (regexpPattern && regexpPattern.length > 5) {
25185       return false;
25186     }
25187
25188     if (node.type === "Literal" || node.type === "BooleanLiteral" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "StringLiteral" || node.type === "Identifier" || node.type === "ThisExpression" || node.type === "Super" || node.type === "BigIntLiteral" || node.type === "PrivateName" || node.type === "ArgumentPlaceholder" || node.type === "RegExpLiteral" || node.type === "Import") {
25189       return true;
25190     }
25191
25192     if (node.type === "TemplateLiteral") {
25193       return node.expressions.every(isChildSimple);
25194     }
25195
25196     if (node.type === "ObjectExpression") {
25197       return node.properties.every(p => !p.computed && (p.shorthand || p.value && isChildSimple(p.value)));
25198     }
25199
25200     if (node.type === "ArrayExpression") {
25201       return node.elements.every(x => x == null || isChildSimple(x));
25202     }
25203
25204     if (node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "NewExpression") {
25205       return isSimpleCallArgument(node.callee, depth) && node.arguments.every(isChildSimple);
25206     }
25207
25208     if (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") {
25209       return isSimpleCallArgument(node.object, depth) && isSimpleCallArgument(node.property, depth);
25210     }
25211
25212     if (node.type === "UnaryExpression" && (node.operator === "!" || node.operator === "-")) {
25213       return isSimpleCallArgument(node.argument, depth);
25214     }
25215
25216     if (node.type === "TSNonNullExpression") {
25217       return isSimpleCallArgument(node.expression, depth);
25218     }
25219
25220     return false;
25221   }
25222
25223   function rawText(node) {
25224     return node.extra ? node.extra.raw : node.raw;
25225   }
25226
25227   function identity$1(x) {
25228     return x;
25229   }
25230
25231   function isTSXFile(options) {
25232     return options.filepath && /\.tsx$/i.test(options.filepath);
25233   }
25234
25235   var utils$5 = {
25236     classChildNeedsASIProtection,
25237     classPropMayCauseASIProblems,
25238     conditionalExpressionChainContainsJSX,
25239     getFlowVariance,
25240     getLeftSidePathName,
25241     getParentExportDeclaration,
25242     getTypeScriptMappedTypeModifier,
25243     hasDanglingComments,
25244     hasFlowAnnotationComment,
25245     hasFlowShorthandAnnotationComment,
25246     hasLeadingComment: hasLeadingComment$2,
25247     hasLeadingOwnLineComment,
25248     hasNakedLeftSide,
25249     hasNewlineBetweenOrAfterDecorators,
25250     hasNgSideEffect,
25251     hasNode,
25252     hasPrettierIgnore: hasPrettierIgnore$4,
25253     hasTrailingComment,
25254     identity: identity$1,
25255     isBinaryish,
25256     isCallOrOptionalCallExpression,
25257     isEmptyJSXElement,
25258     isExportDeclaration,
25259     isFlowAnnotationComment,
25260     isFunctionCompositionArgs,
25261     isFunctionNotation,
25262     isFunctionOrArrowExpression,
25263     isGetterOrSetter,
25264     isJestEachTemplateLiteral,
25265     isJSXNode,
25266     isJSXWhitespaceExpression,
25267     isLastStatement,
25268     isLiteral,
25269     isLongCurriedCallExpression,
25270     isSimpleCallArgument,
25271     isMeaningfulJSXText,
25272     isMemberExpressionChain,
25273     isMemberish,
25274     isNgForOf,
25275     isNumericLiteral,
25276     isObjectType,
25277     isObjectTypePropertyAFunction,
25278     isSimpleFlowType,
25279     isSimpleTemplateLiteral,
25280     isStringLiteral,
25281     isStringPropSafeToCoerceToIdentifier,
25282     isTemplateOnItsOwnLine,
25283     isTestCall,
25284     isTheOnlyJSXElementInMarkdown,
25285     isTSXFile,
25286     isTypeAnnotationAFunction,
25287     matchJsxWhitespaceRegex,
25288     needsHardlineAfterDanglingComment,
25289     rawText,
25290     returnArgumentHasLeadingComment
25291   };
25292
25293   const {
25294     getLeftSidePathName: getLeftSidePathName$1,
25295     hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$1,
25296     hasNakedLeftSide: hasNakedLeftSide$1,
25297     hasNode: hasNode$1
25298   } = utils$5;
25299
25300   function needsParens(path, options) {
25301     const parent = path.getParentNode();
25302
25303     if (!parent) {
25304       return false;
25305     }
25306
25307     const name = path.getName();
25308     const node = path.getNode(); // If the value of this path is some child of a Node and not a Node
25309     // itself, then it doesn't need parentheses. Only Node objects (in
25310     // fact, only Expression nodes) need parentheses.
25311
25312     if (path.getValue() !== node) {
25313       return false;
25314     } // to avoid unexpected `}}` in HTML interpolations
25315
25316
25317     if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) {
25318       return true;
25319     } // Only statements don't need parentheses.
25320
25321
25322     if (isStatement(node)) {
25323       return false;
25324     }
25325
25326     if ( // Preserve parens if we have a Flow annotation comment, unless we're using the Flow
25327     // parser. The Flow parser turns Flow comments into type annotation nodes in its
25328     // AST, which we handle separately.
25329     options.parser !== "flow" && hasFlowShorthandAnnotationComment$1(path.getValue())) {
25330       return true;
25331     } // Identifiers never need parentheses.
25332
25333
25334     if (node.type === "Identifier") {
25335       // ...unless those identifiers are embed placeholders. They might be substituted by complex
25336       // expressions, so the parens around them should not be dropped. Example (JS-in-HTML-in-JS):
25337       //     let tpl = html`<script> f((${expr}) / 2); </script>`;
25338       // If the inner JS formatter removes the parens, the expression might change its meaning:
25339       //     f((a + b) / 2)  vs  f(a + b / 2)
25340       if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
25341         return true;
25342       }
25343
25344       return false;
25345     }
25346
25347     if (parent.type === "ParenthesizedExpression") {
25348       return false;
25349     } // Add parens around the extends clause of a class. It is needed for almost
25350     // all expressions.
25351
25352
25353     if ((parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node && (node.type === "ArrowFunctionExpression" || node.type === "AssignmentExpression" || node.type === "AwaitExpression" || node.type === "BinaryExpression" || node.type === "ConditionalExpression" || node.type === "LogicalExpression" || node.type === "NewExpression" || node.type === "ObjectExpression" || node.type === "ParenthesizedExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "UnaryExpression" || node.type === "UpdateExpression" || node.type === "YieldExpression")) {
25354       return true;
25355     }
25356
25357     if (parent.type === "ExportDefaultDeclaration") {
25358       return (// `export default function` or `export default class` can't be followed by
25359         // anything after. So an expression like `export default (function(){}).toString()`
25360         // needs to be followed by a parentheses
25361         shouldWrapFunctionForExportDefault(path, options) || // `export default (foo, bar)` also needs parentheses
25362         node.type === "SequenceExpression"
25363       );
25364     }
25365
25366     if (parent.type === "Decorator" && parent.expression === node) {
25367       let hasCallExpression = false;
25368       let hasMemberExpression = false;
25369       let current = node;
25370
25371       while (current) {
25372         switch (current.type) {
25373           case "MemberExpression":
25374             hasMemberExpression = true;
25375             current = current.object;
25376             break;
25377
25378           case "CallExpression":
25379             if (
25380             /** @(x().y) */
25381             hasMemberExpression ||
25382             /** @(x().y()) */
25383             hasCallExpression) {
25384               return true;
25385             }
25386
25387             hasCallExpression = true;
25388             current = current.callee;
25389             break;
25390
25391           case "Identifier":
25392             return false;
25393
25394           default:
25395             return true;
25396         }
25397       }
25398
25399       return true;
25400     }
25401
25402     if (parent.type === "ArrowFunctionExpression" && parent.body === node && node.type !== "SequenceExpression" && // these have parens added anyway
25403     util$1.startsWithNoLookaheadToken(node,
25404     /* forbidFunctionClassAndDoExpr */
25405     false) || parent.type === "ExpressionStatement" && util$1.startsWithNoLookaheadToken(node,
25406     /* forbidFunctionClassAndDoExpr */
25407     true)) {
25408       return true;
25409     }
25410
25411     switch (node.type) {
25412       case "SpreadElement":
25413       case "SpreadProperty":
25414         return parent.type === "MemberExpression" && name === "object" && parent.object === node;
25415
25416       case "UpdateExpression":
25417         if (parent.type === "UnaryExpression") {
25418           return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-");
25419         }
25420
25421       // else fallthrough
25422
25423       case "UnaryExpression":
25424         switch (parent.type) {
25425           case "UnaryExpression":
25426             return node.operator === parent.operator && (node.operator === "+" || node.operator === "-");
25427
25428           case "BindExpression":
25429             return true;
25430
25431           case "MemberExpression":
25432           case "OptionalMemberExpression":
25433             return name === "object";
25434
25435           case "TaggedTemplateExpression":
25436             return true;
25437
25438           case "NewExpression":
25439           case "CallExpression":
25440           case "OptionalCallExpression":
25441             return name === "callee";
25442
25443           case "BinaryExpression":
25444             return parent.operator === "**" && name === "left";
25445
25446           case "TSNonNullExpression":
25447             return true;
25448
25449           default:
25450             return false;
25451         }
25452
25453       case "BinaryExpression":
25454         {
25455           if (parent.type === "UpdateExpression") {
25456             return true;
25457           }
25458
25459           const isLeftOfAForStatement = node => {
25460             let i = 0;
25461
25462             while (node) {
25463               const parent = path.getParentNode(i++);
25464
25465               if (!parent) {
25466                 return false;
25467               }
25468
25469               if (parent.type === "ForStatement" && parent.init === node) {
25470                 return true;
25471               }
25472
25473               node = parent;
25474             }
25475
25476             return false;
25477           };
25478
25479           if (node.operator === "in" && isLeftOfAForStatement(node)) {
25480             return true;
25481           }
25482         }
25483       // fallthrough
25484
25485       case "TSTypeAssertion":
25486       case "TSAsExpression":
25487       case "LogicalExpression":
25488         switch (parent.type) {
25489           case "ConditionalExpression":
25490             return node.type === "TSAsExpression";
25491
25492           case "CallExpression":
25493           case "NewExpression":
25494           case "OptionalCallExpression":
25495             return name === "callee";
25496
25497           case "ClassExpression":
25498           case "ClassDeclaration":
25499             return name === "superClass" && parent.superClass === node;
25500
25501           case "TSTypeAssertion":
25502           case "TaggedTemplateExpression":
25503           case "UnaryExpression":
25504           case "JSXSpreadAttribute":
25505           case "SpreadElement":
25506           case "SpreadProperty":
25507           case "BindExpression":
25508           case "AwaitExpression":
25509           case "TSAsExpression":
25510           case "TSNonNullExpression":
25511           case "UpdateExpression":
25512             return true;
25513
25514           case "MemberExpression":
25515           case "OptionalMemberExpression":
25516             return name === "object";
25517
25518           case "AssignmentExpression":
25519             return parent.left === node && (node.type === "TSTypeAssertion" || node.type === "TSAsExpression");
25520
25521           case "LogicalExpression":
25522             if (node.type === "LogicalExpression") {
25523               return parent.operator !== node.operator;
25524             }
25525
25526           // else fallthrough
25527
25528           case "BinaryExpression":
25529             {
25530               if (!node.operator && node.type !== "TSTypeAssertion") {
25531                 return true;
25532               }
25533
25534               const po = parent.operator;
25535               const pp = util$1.getPrecedence(po);
25536               const no = node.operator;
25537               const np = util$1.getPrecedence(no);
25538
25539               if (pp > np) {
25540                 return true;
25541               }
25542
25543               if (pp === np && name === "right") {
25544                 assert.strictEqual(parent.right, node);
25545                 return true;
25546               }
25547
25548               if (pp === np && !util$1.shouldFlatten(po, no)) {
25549                 return true;
25550               }
25551
25552               if (pp < np && no === "%") {
25553                 return po === "+" || po === "-";
25554               } // Add parenthesis when working with bitwise operators
25555               // It's not strictly needed but helps with code understanding
25556
25557
25558               if (util$1.isBitwiseOperator(po)) {
25559                 return true;
25560               }
25561
25562               return false;
25563             }
25564
25565           default:
25566             return false;
25567         }
25568
25569       case "SequenceExpression":
25570         switch (parent.type) {
25571           case "ReturnStatement":
25572             return false;
25573
25574           case "ForStatement":
25575             // Although parentheses wouldn't hurt around sequence
25576             // expressions in the head of for loops, traditional style
25577             // dictates that e.g. i++, j++ should not be wrapped with
25578             // parentheses.
25579             return false;
25580
25581           case "ExpressionStatement":
25582             return name !== "expression";
25583
25584           case "ArrowFunctionExpression":
25585             // We do need parentheses, but SequenceExpressions are handled
25586             // specially when printing bodies of arrow functions.
25587             return name !== "body";
25588
25589           default:
25590             // Otherwise err on the side of overparenthesization, adding
25591             // explicit exceptions above if this proves overzealous.
25592             return true;
25593         }
25594
25595       case "YieldExpression":
25596         if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || parent.type === "TSAsExpression" || parent.type === "TSNonNullExpression") {
25597           return true;
25598         }
25599
25600       // else fallthrough
25601
25602       case "AwaitExpression":
25603         switch (parent.type) {
25604           case "TaggedTemplateExpression":
25605           case "UnaryExpression":
25606           case "BinaryExpression":
25607           case "LogicalExpression":
25608           case "SpreadElement":
25609           case "SpreadProperty":
25610           case "TSAsExpression":
25611           case "TSNonNullExpression":
25612           case "BindExpression":
25613             return true;
25614
25615           case "MemberExpression":
25616           case "OptionalMemberExpression":
25617             return name === "object";
25618
25619           case "NewExpression":
25620           case "CallExpression":
25621           case "OptionalCallExpression":
25622             return name === "callee";
25623
25624           case "ConditionalExpression":
25625             return parent.test === node;
25626
25627           default:
25628             return false;
25629         }
25630
25631       case "TSJSDocFunctionType":
25632       case "TSConditionalType":
25633         if (parent.type === "TSConditionalType" && node === parent.extendsType) {
25634           return true;
25635         }
25636
25637       // fallthrough
25638
25639       case "TSFunctionType":
25640       case "TSConstructorType":
25641         if (parent.type === "TSConditionalType" && node === parent.checkType) {
25642           return true;
25643         }
25644
25645       // fallthrough
25646
25647       case "TSUnionType":
25648       case "TSIntersectionType":
25649         if (parent.type === "TSUnionType" || parent.type === "TSIntersectionType") {
25650           return true;
25651         }
25652
25653       // fallthrough
25654
25655       case "TSTypeOperator":
25656       case "TSInferType":
25657         return parent.type === "TSArrayType" || parent.type === "TSOptionalType" || parent.type === "TSRestType" || parent.type === "TSIndexedAccessType" && node === parent.objectType || parent.type === "TSTypeOperator" || parent.type === "TSTypeAnnotation" && /^TSJSDoc/.test(path.getParentNode(1).type);
25658
25659       case "ArrayTypeAnnotation":
25660         return parent.type === "NullableTypeAnnotation";
25661
25662       case "IntersectionTypeAnnotation":
25663       case "UnionTypeAnnotation":
25664         return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation";
25665
25666       case "NullableTypeAnnotation":
25667         return parent.type === "ArrayTypeAnnotation";
25668
25669       case "FunctionTypeAnnotation":
25670         {
25671           const ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent;
25672           return ancestor.type === "UnionTypeAnnotation" || ancestor.type === "IntersectionTypeAnnotation" || ancestor.type === "ArrayTypeAnnotation" || // We should check ancestor's parent to know whether the parentheses
25673           // are really needed, but since ??T doesn't make sense this check
25674           // will almost never be true.
25675           ancestor.type === "NullableTypeAnnotation";
25676         }
25677
25678       case "StringLiteral":
25679       case "NumericLiteral":
25680       case "Literal":
25681         if (typeof node.value === "string" && parent.type === "ExpressionStatement" && ( // TypeScript workaround for https://github.com/JamesHenry/typescript-estree/issues/2
25682         // See corresponding workaround in printer.js case: "Literal"
25683         options.parser !== "typescript" && !parent.directive || options.parser === "typescript" && options.originalText.charAt(options.locStart(node) - 1) === "(")) {
25684           // To avoid becoming a directive
25685           const grandParent = path.getParentNode(1);
25686           return grandParent.type === "Program" || grandParent.type === "BlockStatement";
25687         }
25688
25689         return parent.type === "MemberExpression" && typeof node.value === "number" && name === "object" && parent.object === node;
25690
25691       case "AssignmentExpression":
25692         {
25693           const grandParent = path.getParentNode(1);
25694
25695           if (parent.type === "ArrowFunctionExpression" && parent.body === node) {
25696             return true;
25697           } else if (parent.type === "ClassProperty" && parent.key === node && parent.computed) {
25698             return false;
25699           } else if (parent.type === "TSPropertySignature" && parent.name === node) {
25700             return false;
25701           } else if (parent.type === "ForStatement" && (parent.init === node || parent.update === node)) {
25702             return false;
25703           } else if (parent.type === "ExpressionStatement") {
25704             return node.left.type === "ObjectPattern";
25705           } else if (parent.type === "TSPropertySignature" && parent.key === node) {
25706             return false;
25707           } else if (parent.type === "AssignmentExpression") {
25708             return false;
25709           } else if (parent.type === "SequenceExpression" && grandParent && grandParent.type === "ForStatement" && (grandParent.init === parent || grandParent.update === parent)) {
25710             return false;
25711           } else if (parent.type === "Property" && parent.value === node) {
25712             return false;
25713           } else if (parent.type === "NGChainedExpression") {
25714             return false;
25715           }
25716
25717           return true;
25718         }
25719
25720       case "ConditionalExpression":
25721         switch (parent.type) {
25722           case "TaggedTemplateExpression":
25723           case "UnaryExpression":
25724           case "SpreadElement":
25725           case "SpreadProperty":
25726           case "BinaryExpression":
25727           case "LogicalExpression":
25728           case "NGPipeExpression":
25729           case "ExportDefaultDeclaration":
25730           case "AwaitExpression":
25731           case "JSXSpreadAttribute":
25732           case "TSTypeAssertion":
25733           case "TypeCastExpression":
25734           case "TSAsExpression":
25735           case "TSNonNullExpression":
25736             return true;
25737
25738           case "NewExpression":
25739           case "CallExpression":
25740           case "OptionalCallExpression":
25741             return name === "callee";
25742
25743           case "ConditionalExpression":
25744             return name === "test" && parent.test === node;
25745
25746           case "MemberExpression":
25747           case "OptionalMemberExpression":
25748             return name === "object";
25749
25750           default:
25751             return false;
25752         }
25753
25754       case "FunctionExpression":
25755         switch (parent.type) {
25756           case "NewExpression":
25757           case "CallExpression":
25758           case "OptionalCallExpression":
25759             // Not always necessary, but it's clearer to the reader if IIFEs are wrapped in parentheses.
25760             // Is necessary if it is `expression` of `ExpressionStatement`.
25761             return name === "callee";
25762
25763           case "TaggedTemplateExpression":
25764             return true;
25765           // This is basically a kind of IIFE.
25766
25767           default:
25768             return false;
25769         }
25770
25771       case "ArrowFunctionExpression":
25772         switch (parent.type) {
25773           case "NewExpression":
25774           case "CallExpression":
25775           case "OptionalCallExpression":
25776             return name === "callee";
25777
25778           case "MemberExpression":
25779           case "OptionalMemberExpression":
25780             return name === "object";
25781
25782           case "TSAsExpression":
25783           case "BindExpression":
25784           case "TaggedTemplateExpression":
25785           case "UnaryExpression":
25786           case "LogicalExpression":
25787           case "BinaryExpression":
25788           case "AwaitExpression":
25789           case "TSTypeAssertion":
25790             return true;
25791
25792           case "ConditionalExpression":
25793             return name === "test";
25794
25795           default:
25796             return false;
25797         }
25798
25799       case "ClassExpression":
25800         switch (parent.type) {
25801           case "NewExpression":
25802             return name === "callee" && parent.callee === node;
25803
25804           default:
25805             return false;
25806         }
25807
25808       case "OptionalMemberExpression":
25809       case "OptionalCallExpression":
25810         if (parent.type === "MemberExpression" && name === "object" || (parent.type === "CallExpression" || parent.type === "NewExpression") && name === "callee") {
25811           return true;
25812         }
25813
25814       // fallthrough
25815
25816       case "CallExpression":
25817       case "MemberExpression":
25818       case "TaggedTemplateExpression":
25819       case "TSNonNullExpression":
25820         if ((parent.type === "BindExpression" || parent.type === "NewExpression") && name === "callee") {
25821           let object = node;
25822
25823           while (object) {
25824             switch (object.type) {
25825               case "CallExpression":
25826               case "OptionalCallExpression":
25827                 return true;
25828
25829               case "MemberExpression":
25830               case "OptionalMemberExpression":
25831               case "BindExpression":
25832                 object = object.object;
25833                 break;
25834               // tagged templates are basically member expressions from a grammar perspective
25835               // see https://tc39.github.io/ecma262/#prod-MemberExpression
25836
25837               case "TaggedTemplateExpression":
25838                 object = object.tag;
25839                 break;
25840
25841               case "TSNonNullExpression":
25842                 object = object.expression;
25843                 break;
25844
25845               default:
25846                 return false;
25847             }
25848           }
25849         }
25850
25851         return false;
25852
25853       case "BindExpression":
25854         return (parent.type === "BindExpression" || parent.type === "NewExpression") && name === "callee" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && name === "object";
25855
25856       case "NGPipeExpression":
25857         if (parent.type === "NGRoot" || parent.type === "NGMicrosyntaxExpression" || parent.type === "ObjectProperty" || parent.type === "ArrayExpression" || (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.arguments[name] === node || parent.type === "NGPipeExpression" && name === "right" || parent.type === "MemberExpression" && name === "property" || parent.type === "AssignmentExpression") {
25858           return false;
25859         }
25860
25861         return true;
25862
25863       case "JSXFragment":
25864       case "JSXElement":
25865         return name === "callee" || parent.type !== "ArrayExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "AssignmentExpression" && parent.type !== "AssignmentPattern" && parent.type !== "BinaryExpression" && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "ConditionalExpression" && parent.type !== "ExpressionStatement" && parent.type !== "JsExpressionRoot" && parent.type !== "JSXAttribute" && parent.type !== "JSXElement" && parent.type !== "JSXExpressionContainer" && parent.type !== "JSXFragment" && parent.type !== "LogicalExpression" && parent.type !== "ObjectProperty" && parent.type !== "OptionalCallExpression" && parent.type !== "Property" && parent.type !== "ReturnStatement" && parent.type !== "ThrowStatement" && parent.type !== "TypeCastExpression" && parent.type !== "VariableDeclarator" && parent.type !== "YieldExpression";
25866
25867       case "TypeAnnotation":
25868         return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node);
25869     }
25870
25871     return false;
25872   }
25873
25874   function isStatement(node) {
25875     return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "EnumDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement";
25876   }
25877
25878   function includesFunctionTypeInObjectType(node) {
25879     return hasNode$1(node, n1 => n1.type === "ObjectTypeAnnotation" && hasNode$1(n1, n2 => n2.type === "FunctionTypeAnnotation" || undefined) || undefined);
25880   }
25881
25882   function endsWithRightBracket(node) {
25883     switch (node.type) {
25884       case "ObjectExpression":
25885         return true;
25886
25887       default:
25888         return false;
25889     }
25890   }
25891
25892   function isFollowedByRightBracket(path) {
25893     const node = path.getValue();
25894     const parent = path.getParentNode();
25895     const name = path.getName();
25896
25897     switch (parent.type) {
25898       case "NGPipeExpression":
25899         if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) {
25900           return path.callParent(isFollowedByRightBracket);
25901         }
25902
25903         break;
25904
25905       case "ObjectProperty":
25906         if (name === "value") {
25907           const parentParent = path.getParentNode(1);
25908           return parentParent.properties[parentParent.properties.length - 1] === parent;
25909         }
25910
25911         break;
25912
25913       case "BinaryExpression":
25914       case "LogicalExpression":
25915         if (name === "right") {
25916           return path.callParent(isFollowedByRightBracket);
25917         }
25918
25919         break;
25920
25921       case "ConditionalExpression":
25922         if (name === "alternate") {
25923           return path.callParent(isFollowedByRightBracket);
25924         }
25925
25926         break;
25927
25928       case "UnaryExpression":
25929         if (parent.prefix) {
25930           return path.callParent(isFollowedByRightBracket);
25931         }
25932
25933         break;
25934     }
25935
25936     return false;
25937   }
25938
25939   function shouldWrapFunctionForExportDefault(path, options) {
25940     const node = path.getValue();
25941     const parent = path.getParentNode();
25942
25943     if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
25944       return parent.type === "ExportDefaultDeclaration" || // in some cases the function is already wrapped
25945       // (e.g. `export default (function() {})();`)
25946       // in this case we don't need to add extra parens
25947       !needsParens(path, options);
25948     }
25949
25950     if (!hasNakedLeftSide$1(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) {
25951       return false;
25952     }
25953
25954     return path.call(childPath => shouldWrapFunctionForExportDefault(childPath, options), ...getLeftSidePathName$1(path, node));
25955   }
25956
25957   var needsParens_1 = needsParens;
25958
25959   const {
25960     builders: {
25961       concat: concat$c,
25962       join: join$8,
25963       line: line$8
25964     }
25965   } = document;
25966
25967   function printHtmlBinding(path, options, print) {
25968     const node = path.getValue();
25969
25970     if (options.__onHtmlBindingRoot && path.getName() === null) {
25971       options.__onHtmlBindingRoot(node, options);
25972     }
25973
25974     if (node.type !== "File") {
25975       return;
25976     }
25977
25978     if (options.__isVueForBindingLeft) {
25979       return path.call(functionDeclarationPath => {
25980         const {
25981           params
25982         } = functionDeclarationPath.getValue();
25983         return concat$c([params.length > 1 ? "(" : "", join$8(concat$c([",", line$8]), functionDeclarationPath.map(print, "params")), params.length > 1 ? ")" : ""]);
25984       }, "program", "body", 0);
25985     }
25986
25987     if (options.__isVueSlotScope) {
25988       return path.call(functionDeclarationPath => join$8(concat$c([",", line$8]), functionDeclarationPath.map(print, "params")), "program", "body", 0);
25989     }
25990   } // based on https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js isVueEventBindingExpression()
25991
25992
25993   function isVueEventBindingExpression$2(node) {
25994     switch (node.type) {
25995       case "MemberExpression":
25996         switch (node.property.type) {
25997           case "Identifier":
25998           case "NumericLiteral":
25999           case "StringLiteral":
26000             return isVueEventBindingExpression$2(node.object);
26001         }
26002
26003         return false;
26004
26005       case "Identifier":
26006         return true;
26007
26008       default:
26009         return false;
26010     }
26011   }
26012
26013   var htmlBinding = {
26014     isVueEventBindingExpression: isVueEventBindingExpression$2,
26015     printHtmlBinding
26016   };
26017
26018   function preprocess$1(ast, options) {
26019     switch (options.parser) {
26020       case "json":
26021       case "json5":
26022       case "json-stringify":
26023       case "__js_expression":
26024       case "__vue_expression":
26025         return Object.assign({}, ast, {
26026           type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
26027           node: ast,
26028           comments: [],
26029           rootMarker: options.rootMarker
26030         });
26031
26032       default:
26033         return ast;
26034     }
26035   }
26036
26037   var preprocess_1$1 = preprocess$1;
26038
26039   const {
26040     shouldFlatten: shouldFlatten$1,
26041     getNextNonSpaceNonCommentCharacter: getNextNonSpaceNonCommentCharacter$1,
26042     hasNewline: hasNewline$5,
26043     hasNewlineInRange: hasNewlineInRange$3,
26044     getLast: getLast$3,
26045     getStringWidth: getStringWidth$3,
26046     printString: printString$2,
26047     printNumber: printNumber$2,
26048     hasIgnoreComment: hasIgnoreComment$4,
26049     hasNodeIgnoreComment: hasNodeIgnoreComment$2,
26050     getPenultimate: getPenultimate$1,
26051     startsWithNoLookaheadToken: startsWithNoLookaheadToken$1,
26052     getIndentSize: getIndentSize$2,
26053     getPreferredQuote: getPreferredQuote$1
26054   } = util$1;
26055   const {
26056     isNextLineEmpty: isNextLineEmpty$4,
26057     isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$2,
26058     getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$3
26059   } = utilShared;
26060   const {
26061     insertPragma: insertPragma$7
26062   } = pragma;
26063   const {
26064     printHtmlBinding: printHtmlBinding$1,
26065     isVueEventBindingExpression: isVueEventBindingExpression$3
26066   } = htmlBinding;
26067   const {
26068     classChildNeedsASIProtection: classChildNeedsASIProtection$1,
26069     classPropMayCauseASIProblems: classPropMayCauseASIProblems$1,
26070     conditionalExpressionChainContainsJSX: conditionalExpressionChainContainsJSX$1,
26071     getFlowVariance: getFlowVariance$1,
26072     getLeftSidePathName: getLeftSidePathName$2,
26073     getParentExportDeclaration: getParentExportDeclaration$1,
26074     getTypeScriptMappedTypeModifier: getTypeScriptMappedTypeModifier$1,
26075     hasDanglingComments: hasDanglingComments$1,
26076     hasFlowAnnotationComment: hasFlowAnnotationComment$1,
26077     hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$2,
26078     hasLeadingComment: hasLeadingComment$3,
26079     hasLeadingOwnLineComment: hasLeadingOwnLineComment$1,
26080     hasNakedLeftSide: hasNakedLeftSide$2,
26081     hasNewlineBetweenOrAfterDecorators: hasNewlineBetweenOrAfterDecorators$1,
26082     hasNgSideEffect: hasNgSideEffect$1,
26083     hasPrettierIgnore: hasPrettierIgnore$5,
26084     hasTrailingComment: hasTrailingComment$1,
26085     identity: identity$2,
26086     isBinaryish: isBinaryish$1,
26087     isCallOrOptionalCallExpression: isCallOrOptionalCallExpression$1,
26088     isEmptyJSXElement: isEmptyJSXElement$1,
26089     isExportDeclaration: isExportDeclaration$1,
26090     isFlowAnnotationComment: isFlowAnnotationComment$1,
26091     isFunctionCompositionArgs: isFunctionCompositionArgs$1,
26092     isFunctionNotation: isFunctionNotation$1,
26093     isFunctionOrArrowExpression: isFunctionOrArrowExpression$1,
26094     isGetterOrSetter: isGetterOrSetter$1,
26095     isJestEachTemplateLiteral: isJestEachTemplateLiteral$1,
26096     isJSXNode: isJSXNode$1,
26097     isJSXWhitespaceExpression: isJSXWhitespaceExpression$1,
26098     isLastStatement: isLastStatement$1,
26099     isLiteral: isLiteral$1,
26100     isLongCurriedCallExpression: isLongCurriedCallExpression$1,
26101     isMeaningfulJSXText: isMeaningfulJSXText$1,
26102     isMemberExpressionChain: isMemberExpressionChain$1,
26103     isMemberish: isMemberish$1,
26104     isNgForOf: isNgForOf$1,
26105     isNumericLiteral: isNumericLiteral$1,
26106     isObjectType: isObjectType$1,
26107     isObjectTypePropertyAFunction: isObjectTypePropertyAFunction$1,
26108     isSimpleCallArgument: isSimpleCallArgument$1,
26109     isSimpleFlowType: isSimpleFlowType$1,
26110     isSimpleTemplateLiteral: isSimpleTemplateLiteral$1,
26111     isStringLiteral: isStringLiteral$1,
26112     isStringPropSafeToCoerceToIdentifier: isStringPropSafeToCoerceToIdentifier$1,
26113     isTemplateOnItsOwnLine: isTemplateOnItsOwnLine$1,
26114     isTestCall: isTestCall$1,
26115     isTheOnlyJSXElementInMarkdown: isTheOnlyJSXElementInMarkdown$1,
26116     isTSXFile: isTSXFile$1,
26117     isTypeAnnotationAFunction: isTypeAnnotationAFunction$1,
26118     matchJsxWhitespaceRegex: matchJsxWhitespaceRegex$1,
26119     needsHardlineAfterDanglingComment: needsHardlineAfterDanglingComment$1,
26120     rawText: rawText$1,
26121     returnArgumentHasLeadingComment: returnArgumentHasLeadingComment$1
26122   } = utils$5;
26123   const needsQuoteProps = new WeakMap();
26124   const {
26125     builders: {
26126       concat: concat$d,
26127       join: join$9,
26128       line: line$9,
26129       hardline: hardline$9,
26130       softline: softline$6,
26131       literalline: literalline$4,
26132       group: group$b,
26133       indent: indent$7,
26134       align: align$1,
26135       conditionalGroup: conditionalGroup$1,
26136       fill: fill$4,
26137       ifBreak: ifBreak$6,
26138       breakParent: breakParent$3,
26139       lineSuffixBoundary: lineSuffixBoundary$1,
26140       addAlignmentToDoc: addAlignmentToDoc$2,
26141       dedent: dedent$2
26142     },
26143     utils: {
26144       willBreak: willBreak$1,
26145       isLineNext: isLineNext$1,
26146       isEmpty: isEmpty$1,
26147       removeLines: removeLines$2
26148     },
26149     printer: {
26150       printDocToString: printDocToString$2
26151     }
26152   } = document;
26153   let uid = 0;
26154
26155   function shouldPrintComma$1(options, level) {
26156     level = level || "es5";
26157
26158     switch (options.trailingComma) {
26159       case "all":
26160         if (level === "all") {
26161           return true;
26162         }
26163
26164       // fallthrough
26165
26166       case "es5":
26167         if (level === "es5") {
26168           return true;
26169         }
26170
26171       // fallthrough
26172
26173       case "none":
26174       default:
26175         return false;
26176     }
26177   }
26178
26179   function genericPrint$3(path, options, printPath, args) {
26180     const node = path.getValue();
26181     let needsParens = false;
26182     const linesWithoutParens = printPathNoParens(path, options, printPath, args);
26183
26184     if (!node || isEmpty$1(linesWithoutParens)) {
26185       return linesWithoutParens;
26186     }
26187
26188     const parentExportDecl = getParentExportDeclaration$1(path);
26189     const decorators = [];
26190
26191     if (node.type === "ClassMethod" || node.type === "ClassPrivateMethod" || node.type === "ClassProperty" || node.type === "TSAbstractClassProperty" || node.type === "ClassPrivateProperty" || node.type === "MethodDefinition" || node.type === "TSAbstractMethodDefinition" || node.type === "TSDeclareMethod") ; else if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration and the decorator
26192     // was written before the export, the export will be responsible
26193     // for printing the decorators.
26194     !(parentExportDecl && options.locStart(parentExportDecl, {
26195       ignoreDecorators: true
26196     }) > options.locStart(node.decorators[0]))) {
26197       const shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators$1(node, options);
26198       const separator = shouldBreak ? hardline$9 : line$9;
26199       path.each(decoratorPath => {
26200         let decorator = decoratorPath.getValue();
26201
26202         if (decorator.expression) {
26203           decorator = decorator.expression;
26204         } else {
26205           decorator = decorator.callee;
26206         }
26207
26208         decorators.push(printPath(decoratorPath), separator);
26209       }, "decorators");
26210
26211       if (parentExportDecl) {
26212         decorators.unshift(hardline$9);
26213       }
26214     } else if (isExportDeclaration$1(node) && node.declaration && node.declaration.decorators && node.declaration.decorators.length > 0 && // Only print decorators here if they were written before the export,
26215     // otherwise they are printed by the node.declaration
26216     options.locStart(node, {
26217       ignoreDecorators: true
26218     }) > options.locStart(node.declaration.decorators[0])) {
26219       // Export declarations are responsible for printing any decorators
26220       // that logically apply to node.declaration.
26221       path.each(decoratorPath => {
26222         const decorator = decoratorPath.getValue();
26223         const prefix = decorator.type === "Decorator" ? "" : "@";
26224         decorators.push(prefix, printPath(decoratorPath), hardline$9);
26225       }, "declaration", "decorators");
26226     } else {
26227       // Nodes with decorators can't have parentheses, so we can avoid
26228       // computing pathNeedsParens() except in this case.
26229       needsParens = needsParens_1(path, options);
26230     }
26231
26232     const parts = [];
26233
26234     if (needsParens) {
26235       parts.unshift("(");
26236     }
26237
26238     parts.push(linesWithoutParens);
26239
26240     if (needsParens) {
26241       const node = path.getValue();
26242
26243       if (hasFlowShorthandAnnotationComment$2(node)) {
26244         parts.push(" /*");
26245         parts.push(node.trailingComments[0].value.trimStart());
26246         parts.push("*/");
26247         node.trailingComments[0].printed = true;
26248       }
26249
26250       parts.push(")");
26251     }
26252
26253     if (decorators.length > 0) {
26254       return group$b(concat$d(decorators.concat(parts)));
26255     }
26256
26257     return concat$d(parts);
26258   }
26259
26260   function printDecorators(path, options, print) {
26261     const node = path.getValue();
26262     return group$b(concat$d([join$9(line$9, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators$1(node, options) ? hardline$9 : line$9]));
26263   }
26264   /**
26265    * The following is the shared logic for
26266    * ternary operators, namely ConditionalExpression
26267    * and TSConditionalType
26268    * @typedef {Object} OperatorOptions
26269    * @property {() => Array<string | Doc>} beforeParts - Parts to print before the `?`.
26270    * @property {(breakClosingParen: boolean) => Array<string | Doc>} afterParts - Parts to print after the conditional expression.
26271    * @property {boolean} shouldCheckJsx - Whether to check for and print in JSX mode.
26272    * @property {string} conditionalNodeType - The type of the conditional expression node, ie "ConditionalExpression" or "TSConditionalType".
26273    * @property {string} consequentNodePropertyName - The property at which the consequent node can be found on the main node, eg "consequent".
26274    * @property {string} alternateNodePropertyName - The property at which the alternate node can be found on the main node, eg "alternate".
26275    * @property {string[]} testNodePropertyNames - The properties at which the test nodes can be found on the main node, eg "test".
26276    * @param {FastPath} path - The path to the ConditionalExpression/TSConditionalType node.
26277    * @param {Options} options - Prettier options
26278    * @param {Function} print - Print function to call recursively
26279    * @param {OperatorOptions} operatorOptions
26280    * @returns Doc
26281    */
26282
26283
26284   function printTernaryOperator(path, options, print, operatorOptions) {
26285     const node = path.getValue();
26286     const consequentNode = node[operatorOptions.consequentNodePropertyName];
26287     const alternateNode = node[operatorOptions.alternateNodePropertyName];
26288     const parts = []; // We print a ConditionalExpression in either "JSX mode" or "normal mode".
26289     // See tests/jsx/conditional-expression.js for more info.
26290
26291     let jsxMode = false;
26292     const parent = path.getParentNode();
26293     const isParentTest = parent.type === operatorOptions.conditionalNodeType && operatorOptions.testNodePropertyNames.some(prop => parent[prop] === node);
26294     let forceNoIndent = parent.type === operatorOptions.conditionalNodeType && !isParentTest; // Find the outermost non-ConditionalExpression parent, and the outermost
26295     // ConditionalExpression parent. We'll use these to determine if we should
26296     // print in JSX mode.
26297
26298     let currentParent;
26299     let previousParent;
26300     let i = 0;
26301
26302     do {
26303       previousParent = currentParent || node;
26304       currentParent = path.getParentNode(i);
26305       i++;
26306     } while (currentParent && currentParent.type === operatorOptions.conditionalNodeType && operatorOptions.testNodePropertyNames.every(prop => currentParent[prop] !== previousParent));
26307
26308     const firstNonConditionalParent = currentParent || parent;
26309     const lastConditionalParent = previousParent;
26310
26311     if (operatorOptions.shouldCheckJsx && (isJSXNode$1(node[operatorOptions.testNodePropertyNames[0]]) || isJSXNode$1(consequentNode) || isJSXNode$1(alternateNode) || conditionalExpressionChainContainsJSX$1(lastConditionalParent))) {
26312       jsxMode = true;
26313       forceNoIndent = true; // Even though they don't need parens, we wrap (almost) everything in
26314       // parens when using ?: within JSX, because the parens are analogous to
26315       // curly braces in an if statement.
26316
26317       const wrap = doc => concat$d([ifBreak$6("(", ""), indent$7(concat$d([softline$6, doc])), softline$6, ifBreak$6(")", "")]); // The only things we don't wrap are:
26318       // * Nested conditional expressions in alternates
26319       // * null
26320       // * undefined
26321
26322
26323       const isNil = node => node.type === "NullLiteral" || node.type === "Literal" && node.value === null || node.type === "Identifier" && node.name === "undefined";
26324
26325       parts.push(" ? ", isNil(consequentNode) ? path.call(print, operatorOptions.consequentNodePropertyName) : wrap(path.call(print, operatorOptions.consequentNodePropertyName)), " : ", alternateNode.type === operatorOptions.conditionalNodeType || isNil(alternateNode) ? path.call(print, operatorOptions.alternateNodePropertyName) : wrap(path.call(print, operatorOptions.alternateNodePropertyName)));
26326     } else {
26327       // normal mode
26328       const part = concat$d([line$9, "? ", consequentNode.type === operatorOptions.conditionalNodeType ? ifBreak$6("", "(") : "", align$1(2, path.call(print, operatorOptions.consequentNodePropertyName)), consequentNode.type === operatorOptions.conditionalNodeType ? ifBreak$6("", ")") : "", line$9, ": ", alternateNode.type === operatorOptions.conditionalNodeType ? path.call(print, operatorOptions.alternateNodePropertyName) : align$1(2, path.call(print, operatorOptions.alternateNodePropertyName))]);
26329       parts.push(parent.type !== operatorOptions.conditionalNodeType || parent[operatorOptions.alternateNodePropertyName] === node || isParentTest ? part : options.useTabs ? dedent$2(indent$7(part)) : align$1(Math.max(0, options.tabWidth - 2), part));
26330     } // We want a whole chain of ConditionalExpressions to all
26331     // break if any of them break. That means we should only group around the
26332     // outer-most ConditionalExpression.
26333
26334
26335     const maybeGroup = doc => parent === firstNonConditionalParent ? group$b(doc) : doc; // Break the closing paren to keep the chain right after it:
26336     // (a
26337     //   ? b
26338     //   : c
26339     // ).call()
26340
26341
26342     const breakClosingParen = !jsxMode && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression" || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed;
26343     const result = maybeGroup(concat$d([].concat((testDoc =>
26344     /**
26345      *     a
26346      *       ? b
26347      *       : multiline
26348      *         test
26349      *         node
26350      *       ^^ align(2)
26351      *       ? d
26352      *       : e
26353      */
26354     parent.type === operatorOptions.conditionalNodeType && parent[operatorOptions.alternateNodePropertyName] === node ? align$1(2, testDoc) : testDoc)(concat$d(operatorOptions.beforeParts())), forceNoIndent ? concat$d(parts) : indent$7(concat$d(parts)), operatorOptions.afterParts(breakClosingParen))));
26355     return isParentTest ? group$b(concat$d([indent$7(concat$d([softline$6, result])), softline$6])) : result;
26356   }
26357
26358   function printPathNoParens(path, options, print, args) {
26359     const n = path.getValue();
26360     const semi = options.semi ? ";" : "";
26361
26362     if (!n) {
26363       return "";
26364     }
26365
26366     if (typeof n === "string") {
26367       return n;
26368     }
26369
26370     const htmlBinding = printHtmlBinding$1(path, options, print);
26371
26372     if (htmlBinding) {
26373       return htmlBinding;
26374     }
26375
26376     let parts = [];
26377
26378     switch (n.type) {
26379       case "JsExpressionRoot":
26380         return path.call(print, "node");
26381
26382       case "JsonRoot":
26383         return concat$d([path.call(print, "node"), hardline$9]);
26384
26385       case "File":
26386         // Print @babel/parser's InterpreterDirective here so that
26387         // leading comments on the `Program` node get printed after the hashbang.
26388         if (n.program && n.program.interpreter) {
26389           parts.push(path.call(programPath => programPath.call(print, "interpreter"), "program"));
26390         }
26391
26392         parts.push(path.call(print, "program"));
26393         return concat$d(parts);
26394
26395       case "Program":
26396         // Babel 6
26397         if (n.directives) {
26398           path.each(childPath => {
26399             parts.push(print(childPath), semi, hardline$9);
26400
26401             if (isNextLineEmpty$4(options.originalText, childPath.getValue(), options.locEnd)) {
26402               parts.push(hardline$9);
26403             }
26404           }, "directives");
26405         }
26406
26407         parts.push(path.call(bodyPath => {
26408           return printStatementSequence(bodyPath, options, print);
26409         }, "body"));
26410         parts.push(comments.printDanglingComments(path, options,
26411         /* sameIndent */
26412         true)); // Only force a trailing newline if there were any contents.
26413
26414         if (!n.body.every(({
26415           type
26416         }) => type === "EmptyStatement") || n.comments) {
26417           parts.push(hardline$9);
26418         }
26419
26420         return concat$d(parts);
26421       // Babel extension.
26422
26423       case "EmptyStatement":
26424         return "";
26425
26426       case "ExpressionStatement":
26427         // Detect Flow-parsed directives
26428         if (n.directive) {
26429           return concat$d([nodeStr(n.expression, options, true), semi]);
26430         }
26431
26432         if (options.parser === "__vue_event_binding") {
26433           const parent = path.getParentNode();
26434
26435           if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === n) {
26436             return concat$d([path.call(print, "expression"), isVueEventBindingExpression$3(n.expression) ? ";" : ""]);
26437           }
26438         } // Do not append semicolon after the only JSX element in a program
26439
26440
26441         return concat$d([path.call(print, "expression"), isTheOnlyJSXElementInMarkdown$1(options, path) ? "" : semi]);
26442       // Babel non-standard node. Used for Closure-style type casts. See postprocess.js.
26443
26444       case "ParenthesizedExpression":
26445         {
26446           const shouldHug = !n.expression.comments;
26447
26448           if (shouldHug) {
26449             return concat$d(["(", path.call(print, "expression"), ")"]);
26450           }
26451
26452           return group$b(concat$d(["(", indent$7(concat$d([softline$6, path.call(print, "expression")])), softline$6, ")"]));
26453         }
26454
26455       case "AssignmentExpression":
26456         return printAssignment(n.left, path.call(print, "left"), concat$d([" ", n.operator]), n.right, path.call(print, "right"), options);
26457
26458       case "BinaryExpression":
26459       case "LogicalExpression":
26460       case "NGPipeExpression":
26461         {
26462           const parent = path.getParentNode();
26463           const parentParent = path.getParentNode(1);
26464           const isInsideParenthesis = n !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "SwitchStatement" || parent.type === "DoWhileStatement");
26465           const parts = printBinaryishExpressions(path, print, options,
26466           /* isNested */
26467           false, isInsideParenthesis); //   if (
26468           //     this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft
26469           //   ) {
26470           //
26471           // looks super weird, we want to break the children if the parent breaks
26472           //
26473           //   if (
26474           //     this.hasPlugin("dynamicImports") &&
26475           //     this.lookahead().type === tt.parenLeft
26476           //   ) {
26477
26478           if (isInsideParenthesis) {
26479             return concat$d(parts);
26480           } // Break between the parens in
26481           // unaries or in a member or specific call expression, i.e.
26482           //
26483           //   (
26484           //     a &&
26485           //     b &&
26486           //     c
26487           //   ).call()
26488
26489
26490           if ((parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.callee === n || parent.type === "UnaryExpression" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && !parent.computed) {
26491             return group$b(concat$d([indent$7(concat$d([softline$6, concat$d(parts)])), softline$6]));
26492           } // Avoid indenting sub-expressions in some cases where the first sub-expression is already
26493           // indented accordingly. We should indent sub-expressions where the first case isn't indented.
26494
26495
26496           const shouldNotIndent = parent.type === "ReturnStatement" || parent.type === "ThrowStatement" || parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" || n.operator !== "|" && parent.type === "JsExpressionRoot" || n.type !== "NGPipeExpression" && (parent.type === "NGRoot" && options.parser === "__ng_binding" || parent.type === "NGMicrosyntaxExpression" && parentParent.type === "NGMicrosyntax" && parentParent.body.length === 1) || n === parent.body && parent.type === "ArrowFunctionExpression" || n !== parent.body && parent.type === "ForStatement" || parent.type === "ConditionalExpression" && parentParent.type !== "ReturnStatement" && parentParent.type !== "ThrowStatement" && parentParent.type !== "CallExpression" && parentParent.type !== "OptionalCallExpression" || parent.type === "TemplateLiteral";
26497           const shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "TSAbstractClassProperty" || parent.type === "ClassPrivateProperty" || parent.type === "ObjectProperty" || parent.type === "Property";
26498           const samePrecedenceSubExpression = isBinaryish$1(n.left) && shouldFlatten$1(n.operator, n.left.operator);
26499
26500           if (shouldNotIndent || shouldInlineLogicalExpression(n) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(n) && shouldIndentIfInlining) {
26501             return group$b(concat$d(parts));
26502           }
26503
26504           if (parts.length === 0) {
26505             return "";
26506           } // If the right part is a JSX node, we include it in a separate group to
26507           // prevent it breaking the whole chain, so we can print the expression like:
26508           //
26509           //   foo && bar && (
26510           //     <Foo>
26511           //       <Bar />
26512           //     </Foo>
26513           //   )
26514
26515
26516           const hasJSX = isJSXNode$1(n.right);
26517           const rest = concat$d(hasJSX ? parts.slice(1, -1) : parts.slice(1));
26518           const groupId = Symbol("logicalChain-" + ++uid);
26519           const chain = group$b(concat$d([// Don't include the initial expression in the indentation
26520           // level. The first item is guaranteed to be the first
26521           // left-most expression.
26522           parts.length > 0 ? parts[0] : "", indent$7(rest)]), {
26523             id: groupId
26524           });
26525
26526           if (!hasJSX) {
26527             return chain;
26528           }
26529
26530           const jsxPart = getLast$3(parts);
26531           return group$b(concat$d([chain, ifBreak$6(indent$7(jsxPart), jsxPart, {
26532             groupId
26533           })]));
26534         }
26535
26536       case "AssignmentPattern":
26537         return concat$d([path.call(print, "left"), " = ", path.call(print, "right")]);
26538
26539       case "TSTypeAssertion":
26540         {
26541           const shouldBreakAfterCast = !(n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression");
26542           const castGroup = group$b(concat$d(["<", indent$7(concat$d([softline$6, path.call(print, "typeAnnotation")])), softline$6, ">"]));
26543           const exprContents = concat$d([ifBreak$6("("), indent$7(concat$d([softline$6, path.call(print, "expression")])), softline$6, ifBreak$6(")")]);
26544
26545           if (shouldBreakAfterCast) {
26546             return conditionalGroup$1([concat$d([castGroup, path.call(print, "expression")]), concat$d([castGroup, group$b(exprContents, {
26547               shouldBreak: true
26548             })]), concat$d([castGroup, path.call(print, "expression")])]);
26549           }
26550
26551           return group$b(concat$d([castGroup, path.call(print, "expression")]));
26552         }
26553
26554       case "OptionalMemberExpression":
26555       case "MemberExpression":
26556         {
26557           const parent = path.getParentNode();
26558           let firstNonMemberParent;
26559           let i = 0;
26560
26561           do {
26562             firstNonMemberParent = path.getParentNode(i);
26563             i++;
26564           } while (firstNonMemberParent && (firstNonMemberParent.type === "MemberExpression" || firstNonMemberParent.type === "OptionalMemberExpression" || firstNonMemberParent.type === "TSNonNullExpression"));
26565
26566           const shouldInline = firstNonMemberParent && (firstNonMemberParent.type === "NewExpression" || firstNonMemberParent.type === "BindExpression" || firstNonMemberParent.type === "VariableDeclarator" && firstNonMemberParent.id.type !== "Identifier" || firstNonMemberParent.type === "AssignmentExpression" && firstNonMemberParent.left.type !== "Identifier") || n.computed || n.object.type === "Identifier" && n.property.type === "Identifier" && parent.type !== "MemberExpression" && parent.type !== "OptionalMemberExpression";
26567           return concat$d([path.call(print, "object"), shouldInline ? printMemberLookup(path, options, print) : group$b(indent$7(concat$d([softline$6, printMemberLookup(path, options, print)])))]);
26568         }
26569
26570       case "MetaProperty":
26571         return concat$d([path.call(print, "meta"), ".", path.call(print, "property")]);
26572
26573       case "BindExpression":
26574         if (n.object) {
26575           parts.push(path.call(print, "object"));
26576         }
26577
26578         parts.push(group$b(indent$7(concat$d([softline$6, printBindExpressionCallee(path, options, print)]))));
26579         return concat$d(parts);
26580
26581       case "Identifier":
26582         {
26583           return concat$d([n.name, printOptionalToken(path), printTypeAnnotation(path, options, print)]);
26584         }
26585
26586       case "V8IntrinsicIdentifier":
26587         return concat$d(["%", n.name]);
26588
26589       case "SpreadElement":
26590       case "SpreadElementPattern":
26591       case "SpreadProperty":
26592       case "SpreadPropertyPattern":
26593       case "RestElement":
26594       case "ObjectTypeSpreadProperty":
26595         return concat$d(["...", path.call(print, "argument"), printTypeAnnotation(path, options, print)]);
26596
26597       case "FunctionDeclaration":
26598       case "FunctionExpression":
26599         parts.push(printFunctionDeclaration(path, print, options));
26600
26601         if (!n.body) {
26602           parts.push(semi);
26603         }
26604
26605         return concat$d(parts);
26606
26607       case "ArrowFunctionExpression":
26608         {
26609           if (n.async) {
26610             parts.push("async ");
26611           }
26612
26613           if (shouldPrintParamsWithoutParens(path, options)) {
26614             parts.push(path.call(print, "params", 0));
26615           } else {
26616             parts.push(group$b(concat$d([printFunctionParams(path, print, options,
26617             /* expandLast */
26618             args && (args.expandLastArg || args.expandFirstArg),
26619             /* printTypeParams */
26620             true), printReturnType(path, print, options)])));
26621           }
26622
26623           const dangling = comments.printDanglingComments(path, options,
26624           /* sameIndent */
26625           true, comment => {
26626             const nextCharacter = getNextNonSpaceNonCommentCharacterIndex$3(options.originalText, comment, options.locEnd);
26627             return options.originalText.slice(nextCharacter, nextCharacter + 2) === "=>";
26628           });
26629
26630           if (dangling) {
26631             parts.push(" ", dangling);
26632           }
26633
26634           parts.push(" =>");
26635           const body = path.call(bodyPath => print(bodyPath, args), "body"); // We want to always keep these types of nodes on the same line
26636           // as the arrow.
26637
26638           if (!hasLeadingOwnLineComment$1(options.originalText, n.body, options) && (n.body.type === "ArrayExpression" || n.body.type === "ObjectExpression" || n.body.type === "BlockStatement" || isJSXNode$1(n.body) || isTemplateOnItsOwnLine$1(n.body, options.originalText, options) || n.body.type === "ArrowFunctionExpression" || n.body.type === "DoExpression")) {
26639             return group$b(concat$d([concat$d(parts), " ", body]));
26640           } // We handle sequence expressions as the body of arrows specially,
26641           // so that the required parentheses end up on their own lines.
26642
26643
26644           if (n.body.type === "SequenceExpression") {
26645             return group$b(concat$d([concat$d(parts), group$b(concat$d([" (", indent$7(concat$d([softline$6, body])), softline$6, ")"]))]));
26646           } // if the arrow function is expanded as last argument, we are adding a
26647           // level of indentation and need to add a softline to align the closing )
26648           // with the opening (, or if it's inside a JSXExpression (e.g. an attribute)
26649           // we should align the expression's closing } with the line with the opening {.
26650
26651
26652           const shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !(n.comments && n.comments.length);
26653           const printTrailingComma = args && args.expandLastArg && shouldPrintComma$1(options, "all"); // In order to avoid confusion between
26654           // a => a ? a : a
26655           // a <= a ? a : a
26656
26657           const shouldAddParens = n.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken$1(n.body,
26658           /* forbidFunctionAndClass */
26659           false);
26660           return group$b(concat$d([concat$d(parts), group$b(concat$d([indent$7(concat$d([line$9, shouldAddParens ? ifBreak$6("", "(") : "", body, shouldAddParens ? ifBreak$6("", ")") : ""])), shouldAddSoftLine ? concat$d([ifBreak$6(printTrailingComma ? "," : ""), softline$6]) : ""]))]));
26661         }
26662
26663       case "YieldExpression":
26664         parts.push("yield");
26665
26666         if (n.delegate) {
26667           parts.push("*");
26668         }
26669
26670         if (n.argument) {
26671           parts.push(" ", path.call(print, "argument"));
26672         }
26673
26674         return concat$d(parts);
26675
26676       case "AwaitExpression":
26677         {
26678           parts.push("await ", path.call(print, "argument"));
26679           const parent = path.getParentNode();
26680
26681           if ((parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.callee === n || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && parent.object === n) {
26682             return group$b(concat$d([indent$7(concat$d([softline$6, concat$d(parts)])), softline$6]));
26683           }
26684
26685           return concat$d(parts);
26686         }
26687
26688       case "ImportSpecifier":
26689         if (n.importKind) {
26690           parts.push(path.call(print, "importKind"), " ");
26691         }
26692
26693         parts.push(path.call(print, "imported"));
26694
26695         if (n.local && n.local.name !== n.imported.name) {
26696           parts.push(" as ", path.call(print, "local"));
26697         }
26698
26699         return concat$d(parts);
26700
26701       case "ExportSpecifier":
26702         parts.push(path.call(print, "local"));
26703
26704         if (n.exported && n.exported.name !== n.local.name) {
26705           parts.push(" as ", path.call(print, "exported"));
26706         }
26707
26708         return concat$d(parts);
26709
26710       case "ImportNamespaceSpecifier":
26711         parts.push("* as ");
26712         parts.push(path.call(print, "local"));
26713         return concat$d(parts);
26714
26715       case "ImportDefaultSpecifier":
26716         return path.call(print, "local");
26717
26718       case "TSExportAssignment":
26719         return concat$d(["export = ", path.call(print, "expression"), semi]);
26720
26721       case "ExportDefaultDeclaration":
26722       case "ExportNamedDeclaration":
26723         return printExportDeclaration(path, options, print);
26724
26725       case "ExportAllDeclaration":
26726         parts.push("export ");
26727
26728         if (n.exportKind === "type") {
26729           parts.push("type ");
26730         }
26731
26732         parts.push("* ");
26733
26734         if (n.exported) {
26735           parts.push("as ", path.call(print, "exported"), " ");
26736         }
26737
26738         parts.push("from ", path.call(print, "source"), semi);
26739         return concat$d(parts);
26740
26741       case "ExportNamespaceSpecifier":
26742       case "ExportDefaultSpecifier":
26743         return path.call(print, "exported");
26744
26745       case "ImportDeclaration":
26746         {
26747           parts.push("import ");
26748
26749           if (n.importKind && n.importKind !== "value") {
26750             parts.push(n.importKind + " ");
26751           }
26752
26753           const standalones = [];
26754           const grouped = [];
26755
26756           if (n.specifiers && n.specifiers.length > 0) {
26757             path.each(specifierPath => {
26758               const value = specifierPath.getValue();
26759
26760               if (value.type === "ImportDefaultSpecifier" || value.type === "ImportNamespaceSpecifier") {
26761                 standalones.push(print(specifierPath));
26762               } else {
26763                 grouped.push(print(specifierPath));
26764               }
26765             }, "specifiers");
26766
26767             if (standalones.length > 0) {
26768               parts.push(join$9(", ", standalones));
26769             }
26770
26771             if (standalones.length > 0 && grouped.length > 0) {
26772               parts.push(", ");
26773             }
26774
26775             if (grouped.length === 1 && standalones.length === 0 && n.specifiers && !n.specifiers.some(node => node.comments)) {
26776               parts.push(concat$d(["{", options.bracketSpacing ? " " : "", concat$d(grouped), options.bracketSpacing ? " " : "", "}"]));
26777             } else if (grouped.length >= 1) {
26778               parts.push(group$b(concat$d(["{", indent$7(concat$d([options.bracketSpacing ? line$9 : softline$6, join$9(concat$d([",", line$9]), grouped)])), ifBreak$6(shouldPrintComma$1(options) ? "," : ""), options.bracketSpacing ? line$9 : softline$6, "}"])));
26779             }
26780
26781             parts.push(" from ");
26782           } else if (n.importKind && n.importKind === "type" || // import {} from 'x'
26783           /{\s*}/.test(options.originalText.slice(options.locStart(n), options.locStart(n.source)))) {
26784             parts.push("{} from ");
26785           }
26786
26787           parts.push(path.call(print, "source"), semi);
26788           return concat$d(parts);
26789         }
26790
26791       case "Import":
26792         return "import";
26793
26794       case "TSModuleBlock":
26795       case "BlockStatement":
26796         {
26797           const naked = path.call(bodyPath => {
26798             return printStatementSequence(bodyPath, options, print);
26799           }, "body");
26800           const hasContent = n.body.find(node => node.type !== "EmptyStatement");
26801           const hasDirectives = n.directives && n.directives.length > 0;
26802           const parent = path.getParentNode();
26803           const parentParent = path.getParentNode(1);
26804
26805           if (!hasContent && !hasDirectives && !hasDanglingComments$1(n) && (parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration" || parent.type === "ObjectMethod" || parent.type === "ClassMethod" || parent.type === "ClassPrivateMethod" || parent.type === "ForStatement" || parent.type === "WhileStatement" || parent.type === "DoWhileStatement" || parent.type === "DoExpression" || parent.type === "CatchClause" && !parentParent.finalizer || parent.type === "TSModuleDeclaration")) {
26806             return "{}";
26807           }
26808
26809           parts.push("{"); // Babel 6
26810
26811           if (hasDirectives) {
26812             path.each(childPath => {
26813               parts.push(indent$7(concat$d([hardline$9, print(childPath), semi])));
26814
26815               if (isNextLineEmpty$4(options.originalText, childPath.getValue(), options.locEnd)) {
26816                 parts.push(hardline$9);
26817               }
26818             }, "directives");
26819           }
26820
26821           if (hasContent) {
26822             parts.push(indent$7(concat$d([hardline$9, naked])));
26823           }
26824
26825           parts.push(comments.printDanglingComments(path, options));
26826           parts.push(hardline$9, "}");
26827           return concat$d(parts);
26828         }
26829
26830       case "ReturnStatement":
26831         return concat$d(["return", printReturnAndThrowArgument(path, options, print)]);
26832
26833       case "NewExpression":
26834       case "OptionalCallExpression":
26835       case "CallExpression":
26836         {
26837           const isNew = n.type === "NewExpression";
26838           const optional = printOptionalToken(path);
26839
26840           if ( // We want to keep CommonJS- and AMD-style require calls, and AMD-style
26841           // define calls, as a unit.
26842           // e.g. `define(["some/lib", (lib) => {`
26843           !isNew && n.callee.type === "Identifier" && (n.callee.name === "require" || n.callee.name === "define") || // Template literals as single arguments
26844           n.arguments.length === 1 && isTemplateOnItsOwnLine$1(n.arguments[0], options.originalText, options) || // Keep test declarations on a single line
26845           // e.g. `it('long name', () => {`
26846           !isNew && isTestCall$1(n, path.getParentNode())) {
26847             return concat$d([isNew ? "new " : "", path.call(print, "callee"), optional, printFunctionTypeParameters(path, options, print), concat$d(["(", join$9(", ", path.map(print, "arguments")), ")"])]);
26848           } // Inline Flow annotation comments following Identifiers in Call nodes need to
26849           // stay with the Identifier. For example:
26850           //
26851           // foo /*:: <SomeGeneric> */(bar);
26852           //
26853           // Here, we ensure that such comments stay between the Identifier and the Callee.
26854
26855
26856           const isIdentifierWithFlowAnnotation = n.callee.type === "Identifier" && hasFlowAnnotationComment$1(n.callee.trailingComments);
26857
26858           if (isIdentifierWithFlowAnnotation) {
26859             n.callee.trailingComments[0].printed = true;
26860           } // We detect calls on member lookups and possibly print them in a
26861           // special chain format. See `printMemberChain` for more info.
26862
26863
26864           if (!isNew && isMemberish$1(n.callee) && !path.call(path => needsParens_1(path, options), "callee")) {
26865             return printMemberChain(path, options, print);
26866           }
26867
26868           const contents = concat$d([isNew ? "new " : "", path.call(print, "callee"), optional, isIdentifierWithFlowAnnotation ? "/*:: ".concat(n.callee.trailingComments[0].value.slice(2).trim(), " */") : "", printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)]); // We group here when the callee is itself a call expression.
26869           // See `isLongCurriedCallExpression` for more info.
26870
26871           if (isCallOrOptionalCallExpression$1(n.callee)) {
26872             return group$b(contents);
26873           }
26874
26875           return contents;
26876         }
26877
26878       case "TSInterfaceDeclaration":
26879         if (n.declare) {
26880           parts.push("declare ");
26881         }
26882
26883         parts.push(n.abstract ? "abstract " : "", printTypeScriptModifiers(path, options, print), "interface ", path.call(print, "id"), n.typeParameters ? path.call(print, "typeParameters") : "", " ");
26884
26885         if (n.extends && n.extends.length) {
26886           parts.push(group$b(indent$7(concat$d([softline$6, "extends ", (n.extends.length === 1 ? identity$2 : indent$7)(join$9(concat$d([",", line$9]), path.map(print, "extends"))), " "]))));
26887         }
26888
26889         parts.push(path.call(print, "body"));
26890         return concat$d(parts);
26891
26892       case "ObjectTypeInternalSlot":
26893         return concat$d([n.static ? "static " : "", "[[", path.call(print, "id"), "]]", printOptionalToken(path), n.method ? "" : ": ", path.call(print, "value")]);
26894
26895       case "ObjectExpression":
26896       case "ObjectPattern":
26897       case "ObjectTypeAnnotation":
26898       case "TSInterfaceBody":
26899       case "TSTypeLiteral":
26900         {
26901           let propertiesField;
26902
26903           if (n.type === "TSTypeLiteral") {
26904             propertiesField = "members";
26905           } else if (n.type === "TSInterfaceBody") {
26906             propertiesField = "body";
26907           } else {
26908             propertiesField = "properties";
26909           }
26910
26911           const isTypeAnnotation = n.type === "ObjectTypeAnnotation";
26912           const fields = [];
26913
26914           if (isTypeAnnotation) {
26915             fields.push("indexers", "callProperties", "internalSlots");
26916           }
26917
26918           fields.push(propertiesField);
26919           const firstProperty = fields.map(field => n[field][0]).sort((a, b) => options.locStart(a) - options.locStart(b))[0];
26920           const parent = path.getParentNode(0);
26921           const isFlowInterfaceLikeBody = isTypeAnnotation && parent && (parent.type === "InterfaceDeclaration" || parent.type === "DeclareInterface" || parent.type === "DeclareClass") && path.getName() === "body";
26922           const shouldBreak = n.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || n.type === "ObjectPattern" && parent.type !== "FunctionDeclaration" && parent.type !== "FunctionExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "ObjectMethod" && parent.type !== "ClassMethod" && parent.type !== "ClassPrivateMethod" && parent.type !== "AssignmentPattern" && parent.type !== "CatchClause" && n.properties.some(property => property.value && (property.value.type === "ObjectPattern" || property.value.type === "ArrayPattern")) || n.type !== "ObjectPattern" && firstProperty && hasNewlineInRange$3(options.originalText, options.locStart(n), options.locStart(firstProperty));
26923           const separator = isFlowInterfaceLikeBody ? ";" : n.type === "TSInterfaceBody" || n.type === "TSTypeLiteral" ? ifBreak$6(semi, ";") : ",";
26924           const leftBrace = n.exact ? "{|" : "{";
26925           const rightBrace = n.exact ? "|}" : "}"; // Unfortunately, things are grouped together in the ast can be
26926           // interleaved in the source code. So we need to reorder them before
26927           // printing them.
26928
26929           const propsAndLoc = [];
26930           fields.forEach(field => {
26931             path.each(childPath => {
26932               const node = childPath.getValue();
26933               propsAndLoc.push({
26934                 node,
26935                 printed: print(childPath),
26936                 loc: options.locStart(node)
26937               });
26938             }, field);
26939           });
26940           let separatorParts = [];
26941           const props = propsAndLoc.sort((a, b) => a.loc - b.loc).map(prop => {
26942             const result = concat$d(separatorParts.concat(group$b(prop.printed)));
26943             separatorParts = [separator, line$9];
26944
26945             if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasNodeIgnoreComment$2(prop.node)) {
26946               separatorParts.shift();
26947             }
26948
26949             if (isNextLineEmpty$4(options.originalText, prop.node, options.locEnd)) {
26950               separatorParts.push(hardline$9);
26951             }
26952
26953             return result;
26954           });
26955
26956           if (n.inexact) {
26957             let printed;
26958
26959             if (hasDanglingComments$1(n)) {
26960               const hasLineComments = !n.comments.every(comments$1.isBlockComment);
26961               const printedDanglingComments = comments.printDanglingComments(path, options,
26962               /* sameIndent */
26963               true);
26964               printed = concat$d([printedDanglingComments, hasLineComments || hasNewline$5(options.originalText, options.locEnd(n.comments[n.comments.length - 1])) ? hardline$9 : line$9, "..."]);
26965             } else {
26966               printed = "...";
26967             }
26968
26969             props.push(concat$d(separatorParts.concat(printed)));
26970           }
26971
26972           const lastElem = getLast$3(n[propertiesField]);
26973           const canHaveTrailingSeparator = !(n.inexact || lastElem && (lastElem.type === "RestElement" || hasNodeIgnoreComment$2(lastElem)));
26974           let content;
26975
26976           if (props.length === 0) {
26977             if (!hasDanglingComments$1(n)) {
26978               return concat$d([leftBrace, rightBrace, printTypeAnnotation(path, options, print)]);
26979             }
26980
26981             content = group$b(concat$d([leftBrace, comments.printDanglingComments(path, options), softline$6, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)]));
26982           } else {
26983             content = concat$d([leftBrace, indent$7(concat$d([options.bracketSpacing ? line$9 : softline$6, concat$d(props)])), ifBreak$6(canHaveTrailingSeparator && (separator !== "," || shouldPrintComma$1(options)) ? separator : ""), concat$d([options.bracketSpacing ? line$9 : softline$6, rightBrace]), printOptionalToken(path), printTypeAnnotation(path, options, print)]);
26984           } // If we inline the object as first argument of the parent, we don't want
26985           // to create another group so that the object breaks before the return
26986           // type
26987
26988
26989           if (path.match(node => node.type === "ObjectPattern" && !node.decorators, (node, name, number) => shouldHugArguments(node) && (name === "params" || name === "parameters") && number === 0) || path.match(shouldHugType, (node, name) => name === "typeAnnotation", (node, name) => name === "typeAnnotation", (node, name, number) => shouldHugArguments(node) && (name === "params" || name === "parameters") && number === 0)) {
26990             return content;
26991           }
26992
26993           return group$b(content, {
26994             shouldBreak
26995           });
26996         }
26997       // Babel 6
26998
26999       case "ObjectProperty": // Non-standard AST node type.
27000
27001       case "Property":
27002         if (n.method || n.kind === "get" || n.kind === "set") {
27003           return printMethod(path, options, print);
27004         }
27005
27006         if (n.shorthand) {
27007           parts.push(path.call(print, "value"));
27008         } else {
27009           parts.push(printAssignment(n.key, printPropertyKey(path, options, print), ":", n.value, path.call(print, "value"), options));
27010         }
27011
27012         return concat$d(parts);
27013       // Babel 6
27014
27015       case "ClassMethod":
27016       case "ClassPrivateMethod":
27017       case "MethodDefinition":
27018       case "TSAbstractMethodDefinition":
27019       case "TSDeclareMethod":
27020         if (n.decorators && n.decorators.length !== 0) {
27021           parts.push(printDecorators(path, options, print));
27022         }
27023
27024         if (n.accessibility) {
27025           parts.push(n.accessibility + " ");
27026         }
27027
27028         if (n.static) {
27029           parts.push("static ");
27030         }
27031
27032         if (n.type === "TSAbstractMethodDefinition" || n.abstract) {
27033           parts.push("abstract ");
27034         }
27035
27036         parts.push(printMethod(path, options, print));
27037         return concat$d(parts);
27038
27039       case "ObjectMethod":
27040         return printMethod(path, options, print);
27041
27042       case "Decorator":
27043         return concat$d(["@", path.call(print, "expression"), path.call(print, "callee")]);
27044
27045       case "ArrayExpression":
27046       case "ArrayPattern":
27047         if (n.elements.length === 0) {
27048           if (!hasDanglingComments$1(n)) {
27049             parts.push("[]");
27050           } else {
27051             parts.push(group$b(concat$d(["[", comments.printDanglingComments(path, options), softline$6, "]"])));
27052           }
27053         } else {
27054           const lastElem = getLast$3(n.elements);
27055           const canHaveTrailingComma = !(lastElem && lastElem.type === "RestElement"); // JavaScript allows you to have empty elements in an array which
27056           // changes its length based on the number of commas. The algorithm
27057           // is that if the last argument is null, we need to force insert
27058           // a comma to ensure JavaScript recognizes it.
27059           //   [,].length === 1
27060           //   [1,].length === 1
27061           //   [1,,].length === 2
27062           //
27063           // Note that getLast returns null if the array is empty, but
27064           // we already check for an empty array just above so we are safe
27065
27066           const needsForcedTrailingComma = canHaveTrailingComma && lastElem === null;
27067           const shouldBreak = n.elements.length > 1 && n.elements.every((element, i, elements) => {
27068             const elementType = element && element.type;
27069
27070             if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") {
27071               return false;
27072             }
27073
27074             const nextElement = elements[i + 1];
27075
27076             if (nextElement && elementType !== nextElement.type) {
27077               return false;
27078             }
27079
27080             const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
27081             return element[itemsKey] && element[itemsKey].length > 1;
27082           });
27083           parts.push(group$b(concat$d(["[", indent$7(concat$d([softline$6, printArrayItems(path, options, "elements", print)])), needsForcedTrailingComma ? "," : "", ifBreak$6(canHaveTrailingComma && !needsForcedTrailingComma && shouldPrintComma$1(options) ? "," : ""), comments.printDanglingComments(path, options,
27084           /* sameIndent */
27085           true), softline$6, "]"]), {
27086             shouldBreak
27087           }));
27088         }
27089
27090         parts.push(printOptionalToken(path), printTypeAnnotation(path, options, print));
27091         return concat$d(parts);
27092
27093       case "SequenceExpression":
27094         {
27095           const parent = path.getParentNode(0);
27096
27097           if (parent.type === "ExpressionStatement" || parent.type === "ForStatement") {
27098             // For ExpressionStatements and for-loop heads, which are among
27099             // the few places a SequenceExpression appears unparenthesized, we want
27100             // to indent expressions after the first.
27101             const parts = [];
27102             path.each(p => {
27103               if (p.getName() === 0) {
27104                 parts.push(print(p));
27105               } else {
27106                 parts.push(",", indent$7(concat$d([line$9, print(p)])));
27107               }
27108             }, "expressions");
27109             return group$b(concat$d(parts));
27110           }
27111
27112           return group$b(concat$d([join$9(concat$d([",", line$9]), path.map(print, "expressions"))]));
27113         }
27114
27115       case "ThisExpression":
27116         return "this";
27117
27118       case "Super":
27119         return "super";
27120
27121       case "NullLiteral":
27122         // Babel 6 Literal split
27123         return "null";
27124
27125       case "RegExpLiteral":
27126         // Babel 6 Literal split
27127         return printRegex(n);
27128
27129       case "NumericLiteral":
27130         // Babel 6 Literal split
27131         return printNumber$2(n.extra.raw);
27132
27133       case "BigIntLiteral":
27134         // babel: n.extra.raw, typescript: n.raw, flow: n.bigint
27135         return (n.bigint || (n.extra ? n.extra.raw : n.raw)).toLowerCase();
27136
27137       case "BooleanLiteral": // Babel 6 Literal split
27138
27139       case "StringLiteral": // Babel 6 Literal split
27140
27141       case "Literal":
27142         {
27143           if (n.regex) {
27144             return printRegex(n.regex);
27145           }
27146
27147           if (typeof n.value === "number") {
27148             return printNumber$2(n.raw);
27149           }
27150
27151           if (typeof n.value !== "string") {
27152             return "" + n.value;
27153           } // TypeScript workaround for https://github.com/JamesHenry/typescript-estree/issues/2
27154           // See corresponding workaround in needs-parens.js
27155
27156
27157           const grandParent = path.getParentNode(1);
27158           const isTypeScriptDirective = options.parser === "typescript" && typeof n.value === "string" && grandParent && (grandParent.type === "Program" || grandParent.type === "BlockStatement");
27159           return nodeStr(n, options, isTypeScriptDirective);
27160         }
27161
27162       case "Directive":
27163         return path.call(print, "value");
27164       // Babel 6
27165
27166       case "DirectiveLiteral":
27167         return nodeStr(n, options);
27168
27169       case "UnaryExpression":
27170         parts.push(n.operator);
27171
27172         if (/[a-z]$/.test(n.operator)) {
27173           parts.push(" ");
27174         }
27175
27176         if (n.argument.comments && n.argument.comments.length > 0) {
27177           parts.push(group$b(concat$d(["(", indent$7(concat$d([softline$6, path.call(print, "argument")])), softline$6, ")"])));
27178         } else {
27179           parts.push(path.call(print, "argument"));
27180         }
27181
27182         return concat$d(parts);
27183
27184       case "UpdateExpression":
27185         parts.push(path.call(print, "argument"), n.operator);
27186
27187         if (n.prefix) {
27188           parts.reverse();
27189         }
27190
27191         return concat$d(parts);
27192
27193       case "ConditionalExpression":
27194         return printTernaryOperator(path, options, print, {
27195           beforeParts: () => [path.call(print, "test")],
27196           afterParts: breakClosingParen => [breakClosingParen ? softline$6 : ""],
27197           shouldCheckJsx: true,
27198           conditionalNodeType: "ConditionalExpression",
27199           consequentNodePropertyName: "consequent",
27200           alternateNodePropertyName: "alternate",
27201           testNodePropertyNames: ["test"]
27202         });
27203
27204       case "VariableDeclaration":
27205         {
27206           const printed = path.map(childPath => {
27207             return print(childPath);
27208           }, "declarations"); // We generally want to terminate all variable declarations with a
27209           // semicolon, except when they in the () part of for loops.
27210
27211           const parentNode = path.getParentNode();
27212           const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement";
27213           const hasValue = n.declarations.some(decl => decl.init);
27214           let firstVariable;
27215
27216           if (printed.length === 1 && !n.declarations[0].comments) {
27217             firstVariable = printed[0];
27218           } else if (printed.length > 0) {
27219             // Indent first var to comply with eslint one-var rule
27220             firstVariable = indent$7(printed[0]);
27221           }
27222
27223           parts = [n.declare ? "declare " : "", n.kind, firstVariable ? concat$d([" ", firstVariable]) : "", indent$7(concat$d(printed.slice(1).map(p => concat$d([",", hasValue && !isParentForLoop ? hardline$9 : line$9, p]))))];
27224
27225           if (!(isParentForLoop && parentNode.body !== n)) {
27226             parts.push(semi);
27227           }
27228
27229           return group$b(concat$d(parts));
27230         }
27231
27232       case "TSTypeAliasDeclaration":
27233         {
27234           if (n.declare) {
27235             parts.push("declare ");
27236           }
27237
27238           const printed = printAssignmentRight(n.id, n.typeAnnotation, n.typeAnnotation && path.call(print, "typeAnnotation"), options);
27239           parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", printed, semi);
27240           return group$b(concat$d(parts));
27241         }
27242
27243       case "VariableDeclarator":
27244         return printAssignment(n.id, path.call(print, "id"), " =", n.init, n.init && path.call(print, "init"), options);
27245
27246       case "WithStatement":
27247         return group$b(concat$d(["with (", path.call(print, "object"), ")", adjustClause(n.body, path.call(print, "body"))]));
27248
27249       case "IfStatement":
27250         {
27251           const con = adjustClause(n.consequent, path.call(print, "consequent"));
27252           const opening = group$b(concat$d(["if (", group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "test")])), softline$6])), ")", con]));
27253           parts.push(opening);
27254
27255           if (n.alternate) {
27256             const commentOnOwnLine = hasTrailingComment$1(n.consequent) && n.consequent.comments.some(comment => comment.trailing && !comments$1.isBlockComment(comment)) || needsHardlineAfterDanglingComment$1(n);
27257             const elseOnSameLine = n.consequent.type === "BlockStatement" && !commentOnOwnLine;
27258             parts.push(elseOnSameLine ? " " : hardline$9);
27259
27260             if (hasDanglingComments$1(n)) {
27261               parts.push(comments.printDanglingComments(path, options, true), commentOnOwnLine ? hardline$9 : " ");
27262             }
27263
27264             parts.push("else", group$b(adjustClause(n.alternate, path.call(print, "alternate"), n.alternate.type === "IfStatement")));
27265           }
27266
27267           return concat$d(parts);
27268         }
27269
27270       case "ForStatement":
27271         {
27272           const body = adjustClause(n.body, path.call(print, "body")); // We want to keep dangling comments above the loop to stay consistent.
27273           // Any comment positioned between the for statement and the parentheses
27274           // is going to be printed before the statement.
27275
27276           const dangling = comments.printDanglingComments(path, options,
27277           /* sameLine */
27278           true);
27279           const printedComments = dangling ? concat$d([dangling, softline$6]) : "";
27280
27281           if (!n.init && !n.test && !n.update) {
27282             return concat$d([printedComments, group$b(concat$d(["for (;;)", body]))]);
27283           }
27284
27285           return concat$d([printedComments, group$b(concat$d(["for (", group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "init"), ";", line$9, path.call(print, "test"), ";", line$9, path.call(print, "update")])), softline$6])), ")", body]))]);
27286         }
27287
27288       case "WhileStatement":
27289         return group$b(concat$d(["while (", group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "test")])), softline$6])), ")", adjustClause(n.body, path.call(print, "body"))]));
27290
27291       case "ForInStatement":
27292         // Note: esprima can't actually parse "for each (".
27293         return group$b(concat$d([n.each ? "for each (" : "for (", path.call(print, "left"), " in ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
27294
27295       case "ForOfStatement":
27296         return group$b(concat$d(["for", n.await ? " await" : "", " (", path.call(print, "left"), " of ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
27297
27298       case "DoWhileStatement":
27299         {
27300           const clause = adjustClause(n.body, path.call(print, "body"));
27301           const doBody = group$b(concat$d(["do", clause]));
27302           parts = [doBody];
27303
27304           if (n.body.type === "BlockStatement") {
27305             parts.push(" ");
27306           } else {
27307             parts.push(hardline$9);
27308           }
27309
27310           parts.push("while (");
27311           parts.push(group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "test")])), softline$6])), ")", semi);
27312           return concat$d(parts);
27313         }
27314
27315       case "DoExpression":
27316         return concat$d(["do ", path.call(print, "body")]);
27317
27318       case "BreakStatement":
27319         parts.push("break");
27320
27321         if (n.label) {
27322           parts.push(" ", path.call(print, "label"));
27323         }
27324
27325         parts.push(semi);
27326         return concat$d(parts);
27327
27328       case "ContinueStatement":
27329         parts.push("continue");
27330
27331         if (n.label) {
27332           parts.push(" ", path.call(print, "label"));
27333         }
27334
27335         parts.push(semi);
27336         return concat$d(parts);
27337
27338       case "LabeledStatement":
27339         if (n.body.type === "EmptyStatement") {
27340           return concat$d([path.call(print, "label"), ":;"]);
27341         }
27342
27343         return concat$d([path.call(print, "label"), ": ", path.call(print, "body")]);
27344
27345       case "TryStatement":
27346         return concat$d(["try ", path.call(print, "block"), n.handler ? concat$d([" ", path.call(print, "handler")]) : "", n.finalizer ? concat$d([" finally ", path.call(print, "finalizer")]) : ""]);
27347
27348       case "CatchClause":
27349         if (n.param) {
27350           const hasComments = n.param.comments && n.param.comments.some(comment => !comments$1.isBlockComment(comment) || comment.leading && hasNewline$5(options.originalText, options.locEnd(comment)) || comment.trailing && hasNewline$5(options.originalText, options.locStart(comment), {
27351             backwards: true
27352           }));
27353           const param = path.call(print, "param");
27354           return concat$d(["catch ", hasComments ? concat$d(["(", indent$7(concat$d([softline$6, param])), softline$6, ") "]) : concat$d(["(", param, ") "]), path.call(print, "body")]);
27355         }
27356
27357         return concat$d(["catch ", path.call(print, "body")]);
27358
27359       case "ThrowStatement":
27360         return concat$d(["throw", printReturnAndThrowArgument(path, options, print)]);
27361       // Note: ignoring n.lexical because it has no printing consequences.
27362
27363       case "SwitchStatement":
27364         return concat$d([group$b(concat$d(["switch (", indent$7(concat$d([softline$6, path.call(print, "discriminant")])), softline$6, ")"])), " {", n.cases.length > 0 ? indent$7(concat$d([hardline$9, join$9(hardline$9, path.map(casePath => {
27365           const caseNode = casePath.getValue();
27366           return concat$d([casePath.call(print), n.cases.indexOf(caseNode) !== n.cases.length - 1 && isNextLineEmpty$4(options.originalText, caseNode, options.locEnd) ? hardline$9 : ""]);
27367         }, "cases"))])) : "", hardline$9, "}"]);
27368
27369       case "SwitchCase":
27370         {
27371           if (n.test) {
27372             parts.push("case ", path.call(print, "test"), ":");
27373           } else {
27374             parts.push("default:");
27375           }
27376
27377           const consequent = n.consequent.filter(node => node.type !== "EmptyStatement");
27378
27379           if (consequent.length > 0) {
27380             const cons = path.call(consequentPath => {
27381               return printStatementSequence(consequentPath, options, print);
27382             }, "consequent");
27383             parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? concat$d([" ", cons]) : indent$7(concat$d([hardline$9, cons])));
27384           }
27385
27386           return concat$d(parts);
27387         }
27388       // JSX extensions below.
27389
27390       case "DebuggerStatement":
27391         return concat$d(["debugger", semi]);
27392
27393       case "JSXAttribute":
27394         parts.push(path.call(print, "name"));
27395
27396         if (n.value) {
27397           let res;
27398
27399           if (isStringLiteral$1(n.value)) {
27400             const raw = rawText$1(n.value); // Unescape all quotes so we get an accurate preferred quote
27401
27402             let final = raw.replace(/&apos;/g, "'").replace(/&quot;/g, '"');
27403             const quote = getPreferredQuote$1(final, options.jsxSingleQuote ? "'" : '"');
27404             const escape = quote === "'" ? "&apos;" : "&quot;";
27405             final = final.slice(1, -1).replace(new RegExp(quote, "g"), escape);
27406             res = concat$d([quote, final, quote]);
27407           } else {
27408             res = path.call(print, "value");
27409           }
27410
27411           parts.push("=", res);
27412         }
27413
27414         return concat$d(parts);
27415
27416       case "JSXIdentifier":
27417         return "" + n.name;
27418
27419       case "JSXNamespacedName":
27420         return join$9(":", [path.call(print, "namespace"), path.call(print, "name")]);
27421
27422       case "JSXMemberExpression":
27423         return join$9(".", [path.call(print, "object"), path.call(print, "property")]);
27424
27425       case "TSQualifiedName":
27426         return join$9(".", [path.call(print, "left"), path.call(print, "right")]);
27427
27428       case "JSXSpreadAttribute":
27429       case "JSXSpreadChild":
27430         {
27431           return concat$d(["{", path.call(p => {
27432             const printed = concat$d(["...", print(p)]);
27433             const n = p.getValue();
27434
27435             if (!n.comments || !n.comments.length) {
27436               return printed;
27437             }
27438
27439             return concat$d([indent$7(concat$d([softline$6, comments.printComments(p, () => printed, options)])), softline$6]);
27440           }, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"]);
27441         }
27442
27443       case "JSXExpressionContainer":
27444         {
27445           const parent = path.getParentNode(0);
27446           const hasComments = n.expression.comments && n.expression.comments.length > 0;
27447           const shouldInline = n.expression.type === "JSXEmptyExpression" || !hasComments && (n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression" || n.expression.type === "ArrowFunctionExpression" || n.expression.type === "CallExpression" || n.expression.type === "OptionalCallExpression" || n.expression.type === "FunctionExpression" || n.expression.type === "TemplateLiteral" || n.expression.type === "TaggedTemplateExpression" || n.expression.type === "DoExpression" || isJSXNode$1(parent) && (n.expression.type === "ConditionalExpression" || isBinaryish$1(n.expression)));
27448
27449           if (shouldInline) {
27450             return group$b(concat$d(["{", path.call(print, "expression"), lineSuffixBoundary$1, "}"]));
27451           }
27452
27453           return group$b(concat$d(["{", indent$7(concat$d([softline$6, path.call(print, "expression")])), softline$6, lineSuffixBoundary$1, "}"]));
27454         }
27455
27456       case "JSXFragment":
27457       case "JSXElement":
27458         {
27459           const elem = comments.printComments(path, () => printJSXElement(path, options, print), options);
27460           return maybeWrapJSXElementInParens(path, elem, options);
27461         }
27462
27463       case "JSXOpeningElement":
27464         {
27465           const n = path.getValue();
27466           const nameHasComments = n.name && n.name.comments && n.name.comments.length > 0 || n.typeParameters && n.typeParameters.comments && n.typeParameters.comments.length > 0; // Don't break self-closing elements with no attributes and no comments
27467
27468           if (n.selfClosing && !n.attributes.length && !nameHasComments) {
27469             return concat$d(["<", path.call(print, "name"), path.call(print, "typeParameters"), " />"]);
27470           } // don't break up opening elements with a single long text attribute
27471
27472
27473           if (n.attributes && n.attributes.length === 1 && n.attributes[0].value && isStringLiteral$1(n.attributes[0].value) && !n.attributes[0].value.value.includes("\n") && // We should break for the following cases:
27474           // <div
27475           //   // comment
27476           //   attr="value"
27477           // >
27478           // <div
27479           //   attr="value"
27480           //   // comment
27481           // >
27482           !nameHasComments && (!n.attributes[0].comments || !n.attributes[0].comments.length)) {
27483             return group$b(concat$d(["<", path.call(print, "name"), path.call(print, "typeParameters"), " ", concat$d(path.map(print, "attributes")), n.selfClosing ? " />" : ">"]));
27484           }
27485
27486           const lastAttrHasTrailingComments = n.attributes.length && hasTrailingComment$1(getLast$3(n.attributes));
27487           const bracketSameLine = // Simple tags (no attributes and no comment in tag name) should be
27488           // kept unbroken regardless of `jsxBracketSameLine`
27489           !n.attributes.length && !nameHasComments || options.jsxBracketSameLine && ( // We should print the bracket in a new line for the following cases:
27490           // <div
27491           //   // comment
27492           // >
27493           // <div
27494           //   attr // comment
27495           // >
27496           !nameHasComments || n.attributes.length) && !lastAttrHasTrailingComments; // We should print the opening element expanded if any prop value is a
27497           // string literal with newlines
27498
27499           const shouldBreak = n.attributes && n.attributes.some(attr => attr.value && isStringLiteral$1(attr.value) && attr.value.value.includes("\n"));
27500           return group$b(concat$d(["<", path.call(print, "name"), path.call(print, "typeParameters"), concat$d([indent$7(concat$d(path.map(attr => concat$d([line$9, print(attr)]), "attributes"))), n.selfClosing ? line$9 : bracketSameLine ? ">" : softline$6]), n.selfClosing ? "/>" : bracketSameLine ? "" : ">"]), {
27501             shouldBreak
27502           });
27503         }
27504
27505       case "JSXClosingElement":
27506         return concat$d(["</", path.call(print, "name"), ">"]);
27507
27508       case "JSXOpeningFragment":
27509       case "JSXClosingFragment":
27510         {
27511           const hasComment = n.comments && n.comments.length;
27512           const hasOwnLineComment = hasComment && !n.comments.every(comments$1.isBlockComment);
27513           const isOpeningFragment = n.type === "JSXOpeningFragment";
27514           return concat$d([isOpeningFragment ? "<" : "</", indent$7(concat$d([hasOwnLineComment ? hardline$9 : hasComment && !isOpeningFragment ? " " : "", comments.printDanglingComments(path, options, true)])), hasOwnLineComment ? hardline$9 : "", ">"]);
27515         }
27516
27517       case "JSXText":
27518         /* istanbul ignore next */
27519         throw new Error("JSXTest should be handled by JSXElement");
27520
27521       case "JSXEmptyExpression":
27522         {
27523           const requiresHardline = n.comments && !n.comments.every(comments$1.isBlockComment);
27524           return concat$d([comments.printDanglingComments(path, options,
27525           /* sameIndent */
27526           !requiresHardline), requiresHardline ? hardline$9 : ""]);
27527         }
27528
27529       case "ClassBody":
27530         if (!n.comments && n.body.length === 0) {
27531           return "{}";
27532         }
27533
27534         return concat$d(["{", n.body.length > 0 ? indent$7(concat$d([hardline$9, path.call(bodyPath => {
27535           return printStatementSequence(bodyPath, options, print);
27536         }, "body")])) : comments.printDanglingComments(path, options), hardline$9, "}"]);
27537
27538       case "ClassProperty":
27539       case "TSAbstractClassProperty":
27540       case "ClassPrivateProperty":
27541         {
27542           if (n.decorators && n.decorators.length !== 0) {
27543             parts.push(printDecorators(path, options, print));
27544           }
27545
27546           if (n.accessibility) {
27547             parts.push(n.accessibility + " ");
27548           }
27549
27550           if (n.declare) {
27551             parts.push("declare ");
27552           }
27553
27554           if (n.static) {
27555             parts.push("static ");
27556           }
27557
27558           if (n.type === "TSAbstractClassProperty" || n.abstract) {
27559             parts.push("abstract ");
27560           }
27561
27562           if (n.readonly) {
27563             parts.push("readonly ");
27564           }
27565
27566           const variance = getFlowVariance$1(n);
27567
27568           if (variance) {
27569             parts.push(variance);
27570           }
27571
27572           parts.push(printPropertyKey(path, options, print), printOptionalToken(path), printTypeAnnotation(path, options, print));
27573
27574           if (n.value) {
27575             parts.push(" =", printAssignmentRight(n.key, n.value, path.call(print, "value"), options));
27576           }
27577
27578           parts.push(semi);
27579           return group$b(concat$d(parts));
27580         }
27581
27582       case "ClassDeclaration":
27583       case "ClassExpression":
27584         if (n.declare) {
27585           parts.push("declare ");
27586         }
27587
27588         parts.push(concat$d(printClass(path, options, print)));
27589         return concat$d(parts);
27590
27591       case "TSInterfaceHeritage":
27592       case "TSExpressionWithTypeArguments":
27593         // Babel AST
27594         parts.push(path.call(print, "expression"));
27595
27596         if (n.typeParameters) {
27597           parts.push(path.call(print, "typeParameters"));
27598         }
27599
27600         return concat$d(parts);
27601
27602       case "TemplateElement":
27603         return join$9(literalline$4, n.value.raw.split(/\r?\n/g));
27604
27605       case "TemplateLiteral":
27606         {
27607           let expressions = path.map(print, "expressions");
27608           const parentNode = path.getParentNode();
27609
27610           if (isJestEachTemplateLiteral$1(n, parentNode)) {
27611             const printed = printJestEachTemplateLiteral(n, expressions, options);
27612
27613             if (printed) {
27614               return printed;
27615             }
27616           }
27617
27618           const isSimple = isSimpleTemplateLiteral$1(n);
27619
27620           if (isSimple) {
27621             expressions = expressions.map(doc => printDocToString$2(doc, Object.assign({}, options, {
27622               printWidth: Infinity
27623             })).formatted);
27624           }
27625
27626           parts.push(lineSuffixBoundary$1, "`");
27627           path.each(childPath => {
27628             const i = childPath.getName();
27629             parts.push(print(childPath));
27630
27631             if (i < expressions.length) {
27632               // For a template literal of the following form:
27633               //   `someQuery {
27634               //     ${call({
27635               //       a,
27636               //       b,
27637               //     })}
27638               //   }`
27639               // the expression is on its own line (there is a \n in the previous
27640               // quasi literal), therefore we want to indent the JavaScript
27641               // expression inside at the beginning of ${ instead of the beginning
27642               // of the `.
27643               const {
27644                 tabWidth
27645               } = options;
27646               const quasi = childPath.getValue();
27647               const indentSize = getIndentSize$2(quasi.value.raw, tabWidth);
27648               let printed = expressions[i];
27649
27650               if (!isSimple) {
27651                 // Breaks at the template element boundaries (${ and }) are preferred to breaking
27652                 // in the middle of a MemberExpression
27653                 if (n.expressions[i].comments && n.expressions[i].comments.length || n.expressions[i].type === "MemberExpression" || n.expressions[i].type === "OptionalMemberExpression" || n.expressions[i].type === "ConditionalExpression" || n.expressions[i].type === "SequenceExpression" || n.expressions[i].type === "TSAsExpression" || isBinaryish$1(n.expressions[i])) {
27654                   printed = concat$d([indent$7(concat$d([softline$6, printed])), softline$6]);
27655                 }
27656               }
27657
27658               const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity, printed) : addAlignmentToDoc$2(printed, indentSize, tabWidth);
27659               parts.push(group$b(concat$d(["${", aligned, lineSuffixBoundary$1, "}"])));
27660             }
27661           }, "quasis");
27662           parts.push("`");
27663           return concat$d(parts);
27664         }
27665       // These types are unprintable because they serve as abstract
27666       // supertypes for other (printable) types.
27667
27668       case "TaggedTemplateExpression":
27669         return concat$d([path.call(print, "tag"), path.call(print, "typeParameters"), path.call(print, "quasi")]);
27670
27671       case "Node":
27672       case "Printable":
27673       case "SourceLocation":
27674       case "Position":
27675       case "Statement":
27676       case "Function":
27677       case "Pattern":
27678       case "Expression":
27679       case "Declaration":
27680       case "Specifier":
27681       case "NamedSpecifier":
27682       case "Comment":
27683       case "MemberTypeAnnotation": // Flow
27684
27685       case "Type":
27686         /* istanbul ignore next */
27687         throw new Error("unprintable type: " + JSON.stringify(n.type));
27688       // Type Annotations for Facebook Flow, typically stripped out or
27689       // transformed away before printing.
27690
27691       case "TypeAnnotation":
27692       case "TSTypeAnnotation":
27693         if (n.typeAnnotation) {
27694           return path.call(print, "typeAnnotation");
27695         }
27696         /* istanbul ignore next */
27697
27698
27699         return "";
27700
27701       case "TSTupleType":
27702       case "TupleTypeAnnotation":
27703         {
27704           const typesField = n.type === "TSTupleType" ? "elementTypes" : "types";
27705           const hasRest = n[typesField].length > 0 && getLast$3(n[typesField]).type === "TSRestType";
27706           return group$b(concat$d(["[", indent$7(concat$d([softline$6, printArrayItems(path, options, typesField, print)])), ifBreak$6(shouldPrintComma$1(options, "all") && !hasRest ? "," : ""), comments.printDanglingComments(path, options,
27707           /* sameIndent */
27708           true), softline$6, "]"]));
27709         }
27710
27711       case "ExistsTypeAnnotation":
27712         return "*";
27713
27714       case "EmptyTypeAnnotation":
27715         return "empty";
27716
27717       case "AnyTypeAnnotation":
27718         return "any";
27719
27720       case "MixedTypeAnnotation":
27721         return "mixed";
27722
27723       case "ArrayTypeAnnotation":
27724         return concat$d([path.call(print, "elementType"), "[]"]);
27725
27726       case "BooleanTypeAnnotation":
27727         return "boolean";
27728
27729       case "BooleanLiteralTypeAnnotation":
27730         return "" + n.value;
27731
27732       case "DeclareClass":
27733         return printFlowDeclaration(path, printClass(path, options, print));
27734
27735       case "TSDeclareFunction":
27736         // For TypeScript the TSDeclareFunction node shares the AST
27737         // structure with FunctionDeclaration
27738         return concat$d([n.declare ? "declare " : "", printFunctionDeclaration(path, print, options), semi]);
27739
27740       case "DeclareFunction":
27741         return printFlowDeclaration(path, ["function ", path.call(print, "id"), n.predicate ? " " : "", path.call(print, "predicate"), semi]);
27742
27743       case "DeclareModule":
27744         return printFlowDeclaration(path, ["module ", path.call(print, "id"), " ", path.call(print, "body")]);
27745
27746       case "DeclareModuleExports":
27747         return printFlowDeclaration(path, ["module.exports", ": ", path.call(print, "typeAnnotation"), semi]);
27748
27749       case "DeclareVariable":
27750         return printFlowDeclaration(path, ["var ", path.call(print, "id"), semi]);
27751
27752       case "DeclareExportAllDeclaration":
27753         return concat$d(["declare export * from ", path.call(print, "source")]);
27754
27755       case "DeclareExportDeclaration":
27756         return concat$d(["declare ", printExportDeclaration(path, options, print)]);
27757
27758       case "DeclareOpaqueType":
27759       case "OpaqueType":
27760         {
27761           parts.push("opaque type ", path.call(print, "id"), path.call(print, "typeParameters"));
27762
27763           if (n.supertype) {
27764             parts.push(": ", path.call(print, "supertype"));
27765           }
27766
27767           if (n.impltype) {
27768             parts.push(" = ", path.call(print, "impltype"));
27769           }
27770
27771           parts.push(semi);
27772
27773           if (n.type === "DeclareOpaqueType") {
27774             return printFlowDeclaration(path, parts);
27775           }
27776
27777           return concat$d(parts);
27778         }
27779
27780       case "EnumDeclaration":
27781         return concat$d(["enum ", path.call(print, "id"), " ", path.call(print, "body")]);
27782
27783       case "EnumBooleanBody":
27784       case "EnumNumberBody":
27785       case "EnumStringBody":
27786       case "EnumSymbolBody":
27787         {
27788           if (n.type === "EnumSymbolBody" || n.explicitType) {
27789             let type = null;
27790
27791             switch (n.type) {
27792               case "EnumBooleanBody":
27793                 type = "boolean";
27794                 break;
27795
27796               case "EnumNumberBody":
27797                 type = "number";
27798                 break;
27799
27800               case "EnumStringBody":
27801                 type = "string";
27802                 break;
27803
27804               case "EnumSymbolBody":
27805                 type = "symbol";
27806                 break;
27807             }
27808
27809             parts.push("of ", type, " ");
27810           }
27811
27812           if (n.members.length === 0) {
27813             parts.push(group$b(concat$d(["{", comments.printDanglingComments(path, options), softline$6, "}"])));
27814           } else {
27815             parts.push(group$b(concat$d(["{", indent$7(concat$d([hardline$9, printArrayItems(path, options, "members", print), shouldPrintComma$1(options) ? "," : ""])), comments.printDanglingComments(path, options,
27816             /* sameIndent */
27817             true), hardline$9, "}"])));
27818           }
27819
27820           return concat$d(parts);
27821         }
27822
27823       case "EnumBooleanMember":
27824       case "EnumNumberMember":
27825       case "EnumStringMember":
27826         return concat$d([path.call(print, "id"), " = ", typeof n.init === "object" ? path.call(print, "init") : String(n.init)]);
27827
27828       case "EnumDefaultedMember":
27829         return path.call(print, "id");
27830
27831       case "FunctionTypeAnnotation":
27832       case "TSFunctionType":
27833         {
27834           // FunctionTypeAnnotation is ambiguous:
27835           // declare function foo(a: B): void; OR
27836           // var A: (a: B) => void;
27837           const parent = path.getParentNode(0);
27838           const parentParent = path.getParentNode(1);
27839           const parentParentParent = path.getParentNode(2);
27840           let isArrowFunctionTypeAnnotation = n.type === "TSFunctionType" || !((parent.type === "ObjectTypeProperty" || parent.type === "ObjectTypeInternalSlot") && !getFlowVariance$1(parent) && !parent.optional && options.locStart(parent) === options.locStart(n) || parent.type === "ObjectTypeCallProperty" || parentParentParent && parentParentParent.type === "DeclareFunction");
27841           let needsColon = isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation"); // Sadly we can't put it inside of FastPath::needsColon because we are
27842           // printing ":" as part of the expression and it would put parenthesis
27843           // around :(
27844
27845           const needsParens = needsColon && isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression";
27846
27847           if (isObjectTypePropertyAFunction$1(parent, options)) {
27848             isArrowFunctionTypeAnnotation = true;
27849             needsColon = true;
27850           }
27851
27852           if (needsParens) {
27853             parts.push("(");
27854           }
27855
27856           parts.push(printFunctionParams(path, print, options,
27857           /* expandArg */
27858           false,
27859           /* printTypeParams */
27860           true)); // The returnType is not wrapped in a TypeAnnotation, so the colon
27861           // needs to be added separately.
27862
27863           if (n.returnType || n.predicate || n.typeAnnotation) {
27864             parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path.call(print, "returnType"), path.call(print, "predicate"), path.call(print, "typeAnnotation"));
27865           }
27866
27867           if (needsParens) {
27868             parts.push(")");
27869           }
27870
27871           return group$b(concat$d(parts));
27872         }
27873
27874       case "TSRestType":
27875         return concat$d(["...", path.call(print, "typeAnnotation")]);
27876
27877       case "TSOptionalType":
27878         return concat$d([path.call(print, "typeAnnotation"), "?"]);
27879
27880       case "FunctionTypeParam":
27881         return concat$d([path.call(print, "name"), printOptionalToken(path), n.name ? ": " : "", path.call(print, "typeAnnotation")]);
27882
27883       case "GenericTypeAnnotation":
27884         return concat$d([path.call(print, "id"), path.call(print, "typeParameters")]);
27885
27886       case "DeclareInterface":
27887       case "InterfaceDeclaration":
27888       case "InterfaceTypeAnnotation":
27889         {
27890           if (n.type === "DeclareInterface" || n.declare) {
27891             parts.push("declare ");
27892           }
27893
27894           parts.push("interface");
27895
27896           if (n.type === "DeclareInterface" || n.type === "InterfaceDeclaration") {
27897             parts.push(" ", path.call(print, "id"), path.call(print, "typeParameters"));
27898           }
27899
27900           if (n.extends.length > 0) {
27901             parts.push(group$b(indent$7(concat$d([line$9, "extends ", (n.extends.length === 1 ? identity$2 : indent$7)(join$9(concat$d([",", line$9]), path.map(print, "extends")))]))));
27902           }
27903
27904           parts.push(" ", path.call(print, "body"));
27905           return group$b(concat$d(parts));
27906         }
27907
27908       case "ClassImplements":
27909       case "InterfaceExtends":
27910         return concat$d([path.call(print, "id"), path.call(print, "typeParameters")]);
27911
27912       case "TSClassImplements":
27913         return concat$d([path.call(print, "expression"), path.call(print, "typeParameters")]);
27914
27915       case "TSIntersectionType":
27916       case "IntersectionTypeAnnotation":
27917         {
27918           const types = path.map(print, "types");
27919           const result = [];
27920           let wasIndented = false;
27921
27922           for (let i = 0; i < types.length; ++i) {
27923             if (i === 0) {
27924               result.push(types[i]);
27925             } else if (isObjectType$1(n.types[i - 1]) && isObjectType$1(n.types[i])) {
27926               // If both are objects, don't indent
27927               result.push(concat$d([" & ", wasIndented ? indent$7(types[i]) : types[i]]));
27928             } else if (!isObjectType$1(n.types[i - 1]) && !isObjectType$1(n.types[i])) {
27929               // If no object is involved, go to the next line if it breaks
27930               result.push(indent$7(concat$d([" &", line$9, types[i]])));
27931             } else {
27932               // If you go from object to non-object or vis-versa, then inline it
27933               if (i > 1) {
27934                 wasIndented = true;
27935               }
27936
27937               result.push(" & ", i > 1 ? indent$7(types[i]) : types[i]);
27938             }
27939           }
27940
27941           return group$b(concat$d(result));
27942         }
27943
27944       case "TSUnionType":
27945       case "UnionTypeAnnotation":
27946         {
27947           // single-line variation
27948           // A | B | C
27949           // multi-line variation
27950           // | A
27951           // | B
27952           // | C
27953           const parent = path.getParentNode(); // If there's a leading comment, the parent is doing the indentation
27954
27955           const shouldIndent = parent.type !== "TypeParameterInstantiation" && parent.type !== "TSTypeParameterInstantiation" && parent.type !== "GenericTypeAnnotation" && parent.type !== "TSTypeReference" && parent.type !== "TSTypeAssertion" && parent.type !== "TupleTypeAnnotation" && parent.type !== "TSTupleType" && !(parent.type === "FunctionTypeParam" && !parent.name) && !((parent.type === "TypeAlias" || parent.type === "VariableDeclarator" || parent.type === "TSTypeAliasDeclaration") && hasLeadingOwnLineComment$1(options.originalText, n, options)); // {
27956           //   a: string
27957           // } | null | void
27958           // should be inlined and not be printed in the multi-line variant
27959
27960           const shouldHug = shouldHugType(n); // We want to align the children but without its comment, so it looks like
27961           // | child1
27962           // // comment
27963           // | child2
27964
27965           const printed = path.map(typePath => {
27966             let printedType = typePath.call(print);
27967
27968             if (!shouldHug) {
27969               printedType = align$1(2, printedType);
27970             }
27971
27972             return comments.printComments(typePath, () => printedType, options);
27973           }, "types");
27974
27975           if (shouldHug) {
27976             return join$9(" | ", printed);
27977           }
27978
27979           const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment$1(options.originalText, n, options);
27980           const code = concat$d([ifBreak$6(concat$d([shouldAddStartLine ? line$9 : "", "| "])), join$9(concat$d([line$9, "| "]), printed)]);
27981
27982           if (needsParens_1(path, options)) {
27983             return group$b(concat$d([indent$7(code), softline$6]));
27984           }
27985
27986           if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) {
27987             return group$b(concat$d([indent$7(concat$d([ifBreak$6(concat$d(["(", softline$6])), code])), softline$6, ifBreak$6(")")]));
27988           }
27989
27990           return group$b(shouldIndent ? indent$7(code) : code);
27991         }
27992
27993       case "NullableTypeAnnotation":
27994         return concat$d(["?", path.call(print, "typeAnnotation")]);
27995
27996       case "TSNullKeyword":
27997       case "NullLiteralTypeAnnotation":
27998         return "null";
27999
28000       case "ThisTypeAnnotation":
28001         return "this";
28002
28003       case "NumberTypeAnnotation":
28004         return "number";
28005
28006       case "SymbolTypeAnnotation":
28007         return "symbol";
28008
28009       case "ObjectTypeCallProperty":
28010         if (n.static) {
28011           parts.push("static ");
28012         }
28013
28014         parts.push(path.call(print, "value"));
28015         return concat$d(parts);
28016
28017       case "ObjectTypeIndexer":
28018         {
28019           const variance = getFlowVariance$1(n);
28020           return concat$d([variance || "", "[", path.call(print, "id"), n.id ? ": " : "", path.call(print, "key"), "]: ", path.call(print, "value")]);
28021         }
28022
28023       case "ObjectTypeProperty":
28024         {
28025           const variance = getFlowVariance$1(n);
28026           let modifier = "";
28027
28028           if (n.proto) {
28029             modifier = "proto ";
28030           } else if (n.static) {
28031             modifier = "static ";
28032           }
28033
28034           return concat$d([modifier, isGetterOrSetter$1(n) ? n.kind + " " : "", variance || "", printPropertyKey(path, options, print), printOptionalToken(path), isFunctionNotation$1(n, options) ? "" : ": ", path.call(print, "value")]);
28035         }
28036
28037       case "QualifiedTypeIdentifier":
28038         return concat$d([path.call(print, "qualification"), ".", path.call(print, "id")]);
28039
28040       case "StringLiteralTypeAnnotation":
28041         return nodeStr(n, options);
28042
28043       case "NumberLiteralTypeAnnotation":
28044         assert.strictEqual(typeof n.value, "number");
28045
28046         if (n.extra != null) {
28047           return printNumber$2(n.extra.raw);
28048         }
28049
28050         return printNumber$2(n.raw);
28051
28052       case "StringTypeAnnotation":
28053         return "string";
28054
28055       case "DeclareTypeAlias":
28056       case "TypeAlias":
28057         {
28058           if (n.type === "DeclareTypeAlias" || n.declare) {
28059             parts.push("declare ");
28060           }
28061
28062           const printed = printAssignmentRight(n.id, n.right, path.call(print, "right"), options);
28063           parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", printed, semi);
28064           return group$b(concat$d(parts));
28065         }
28066
28067       case "TypeCastExpression":
28068         {
28069           return concat$d(["(", path.call(print, "expression"), printTypeAnnotation(path, options, print), ")"]);
28070         }
28071
28072       case "TypeParameterDeclaration":
28073       case "TypeParameterInstantiation":
28074         {
28075           const value = path.getValue();
28076           const commentStart = value.range ? options.originalText.slice(0, value.range[0]).lastIndexOf("/*") : -1; // As noted in the TypeCastExpression comments above, we're able to use a normal whitespace regex here
28077           // because we know for sure that this is a type definition.
28078
28079           const commentSyntax = commentStart >= 0 && options.originalText.slice(commentStart).match(/^\/\*\s*::/);
28080
28081           if (commentSyntax) {
28082             return concat$d(["/*:: ", printTypeParameters(path, options, print, "params"), " */"]);
28083           }
28084
28085           return printTypeParameters(path, options, print, "params");
28086         }
28087
28088       case "TSTypeParameterDeclaration":
28089       case "TSTypeParameterInstantiation":
28090         return printTypeParameters(path, options, print, "params");
28091
28092       case "TSTypeParameter":
28093       case "TypeParameter":
28094         {
28095           const parent = path.getParentNode();
28096
28097           if (parent.type === "TSMappedType") {
28098             parts.push("[", path.call(print, "name"));
28099
28100             if (n.constraint) {
28101               parts.push(" in ", path.call(print, "constraint"));
28102             }
28103
28104             parts.push("]");
28105             return concat$d(parts);
28106           }
28107
28108           const variance = getFlowVariance$1(n);
28109
28110           if (variance) {
28111             parts.push(variance);
28112           }
28113
28114           parts.push(path.call(print, "name"));
28115
28116           if (n.bound) {
28117             parts.push(": ");
28118             parts.push(path.call(print, "bound"));
28119           }
28120
28121           if (n.constraint) {
28122             parts.push(" extends ", path.call(print, "constraint"));
28123           }
28124
28125           if (n.default) {
28126             parts.push(" = ", path.call(print, "default"));
28127           } // Keep comma if the file extension is .tsx and
28128           // has one type parameter that isn't extend with any types.
28129           // Because, otherwise formatted result will be invalid as tsx.
28130
28131
28132           const grandParent = path.getNode(2);
28133
28134           if (parent.params && parent.params.length === 1 && isTSXFile$1(options) && !n.constraint && grandParent.type === "ArrowFunctionExpression") {
28135             parts.push(",");
28136           }
28137
28138           return concat$d(parts);
28139         }
28140
28141       case "TypeofTypeAnnotation":
28142         return concat$d(["typeof ", path.call(print, "argument")]);
28143
28144       case "VoidTypeAnnotation":
28145         return "void";
28146
28147       case "InferredPredicate":
28148         return "%checks";
28149       // Unhandled types below. If encountered, nodes of these types should
28150       // be either left alone or desugared into AST types that are fully
28151       // supported by the pretty-printer.
28152
28153       case "DeclaredPredicate":
28154         return concat$d(["%checks(", path.call(print, "value"), ")"]);
28155
28156       case "TSAbstractKeyword":
28157         return "abstract";
28158
28159       case "TSAnyKeyword":
28160         return "any";
28161
28162       case "TSAsyncKeyword":
28163         return "async";
28164
28165       case "TSBooleanKeyword":
28166         return "boolean";
28167
28168       case "TSBigIntKeyword":
28169         return "bigint";
28170
28171       case "TSConstKeyword":
28172         return "const";
28173
28174       case "TSDeclareKeyword":
28175         return "declare";
28176
28177       case "TSExportKeyword":
28178         return "export";
28179
28180       case "TSNeverKeyword":
28181         return "never";
28182
28183       case "TSNumberKeyword":
28184         return "number";
28185
28186       case "TSObjectKeyword":
28187         return "object";
28188
28189       case "TSProtectedKeyword":
28190         return "protected";
28191
28192       case "TSPrivateKeyword":
28193         return "private";
28194
28195       case "TSPublicKeyword":
28196         return "public";
28197
28198       case "TSReadonlyKeyword":
28199         return "readonly";
28200
28201       case "TSSymbolKeyword":
28202         return "symbol";
28203
28204       case "TSStaticKeyword":
28205         return "static";
28206
28207       case "TSStringKeyword":
28208         return "string";
28209
28210       case "TSUndefinedKeyword":
28211         return "undefined";
28212
28213       case "TSUnknownKeyword":
28214         return "unknown";
28215
28216       case "TSVoidKeyword":
28217         return "void";
28218
28219       case "TSAsExpression":
28220         return concat$d([path.call(print, "expression"), " as ", path.call(print, "typeAnnotation")]);
28221
28222       case "TSArrayType":
28223         return concat$d([path.call(print, "elementType"), "[]"]);
28224
28225       case "TSPropertySignature":
28226         {
28227           if (n.export) {
28228             parts.push("export ");
28229           }
28230
28231           if (n.accessibility) {
28232             parts.push(n.accessibility + " ");
28233           }
28234
28235           if (n.static) {
28236             parts.push("static ");
28237           }
28238
28239           if (n.readonly) {
28240             parts.push("readonly ");
28241           }
28242
28243           parts.push(printPropertyKey(path, options, print), printOptionalToken(path));
28244
28245           if (n.typeAnnotation) {
28246             parts.push(": ");
28247             parts.push(path.call(print, "typeAnnotation"));
28248           } // This isn't valid semantically, but it's in the AST so we can print it.
28249
28250
28251           if (n.initializer) {
28252             parts.push(" = ", path.call(print, "initializer"));
28253           }
28254
28255           return concat$d(parts);
28256         }
28257
28258       case "TSParameterProperty":
28259         if (n.accessibility) {
28260           parts.push(n.accessibility + " ");
28261         }
28262
28263         if (n.export) {
28264           parts.push("export ");
28265         }
28266
28267         if (n.static) {
28268           parts.push("static ");
28269         }
28270
28271         if (n.readonly) {
28272           parts.push("readonly ");
28273         }
28274
28275         parts.push(path.call(print, "parameter"));
28276         return concat$d(parts);
28277
28278       case "TSTypeReference":
28279         return concat$d([path.call(print, "typeName"), printTypeParameters(path, options, print, "typeParameters")]);
28280
28281       case "TSTypeQuery":
28282         return concat$d(["typeof ", path.call(print, "exprName")]);
28283
28284       case "TSIndexSignature":
28285         {
28286           const parent = path.getParentNode(); // The typescript parser accepts multiple parameters here. If you're
28287           // using them, it makes sense to have a trailing comma. But if you
28288           // aren't, this is more like a computed property name than an array.
28289           // So we leave off the trailing comma when there's just one parameter.
28290
28291           const trailingComma = n.parameters.length > 1 ? ifBreak$6(shouldPrintComma$1(options) ? "," : "") : "";
28292           const parametersGroup = group$b(concat$d([indent$7(concat$d([softline$6, join$9(concat$d([", ", softline$6]), path.map(print, "parameters"))])), trailingComma, softline$6]));
28293           return concat$d([n.export ? "export " : "", n.accessibility ? concat$d([n.accessibility, " "]) : "", n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? parametersGroup : "", n.typeAnnotation ? "]: " : "]", n.typeAnnotation ? path.call(print, "typeAnnotation") : "", parent.type === "ClassBody" ? semi : ""]);
28294         }
28295
28296       case "TSTypePredicate":
28297         return concat$d([n.asserts ? "asserts " : "", path.call(print, "parameterName"), n.typeAnnotation ? concat$d([" is ", path.call(print, "typeAnnotation")]) : ""]);
28298
28299       case "TSNonNullExpression":
28300         return concat$d([path.call(print, "expression"), "!"]);
28301
28302       case "TSThisType":
28303         return "this";
28304
28305       case "TSImportType":
28306         return concat$d([!n.isTypeOf ? "" : "typeof ", "import(", path.call(print, n.parameter ? "parameter" : "argument"), ")", !n.qualifier ? "" : concat$d([".", path.call(print, "qualifier")]), printTypeParameters(path, options, print, "typeParameters")]);
28307
28308       case "TSLiteralType":
28309         return path.call(print, "literal");
28310
28311       case "TSIndexedAccessType":
28312         return concat$d([path.call(print, "objectType"), "[", path.call(print, "indexType"), "]"]);
28313
28314       case "TSConstructSignatureDeclaration":
28315       case "TSCallSignatureDeclaration":
28316       case "TSConstructorType":
28317         {
28318           if (n.type !== "TSCallSignatureDeclaration") {
28319             parts.push("new ");
28320           }
28321
28322           parts.push(group$b(printFunctionParams(path, print, options,
28323           /* expandArg */
28324           false,
28325           /* printTypeParams */
28326           true)));
28327
28328           if (n.returnType || n.typeAnnotation) {
28329             const isType = n.type === "TSConstructorType";
28330             parts.push(isType ? " => " : ": ", path.call(print, "returnType"), path.call(print, "typeAnnotation"));
28331           }
28332
28333           return concat$d(parts);
28334         }
28335
28336       case "TSTypeOperator":
28337         return concat$d([n.operator, " ", path.call(print, "typeAnnotation")]);
28338
28339       case "TSMappedType":
28340         {
28341           const shouldBreak = hasNewlineInRange$3(options.originalText, options.locStart(n), options.locEnd(n));
28342           return group$b(concat$d(["{", indent$7(concat$d([options.bracketSpacing ? line$9 : softline$6, n.readonly ? concat$d([getTypeScriptMappedTypeModifier$1(n.readonly, "readonly"), " "]) : "", printTypeScriptModifiers(path, options, print), path.call(print, "typeParameter"), n.optional ? getTypeScriptMappedTypeModifier$1(n.optional, "?") : "", n.typeAnnotation ? ": " : "", path.call(print, "typeAnnotation"), ifBreak$6(semi, "")])), comments.printDanglingComments(path, options,
28343           /* sameIndent */
28344           true), options.bracketSpacing ? line$9 : softline$6, "}"]), {
28345             shouldBreak
28346           });
28347         }
28348
28349       case "TSMethodSignature":
28350         parts.push(n.accessibility ? concat$d([n.accessibility, " "]) : "", n.export ? "export " : "", n.static ? "static " : "", n.readonly ? "readonly " : "", n.computed ? "[" : "", path.call(print, "key"), n.computed ? "]" : "", printOptionalToken(path), printFunctionParams(path, print, options,
28351         /* expandArg */
28352         false,
28353         /* printTypeParams */
28354         true));
28355
28356         if (n.returnType || n.typeAnnotation) {
28357           parts.push(": ", path.call(print, "returnType"), path.call(print, "typeAnnotation"));
28358         }
28359
28360         return group$b(concat$d(parts));
28361
28362       case "TSNamespaceExportDeclaration":
28363         parts.push("export as namespace ", path.call(print, "id"));
28364
28365         if (options.semi) {
28366           parts.push(";");
28367         }
28368
28369         return group$b(concat$d(parts));
28370
28371       case "TSEnumDeclaration":
28372         if (n.declare) {
28373           parts.push("declare ");
28374         }
28375
28376         if (n.modifiers) {
28377           parts.push(printTypeScriptModifiers(path, options, print));
28378         }
28379
28380         if (n.const) {
28381           parts.push("const ");
28382         }
28383
28384         parts.push("enum ", path.call(print, "id"), " ");
28385
28386         if (n.members.length === 0) {
28387           parts.push(group$b(concat$d(["{", comments.printDanglingComments(path, options), softline$6, "}"])));
28388         } else {
28389           parts.push(group$b(concat$d(["{", indent$7(concat$d([hardline$9, printArrayItems(path, options, "members", print), shouldPrintComma$1(options, "es5") ? "," : ""])), comments.printDanglingComments(path, options,
28390           /* sameIndent */
28391           true), hardline$9, "}"])));
28392         }
28393
28394         return concat$d(parts);
28395
28396       case "TSEnumMember":
28397         parts.push(path.call(print, "id"));
28398
28399         if (n.initializer) {
28400           parts.push(" = ", path.call(print, "initializer"));
28401         }
28402
28403         return concat$d(parts);
28404
28405       case "TSImportEqualsDeclaration":
28406         if (n.isExport) {
28407           parts.push("export ");
28408         }
28409
28410         parts.push("import ", path.call(print, "id"), " = ", path.call(print, "moduleReference"));
28411
28412         if (options.semi) {
28413           parts.push(";");
28414         }
28415
28416         return group$b(concat$d(parts));
28417
28418       case "TSExternalModuleReference":
28419         return concat$d(["require(", path.call(print, "expression"), ")"]);
28420
28421       case "TSModuleDeclaration":
28422         {
28423           const parent = path.getParentNode();
28424           const isExternalModule = isLiteral$1(n.id);
28425           const parentIsDeclaration = parent.type === "TSModuleDeclaration";
28426           const bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration";
28427
28428           if (parentIsDeclaration) {
28429             parts.push(".");
28430           } else {
28431             if (n.declare) {
28432               parts.push("declare ");
28433             }
28434
28435             parts.push(printTypeScriptModifiers(path, options, print));
28436             const textBetweenNodeAndItsId = options.originalText.slice(options.locStart(n), options.locStart(n.id)); // Global declaration looks like this:
28437             // (declare)? global { ... }
28438
28439             const isGlobalDeclaration = n.id.type === "Identifier" && n.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
28440
28441             if (!isGlobalDeclaration) {
28442               parts.push(isExternalModule || /(^|\s)module(\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
28443             }
28444           }
28445
28446           parts.push(path.call(print, "id"));
28447
28448           if (bodyIsDeclaration) {
28449             parts.push(path.call(print, "body"));
28450           } else if (n.body) {
28451             parts.push(" ", group$b(path.call(print, "body")));
28452           } else {
28453             parts.push(semi);
28454           }
28455
28456           return concat$d(parts);
28457         }
28458
28459       case "PrivateName":
28460         return concat$d(["#", path.call(print, "id")]);
28461       // TODO: Temporary auto-generated node type. To remove when typescript-estree has proper support for private fields.
28462
28463       case "TSPrivateIdentifier":
28464         return n.escapedText;
28465
28466       case "TSConditionalType":
28467         return printTernaryOperator(path, options, print, {
28468           beforeParts: () => [path.call(print, "checkType"), " ", "extends", " ", path.call(print, "extendsType")],
28469           afterParts: () => [],
28470           shouldCheckJsx: false,
28471           conditionalNodeType: "TSConditionalType",
28472           consequentNodePropertyName: "trueType",
28473           alternateNodePropertyName: "falseType",
28474           testNodePropertyNames: ["checkType", "extendsType"]
28475         });
28476
28477       case "TSInferType":
28478         return concat$d(["infer", " ", path.call(print, "typeParameter")]);
28479
28480       case "InterpreterDirective":
28481         parts.push("#!", n.value, hardline$9);
28482
28483         if (isNextLineEmpty$4(options.originalText, n, options.locEnd)) {
28484           parts.push(hardline$9);
28485         }
28486
28487         return concat$d(parts);
28488
28489       case "NGRoot":
28490         return concat$d([].concat(path.call(print, "node"), !n.node.comments || n.node.comments.length === 0 ? [] : concat$d([" //", n.node.comments[0].value.trimEnd()])));
28491
28492       case "NGChainedExpression":
28493         return group$b(join$9(concat$d([";", line$9]), path.map(childPath => hasNgSideEffect$1(childPath) ? print(childPath) : concat$d(["(", print(childPath), ")"]), "expressions")));
28494
28495       case "NGEmptyExpression":
28496         return "";
28497
28498       case "NGQuotedExpression":
28499         return concat$d([n.prefix, ": ", n.value.trim()]);
28500
28501       case "NGMicrosyntax":
28502         return concat$d(path.map((childPath, index) => concat$d([index === 0 ? "" : isNgForOf$1(childPath.getValue(), index, n) ? " " : concat$d([";", line$9]), print(childPath)]), "body"));
28503
28504       case "NGMicrosyntaxKey":
28505         return /^[a-z_$][a-z0-9_$]*(-[a-z_$][a-z0-9_$])*$/i.test(n.name) ? n.name : JSON.stringify(n.name);
28506
28507       case "NGMicrosyntaxExpression":
28508         return concat$d([path.call(print, "expression"), n.alias === null ? "" : concat$d([" as ", path.call(print, "alias")])]);
28509
28510       case "NGMicrosyntaxKeyedExpression":
28511         {
28512           const index = path.getName();
28513           const parentNode = path.getParentNode();
28514           const shouldNotPrintColon = isNgForOf$1(n, index, parentNode) || (index === 1 && (n.key.name === "then" || n.key.name === "else") || index === 2 && n.key.name === "else" && parentNode.body[index - 1].type === "NGMicrosyntaxKeyedExpression" && parentNode.body[index - 1].key.name === "then") && parentNode.body[0].type === "NGMicrosyntaxExpression";
28515           return concat$d([path.call(print, "key"), shouldNotPrintColon ? " " : ": ", path.call(print, "expression")]);
28516         }
28517
28518       case "NGMicrosyntaxLet":
28519         return concat$d(["let ", path.call(print, "key"), n.value === null ? "" : concat$d([" = ", path.call(print, "value")])]);
28520
28521       case "NGMicrosyntaxAs":
28522         return concat$d([path.call(print, "key"), " as ", path.call(print, "alias")]);
28523
28524       case "ArgumentPlaceholder":
28525         return "?";
28526       // These are not valid TypeScript. Printing them just for the sake of error recovery.
28527
28528       case "TSJSDocAllType":
28529         return "*";
28530
28531       case "TSJSDocUnknownType":
28532         return "?";
28533
28534       case "TSJSDocNullableType":
28535         return concat$d(["?", path.call(print, "typeAnnotation")]);
28536
28537       case "TSJSDocNonNullableType":
28538         return concat$d(["!", path.call(print, "typeAnnotation")]);
28539
28540       case "TSJSDocFunctionType":
28541         return concat$d(["function(", // The parameters could be here, but typescript-estree doesn't convert them anyway (throws an error).
28542         "): ", path.call(print, "typeAnnotation")]);
28543
28544       default:
28545         /* istanbul ignore next */
28546         throw new Error("unknown type: " + JSON.stringify(n.type));
28547     }
28548   }
28549
28550   function printStatementSequence(path, options, print) {
28551     const printed = [];
28552     const bodyNode = path.getNode();
28553     const isClass = bodyNode.type === "ClassBody";
28554     path.map((stmtPath, i) => {
28555       const stmt = stmtPath.getValue(); // Just in case the AST has been modified to contain falsy
28556       // "statements," it's safer simply to skip them.
28557
28558       /* istanbul ignore if */
28559
28560       if (!stmt) {
28561         return;
28562       } // Skip printing EmptyStatement nodes to avoid leaving stray
28563       // semicolons lying around.
28564
28565
28566       if (stmt.type === "EmptyStatement") {
28567         return;
28568       }
28569
28570       const stmtPrinted = print(stmtPath);
28571       const text = options.originalText;
28572       const parts = []; // in no-semi mode, prepend statement with semicolon if it might break ASI
28573       // don't prepend the only JSX element in a program with semicolon
28574
28575       if (!options.semi && !isClass && !isTheOnlyJSXElementInMarkdown$1(options, stmtPath) && stmtNeedsASIProtection(stmtPath, options)) {
28576         if (stmt.comments && stmt.comments.some(comment => comment.leading)) {
28577           parts.push(print(stmtPath, {
28578             needsSemi: true
28579           }));
28580         } else {
28581           parts.push(";", stmtPrinted);
28582         }
28583       } else {
28584         parts.push(stmtPrinted);
28585       }
28586
28587       if (!options.semi && isClass) {
28588         if (classPropMayCauseASIProblems$1(stmtPath)) {
28589           parts.push(";");
28590         } else if (stmt.type === "ClassProperty") {
28591           const nextChild = bodyNode.body[i + 1];
28592
28593           if (classChildNeedsASIProtection$1(nextChild)) {
28594             parts.push(";");
28595           }
28596         }
28597       }
28598
28599       if (isNextLineEmpty$4(text, stmt, options.locEnd) && !isLastStatement$1(stmtPath)) {
28600         parts.push(hardline$9);
28601       }
28602
28603       printed.push(concat$d(parts));
28604     });
28605     return join$9(hardline$9, printed);
28606   }
28607
28608   function printPropertyKey(path, options, print) {
28609     const node = path.getNode();
28610
28611     if (node.computed) {
28612       return concat$d(["[", path.call(print, "key"), "]"]);
28613     }
28614
28615     const parent = path.getParentNode();
28616     const {
28617       key
28618     } = node;
28619
28620     if (node.type === "ClassPrivateProperty" && // flow has `Identifier` key, and babel has `PrivateName` key
28621     key.type === "Identifier") {
28622       return concat$d(["#", path.call(print, "key")]);
28623     }
28624
28625     if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
28626       const objectHasStringProp = (parent.properties || parent.body || parent.members).some(prop => !prop.computed && prop.key && isStringLiteral$1(prop.key) && !isStringPropSafeToCoerceToIdentifier$1(prop, options));
28627       needsQuoteProps.set(parent, objectHasStringProp);
28628     }
28629
28630     if (key.type === "Identifier" && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) {
28631       // a -> "a"
28632       const prop = printString$2(JSON.stringify(key.name), options);
28633       return path.call(keyPath => comments.printComments(keyPath, () => prop, options), "key");
28634     }
28635
28636     if (isStringPropSafeToCoerceToIdentifier$1(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
28637       // 'a' -> a
28638       return path.call(keyPath => comments.printComments(keyPath, () => key.value, options), "key");
28639     }
28640
28641     return path.call(print, "key");
28642   }
28643
28644   function printMethod(path, options, print) {
28645     const node = path.getNode();
28646     const {
28647       kind
28648     } = node;
28649     const value = node.value || node;
28650     const parts = [];
28651
28652     if (!kind || kind === "init" || kind === "method" || kind === "constructor") {
28653       if (value.async) {
28654         parts.push("async ");
28655       }
28656
28657       if (value.generator) {
28658         parts.push("*");
28659       }
28660     } else {
28661       assert.ok(kind === "get" || kind === "set");
28662       parts.push(kind, " ");
28663     }
28664
28665     parts.push(printPropertyKey(path, options, print), node.optional || node.key.optional ? "?" : "", node === value ? printMethodInternal(path, options, print) : path.call(path => printMethodInternal(path, options, print), "value"));
28666     return concat$d(parts);
28667   }
28668
28669   function printMethodInternal(path, options, print) {
28670     const parts = [printFunctionTypeParameters(path, options, print), group$b(concat$d([printFunctionParams(path, print, options), printReturnType(path, print, options)]))];
28671
28672     if (path.getNode().body) {
28673       parts.push(" ", path.call(print, "body"));
28674     } else {
28675       parts.push(options.semi ? ";" : "");
28676     }
28677
28678     return concat$d(parts);
28679   }
28680
28681   function couldGroupArg(arg) {
28682     return arg.type === "ObjectExpression" && (arg.properties.length > 0 || arg.comments) || arg.type === "ArrayExpression" && (arg.elements.length > 0 || arg.comments) || arg.type === "TSTypeAssertion" && couldGroupArg(arg.expression) || arg.type === "TSAsExpression" && couldGroupArg(arg.expression) || arg.type === "FunctionExpression" || arg.type === "ArrowFunctionExpression" && ( // we want to avoid breaking inside composite return types but not simple keywords
28683     // https://github.com/prettier/prettier/issues/4070
28684     // export class Thing implements OtherThing {
28685     //   do: (type: Type) => Provider<Prop> = memoize(
28686     //     (type: ObjectType): Provider<Opts> => {}
28687     //   );
28688     // }
28689     // https://github.com/prettier/prettier/issues/6099
28690     // app.get("/", (req, res): void => {
28691     //   res.send("Hello World!");
28692     // });
28693     !arg.returnType || !arg.returnType.typeAnnotation || arg.returnType.typeAnnotation.type !== "TSTypeReference") && (arg.body.type === "BlockStatement" || arg.body.type === "ArrowFunctionExpression" || arg.body.type === "ObjectExpression" || arg.body.type === "ArrayExpression" || arg.body.type === "CallExpression" || arg.body.type === "OptionalCallExpression" || arg.body.type === "ConditionalExpression" || isJSXNode$1(arg.body));
28694   }
28695
28696   function shouldGroupLastArg(args) {
28697     const lastArg = getLast$3(args);
28698     const penultimateArg = getPenultimate$1(args);
28699     return !hasLeadingComment$3(lastArg) && !hasTrailingComment$1(lastArg) && couldGroupArg(lastArg) && ( // If the last two arguments are of the same type,
28700     // disable last element expansion.
28701     !penultimateArg || penultimateArg.type !== lastArg.type);
28702   }
28703
28704   function shouldGroupFirstArg(args) {
28705     if (args.length !== 2) {
28706       return false;
28707     }
28708
28709     const [firstArg, secondArg] = args;
28710     return (!firstArg.comments || !firstArg.comments.length) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && secondArg.type !== "ConditionalExpression" && !couldGroupArg(secondArg);
28711   }
28712
28713   function printJestEachTemplateLiteral(node, expressions, options) {
28714     /**
28715      * a    | b    | expected
28716      * ${1} | ${1} | ${2}
28717      * ${1} | ${2} | ${3}
28718      * ${2} | ${1} | ${3}
28719      */
28720     const headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
28721
28722     if (headerNames.length > 1 || headerNames.some(headerName => headerName.length !== 0)) {
28723       const parts = [];
28724       const stringifiedExpressions = expressions.map(doc => "${" + printDocToString$2(doc, Object.assign({}, options, {
28725         printWidth: Infinity,
28726         endOfLine: "lf"
28727       })).formatted + "}");
28728       const tableBody = [{
28729         hasLineBreak: false,
28730         cells: []
28731       }];
28732
28733       for (let i = 1; i < node.quasis.length; i++) {
28734         const row = tableBody[tableBody.length - 1];
28735         const correspondingExpression = stringifiedExpressions[i - 1];
28736         row.cells.push(correspondingExpression);
28737
28738         if (correspondingExpression.includes("\n")) {
28739           row.hasLineBreak = true;
28740         }
28741
28742         if (node.quasis[i].value.raw.includes("\n")) {
28743           tableBody.push({
28744             hasLineBreak: false,
28745             cells: []
28746           });
28747         }
28748       }
28749
28750       const maxColumnCount = Math.max(headerNames.length, ...tableBody.map(row => row.cells.length));
28751       const maxColumnWidths = Array.from({
28752         length: maxColumnCount
28753       }).fill(0);
28754       const table = [{
28755         cells: headerNames
28756       }, ...tableBody.filter(row => row.cells.length !== 0)];
28757
28758       for (const {
28759         cells
28760       } of table.filter(row => !row.hasLineBreak)) {
28761         cells.forEach((cell, index) => {
28762           maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$3(cell));
28763         });
28764       }
28765
28766       parts.push(lineSuffixBoundary$1, "`", indent$7(concat$d([hardline$9, join$9(hardline$9, table.map(row => join$9(" | ", row.cells.map((cell, index) => row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$3(cell))))))])), hardline$9, "`");
28767       return concat$d(parts);
28768     }
28769   }
28770
28771   function printArgumentsList(path, options, print) {
28772     const node = path.getValue();
28773     const args = node.arguments;
28774
28775     if (args.length === 0) {
28776       return concat$d(["(", comments.printDanglingComments(path, options,
28777       /* sameIndent */
28778       true), ")"]);
28779     } // useEffect(() => { ... }, [foo, bar, baz])
28780
28781
28782     if (args.length === 2 && args[0].type === "ArrowFunctionExpression" && args[0].params.length === 0 && args[0].body.type === "BlockStatement" && args[1].type === "ArrayExpression" && !args.find(arg => arg.comments)) {
28783       return concat$d(["(", path.call(print, "arguments", 0), ", ", path.call(print, "arguments", 1), ")"]);
28784     } // func(
28785     //   ({
28786     //     a,
28787     //     b
28788     //   }) => {}
28789     // );
28790
28791
28792     function shouldBreakForArrowFunctionInArguments(arg, argPath) {
28793       if (!arg || arg.type !== "ArrowFunctionExpression" || !arg.body || arg.body.type !== "BlockStatement" || !arg.params || arg.params.length < 1) {
28794         return false;
28795       }
28796
28797       let shouldBreak = false;
28798       argPath.each(paramPath => {
28799         const printed = concat$d([print(paramPath)]);
28800         shouldBreak = shouldBreak || willBreak$1(printed);
28801       }, "params");
28802       return shouldBreak;
28803     }
28804
28805     let anyArgEmptyLine = false;
28806     let shouldBreakForArrowFunction = false;
28807     let hasEmptyLineFollowingFirstArg = false;
28808     const lastArgIndex = args.length - 1;
28809     const printedArguments = path.map((argPath, index) => {
28810       const arg = argPath.getNode();
28811       const parts = [print(argPath)];
28812
28813       if (index === lastArgIndex) ; else if (isNextLineEmpty$4(options.originalText, arg, options.locEnd)) {
28814         if (index === 0) {
28815           hasEmptyLineFollowingFirstArg = true;
28816         }
28817
28818         anyArgEmptyLine = true;
28819         parts.push(",", hardline$9, hardline$9);
28820       } else {
28821         parts.push(",", line$9);
28822       }
28823
28824       shouldBreakForArrowFunction = shouldBreakForArrowFunctionInArguments(arg, argPath);
28825       return concat$d(parts);
28826     }, "arguments");
28827     const maybeTrailingComma = // Dynamic imports cannot have trailing commas
28828     !(node.callee && node.callee.type === "Import") && shouldPrintComma$1(options, "all") ? "," : "";
28829
28830     function allArgsBrokenOut() {
28831       return group$b(concat$d(["(", indent$7(concat$d([line$9, concat$d(printedArguments)])), maybeTrailingComma, line$9, ")"]), {
28832         shouldBreak: true
28833       });
28834     }
28835
28836     if (path.getParentNode().type !== "Decorator" && isFunctionCompositionArgs$1(args)) {
28837       return allArgsBrokenOut();
28838     }
28839
28840     const shouldGroupFirst = shouldGroupFirstArg(args);
28841     const shouldGroupLast = shouldGroupLastArg(args);
28842
28843     if (shouldGroupFirst || shouldGroupLast) {
28844       const shouldBreak = (shouldGroupFirst ? printedArguments.slice(1).some(willBreak$1) : printedArguments.slice(0, -1).some(willBreak$1)) || anyArgEmptyLine || shouldBreakForArrowFunction; // We want to print the last argument with a special flag
28845
28846       let printedExpanded;
28847       let i = 0;
28848       path.each(argPath => {
28849         if (shouldGroupFirst && i === 0) {
28850           printedExpanded = [concat$d([argPath.call(p => print(p, {
28851             expandFirstArg: true
28852           })), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline$9 : line$9, hasEmptyLineFollowingFirstArg ? hardline$9 : ""])].concat(printedArguments.slice(1));
28853         }
28854
28855         if (shouldGroupLast && i === args.length - 1) {
28856           printedExpanded = printedArguments.slice(0, -1).concat(argPath.call(p => print(p, {
28857             expandLastArg: true
28858           })));
28859         }
28860
28861         i++;
28862       }, "arguments");
28863       const somePrintedArgumentsWillBreak = printedArguments.some(willBreak$1);
28864       const simpleConcat = concat$d(["(", concat$d(printedExpanded), ")"]);
28865       return concat$d([somePrintedArgumentsWillBreak ? breakParent$3 : "", conditionalGroup$1([!somePrintedArgumentsWillBreak && !node.typeArguments && !node.typeParameters ? simpleConcat : ifBreak$6(allArgsBrokenOut(), simpleConcat), shouldGroupFirst ? concat$d(["(", group$b(printedExpanded[0], {
28866         shouldBreak: true
28867       }), concat$d(printedExpanded.slice(1)), ")"]) : concat$d(["(", concat$d(printedArguments.slice(0, -1)), group$b(getLast$3(printedExpanded), {
28868         shouldBreak: true
28869       }), ")"]), allArgsBrokenOut()], {
28870         shouldBreak
28871       })]);
28872     }
28873
28874     const contents = concat$d(["(", indent$7(concat$d([softline$6, concat$d(printedArguments)])), ifBreak$6(maybeTrailingComma), softline$6, ")"]);
28875
28876     if (isLongCurriedCallExpression$1(path)) {
28877       // By not wrapping the arguments in a group, the printer prioritizes
28878       // breaking up these arguments rather than the args of the parent call.
28879       return contents;
28880     }
28881
28882     return group$b(contents, {
28883       shouldBreak: printedArguments.some(willBreak$1) || anyArgEmptyLine
28884     });
28885   }
28886
28887   function printTypeAnnotation(path, options, print) {
28888     const node = path.getValue();
28889
28890     if (!node.typeAnnotation) {
28891       return "";
28892     }
28893
28894     const parentNode = path.getParentNode();
28895     const isDefinite = node.definite || parentNode && parentNode.type === "VariableDeclarator" && parentNode.definite;
28896     const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
28897
28898     if (isFlowAnnotationComment$1(options.originalText, node.typeAnnotation, options)) {
28899       return concat$d([" /*: ", path.call(print, "typeAnnotation"), " */"]);
28900     }
28901
28902     return concat$d([isFunctionDeclarationIdentifier ? "" : isDefinite ? "!: " : ": ", path.call(print, "typeAnnotation")]);
28903   }
28904
28905   function printFunctionTypeParameters(path, options, print) {
28906     const fun = path.getValue();
28907
28908     if (fun.typeArguments) {
28909       return path.call(print, "typeArguments");
28910     }
28911
28912     if (fun.typeParameters) {
28913       return path.call(print, "typeParameters");
28914     }
28915
28916     return "";
28917   }
28918
28919   function printFunctionParams(path, print, options, expandArg, printTypeParams) {
28920     const fun = path.getValue();
28921     const parent = path.getParentNode();
28922     const paramsField = fun.parameters ? "parameters" : "params";
28923     const isParametersInTestCall = isTestCall$1(parent);
28924     const shouldHugParameters = shouldHugArguments(fun);
28925     const shouldExpandParameters = expandArg && !(fun[paramsField] && fun[paramsField].some(n => n.comments));
28926     const typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : "";
28927     let printed = [];
28928
28929     if (fun[paramsField]) {
28930       const lastArgIndex = fun[paramsField].length - 1;
28931       printed = path.map((childPath, index) => {
28932         const parts = [];
28933         const param = childPath.getValue();
28934         parts.push(print(childPath));
28935
28936         if (index === lastArgIndex) {
28937           if (fun.rest) {
28938             parts.push(",", line$9);
28939           }
28940         } else if (isParametersInTestCall || shouldHugParameters || shouldExpandParameters) {
28941           parts.push(", ");
28942         } else if (isNextLineEmpty$4(options.originalText, param, options.locEnd)) {
28943           parts.push(",", hardline$9, hardline$9);
28944         } else {
28945           parts.push(",", line$9);
28946         }
28947
28948         return concat$d(parts);
28949       }, paramsField);
28950     }
28951
28952     if (fun.rest) {
28953       printed.push(concat$d(["...", path.call(print, "rest")]));
28954     }
28955
28956     if (printed.length === 0) {
28957       return concat$d([typeParams, "(", comments.printDanglingComments(path, options,
28958       /* sameIndent */
28959       true, comment => getNextNonSpaceNonCommentCharacter$1(options.originalText, comment, options.locEnd) === ")"), ")"]);
28960     }
28961
28962     const lastParam = getLast$3(fun[paramsField]); // If the parent is a call with the first/last argument expansion and this is the
28963     // params of the first/last argument, we don't want the arguments to break and instead
28964     // want the whole expression to be on a new line.
28965     //
28966     // Good:                 Bad:
28967     //   verylongcall(         verylongcall((
28968     //     (a, b) => {           a,
28969     //     }                     b,
28970     //   })                    ) => {
28971     //                         })
28972
28973     if (shouldExpandParameters) {
28974       return group$b(concat$d([removeLines$2(typeParams), "(", concat$d(printed.map(removeLines$2)), ")"]));
28975     } // Single object destructuring should hug
28976     //
28977     // function({
28978     //   a,
28979     //   b,
28980     //   c
28981     // }) {}
28982
28983
28984     const hasNotParameterDecorator = fun[paramsField].every(param => !param.decorators);
28985
28986     if (shouldHugParameters && hasNotParameterDecorator) {
28987       return concat$d([typeParams, "(", concat$d(printed), ")"]);
28988     } // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
28989
28990
28991     if (isParametersInTestCall) {
28992       return concat$d([typeParams, "(", concat$d(printed), ")"]);
28993     }
28994
28995     const isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction$1(parent, options) || isTypeAnnotationAFunction$1(parent, options) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === fun) && fun[paramsField].length === 1 && fun[paramsField][0].name === null && fun[paramsField][0].typeAnnotation && fun.typeParameters === null && isSimpleFlowType$1(fun[paramsField][0].typeAnnotation) && !fun.rest;
28996
28997     if (isFlowShorthandWithOneArg) {
28998       if (options.arrowParens === "always") {
28999         return concat$d(["(", concat$d(printed), ")"]);
29000       }
29001
29002       return concat$d(printed);
29003     }
29004
29005     const canHaveTrailingComma = !(lastParam && lastParam.type === "RestElement") && !fun.rest;
29006     return concat$d([typeParams, "(", indent$7(concat$d([softline$6, concat$d(printed)])), ifBreak$6(canHaveTrailingComma && shouldPrintComma$1(options, "all") ? "," : ""), softline$6, ")"]);
29007   }
29008
29009   function shouldPrintParamsWithoutParens(path, options) {
29010     if (options.arrowParens === "always") {
29011       return false;
29012     }
29013
29014     if (options.arrowParens === "avoid") {
29015       const node = path.getValue();
29016       return canPrintParamsWithoutParens(node);
29017     } // Fallback default; should be unreachable
29018
29019
29020     return false;
29021   }
29022
29023   function canPrintParamsWithoutParens(node) {
29024     return node.params.length === 1 && !node.rest && !node.typeParameters && !hasDanglingComments$1(node) && node.params[0].type === "Identifier" && !node.params[0].typeAnnotation && !node.params[0].comments && !node.params[0].optional && !node.predicate && !node.returnType;
29025   }
29026
29027   function printFunctionDeclaration(path, print, options) {
29028     const n = path.getValue();
29029     const parts = [];
29030
29031     if (n.async) {
29032       parts.push("async ");
29033     }
29034
29035     if (n.generator) {
29036       parts.push("function* ");
29037     } else {
29038       parts.push("function ");
29039     }
29040
29041     if (n.id) {
29042       parts.push(path.call(print, "id"));
29043     }
29044
29045     parts.push(printFunctionTypeParameters(path, options, print), group$b(concat$d([printFunctionParams(path, print, options), printReturnType(path, print, options)])), n.body ? " " : "", path.call(print, "body"));
29046     return concat$d(parts);
29047   }
29048
29049   function printReturnType(path, print, options) {
29050     const n = path.getValue();
29051     const returnType = path.call(print, "returnType");
29052
29053     if (n.returnType && isFlowAnnotationComment$1(options.originalText, n.returnType, options)) {
29054       return concat$d([" /*: ", returnType, " */"]);
29055     }
29056
29057     const parts = [returnType]; // prepend colon to TypeScript type annotation
29058
29059     if (n.returnType && n.returnType.typeAnnotation) {
29060       parts.unshift(": ");
29061     }
29062
29063     if (n.predicate) {
29064       // The return type will already add the colon, but otherwise we
29065       // need to do it ourselves
29066       parts.push(n.returnType ? " " : ": ", path.call(print, "predicate"));
29067     }
29068
29069     return concat$d(parts);
29070   }
29071
29072   function printExportDeclaration(path, options, print) {
29073     const decl = path.getValue();
29074     const semi = options.semi ? ";" : "";
29075     const parts = ["export "];
29076     const isDefault = decl.default || decl.type === "ExportDefaultDeclaration";
29077
29078     if (isDefault) {
29079       parts.push("default ");
29080     }
29081
29082     parts.push(comments.printDanglingComments(path, options,
29083     /* sameIndent */
29084     true));
29085
29086     if (needsHardlineAfterDanglingComment$1(decl)) {
29087       parts.push(hardline$9);
29088     }
29089
29090     if (decl.declaration) {
29091       parts.push(path.call(print, "declaration"));
29092
29093       if (isDefault && decl.declaration.type !== "ClassDeclaration" && decl.declaration.type !== "FunctionDeclaration" && decl.declaration.type !== "TSInterfaceDeclaration" && decl.declaration.type !== "DeclareClass" && decl.declaration.type !== "DeclareFunction" && decl.declaration.type !== "TSDeclareFunction") {
29094         parts.push(semi);
29095       }
29096     } else {
29097       if (decl.specifiers && decl.specifiers.length > 0) {
29098         const specifiers = [];
29099         const defaultSpecifiers = [];
29100         const namespaceSpecifiers = [];
29101         path.each(specifierPath => {
29102           const specifierType = path.getValue().type;
29103
29104           if (specifierType === "ExportSpecifier") {
29105             specifiers.push(print(specifierPath));
29106           } else if (specifierType === "ExportDefaultSpecifier") {
29107             defaultSpecifiers.push(print(specifierPath));
29108           } else if (specifierType === "ExportNamespaceSpecifier") {
29109             namespaceSpecifiers.push(concat$d(["* as ", print(specifierPath)]));
29110           }
29111         }, "specifiers");
29112         const isNamespaceFollowed = namespaceSpecifiers.length !== 0 && specifiers.length !== 0;
29113         const isDefaultFollowed = defaultSpecifiers.length !== 0 && (namespaceSpecifiers.length !== 0 || specifiers.length !== 0);
29114         const canBreak = specifiers.length > 1 || defaultSpecifiers.length > 0 || decl.specifiers && decl.specifiers.some(node => node.comments);
29115         let printed = "";
29116
29117         if (specifiers.length !== 0) {
29118           if (canBreak) {
29119             printed = group$b(concat$d(["{", indent$7(concat$d([options.bracketSpacing ? line$9 : softline$6, join$9(concat$d([",", line$9]), specifiers)])), ifBreak$6(shouldPrintComma$1(options) ? "," : ""), options.bracketSpacing ? line$9 : softline$6, "}"]));
29120           } else {
29121             printed = concat$d(["{", options.bracketSpacing ? " " : "", concat$d(specifiers), options.bracketSpacing ? " " : "", "}"]);
29122           }
29123         }
29124
29125         parts.push(decl.exportKind === "type" ? "type " : "", concat$d(defaultSpecifiers), concat$d([isDefaultFollowed ? ", " : ""]), concat$d(namespaceSpecifiers), concat$d([isNamespaceFollowed ? ", " : ""]), printed);
29126       } else {
29127         parts.push("{}");
29128       }
29129
29130       if (decl.source) {
29131         parts.push(" from ", path.call(print, "source"));
29132       }
29133
29134       parts.push(semi);
29135     }
29136
29137     return concat$d(parts);
29138   }
29139
29140   function printFlowDeclaration(path, parts) {
29141     const parentExportDecl = getParentExportDeclaration$1(path);
29142
29143     if (parentExportDecl) {
29144       assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
29145     } else {
29146       // If the parent node has type DeclareExportDeclaration, then it
29147       // will be responsible for printing the "declare" token. Otherwise
29148       // it needs to be printed with this non-exported declaration node.
29149       parts.unshift("declare ");
29150     }
29151
29152     return concat$d(parts);
29153   }
29154
29155   function printTypeScriptModifiers(path, options, print) {
29156     const n = path.getValue();
29157
29158     if (!n.modifiers || !n.modifiers.length) {
29159       return "";
29160     }
29161
29162     return concat$d([join$9(" ", path.map(print, "modifiers")), " "]);
29163   }
29164
29165   function printTypeParameters(path, options, print, paramsKey) {
29166     const n = path.getValue();
29167
29168     if (!n[paramsKey]) {
29169       return "";
29170     } // for TypeParameterDeclaration typeParameters is a single node
29171
29172
29173     if (!Array.isArray(n[paramsKey])) {
29174       return path.call(print, paramsKey);
29175     }
29176
29177     const grandparent = path.getNode(2);
29178     const greatGrandParent = path.getNode(3);
29179     const greatGreatGrandParent = path.getNode(4);
29180     const isParameterInTestCall = grandparent != null && isTestCall$1(grandparent);
29181     const shouldInline = isParameterInTestCall || n[paramsKey].length === 0 || n[paramsKey].length === 1 && (shouldHugType(n[paramsKey][0]) || n[paramsKey][0].type === "GenericTypeAnnotation" && shouldHugType(n[paramsKey][0].id) || n[paramsKey][0].type === "TSTypeReference" && shouldHugType(n[paramsKey][0].typeName) || n[paramsKey][0].type === "NullableTypeAnnotation" || // See https://github.com/prettier/prettier/pull/6467 for the context.
29182     greatGreatGrandParent && greatGreatGrandParent.type === "VariableDeclarator" && grandparent.type === "TSTypeAnnotation" && greatGrandParent.type !== "ArrowFunctionExpression" && n[paramsKey][0].type !== "TSUnionType" && n[paramsKey][0].type !== "UnionTypeAnnotation" && n[paramsKey][0].type !== "TSIntersectionType" && n[paramsKey][0].type !== "IntersectionTypeAnnotation" && n[paramsKey][0].type !== "TSConditionalType" && n[paramsKey][0].type !== "TSMappedType" && n[paramsKey][0].type !== "TSTypeOperator" && n[paramsKey][0].type !== "TSIndexedAccessType" && n[paramsKey][0].type !== "TSArrayType");
29183
29184     function printDanglingCommentsForInline(n) {
29185       if (!hasDanglingComments$1(n)) {
29186         return "";
29187       }
29188
29189       const hasOnlyBlockComments = n.comments.every(comments$1.isBlockComment);
29190       const printed = comments.printDanglingComments(path, options,
29191       /* sameIndent */
29192       hasOnlyBlockComments);
29193
29194       if (hasOnlyBlockComments) {
29195         return printed;
29196       }
29197
29198       return concat$d([printed, hardline$9]);
29199     }
29200
29201     if (shouldInline) {
29202       return concat$d(["<", join$9(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(n), ">"]);
29203     }
29204
29205     return group$b(concat$d(["<", indent$7(concat$d([softline$6, join$9(concat$d([",", line$9]), path.map(print, paramsKey))])), ifBreak$6(options.parser !== "typescript" && options.parser !== "babel-ts" && shouldPrintComma$1(options, "all") ? "," : ""), softline$6, ">"]));
29206   }
29207
29208   function printClass(path, options, print) {
29209     const n = path.getValue();
29210     const parts = [];
29211
29212     if (n.abstract) {
29213       parts.push("abstract ");
29214     }
29215
29216     parts.push("class");
29217
29218     if (n.id) {
29219       parts.push(" ", path.call(print, "id"));
29220     }
29221
29222     parts.push(path.call(print, "typeParameters"));
29223     const partsGroup = [];
29224
29225     if (n.superClass) {
29226       const printed = concat$d(["extends ", path.call(print, "superClass"), path.call(print, "superTypeParameters")]); // Keep old behaviour of extends in same line
29227       // If there is only on extends and there are not comments
29228
29229       if ((!n.implements || n.implements.length === 0) && (!n.superClass.comments || n.superClass.comments.length === 0)) {
29230         parts.push(concat$d([" ", path.call(superClass => comments.printComments(superClass, () => printed, options), "superClass")]));
29231       } else {
29232         partsGroup.push(group$b(concat$d([line$9, path.call(superClass => comments.printComments(superClass, () => printed, options), "superClass")])));
29233       }
29234     } else if (n.extends && n.extends.length > 0) {
29235       parts.push(" extends ", join$9(", ", path.map(print, "extends")));
29236     }
29237
29238     if (n.mixins && n.mixins.length > 0) {
29239       partsGroup.push(line$9, "mixins ", group$b(indent$7(join$9(concat$d([",", line$9]), path.map(print, "mixins")))));
29240     }
29241
29242     if (n.implements && n.implements.length > 0) {
29243       partsGroup.push(line$9, "implements", group$b(indent$7(concat$d([line$9, join$9(concat$d([",", line$9]), path.map(print, "implements"))]))));
29244     }
29245
29246     if (partsGroup.length > 0) {
29247       parts.push(group$b(indent$7(concat$d(partsGroup))));
29248     }
29249
29250     if (n.body && n.body.comments && hasLeadingOwnLineComment$1(options.originalText, n.body, options)) {
29251       parts.push(hardline$9);
29252     } else {
29253       parts.push(" ");
29254     }
29255
29256     parts.push(path.call(print, "body"));
29257     return parts;
29258   }
29259
29260   function printOptionalToken(path) {
29261     const node = path.getValue();
29262
29263     if (!node.optional || // It's an optional computed method parsed by typescript-estree.
29264     // "?" is printed in `printMethod`.
29265     node.type === "Identifier" && node === path.getParentNode().key) {
29266       return "";
29267     }
29268
29269     if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) {
29270       return "?.";
29271     }
29272
29273     return "?";
29274   }
29275
29276   function printMemberLookup(path, options, print) {
29277     const property = path.call(print, "property");
29278     const n = path.getValue();
29279     const optional = printOptionalToken(path);
29280
29281     if (!n.computed) {
29282       return concat$d([optional, ".", property]);
29283     }
29284
29285     if (!n.property || isNumericLiteral$1(n.property)) {
29286       return concat$d([optional, "[", property, "]"]);
29287     }
29288
29289     return group$b(concat$d([optional, "[", indent$7(concat$d([softline$6, property])), softline$6, "]"]));
29290   }
29291
29292   function printBindExpressionCallee(path, options, print) {
29293     return concat$d(["::", path.call(print, "callee")]);
29294   } // We detect calls on member expressions specially to format a
29295   // common pattern better. The pattern we are looking for is this:
29296   //
29297   // arr
29298   //   .map(x => x + 1)
29299   //   .filter(x => x > 10)
29300   //   .some(x => x % 2)
29301   //
29302   // The way it is structured in the AST is via a nested sequence of
29303   // MemberExpression and CallExpression. We need to traverse the AST
29304   // and make groups out of it to print it in the desired way.
29305
29306
29307   function printMemberChain(path, options, print) {
29308     // The first phase is to linearize the AST by traversing it down.
29309     //
29310     //   a().b()
29311     // has the following AST structure:
29312     //   CallExpression(MemberExpression(CallExpression(Identifier)))
29313     // and we transform it into
29314     //   [Identifier, CallExpression, MemberExpression, CallExpression]
29315     const printedNodes = []; // Here we try to retain one typed empty line after each call expression or
29316     // the first group whether it is in parentheses or not
29317
29318     function shouldInsertEmptyLineAfter(node) {
29319       const {
29320         originalText
29321       } = options;
29322       const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex$3(originalText, node, options.locEnd);
29323       const nextChar = originalText.charAt(nextCharIndex); // if it is cut off by a parenthesis, we only account for one typed empty
29324       // line after that parenthesis
29325
29326       if (nextChar === ")") {
29327         return isNextLineEmptyAfterIndex$2(originalText, nextCharIndex + 1, options.locEnd);
29328       }
29329
29330       return isNextLineEmpty$4(originalText, node, options.locEnd);
29331     }
29332
29333     function rec(path) {
29334       const node = path.getValue();
29335
29336       if ((node.type === "CallExpression" || node.type === "OptionalCallExpression") && (isMemberish$1(node.callee) || node.callee.type === "CallExpression" || node.callee.type === "OptionalCallExpression")) {
29337         printedNodes.unshift({
29338           node,
29339           printed: concat$d([comments.printComments(path, () => concat$d([printOptionalToken(path), printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)]), options), shouldInsertEmptyLineAfter(node) ? hardline$9 : ""])
29340         });
29341         path.call(callee => rec(callee), "callee");
29342       } else if (isMemberish$1(node)) {
29343         printedNodes.unshift({
29344           node,
29345           needsParens: needsParens_1(path, options),
29346           printed: comments.printComments(path, () => node.type === "OptionalMemberExpression" || node.type === "MemberExpression" ? printMemberLookup(path, options, print) : printBindExpressionCallee(path, options, print), options)
29347         });
29348         path.call(object => rec(object), "object");
29349       } else if (node.type === "TSNonNullExpression") {
29350         printedNodes.unshift({
29351           node,
29352           printed: comments.printComments(path, () => "!", options)
29353         });
29354         path.call(expression => rec(expression), "expression");
29355       } else {
29356         printedNodes.unshift({
29357           node,
29358           printed: path.call(print)
29359         });
29360       }
29361     } // Note: the comments of the root node have already been printed, so we
29362     // need to extract this first call without printing them as they would
29363     // if handled inside of the recursive call.
29364
29365
29366     const node = path.getValue();
29367     printedNodes.unshift({
29368       node,
29369       printed: concat$d([printOptionalToken(path), printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)])
29370     });
29371     path.call(callee => rec(callee), "callee"); // Once we have a linear list of printed nodes, we want to create groups out
29372     // of it.
29373     //
29374     //   a().b.c().d().e
29375     // will be grouped as
29376     //   [
29377     //     [Identifier, CallExpression],
29378     //     [MemberExpression, MemberExpression, CallExpression],
29379     //     [MemberExpression, CallExpression],
29380     //     [MemberExpression],
29381     //   ]
29382     // so that we can print it as
29383     //   a()
29384     //     .b.c()
29385     //     .d()
29386     //     .e
29387     // The first group is the first node followed by
29388     //   - as many CallExpression as possible
29389     //       < fn()()() >.something()
29390     //   - as many array accessors as possible
29391     //       < fn()[0][1][2] >.something()
29392     //   - then, as many MemberExpression as possible but the last one
29393     //       < this.items >.something()
29394
29395     const groups = [];
29396     let currentGroup = [printedNodes[0]];
29397     let i = 1;
29398
29399     for (; i < printedNodes.length; ++i) {
29400       if (printedNodes[i].node.type === "TSNonNullExpression" || printedNodes[i].node.type === "OptionalCallExpression" || printedNodes[i].node.type === "CallExpression" || (printedNodes[i].node.type === "MemberExpression" || printedNodes[i].node.type === "OptionalMemberExpression") && printedNodes[i].node.computed && isNumericLiteral$1(printedNodes[i].node.property)) {
29401         currentGroup.push(printedNodes[i]);
29402       } else {
29403         break;
29404       }
29405     }
29406
29407     if (printedNodes[0].node.type !== "CallExpression" && printedNodes[0].node.type !== "OptionalCallExpression") {
29408       for (; i + 1 < printedNodes.length; ++i) {
29409         if (isMemberish$1(printedNodes[i].node) && isMemberish$1(printedNodes[i + 1].node)) {
29410           currentGroup.push(printedNodes[i]);
29411         } else {
29412           break;
29413         }
29414       }
29415     }
29416
29417     groups.push(currentGroup);
29418     currentGroup = []; // Then, each following group is a sequence of MemberExpression followed by
29419     // a sequence of CallExpression. To compute it, we keep adding things to the
29420     // group until we has seen a CallExpression in the past and reach a
29421     // MemberExpression
29422
29423     let hasSeenCallExpression = false;
29424
29425     for (; i < printedNodes.length; ++i) {
29426       if (hasSeenCallExpression && isMemberish$1(printedNodes[i].node)) {
29427         // [0] should be appended at the end of the group instead of the
29428         // beginning of the next one
29429         if (printedNodes[i].node.computed && isNumericLiteral$1(printedNodes[i].node.property)) {
29430           currentGroup.push(printedNodes[i]);
29431           continue;
29432         }
29433
29434         groups.push(currentGroup);
29435         currentGroup = [];
29436         hasSeenCallExpression = false;
29437       }
29438
29439       if (printedNodes[i].node.type === "CallExpression" || printedNodes[i].node.type === "OptionalCallExpression") {
29440         hasSeenCallExpression = true;
29441       }
29442
29443       currentGroup.push(printedNodes[i]);
29444
29445       if (printedNodes[i].node.comments && printedNodes[i].node.comments.some(comment => comment.trailing)) {
29446         groups.push(currentGroup);
29447         currentGroup = [];
29448         hasSeenCallExpression = false;
29449       }
29450     }
29451
29452     if (currentGroup.length > 0) {
29453       groups.push(currentGroup);
29454     } // There are cases like Object.keys(), Observable.of(), _.values() where
29455     // they are the subject of all the chained calls and therefore should
29456     // be kept on the same line:
29457     //
29458     //   Object.keys(items)
29459     //     .filter(x => x)
29460     //     .map(x => x)
29461     //
29462     // In order to detect those cases, we use an heuristic: if the first
29463     // node is an identifier with the name starting with a capital
29464     // letter or just a sequence of _$. The rationale is that they are
29465     // likely to be factories.
29466
29467
29468     function isFactory(name) {
29469       return /^[A-Z]|^[_$]+$/.test(name);
29470     } // In case the Identifier is shorter than tab width, we can keep the
29471     // first call in a single line, if it's an ExpressionStatement.
29472     //
29473     //   d3.scaleLinear()
29474     //     .domain([0, 100])
29475     //     .range([0, width]);
29476     //
29477
29478
29479     function isShort(name) {
29480       return name.length <= options.tabWidth;
29481     }
29482
29483     function shouldNotWrap(groups) {
29484       const parent = path.getParentNode();
29485       const isExpression = parent && parent.type === "ExpressionStatement";
29486       const hasComputed = groups[1].length && groups[1][0].node.computed;
29487
29488       if (groups[0].length === 1) {
29489         const firstNode = groups[0][0].node;
29490         return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpression && isShort(firstNode.name) || hasComputed);
29491       }
29492
29493       const lastNode = getLast$3(groups[0]).node;
29494       return (lastNode.type === "MemberExpression" || lastNode.type === "OptionalMemberExpression") && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
29495     }
29496
29497     const shouldMerge = groups.length >= 2 && !groups[1][0].node.comments && shouldNotWrap(groups);
29498
29499     function printGroup(printedGroup) {
29500       const printed = printedGroup.map(tuple => tuple.printed); // Checks if the last node (i.e. the parent node) needs parens and print
29501       // accordingly
29502
29503       if (printedGroup.length > 0 && printedGroup[printedGroup.length - 1].needsParens) {
29504         return concat$d(["(", ...printed, ")"]);
29505       }
29506
29507       return concat$d(printed);
29508     }
29509
29510     function printIndentedGroup(groups) {
29511       if (groups.length === 0) {
29512         return "";
29513       }
29514
29515       return indent$7(group$b(concat$d([hardline$9, join$9(hardline$9, groups.map(printGroup))])));
29516     }
29517
29518     const printedGroups = groups.map(printGroup);
29519     const oneLine = concat$d(printedGroups);
29520     const cutoff = shouldMerge ? 3 : 2;
29521     const flatGroups = groups.reduce((res, group) => res.concat(group), []);
29522     const hasComment = flatGroups.slice(1, -1).some(node => hasLeadingComment$3(node.node)) || flatGroups.slice(0, -1).some(node => hasTrailingComment$1(node.node)) || groups[cutoff] && hasLeadingComment$3(groups[cutoff][0].node); // If we only have a single `.`, we shouldn't do anything fancy and just
29523     // render everything concatenated together.
29524
29525     if (groups.length <= cutoff && !hasComment) {
29526       if (isLongCurriedCallExpression$1(path)) {
29527         return oneLine;
29528       }
29529
29530       return group$b(oneLine);
29531     } // Find out the last node in the first group and check if it has an
29532     // empty line after
29533
29534
29535     const lastNodeBeforeIndent = getLast$3(shouldMerge ? groups.slice(1, 2)[0] : groups[0]).node;
29536     const shouldHaveEmptyLineBeforeIndent = lastNodeBeforeIndent.type !== "CallExpression" && lastNodeBeforeIndent.type !== "OptionalCallExpression" && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
29537     const expanded = concat$d([printGroup(groups[0]), shouldMerge ? concat$d(groups.slice(1, 2).map(printGroup)) : "", shouldHaveEmptyLineBeforeIndent ? hardline$9 : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))]);
29538     const callExpressions = printedNodes.map(({
29539       node
29540     }) => node).filter(isCallOrOptionalCallExpression$1); // We don't want to print in one line if the chain has:
29541     //  * A comment.
29542     //  * Non-trivial arguments.
29543     //  * Any group but the last one has a hard line.
29544     // If the last group is a function it's okay to inline if it fits.
29545
29546     if (hasComment || callExpressions.length > 2 && callExpressions.some(expr => !expr.arguments.every(arg => isSimpleCallArgument$1(arg, 0))) || printedGroups.slice(0, -1).some(willBreak$1) ||
29547     /**
29548      *     scopes.filter(scope => scope.value !== '').map((scope, i) => {
29549      *       // multi line content
29550      *     })
29551      */
29552     ((lastGroupDoc, lastGroupNode) => isCallOrOptionalCallExpression$1(lastGroupNode) && willBreak$1(lastGroupDoc))(getLast$3(printedGroups), getLast$3(getLast$3(groups)).node) && callExpressions.slice(0, -1).some(n => n.arguments.some(isFunctionOrArrowExpression$1))) {
29553       return group$b(expanded);
29554     }
29555
29556     return concat$d([// We only need to check `oneLine` because if `expanded` is chosen
29557     // that means that the parent group has already been broken
29558     // naturally
29559     willBreak$1(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent$3 : "", conditionalGroup$1([oneLine, expanded])]);
29560   }
29561
29562   function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
29563     if (isFacebookTranslationTag) {
29564       return "";
29565     }
29566
29567     if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) {
29568       return child.length === 1 ? softline$6 : hardline$9;
29569     }
29570
29571     return softline$6;
29572   }
29573
29574   function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
29575     if (isFacebookTranslationTag) {
29576       return hardline$9;
29577     }
29578
29579     if (child.length === 1) {
29580       return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline$9 : softline$6;
29581     }
29582
29583     return hardline$9;
29584   } // JSX Children are strange, mostly for two reasons:
29585   // 1. JSX reads newlines into string values, instead of skipping them like JS
29586   // 2. up to one whitespace between elements within a line is significant,
29587   //    but not between lines.
29588   //
29589   // Leading, trailing, and lone whitespace all need to
29590   // turn themselves into the rather ugly `{' '}` when breaking.
29591   //
29592   // We print JSX using the `fill` doc primitive.
29593   // This requires that we give it an array of alternating
29594   // content and whitespace elements.
29595   // To ensure this we add dummy `""` content elements as needed.
29596
29597
29598   function printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
29599     const n = path.getValue();
29600     const children = []; // using `map` instead of `each` because it provides `i`
29601
29602     path.map((childPath, i) => {
29603       const child = childPath.getValue();
29604
29605       if (isLiteral$1(child)) {
29606         const text = rawText$1(child); // Contains a non-whitespace character
29607
29608         if (isMeaningfulJSXText$1(child)) {
29609           const words = text.split(matchJsxWhitespaceRegex$1); // Starts with whitespace
29610
29611           if (words[0] === "") {
29612             children.push("");
29613             words.shift();
29614
29615             if (/\n/.test(words[0])) {
29616               const next = n.children[i + 1];
29617               children.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next));
29618             } else {
29619               children.push(jsxWhitespace);
29620             }
29621
29622             words.shift();
29623           }
29624
29625           let endWhitespace; // Ends with whitespace
29626
29627           if (getLast$3(words) === "") {
29628             words.pop();
29629             endWhitespace = words.pop();
29630           } // This was whitespace only without a new line.
29631
29632
29633           if (words.length === 0) {
29634             return;
29635           }
29636
29637           words.forEach((word, i) => {
29638             if (i % 2 === 1) {
29639               children.push(line$9);
29640             } else {
29641               children.push(word);
29642             }
29643           });
29644
29645           if (endWhitespace !== undefined) {
29646             if (/\n/.test(endWhitespace)) {
29647               const next = n.children[i + 1];
29648               children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$3(children), child, next));
29649             } else {
29650               children.push(jsxWhitespace);
29651             }
29652           } else {
29653             const next = n.children[i + 1];
29654             children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$3(children), child, next));
29655           }
29656         } else if (/\n/.test(text)) {
29657           // Keep (up to one) blank line between tags/expressions/text.
29658           // Note: We don't keep blank lines between text elements.
29659           if (text.match(/\n/g).length > 1) {
29660             children.push("");
29661             children.push(hardline$9);
29662           }
29663         } else {
29664           children.push("");
29665           children.push(jsxWhitespace);
29666         }
29667       } else {
29668         const printedChild = print(childPath);
29669         children.push(printedChild);
29670         const next = n.children[i + 1];
29671         const directlyFollowedByMeaningfulText = next && isMeaningfulJSXText$1(next);
29672
29673         if (directlyFollowedByMeaningfulText) {
29674           const firstWord = rawText$1(next).trim().split(matchJsxWhitespaceRegex$1)[0];
29675           children.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, next));
29676         } else {
29677           children.push(hardline$9);
29678         }
29679       }
29680     }, "children");
29681     return children;
29682   } // JSX expands children from the inside-out, instead of the outside-in.
29683   // This is both to break children before attributes,
29684   // and to ensure that when children break, their parents do as well.
29685   //
29686   // Any element that is written without any newlines and fits on a single line
29687   // is left that way.
29688   // Not only that, any user-written-line containing multiple JSX siblings
29689   // should also be kept on one line if possible,
29690   // so each user-written-line is wrapped in its own group.
29691   //
29692   // Elements that contain newlines or don't fit on a single line (recursively)
29693   // are fully-split, using hardline and shouldBreak: true.
29694   //
29695   // To support that case properly, all leading and trailing spaces
29696   // are stripped from the list of children, and replaced with a single hardline.
29697
29698
29699   function printJSXElement(path, options, print) {
29700     const n = path.getValue();
29701
29702     if (n.type === "JSXElement" && isEmptyJSXElement$1(n)) {
29703       return concat$d([path.call(print, "openingElement"), path.call(print, "closingElement")]);
29704     }
29705
29706     const openingLines = n.type === "JSXElement" ? path.call(print, "openingElement") : path.call(print, "openingFragment");
29707     const closingLines = n.type === "JSXElement" ? path.call(print, "closingElement") : path.call(print, "closingFragment");
29708
29709     if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) {
29710       return concat$d([openingLines, concat$d(path.map(print, "children")), closingLines]);
29711     } // Convert `{" "}` to text nodes containing a space.
29712     // This makes it easy to turn them into `jsxWhitespace` which
29713     // can then print as either a space or `{" "}` when breaking.
29714
29715
29716     n.children = n.children.map(child => {
29717       if (isJSXWhitespaceExpression$1(child)) {
29718         return {
29719           type: "JSXText",
29720           value: " ",
29721           raw: " "
29722         };
29723       }
29724
29725       return child;
29726     });
29727     const containsTag = n.children.filter(isJSXNode$1).length > 0;
29728     const containsMultipleExpressions = n.children.filter(child => child.type === "JSXExpressionContainer").length > 1;
29729     const containsMultipleAttributes = n.type === "JSXElement" && n.openingElement.attributes.length > 1; // Record any breaks. Should never go from true to false, only false to true.
29730
29731     let forcedBreak = willBreak$1(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
29732     const isMdxBlock = path.getParentNode().rootMarker === "mdx";
29733     const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
29734     const jsxWhitespace = isMdxBlock ? concat$d([" "]) : ifBreak$6(concat$d([rawJsxWhitespace, softline$6]), " ");
29735     const isFacebookTranslationTag = n.openingElement && n.openingElement.name && n.openingElement.name.name === "fbt";
29736     const children = printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
29737     const containsText = n.children.some(child => isMeaningfulJSXText$1(child)); // We can end up we multiple whitespace elements with empty string
29738     // content between them.
29739     // We need to remove empty whitespace and softlines before JSX whitespace
29740     // to get the correct output.
29741
29742     for (let i = children.length - 2; i >= 0; i--) {
29743       const isPairOfEmptyStrings = children[i] === "" && children[i + 1] === "";
29744       const isPairOfHardlines = children[i] === hardline$9 && children[i + 1] === "" && children[i + 2] === hardline$9;
29745       const isLineFollowedByJSXWhitespace = (children[i] === softline$6 || children[i] === hardline$9) && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
29746       const isJSXWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline$6 || children[i + 2] === hardline$9);
29747       const isDoubleJSXWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
29748       const isPairOfHardOrSoftLines = children[i] === softline$6 && children[i + 1] === "" && children[i + 2] === hardline$9 || children[i] === hardline$9 && children[i + 1] === "" && children[i + 2] === softline$6;
29749
29750       if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJSXWhitespace || isDoubleJSXWhitespace || isPairOfHardOrSoftLines) {
29751         children.splice(i, 2);
29752       } else if (isJSXWhitespaceFollowedByLine) {
29753         children.splice(i + 1, 2);
29754       }
29755     } // Trim trailing lines (or empty strings)
29756
29757
29758     while (children.length && (isLineNext$1(getLast$3(children)) || isEmpty$1(getLast$3(children)))) {
29759       children.pop();
29760     } // Trim leading lines (or empty strings)
29761
29762
29763     while (children.length && (isLineNext$1(children[0]) || isEmpty$1(children[0])) && (isLineNext$1(children[1]) || isEmpty$1(children[1]))) {
29764       children.shift();
29765       children.shift();
29766     } // Tweak how we format children if outputting this element over multiple lines.
29767     // Also detect whether we will force this element to output over multiple lines.
29768
29769
29770     const multilineChildren = [];
29771     children.forEach((child, i) => {
29772       // There are a number of situations where we need to ensure we display
29773       // whitespace as `{" "}` when outputting this element over multiple lines.
29774       if (child === jsxWhitespace) {
29775         if (i === 1 && children[i - 1] === "") {
29776           if (children.length === 2) {
29777             // Solitary whitespace
29778             multilineChildren.push(rawJsxWhitespace);
29779             return;
29780           } // Leading whitespace
29781
29782
29783           multilineChildren.push(concat$d([rawJsxWhitespace, hardline$9]));
29784           return;
29785         } else if (i === children.length - 1) {
29786           // Trailing whitespace
29787           multilineChildren.push(rawJsxWhitespace);
29788           return;
29789         } else if (children[i - 1] === "" && children[i - 2] === hardline$9) {
29790           // Whitespace after line break
29791           multilineChildren.push(rawJsxWhitespace);
29792           return;
29793         }
29794       }
29795
29796       multilineChildren.push(child);
29797
29798       if (willBreak$1(child)) {
29799         forcedBreak = true;
29800       }
29801     }); // If there is text we use `fill` to fit as much onto each line as possible.
29802     // When there is no text (just tags and expressions) we use `group`
29803     // to output each on a separate line.
29804
29805     const content = containsText ? fill$4(multilineChildren) : group$b(concat$d(multilineChildren), {
29806       shouldBreak: true
29807     });
29808
29809     if (isMdxBlock) {
29810       return content;
29811     }
29812
29813     const multiLineElem = group$b(concat$d([openingLines, indent$7(concat$d([hardline$9, content])), hardline$9, closingLines]));
29814
29815     if (forcedBreak) {
29816       return multiLineElem;
29817     }
29818
29819     return conditionalGroup$1([group$b(concat$d([openingLines, concat$d(children), closingLines])), multiLineElem]);
29820   }
29821
29822   function maybeWrapJSXElementInParens(path, elem, options) {
29823     const parent = path.getParentNode();
29824
29825     if (!parent) {
29826       return elem;
29827     }
29828
29829     const NO_WRAP_PARENTS = {
29830       ArrayExpression: true,
29831       JSXAttribute: true,
29832       JSXElement: true,
29833       JSXExpressionContainer: true,
29834       JSXFragment: true,
29835       ExpressionStatement: true,
29836       CallExpression: true,
29837       OptionalCallExpression: true,
29838       ConditionalExpression: true,
29839       JsExpressionRoot: true
29840     };
29841
29842     if (NO_WRAP_PARENTS[parent.type]) {
29843       return elem;
29844     }
29845
29846     const shouldBreak = path.match(undefined, node => node.type === "ArrowFunctionExpression", isCallOrOptionalCallExpression$1, node => node.type === "JSXExpressionContainer");
29847     const needsParens = needsParens_1(path, options);
29848     return group$b(concat$d([needsParens ? "" : ifBreak$6("("), indent$7(concat$d([softline$6, elem])), softline$6, needsParens ? "" : ifBreak$6(")")]), {
29849       shouldBreak
29850     });
29851   }
29852
29853   function shouldInlineLogicalExpression(node) {
29854     if (node.type !== "LogicalExpression") {
29855       return false;
29856     }
29857
29858     if (node.right.type === "ObjectExpression" && node.right.properties.length !== 0) {
29859       return true;
29860     }
29861
29862     if (node.right.type === "ArrayExpression" && node.right.elements.length !== 0) {
29863       return true;
29864     }
29865
29866     if (isJSXNode$1(node.right)) {
29867       return true;
29868     }
29869
29870     return false;
29871   } // For binary expressions to be consistent, we need to group
29872   // subsequent operators with the same precedence level under a single
29873   // group. Otherwise they will be nested such that some of them break
29874   // onto new lines but not all. Operators with the same precedence
29875   // level should either all break or not. Because we group them by
29876   // precedence level and the AST is structured based on precedence
29877   // level, things are naturally broken up correctly, i.e. `&&` is
29878   // broken before `+`.
29879
29880
29881   function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) {
29882     let parts = [];
29883     const node = path.getValue(); // We treat BinaryExpression and LogicalExpression nodes the same.
29884
29885     if (isBinaryish$1(node)) {
29886       // Put all operators with the same precedence level in the same
29887       // group. The reason we only need to do this with the `left`
29888       // expression is because given an expression like `1 + 2 - 3`, it
29889       // is always parsed like `((1 + 2) - 3)`, meaning the `left` side
29890       // is where the rest of the expression will exist. Binary
29891       // expressions on the right side mean they have a difference
29892       // precedence level and should be treated as a separate group, so
29893       // print them normally. (This doesn't hold for the `**` operator,
29894       // which is unique in that it is right-associative.)
29895       if (shouldFlatten$1(node.operator, node.left.operator)) {
29896         // Flatten them out by recursively calling this function.
29897         parts = parts.concat(path.call(left => printBinaryishExpressions(left, print, options,
29898         /* isNested */
29899         true, isInsideParenthesis), "left"));
29900       } else {
29901         parts.push(path.call(print, "left"));
29902       }
29903
29904       const shouldInline = shouldInlineLogicalExpression(node);
29905       const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment$1(options.originalText, node.right, options);
29906       const operator = node.type === "NGPipeExpression" ? "|" : node.operator;
29907       const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length !== 0 ? group$b(indent$7(concat$d([softline$6, ": ", join$9(concat$d([softline$6, ":", ifBreak$6(" ")]), path.map(print, "arguments").map(arg => align$1(2, group$b(arg))))]))) : "";
29908       const right = shouldInline ? concat$d([operator, " ", path.call(print, "right"), rightSuffix]) : concat$d([lineBeforeOperator ? softline$6 : "", operator, lineBeforeOperator ? " " : line$9, path.call(print, "right"), rightSuffix]); // If there's only a single binary expression, we want to create a group
29909       // in order to avoid having a small right part like -1 be on its own line.
29910
29911       const parent = path.getParentNode();
29912       const shouldGroup = !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type;
29913       parts.push(" ", shouldGroup ? group$b(right) : right); // The root comments are already printed, but we need to manually print
29914       // the other ones since we don't call the normal print on BinaryExpression,
29915       // only for the left and right parts
29916
29917       if (isNested && node.comments) {
29918         parts = comments.printComments(path, () => concat$d(parts), options);
29919       }
29920     } else {
29921       // Our stopping case. Simply print the node normally.
29922       parts.push(path.call(print));
29923     }
29924
29925     return parts;
29926   }
29927
29928   function printAssignmentRight(leftNode, rightNode, printedRight, options) {
29929     if (hasLeadingOwnLineComment$1(options.originalText, rightNode, options)) {
29930       return indent$7(concat$d([line$9, printedRight]));
29931     }
29932
29933     const canBreak = isBinaryish$1(rightNode) && !shouldInlineLogicalExpression(rightNode) || rightNode.type === "ConditionalExpression" && isBinaryish$1(rightNode.test) && !shouldInlineLogicalExpression(rightNode.test) || rightNode.type === "StringLiteralTypeAnnotation" || rightNode.type === "ClassExpression" && rightNode.decorators && rightNode.decorators.length || (leftNode.type === "Identifier" || isStringLiteral$1(leftNode) || leftNode.type === "MemberExpression") && (isStringLiteral$1(rightNode) || isMemberExpressionChain$1(rightNode)) && // do not put values on a separate line from the key in json
29934     options.parser !== "json" && options.parser !== "json5" || rightNode.type === "SequenceExpression";
29935
29936     if (canBreak) {
29937       return group$b(indent$7(concat$d([line$9, printedRight])));
29938     }
29939
29940     return concat$d([" ", printedRight]);
29941   }
29942
29943   function printAssignment(leftNode, printedLeft, operator, rightNode, printedRight, options) {
29944     if (!rightNode) {
29945       return printedLeft;
29946     }
29947
29948     const printed = printAssignmentRight(leftNode, rightNode, printedRight, options);
29949     return group$b(concat$d([printedLeft, operator, printed]));
29950   }
29951
29952   function adjustClause(node, clause, forceSpace) {
29953     if (node.type === "EmptyStatement") {
29954       return ";";
29955     }
29956
29957     if (node.type === "BlockStatement" || forceSpace) {
29958       return concat$d([" ", clause]);
29959     }
29960
29961     return indent$7(concat$d([line$9, clause]));
29962   }
29963
29964   function nodeStr(node, options, isFlowOrTypeScriptDirectiveLiteral) {
29965     const raw = rawText$1(node);
29966     const isDirectiveLiteral = isFlowOrTypeScriptDirectiveLiteral || node.type === "DirectiveLiteral";
29967     return printString$2(raw, options, isDirectiveLiteral);
29968   }
29969
29970   function printRegex(node) {
29971     const flags = node.flags.split("").sort().join("");
29972     return "/".concat(node.pattern, "/").concat(flags);
29973   }
29974
29975   function exprNeedsASIProtection(path, options) {
29976     const node = path.getValue();
29977     const maybeASIProblem = needsParens_1(path, options) || node.type === "ParenthesizedExpression" || node.type === "TypeCastExpression" || node.type === "ArrowFunctionExpression" && !shouldPrintParamsWithoutParens(path, options) || node.type === "ArrayExpression" || node.type === "ArrayPattern" || node.type === "UnaryExpression" && node.prefix && (node.operator === "+" || node.operator === "-") || node.type === "TemplateLiteral" || node.type === "TemplateElement" || isJSXNode$1(node) || node.type === "BindExpression" && !node.object || node.type === "RegExpLiteral" || node.type === "Literal" && node.pattern || node.type === "Literal" && node.regex;
29978
29979     if (maybeASIProblem) {
29980       return true;
29981     }
29982
29983     if (!hasNakedLeftSide$2(node)) {
29984       return false;
29985     }
29986
29987     return path.call(childPath => exprNeedsASIProtection(childPath, options), ...getLeftSidePathName$2(path, node));
29988   }
29989
29990   function stmtNeedsASIProtection(path, options) {
29991     const node = path.getNode();
29992
29993     if (node.type !== "ExpressionStatement") {
29994       return false;
29995     }
29996
29997     return path.call(childPath => exprNeedsASIProtection(childPath, options), "expression");
29998   }
29999
30000   function shouldHugType(node) {
30001     if (isSimpleFlowType$1(node) || isObjectType$1(node)) {
30002       return true;
30003     }
30004
30005     if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") {
30006       const voidCount = node.types.filter(n => n.type === "VoidTypeAnnotation" || n.type === "TSVoidKeyword" || n.type === "NullLiteralTypeAnnotation" || n.type === "TSNullKeyword").length;
30007       const hasObject = node.types.some(n => n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral" || // This is a bit aggressive but captures Array<{x}>
30008       n.type === "GenericTypeAnnotation" || n.type === "TSTypeReference");
30009
30010       if (node.types.length - 1 === voidCount && hasObject) {
30011         return true;
30012       }
30013     }
30014
30015     return false;
30016   }
30017
30018   function shouldHugArguments(fun) {
30019     if (!fun || fun.rest) {
30020       return false;
30021     }
30022
30023     const params = fun.params || fun.parameters;
30024
30025     if (!params || params.length !== 1) {
30026       return false;
30027     }
30028
30029     const param = params[0];
30030     return !param.comments && (param.type === "ObjectPattern" || param.type === "ArrayPattern" || param.type === "Identifier" && param.typeAnnotation && (param.typeAnnotation.type === "TypeAnnotation" || param.typeAnnotation.type === "TSTypeAnnotation") && isObjectType$1(param.typeAnnotation.typeAnnotation) || param.type === "FunctionTypeParam" && isObjectType$1(param.typeAnnotation) || param.type === "AssignmentPattern" && (param.left.type === "ObjectPattern" || param.left.type === "ArrayPattern") && (param.right.type === "Identifier" || param.right.type === "ObjectExpression" && param.right.properties.length === 0 || param.right.type === "ArrayExpression" && param.right.elements.length === 0));
30031   }
30032
30033   function printArrayItems(path, options, printPath, print) {
30034     const printedElements = [];
30035     let separatorParts = [];
30036     path.each(childPath => {
30037       printedElements.push(concat$d(separatorParts));
30038       printedElements.push(group$b(print(childPath)));
30039       separatorParts = [",", line$9];
30040
30041       if (childPath.getValue() && isNextLineEmpty$4(options.originalText, childPath.getValue(), options.locEnd)) {
30042         separatorParts.push(softline$6);
30043       }
30044     }, printPath);
30045     return concat$d(printedElements);
30046   }
30047
30048   function printReturnAndThrowArgument(path, options, print) {
30049     const node = path.getValue();
30050     const semi = options.semi ? ";" : "";
30051     const parts = [];
30052
30053     if (node.argument) {
30054       if (returnArgumentHasLeadingComment$1(options, node.argument)) {
30055         parts.push(concat$d([" (", indent$7(concat$d([hardline$9, path.call(print, "argument")])), hardline$9, ")"]));
30056       } else if (isBinaryish$1(node.argument) || node.argument.type === "SequenceExpression") {
30057         parts.push(group$b(concat$d([ifBreak$6(" (", " "), indent$7(concat$d([softline$6, path.call(print, "argument")])), softline$6, ifBreak$6(")")])));
30058       } else {
30059         parts.push(" ", path.call(print, "argument"));
30060       }
30061     }
30062
30063     const lastComment = Array.isArray(node.comments) && node.comments[node.comments.length - 1];
30064     const isLastCommentLine = lastComment && (lastComment.type === "CommentLine" || lastComment.type === "Line");
30065
30066     if (isLastCommentLine) {
30067       parts.push(semi);
30068     }
30069
30070     if (hasDanglingComments$1(node)) {
30071       parts.push(" ", comments.printDanglingComments(path, options,
30072       /* sameIndent */
30073       true));
30074     }
30075
30076     if (!isLastCommentLine) {
30077       parts.push(semi);
30078     }
30079
30080     return concat$d(parts);
30081   }
30082
30083   function willPrintOwnComments(path
30084   /*, options */
30085   ) {
30086     const node = path.getValue();
30087     const parent = path.getParentNode();
30088     return (node && (isJSXNode$1(node) || hasFlowShorthandAnnotationComment$2(node) || parent && (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && (hasFlowAnnotationComment$1(node.leadingComments) || hasFlowAnnotationComment$1(node.trailingComments))) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && (!hasIgnoreComment$4(path) || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType");
30089   }
30090
30091   function canAttachComment$1(node) {
30092     return node.type && node.type !== "CommentBlock" && node.type !== "CommentLine" && node.type !== "Line" && node.type !== "Block" && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import";
30093   }
30094
30095   function printComment$2(commentPath, options) {
30096     const comment = commentPath.getValue();
30097
30098     switch (comment.type) {
30099       case "CommentBlock":
30100       case "Block":
30101         {
30102           if (isIndentableBlockComment(comment)) {
30103             const printed = printIndentableBlockComment(comment); // We need to prevent an edge case of a previous trailing comment
30104             // printed as a `lineSuffix` which causes the comments to be
30105             // interleaved. See https://github.com/prettier/prettier/issues/4412
30106
30107             if (comment.trailing && !hasNewline$5(options.originalText, options.locStart(comment), {
30108               backwards: true
30109             })) {
30110               return concat$d([hardline$9, printed]);
30111             }
30112
30113             return printed;
30114           }
30115
30116           const commentEnd = options.locEnd(comment);
30117           const isInsideFlowComment = options.originalText.slice(commentEnd - 3, commentEnd) === "*-/";
30118           return "/*" + comment.value + (isInsideFlowComment ? "*-/" : "*/");
30119         }
30120
30121       case "CommentLine":
30122       case "Line":
30123         // Print shebangs with the proper comment characters
30124         if (options.originalText.slice(options.locStart(comment)).startsWith("#!")) {
30125           return "#!" + comment.value.trimEnd();
30126         }
30127
30128         return "//" + comment.value.trimEnd();
30129
30130       default:
30131         throw new Error("Not a comment: " + JSON.stringify(comment));
30132     }
30133   }
30134
30135   function isIndentableBlockComment(comment) {
30136     // If the comment has multiple lines and every line starts with a star
30137     // we can fix the indentation of each line. The stars in the `/*` and
30138     // `*/` delimiters are not included in the comment value, so add them
30139     // back first.
30140     const lines = "*".concat(comment.value, "*").split("\n");
30141     return lines.length > 1 && lines.every(line => line.trim()[0] === "*");
30142   }
30143
30144   function printIndentableBlockComment(comment) {
30145     const lines = comment.value.split("\n");
30146     return concat$d(["/*", join$9(hardline$9, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"]);
30147   }
30148
30149   var printerEstree = {
30150     preprocess: preprocess_1$1,
30151     print: genericPrint$3,
30152     embed: embed_1$1,
30153     insertPragma: insertPragma$7,
30154     massageAstNode: clean_1$1,
30155     hasPrettierIgnore: hasPrettierIgnore$5,
30156     willPrintOwnComments,
30157     canAttachComment: canAttachComment$1,
30158     printComment: printComment$2,
30159     isBlockComment: comments$1.isBlockComment,
30160     handleComments: {
30161       ownLine: comments$1.handleOwnLineComment,
30162       endOfLine: comments$1.handleEndOfLineComment,
30163       remaining: comments$1.handleRemainingComment
30164     },
30165     getGapRegex: comments$1.getGapRegex,
30166     getCommentChildNodes: comments$1.getCommentChildNodes
30167   };
30168
30169   const {
30170     concat: concat$e,
30171     hardline: hardline$a,
30172     indent: indent$8,
30173     join: join$a
30174   } = document.builders;
30175
30176   function genericPrint$4(path, options, print) {
30177     const node = path.getValue();
30178
30179     switch (node.type) {
30180       case "JsonRoot":
30181         return concat$e([path.call(print, "node"), hardline$a]);
30182
30183       case "ArrayExpression":
30184         return node.elements.length === 0 ? "[]" : concat$e(["[", indent$8(concat$e([hardline$a, join$a(concat$e([",", hardline$a]), path.map(print, "elements"))])), hardline$a, "]"]);
30185
30186       case "ObjectExpression":
30187         return node.properties.length === 0 ? "{}" : concat$e(["{", indent$8(concat$e([hardline$a, join$a(concat$e([",", hardline$a]), path.map(print, "properties"))])), hardline$a, "}"]);
30188
30189       case "ObjectProperty":
30190         return concat$e([path.call(print, "key"), ": ", path.call(print, "value")]);
30191
30192       case "UnaryExpression":
30193         return concat$e([node.operator === "+" ? "" : node.operator, path.call(print, "argument")]);
30194
30195       case "NullLiteral":
30196         return "null";
30197
30198       case "BooleanLiteral":
30199         return node.value ? "true" : "false";
30200
30201       case "StringLiteral":
30202       case "NumericLiteral":
30203         return JSON.stringify(node.value);
30204
30205       case "Identifier":
30206         return JSON.stringify(node.name);
30207
30208       default:
30209         /* istanbul ignore next */
30210         throw new Error("unknown type: " + JSON.stringify(node.type));
30211     }
30212   }
30213
30214   function clean$5(node, newNode
30215   /*, parent*/
30216   ) {
30217     delete newNode.start;
30218     delete newNode.end;
30219     delete newNode.extra;
30220     delete newNode.loc;
30221     delete newNode.comments;
30222     delete newNode.errors;
30223
30224     if (node.type === "Identifier") {
30225       return {
30226         type: "StringLiteral",
30227         value: node.name
30228       };
30229     }
30230
30231     if (node.type === "UnaryExpression" && node.operator === "+") {
30232       return newNode.argument;
30233     }
30234   }
30235
30236   var printerEstreeJson = {
30237     preprocess: preprocess_1$1,
30238     print: genericPrint$4,
30239     massageAstNode: clean$5
30240   };
30241
30242   const CATEGORY_JAVASCRIPT = "JavaScript"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
30243
30244   var options$5 = {
30245     arrowParens: {
30246       since: "1.9.0",
30247       category: CATEGORY_JAVASCRIPT,
30248       type: "choice",
30249       default: [{
30250         since: "1.9.0",
30251         value: "avoid"
30252       }, {
30253         since: "2.0.0",
30254         value: "always"
30255       }],
30256       description: "Include parentheses around a sole arrow function parameter.",
30257       choices: [{
30258         value: "always",
30259         description: "Always include parens. Example: `(x) => x`"
30260       }, {
30261         value: "avoid",
30262         description: "Omit parens when possible. Example: `x => x`"
30263       }]
30264     },
30265     bracketSpacing: commonOptions.bracketSpacing,
30266     jsxBracketSameLine: {
30267       since: "0.17.0",
30268       category: CATEGORY_JAVASCRIPT,
30269       type: "boolean",
30270       default: false,
30271       description: "Put > on the last line instead of at a new line."
30272     },
30273     semi: {
30274       since: "1.0.0",
30275       category: CATEGORY_JAVASCRIPT,
30276       type: "boolean",
30277       default: true,
30278       description: "Print semicolons.",
30279       oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
30280     },
30281     singleQuote: commonOptions.singleQuote,
30282     jsxSingleQuote: {
30283       since: "1.15.0",
30284       category: CATEGORY_JAVASCRIPT,
30285       type: "boolean",
30286       default: false,
30287       description: "Use single quotes in JSX."
30288     },
30289     quoteProps: {
30290       since: "1.17.0",
30291       category: CATEGORY_JAVASCRIPT,
30292       type: "choice",
30293       default: "as-needed",
30294       description: "Change when properties in objects are quoted.",
30295       choices: [{
30296         value: "as-needed",
30297         description: "Only add quotes around object properties where required."
30298       }, {
30299         value: "consistent",
30300         description: "If at least one property in an object requires quotes, quote all properties."
30301       }, {
30302         value: "preserve",
30303         description: "Respect the input use of quotes in object properties."
30304       }]
30305     },
30306     trailingComma: {
30307       since: "0.0.0",
30308       category: CATEGORY_JAVASCRIPT,
30309       type: "choice",
30310       default: [{
30311         since: "0.0.0",
30312         value: false
30313       }, {
30314         since: "0.19.0",
30315         value: "none"
30316       }, {
30317         since: "2.0.0",
30318         value: "es5"
30319       }],
30320       description: "Print trailing commas wherever possible when multi-line.",
30321       choices: [{
30322         value: "es5",
30323         description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
30324       }, {
30325         value: "none",
30326         description: "No trailing commas."
30327       }, {
30328         value: "all",
30329         description: "Trailing commas wherever possible (including function arguments)."
30330       }]
30331     }
30332   };
30333
30334   var name$9 = "JavaScript";
30335   var type$8 = "programming";
30336   var tmScope$8 = "source.js";
30337   var aceMode$8 = "javascript";
30338   var codemirrorMode$4 = "javascript";
30339   var codemirrorMimeType$4 = "text/javascript";
30340   var color$3 = "#f1e05a";
30341   var aliases$2 = [
30342         "js",
30343         "node"
30344   ];
30345   var extensions$8 = [
30346         ".js",
30347         "._js",
30348         ".bones",
30349         ".cjs",
30350         ".es",
30351         ".es6",
30352         ".frag",
30353         ".gs",
30354         ".jake",
30355         ".jsb",
30356         ".jscad",
30357         ".jsfl",
30358         ".jsm",
30359         ".jss",
30360         ".mjs",
30361         ".njs",
30362         ".pac",
30363         ".sjs",
30364         ".ssjs",
30365         ".xsjs",
30366         ".xsjslib"
30367   ];
30368   var filenames = [
30369         "Jakefile"
30370   ];
30371   var interpreters = [
30372         "chakra",
30373         "d8",
30374         "gjs",
30375         "js",
30376         "node",
30377         "qjs",
30378         "rhino",
30379         "v8",
30380         "v8-shell"
30381   ];
30382   var languageId$8 = 183;
30383   var JavaScript = {
30384         name: name$9,
30385         type: type$8,
30386         tmScope: tmScope$8,
30387         aceMode: aceMode$8,
30388         codemirrorMode: codemirrorMode$4,
30389         codemirrorMimeType: codemirrorMimeType$4,
30390         color: color$3,
30391         aliases: aliases$2,
30392         extensions: extensions$8,
30393         filenames: filenames,
30394         interpreters: interpreters,
30395         languageId: languageId$8
30396   };
30397
30398   var JavaScript$1 = /*#__PURE__*/Object.freeze({
30399     __proto__: null,
30400     name: name$9,
30401     type: type$8,
30402     tmScope: tmScope$8,
30403     aceMode: aceMode$8,
30404     codemirrorMode: codemirrorMode$4,
30405     codemirrorMimeType: codemirrorMimeType$4,
30406     color: color$3,
30407     aliases: aliases$2,
30408     extensions: extensions$8,
30409     filenames: filenames,
30410     interpreters: interpreters,
30411     languageId: languageId$8,
30412     'default': JavaScript
30413   });
30414
30415   var name$a = "JSX";
30416   var type$9 = "programming";
30417   var group$c = "JavaScript";
30418   var extensions$9 = [
30419         ".jsx"
30420   ];
30421   var tmScope$9 = "source.js.jsx";
30422   var aceMode$9 = "javascript";
30423   var codemirrorMode$5 = "jsx";
30424   var codemirrorMimeType$5 = "text/jsx";
30425   var languageId$9 = 178;
30426   var JSX = {
30427         name: name$a,
30428         type: type$9,
30429         group: group$c,
30430         extensions: extensions$9,
30431         tmScope: tmScope$9,
30432         aceMode: aceMode$9,
30433         codemirrorMode: codemirrorMode$5,
30434         codemirrorMimeType: codemirrorMimeType$5,
30435         languageId: languageId$9
30436   };
30437
30438   var JSX$1 = /*#__PURE__*/Object.freeze({
30439     __proto__: null,
30440     name: name$a,
30441     type: type$9,
30442     group: group$c,
30443     extensions: extensions$9,
30444     tmScope: tmScope$9,
30445     aceMode: aceMode$9,
30446     codemirrorMode: codemirrorMode$5,
30447     codemirrorMimeType: codemirrorMimeType$5,
30448     languageId: languageId$9,
30449     'default': JSX
30450   });
30451
30452   var name$b = "TypeScript";
30453   var type$a = "programming";
30454   var color$4 = "#2b7489";
30455   var aliases$3 = [
30456         "ts"
30457   ];
30458   var interpreters$1 = [
30459         "deno",
30460         "ts-node"
30461   ];
30462   var extensions$a = [
30463         ".ts"
30464   ];
30465   var tmScope$a = "source.ts";
30466   var aceMode$a = "typescript";
30467   var codemirrorMode$6 = "javascript";
30468   var codemirrorMimeType$6 = "application/typescript";
30469   var languageId$a = 378;
30470   var TypeScript = {
30471         name: name$b,
30472         type: type$a,
30473         color: color$4,
30474         aliases: aliases$3,
30475         interpreters: interpreters$1,
30476         extensions: extensions$a,
30477         tmScope: tmScope$a,
30478         aceMode: aceMode$a,
30479         codemirrorMode: codemirrorMode$6,
30480         codemirrorMimeType: codemirrorMimeType$6,
30481         languageId: languageId$a
30482   };
30483
30484   var TypeScript$1 = /*#__PURE__*/Object.freeze({
30485     __proto__: null,
30486     name: name$b,
30487     type: type$a,
30488     color: color$4,
30489     aliases: aliases$3,
30490     interpreters: interpreters$1,
30491     extensions: extensions$a,
30492     tmScope: tmScope$a,
30493     aceMode: aceMode$a,
30494     codemirrorMode: codemirrorMode$6,
30495     codemirrorMimeType: codemirrorMimeType$6,
30496     languageId: languageId$a,
30497     'default': TypeScript
30498   });
30499
30500   var name$c = "TSX";
30501   var type$b = "programming";
30502   var group$d = "TypeScript";
30503   var extensions$b = [
30504         ".tsx"
30505   ];
30506   var tmScope$b = "source.tsx";
30507   var aceMode$b = "javascript";
30508   var codemirrorMode$7 = "jsx";
30509   var codemirrorMimeType$7 = "text/jsx";
30510   var languageId$b = 94901924;
30511   var TSX = {
30512         name: name$c,
30513         type: type$b,
30514         group: group$d,
30515         extensions: extensions$b,
30516         tmScope: tmScope$b,
30517         aceMode: aceMode$b,
30518         codemirrorMode: codemirrorMode$7,
30519         codemirrorMimeType: codemirrorMimeType$7,
30520         languageId: languageId$b
30521   };
30522
30523   var TSX$1 = /*#__PURE__*/Object.freeze({
30524     __proto__: null,
30525     name: name$c,
30526     type: type$b,
30527     group: group$d,
30528     extensions: extensions$b,
30529     tmScope: tmScope$b,
30530     aceMode: aceMode$b,
30531     codemirrorMode: codemirrorMode$7,
30532     codemirrorMimeType: codemirrorMimeType$7,
30533     languageId: languageId$b,
30534     'default': TSX
30535   });
30536
30537   var name$d = "JSON";
30538   var type$c = "data";
30539   var tmScope$c = "source.json";
30540   var aceMode$c = "json";
30541   var codemirrorMode$8 = "javascript";
30542   var codemirrorMimeType$8 = "application/json";
30543   var searchable = false;
30544   var extensions$c = [
30545         ".json",
30546         ".avsc",
30547         ".geojson",
30548         ".gltf",
30549         ".har",
30550         ".ice",
30551         ".JSON-tmLanguage",
30552         ".jsonl",
30553         ".mcmeta",
30554         ".tfstate",
30555         ".tfstate.backup",
30556         ".topojson",
30557         ".webapp",
30558         ".webmanifest",
30559         ".yy",
30560         ".yyp"
30561   ];
30562   var filenames$1 = [
30563         ".arcconfig",
30564         ".htmlhintrc",
30565         ".tern-config",
30566         ".tern-project",
30567         ".watchmanconfig",
30568         "composer.lock",
30569         "mcmod.info"
30570   ];
30571   var languageId$c = 174;
30572   var _JSON = {
30573         name: name$d,
30574         type: type$c,
30575         tmScope: tmScope$c,
30576         aceMode: aceMode$c,
30577         codemirrorMode: codemirrorMode$8,
30578         codemirrorMimeType: codemirrorMimeType$8,
30579         searchable: searchable,
30580         extensions: extensions$c,
30581         filenames: filenames$1,
30582         languageId: languageId$c
30583   };
30584
30585   var _JSON$1 = /*#__PURE__*/Object.freeze({
30586     __proto__: null,
30587     name: name$d,
30588     type: type$c,
30589     tmScope: tmScope$c,
30590     aceMode: aceMode$c,
30591     codemirrorMode: codemirrorMode$8,
30592     codemirrorMimeType: codemirrorMimeType$8,
30593     searchable: searchable,
30594     extensions: extensions$c,
30595     filenames: filenames$1,
30596     languageId: languageId$c,
30597     'default': _JSON
30598   });
30599
30600   var name$e = "JSON with Comments";
30601   var type$d = "data";
30602   var group$e = "JSON";
30603   var tmScope$d = "source.js";
30604   var aceMode$d = "javascript";
30605   var codemirrorMode$9 = "javascript";
30606   var codemirrorMimeType$9 = "text/javascript";
30607   var aliases$4 = [
30608         "jsonc"
30609   ];
30610   var extensions$d = [
30611         ".jsonc",
30612         ".sublime-build",
30613         ".sublime-commands",
30614         ".sublime-completions",
30615         ".sublime-keymap",
30616         ".sublime-macro",
30617         ".sublime-menu",
30618         ".sublime-mousemap",
30619         ".sublime-project",
30620         ".sublime-settings",
30621         ".sublime-theme",
30622         ".sublime-workspace",
30623         ".sublime_metrics",
30624         ".sublime_session"
30625   ];
30626   var filenames$2 = [
30627         ".babelrc",
30628         ".eslintrc.json",
30629         ".jscsrc",
30630         ".jshintrc",
30631         ".jslintrc",
30632         "jsconfig.json",
30633         "language-configuration.json",
30634         "tsconfig.json"
30635   ];
30636   var languageId$d = 423;
30637   var JSON_with_Comments = {
30638         name: name$e,
30639         type: type$d,
30640         group: group$e,
30641         tmScope: tmScope$d,
30642         aceMode: aceMode$d,
30643         codemirrorMode: codemirrorMode$9,
30644         codemirrorMimeType: codemirrorMimeType$9,
30645         aliases: aliases$4,
30646         extensions: extensions$d,
30647         filenames: filenames$2,
30648         languageId: languageId$d
30649   };
30650
30651   var JSON_with_Comments$1 = /*#__PURE__*/Object.freeze({
30652     __proto__: null,
30653     name: name$e,
30654     type: type$d,
30655     group: group$e,
30656     tmScope: tmScope$d,
30657     aceMode: aceMode$d,
30658     codemirrorMode: codemirrorMode$9,
30659     codemirrorMimeType: codemirrorMimeType$9,
30660     aliases: aliases$4,
30661     extensions: extensions$d,
30662     filenames: filenames$2,
30663     languageId: languageId$d,
30664     'default': JSON_with_Comments
30665   });
30666
30667   var name$f = "JSON5";
30668   var type$e = "data";
30669   var extensions$e = [
30670         ".json5"
30671   ];
30672   var tmScope$e = "source.js";
30673   var aceMode$e = "javascript";
30674   var codemirrorMode$a = "javascript";
30675   var codemirrorMimeType$a = "application/json";
30676   var languageId$e = 175;
30677   var JSON5 = {
30678         name: name$f,
30679         type: type$e,
30680         extensions: extensions$e,
30681         tmScope: tmScope$e,
30682         aceMode: aceMode$e,
30683         codemirrorMode: codemirrorMode$a,
30684         codemirrorMimeType: codemirrorMimeType$a,
30685         languageId: languageId$e
30686   };
30687
30688   var JSON5$1 = /*#__PURE__*/Object.freeze({
30689     __proto__: null,
30690     name: name$f,
30691     type: type$e,
30692     extensions: extensions$e,
30693     tmScope: tmScope$e,
30694     aceMode: aceMode$e,
30695     codemirrorMode: codemirrorMode$a,
30696     codemirrorMimeType: codemirrorMimeType$a,
30697     languageId: languageId$e,
30698     'default': JSON5
30699   });
30700
30701   var require$$0$6 = getCjsExportFromNamespace(JavaScript$1);
30702
30703   var require$$1$2 = getCjsExportFromNamespace(JSX$1);
30704
30705   var require$$2$1 = getCjsExportFromNamespace(TypeScript$1);
30706
30707   var require$$3$1 = getCjsExportFromNamespace(TSX$1);
30708
30709   var require$$4 = getCjsExportFromNamespace(_JSON$1);
30710
30711   var require$$5 = getCjsExportFromNamespace(JSON_with_Comments$1);
30712
30713   var require$$6 = getCjsExportFromNamespace(JSON5$1);
30714
30715   const languages$4 = [createLanguage(require$$0$6, data => ({
30716     since: "0.0.0",
30717     parsers: ["babel", "flow"],
30718     vscodeLanguageIds: ["javascript", "mongo"],
30719     interpreters: data.interpreters.concat(["nodejs"])
30720   })), createLanguage(require$$0$6, () => ({
30721     name: "Flow",
30722     since: "0.0.0",
30723     parsers: ["babel", "flow"],
30724     vscodeLanguageIds: ["javascript"],
30725     aliases: [],
30726     filenames: [],
30727     extensions: [".js.flow"]
30728   })), createLanguage(require$$1$2, () => ({
30729     since: "0.0.0",
30730     parsers: ["babel", "flow"],
30731     vscodeLanguageIds: ["javascriptreact"]
30732   })), createLanguage(require$$2$1, () => ({
30733     since: "1.4.0",
30734     parsers: ["typescript", "babel-ts"],
30735     vscodeLanguageIds: ["typescript"]
30736   })), createLanguage(require$$3$1, () => ({
30737     since: "1.4.0",
30738     parsers: ["typescript", "babel-ts"],
30739     vscodeLanguageIds: ["typescriptreact"]
30740   })), createLanguage(require$$4, () => ({
30741     name: "JSON.stringify",
30742     since: "1.13.0",
30743     parsers: ["json-stringify"],
30744     vscodeLanguageIds: ["json"],
30745     extensions: [],
30746     // .json file defaults to json instead of json-stringify
30747     filenames: ["package.json", "package-lock.json", "composer.json"]
30748   })), createLanguage(require$$4, data => ({
30749     since: "1.5.0",
30750     parsers: ["json"],
30751     vscodeLanguageIds: ["json"],
30752     filenames: data.filenames.concat([".prettierrc"])
30753   })), createLanguage(require$$5, data => ({
30754     since: "1.5.0",
30755     parsers: ["json"],
30756     vscodeLanguageIds: ["jsonc"],
30757     filenames: data.filenames.concat([".eslintrc"])
30758   })), createLanguage(require$$6, () => ({
30759     since: "1.13.0",
30760     parsers: ["json5"],
30761     vscodeLanguageIds: ["json5"]
30762   }))];
30763   const printers$4 = {
30764     estree: printerEstree,
30765     "estree-json": printerEstreeJson
30766   };
30767   var languageJs = {
30768     languages: languages$4,
30769     options: options$5,
30770     printers: printers$4
30771   };
30772
30773   var json$1 = {
30774     "cjkPattern": "[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u3000-\\u303f\\u3041-\\u3096\\u3099-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u3191\\u3196-\\u31ba\\u31c0-\\u31e3\\u31f0-\\u321e\\u322a-\\u3247\\u3260-\\u327e\\u328a-\\u32b0\\u32c0-\\u32cb\\u32d0-\\u3370\\u337b-\\u337f\\u33e0-\\u33fe\\u3400-\\u4db5\\u4e00-\\u9fef\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufe10-\\ufe1f\\ufe30-\\ufe6f\\uff00-\\uffef]|[\\ud840-\\ud868\\ud86a-\\ud86c\\ud86f-\\ud872\\ud874-\\ud879][\\udc00-\\udfff]|\\ud82c[\\udc00-\\udd1e\\udd50-\\udd52\\udd64-\\udd67]|\\ud83c[\\ude00\\ude50-\\ude51]|\\ud869[\\udc00-\\uded6\\udf00-\\udfff]|\\ud86d[\\udc00-\\udf34\\udf40-\\udfff]|\\ud86e[\\udc00-\\udc1d\\udc20-\\udfff]|\\ud873[\\udc00-\\udea1\\udeb0-\\udfff]|\\ud87a[\\udc00-\\udfe0]|\\ud87e[\\udc00-\\ude1d]",
30775     "kPattern": "[\\u1100-\\u11ff\\u3001-\\u3003\\u3008-\\u3011\\u3013-\\u301f\\u302e-\\u3030\\u3037\\u30fb\\u3131-\\u318e\\u3200-\\u321e\\u3260-\\u327e\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\ufe45-\\ufe46\\uff61-\\uff65\\uffa0-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc]",
30776     "punctuationPattern": "[\\u0021-\\u002f\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007e\\u00a1\\u00a7\\u00ab\\u00b6-\\u00b7\\u00bb\\u00bf\\u037e\\u0387\\u055a-\\u055f\\u0589-\\u058a\\u05be\\u05c0\\u05c3\\u05c6\\u05f3-\\u05f4\\u0609-\\u060a\\u060c-\\u060d\\u061b\\u061e-\\u061f\\u066a-\\u066d\\u06d4\\u0700-\\u070d\\u07f7-\\u07f9\\u0830-\\u083e\\u085e\\u0964-\\u0965\\u0970\\u09fd\\u0a76\\u0af0\\u0c77\\u0c84\\u0df4\\u0e4f\\u0e5a-\\u0e5b\\u0f04-\\u0f12\\u0f14\\u0f3a-\\u0f3d\\u0f85\\u0fd0-\\u0fd4\\u0fd9-\\u0fda\\u104a-\\u104f\\u10fb\\u1360-\\u1368\\u1400\\u166e\\u169b-\\u169c\\u16eb-\\u16ed\\u1735-\\u1736\\u17d4-\\u17d6\\u17d8-\\u17da\\u1800-\\u180a\\u1944-\\u1945\\u1a1e-\\u1a1f\\u1aa0-\\u1aa6\\u1aa8-\\u1aad\\u1b5a-\\u1b60\\u1bfc-\\u1bff\\u1c3b-\\u1c3f\\u1c7e-\\u1c7f\\u1cc0-\\u1cc7\\u1cd3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205e\\u207d-\\u207e\\u208d-\\u208e\\u2308-\\u230b\\u2329-\\u232a\\u2768-\\u2775\\u27c5-\\u27c6\\u27e6-\\u27ef\\u2983-\\u2998\\u29d8-\\u29db\\u29fc-\\u29fd\\u2cf9-\\u2cfc\\u2cfe-\\u2cff\\u2d70\\u2e00-\\u2e2e\\u2e30-\\u2e4f\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301f\\u3030\\u303d\\u30a0\\u30fb\\ua4fe-\\ua4ff\\ua60d-\\ua60f\\ua673\\ua67e\\ua6f2-\\ua6f7\\ua874-\\ua877\\ua8ce-\\ua8cf\\ua8f8-\\ua8fa\\ua8fc\\ua92e-\\ua92f\\ua95f\\ua9c1-\\ua9cd\\ua9de-\\ua9df\\uaa5c-\\uaa5f\\uaade-\\uaadf\\uaaf0-\\uaaf1\\uabeb\\ufd3e-\\ufd3f\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe61\\ufe63\\ufe68\\ufe6a-\\ufe6b\\uff01-\\uff03\\uff05-\\uff0a\\uff0c-\\uff0f\\uff1a-\\uff1b\\uff1f-\\uff20\\uff3b-\\uff3d\\uff3f\\uff5b\\uff5d\\uff5f-\\uff65]|\\ud800[\\udd00-\\udd02\\udf9f\\udfd0]|\\ud801[\\udd6f]|\\ud802[\\udc57\\udd1f\\udd3f\\ude50-\\ude58\\ude7f\\udef0-\\udef6\\udf39-\\udf3f\\udf99-\\udf9c]|\\ud803[\\udf55-\\udf59]|\\ud804[\\udc47-\\udc4d\\udcbb-\\udcbc\\udcbe-\\udcc1\\udd40-\\udd43\\udd74-\\udd75\\uddc5-\\uddc8\\uddcd\\udddb\\udddd-\\udddf\\ude38-\\ude3d\\udea9]|\\ud805[\\udc4b-\\udc4f\\udc5b\\udc5d\\udcc6\\uddc1-\\uddd7\\ude41-\\ude43\\ude60-\\ude6c\\udf3c-\\udf3e]|\\ud806[\\udc3b\\udde2\\ude3f-\\ude46\\ude9a-\\ude9c\\ude9e-\\udea2]|\\ud807[\\udc41-\\udc45\\udc70-\\udc71\\udef7-\\udef8\\udfff]|\\ud809[\\udc70-\\udc74]|\\ud81a[\\ude6e-\\ude6f\\udef5\\udf37-\\udf3b\\udf44]|\\ud81b[\\ude97-\\ude9a\\udfe2]|\\ud82f[\\udc9f]|\\ud836[\\ude87-\\ude8b]|\\ud83a[\\udd5e-\\udd5f]"
30777   };
30778
30779   const {
30780     cjkPattern,
30781     kPattern,
30782     punctuationPattern
30783   } = json$1;
30784   const {
30785     getLast: getLast$4
30786   } = util$1;
30787   const INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "strong", "delete", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
30788   const INLINE_NODE_WRAPPER_TYPES = INLINE_NODE_TYPES.concat(["tableCell", "paragraph", "heading"]);
30789   const kRegex = new RegExp(kPattern);
30790   const punctuationRegex = new RegExp(punctuationPattern);
30791   /**
30792    * split text into whitespaces and words
30793    * @param {string} text
30794    * @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
30795    */
30796
30797   function splitText(text, options) {
30798     const KIND_NON_CJK = "non-cjk";
30799     const KIND_CJ_LETTER = "cj-letter";
30800     const KIND_K_LETTER = "k-letter";
30801     const KIND_CJK_PUNCTUATION = "cjk-punctuation";
30802     const nodes = [];
30803     (options.proseWrap === "preserve" ? text : text.replace(new RegExp("(".concat(cjkPattern, ")\n(").concat(cjkPattern, ")"), "g"), "$1$2")).split(/([ \t\n]+)/).forEach((token, index, tokens) => {
30804       // whitespace
30805       if (index % 2 === 1) {
30806         nodes.push({
30807           type: "whitespace",
30808           value: /\n/.test(token) ? "\n" : " "
30809         });
30810         return;
30811       } // word separated by whitespace
30812
30813
30814       if ((index === 0 || index === tokens.length - 1) && token === "") {
30815         return;
30816       }
30817
30818       token.split(new RegExp("(".concat(cjkPattern, ")"))).forEach((innerToken, innerIndex, innerTokens) => {
30819         if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") {
30820           return;
30821         } // non-CJK word
30822
30823
30824         if (innerIndex % 2 === 0) {
30825           if (innerToken !== "") {
30826             appendNode({
30827               type: "word",
30828               value: innerToken,
30829               kind: KIND_NON_CJK,
30830               hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
30831               hasTrailingPunctuation: punctuationRegex.test(getLast$4(innerToken))
30832             });
30833           }
30834
30835           return;
30836         } // CJK character
30837
30838
30839         appendNode(punctuationRegex.test(innerToken) ? {
30840           type: "word",
30841           value: innerToken,
30842           kind: KIND_CJK_PUNCTUATION,
30843           hasLeadingPunctuation: true,
30844           hasTrailingPunctuation: true
30845         } : {
30846           type: "word",
30847           value: innerToken,
30848           kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER,
30849           hasLeadingPunctuation: false,
30850           hasTrailingPunctuation: false
30851         });
30852       });
30853     });
30854     return nodes;
30855
30856     function appendNode(node) {
30857       const lastNode = getLast$4(nodes);
30858
30859       if (lastNode && lastNode.type === "word") {
30860         if (lastNode.kind === KIND_NON_CJK && node.kind === KIND_CJ_LETTER && !lastNode.hasTrailingPunctuation || lastNode.kind === KIND_CJ_LETTER && node.kind === KIND_NON_CJK && !node.hasLeadingPunctuation) {
30861           nodes.push({
30862             type: "whitespace",
30863             value: " "
30864           });
30865         } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && // disallow leading/trailing full-width whitespace
30866         ![lastNode.value, node.value].some(value => /\u3000/.test(value))) {
30867           nodes.push({
30868             type: "whitespace",
30869             value: ""
30870           });
30871         }
30872       }
30873
30874       nodes.push(node);
30875
30876       function isBetween(kind1, kind2) {
30877         return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1;
30878       }
30879     }
30880   }
30881
30882   function getOrderedListItemInfo(orderListItem, originalText) {
30883     const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/);
30884     return {
30885       numberText,
30886       marker,
30887       leadingSpaces
30888     };
30889   }
30890
30891   function hasGitDiffFriendlyOrderedList(node, options) {
30892     if (!node.ordered) {
30893       return false;
30894     }
30895
30896     if (node.children.length < 2) {
30897       return false;
30898     }
30899
30900     const firstNumber = Number(getOrderedListItemInfo(node.children[0], options.originalText).numberText);
30901     const secondNumber = Number(getOrderedListItemInfo(node.children[1], options.originalText).numberText);
30902
30903     if (firstNumber === 0 && node.children.length > 2) {
30904       const thirdNumber = Number(getOrderedListItemInfo(node.children[2], options.originalText).numberText);
30905       return secondNumber === 1 && thirdNumber === 1;
30906     }
30907
30908     return secondNumber === 1;
30909   } // workaround for https://github.com/remarkjs/remark/issues/351
30910   // leading and trailing newlines are stripped by remark
30911
30912
30913   function getFencedCodeBlockValue(node, originalText) {
30914     const text = originalText.slice(node.position.start.offset, node.position.end.offset);
30915     const leadingSpaceCount = text.match(/^\s*/)[0].length;
30916     const replaceRegex = new RegExp("^\\s{0,".concat(leadingSpaceCount, "}"));
30917     const lineContents = text.split("\n");
30918     const markerStyle = text[leadingSpaceCount]; // ` or ~
30919
30920     const marker = text.slice(leadingSpaceCount).match(new RegExp("^[".concat(markerStyle, "]+")))[0]; // https://spec.commonmark.org/0.28/#example-104: Closing fences may be indented by 0-3 spaces
30921     // https://spec.commonmark.org/0.28/#example-93: The closing code fence must be at least as long as the opening fence
30922
30923     const hasEndMarker = new RegExp("^\\s{0,3}".concat(marker)).test(lineContents[lineContents.length - 1].slice(getIndent(lineContents.length - 1)));
30924     return lineContents.slice(1, hasEndMarker ? -1 : undefined).map((x, i) => x.slice(getIndent(i + 1)).replace(replaceRegex, "")).join("\n");
30925
30926     function getIndent(lineIndex) {
30927       return node.position.indent[lineIndex - 1] - 1;
30928     }
30929   }
30930
30931   function mapAst(ast, handler) {
30932     return function preorder(node, index, parentStack) {
30933       parentStack = parentStack || [];
30934       const newNode = Object.assign({}, handler(node, index, parentStack));
30935
30936       if (newNode.children) {
30937         newNode.children = newNode.children.map((child, index) => {
30938           return preorder(child, index, [newNode].concat(parentStack));
30939         });
30940       }
30941
30942       return newNode;
30943     }(ast, null, null);
30944   }
30945
30946   var utils$6 = {
30947     mapAst,
30948     splitText,
30949     punctuationPattern,
30950     getFencedCodeBlockValue,
30951     getOrderedListItemInfo,
30952     hasGitDiffFriendlyOrderedList,
30953     INLINE_NODE_TYPES,
30954     INLINE_NODE_WRAPPER_TYPES
30955   };
30956
30957   const {
30958     builders: {
30959       hardline: hardline$b,
30960       literalline: literalline$5,
30961       concat: concat$f,
30962       markAsRoot: markAsRoot$3
30963     },
30964     utils: {
30965       mapDoc: mapDoc$4
30966     }
30967   } = document;
30968   const {
30969     getFencedCodeBlockValue: getFencedCodeBlockValue$1
30970   } = utils$6;
30971
30972   function embed$4(path, print, textToDoc, options) {
30973     const node = path.getValue();
30974
30975     if (node.type === "code" && node.lang !== null) {
30976       // only look for the first string so as to support [markdown-preview-enhanced](https://shd101wyy.github.io/markdown-preview-enhanced/#/code-chunk)
30977       const langMatch = node.lang.match(/^[A-Za-z0-9_-]+/);
30978       const lang = langMatch ? langMatch[0] : "";
30979       const parser = getParserName(lang);
30980
30981       if (parser) {
30982         const styleUnit = options.__inJsTemplate ? "~" : "`";
30983         const style = styleUnit.repeat(Math.max(3, util$1.getMaxContinuousCount(node.value, styleUnit) + 1));
30984         const doc = textToDoc(getFencedCodeBlockValue$1(node, options.originalText), {
30985           parser
30986         });
30987         return markAsRoot$3(concat$f([style, node.lang, hardline$b, replaceNewlinesWithLiterallines(doc), style]));
30988       }
30989     }
30990
30991     if (node.type === "yaml") {
30992       return markAsRoot$3(concat$f(["---", hardline$b, node.value && node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, {
30993         parser: "yaml"
30994       })) : "", "---"]));
30995     } // MDX
30996
30997
30998     switch (node.type) {
30999       case "importExport":
31000         return textToDoc(node.value, {
31001           parser: "babel"
31002         });
31003
31004       case "jsx":
31005         return textToDoc("<$>".concat(node.value, "</$>"), {
31006           parser: "__js_expression",
31007           rootMarker: "mdx"
31008         });
31009     }
31010
31011     return null;
31012
31013     function getParserName(lang) {
31014       const supportInfo = support.getSupportInfo({
31015         plugins: options.plugins
31016       });
31017       const language = supportInfo.languages.find(language => language.name.toLowerCase() === lang || language.aliases && language.aliases.includes(lang) || language.extensions && language.extensions.find(ext => ext === ".".concat(lang)));
31018
31019       if (language) {
31020         return language.parsers[0];
31021       }
31022
31023       return null;
31024     }
31025
31026     function replaceNewlinesWithLiterallines(doc) {
31027       return mapDoc$4(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$f(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$5)) : currentDoc);
31028     }
31029   }
31030
31031   var embed_1$2 = embed$4;
31032
31033   const pragmas = ["format", "prettier"];
31034
31035   function startWithPragma(text) {
31036     const pragma = "@(".concat(pragmas.join("|"), ")");
31037     const regex = new RegExp(["<!--\\s*".concat(pragma, "\\s*-->"), "<!--.*\r?\n[\\s\\S]*(^|\n)[^\\S\n]*".concat(pragma, "[^\\S\n]*($|\n)[\\s\\S]*\n.*-->")].join("|"), "m");
31038     const matched = text.match(regex);
31039     return matched && matched.index === 0;
31040   }
31041
31042   var pragma$4 = {
31043     startWithPragma,
31044     hasPragma: text => startWithPragma(frontMatter(text).content.trimStart()),
31045     insertPragma: text => {
31046       const extracted = frontMatter(text);
31047       const pragma = "<!-- @".concat(pragmas[0], " -->");
31048       return extracted.frontMatter ? "".concat(extracted.frontMatter.raw, "\n\n").concat(pragma, "\n\n").concat(extracted.content) : "".concat(pragma, "\n\n").concat(extracted.content);
31049     }
31050   };
31051
31052   const {
31053     getOrderedListItemInfo: getOrderedListItemInfo$1,
31054     mapAst: mapAst$1,
31055     splitText: splitText$1
31056   } = utils$6; // 0x0 ~ 0x10ffff
31057   // eslint-disable-next-line no-control-regex
31058
31059   const isSingleCharRegex = /^([\u0000-\uffff]|[\ud800-\udbff][\udc00-\udfff])$/;
31060
31061   function preprocess$2(ast, options) {
31062     ast = restoreUnescapedCharacter(ast, options);
31063     ast = mergeContinuousTexts(ast);
31064     ast = transformInlineCode(ast);
31065     ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
31066     ast = markAlignedList(ast, options);
31067     ast = splitTextIntoSentences(ast, options);
31068     ast = transformImportExport(ast);
31069     ast = mergeContinuousImportExport(ast);
31070     return ast;
31071   }
31072
31073   function transformImportExport(ast) {
31074     return mapAst$1(ast, node => {
31075       if (node.type !== "import" && node.type !== "export") {
31076         return node;
31077       }
31078
31079       return Object.assign({}, node, {
31080         type: "importExport"
31081       });
31082     });
31083   }
31084
31085   function transformInlineCode(ast) {
31086     return mapAst$1(ast, node => {
31087       if (node.type !== "inlineCode") {
31088         return node;
31089       }
31090
31091       return Object.assign({}, node, {
31092         value: node.value.replace(/\s+/g, " ")
31093       });
31094     });
31095   }
31096
31097   function restoreUnescapedCharacter(ast, options) {
31098     return mapAst$1(ast, node => {
31099       return node.type !== "text" ? node : Object.assign({}, node, {
31100         value: node.value !== "*" && node.value !== "_" && node.value !== "$" && // handle these cases in printer
31101         isSingleCharRegex.test(node.value) && node.position.end.offset - node.position.start.offset !== node.value.length ? options.originalText.slice(node.position.start.offset, node.position.end.offset) : node.value
31102       });
31103     });
31104   }
31105
31106   function mergeContinuousImportExport(ast) {
31107     return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({
31108       type: "importExport",
31109       value: prevNode.value + "\n\n" + node.value,
31110       position: {
31111         start: prevNode.position.start,
31112         end: node.position.end
31113       }
31114     }));
31115   }
31116
31117   function mergeChildren(ast, shouldMerge, mergeNode) {
31118     return mapAst$1(ast, node => {
31119       if (!node.children) {
31120         return node;
31121       }
31122
31123       const children = node.children.reduce((current, child) => {
31124         const lastChild = current[current.length - 1];
31125
31126         if (lastChild && shouldMerge(lastChild, child)) {
31127           current.splice(-1, 1, mergeNode(lastChild, child));
31128         } else {
31129           current.push(child);
31130         }
31131
31132         return current;
31133       }, []);
31134       return Object.assign({}, node, {
31135         children
31136       });
31137     });
31138   }
31139
31140   function mergeContinuousTexts(ast) {
31141     return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({
31142       type: "text",
31143       value: prevNode.value + node.value,
31144       position: {
31145         start: prevNode.position.start,
31146         end: node.position.end
31147       }
31148     }));
31149   }
31150
31151   function splitTextIntoSentences(ast, options) {
31152     return mapAst$1(ast, (node, index, [parentNode]) => {
31153       if (node.type !== "text") {
31154         return node;
31155       }
31156
31157       let {
31158         value
31159       } = node;
31160
31161       if (parentNode.type === "paragraph") {
31162         if (index === 0) {
31163           value = value.trimStart();
31164         }
31165
31166         if (index === parentNode.children.length - 1) {
31167           value = value.trimEnd();
31168         }
31169       }
31170
31171       return {
31172         type: "sentence",
31173         position: node.position,
31174         children: splitText$1(value, options)
31175       };
31176     });
31177   }
31178
31179   function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
31180     return mapAst$1(ast, (node, index, parentStack) => {
31181       if (node.type === "code") {
31182         // the first char may point to `\n`, e.g. `\n\t\tbar`, just ignore it
31183         const isIndented = /^\n?( {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset));
31184         node.isIndented = isIndented;
31185
31186         if (isIndented) {
31187           for (let i = 0; i < parentStack.length; i++) {
31188             const parent = parentStack[i]; // no need to check checked items
31189
31190             if (parent.hasIndentedCodeblock) {
31191               break;
31192             }
31193
31194             if (parent.type === "list") {
31195               parent.hasIndentedCodeblock = true;
31196             }
31197           }
31198         }
31199       }
31200
31201       return node;
31202     });
31203   }
31204
31205   function markAlignedList(ast, options) {
31206     return mapAst$1(ast, (node, index, parentStack) => {
31207       if (node.type === "list" && node.children.length !== 0) {
31208         // if one of its parents is not aligned, it's not possible to be aligned in sub-lists
31209         for (let i = 0; i < parentStack.length; i++) {
31210           const parent = parentStack[i];
31211
31212           if (parent.type === "list" && !parent.isAligned) {
31213             node.isAligned = false;
31214             return node;
31215           }
31216         }
31217
31218         node.isAligned = isAligned(node);
31219       }
31220
31221       return node;
31222     });
31223
31224     function getListItemStart(listItem) {
31225       return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1;
31226     }
31227
31228     function isAligned(list) {
31229       if (!list.ordered) {
31230         /**
31231          * - 123
31232          * - 123
31233          */
31234         return true;
31235       }
31236
31237       const [firstItem, secondItem] = list.children;
31238       const firstInfo = getOrderedListItemInfo$1(firstItem, options.originalText);
31239
31240       if (firstInfo.leadingSpaces.length > 1) {
31241         /**
31242          * 1.   123
31243          *
31244          * 1.   123
31245          * 1. 123
31246          */
31247         return true;
31248       }
31249
31250       const firstStart = getListItemStart(firstItem);
31251
31252       if (firstStart === -1) {
31253         /**
31254          * 1.
31255          *
31256          * 1.
31257          * 1.
31258          */
31259         return false;
31260       }
31261
31262       if (list.children.length === 1) {
31263         /**
31264          * aligned:
31265          *
31266          * 11. 123
31267          *
31268          * not aligned:
31269          *
31270          * 1. 123
31271          */
31272         return firstStart % options.tabWidth === 0;
31273       }
31274
31275       const secondStart = getListItemStart(secondItem);
31276
31277       if (firstStart !== secondStart) {
31278         /**
31279          * 11. 123
31280          * 1. 123
31281          *
31282          * 1. 123
31283          * 11. 123
31284          */
31285         return false;
31286       }
31287
31288       if (firstStart % options.tabWidth === 0) {
31289         /**
31290          * 11. 123
31291          * 12. 123
31292          */
31293         return true;
31294       }
31295       /**
31296        * aligned:
31297        *
31298        * 11. 123
31299        * 1.  123
31300        *
31301        * not aligned:
31302        *
31303        * 1. 123
31304        * 2. 123
31305        */
31306
31307
31308       const secondInfo = getOrderedListItemInfo$1(secondItem, options.originalText);
31309       return secondInfo.leadingSpaces.length > 1;
31310     }
31311   }
31312
31313   var preprocess_1$2 = preprocess$2;
31314
31315   const {
31316     builders: {
31317       breakParent: breakParent$4,
31318       concat: concat$g,
31319       join: join$b,
31320       line: line$a,
31321       literalline: literalline$6,
31322       markAsRoot: markAsRoot$4,
31323       hardline: hardline$c,
31324       softline: softline$7,
31325       ifBreak: ifBreak$7,
31326       fill: fill$5,
31327       align: align$2,
31328       indent: indent$9,
31329       group: group$f
31330     },
31331     utils: {
31332       mapDoc: mapDoc$5
31333     },
31334     printer: {
31335       printDocToString: printDocToString$3
31336     }
31337   } = document;
31338   const {
31339     getFencedCodeBlockValue: getFencedCodeBlockValue$2,
31340     hasGitDiffFriendlyOrderedList: hasGitDiffFriendlyOrderedList$1,
31341     splitText: splitText$2,
31342     punctuationPattern: punctuationPattern$1,
31343     INLINE_NODE_TYPES: INLINE_NODE_TYPES$1,
31344     INLINE_NODE_WRAPPER_TYPES: INLINE_NODE_WRAPPER_TYPES$1
31345   } = utils$6;
31346   const {
31347     replaceEndOfLineWith: replaceEndOfLineWith$2
31348   } = util$1;
31349   const TRAILING_HARDLINE_NODES = ["importExport"];
31350   const SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link"];
31351   const SIBLING_NODE_TYPES = ["listItem", "definition", "footnoteDefinition"];
31352
31353   function genericPrint$5(path, options, print) {
31354     const node = path.getValue();
31355
31356     if (shouldRemainTheSameContent(path)) {
31357       return concat$g(splitText$2(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map(node => node.type === "word" ? node.value : node.value === "" ? "" : printLine(path, node.value, options)));
31358     }
31359
31360     switch (node.type) {
31361       case "root":
31362         if (node.children.length === 0) {
31363           return "";
31364         }
31365
31366         return concat$g([normalizeDoc(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.includes(getLastDescendantNode(node).type) ? hardline$c : ""]);
31367
31368       case "paragraph":
31369         return printChildren$2(path, options, print, {
31370           postprocessor: fill$5
31371         });
31372
31373       case "sentence":
31374         return printChildren$2(path, options, print);
31375
31376       case "word":
31377         return node.value.replace(/[*$]/g, "\\$&") // escape all `*` and `$` (math)
31378         .replace(new RegExp(["(^|".concat(punctuationPattern$1, ")(_+)"), "(_+)(".concat(punctuationPattern$1, "|$)")].join("|"), "g"), (_, text1, underscore1, underscore2, text2) => (underscore1 ? "".concat(text1).concat(underscore1) : "".concat(underscore2).concat(text2)).replace(/_/g, "\\_"));
31379       // escape all `_` except concating with non-punctuation, e.g. `1_2_3` is not considered emphasis
31380
31381       case "whitespace":
31382         {
31383           const parentNode = path.getParentNode();
31384           const index = parentNode.children.indexOf(node);
31385           const nextNode = parentNode.children[index + 1];
31386           const proseWrap = // leading char that may cause different syntax
31387           nextNode && /^>|^([-+*]|#{1,6}|[0-9]+[.)])$/.test(nextNode.value) ? "never" : options.proseWrap;
31388           return printLine(path, node.value, {
31389             proseWrap
31390           });
31391         }
31392
31393       case "emphasis":
31394         {
31395           const parentNode = path.getParentNode();
31396           const index = parentNode.children.indexOf(node);
31397           const prevNode = parentNode.children[index - 1];
31398           const nextNode = parentNode.children[index + 1];
31399           const hasPrevOrNextWord = // `1*2*3` is considered emphasis but `1_2_3` is not
31400           prevNode && prevNode.type === "sentence" && prevNode.children.length > 0 && util$1.getLast(prevNode.children).type === "word" && !util$1.getLast(prevNode.children).hasTrailingPunctuation || nextNode && nextNode.type === "sentence" && nextNode.children.length > 0 && nextNode.children[0].type === "word" && !nextNode.children[0].hasLeadingPunctuation;
31401           const style = hasPrevOrNextWord || getAncestorNode$2(path, "emphasis") ? "*" : "_";
31402           return concat$g([style, printChildren$2(path, options, print), style]);
31403         }
31404
31405       case "strong":
31406         return concat$g(["**", printChildren$2(path, options, print), "**"]);
31407
31408       case "delete":
31409         return concat$g(["~~", printChildren$2(path, options, print), "~~"]);
31410
31411       case "inlineCode":
31412         {
31413           const backtickCount = util$1.getMinNotPresentContinuousCount(node.value, "`");
31414           const style = "`".repeat(backtickCount || 1);
31415           const gap = backtickCount ? " " : "";
31416           return concat$g([style, gap, node.value, gap, style]);
31417         }
31418
31419       case "link":
31420         switch (options.originalText[node.position.start.offset]) {
31421           case "<":
31422             {
31423               const mailto = "mailto:";
31424               const url = // <hello@example.com> is parsed as { url: "mailto:hello@example.com" }
31425               node.url.startsWith(mailto) && options.originalText.slice(node.position.start.offset + 1, node.position.start.offset + 1 + mailto.length) !== mailto ? node.url.slice(mailto.length) : node.url;
31426               return concat$g(["<", url, ">"]);
31427             }
31428
31429           case "[":
31430             return concat$g(["[", printChildren$2(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
31431
31432           default:
31433             return options.originalText.slice(node.position.start.offset, node.position.end.offset);
31434         }
31435
31436       case "image":
31437         return concat$g(["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
31438
31439       case "blockquote":
31440         return concat$g(["> ", align$2("> ", printChildren$2(path, options, print))]);
31441
31442       case "heading":
31443         return concat$g(["#".repeat(node.depth) + " ", printChildren$2(path, options, print)]);
31444
31445       case "code":
31446         {
31447           if (node.isIndented) {
31448             // indented code block
31449             const alignment = " ".repeat(4);
31450             return align$2(alignment, concat$g([alignment, concat$g(replaceEndOfLineWith$2(node.value, hardline$c))]));
31451           } // fenced code block
31452
31453
31454           const styleUnit = options.__inJsTemplate ? "~" : "`";
31455           const style = styleUnit.repeat(Math.max(3, util$1.getMaxContinuousCount(node.value, styleUnit) + 1));
31456           return concat$g([style, node.lang || "", hardline$c, concat$g(replaceEndOfLineWith$2(getFencedCodeBlockValue$2(node, options.originalText), hardline$c)), hardline$c, style]);
31457         }
31458
31459       case "yaml":
31460       case "toml":
31461         return options.originalText.slice(node.position.start.offset, node.position.end.offset);
31462
31463       case "html":
31464         {
31465           const parentNode = path.getParentNode();
31466           const value = parentNode.type === "root" && util$1.getLast(parentNode.children) === node ? node.value.trimEnd() : node.value;
31467           const isHtmlComment = /^<!--[\s\S]*-->$/.test(value);
31468           return concat$g(replaceEndOfLineWith$2(value, isHtmlComment ? hardline$c : markAsRoot$4(literalline$6)));
31469         }
31470
31471       case "list":
31472         {
31473           const nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
31474           const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList$1(node, options);
31475           return printChildren$2(path, options, print, {
31476             processor: (childPath, index) => {
31477               const prefix = getPrefix();
31478               const childNode = childPath.getValue();
31479
31480               if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) {
31481                 return concat$g([prefix, printListItem(childPath, options, print, prefix)]);
31482               }
31483
31484               return concat$g([prefix, align$2(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))]);
31485
31486               function getPrefix() {
31487                 const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
31488                 return node.isAligned ||
31489                 /* workaround for https://github.com/remarkjs/remark/issues/315 */
31490                 node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
31491               }
31492             }
31493           });
31494         }
31495
31496       case "thematicBreak":
31497         {
31498           const counter = getAncestorCounter$1(path, "list");
31499
31500           if (counter === -1) {
31501             return "---";
31502           }
31503
31504           const nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1));
31505           return nthSiblingIndex % 2 === 0 ? "***" : "---";
31506         }
31507
31508       case "linkReference":
31509         return concat$g(["[", printChildren$2(path, options, print), "]", node.referenceType === "full" ? concat$g(["[", node.identifier, "]"]) : node.referenceType === "collapsed" ? "[]" : ""]);
31510
31511       case "imageReference":
31512         switch (node.referenceType) {
31513           case "full":
31514             return concat$g(["![", node.alt || "", "][", node.identifier, "]"]);
31515
31516           default:
31517             return concat$g(["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""]);
31518         }
31519
31520       case "definition":
31521         {
31522           const lineOrSpace = options.proseWrap === "always" ? line$a : " ";
31523           return group$f(concat$g([concat$g(["[", node.identifier, "]:"]), indent$9(concat$g([lineOrSpace, printUrl(node.url), node.title === null ? "" : concat$g([lineOrSpace, printTitle(node.title, options, false)])]))]));
31524         }
31525
31526       case "footnote":
31527         return concat$g(["[^", printChildren$2(path, options, print), "]"]);
31528
31529       case "footnoteReference":
31530         return concat$g(["[^", node.identifier, "]"]);
31531
31532       case "footnoteDefinition":
31533         {
31534           const nextNode = path.getParentNode().children[path.getName() + 1];
31535           const shouldInlineFootnote = node.children.length === 1 && node.children[0].type === "paragraph" && (options.proseWrap === "never" || options.proseWrap === "preserve" && node.children[0].position.start.line === node.children[0].position.end.line);
31536           return concat$g(["[^", node.identifier, "]: ", shouldInlineFootnote ? printChildren$2(path, options, print) : group$f(concat$g([align$2(" ".repeat(options.tabWidth), printChildren$2(path, options, print, {
31537             processor: (childPath, index) => {
31538               return index === 0 ? group$f(concat$g([softline$7, childPath.call(print)])) : childPath.call(print);
31539             }
31540           })), nextNode && nextNode.type === "footnoteDefinition" ? softline$7 : ""]))]);
31541         }
31542
31543       case "table":
31544         return printTable(path, options, print);
31545
31546       case "tableCell":
31547         return printChildren$2(path, options, print);
31548
31549       case "break":
31550         return /\s/.test(options.originalText[node.position.start.offset]) ? concat$g(["  ", markAsRoot$4(literalline$6)]) : concat$g(["\\", hardline$c]);
31551
31552       case "liquidNode":
31553         return concat$g(replaceEndOfLineWith$2(node.value, hardline$c));
31554       // MDX
31555
31556       case "importExport":
31557       case "jsx":
31558         return node.value;
31559       // fallback to the original text if multiparser failed
31560
31561       case "math":
31562         return concat$g(["$$", hardline$c, node.value ? concat$g([concat$g(replaceEndOfLineWith$2(node.value, hardline$c)), hardline$c]) : "", "$$"]);
31563
31564       case "inlineMath":
31565         {
31566           // remark-math trims content but we don't want to remove whitespaces
31567           // since it's very possible that it's recognized as math accidentally
31568           return options.originalText.slice(options.locStart(node), options.locEnd(node));
31569         }
31570
31571       case "tableRow": // handled in "table"
31572
31573       case "listItem": // handled in "list"
31574
31575       default:
31576         throw new Error("Unknown markdown type ".concat(JSON.stringify(node.type)));
31577     }
31578   }
31579
31580   function printListItem(path, options, print, listPrefix) {
31581     const node = path.getValue();
31582     const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
31583     return concat$g([prefix, printChildren$2(path, options, print, {
31584       processor: (childPath, index) => {
31585         if (index === 0 && childPath.getValue().type !== "list") {
31586           return align$2(" ".repeat(prefix.length), childPath.call(print));
31587         }
31588
31589         const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3) // 4+ will cause indented code block
31590         );
31591         return concat$g([alignment, align$2(alignment, childPath.call(print))]);
31592       }
31593     })]);
31594   }
31595
31596   function alignListPrefix(prefix, options) {
31597     const additionalSpaces = getAdditionalSpaces();
31598     return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces // 4+ will cause indented code block
31599     );
31600
31601     function getAdditionalSpaces() {
31602       const restSpaces = prefix.length % options.tabWidth;
31603       return restSpaces === 0 ? 0 : options.tabWidth - restSpaces;
31604     }
31605   }
31606
31607   function getNthListSiblingIndex(node, parentNode) {
31608     return getNthSiblingIndex(node, parentNode, siblingNode => siblingNode.ordered === node.ordered);
31609   }
31610
31611   function getNthSiblingIndex(node, parentNode, condition) {
31612     condition = condition || (() => true);
31613
31614     let index = -1;
31615
31616     for (const childNode of parentNode.children) {
31617       if (childNode.type === node.type && condition(childNode)) {
31618         index++;
31619       } else {
31620         index = -1;
31621       }
31622
31623       if (childNode === node) {
31624         return index;
31625       }
31626     }
31627   }
31628
31629   function getAncestorCounter$1(path, typeOrTypes) {
31630     const types = [].concat(typeOrTypes);
31631     let counter = -1;
31632     let ancestorNode;
31633
31634     while (ancestorNode = path.getParentNode(++counter)) {
31635       if (types.includes(ancestorNode.type)) {
31636         return counter;
31637       }
31638     }
31639
31640     return -1;
31641   }
31642
31643   function getAncestorNode$2(path, typeOrTypes) {
31644     const counter = getAncestorCounter$1(path, typeOrTypes);
31645     return counter === -1 ? null : path.getParentNode(counter);
31646   }
31647
31648   function printLine(path, value, options) {
31649     if (options.proseWrap === "preserve" && value === "\n") {
31650       return hardline$c;
31651     }
31652
31653     const isBreakable = options.proseWrap === "always" && !getAncestorNode$2(path, SINGLE_LINE_NODE_TYPES);
31654     return value !== "" ? isBreakable ? line$a : " " : isBreakable ? softline$7 : "";
31655   }
31656
31657   function printTable(path, options, print) {
31658     const hardlineWithoutBreakParent = hardline$c.parts[0];
31659     const node = path.getValue();
31660     const contents = []; // { [rowIndex: number]: { [columnIndex: number]: string } }
31661
31662     path.map(rowPath => {
31663       const rowContents = [];
31664       rowPath.map(cellPath => {
31665         rowContents.push(printDocToString$3(cellPath.call(print), options).formatted);
31666       }, "children");
31667       contents.push(rowContents);
31668     }, "children"); // Get the width of each column
31669
31670     const columnMaxWidths = contents.reduce((currentWidths, rowContents) => currentWidths.map((width, columnIndex) => Math.max(width, util$1.getStringWidth(rowContents[columnIndex]))), contents[0].map(() => 3) // minimum width = 3 (---, :--, :-:, --:)
31671     );
31672     const alignedTable = join$b(hardlineWithoutBreakParent, [printRow(contents[0]), printSeparator(), join$b(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents)))]);
31673
31674     if (options.proseWrap !== "never") {
31675       return concat$g([breakParent$4, alignedTable]);
31676     } // Only if the --prose-wrap never is set and it exceeds the print width.
31677
31678
31679     const compactTable = join$b(hardlineWithoutBreakParent, [printRow(contents[0],
31680     /* isCompact */
31681     true), printSeparator(
31682     /* isCompact */
31683     true), join$b(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents,
31684     /* isCompact */
31685     true)))]);
31686     return concat$g([breakParent$4, group$f(ifBreak$7(compactTable, alignedTable))]);
31687
31688     function printSeparator(isCompact) {
31689       return concat$g(["| ", join$b(" | ", columnMaxWidths.map((width, index) => {
31690         const spaces = isCompact ? 3 : width;
31691
31692         switch (node.align[index]) {
31693           case "left":
31694             return ":" + "-".repeat(spaces - 1);
31695
31696           case "right":
31697             return "-".repeat(spaces - 1) + ":";
31698
31699           case "center":
31700             return ":" + "-".repeat(spaces - 2) + ":";
31701
31702           default:
31703             return "-".repeat(spaces);
31704         }
31705       })), " |"]);
31706     }
31707
31708     function printRow(rowContents, isCompact) {
31709       return concat$g(["| ", join$b(" | ", isCompact ? rowContents : rowContents.map((rowContent, columnIndex) => {
31710         switch (node.align[columnIndex]) {
31711           case "right":
31712             return alignRight(rowContent, columnMaxWidths[columnIndex]);
31713
31714           case "center":
31715             return alignCenter(rowContent, columnMaxWidths[columnIndex]);
31716
31717           default:
31718             return alignLeft(rowContent, columnMaxWidths[columnIndex]);
31719         }
31720       })), " |"]);
31721     }
31722
31723     function alignLeft(text, width) {
31724       const spaces = width - util$1.getStringWidth(text);
31725       return concat$g([text, " ".repeat(spaces)]);
31726     }
31727
31728     function alignRight(text, width) {
31729       const spaces = width - util$1.getStringWidth(text);
31730       return concat$g([" ".repeat(spaces), text]);
31731     }
31732
31733     function alignCenter(text, width) {
31734       const spaces = width - util$1.getStringWidth(text);
31735       const left = Math.floor(spaces / 2);
31736       const right = spaces - left;
31737       return concat$g([" ".repeat(left), text, " ".repeat(right)]);
31738     }
31739   }
31740
31741   function printRoot(path, options, print) {
31742     /** @typedef {{ index: number, offset: number }} IgnorePosition */
31743
31744     /** @type {Array<{start: IgnorePosition, end: IgnorePosition}>} */
31745     const ignoreRanges = [];
31746     /** @type {IgnorePosition | null} */
31747
31748     let ignoreStart = null;
31749     const {
31750       children
31751     } = path.getValue();
31752     children.forEach((childNode, index) => {
31753       switch (isPrettierIgnore$1(childNode)) {
31754         case "start":
31755           if (ignoreStart === null) {
31756             ignoreStart = {
31757               index,
31758               offset: childNode.position.end.offset
31759             };
31760           }
31761
31762           break;
31763
31764         case "end":
31765           if (ignoreStart !== null) {
31766             ignoreRanges.push({
31767               start: ignoreStart,
31768               end: {
31769                 index,
31770                 offset: childNode.position.start.offset
31771               }
31772             });
31773             ignoreStart = null;
31774           }
31775
31776           break;
31777       }
31778     });
31779     return printChildren$2(path, options, print, {
31780       processor: (childPath, index) => {
31781         if (ignoreRanges.length !== 0) {
31782           const ignoreRange = ignoreRanges[0];
31783
31784           if (index === ignoreRange.start.index) {
31785             return concat$g([children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value]);
31786           }
31787
31788           if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
31789             return false;
31790           }
31791
31792           if (index === ignoreRange.end.index) {
31793             ignoreRanges.shift();
31794             return false;
31795           }
31796         }
31797
31798         return childPath.call(print);
31799       }
31800     });
31801   }
31802
31803   function printChildren$2(path, options, print, events) {
31804     events = events || {};
31805     const postprocessor = events.postprocessor || concat$g;
31806
31807     const processor = events.processor || (childPath => childPath.call(print));
31808
31809     const node = path.getValue();
31810     const parts = [];
31811     let lastChildNode;
31812     path.map((childPath, index) => {
31813       const childNode = childPath.getValue();
31814       const result = processor(childPath, index);
31815
31816       if (result !== false) {
31817         const data = {
31818           parts,
31819           prevNode: lastChildNode,
31820           parentNode: node,
31821           options
31822         };
31823
31824         if (!shouldNotPrePrintHardline(childNode, data)) {
31825           parts.push(hardline$c);
31826
31827           if (lastChildNode && TRAILING_HARDLINE_NODES.includes(lastChildNode.type)) {
31828             if (shouldPrePrintTripleHardline(childNode, data)) {
31829               parts.push(hardline$c);
31830             }
31831           } else {
31832             if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
31833               parts.push(hardline$c);
31834             }
31835
31836             if (shouldPrePrintTripleHardline(childNode, data)) {
31837               parts.push(hardline$c);
31838             }
31839           }
31840         }
31841
31842         parts.push(result);
31843         lastChildNode = childNode;
31844       }
31845     }, "children");
31846     return postprocessor(parts);
31847   }
31848
31849   function getLastDescendantNode(node) {
31850     let current = node;
31851
31852     while (current.children && current.children.length !== 0) {
31853       current = current.children[current.children.length - 1];
31854     }
31855
31856     return current;
31857   }
31858   /** @return {false | 'next' | 'start' | 'end'} */
31859
31860
31861   function isPrettierIgnore$1(node) {
31862     if (node.type !== "html") {
31863       return false;
31864     }
31865
31866     const match = node.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);
31867     return match === null ? false : match[1] ? match[1] : "next";
31868   }
31869
31870   function shouldNotPrePrintHardline(node, data) {
31871     const isFirstNode = data.parts.length === 0;
31872     const isInlineNode = INLINE_NODE_TYPES$1.includes(node.type);
31873     const isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES$1.includes(data.parentNode.type);
31874     return isFirstNode || isInlineNode || isInlineHTML;
31875   }
31876
31877   function shouldPrePrintDoubleHardline(node, data) {
31878     const isSequence = (data.prevNode && data.prevNode.type) === node.type;
31879     const isSiblingNode = isSequence && SIBLING_NODE_TYPES.includes(node.type);
31880     const isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose;
31881     const isPrevNodeLooseListItem = data.prevNode && data.prevNode.type === "listItem" && data.prevNode.loose;
31882     const isPrevNodePrettierIgnore = isPrettierIgnore$1(data.prevNode) === "next";
31883     const isBlockHtmlWithoutBlankLineBetweenPrevHtml = node.type === "html" && data.prevNode && data.prevNode.type === "html" && data.prevNode.position.end.line + 1 === node.position.start.line;
31884     const isHtmlDirectAfterListItem = node.type === "html" && data.parentNode.type === "listItem" && data.prevNode && data.prevNode.type === "paragraph" && data.prevNode.position.end.line + 1 === node.position.start.line;
31885     return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isHtmlDirectAfterListItem);
31886   }
31887
31888   function shouldPrePrintTripleHardline(node, data) {
31889     const isPrevNodeList = data.prevNode && data.prevNode.type === "list";
31890     const isIndentedCode = node.type === "code" && node.isIndented;
31891     return isPrevNodeList && isIndentedCode;
31892   }
31893
31894   function shouldRemainTheSameContent(path) {
31895     const ancestorNode = getAncestorNode$2(path, ["linkReference", "imageReference"]);
31896     return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full");
31897   }
31898
31899   function normalizeDoc(doc) {
31900     return mapDoc$5(doc, currentDoc => {
31901       if (!currentDoc.parts) {
31902         return currentDoc;
31903       }
31904
31905       if (currentDoc.type === "concat" && currentDoc.parts.length === 1) {
31906         return currentDoc.parts[0];
31907       }
31908
31909       const parts = currentDoc.parts.reduce((parts, part) => {
31910         if (part.type === "concat") {
31911           parts.push(...part.parts);
31912         } else if (part !== "") {
31913           parts.push(part);
31914         }
31915
31916         return parts;
31917       }, []);
31918       return Object.assign({}, currentDoc, {
31919         parts: normalizeParts$2(parts)
31920       });
31921     });
31922   }
31923
31924   function printUrl(url, dangerousCharOrChars) {
31925     const dangerousChars = [" "].concat(dangerousCharOrChars || []);
31926     return new RegExp(dangerousChars.map(x => "\\".concat(x)).join("|")).test(url) ? "<".concat(url, ">") : url;
31927   }
31928
31929   function printTitle(title, options, printSpace) {
31930     if (printSpace == null) {
31931       printSpace = true;
31932     }
31933
31934     if (!title) {
31935       return "";
31936     }
31937
31938     if (printSpace) {
31939       return " " + printTitle(title, options, false);
31940     }
31941
31942     if (title.includes('"') && title.includes("'") && !title.includes(")")) {
31943       return "(".concat(title, ")"); // avoid escaped quotes
31944     } // faster than using RegExps: https://jsperf.com/performance-of-match-vs-split
31945
31946
31947     const singleCount = title.split("'").length - 1;
31948     const doubleCount = title.split('"').length - 1;
31949     const quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"';
31950     title = title.replace(new RegExp("(".concat(quote, ")"), "g"), "\\$1");
31951     return "".concat(quote).concat(title).concat(quote);
31952   }
31953
31954   function normalizeParts$2(parts) {
31955     return parts.reduce((current, part) => {
31956       const lastPart = util$1.getLast(current);
31957
31958       if (typeof lastPart === "string" && typeof part === "string") {
31959         current.splice(-1, 1, lastPart + part);
31960       } else {
31961         current.push(part);
31962       }
31963
31964       return current;
31965     }, []);
31966   }
31967
31968   function clamp(value, min, max) {
31969     return value < min ? min : value > max ? max : value;
31970   }
31971
31972   function clean$6(ast, newObj, parent) {
31973     delete newObj.position;
31974     delete newObj.raw; // front-matter
31975     // for codeblock
31976
31977     if (ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") {
31978       delete newObj.value;
31979     }
31980
31981     if (ast.type === "list") {
31982       delete newObj.isAligned;
31983     } // texts can be splitted or merged
31984
31985
31986     if (ast.type === "text") {
31987       return null;
31988     }
31989
31990     if (ast.type === "inlineCode") {
31991       newObj.value = ast.value.replace(/[ \t\n]+/g, " ");
31992     } // for insert pragma
31993
31994
31995     if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || (parent.children[0].type === "yaml" || parent.children[0].type === "toml") && parent.children[1] === ast) && ast.type === "html" && pragma$4.startWithPragma(ast.value)) {
31996       return null;
31997     }
31998   }
31999
32000   function hasPrettierIgnore$6(path) {
32001     const index = +path.getName();
32002
32003     if (index === 0) {
32004       return false;
32005     }
32006
32007     const prevNode = path.getParentNode().children[index - 1];
32008     return isPrettierIgnore$1(prevNode) === "next";
32009   }
32010
32011   var printerMarkdown = {
32012     preprocess: preprocess_1$2,
32013     print: genericPrint$5,
32014     embed: embed_1$2,
32015     massageAstNode: clean$6,
32016     hasPrettierIgnore: hasPrettierIgnore$6,
32017     insertPragma: pragma$4.insertPragma
32018   };
32019
32020   var options$6 = {
32021     proseWrap: commonOptions.proseWrap,
32022     singleQuote: commonOptions.singleQuote
32023   };
32024
32025   var name$g = "Markdown";
32026   var type$f = "prose";
32027   var aliases$5 = [
32028         "pandoc"
32029   ];
32030   var aceMode$f = "markdown";
32031   var codemirrorMode$b = "gfm";
32032   var codemirrorMimeType$b = "text/x-gfm";
32033   var wrap = true;
32034   var extensions$f = [
32035         ".md",
32036         ".markdown",
32037         ".mdown",
32038         ".mdwn",
32039         ".mdx",
32040         ".mkd",
32041         ".mkdn",
32042         ".mkdown",
32043         ".ronn",
32044         ".workbook"
32045   ];
32046   var filenames$3 = [
32047         "contents.lr"
32048   ];
32049   var tmScope$f = "source.gfm";
32050   var languageId$f = 222;
32051   var Markdown = {
32052         name: name$g,
32053         type: type$f,
32054         aliases: aliases$5,
32055         aceMode: aceMode$f,
32056         codemirrorMode: codemirrorMode$b,
32057         codemirrorMimeType: codemirrorMimeType$b,
32058         wrap: wrap,
32059         extensions: extensions$f,
32060         filenames: filenames$3,
32061         tmScope: tmScope$f,
32062         languageId: languageId$f
32063   };
32064
32065   var Markdown$1 = /*#__PURE__*/Object.freeze({
32066     __proto__: null,
32067     name: name$g,
32068     type: type$f,
32069     aliases: aliases$5,
32070     aceMode: aceMode$f,
32071     codemirrorMode: codemirrorMode$b,
32072     codemirrorMimeType: codemirrorMimeType$b,
32073     wrap: wrap,
32074     extensions: extensions$f,
32075     filenames: filenames$3,
32076     tmScope: tmScope$f,
32077     languageId: languageId$f,
32078     'default': Markdown
32079   });
32080
32081   var require$$0$7 = getCjsExportFromNamespace(Markdown$1);
32082
32083   const languages$5 = [createLanguage(require$$0$7, data => ({
32084     since: "1.8.0",
32085     parsers: ["markdown"],
32086     vscodeLanguageIds: ["markdown"],
32087     filenames: data.filenames.concat(["README"]),
32088     extensions: data.extensions.filter(extension => extension !== ".mdx")
32089   })), createLanguage(require$$0$7, () => ({
32090     name: "MDX",
32091     since: "1.15.0",
32092     parsers: ["mdx"],
32093     vscodeLanguageIds: ["mdx"],
32094     filenames: [],
32095     extensions: [".mdx"]
32096   }))];
32097   const printers$5 = {
32098     mdast: printerMarkdown
32099   };
32100   var languageMarkdown = {
32101     languages: languages$5,
32102     options: options$6,
32103     printers: printers$5
32104   };
32105
32106   function isPragma(text) {
32107     return /^\s*@(prettier|format)\s*$/.test(text);
32108   }
32109
32110   function hasPragma$4(text) {
32111     return /^\s*#[^\n\S]*@(prettier|format)\s*?(\n|$)/.test(text);
32112   }
32113
32114   function insertPragma$8(text) {
32115     return "# @format\n\n".concat(text);
32116   }
32117
32118   var pragma$5 = {
32119     isPragma,
32120     hasPragma: hasPragma$4,
32121     insertPragma: insertPragma$8
32122   };
32123
32124   const {
32125     getLast: getLast$5
32126   } = util$1;
32127
32128   function getAncestorCount(path, filter) {
32129     let counter = 0;
32130     const pathStackLength = path.stack.length - 1;
32131
32132     for (let i = 0; i < pathStackLength; i++) {
32133       const value = path.stack[i];
32134
32135       if (isNode(value) && filter(value)) {
32136         counter++;
32137       }
32138     }
32139
32140     return counter;
32141   }
32142   /**
32143    * @param {any} value
32144    * @param {string[]=} types
32145    */
32146
32147
32148   function isNode(value, types) {
32149     return value && typeof value.type === "string" && (!types || types.includes(value.type));
32150   }
32151
32152   function mapNode(node, callback, parent) {
32153     return callback("children" in node ? Object.assign({}, node, {
32154       children: node.children.map(childNode => mapNode(childNode, callback, node))
32155     }) : node, parent);
32156   }
32157
32158   function defineShortcut(x, key, getter) {
32159     Object.defineProperty(x, key, {
32160       get: getter,
32161       enumerable: false
32162     });
32163   }
32164
32165   function isNextLineEmpty$5(node, text) {
32166     let newlineCount = 0;
32167     const textLength = text.length;
32168
32169     for (let i = node.position.end.offset - 1; i < textLength; i++) {
32170       const char = text[i];
32171
32172       if (char === "\n") {
32173         newlineCount++;
32174       }
32175
32176       if (newlineCount === 1 && /\S/.test(char)) {
32177         return false;
32178       }
32179
32180       if (newlineCount === 2) {
32181         return true;
32182       }
32183     }
32184
32185     return false;
32186   }
32187
32188   function isLastDescendantNode(path) {
32189     const node = path.getValue();
32190
32191     switch (node.type) {
32192       case "tag":
32193       case "anchor":
32194       case "comment":
32195         return false;
32196     }
32197
32198     const pathStackLength = path.stack.length;
32199
32200     for (let i = 1; i < pathStackLength; i++) {
32201       const item = path.stack[i];
32202       const parentItem = path.stack[i - 1];
32203
32204       if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
32205         return false;
32206       }
32207     }
32208
32209     return true;
32210   }
32211
32212   function getLastDescendantNode$1(node) {
32213     return "children" in node && node.children.length !== 0 ? getLastDescendantNode$1(getLast$5(node.children)) : node;
32214   }
32215
32216   function isPrettierIgnore$2(comment) {
32217     return comment.value.trim() === "prettier-ignore";
32218   }
32219
32220   function hasPrettierIgnore$7(path) {
32221     const node = path.getValue();
32222
32223     if (node.type === "documentBody") {
32224       const document = path.getParentNode();
32225       return hasEndComments(document.head) && isPrettierIgnore$2(getLast$5(document.head.endComments));
32226     }
32227
32228     return hasLeadingComments(node) && isPrettierIgnore$2(getLast$5(node.leadingComments));
32229   }
32230
32231   function isEmptyNode(node) {
32232     return (!node.children || node.children.length === 0) && !hasComments(node);
32233   }
32234
32235   function hasComments(node) {
32236     return hasLeadingComments(node) || hasMiddleComments(node) || hasIndicatorComment(node) || hasTrailingComment$2(node) || hasEndComments(node);
32237   }
32238
32239   function hasLeadingComments(node) {
32240     return node && node.leadingComments && node.leadingComments.length !== 0;
32241   }
32242
32243   function hasMiddleComments(node) {
32244     return node && node.middleComments && node.middleComments.length !== 0;
32245   }
32246
32247   function hasIndicatorComment(node) {
32248     return node && node.indicatorComment;
32249   }
32250
32251   function hasTrailingComment$2(node) {
32252     return node && node.trailingComment;
32253   }
32254
32255   function hasEndComments(node) {
32256     return node && node.endComments && node.endComments.length !== 0;
32257   }
32258   /**
32259    * " a   b c   d e   f " -> [" a   b", "c   d", "e   f "]
32260    */
32261
32262
32263   function splitWithSingleSpace(text) {
32264     const parts = [];
32265     let lastPart = undefined;
32266
32267     for (const part of text.split(/( +)/g)) {
32268       if (part !== " ") {
32269         if (lastPart === " ") {
32270           parts.push(part);
32271         } else {
32272           parts.push((parts.pop() || "") + part);
32273         }
32274       } else if (lastPart === undefined) {
32275         parts.unshift("");
32276       }
32277
32278       lastPart = part;
32279     }
32280
32281     if (lastPart === " ") {
32282       parts.push((parts.pop() || "") + " ");
32283     }
32284
32285     if (parts[0] === "") {
32286       parts.shift();
32287       parts.unshift(" " + (parts.shift() || ""));
32288     }
32289
32290     return parts;
32291   }
32292
32293   function getFlowScalarLineContents(nodeType, content, options) {
32294     const rawLineContents = content.split("\n").map((lineContent, index, lineContents) => index === 0 && index === lineContents.length - 1 ? lineContent : index !== 0 && index !== lineContents.length - 1 ? lineContent.trim() : index === 0 ? lineContent.trimEnd() : lineContent.trimStart());
32295
32296     if (options.proseWrap === "preserve") {
32297       return rawLineContents.map(lineContent => lineContent.length === 0 ? [] : [lineContent]);
32298     }
32299
32300     return rawLineContents.map(lineContent => lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent)).reduce((reduced, lineContentWords, index) => index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !( // trailing backslash in quoteDouble should be preserved
32301     nodeType === "quoteDouble" && getLast$5(getLast$5(reduced)).endsWith("\\")) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]), []).map(lineContentWords => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords);
32302   }
32303
32304   function getBlockValueLineContents(node, {
32305     parentIndent,
32306     isLastDescendant,
32307     options
32308   }) {
32309     const content = node.position.start.line === node.position.end.line ? "" : options.originalText.slice(node.position.start.offset, node.position.end.offset) // exclude open line `>` or `|`
32310     .match(/^[^\n]*?\n([\s\S]*)$/)[1];
32311     const leadingSpaceCount = node.indent === null ? (match => match ? match[1].length : Infinity)(content.match(/^( *)\S/m)) : node.indent - 1 + parentIndent;
32312     const rawLineContents = content.split("\n").map(lineContent => lineContent.slice(leadingSpaceCount));
32313
32314     if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
32315       return removeUnnecessaryTrailingNewlines(rawLineContents.map(lineContent => lineContent.length === 0 ? [] : [lineContent]));
32316     }
32317
32318     return removeUnnecessaryTrailingNewlines(rawLineContents.map(lineContent => lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent)).reduce((reduced, lineContentWords, index) => index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast$5(reduced)) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]), []).map(lineContentWords => lineContentWords.reduce((reduced, word) => // disallow trailing spaces
32319     reduced.length !== 0 && /\s$/.test(getLast$5(reduced)) ? reduced.concat(reduced.pop() + " " + word) : reduced.concat(word), [])).map(lineContentWords => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords));
32320
32321     function removeUnnecessaryTrailingNewlines(lineContents) {
32322       if (node.chomping === "keep") {
32323         return getLast$5(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
32324       }
32325
32326       let trailingNewlineCount = 0;
32327
32328       for (let i = lineContents.length - 1; i >= 0; i--) {
32329         if (lineContents[i].length === 0) {
32330           trailingNewlineCount++;
32331         } else {
32332           break;
32333         }
32334       }
32335
32336       return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? // next empty line
32337       lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
32338     }
32339   }
32340
32341   var utils$7 = {
32342     getLast: getLast$5,
32343     getAncestorCount,
32344     isNode,
32345     isEmptyNode,
32346     mapNode,
32347     defineShortcut,
32348     isNextLineEmpty: isNextLineEmpty$5,
32349     isLastDescendantNode,
32350     getBlockValueLineContents,
32351     getFlowScalarLineContents,
32352     getLastDescendantNode: getLastDescendantNode$1,
32353     hasPrettierIgnore: hasPrettierIgnore$7,
32354     hasLeadingComments,
32355     hasMiddleComments,
32356     hasIndicatorComment,
32357     hasTrailingComment: hasTrailingComment$2,
32358     hasEndComments
32359   };
32360
32361   const {
32362     insertPragma: insertPragma$9,
32363     isPragma: isPragma$1
32364   } = pragma$5;
32365   const {
32366     getAncestorCount: getAncestorCount$1,
32367     getBlockValueLineContents: getBlockValueLineContents$1,
32368     getFlowScalarLineContents: getFlowScalarLineContents$1,
32369     getLast: getLast$6,
32370     getLastDescendantNode: getLastDescendantNode$2,
32371     hasLeadingComments: hasLeadingComments$1,
32372     hasMiddleComments: hasMiddleComments$1,
32373     hasIndicatorComment: hasIndicatorComment$1,
32374     hasTrailingComment: hasTrailingComment$3,
32375     hasEndComments: hasEndComments$1,
32376     hasPrettierIgnore: hasPrettierIgnore$8,
32377     isLastDescendantNode: isLastDescendantNode$1,
32378     isNextLineEmpty: isNextLineEmpty$6,
32379     isNode: isNode$1,
32380     isEmptyNode: isEmptyNode$1,
32381     defineShortcut: defineShortcut$1,
32382     mapNode: mapNode$1
32383   } = utils$7;
32384   const docBuilders$2 = document.builders;
32385   const {
32386     conditionalGroup: conditionalGroup$2,
32387     breakParent: breakParent$5,
32388     concat: concat$h,
32389     dedent: dedent$3,
32390     dedentToRoot: dedentToRoot$3,
32391     fill: fill$6,
32392     group: group$g,
32393     hardline: hardline$d,
32394     ifBreak: ifBreak$8,
32395     join: join$c,
32396     line: line$b,
32397     lineSuffix: lineSuffix$2,
32398     literalline: literalline$7,
32399     markAsRoot: markAsRoot$5,
32400     softline: softline$8
32401   } = docBuilders$2;
32402   const {
32403     replaceEndOfLineWith: replaceEndOfLineWith$3
32404   } = util$1;
32405
32406   function preprocess$3(ast) {
32407     return mapNode$1(ast, defineShortcuts);
32408   }
32409
32410   function defineShortcuts(node) {
32411     switch (node.type) {
32412       case "document":
32413         defineShortcut$1(node, "head", () => node.children[0]);
32414         defineShortcut$1(node, "body", () => node.children[1]);
32415         break;
32416
32417       case "documentBody":
32418       case "sequenceItem":
32419       case "flowSequenceItem":
32420       case "mappingKey":
32421       case "mappingValue":
32422         defineShortcut$1(node, "content", () => node.children[0]);
32423         break;
32424
32425       case "mappingItem":
32426       case "flowMappingItem":
32427         defineShortcut$1(node, "key", () => node.children[0]);
32428         defineShortcut$1(node, "value", () => node.children[1]);
32429         break;
32430     }
32431
32432     return node;
32433   }
32434
32435   function genericPrint$6(path, options, print) {
32436     const node = path.getValue();
32437     const parentNode = path.getParentNode();
32438     const tag = !node.tag ? "" : path.call(print, "tag");
32439     const anchor = !node.anchor ? "" : path.call(print, "anchor");
32440     const nextEmptyLine = isNode$1(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode$1(path) ? printNextEmptyLine(path, options.originalText) : "";
32441     return concat$h([node.type !== "mappingValue" && hasLeadingComments$1(node) ? concat$h([join$c(hardline$d, path.map(print, "leadingComments")), hardline$d]) : "", tag, tag && anchor ? " " : "", anchor, tag || anchor ? isNode$1(node, ["sequence", "mapping"]) && !hasMiddleComments$1(node) ? hardline$d : " " : "", hasMiddleComments$1(node) ? concat$h([node.middleComments.length === 1 ? "" : hardline$d, join$c(hardline$d, path.map(print, "middleComments")), hardline$d]) : "", hasPrettierIgnore$8(path) ? concat$h(replaceEndOfLineWith$3(options.originalText.slice(node.position.start.offset, node.position.end.offset), literalline$7)) : group$g(_print(node, parentNode, path, options, print)), hasTrailingComment$3(node) && !isNode$1(node, ["document", "documentHead"]) ? lineSuffix$2(concat$h([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent$5, path.call(print, "trailingComment")])) : "", nextEmptyLine, hasEndComments$1(node) && !isNode$1(node, ["documentHead", "documentBody"]) ? align$3(node.type === "sequenceItem" ? 2 : 0, concat$h([hardline$d, join$c(hardline$d, path.map(print, "endComments"))])) : ""]);
32442   }
32443
32444   function _print(node, parentNode, path, options, print) {
32445     switch (node.type) {
32446       case "root":
32447         return concat$h([join$c(hardline$d, path.map((childPath, index) => {
32448           const document = node.children[index];
32449           const nextDocument = node.children[index + 1];
32450           return concat$h([print(childPath), shouldPrintDocumentEndMarker(document, nextDocument) ? concat$h([hardline$d, "...", hasTrailingComment$3(document) ? concat$h([" ", path.call(print, "trailingComment")]) : ""]) : !nextDocument || hasTrailingComment$3(nextDocument.head) ? "" : concat$h([hardline$d, "---"])]);
32451         }, "children")), node.children.length === 0 || (lastDescendantNode => isNode$1(lastDescendantNode, ["blockLiteral", "blockFolded"]) && lastDescendantNode.chomping === "keep")(getLastDescendantNode$2(node)) ? "" : hardline$d]);
32452
32453       case "document":
32454         {
32455           const nextDocument = parentNode.children[path.getName() + 1];
32456           return join$c(hardline$d, [shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head" ? join$c(hardline$d, [node.head.children.length === 0 && node.head.endComments.length === 0 ? "" : path.call(print, "head"), concat$h(["---", hasTrailingComment$3(node.head) ? concat$h([" ", path.call(print, "head", "trailingComment")]) : ""])].filter(Boolean)) : "", shouldPrintDocumentBody(node) ? path.call(print, "body") : ""].filter(Boolean));
32457         }
32458
32459       case "documentHead":
32460         return join$c(hardline$d, [].concat(path.map(print, "children"), path.map(print, "endComments")));
32461
32462       case "documentBody":
32463         {
32464           const children = join$c(hardline$d, path.map(print, "children")).parts;
32465           const endComments = join$c(hardline$d, path.map(print, "endComments")).parts;
32466           const separator = children.length === 0 || endComments.length === 0 ? "" : (lastDescendantNode => isNode$1(lastDescendantNode, ["blockFolded", "blockLiteral"]) ? lastDescendantNode.chomping === "keep" ? // there's already a newline printed at the end of blockValue (chomping=keep, lastDescendant=true)
32467           "" : // an extra newline for better readability
32468           concat$h([hardline$d, hardline$d]) : hardline$d)(getLastDescendantNode$2(node));
32469           return concat$h([].concat(children, separator, endComments));
32470         }
32471
32472       case "directive":
32473         return concat$h(["%", join$c(" ", [node.name].concat(node.parameters))]);
32474
32475       case "comment":
32476         return concat$h(["#", node.value]);
32477
32478       case "alias":
32479         return concat$h(["*", node.value]);
32480
32481       case "tag":
32482         return options.originalText.slice(node.position.start.offset, node.position.end.offset);
32483
32484       case "anchor":
32485         return concat$h(["&", node.value]);
32486
32487       case "plain":
32488         return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
32489
32490       case "quoteDouble":
32491       case "quoteSingle":
32492         {
32493           const singleQuote = "'";
32494           const doubleQuote = '"';
32495           const raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
32496
32497           if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
32498             // only quoteDouble can use escape chars
32499             // and quoteSingle do not need to escape backslashes
32500             const originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
32501             return concat$h([originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote]);
32502           } else if (raw.includes(doubleQuote)) {
32503             return concat$h([singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw // double quote needs to be escaped by backslash in quoteDouble
32504             .replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote]);
32505           }
32506
32507           if (raw.includes(singleQuote)) {
32508             return concat$h([doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? // single quote needs to be escaped by 2 single quotes in quoteSingle
32509             raw.replace(/''/g, singleQuote) : raw, options), doubleQuote]);
32510           }
32511
32512           const quote = options.singleQuote ? singleQuote : doubleQuote;
32513           return concat$h([quote, printFlowScalarContent(node.type, raw, options), quote]);
32514         }
32515
32516       case "blockFolded":
32517       case "blockLiteral":
32518         {
32519           const parentIndent = getAncestorCount$1(path, ancestorNode => isNode$1(ancestorNode, ["sequence", "mapping"]));
32520           const isLastDescendant = isLastDescendantNode$1(path);
32521           return concat$h([node.type === "blockFolded" ? ">" : "|", node.indent === null ? "" : node.indent.toString(), node.chomping === "clip" ? "" : node.chomping === "keep" ? "+" : "-", hasIndicatorComment$1(node) ? concat$h([" ", path.call(print, "indicatorComment")]) : "", (node.indent === null ? dedent$3 : dedentToRoot$3)(align$3(node.indent === null ? options.tabWidth : node.indent - 1 + parentIndent, concat$h(getBlockValueLineContents$1(node, {
32522             parentIndent,
32523             isLastDescendant,
32524             options
32525           }).reduce((reduced, lineWords, index, lineContents) => reduced.concat(index === 0 ? hardline$d : "", fill$6(join$c(line$b, lineWords).parts), index !== lineContents.length - 1 ? lineWords.length === 0 ? hardline$d : markAsRoot$5(literalline$7) : node.chomping === "keep" && isLastDescendant ? lineWords.length === 0 ? dedentToRoot$3(hardline$d) : dedentToRoot$3(literalline$7) : ""), []))))]);
32526         }
32527
32528       case "sequence":
32529         return join$c(hardline$d, path.map(print, "children"));
32530
32531       case "sequenceItem":
32532         return concat$h(["- ", align$3(2, !node.content ? "" : path.call(print, "content"))]);
32533
32534       case "mappingKey":
32535         return !node.content ? "" : path.call(print, "content");
32536
32537       case "mappingValue":
32538         return !node.content ? "" : path.call(print, "content");
32539
32540       case "mapping":
32541         return join$c(hardline$d, path.map(print, "children"));
32542
32543       case "mappingItem":
32544       case "flowMappingItem":
32545         {
32546           const isEmptyMappingKey = isEmptyNode$1(node.key);
32547           const isEmptyMappingValue = isEmptyNode$1(node.value);
32548
32549           if (isEmptyMappingKey && isEmptyMappingValue) {
32550             return concat$h([": "]);
32551           }
32552
32553           const key = path.call(print, "key");
32554           const value = path.call(print, "value");
32555
32556           if (isEmptyMappingValue) {
32557             return node.type === "flowMappingItem" && parentNode.type === "flowMapping" ? key : node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(node.key.content, options) && !hasTrailingComment$3(node.key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set") ? concat$h([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ":"]) : concat$h(["? ", align$3(2, key)]);
32558           }
32559
32560           if (isEmptyMappingKey) {
32561             return concat$h([": ", align$3(2, value)]);
32562           }
32563
32564           const groupId = Symbol("mappingKey");
32565           const forceExplicitKey = hasLeadingComments$1(node.value) || !isInlineNode(node.key.content);
32566           return forceExplicitKey ? concat$h(["? ", align$3(2, key), hardline$d, join$c("", path.map(print, "value", "leadingComments").map(comment => concat$h([comment, hardline$d]))), ": ", align$3(2, value)]) : // force singleline
32567           isSingleLineNode(node.key.content) && !hasLeadingComments$1(node.key.content) && !hasMiddleComments$1(node.key.content) && !hasTrailingComment$3(node.key.content) && !hasEndComments$1(node.key) && !hasLeadingComments$1(node.value.content) && !hasMiddleComments$1(node.value.content) && !hasEndComments$1(node.value) && isAbsolutelyPrintedAsSingleLineNode(node.value.content, options) ? concat$h([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ": ", value]) : conditionalGroup$2([concat$h([group$g(concat$h([ifBreak$8("? "), group$g(align$3(2, key), {
32568             id: groupId
32569           })])), ifBreak$8(concat$h([hardline$d, ": ", align$3(2, value)]), indent(concat$h([needsSpaceInFrontOfMappingValue(node) ? " " : "", ":", hasLeadingComments$1(node.value.content) || hasEndComments$1(node.value) && node.value.content && !isNode$1(node.value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment$3(node.key.content) && isInlineNode(node.value.content) || isNode$1(node.value.content, ["mapping", "sequence"]) && node.value.content.tag === null && node.value.content.anchor === null ? hardline$d : !node.value.content ? "" : line$b, value])), {
32570             groupId
32571           })])]);
32572         }
32573
32574       case "flowMapping":
32575       case "flowSequence":
32576         {
32577           const openMarker = node.type === "flowMapping" ? "{" : "[";
32578           const closeMarker = node.type === "flowMapping" ? "}" : "]";
32579           const bracketSpacing = node.type === "flowMapping" && node.children.length !== 0 && options.bracketSpacing ? line$b : softline$8;
32580
32581           const isLastItemEmptyMappingItem = node.children.length !== 0 && (lastItem => lastItem.type === "flowMappingItem" && isEmptyNode$1(lastItem.key) && isEmptyNode$1(lastItem.value))(getLast$6(node.children));
32582
32583           return concat$h([openMarker, indent(concat$h([bracketSpacing, concat$h(path.map((childPath, index) => concat$h([print(childPath), index === node.children.length - 1 ? "" : concat$h([",", line$b, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine(childPath, options.originalText) : ""])]), "children")), ifBreak$8(",", "")])), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker]);
32584         }
32585
32586       case "flowSequenceItem":
32587         return path.call(print, "content");
32588       // istanbul ignore next
32589
32590       default:
32591         throw new Error("Unexpected node type ".concat(node.type));
32592     }
32593
32594     function indent(doc) {
32595       return docBuilders$2.align(" ".repeat(options.tabWidth), doc);
32596     }
32597   }
32598
32599   function align$3(n, doc) {
32600     return typeof n === "number" && n > 0 ? docBuilders$2.align(" ".repeat(n), doc) : docBuilders$2.align(n, doc);
32601   }
32602
32603   function isInlineNode(node) {
32604     if (!node) {
32605       return true;
32606     }
32607
32608     switch (node.type) {
32609       case "plain":
32610       case "quoteDouble":
32611       case "quoteSingle":
32612       case "alias":
32613       case "flowMapping":
32614       case "flowSequence":
32615         return true;
32616
32617       default:
32618         return false;
32619     }
32620   }
32621
32622   function isSingleLineNode(node) {
32623     if (!node) {
32624       return true;
32625     }
32626
32627     switch (node.type) {
32628       case "plain":
32629       case "quoteDouble":
32630       case "quoteSingle":
32631         return node.position.start.line === node.position.end.line;
32632
32633       case "alias":
32634         return true;
32635
32636       default:
32637         return false;
32638     }
32639   }
32640
32641   function shouldPrintDocumentBody(document) {
32642     return document.body.children.length !== 0 || hasEndComments$1(document.body);
32643   }
32644
32645   function shouldPrintDocumentEndMarker(document, nextDocument) {
32646     return (
32647       /**
32648        *... # trailingComment
32649        */
32650       hasTrailingComment$3(document) || nextDocument && (
32651       /**
32652        * ...
32653        * %DIRECTIVE
32654        * ---
32655        */
32656       nextDocument.head.children.length !== 0 ||
32657       /**
32658        * ...
32659        * # endComment
32660        * ---
32661        */
32662       hasEndComments$1(nextDocument.head))
32663     );
32664   }
32665
32666   function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
32667     if (
32668     /**
32669      * ---
32670      * preserve the first document head end marker
32671      */
32672     root.children[0] === document && /---(\s|$)/.test(options.originalText.slice(options.locStart(document), options.locStart(document) + 4)) ||
32673     /**
32674      * %DIRECTIVE
32675      * ---
32676      */
32677     document.head.children.length !== 0 ||
32678     /**
32679      * # end comment
32680      * ---
32681      */
32682     hasEndComments$1(document.head) ||
32683     /**
32684      * --- # trailing comment
32685      */
32686     hasTrailingComment$3(document.head)) {
32687       return "head";
32688     }
32689
32690     if (shouldPrintDocumentEndMarker(document, nextDocument)) {
32691       return false;
32692     }
32693
32694     return nextDocument ? "root" : false;
32695   }
32696
32697   function isAbsolutelyPrintedAsSingleLineNode(node, options) {
32698     if (!node) {
32699       return true;
32700     }
32701
32702     switch (node.type) {
32703       case "plain":
32704       case "quoteSingle":
32705       case "quoteDouble":
32706         break;
32707
32708       case "alias":
32709         return true;
32710
32711       default:
32712         return false;
32713     }
32714
32715     if (options.proseWrap === "preserve") {
32716       return node.position.start.line === node.position.end.line;
32717     }
32718
32719     if ( // backslash-newline
32720     /\\$/m.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
32721       return false;
32722     }
32723
32724     switch (options.proseWrap) {
32725       case "never":
32726         return !node.value.includes("\n");
32727
32728       case "always":
32729         return !/[\n ]/.test(node.value);
32730       // istanbul ignore next
32731
32732       default:
32733         return false;
32734     }
32735   }
32736
32737   function needsSpaceInFrontOfMappingValue(node) {
32738     return node.key.content && node.key.content.type === "alias";
32739   }
32740
32741   function printNextEmptyLine(path, originalText) {
32742     const node = path.getValue();
32743     const root = path.stack[0];
32744     root.isNextEmptyLinePrintedChecklist = root.isNextEmptyLinePrintedChecklist || [];
32745
32746     if (!root.isNextEmptyLinePrintedChecklist[node.position.end.line]) {
32747       if (isNextLineEmpty$6(node, originalText)) {
32748         root.isNextEmptyLinePrintedChecklist[node.position.end.line] = true;
32749         return softline$8;
32750       }
32751     }
32752
32753     return "";
32754   }
32755
32756   function printFlowScalarContent(nodeType, content, options) {
32757     const lineContents = getFlowScalarLineContents$1(nodeType, content, options);
32758     return join$c(hardline$d, lineContents.map(lineContentWords => fill$6(join$c(line$b, lineContentWords).parts)));
32759   }
32760
32761   function clean$7(node, newNode
32762   /*, parent */
32763   ) {
32764     if (isNode$1(newNode)) {
32765       delete newNode.position;
32766
32767       switch (newNode.type) {
32768         case "comment":
32769           // insert pragma
32770           if (isPragma$1(newNode.value)) {
32771             return null;
32772           }
32773
32774           break;
32775
32776         case "quoteDouble":
32777         case "quoteSingle":
32778           newNode.type = "quote";
32779           break;
32780       }
32781     }
32782   }
32783
32784   var printerYaml = {
32785     preprocess: preprocess$3,
32786     print: genericPrint$6,
32787     massageAstNode: clean$7,
32788     insertPragma: insertPragma$9
32789   };
32790
32791   var options$7 = {
32792     bracketSpacing: commonOptions.bracketSpacing,
32793     singleQuote: commonOptions.singleQuote,
32794     proseWrap: commonOptions.proseWrap
32795   };
32796
32797   var name$h = "YAML";
32798   var type$g = "data";
32799   var tmScope$g = "source.yaml";
32800   var aliases$6 = [
32801         "yml"
32802   ];
32803   var extensions$g = [
32804         ".yml",
32805         ".mir",
32806         ".reek",
32807         ".rviz",
32808         ".sublime-syntax",
32809         ".syntax",
32810         ".yaml",
32811         ".yaml-tmlanguage",
32812         ".yaml.sed",
32813         ".yml.mysql"
32814   ];
32815   var filenames$4 = [
32816         ".clang-format",
32817         ".clang-tidy",
32818         ".gemrc",
32819         "glide.lock",
32820         "yarn.lock"
32821   ];
32822   var aceMode$g = "yaml";
32823   var codemirrorMode$c = "yaml";
32824   var codemirrorMimeType$c = "text/x-yaml";
32825   var languageId$g = 407;
32826   var YAML = {
32827         name: name$h,
32828         type: type$g,
32829         tmScope: tmScope$g,
32830         aliases: aliases$6,
32831         extensions: extensions$g,
32832         filenames: filenames$4,
32833         aceMode: aceMode$g,
32834         codemirrorMode: codemirrorMode$c,
32835         codemirrorMimeType: codemirrorMimeType$c,
32836         languageId: languageId$g
32837   };
32838
32839   var YAML$1 = /*#__PURE__*/Object.freeze({
32840     __proto__: null,
32841     name: name$h,
32842     type: type$g,
32843     tmScope: tmScope$g,
32844     aliases: aliases$6,
32845     extensions: extensions$g,
32846     filenames: filenames$4,
32847     aceMode: aceMode$g,
32848     codemirrorMode: codemirrorMode$c,
32849     codemirrorMimeType: codemirrorMimeType$c,
32850     languageId: languageId$g,
32851     'default': YAML
32852   });
32853
32854   var require$$0$8 = getCjsExportFromNamespace(YAML$1);
32855
32856   const languages$6 = [createLanguage(require$$0$8, data => ({
32857     since: "1.14.0",
32858     parsers: ["yaml"],
32859     vscodeLanguageIds: ["yaml"],
32860     // yarn.lock is not YAML: https://github.com/yarnpkg/yarn/issues/5629
32861     filenames: data.filenames.filter(filename => filename !== "yarn.lock")
32862   }))];
32863   var languageYaml = {
32864     languages: languages$6,
32865     printers: {
32866       yaml: printerYaml
32867     },
32868     options: options$7
32869   };
32870
32871   const {
32872     version: version$2
32873   } = require$$0;
32874   const {
32875     getSupportInfo: getSupportInfo$2
32876   } = support;
32877   const internalPlugins = [languageCss, languageGraphql, languageHandlebars, languageHtml, languageJs, languageMarkdown, languageYaml];
32878
32879   function withPlugins(fn, optsArgIdx = 1 // Usually `opts` is the 2nd argument
32880   ) {
32881     return (...args) => {
32882       const opts = args[optsArgIdx] || {};
32883       const plugins = opts.plugins || [];
32884       args[optsArgIdx] = Object.assign({}, opts, {
32885         plugins: [...internalPlugins, ...(Array.isArray(plugins) ? plugins : Object.values(plugins))]
32886       });
32887       return fn(...args);
32888     };
32889   }
32890
32891   const formatWithCursor = withPlugins(core.formatWithCursor);
32892   var standalone = {
32893     formatWithCursor,
32894
32895     format(text, opts) {
32896       return formatWithCursor(text, opts).formatted;
32897     },
32898
32899     check(text, opts) {
32900       const {
32901         formatted
32902       } = formatWithCursor(text, opts);
32903       return formatted === text;
32904     },
32905
32906     doc: document,
32907     getSupportInfo: withPlugins(getSupportInfo$2, 0),
32908     version: version$2,
32909     util: utilShared,
32910     __debug: {
32911       parse: withPlugins(core.parse),
32912       formatAST: withPlugins(core.formatAST),
32913       formatDoc: withPlugins(core.formatDoc),
32914       printToDoc: withPlugins(core.printToDoc),
32915       printDocToString: withPlugins(core.printDocToString)
32916     }
32917   };
32918
32919   var standalone$1 = standalone;
32920
32921   return standalone$1;
32922
32923 })));